From 1615c6150aca13c82ad09ccc1972c7262f100863 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 29 Mar 2022 13:08:00 -0600 Subject: [PATCH 001/245] Start on TypeScript-based styling system Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- .gitignore | 1 + styles/app.ts | 632 +++++++++++++++++++++++++++++++++++++++ styles/components.ts | 62 ++++ styles/core.ts | 38 +++ styles/package-lock.json | 28 ++ styles/package.json | 14 + styles/selector-modal.ts | 59 ++++ styles/theme.ts | 121 ++++++++ 8 files changed, 955 insertions(+) create mode 100644 styles/app.ts create mode 100644 styles/components.ts create mode 100644 styles/core.ts create mode 100644 styles/package-lock.json create mode 100644 styles/package.json create mode 100644 styles/selector-modal.ts create mode 100644 styles/theme.ts diff --git a/.gitignore b/.gitignore index e88434ce4e718285669691175d297842a3b16b33..140053fc2c507f788748b43136b1eaa5c52680da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /zed.xcworkspace .DS_Store /script/node_modules +/styles/node_modules /crates/server/.env.toml /crates/server/static/styles.css /vendor/bin diff --git a/styles/app.ts b/styles/app.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7ae4348bea1d2e0861d0d4a957cd6eb7a3c7adf --- /dev/null +++ b/styles/app.ts @@ -0,0 +1,632 @@ +import { selectorModal } from "./selector-modal"; +import Theme from "./theme"; + +export default function app(theme: Theme): Object { + return { + selector: selectorModal(theme), + workspace: { + background: "$surface.500", + leaderBorderOpacity: 0.7, + leader_border_width: 2.0, + active_tab: { + background: "$surface.300", + extends: "$workspace.tab", + text: "$text.primary", + border: { + bottom: false, + }, + }, + left_sidebar: { + extends: "$workspace.sidebar", + border: { + color: "$border.primary", + right: true, + width: 1, + }, + }, + pane_divider: { + color: "$border.primary", + width: 1, + }, + right_sidebar: { + extends: "$workspace.sidebar", + border: { + color: "$border.primary", + left: true, + width: 1, + }, + }, + sidebar: { + width: 30, + active_item: { + extends: "$workspace.sidebar.item", + icon_color: "$text.primary.color", + }, + border: { + color: "$border.primary", + right: true, + width: 1, + }, + item: { + height: "$workspace.tab.height", + icon_color: "$text.muted.color", + icon_size: 18, + }, + resize_handle: { + background: "$border.primary", + padding: { + left: 1, + }, + }, + }, + status_bar: { + cursor_position: "$text.muted", + diagnostic_message: "$text.muted", + height: 24, + item_spacing: 8, + lsp_message: "$text.muted", + padding: { + left: 6, + right: 6, + }, + }, + tab: { + height: 34, + icon_close: "$text.muted.color", + icon_close_active: "$text.primary.color", + icon_conflict: "$status.warn", + icon_dirty: "$status.info", + icon_width: 8, + spacing: 10, + text: "$text.muted", + border: { + bottom: true, + color: "$border.primary", + left: true, + overlay: true, + width: 1, + }, + padding: { + left: 12, + right: 12, + }, + }, + titlebar: { + avatar_width: 18, + height: 32, + share_icon_active_color: "$text.primary.color", + share_icon_color: "$text.muted.color", + title: "$text.primary", + avatar: { + corner_radius: 10, + border: { + color: "#00000088", + width: 1, + }, + }, + avatar_ribbon: { + background: "#ff0000", + height: 3, + width: 12, + }, + border: { + bottom: true, + color: "$border.primary", + width: 1, + }, + hovered_sign_in_prompt: { + color: "$text.secondary.color", + extends: "$workspace.titlebar.sign_in_prompt", + }, + offline_icon: { + color: "$text.muted.color", + width: 16, + padding: { + right: 4, + }, + }, + outdated_warning: { + extends: "$text.muted", + size: 13, + }, + sign_in_prompt: { + extends: "$text.muted", + size: 13, + underline: true, + padding: { + right: 8, + }, + }, + }, + toolbar: { + height: 44, + }, + }, + chat_panel: { + extends: "$panel", + channel_name: { + extends: "$text.primary", + weight: "bold", + }, + channel_name_hash: { + text: "$text.muted", + padding: { + right: 8, + }, + }, + channel_select: { + active_item: { + extends: "$chat_panel.channel_select.item", + name: "$text.primary", + }, + header: { + extends: "$chat_panel.channel_select.active_item", + padding: { + bottom: 4, + left: 0, + }, + }, + hovered_active_item: { + extends: "$chat_panel.channel_select.hovered_item", + name: "$text.primary", + }, + hovered_item: { + background: "$state.hover", + corner_radius: 6, + extends: "$chat_panel.channel_select.item", + }, + item: { + name: "$text.secondary", + padding: 4, + hash: { + extends: "$text.muted", + margin: { + right: 8, + }, + }, + }, + menu: { + background: "$surface.500", + corner_radius: 6, + padding: 4, + border: { + color: "$border.primary", + width: 1, + }, + shadow: { + blur: 16, + color: "$shadow.0", + offset: [0, 2], + }, + }, + }, + hovered_sign_in_prompt: { + color: "$text.secondary.color", + extends: "$chat_panel.sign_in_prompt", + }, + input_editor: { + background: "$surface.300", + corner_radius: 6, + placeholder_text: "$text.muted", + selection: "$selection.host", + text: "$text.primary", + border: { + color: "$border.primary", + width: 1, + }, + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + message: { + body: "$text.secondary", + timestamp: "$text.muted", + padding: { + bottom: 6, + }, + sender: { + extends: "$text.primary", + weight: "bold", + margin: { + right: 8, + }, + }, + }, + pending_message: { + extends: "$chat_panel.message", + body: { + color: "$text.muted.color", + }, + sender: { + color: "$text.muted.color", + }, + timestamp: { + color: "$text.muted.color", + }, + }, + sign_in_prompt: { + extends: "$text.primary", + underline: true, + }, + }, + contacts_panel: { + extends: "$panel", + host_row_height: 28, + tree_branch_color: "$surface.100", + tree_branch_width: 1, + host_avatar: { + corner_radius: 10, + width: 18, + }, + host_username: { + extends: "$text.primary", + padding: { + left: 8, + }, + }, + hovered_shared_project: { + background: "$state.hover", + corner_radius: 6, + extends: "$contacts_panel.shared_project", + }, + hovered_unshared_project: { + background: "$state.hover", + corner_radius: 6, + extends: "$contacts_panel.unshared_project", + }, + project: { + guest_avatar_spacing: 4, + height: 24, + guest_avatar: { + corner_radius: 8, + width: 14, + }, + name: { + extends: "$text.secondary", + margin: { + right: 6, + }, + }, + padding: { + left: 8, + }, + }, + shared_project: { + extends: "$contacts_panel.project", + name: { + color: "$text.primary.color", + }, + }, + unshared_project: { + extends: "$contacts_panel.project", + }, + }, + editor: { + active_line_background: "$state.active_line", + background: "$surface.300", + code_actions_indicator: "$text.muted.color", + diff_background_deleted: "$state.deleted_line", + diff_background_inserted: "$state.inserted_line", + document_highlight_read_background: "#99999920", + document_highlight_write_background: "#99999916", + error_color: "$status.bad", + guest_selections: "$selection.guests", + gutter_background: "$surface.300", + gutter_padding_factor: 2.5, + highlighted_line_background: "$state.highlighted_line", + line_number: "$text.muted.color", + line_number_active: "$text.primary.color", + rename_fade: 0.6, + selection: "$selection.host", + text_color: "$text.secondary.color", + unnecessary_code_fade: 0.5, + autocomplete: { + background: "$surface.100", + corner_radius: 6, + padding: 6, + border: { + color: "$border.secondary", + width: 2, + }, + hovered_item: { + background: "$state.hover", + extends: "$editor.autocomplete.item", + }, + item: { + corner_radius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, + }, + margin: { + left: -14, + }, + match_highlight: { + color: "$editor.syntax.keyword.color", + weight: "$editor.syntax.keyword.weight", + }, + selected_item: { + background: "$state.selected", + extends: "$editor.autocomplete.item", + }, + }, + diagnostic_header: { + background: "$editor.background", + icon_width_factor: 1.5, + text_scale_factor: 0.857, + border: { + bottom: true, + color: "$border.secondary", + top: true, + width: 1, + }, + code: { + extends: "$text.muted", + size: 14, + margin: { + left: 10, + }, + }, + message: { + highlight_text: { + extends: "$text.primary", + size: 14, + weight: "bold", + }, + text: { + extends: "$text.secondary", + size: 14, + }, + }, + }, + diagnostic_path_header: { + background: "$state.active_line", + text_scale_factor: 0.857, + filename: { + extends: "$text.primary", + size: 14, + }, + path: { + extends: "$text.muted", + size: 14, + margin: { + left: 12, + }, + }, + }, + error_diagnostic: { + text_scale_factor: 0.857, + header: { + border: { + color: "$border.primary", + top: true, + width: 1, + }, + }, + message: { + highlight_text: { + color: "$status.bad", + extends: "$text.secondary", + size: 14, + weight: "bold", + }, + text: { + color: "$status.bad", + extends: "$text.secondary", + size: 14, + }, + }, + }, + hint_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.info", + }, + text: { + color: "$status.info", + }, + }, + }, + information_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.info", + }, + text: { + color: "$status.info", + }, + }, + }, + invalid_error_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_hint_diagnostic: { + extends: "$editor.hint_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_information_diagnostic: { + extends: "$editor.information_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_warning_diagnostic: { + extends: "$editor.warning_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + warning_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.warn", + }, + text: { + color: "$status.warn", + }, + }, + }, + }, + project_diagnostics: { + background: "$surface.300", + tab_icon_spacing: 4, + tab_icon_width: 13, + tab_summary_spacing: 10, + empty_message: { + extends: "$text.primary", + size: 18, + }, + status_bar_item: { + extends: "$text.muted", + margin: { + right: 10, + }, + }, + }, + project_panel: { + extends: "$panel", + entry: { + height: 22, + icon_color: "$text.muted.color", + icon_size: 8, + icon_spacing: 8, + text: "$text.secondary", + }, + hovered_entry: { + background: "$state.hover", + extends: "$project_panel.entry", + }, + hovered_selected_entry: { + extends: "$project_panel.hovered_entry", + text: { + extends: "$text.primary", + }, + }, + padding: { + top: 6, + }, + selected_entry: { + extends: "$project_panel.entry", + text: { + extends: "$text.primary", + }, + }, + }, + search: { + background: "$surface.300", + match_background: "$state.highlighted_line", + tab_icon_spacing: 4, + tab_icon_width: 14, + active_hovered_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + active_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + editor: { + background: "$surface.500", + corner_radius: 6, + max_width: 400, + placeholder_text: "$text.muted", + selection: "$selection.host", + text: "$text.primary", + border: { + color: "$border.primary", + width: 1, + }, + margin: { + bottom: 5, + left: 5, + right: 5, + top: 5, + }, + padding: { + bottom: 3, + left: 13, + right: 13, + top: 3, + }, + }, + hovered_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + invalid_editor: { + extends: "$search.editor", + border: { + color: "$status.bad", + width: 1, + }, + }, + match_index: { + extends: "$text.secondary", + padding: 6, + }, + option_button: { + background: "$surface.300", + corner_radius: 6, + extends: "$text.secondary", + border: { + color: "$border.primary", + width: 1, + }, + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }, + option_button_group: { + padding: { + left: 2, + right: 2, + }, + }, + results_status: { + extends: "$text.primary", + size: 18, + }, + }, + }; +} diff --git a/styles/components.ts b/styles/components.ts new file mode 100644 index 0000000000000000000000000000000000000000..226d1d9e374274ce82938f85c1a73d0c669a468c --- /dev/null +++ b/styles/components.ts @@ -0,0 +1,62 @@ +import chroma from "chroma-js"; +import core, { Color } from "./core"; +import Theme, { BackgroundColor, Weight } from "./theme"; + +export function text( + theme: Theme, + fontFamily: keyof typeof core.fontFamily, + color: keyof Theme["textColor"], + properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } +) { + const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; + const size = core.fontSize[sizeKey].value; + + return { + family: core.fontFamily[fontFamily], + color: theme.textColor[color].value, + ...properties, + size, + }; +} + +export function border(theme: Theme, color: keyof Theme["borderColor"]) { + return { + color: theme.borderColor[color].value, + width: 1, + }; +} + +export interface Player { + selection: { + cursor: Color; + selection: Color; + }; +} + +export function player( + theme: Theme, + playerNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 +): Player { + return { + selection: { + cursor: theme.player[playerNumber].cursorColor.value, + selection: theme.player[playerNumber].selectionColor.value, + }, + }; +} + +export function backgroundColor( + theme: Theme, + name: keyof Theme["backgroundColor"], + state?: keyof BackgroundColor +): Color { + return theme.backgroundColor[name][state || "base"].value; +} + +export function shadow(theme) { + return { + blur: 16, + color: chroma("black").alpha(theme.shadowAlpha.value).hex(), + offset: [0, 2], + }; +} diff --git a/styles/core.ts b/styles/core.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c63b2285ea0406363f05938e956029db5cc39dd --- /dev/null +++ b/styles/core.ts @@ -0,0 +1,38 @@ +export type Color = string; + +export default { + fontFamily: { + sans: "Zed Sans", + mono: "Zed Mono", + }, + fontSize: { + "3xs": { + value: "8", + type: "fontSizes", + }, + "2xs": { + value: "10", + type: "fontSizes", + }, + xs: { + value: "12", + type: "fontSizes", + }, + sm: { + value: "14", + type: "fontSizes", + }, + md: { + value: "16", + type: "fontSizes", + }, + lg: { + value: "18", + type: "fontSizes", + }, + xl: { + value: "20", + type: "fontSizes", + }, + }, +}; diff --git a/styles/package-lock.json b/styles/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..3abb465628bd5400de8fccf399c5e62025600ab1 --- /dev/null +++ b/styles/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "styles", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "styles", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "chroma-js": "^2.4.2" + } + }, + "node_modules/chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + } + }, + "dependencies": { + "chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + } + } +} diff --git a/styles/package.json b/styles/package.json new file mode 100644 index 0000000000000000000000000000000000000000..92f0546c561f768847c081fca7465d28822798ff --- /dev/null +++ b/styles/package.json @@ -0,0 +1,14 @@ +{ + "name": "styles", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "chroma-js": "^2.4.2" + } +} diff --git a/styles/selector-modal.ts b/styles/selector-modal.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7101c915138e61d6147f4f12e82e58310ae9637 --- /dev/null +++ b/styles/selector-modal.ts @@ -0,0 +1,59 @@ +import { backgroundColor, border, player, shadow, text } from "./components"; +import Theme from "./theme"; + +export function selectorModal(theme: Theme): Object { + const item = { + padding: { + bottom: 4, + left: 16, + right: 16, + top: 4, + }, + cornerRadius: 6, + text: text(theme, "sans", "secondary"), + highlightText: text(theme, "sans", "feature", { weight: "bold" }), + }; + + const activeItem = { + ...item, + background: backgroundColor(theme, 500, "active"), + text: text(theme, "sans", "primary"), + }; + + return { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 8, + item, + activeItem, + border: border(theme, "primary"), + empty: { + text: text(theme, "sans", "muted"), + padding: { + bottom: 4, + left: 16, + right: 16, + top: 8, + }, + }, + inputEditor: { + background: backgroundColor(theme, 300), + corner_radius: 6, + placeholderText: text(theme, "sans", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + padding: { + bottom: 7, + left: 16, + right: 16, + top: 7, + }, + }, + margin: { + bottom: 52, + top: 52, + }, + shadow: shadow(theme), + }; +} diff --git a/styles/theme.ts b/styles/theme.ts new file mode 100644 index 0000000000000000000000000000000000000000..5363a8c01c08697f90fa9a37ffba2c6d50305c5c --- /dev/null +++ b/styles/theme.ts @@ -0,0 +1,121 @@ +export type Color = string; +export type Weight = + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; + +interface SyntaxHighlightStyle { + color: { value: Color }; + weight: { value: Weight }; +} + +interface Player { + baseColor: { + value: Color; + }; + cursorColor: { + value: Color; + }; + selectionColor: { + value: Color; + }; + borderColor: { + value: Color; + }; +} + +export interface BackgroundColor { + base: { + value: Color; + }; + hover: { + value: Color; + }; + active: { + value: Color; + }; + focused: { + value: Color; + }; +} + +export default interface Theme { + backgroundColor: { + 100: BackgroundColor; + 300: BackgroundColor; + 500: BackgroundColor; + }; + borderColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + focused: { + value: Color; + }; + active: { + value: Color; + }; + }; + textColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + placeholder: { + value: Color; + }; + active: { + value: Color; + }; + feature: { + value: Color; + }; + }; + syntax: { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; + }; + player: { + 1: Player; + 2: Player; + 3: Player; + 4: Player; + 5: Player; + 6: Player; + 7: Player; + 8: Player; + }; + shadowAlpha: { + value: number; + }; +} From 9669f5a8f81a24fa436bfa15798f7e8ce3fb976a Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 29 Mar 2022 15:33:03 -0400 Subject: [PATCH 002/245] WIP: Add `rose` color tokens to `core.ts` --- styles/core.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/styles/core.ts b/styles/core.ts index 6c63b2285ea0406363f05938e956029db5cc39dd..164b6dba003b391e73717d232fb8b9c94ecbcba2 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,6 +1,51 @@ +import chroma from "chroma-js"; + export type Color = string; +function getColorRamp(colorName, baseColor, steps = 10) { + let hsl = chroma(baseColor).hsl(); + let h = Math.round(hsl[0]); + let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); + let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); + + let ramp = chroma + .scale([lightColor, baseColor, darkColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]) + .colors(steps); + + let tokens = {}; + let token = {}; + let colorNumber = 0; + + for (let i = 0; i < steps; i++) { + if (i !== 0) { + colorNumber = i * 100; + } + + token = { + [`${colorName}_${colorNumber}`]: { + value: ramp[i].value, + rootValue: baseColor, + step: i, + type: "color", + }, + }; + + Object.assign(token, tokens); + } + + return tokens; +} + export default { + color: { + rose: getColorRamp("rose", "#F43F5E", 10), + }, + fontFamily: { sans: "Zed Sans", mono: "Zed Mono", From 39f46f64a69c101266dfb884f9b1c5672e58b074 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 29 Mar 2022 17:10:46 -0400 Subject: [PATCH 003/245] WIP: Color WIP --- styles/core.color.ts | 93 ++++++++++++++++++++++++++++++++++++++++++++ styles/core.ts | 45 +-------------------- 2 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 styles/core.color.ts diff --git a/styles/core.color.ts b/styles/core.color.ts new file mode 100644 index 0000000000000000000000000000000000000000..004e7209a2c124bfa74bfaec6d598389e187d9ad --- /dev/null +++ b/styles/core.color.ts @@ -0,0 +1,93 @@ +import chroma from "chroma-js"; + +export type Color = string; + +function returnTokens( + colorName: string, + ramp: Array, // help, have no clue on type here +) { + let tokens = {}; + let token = {}; + let colorNumber = 0; + let increment = 0; + + for (let i = 0; i < ramp.len; i++) { + if (i > 11 ) { + increment = 50; + } else { + increment = 100; + } + + if (i !== 0) { + colorNumber = i * increment; + } + + token = { + [`${colorName}_${colorNumber}`]: { + value: ramp[i].value, + step: i, + type: "color", + }, + }; + + Object.assign(token, tokens); + } + return tokens; +} + +function oneColorRamp( + colorName: string, + baseColor: string, + steps: number = 10 +) { + let hsl = chroma(baseColor).hsl(); + let h = Math.round(hsl[0]); + let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); + let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); + + let ramp = chroma + .scale([lightColor, baseColor, darkColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]) + .colors(steps) + .hex(); + + return returnTokens(colorName, ramp); +} + +function colorRamp( + colorName: string, + startColor: string, + endColor: string, + steps: number +) { + let ramp = chroma.scale([startColor, endColor]).mode("hsl").colors(steps).hex(); + + return returnTokens(colorName, ramp); +} + +export default { + color: { + neutral: colorRamp("neutral", "black", "white", 21), // colorName, startColor, endColor, steps + rose: oneColorRamp("rose", "#F43F5EFF"), // colorName, baseColor, steps(optional) + red: oneColorRamp("red", "#EF4444FF"), + orange: oneColorRamp("orange", "#F97316FF"), + amber: oneColorRamp("amber", "#F59E0BFF"), + yellow: oneColorRamp("yellow", "#EAB308FF"), + lime: oneColorRamp("lime", "#84CC16FF"), + green: oneColorRamp("green", "#22C55EFF"), + emerald: oneColorRamp("emerald", "#10B981FF"), + teal: oneColorRamp("teal", "#14B8A6FF"), + cyan: oneColorRamp("cyan", "#06BBD4FF"), + sky: oneColorRamp("sky", "#0EA5E9FF"), + blue: oneColorRamp("blue", "#3B82F6FF"), + indigo: oneColorRamp("indigo", "#6366F1FF"), + violet: oneColorRamp("violet", "#8B5CF6FF"), + purple: oneColorRamp("purple", "#A855F7FF"), + fuschia: oneColorRamp("fuschia", "#D946E4FF"), + pink: oneColorRamp("pink", "#EC4899FF"), + }, +}; diff --git a/styles/core.ts b/styles/core.ts index 164b6dba003b391e73717d232fb8b9c94ecbcba2..6444ef9a1c96b26c85ec5181871005650443ce22 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,50 +1,9 @@ -import chroma from "chroma-js"; +import color from "./core.color"; export type Color = string; -function getColorRamp(colorName, baseColor, steps = 10) { - let hsl = chroma(baseColor).hsl(); - let h = Math.round(hsl[0]); - let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); - let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); - - let ramp = chroma - .scale([lightColor, baseColor, darkColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - .correctLightness(true) - .padding([0, 0.15]) - .colors(steps); - - let tokens = {}; - let token = {}; - let colorNumber = 0; - - for (let i = 0; i < steps; i++) { - if (i !== 0) { - colorNumber = i * 100; - } - - token = { - [`${colorName}_${colorNumber}`]: { - value: ramp[i].value, - rootValue: baseColor, - step: i, - type: "color", - }, - }; - - Object.assign(token, tokens); - } - - return tokens; -} - export default { - color: { - rose: getColorRamp("rose", "#F43F5E", 10), - }, + color: color, fontFamily: { sans: "Zed Sans", From 32b6c3d3d49cca415a3ff0a7733d0ed31d7029a7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 29 Mar 2022 16:28:19 -0600 Subject: [PATCH 004/245] Express workspace in terms of new components Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- styles/app.ts | 155 +++------------------------------------ styles/components.ts | 23 +++++- styles/core.color.ts | 93 ----------------------- styles/core.ts | 26 +++++-- styles/lib.ts | 44 +++++++++++ styles/package-lock.json | 11 +++ styles/package.json | 1 + styles/selector-modal.ts | 2 +- styles/theme.ts | 46 ++++++++++++ styles/workspace.ts | 133 +++++++++++++++++++++++++++++++++ 10 files changed, 288 insertions(+), 246 deletions(-) delete mode 100644 styles/core.color.ts create mode 100644 styles/lib.ts create mode 100644 styles/workspace.ts diff --git a/styles/app.ts b/styles/app.ts index a7ae4348bea1d2e0861d0d4a957cd6eb7a3c7adf..4f40577ae9ada410e9cab6c76bfb950660b6b94b 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,147 +1,12 @@ -import { selectorModal } from "./selector-modal"; +import { backgroundColor } from "./components"; +import selectorModal from "./selector-modal"; +import workspace from "./workspace"; import Theme from "./theme"; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), - workspace: { - background: "$surface.500", - leaderBorderOpacity: 0.7, - leader_border_width: 2.0, - active_tab: { - background: "$surface.300", - extends: "$workspace.tab", - text: "$text.primary", - border: { - bottom: false, - }, - }, - left_sidebar: { - extends: "$workspace.sidebar", - border: { - color: "$border.primary", - right: true, - width: 1, - }, - }, - pane_divider: { - color: "$border.primary", - width: 1, - }, - right_sidebar: { - extends: "$workspace.sidebar", - border: { - color: "$border.primary", - left: true, - width: 1, - }, - }, - sidebar: { - width: 30, - active_item: { - extends: "$workspace.sidebar.item", - icon_color: "$text.primary.color", - }, - border: { - color: "$border.primary", - right: true, - width: 1, - }, - item: { - height: "$workspace.tab.height", - icon_color: "$text.muted.color", - icon_size: 18, - }, - resize_handle: { - background: "$border.primary", - padding: { - left: 1, - }, - }, - }, - status_bar: { - cursor_position: "$text.muted", - diagnostic_message: "$text.muted", - height: 24, - item_spacing: 8, - lsp_message: "$text.muted", - padding: { - left: 6, - right: 6, - }, - }, - tab: { - height: 34, - icon_close: "$text.muted.color", - icon_close_active: "$text.primary.color", - icon_conflict: "$status.warn", - icon_dirty: "$status.info", - icon_width: 8, - spacing: 10, - text: "$text.muted", - border: { - bottom: true, - color: "$border.primary", - left: true, - overlay: true, - width: 1, - }, - padding: { - left: 12, - right: 12, - }, - }, - titlebar: { - avatar_width: 18, - height: 32, - share_icon_active_color: "$text.primary.color", - share_icon_color: "$text.muted.color", - title: "$text.primary", - avatar: { - corner_radius: 10, - border: { - color: "#00000088", - width: 1, - }, - }, - avatar_ribbon: { - background: "#ff0000", - height: 3, - width: 12, - }, - border: { - bottom: true, - color: "$border.primary", - width: 1, - }, - hovered_sign_in_prompt: { - color: "$text.secondary.color", - extends: "$workspace.titlebar.sign_in_prompt", - }, - offline_icon: { - color: "$text.muted.color", - width: 16, - padding: { - right: 4, - }, - }, - outdated_warning: { - extends: "$text.muted", - size: 13, - }, - sign_in_prompt: { - extends: "$text.muted", - size: 13, - underline: true, - padding: { - right: 8, - }, - }, - }, - toolbar: { - height: 44, - }, - }, + workspace: workspace(theme), chat_panel: { extends: "$panel", channel_name: { @@ -205,7 +70,7 @@ export default function app(theme: Theme): Object { extends: "$chat_panel.sign_in_prompt", }, input_editor: { - background: "$surface.300", + background: backgroundColor(theme, 300), corner_radius: 6, placeholder_text: "$text.muted", selection: "$selection.host", @@ -306,7 +171,7 @@ export default function app(theme: Theme): Object { }, editor: { active_line_background: "$state.active_line", - background: "$surface.300", + background: backgroundColor(theme, 300), code_actions_indicator: "$text.muted.color", diff_background_deleted: "$state.deleted_line", diff_background_inserted: "$state.inserted_line", @@ -314,7 +179,7 @@ export default function app(theme: Theme): Object { document_highlight_write_background: "#99999916", error_color: "$status.bad", guest_selections: "$selection.guests", - gutter_background: "$surface.300", + gutter_background: backgroundColor(theme, 300), gutter_padding_factor: 2.5, highlighted_line_background: "$state.highlighted_line", line_number: "$text.muted.color", @@ -502,7 +367,7 @@ export default function app(theme: Theme): Object { }, }, project_diagnostics: { - background: "$surface.300", + background: backgroundColor(theme, 300), tab_icon_spacing: 4, tab_icon_width: 13, tab_summary_spacing: 10, @@ -547,7 +412,7 @@ export default function app(theme: Theme): Object { }, }, search: { - background: "$surface.300", + background: backgroundColor(theme, 300), match_background: "$state.highlighted_line", tab_icon_spacing: 4, tab_icon_width: 14, @@ -599,7 +464,7 @@ export default function app(theme: Theme): Object { padding: 6, }, option_button: { - background: "$surface.300", + background: backgroundColor(theme, 300), corner_radius: 6, extends: "$text.secondary", border: { diff --git a/styles/components.ts b/styles/components.ts index 226d1d9e374274ce82938f85c1a73d0c669a468c..9cc58046ffba77646dc07342b1485e0877305f69 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -1,5 +1,6 @@ import chroma from "chroma-js"; -import core, { Color } from "./core"; +import core from "./core"; +import { Color } from "./lib"; import Theme, { BackgroundColor, Weight } from "./theme"; export function text( @@ -19,13 +20,31 @@ export function text( }; } -export function border(theme: Theme, color: keyof Theme["borderColor"]) { +export interface BorderOptions { + width?: number; + top?: boolean; + bottom?: boolean; + left?: boolean; + right?: boolean; + overlay?: boolean; +} + +export function border( + theme: Theme, + color: keyof Theme["borderColor"], + options?: BorderOptions +) { return { color: theme.borderColor[color].value, width: 1, + ...options, }; } +export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { + return theme.iconColor[color].value; +} + export interface Player { selection: { cursor: Color; diff --git a/styles/core.color.ts b/styles/core.color.ts deleted file mode 100644 index 004e7209a2c124bfa74bfaec6d598389e187d9ad..0000000000000000000000000000000000000000 --- a/styles/core.color.ts +++ /dev/null @@ -1,93 +0,0 @@ -import chroma from "chroma-js"; - -export type Color = string; - -function returnTokens( - colorName: string, - ramp: Array, // help, have no clue on type here -) { - let tokens = {}; - let token = {}; - let colorNumber = 0; - let increment = 0; - - for (let i = 0; i < ramp.len; i++) { - if (i > 11 ) { - increment = 50; - } else { - increment = 100; - } - - if (i !== 0) { - colorNumber = i * increment; - } - - token = { - [`${colorName}_${colorNumber}`]: { - value: ramp[i].value, - step: i, - type: "color", - }, - }; - - Object.assign(token, tokens); - } - return tokens; -} - -function oneColorRamp( - colorName: string, - baseColor: string, - steps: number = 10 -) { - let hsl = chroma(baseColor).hsl(); - let h = Math.round(hsl[0]); - let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); - let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); - - let ramp = chroma - .scale([lightColor, baseColor, darkColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - .correctLightness(true) - .padding([0, 0.15]) - .colors(steps) - .hex(); - - return returnTokens(colorName, ramp); -} - -function colorRamp( - colorName: string, - startColor: string, - endColor: string, - steps: number -) { - let ramp = chroma.scale([startColor, endColor]).mode("hsl").colors(steps).hex(); - - return returnTokens(colorName, ramp); -} - -export default { - color: { - neutral: colorRamp("neutral", "black", "white", 21), // colorName, startColor, endColor, steps - rose: oneColorRamp("rose", "#F43F5EFF"), // colorName, baseColor, steps(optional) - red: oneColorRamp("red", "#EF4444FF"), - orange: oneColorRamp("orange", "#F97316FF"), - amber: oneColorRamp("amber", "#F59E0BFF"), - yellow: oneColorRamp("yellow", "#EAB308FF"), - lime: oneColorRamp("lime", "#84CC16FF"), - green: oneColorRamp("green", "#22C55EFF"), - emerald: oneColorRamp("emerald", "#10B981FF"), - teal: oneColorRamp("teal", "#14B8A6FF"), - cyan: oneColorRamp("cyan", "#06BBD4FF"), - sky: oneColorRamp("sky", "#0EA5E9FF"), - blue: oneColorRamp("blue", "#3B82F6FF"), - indigo: oneColorRamp("indigo", "#6366F1FF"), - violet: oneColorRamp("violet", "#8B5CF6FF"), - purple: oneColorRamp("purple", "#A855F7FF"), - fuschia: oneColorRamp("fuschia", "#D946E4FF"), - pink: oneColorRamp("pink", "#EC4899FF"), - }, -}; diff --git a/styles/core.ts b/styles/core.ts index 6444ef9a1c96b26c85ec5181871005650443ce22..e9e81982e456c0ffe151b83ac36767d62140c6ba 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,10 +1,6 @@ -import color from "./core.color"; - -export type Color = string; +import { colorRamp } from "./lib"; export default { - color: color, - fontFamily: { sans: "Zed Sans", mono: "Zed Mono", @@ -39,4 +35,24 @@ export default { type: "fontSizes", }, }, + color: { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), + }, }; diff --git a/styles/lib.ts b/styles/lib.ts new file mode 100644 index 0000000000000000000000000000000000000000..b59f4fa69479a1f886229afe1953284f6626f9d8 --- /dev/null +++ b/styles/lib.ts @@ -0,0 +1,44 @@ +import chroma, { Scale } from "chroma-js"; + +export type Color = string; +export type ColorRampStep = { value: Color; type: "color"; step: number }; +export type ColorRamp = { + [index: number]: ColorRampStep; +}; + +export function colorRamp( + color: Color | [Color, Color], + options?: { steps?: number; increment?: number } +): ColorRamp { + let scale: Scale; + if (Array.isArray(color)) { + const [startColor, endColor] = color; + scale = chroma.scale([startColor, endColor]); + } else { + let hue = Math.round(chroma(color).hsl()[0]); + let startColor = chroma.hsl(hue, 0.88, 0.96); + let endColor = chroma.hsl(hue, 0.68, 0.32); + scale = chroma + .scale([startColor, color, endColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]); + } + + const ramp: ColorRamp = {}; + const steps = options?.steps || 10; + const increment = options?.increment || 100; + + scale.colors(steps, "hex").forEach((color, ix) => { + const step = ix * increment; + ramp[step] = { + value: color, + step, + type: "color", + }; + }); + + return ramp; +} diff --git a/styles/package-lock.json b/styles/package-lock.json index 3abb465628bd5400de8fccf399c5e62025600ab1..7b8503bf720d572d64bb9179a78489beaa068cb4 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -9,9 +9,15 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@types/chroma-js": "^2.1.3", "chroma-js": "^2.4.2" } }, + "node_modules/@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", @@ -19,6 +25,11 @@ } }, "dependencies": { + "@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", diff --git a/styles/package.json b/styles/package.json index 92f0546c561f768847c081fca7465d28822798ff..c66da8718b6d4f2047cbc4e7580036946dab1fb8 100644 --- a/styles/package.json +++ b/styles/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "@types/chroma-js": "^2.1.3", "chroma-js": "^2.4.2" } } diff --git a/styles/selector-modal.ts b/styles/selector-modal.ts index f7101c915138e61d6147f4f12e82e58310ae9637..ddba32683a976153eac6fc0f49f6a5df9a835a1f 100644 --- a/styles/selector-modal.ts +++ b/styles/selector-modal.ts @@ -1,7 +1,7 @@ import { backgroundColor, border, player, shadow, text } from "./components"; import Theme from "./theme"; -export function selectorModal(theme: Theme): Object { +export default function selectorModal(theme: Theme): Object { const item = { padding: { bottom: 4, diff --git a/styles/theme.ts b/styles/theme.ts index 5363a8c01c08697f90fa9a37ffba2c6d50305c5c..ddfa6414f49e5e94236f3c2d316896869f832986 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,3 +1,5 @@ +import { colorRamp } from "./lib"; + export type Color = string; export type Weight = | "thin" @@ -87,6 +89,50 @@ export default interface Theme { feature: { value: Color; }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; + }; + iconColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + placeholder: { + value: Color; + }; + active: { + value: Color; + }; + feature: { + value: Color; + }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; }; syntax: { primary: SyntaxHighlightStyle; diff --git a/styles/workspace.ts b/styles/workspace.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ecb3a378c8d1a5acedc5100203c9b9306e36dca --- /dev/null +++ b/styles/workspace.ts @@ -0,0 +1,133 @@ +import { backgroundColor, border, iconColor, text } from "./components"; +import Theme from "./theme"; + +export default function workspace(theme: Theme) { + const signInPrompt = { + ...text(theme, "sans", "secondary"), + size: 13, + underline: true, + padding: { + right: 8, + }, + }; + + const tab = { + height: 34, + iconClose: iconColor(theme, "secondary"), + iconCloseActive: iconColor(theme, "active"), + iconConflict: iconColor(theme, "warning"), + iconDirty: iconColor(theme, "info"), + iconWidth: 8, + spacing: 10, + text: text(theme, "mono", "secondary"), + border: border(theme, "primary", { + left: true, + bottom: true, + overlay: true, + }), + padding: { + left: 12, + right: 12, + }, + }; + + const activeTab = { + ...tab, + background: backgroundColor(theme, 300), + text: text(theme, "mono", "primary"), + border: { + ...tab.border, + bottom: false, + }, + }; + + const sidebarItem = { + height: "$workspace.tab.height", + iconColor: "$text.muted.color", + iconSize: 18, + }; + const sidebar = { + width: 30, + border: border(theme, "primary", { right: true }), + item: sidebarItem, + activeItem: { + ...sidebarItem, + iconColor: iconColor(theme, "primary"), + }, + resizeHandle: { + background: border(theme, "primary").color, + padding: { + left: 1, + }, + }, + }; + + return { + background: backgroundColor(theme, 500), + leaderBorderOpacity: 0.7, + leaderBorderWidth: 2.0, + tab, + activeTab, + leftSidebar: { + ...sidebar, + border: border(theme, "primary", { right: true }), + }, + rightSidebar: { + ...sidebar, + border: border(theme, "primary", { left: true }), + }, + paneDivider: { + color: border(theme, "primary").color, + width: 1, + }, + status_bar: { + height: 24, + itemSpacing: 8, + padding: { + left: 6, + right: 6, + }, + cursorPosition: text(theme, "sans", "muted"), + diagnosticMessage: text(theme, "sans", "muted"), + lspMessage: text(theme, "sans", "muted"), + }, + titlebar: { + avatarWidth: 18, + height: 32, + shareIconColor: iconColor(theme, "secondary"), + shareIconActiveColor: iconColor(theme, "active"), + title: text(theme, "sans", "primary"), + avatar: { + cornerRadius: 10, + border: { + color: "#00000088", + width: 1, + }, + }, + avatarRibbon: { + height: 3, + width: 12, + }, + border: border(theme, "primary", { bottom: true }), + signInPrompt, + hoveredSignInPrompt: { + ...signInPrompt, + ...text(theme, "mono", "active"), + }, + offlineIcon: { + color: iconColor(theme, "muted"), + width: 16, + padding: { + right: 4, + }, + }, + outdatedWarning: { + ...text(theme, "sans", "muted"), + size: 13, + }, + }, + toolbar: { + height: 44, + }, + }; +} From 89eb34209f539d9ca2138b1e9e0b4968b00ee89a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 17:59:35 -0600 Subject: [PATCH 005/245] Convert editor styles to TypeScript --- styles/app.ts | 201 +------------------------------------------ styles/components.ts | 4 +- styles/editor.ts | 143 ++++++++++++++++++++++++++++++ styles/theme.ts | 65 ++++++++++++++ 4 files changed, 214 insertions(+), 199 deletions(-) create mode 100644 styles/editor.ts diff --git a/styles/app.ts b/styles/app.ts index 4f40577ae9ada410e9cab6c76bfb950660b6b94b..a421da8f07dc854931d64268d84ae2cf9f4ec5e3 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,13 +1,15 @@ import { backgroundColor } from "./components"; import selectorModal from "./selector-modal"; import workspace from "./workspace"; +import editor from "./editor"; import Theme from "./theme"; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), workspace: workspace(theme), - chat_panel: { + editor: editor(theme), + chatPanel: { extends: "$panel", channel_name: { extends: "$text.primary", @@ -169,203 +171,6 @@ export default function app(theme: Theme): Object { extends: "$contacts_panel.project", }, }, - editor: { - active_line_background: "$state.active_line", - background: backgroundColor(theme, 300), - code_actions_indicator: "$text.muted.color", - diff_background_deleted: "$state.deleted_line", - diff_background_inserted: "$state.inserted_line", - document_highlight_read_background: "#99999920", - document_highlight_write_background: "#99999916", - error_color: "$status.bad", - guest_selections: "$selection.guests", - gutter_background: backgroundColor(theme, 300), - gutter_padding_factor: 2.5, - highlighted_line_background: "$state.highlighted_line", - line_number: "$text.muted.color", - line_number_active: "$text.primary.color", - rename_fade: 0.6, - selection: "$selection.host", - text_color: "$text.secondary.color", - unnecessary_code_fade: 0.5, - autocomplete: { - background: "$surface.100", - corner_radius: 6, - padding: 6, - border: { - color: "$border.secondary", - width: 2, - }, - hovered_item: { - background: "$state.hover", - extends: "$editor.autocomplete.item", - }, - item: { - corner_radius: 6, - padding: { - bottom: 2, - left: 6, - right: 6, - top: 2, - }, - }, - margin: { - left: -14, - }, - match_highlight: { - color: "$editor.syntax.keyword.color", - weight: "$editor.syntax.keyword.weight", - }, - selected_item: { - background: "$state.selected", - extends: "$editor.autocomplete.item", - }, - }, - diagnostic_header: { - background: "$editor.background", - icon_width_factor: 1.5, - text_scale_factor: 0.857, - border: { - bottom: true, - color: "$border.secondary", - top: true, - width: 1, - }, - code: { - extends: "$text.muted", - size: 14, - margin: { - left: 10, - }, - }, - message: { - highlight_text: { - extends: "$text.primary", - size: 14, - weight: "bold", - }, - text: { - extends: "$text.secondary", - size: 14, - }, - }, - }, - diagnostic_path_header: { - background: "$state.active_line", - text_scale_factor: 0.857, - filename: { - extends: "$text.primary", - size: 14, - }, - path: { - extends: "$text.muted", - size: 14, - margin: { - left: 12, - }, - }, - }, - error_diagnostic: { - text_scale_factor: 0.857, - header: { - border: { - color: "$border.primary", - top: true, - width: 1, - }, - }, - message: { - highlight_text: { - color: "$status.bad", - extends: "$text.secondary", - size: 14, - weight: "bold", - }, - text: { - color: "$status.bad", - extends: "$text.secondary", - size: 14, - }, - }, - }, - hint_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.info", - }, - text: { - color: "$status.info", - }, - }, - }, - information_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.info", - }, - text: { - color: "$status.info", - }, - }, - }, - invalid_error_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_hint_diagnostic: { - extends: "$editor.hint_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_information_diagnostic: { - extends: "$editor.information_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_warning_diagnostic: { - extends: "$editor.warning_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - warning_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.warn", - }, - text: { - color: "$status.warn", - }, - }, - }, - }, project_diagnostics: { background: backgroundColor(theme, 300), tab_icon_spacing: 4, diff --git a/styles/components.ts b/styles/components.ts index 9cc58046ffba77646dc07342b1485e0877305f69..14becaf2af30e94d4c6d3a0250b0e3f3aab52faf 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -3,10 +3,12 @@ import core from "./core"; import { Color } from "./lib"; import Theme, { BackgroundColor, Weight } from "./theme"; +export type TextColor = keyof Theme["textColor"]; + export function text( theme: Theme, fontFamily: keyof typeof core.fontFamily, - color: keyof Theme["textColor"], + color: TextColor, properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } ) { const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; diff --git a/styles/editor.ts b/styles/editor.ts new file mode 100644 index 0000000000000000000000000000000000000000..9edfdc4716bea35b4c7e3cf83967383b4f6a3850 --- /dev/null +++ b/styles/editor.ts @@ -0,0 +1,143 @@ +import { + backgroundColor, + border, + iconColor, + player, + text, + TextColor, +} from "./components"; +import Theme from "./theme"; + +export default function editor(theme: Theme) { + const autocompleteItem = { + cornerRadius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, + }; + + function diagnostic(theme: Theme, color: TextColor) { + return { + textScaleFactor: 0.857, + header: { + border: border(theme, "primary", { + top: true, + }), + }, + message: { + text: { + ...text(theme, "sans", color), + size: 14, + }, + highlightText: { + ...text(theme, "sans", color, { weight: "bold" }), + size: 14, + }, + }, + }; + } + + return { + textColor: theme.textColor.secondary.value, + background: backgroundColor(theme, 300), + activeLineBackground: theme.editor.line.active.value, + codeActionsIndicator: iconColor(theme, "secondary"), + diffBackgroundDeleted: backgroundColor(theme, "error"), + diffBackgroundInserted: backgroundColor(theme, "ok"), + documentHighlightReadBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, + errorColor: theme.textColor.error, + gutterBackground: backgroundColor(theme, 300), + gutterPaddingFactor: 2.5, + highlightedLineBackground: theme.editor.line.highlighted.value, + lineNumber: theme.editor.gutter.primary.value, + lineNumberActive: theme.editor.gutter.active, + renameFade: 0.6, + unnecessaryCodeFade: 0.5, + selection: player(theme, 1).selection, + guestSelections: [ + player(theme, 2).selection, + player(theme, 3).selection, + player(theme, 4).selection, + player(theme, 5).selection, + player(theme, 6).selection, + player(theme, 7).selection, + player(theme, 8).selection, + ], + autocomplete: { + background: backgroundColor(theme, 100), + cornerRadius: 6, + padding: 6, + border: border(theme, "secondary"), + item: autocompleteItem, + hoveredItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "hover"), + }, + margin: { + left: -14, + }, + matchHighlight: { + color: theme.syntax.keyword.color.value, + weight: theme.syntax.keyword.weight.value, + }, + selectedItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "active"), + }, + }, + diagnosticHeader: { + background: theme.editor.background.value, + iconWidthFactor: 1.5, + textScaleFactor: 0.857, + border: border(theme, "secondary", { + bottom: true, + top: true, + }), + code: { + ...text(theme, "mono", "muted"), + size: 14, + margin: { + left: 10, + }, + }, + message: { + highlightText: { + ...text(theme, "sans", "primary"), + size: 14, + weight: "bold", + }, + text: { + ...text(theme, "sans", "secondary"), + size: 14, + }, + }, + }, + diagnosticPathHeader: { + background: theme.editor.line.active, + textScaleFactor: 0.857, + filename: { + ...text(theme, "mono", "primary"), + size: 14, + }, + path: { + ...text(theme, "mono", "muted"), + size: 14, + margin: { + left: 12, + }, + }, + }, + errorDiagnostic: diagnostic(theme, "error"), + warningDiagnostic: diagnostic(theme, "warning"), + informationDiagnostic: diagnostic(theme, "info"), + hintDiagnostic: diagnostic(theme, "info"), + invalidErrorDiagnostic: diagnostic(theme, "muted"), + invalidHintDiagnostic: diagnostic(theme, "muted"), + invalidInformationDiagnostic: diagnostic(theme, "muted"), + invalidWarningDiagnostic: diagnostic(theme, "muted"), + }; +} diff --git a/styles/theme.ts b/styles/theme.ts index ddfa6414f49e5e94236f3c2d316896869f832986..5220c962c9d2032d35b15e32d12547f92d4c4679 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -52,6 +52,10 @@ export default interface Theme { 100: BackgroundColor; 300: BackgroundColor; 500: BackgroundColor; + ok: BackgroundColor; + error: BackgroundColor; + warning: BackgroundColor; + info: BackgroundColor; }; borderColor: { primary: { @@ -134,6 +138,66 @@ export default interface Theme { value: Color; }; }; + editor: { + background: { + value: Color; + }; + indent_guide: { + value: Color; + }; + indent_guide_active: { + value: Color; + }; + line: { + active: { + value: Color; + }; + highlighted: { + value: Color; + }; + inserted: { + value: Color; + }; + deleted: { + value: Color; + }; + modified: { + value: Color; + }; + }; + highlight: { + selection: { + value: Color; + }; + occurrence: { + value: Color; + }; + activeOccurrence: { + value: Color; + }; + matchingBracket: { + value: Color; + }; + match: { + value: Color; + }; + activeMatch: { + value: Color; + }; + related: { + value: Color; + }; + }; + gutter: { + primary: { + value: Color; + }; + active: { + value: Color; + }; + }; + }; + syntax: { primary: SyntaxHighlightStyle; comment: SyntaxHighlightStyle; @@ -151,6 +215,7 @@ export default interface Theme { boolean: SyntaxHighlightStyle; predictive: SyntaxHighlightStyle; }; + player: { 1: Player; 2: Player; From 4a728bb3d32a3873a766190718ef258de0bdad89 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 18:26:47 -0600 Subject: [PATCH 006/245] Convert project panel styles --- styles/app.ts | 180 +++++++++++++++++----------------------- styles/editor.ts | 38 +++------ styles/project-panel.ts | 32 +++++++ styles/theme.ts | 4 +- 4 files changed, 124 insertions(+), 130 deletions(-) create mode 100644 styles/project-panel.ts diff --git a/styles/app.ts b/styles/app.ts index a421da8f07dc854931d64268d84ae2cf9f4ec5e3..ae0f0717bb5dc13e20db348d36bdeb1d562e0885 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,46 +1,67 @@ -import { backgroundColor } from "./components"; +import { backgroundColor, text } from "./components"; import selectorModal from "./selector-modal"; import workspace from "./workspace"; import editor from "./editor"; import Theme from "./theme"; +import projectPanel from "./project-panel"; + +export const panel = { + padding: { top: 12, left: 12, bottom: 12, right: 12 }, +}; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), workspace: workspace(theme), editor: editor(theme), + projectDiagnostics: { + background: backgroundColor(theme, 300), + tabIconSpacing: 4, + tabIconWidth: 13, + tabSummarySpacing: 10, + emptyMessage: { + ...text(theme, "sans", "primary", { size: "lg" }), + }, + statusBarItem: { + ...text(theme, "sans", "muted"), + margin: { + right: 10, + }, + }, + }, + projectPanel: projectPanel(theme), chatPanel: { extends: "$panel", - channel_name: { + channelName: { extends: "$text.primary", weight: "bold", }, - channel_name_hash: { + channelNameHash: { text: "$text.muted", padding: { right: 8, }, }, - channel_select: { - active_item: { - extends: "$chat_panel.channel_select.item", + channelSelect: { + activeItem: { + extends: "$chatPanel.channel_select.item", name: "$text.primary", }, header: { - extends: "$chat_panel.channel_select.active_item", + extends: "$chat_panel.channel_select.activeItem", padding: { bottom: 4, left: 0, }, }, - hovered_active_item: { - extends: "$chat_panel.channel_select.hovered_item", + hoveredActiveItem: { + extends: "$chatPanel.channelSelect.hoveredItem", name: "$text.primary", }, - hovered_item: { + hoveredItem: { background: "$state.hover", - corner_radius: 6, - extends: "$chat_panel.channel_select.item", + cornerRadius: 6, + extends: "$chat_panel.channelSelect.item", }, item: { name: "$text.secondary", @@ -54,7 +75,7 @@ export default function app(theme: Theme): Object { }, menu: { background: "$surface.500", - corner_radius: 6, + cornerRadius: 6, padding: 4, border: { color: "$border.primary", @@ -67,14 +88,14 @@ export default function app(theme: Theme): Object { }, }, }, - hovered_sign_in_prompt: { + hoveredSignInPrompt: { color: "$text.secondary.color", - extends: "$chat_panel.sign_in_prompt", + extends: "$chatPanel.signInPrompt", }, - input_editor: { + inputEditor: { background: backgroundColor(theme, 300), - corner_radius: 6, - placeholder_text: "$text.muted", + cornerRadius: 6, + placeholderText: "$text.muted", selection: "$selection.host", text: "$text.primary", border: { @@ -102,8 +123,8 @@ export default function app(theme: Theme): Object { }, }, }, - pending_message: { - extends: "$chat_panel.message", + pendingMessage: { + extends: "$chatPanel.message", body: { color: "$text.muted.color", }, @@ -114,41 +135,41 @@ export default function app(theme: Theme): Object { color: "$text.muted.color", }, }, - sign_in_prompt: { + signInPrompt: { extends: "$text.primary", underline: true, }, }, - contacts_panel: { + contactsPanel: { extends: "$panel", - host_row_height: 28, - tree_branch_color: "$surface.100", - tree_branch_width: 1, - host_avatar: { - corner_radius: 10, + hostRowHeight: 28, + treeBranchColor: "$surface.100", + treeBranchWidth: 1, + hostAvatar: { + cornerRadius: 10, width: 18, }, - host_username: { + hostUsername: { extends: "$text.primary", padding: { left: 8, }, }, - hovered_shared_project: { + hoveredSharedProject: { background: "$state.hover", - corner_radius: 6, - extends: "$contacts_panel.shared_project", + cornerRadius: 6, + extends: "$contacts_panel.sharedProject", }, - hovered_unshared_project: { + hoveredUnsharedProject: { background: "$state.hover", - corner_radius: 6, - extends: "$contacts_panel.unshared_project", + cornerRadius: 6, + extends: "$contacts_panel.unsharedProject", }, project: { - guest_avatar_spacing: 4, + guestAvatarSpacing: 4, height: 24, - guest_avatar: { - corner_radius: 8, + guestAvatar: { + cornerRadius: 8, width: 14, }, name: { @@ -161,79 +182,34 @@ export default function app(theme: Theme): Object { left: 8, }, }, - shared_project: { - extends: "$contacts_panel.project", + sharedProject: { + extends: "$contactsPanel.project", name: { color: "$text.primary.color", }, }, - unshared_project: { - extends: "$contacts_panel.project", - }, - }, - project_diagnostics: { - background: backgroundColor(theme, 300), - tab_icon_spacing: 4, - tab_icon_width: 13, - tab_summary_spacing: 10, - empty_message: { - extends: "$text.primary", - size: 18, - }, - status_bar_item: { - extends: "$text.muted", - margin: { - right: 10, - }, - }, - }, - project_panel: { - extends: "$panel", - entry: { - height: 22, - icon_color: "$text.muted.color", - icon_size: 8, - icon_spacing: 8, - text: "$text.secondary", - }, - hovered_entry: { - background: "$state.hover", - extends: "$project_panel.entry", - }, - hovered_selected_entry: { - extends: "$project_panel.hovered_entry", - text: { - extends: "$text.primary", - }, - }, - padding: { - top: 6, - }, - selected_entry: { - extends: "$project_panel.entry", - text: { - extends: "$text.primary", - }, + unsharedProject: { + extends: "$contactsPanel.project", }, }, search: { background: backgroundColor(theme, 300), - match_background: "$state.highlighted_line", - tab_icon_spacing: 4, - tab_icon_width: 14, - active_hovered_option_button: { + matchBackground: "$state.highlightedLine", + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { background: "$surface.100", extends: "$search.option_button", }, - active_option_button: { + activeOptionButton: { background: "$surface.100", extends: "$search.option_button", }, editor: { background: "$surface.500", - corner_radius: 6, - max_width: 400, - placeholder_text: "$text.muted", + cornerRadius: 6, + maxWidth: 400, + placeholderText: "$text.muted", selection: "$selection.host", text: "$text.primary", border: { @@ -253,24 +229,24 @@ export default function app(theme: Theme): Object { top: 3, }, }, - hovered_option_button: { + hoveredOptionButton: { background: "$surface.100", - extends: "$search.option_button", + extends: "$search.optionButton", }, - invalid_editor: { + invalidEditor: { extends: "$search.editor", border: { color: "$status.bad", width: 1, }, }, - match_index: { + matchIndex: { extends: "$text.secondary", padding: 6, }, - option_button: { + optionButton: { background: backgroundColor(theme, 300), - corner_radius: 6, + cornerRadius: 6, extends: "$text.secondary", border: { color: "$border.primary", @@ -287,13 +263,13 @@ export default function app(theme: Theme): Object { top: 1, }, }, - option_button_group: { + optionButtonGroup: { padding: { left: 2, right: 2, }, }, - results_status: { + resultsStatus: { extends: "$text.primary", size: 18, }, diff --git a/styles/editor.ts b/styles/editor.ts index 9edfdc4716bea35b4c7e3cf83967383b4f6a3850..ea7012d2092ebd0d7df324762f4703693b32a89d 100644 --- a/styles/editor.ts +++ b/styles/editor.ts @@ -28,14 +28,11 @@ export default function editor(theme: Theme) { }), }, message: { - text: { - ...text(theme, "sans", color), - size: 14, - }, - highlightText: { - ...text(theme, "sans", color, { weight: "bold" }), - size: 14, - }, + text: text(theme, "sans", color, { size: "sm" }), + highlightText: text(theme, "sans", color, { + size: "sm", + weight: "bold", + }), }, }; } @@ -75,7 +72,7 @@ export default function editor(theme: Theme) { item: autocompleteItem, hoveredItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "hover"), + background: backgroundColor(theme, 100, "hovered"), }, margin: { left: -14, @@ -98,34 +95,25 @@ export default function editor(theme: Theme) { top: true, }), code: { - ...text(theme, "mono", "muted"), - size: 14, + ...text(theme, "mono", "muted", { size: "sm" }), margin: { left: 10, }, }, message: { - highlightText: { - ...text(theme, "sans", "primary"), - size: 14, + highlightText: text(theme, "sans", "primary", { + size: "sm", weight: "bold", - }, - text: { - ...text(theme, "sans", "secondary"), - size: 14, - }, + }), + text: text(theme, "sans", "secondary", { size: "sm" }), }, }, diagnosticPathHeader: { background: theme.editor.line.active, textScaleFactor: 0.857, - filename: { - ...text(theme, "mono", "primary"), - size: 14, - }, + filename: text(theme, "mono", "primary", { size: "sm" }), path: { - ...text(theme, "mono", "muted"), - size: 14, + ...text(theme, "mono", "muted", { size: "sm" }), margin: { left: 12, }, diff --git a/styles/project-panel.ts b/styles/project-panel.ts new file mode 100644 index 0000000000000000000000000000000000000000..343e11b96b6e8adb3c6bd223a71de3e6d7d05f40 --- /dev/null +++ b/styles/project-panel.ts @@ -0,0 +1,32 @@ +import { panel } from "./app"; +import { backgroundColor, iconColor, text, TextColor } from "./components"; +import Theme from "./theme"; +import { Color } from "./lib"; + +export default function projectPanel(theme: Theme) { + function entry(theme: Theme, textColor: TextColor, background?: Color) { + return { + height: 22, + background, + iconColor: iconColor(theme, "muted"), + iconSize: 8, + iconSpacing: 8, + text: text(theme, "mono", textColor), + }; + } + + return { + ...panel, + entry: entry(theme, "secondary"), + hoveredEntry: entry( + theme, + "secondary", + backgroundColor(theme, 300, "hovered") + ), + selectedEntry: entry(theme, "primary"), + hoveredSelectedEntry: entry(theme, "primary", "hovered"), + padding: { + top: 6, + }, + }; +} diff --git a/styles/theme.ts b/styles/theme.ts index 5220c962c9d2032d35b15e32d12547f92d4c4679..27f578f4366bacae8fdc5d4dc366375532e7f2b8 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,5 +1,3 @@ -import { colorRamp } from "./lib"; - export type Color = string; export type Weight = | "thin" @@ -36,7 +34,7 @@ export interface BackgroundColor { base: { value: Color; }; - hover: { + hovered: { value: Color; }; active: { From b8118ee50e71f5c59bdf5913daa55ee7bde7c487 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 18:45:34 -0600 Subject: [PATCH 007/245] Convert chat panel --- styles/app.ts | 112 +------------------------------------------ styles/chat-panel.ts | 108 +++++++++++++++++++++++++++++++++++++++++ styles/components.ts | 8 +++- 3 files changed, 116 insertions(+), 112 deletions(-) create mode 100644 styles/chat-panel.ts diff --git a/styles/app.ts b/styles/app.ts index ae0f0717bb5dc13e20db348d36bdeb1d562e0885..5f2993d30a68cad4410992387bf65a6d76c72a34 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -4,6 +4,7 @@ import workspace from "./workspace"; import editor from "./editor"; import Theme from "./theme"; import projectPanel from "./project-panel"; +import chatPanel from "./chat-panel"; export const panel = { padding: { top: 12, left: 12, bottom: 12, right: 12 }, @@ -30,116 +31,7 @@ export default function app(theme: Theme): Object { }, }, projectPanel: projectPanel(theme), - chatPanel: { - extends: "$panel", - channelName: { - extends: "$text.primary", - weight: "bold", - }, - channelNameHash: { - text: "$text.muted", - padding: { - right: 8, - }, - }, - channelSelect: { - activeItem: { - extends: "$chatPanel.channel_select.item", - name: "$text.primary", - }, - header: { - extends: "$chat_panel.channel_select.activeItem", - padding: { - bottom: 4, - left: 0, - }, - }, - hoveredActiveItem: { - extends: "$chatPanel.channelSelect.hoveredItem", - name: "$text.primary", - }, - hoveredItem: { - background: "$state.hover", - cornerRadius: 6, - extends: "$chat_panel.channelSelect.item", - }, - item: { - name: "$text.secondary", - padding: 4, - hash: { - extends: "$text.muted", - margin: { - right: 8, - }, - }, - }, - menu: { - background: "$surface.500", - cornerRadius: 6, - padding: 4, - border: { - color: "$border.primary", - width: 1, - }, - shadow: { - blur: 16, - color: "$shadow.0", - offset: [0, 2], - }, - }, - }, - hoveredSignInPrompt: { - color: "$text.secondary.color", - extends: "$chatPanel.signInPrompt", - }, - inputEditor: { - background: backgroundColor(theme, 300), - cornerRadius: 6, - placeholderText: "$text.muted", - selection: "$selection.host", - text: "$text.primary", - border: { - color: "$border.primary", - width: 1, - }, - padding: { - bottom: 7, - left: 8, - right: 8, - top: 7, - }, - }, - message: { - body: "$text.secondary", - timestamp: "$text.muted", - padding: { - bottom: 6, - }, - sender: { - extends: "$text.primary", - weight: "bold", - margin: { - right: 8, - }, - }, - }, - pendingMessage: { - extends: "$chatPanel.message", - body: { - color: "$text.muted.color", - }, - sender: { - color: "$text.muted.color", - }, - timestamp: { - color: "$text.muted.color", - }, - }, - signInPrompt: { - extends: "$text.primary", - underline: true, - }, - }, + chatPanel: chatPanel(theme), contactsPanel: { extends: "$panel", hostRowHeight: 28, diff --git a/styles/chat-panel.ts b/styles/chat-panel.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6bf0148ea4c5d9345c29d5df94c978588e4fd0d --- /dev/null +++ b/styles/chat-panel.ts @@ -0,0 +1,108 @@ +import { panel } from "./app"; +import { + backgroundColor, + border, + player, + shadow, + text, + TextColor, +} from "./components"; +import Theme from "./theme"; + +export default function chatPanel(theme: Theme) { + function channelSelectItem( + theme: Theme, + textColor: TextColor, + hovered: boolean + ) { + return { + name: text(theme, "sans", textColor), + padding: 4, + hash: { + ...text(theme, "sans", "muted"), + margin: { + right: 8, + }, + }, + background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, + cornerRadius: hovered ? 6 : 0, + }; + } + + const message = { + body: text(theme, "sans", "secondary"), + timestamp: text(theme, "sans", "muted"), + padding: { + bottom: 6, + }, + sender: { + ...text(theme, "sans", "primary", { weight: "bold" }), + margin: { + right: 8, + }, + }, + }; + + return { + ...panel, + channelName: text(theme, "sans", "primary", { weight: "bold" }), + channelNameHash: { + ...text(theme, "sans", "muted"), + padding: { + right: 8, + }, + }, + channelSelect: { + header: { + ...channelSelectItem(theme, "primary", false), + padding: { + bottom: 4, + left: 0, + }, + }, + item: channelSelectItem(theme, "secondary", false), + hoveredItem: channelSelectItem(theme, "secondary", true), + activeItem: channelSelectItem(theme, "primary", false), + hoveredActiveItem: channelSelectItem(theme, "primary", true), + menu: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 4, + border: border(theme, "primary"), + shadow: shadow(theme), + }, + }, + signInPrompt: text(theme, "sans", "secondary", { underline: true }), + hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), + message, + pendingMessage: { + ...message, + body: { + ...message.body, + color: theme.textColor.muted.value, + }, + sender: { + ...message.sender, + color: theme.textColor.muted.value, + }, + timestamp: { + ...message.timestamp, + color: theme.textColor.muted.value, + }, + }, + inputEditor: { + background: backgroundColor(theme, 300), + cornerRadius: 6, + text: text(theme, "mono", "primary"), + placeholderText: text(theme, "mono", "muted"), + selection: player(theme, 1).selection, + border: border(theme, "primary"), + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + }; +} diff --git a/styles/components.ts b/styles/components.ts index 14becaf2af30e94d4c6d3a0250b0e3f3aab52faf..28d883927bb8f7d6f333a1cf8e45c1149910ba63 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -9,7 +9,11 @@ export function text( theme: Theme, fontFamily: keyof typeof core.fontFamily, color: TextColor, - properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } + properties?: { + size?: keyof typeof core["fontSize"]; + weight?: Weight; + underline?: boolean; + } ) { const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; const size = core.fontSize[sizeKey].value; @@ -74,7 +78,7 @@ export function backgroundColor( return theme.backgroundColor[name][state || "base"].value; } -export function shadow(theme) { +export function shadow(theme: Theme) { return { blur: 16, color: chroma("black").alpha(theme.shadowAlpha.value).hex(), From c6c6cc591ab48ac46d25b28ac4994e616b65a76a Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 01:38:18 -0400 Subject: [PATCH 008/245] Update app.ts, editor.ts --- styles/app.ts | 63 +++++++++++++++++++------------------------- styles/components.ts | 4 +++ styles/editor.ts | 4 +-- styles/theme.ts | 12 +++++++++ styles/workspace.ts | 4 +-- 5 files changed, 47 insertions(+), 40 deletions(-) diff --git a/styles/app.ts b/styles/app.ts index 5f2993d30a68cad4410992387bf65a6d76c72a34..11e476baf73ec97e010288edcad2ce730299833b 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,10 +1,10 @@ -import { backgroundColor, text } from "./components"; -import selectorModal from "./selector-modal"; -import workspace from "./workspace"; +import chatPanel from "./chat-panel"; +import { backgroundColor, border, borderColor, player, text } from "./components"; import editor from "./editor"; -import Theme from "./theme"; import projectPanel from "./project-panel"; -import chatPanel from "./chat-panel"; +import selectorModal from "./selector-modal"; +import Theme from "./theme"; +import workspace from "./workspace"; export const panel = { padding: { top: 12, left: 12, bottom: 12, right: 12 }, @@ -35,27 +35,27 @@ export default function app(theme: Theme): Object { contactsPanel: { extends: "$panel", hostRowHeight: 28, - treeBranchColor: "$surface.100", + treeBranchColor: borderColor(theme, "muted"), treeBranchWidth: 1, hostAvatar: { cornerRadius: 10, width: 18, }, hostUsername: { - extends: "$text.primary", + ...text(theme, "mono", "muted"), padding: { left: 8, }, }, hoveredSharedProject: { - background: "$state.hover", - cornerRadius: 6, extends: "$contacts_panel.sharedProject", + background: theme.editor.line.active.value, + cornerRadius: 6, }, hoveredUnsharedProject: { - background: "$state.hover", - cornerRadius: 6, extends: "$contacts_panel.unsharedProject", + background: theme.editor.line.active.value, + cornerRadius: 6, }, project: { guestAvatarSpacing: 4, @@ -65,7 +65,7 @@ export default function app(theme: Theme): Object { width: 14, }, name: { - extends: "$text.secondary", + extends: text(theme, "mono", "secondary"), margin: { right: 6, }, @@ -77,7 +77,7 @@ export default function app(theme: Theme): Object { sharedProject: { extends: "$contactsPanel.project", name: { - color: "$text.primary.color", + color: text(theme, "mono", "primary"), }, }, unsharedProject: { @@ -86,28 +86,25 @@ export default function app(theme: Theme): Object { }, search: { background: backgroundColor(theme, 300), - matchBackground: "$state.highlightedLine", + matchBackground: theme.editor.highlight.match, tabIconSpacing: 4, tabIconWidth: 14, activeHoveredOptionButton: { - background: "$surface.100", extends: "$search.option_button", + background: backgroundColor(theme, 100), }, activeOptionButton: { - background: "$surface.100", extends: "$search.option_button", + background: backgroundColor(theme, 100), }, editor: { - background: "$surface.500", + background: backgroundColor(theme, 500), cornerRadius: 6, maxWidth: 400, - placeholderText: "$text.muted", - selection: "$selection.host", - text: "$text.primary", - border: { - color: "$border.primary", - width: 1, - }, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), margin: { bottom: 5, left: 5, @@ -122,28 +119,22 @@ export default function app(theme: Theme): Object { }, }, hoveredOptionButton: { - background: "$surface.100", extends: "$search.optionButton", + background: backgroundColor(theme, 100), }, invalidEditor: { extends: "$search.editor", - border: { - color: "$status.bad", - width: 1, - }, + border: border(theme, "error"), }, matchIndex: { - extends: "$text.secondary", + ...text(theme, "mono", "secondary"), padding: 6, }, optionButton: { + ...text(theme, "mono", "secondary"), background: backgroundColor(theme, 300), cornerRadius: 6, - extends: "$text.secondary", - border: { - color: "$border.primary", - width: 1, - }, + border: border(theme, "primary"), margin: { left: 1, right: 1, @@ -162,7 +153,7 @@ export default function app(theme: Theme): Object { }, }, resultsStatus: { - extends: "$text.primary", + ...text(theme, "mono", "primary"), size: 18, }, }, diff --git a/styles/components.ts b/styles/components.ts index 28d883927bb8f7d6f333a1cf8e45c1149910ba63..c8b2f87638a004365596f0ec11bab644580ed255 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -47,6 +47,10 @@ export function border( }; } +export function borderColor(theme: Theme, color: keyof Theme["borderColor"]) { + return theme.borderColor[color].value; +} + export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { return theme.iconColor[color].value; } diff --git a/styles/editor.ts b/styles/editor.ts index ea7012d2092ebd0d7df324762f4703693b32a89d..a27464eee2182ecfb0633623ff4e773cfb85b35d 100644 --- a/styles/editor.ts +++ b/styles/editor.ts @@ -4,7 +4,7 @@ import { iconColor, player, text, - TextColor, + TextColor } from "./components"; import Theme from "./theme"; @@ -89,7 +89,7 @@ export default function editor(theme: Theme) { diagnosticHeader: { background: theme.editor.background.value, iconWidthFactor: 1.5, - textScaleFactor: 0.857, + textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. border: border(theme, "secondary", { bottom: true, top: true, diff --git a/styles/theme.ts b/styles/theme.ts index 27f578f4366bacae8fdc5d4dc366375532e7f2b8..9d297d552d38b21154a77b2eed22d49a1ce2a247 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -71,6 +71,18 @@ export default interface Theme { active: { value: Color; }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; }; textColor: { primary: { diff --git a/styles/workspace.ts b/styles/workspace.ts index 5ecb3a378c8d1a5acedc5100203c9b9306e36dca..1a50fe9ee1c248de6d48a9521efa9f9cc8f82fbb 100644 --- a/styles/workspace.ts +++ b/styles/workspace.ts @@ -42,8 +42,8 @@ export default function workspace(theme: Theme) { }; const sidebarItem = { - height: "$workspace.tab.height", - iconColor: "$text.muted.color", + height: 32, + iconColor: iconColor(theme, "secondary"), iconSize: 18, }; const sidebar = { From fb41ad325c2b2294e18439dbe42f4473799e88e5 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 11:27:02 -0400 Subject: [PATCH 009/245] Extract `search` from `app` - Also update border to use borderColor( ) --- styles/app.ts | 79 +++---------------------------------------- styles/components.ts | 2 +- styles/search.ts | 80 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 76 deletions(-) create mode 100644 styles/search.ts diff --git a/styles/app.ts b/styles/app.ts index 11e476baf73ec97e010288edcad2ce730299833b..a65442db0737630f77d1de92d921d934ed4a8804 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,7 +1,8 @@ import chatPanel from "./chat-panel"; -import { backgroundColor, border, borderColor, player, text } from "./components"; +import { backgroundColor, borderColor, text } from "./components"; import editor from "./editor"; import projectPanel from "./project-panel"; +import search from "./search"; import selectorModal from "./selector-modal"; import Theme from "./theme"; import workspace from "./workspace"; @@ -33,7 +34,7 @@ export default function app(theme: Theme): Object { projectPanel: projectPanel(theme), chatPanel: chatPanel(theme), contactsPanel: { - extends: "$panel", + ...panel, hostRowHeight: 28, treeBranchColor: borderColor(theme, "muted"), treeBranchWidth: 1, @@ -84,78 +85,6 @@ export default function app(theme: Theme): Object { extends: "$contactsPanel.project", }, }, - search: { - background: backgroundColor(theme, 300), - matchBackground: theme.editor.highlight.match, - tabIconSpacing: 4, - tabIconWidth: 14, - activeHoveredOptionButton: { - extends: "$search.option_button", - background: backgroundColor(theme, 100), - }, - activeOptionButton: { - extends: "$search.option_button", - background: backgroundColor(theme, 100), - }, - editor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - maxWidth: 400, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "primary"), - margin: { - bottom: 5, - left: 5, - right: 5, - top: 5, - }, - padding: { - bottom: 3, - left: 13, - right: 13, - top: 3, - }, - }, - hoveredOptionButton: { - extends: "$search.optionButton", - background: backgroundColor(theme, 100), - }, - invalidEditor: { - extends: "$search.editor", - border: border(theme, "error"), - }, - matchIndex: { - ...text(theme, "mono", "secondary"), - padding: 6, - }, - optionButton: { - ...text(theme, "mono", "secondary"), - background: backgroundColor(theme, 300), - cornerRadius: 6, - border: border(theme, "primary"), - margin: { - left: 1, - right: 1, - }, - padding: { - bottom: 1, - left: 6, - right: 6, - top: 1, - }, - }, - optionButtonGroup: { - padding: { - left: 2, - right: 2, - }, - }, - resultsStatus: { - ...text(theme, "mono", "primary"), - size: 18, - }, - }, + search: search(theme), }; } diff --git a/styles/components.ts b/styles/components.ts index c8b2f87638a004365596f0ec11bab644580ed255..590c1b5eea9f6779dee0c2697a781d36b3edee60 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -41,7 +41,7 @@ export function border( options?: BorderOptions ) { return { - color: theme.borderColor[color].value, + color: borderColor(theme, color), width: 1, ...options, }; diff --git a/styles/search.ts b/styles/search.ts new file mode 100644 index 0000000000000000000000000000000000000000..ced2266ea73480da11f880d4c56b4a65aa83f12c --- /dev/null +++ b/styles/search.ts @@ -0,0 +1,80 @@ +import { backgroundColor, border, player, text } from "./components"; +import Theme from "./theme"; + +export default function search(theme: Theme) { + const optionButton = { + ...text(theme, "mono", "secondary"), + background: backgroundColor(theme, 300), + cornerRadius: 6, + border: border(theme, "primary"), + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }; + + return { + background: backgroundColor(theme, 300), + matchBackground: theme.editor.highlight.match, + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + activeOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + editor: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + maxWidth: 400, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + margin: { + bottom: 5, + left: 5, + right: 5, + top: 5, + }, + padding: { + bottom: 3, + left: 13, + right: 13, + top: 3, + }, + }, + hoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + invalidEditor: { + extends: "$search.editor", + border: border(theme, "error"), + }, + matchIndex: { + ...text(theme, "mono", "secondary"), + padding: 6, + }, + optionButton, + optionButtonGroup: { + padding: { + left: 2, + right: 2, + }, + }, + resultsStatus: { + ...text(theme, "mono", "primary"), + size: 18, + }, + }; +} From 0b690ac0b47d13da7da528cf52b0de91f46e7fe6 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 19:10:44 -0400 Subject: [PATCH 010/245] WIP: Scaffold tokens in dark.ts, no real values yet. --- styles/dark.ts | 438 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 styles/dark.ts diff --git a/styles/dark.ts b/styles/dark.ts new file mode 100644 index 0000000000000000000000000000000000000000..019f50e40cec8ede5e62d2db37e97e691fbce8d6 --- /dev/null +++ b/styles/dark.ts @@ -0,0 +1,438 @@ +import Theme from "./theme"; + +export default function dark(): Theme { + return { + backgroundColor: { + 100: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + 300: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + 500: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + }, + borderColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + active: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + textColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + placeholder: { + value: "#000000", + }, + active: { + value: "#000000", + }, + feature: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + iconColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + placeholder: { + value: "#000000", + }, + active: { + value: "#000000", + }, + feature: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + editor: { + background: { + value: "#000000", + }, + indent_guide: { + value: "#000000", + }, + indent_guide_active: { + value: "#000000", + }, + line: { + active: { + value: "#000000", + }, + highlighted: { + value: "#000000", + }, + inserted: { + value: "#000000", + }, + deleted: { + value: "#000000", + }, + modified: { + value: "#000000", + }, + }, + highlight: { + selection: { + value: "#000000", + }, + occurrence: { + value: "#000000", + }, + activeOccurrence: { + value: "#000000", + }, + matchingBracket: { + value: "#000000", + }, + match: { + value: "#000000", + }, + activeMatch: { + value: "#000000", + }, + related: { + value: "#000000", + }, + }, + gutter: { + primary: { + value: "#000000", + }, + active: { + value: "#000000", + }, + }, + }, + + syntax: { + primary: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + }, + player: { + 1: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 2: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 3: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 4: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 5: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 6: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 7: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 8: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + }, + shadowAlpha: { + value: 0.32, + }, + }; +} \ No newline at end of file From b4087b115bc67248eefd4e216f450f332fc8356c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 20:32:47 -0400 Subject: [PATCH 011/245] WIP for keith --- styles/dark.ts | 880 +++++++++++++++++++++++++------------------------ 1 file changed, 449 insertions(+), 431 deletions(-) diff --git a/styles/dark.ts b/styles/dark.ts index 019f50e40cec8ede5e62d2db37e97e691fbce8d6..efd2d3b8a49b1b43c53b8ee782d13615c0f3e0d2 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -1,438 +1,456 @@ +import core from "./core"; import Theme from "./theme"; -export default function dark(): Theme { - return { - backgroundColor: { - 100: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - 300: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - 500: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - ok: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - error: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - warning: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - info: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, +const backgroundColor = { + 100: { + base: { + value: core.color.neutral[999].value, }, - borderColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - textColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - placeholder: { - value: "#000000", - }, - active: { - value: "#000000", - }, - feature: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - iconColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - placeholder: { - value: "#000000", - }, - active: { - value: "#000000", - }, - feature: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - editor: { - background: { - value: "#000000", - }, - indent_guide: { - value: "#000000", - }, - indent_guide_active: { - value: "#000000", - }, - line: { - active: { - value: "#000000", - }, - highlighted: { - value: "#000000", - }, - inserted: { - value: "#000000", - }, - deleted: { - value: "#000000", - }, - modified: { - value: "#000000", - }, - }, - highlight: { - selection: { - value: "#000000", - }, - occurrence: { - value: "#000000", - }, - activeOccurrence: { - value: "#000000", - }, - matchingBracket: { - value: "#000000", - }, - match: { - value: "#000000", - }, - activeMatch: { - value: "#000000", - }, - related: { - value: "#000000", - }, - }, - gutter: { - primary: { - value: "#000000", - }, - active: { - value: "#000000", - }, - }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 300: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 500: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, +}; - syntax: { - primary: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - comment: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - punctuation: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - constant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - keyword: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - function: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - type: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - variant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - property: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - enum: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - operator: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - string: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - number: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - boolean: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - predictive: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - }, - player: { - 1: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 2: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 3: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 4: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 5: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 6: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 7: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 8: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - }, - shadowAlpha: { - value: 0.32, +const borderColor = { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + active: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, +}; + +const textColor = { + primary: { + value: core.color.neutral[150].value, + }, + secondary: { + value: core.color.neutral[350].value, + }, + muted: { + value: core.color.neutral[550].value, + }, + placeholder: { + value: core.color.neutral[750].value, + }, + active: { + value: core.color.neutral[0].value, + }, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, + }, + ok: { + value: core.color.green[600].value, + }, + error: { + value: core.color.red[400].value, + }, + warning: { + value: core.color.amber[300].value, + }, + info: { + value: core.color.blue[500].value, + }, +}; + +const iconColor = { + primary: { + value: core.color.neutral[300].value, + }, + secondary: { + value: core.color.neutral[500].value, + }, + muted: { + value: core.color.neutral[600].value, + }, + placeholder: { + value: core.color.neutral[700].value, + }, + active: { + value: core.color.neutral[50].value, + }, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, + }, + ok: { + value: core.color.green[600].value, + }, + error: { + value: core.color.red[400].value, + }, + warning: { + value: core.color.amber[300].value, + }, + info: { + value: core.color.blue[500].value, + }, +}; + +const editor = { + background: { + value: backgroundColor[500].base.value, + }, + indent_guide: { + value: core.color.neutral[999].value, + }, + indent_guide_active: { + value: core.color.neutral[999].value, + }, + line: { + active: { + value: core.color.neutral[999].value, + }, + highlighted: { + value: core.color.neutral[999].value, + }, + inserted: { + value: core.color.neutral[999].value, + }, + deleted: { + value: core.color.neutral[999].value, }, + modified: { + value: core.color.neutral[999].value, + }, + }, + highlight: { + selection: { + value: core.color.neutral[999].value, + }, + occurrence: { + value: core.color.neutral[999].value, + }, + activeOccurrence: { + value: core.color.neutral[999].value, + }, + matchingBracket: { + value: core.color.neutral[999].value, + }, + match: { + value: core.color.neutral[999].value, + }, + activeMatch: { + value: core.color.neutral[999].value, + }, + related: { + value: core.color.neutral[999].value, + }, + }, + gutter: { + primary: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + }, +}; + +const syntax = { + primary: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, +}; + +const player = { + 1: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 2: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 3: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 4: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 5: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 6: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 7: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 8: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, +}; + +const shadowAlpha = { + value: 0.32, +}; + +export default function dark(): Theme { + return { + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -} \ No newline at end of file +} From e3366c490e88c4f55bf1e35c8077cfe6089ad79a Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 17:51:25 -0700 Subject: [PATCH 012/245] wip --- message.txt | 1672 ++++++++++++++++++++++++++++++++++++++++++++++++ styles/dark.ts | 780 +++++++++++----------- 2 files changed, 2063 insertions(+), 389 deletions(-) create mode 100644 message.txt diff --git a/message.txt b/message.txt new file mode 100644 index 0000000000000000000000000000000000000000..f086360d37f8ee060cb030b5f2026d7a81f4864c --- /dev/null +++ b/message.txt @@ -0,0 +1,1672 @@ +{ + "core": { + "color": { + "neutral": { + "0": { + "value": "#FFFFFF", + "type": "color" + }, + "50": { + "value": "#F8F8F8", + "type": "color" + }, + "100": { + "value": "#F0F0F0", + "type": "color" + }, + "150": { + "value": "#E1E1E1", + "type": "color" + }, + "200": { + "value": "#D2D2D2", + "type": "color" + }, + "250": { + "value": "#C3C3C3", + "type": "color" + }, + "300": { + "value": "#B4B4B4", + "type": "color" + }, + "350": { + "value": "#A5A5A5", + "type": "color" + }, + "400": { + "value": "#969696", + "type": "color" + }, + "450": { + "value": "#878787", + "type": "color" + }, + "500": { + "value": "#787878", + "type": "color" + }, + "550": { + "value": "#696969", + "type": "color" + }, + "600": { + "value": "#5A5A5A", + "type": "color" + }, + "650": { + "value": "#4B4B4B", + "type": "color" + }, + "700": { + "value": "#3C3C3C", + "type": "color" + }, + "750": { + "value": "#262626", + "type": "color" + }, + "800": { + "value": "#1E1E1E", + "type": "color" + }, + "850": { + "value": "#0F0F0F", + "type": "color" + }, + "900": { + "value": "#000000", + "type": "color" + } + }, + "steel": { + "0": { + "value": "#F8FAFC", + "type": "color" + }, + "100": { + "value": "#F1F5F9", + "type": "color" + }, + "200": { + "value": "#E2E8F0", + "type": "color" + }, + "300": { + "value": "#CBD5E1", + "type": "color" + }, + "400": { + "value": "#94A3BA", + "type": "color" + }, + "500": { + "value": "#64748B", + "type": "color" + }, + "600": { + "value": "#475569", + "type": "color" + }, + "700": { + "value": "#334155", + "type": "color" + }, + "800": { + "value": "#1E293B", + "type": "color" + }, + "900": { + "value": "#0F172A", + "type": "color" + } + }, + "gray": { + "0": { + "value": "#FAFAFA", + "type": "color" + }, + "100": { + "value": "#F4F4F5", + "type": "color" + }, + "200": { + "value": "#E4E4E7", + "type": "color" + }, + "300": { + "value": "#D4D4D8", + "type": "color" + }, + "400": { + "value": "#A1A1AA", + "type": "color" + }, + "500": { + "value": "#71717A", + "type": "color" + }, + "600": { + "value": "#52525B", + "type": "color" + }, + "700": { + "value": "#3F3F46", + "type": "color" + }, + "800": { + "value": "#27272A", + "type": "color" + }, + "900": { + "value": "#18181B", + "type": "color" + } + }, + "rose": { + "0": { + "value": "#FFF1F2", + "type": "color" + }, + "100": { + "value": "#FFE4E6", + "type": "color" + }, + "200": { + "value": "#FECDD3", + "type": "color" + }, + "300": { + "value": "#FDA4AF", + "type": "color" + }, + "400": { + "value": "#FB7185", + "type": "color" + }, + "500": { + "value": "#F43F5E", + "type": "color" + }, + "600": { + "value": "#E11D48", + "type": "color" + }, + "700": { + "value": "#BE123C", + "type": "color" + }, + "800": { + "value": "#9F1239", + "type": "color" + }, + "900": { + "value": "#881337", + "type": "color" + } + }, + "red": { + "0": { + "value": "#FEF2F2", + "type": "color" + }, + "100": { + "value": "#FEE2E2", + "type": "color" + }, + "200": { + "value": "#FECACA", + "type": "color" + }, + "300": { + "value": "#FCA5A5", + "type": "color" + }, + "400": { + "value": "#F87171", + "type": "color" + }, + "500": { + "value": "#EF4444", + "type": "color" + }, + "600": { + "value": "#DC2626", + "type": "color" + }, + "700": { + "value": "#B91C1C", + "type": "color" + }, + "800": { + "value": "#991B1B", + "type": "color" + }, + "900": { + "value": "#7F1D1D", + "type": "color" + } + }, + "orange": { + "0": { + "value": "#FFF7ED", + "type": "color" + }, + "100": { + "value": "#FFEDD5", + "type": "color" + }, + "200": { + "value": "#FED7AA", + "type": "color" + }, + "300": { + "value": "#FDBA74", + "type": "color" + }, + "400": { + "value": "#FB923C", + "type": "color" + }, + "500": { + "value": "#F97316", + "type": "color" + }, + "600": { + "value": "#EA580C", + "type": "color" + }, + "700": { + "value": "#C2410C", + "type": "color" + }, + "800": { + "value": "#9A3412", + "type": "color" + }, + "900": { + "value": "#7C2D12", + "type": "color" + } + }, + "amber": { + "0": { + "value": "#FFFBEB", + "type": "color" + }, + "100": { + "value": "#FEF3C7", + "type": "color" + }, + "200": { + "value": "#FDE68A", + "type": "color" + }, + "300": { + "value": "#FCD34D", + "type": "color" + }, + "400": { + "value": "#FBBF24", + "type": "color" + }, + "500": { + "value": "#F59E0B", + "type": "color" + }, + "600": { + "value": "#D97706", + "type": "color" + }, + "700": { + "value": "#B45309", + "type": "color" + }, + "800": { + "value": "#92400E", + "type": "color" + }, + "900": { + "value": "#78350F", + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#FEFCE8", + "type": "color" + }, + "100": { + "value": "#FEF9C3", + "type": "color" + }, + "200": { + "value": "#FEF08A", + "type": "color" + }, + "300": { + "value": "#FDE047", + "type": "color" + }, + "400": { + "value": "#FACC15", + "type": "color" + }, + "500": { + "value": "#EAB308", + "type": "color" + }, + "600": { + "value": "#CA8A04", + "type": "color" + }, + "700": { + "value": "#A16207", + "type": "color" + }, + "800": { + "value": "#854D0E", + "type": "color" + }, + "900": { + "value": "#713F12", + "type": "color" + } + }, + "lime": { + "0": { + "value": "#F7FEE7", + "type": "color" + }, + "100": { + "value": "#ECFCCB", + "type": "color" + }, + "200": { + "value": "#D9F99D", + "type": "color" + }, + "300": { + "value": "#BEF264", + "type": "color" + }, + "400": { + "value": "#A3E635", + "type": "color" + }, + "500": { + "value": "#84CC16", + "type": "color" + }, + "600": { + "value": "#65A30D", + "type": "color" + }, + "700": { + "value": "#4D7C0F", + "type": "color" + }, + "800": { + "value": "#3F6212", + "type": "color" + }, + "900": { + "value": "#365314", + "type": "color" + } + }, + "green": { + "0": { + "value": "#F0FDF4", + "type": "color" + }, + "100": { + "value": "#DCFCE7", + "type": "color" + }, + "200": { + "value": "#BBF7D0", + "type": "color" + }, + "300": { + "value": "#86EFAC", + "type": "color" + }, + "400": { + "value": "#4ADE80", + "type": "color" + }, + "500": { + "value": "#22C55E", + "type": "color" + }, + "600": { + "value": "#16A34A", + "type": "color" + }, + "700": { + "value": "#15803D", + "type": "color" + }, + "800": { + "value": "#166534", + "type": "color" + }, + "900": { + "value": "#14532D", + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ECFDF5", + "type": "color" + }, + "100": { + "value": "#D1FAE5", + "type": "color" + }, + "200": { + "value": "#A7F3D0", + "type": "color" + }, + "300": { + "value": "#6EE7B7", + "type": "color" + }, + "400": { + "value": "#34D399", + "type": "color" + }, + "500": { + "value": "#10B981", + "type": "color" + }, + "600": { + "value": "#059669", + "type": "color" + }, + "700": { + "value": "#047857", + "type": "color" + }, + "800": { + "value": "#065F46", + "type": "color" + }, + "900": { + "value": "#064E3B", + "type": "color" + } + }, + "teal": { + "0": { + "value": "#F0FDFA", + "type": "color" + }, + "100": { + "value": "#CCFBF1", + "type": "color" + }, + "200": { + "value": "#99F6E4", + "type": "color" + }, + "300": { + "value": "#5EEAD4", + "type": "color" + }, + "400": { + "value": "#2DD4BF", + "type": "color" + }, + "500": { + "value": "#14B8A6", + "type": "color" + }, + "600": { + "value": "#0D9488", + "type": "color" + }, + "700": { + "value": "#0F766E", + "type": "color" + }, + "800": { + "value": "#115E59", + "type": "color" + }, + "900": { + "value": "#134E4A", + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ECFEFF", + "type": "color" + }, + "100": { + "value": "#CFFAFE", + "type": "color" + }, + "200": { + "value": "#A5F3FC", + "type": "color" + }, + "300": { + "value": "#67E8F9", + "type": "color" + }, + "400": { + "value": "#22D3EE", + "type": "color" + }, + "500": { + "value": "#06BBD4", + "type": "color" + }, + "600": { + "value": "#0891B2", + "type": "color" + }, + "700": { + "value": "#0E7490", + "type": "color" + }, + "800": { + "value": "#155E75", + "type": "color" + }, + "900": { + "value": "#164E63", + "type": "color" + } + }, + "sky": { + "0": { + "value": "#F0F9FF", + "type": "color" + }, + "100": { + "value": "#E0F2FE", + "type": "color" + }, + "200": { + "value": "#BAE6FD", + "type": "color" + }, + "300": { + "value": "#7DD3FC", + "type": "color" + }, + "400": { + "value": "#38BDF8", + "type": "color" + }, + "500": { + "value": "#0EA5E9", + "type": "color" + }, + "600": { + "value": "#0284C7", + "type": "color" + }, + "700": { + "value": "#0369A1", + "type": "color" + }, + "800": { + "value": "#075985", + "type": "color" + }, + "900": { + "value": "#0C4A6E", + "type": "color" + } + }, + "blue": { + "0": { + "value": "#EFF6FF", + "type": "color" + }, + "100": { + "value": "#DBEAFE", + "type": "color" + }, + "200": { + "value": "#BFDBFE", + "type": "color" + }, + "300": { + "value": "#93C5FD", + "type": "color" + }, + "400": { + "value": "#60A5FA", + "type": "color" + }, + "500": { + "value": "#3B82F6", + "type": "color" + }, + "600": { + "value": "#2563EB", + "type": "color" + }, + "700": { + "value": "#1D4ED8", + "type": "color" + }, + "800": { + "value": "#1E40A4", + "type": "color" + }, + "900": { + "value": "#1E3A8A", + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#EEF2FF", + "type": "color" + }, + "100": { + "value": "#E0E7FF", + "type": "color" + }, + "200": { + "value": "#C7D2FE", + "type": "color" + }, + "300": { + "value": "#A5B4FC", + "type": "color" + }, + "400": { + "value": "#818CF8", + "type": "color" + }, + "500": { + "value": "#6366F1", + "type": "color" + }, + "600": { + "value": "#4F46E5", + "type": "color" + }, + "700": { + "value": "#4338CA", + "type": "color" + }, + "800": { + "value": "#3730A3", + "type": "color" + }, + "900": { + "value": "#312E81", + "type": "color" + } + }, + "violet": { + "0": { + "value": "#F5F3FF", + "type": "color" + }, + "100": { + "value": "#EDE9FE", + "type": "color" + }, + "200": { + "value": "#DDD6FE", + "type": "color" + }, + "300": { + "value": "#C4B5FD", + "type": "color" + }, + "400": { + "value": "#A78BFA", + "type": "color" + }, + "500": { + "value": "#8B5CF6", + "type": "color" + }, + "600": { + "value": "#7C3AED", + "type": "color" + }, + "700": { + "value": "#6D28D9", + "type": "color" + }, + "800": { + "value": "#5B21B6", + "type": "color" + }, + "900": { + "value": "#4C1D95", + "type": "color" + } + }, + "purple": { + "0": { + "value": "#FAF5FF", + "type": "color" + }, + "100": { + "value": "#F3E8FF", + "type": "color" + }, + "200": { + "value": "#E9D5FF", + "type": "color" + }, + "300": { + "value": "#D8B4FE", + "type": "color" + }, + "400": { + "value": "#C084FC", + "type": "color" + }, + "500": { + "value": "#A855F7", + "type": "color" + }, + "600": { + "value": "#9333EA", + "type": "color" + }, + "700": { + "value": "#7E22CE", + "type": "color" + }, + "800": { + "value": "#6B21A8", + "type": "color" + }, + "900": { + "value": "#581C87", + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#FDF4FF", + "type": "color" + }, + "100": { + "value": "#FAE8FF", + "type": "color" + }, + "200": { + "value": "#F5D0FE", + "type": "color" + }, + "300": { + "value": "#F0ABFC", + "type": "color" + }, + "400": { + "value": "#E879F9", + "type": "color" + }, + "500": { + "value": "#D946E4", + "type": "color" + }, + "600": { + "value": "#C026D3", + "type": "color" + }, + "700": { + "value": "#A21CAF", + "type": "color" + }, + "800": { + "value": "#86198F", + "type": "color" + }, + "900": { + "value": "#701A75", + "type": "color" + } + }, + "pink": { + "0": { + "value": "#FDF2F8", + "type": "color" + }, + "100": { + "value": "#FCE7F3", + "type": "color" + }, + "200": { + "value": "#FBCFE8", + "type": "color" + }, + "300": { + "value": "#F988D4", + "type": "color" + }, + "400": { + "value": "#F472B6", + "type": "color" + }, + "500": { + "value": "#EC4899", + "type": "color" + }, + "600": { + "value": "#DB2777", + "type": "color" + }, + "700": { + "value": "#BE185D", + "type": "color" + }, + "800": { + "value": "#9D174D", + "type": "color" + }, + "900": { + "value": "#831843", + "type": "color" + } + } + }, + "font-weight": { + "normal": { + "100": { + "value": "Thin", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "normal-bold": { + "100": { + "value": "Thin", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "italic": { + "100": { + "value": "Thin Italic", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "italic-bold": { + "100": { + "value": "Thin Italic", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + } + }, + "font-family": { + "zed-mono": { + "value": "Zed Mono", + "type": "fontFamilies" + }, + "zed-sans": { + "value": "Zed Sans", + "type": "fontFamilies" + } + }, + "font-size": { + "3xs": { + "value": "8", + "type": "fontSizes" + }, + "2xs": { + "value": "10", + "type": "fontSizes" + }, + "xs": { + "value": "12", + "type": "fontSizes" + }, + "sm": { + "value": "14", + "type": "fontSizes" + }, + "base": { + "value": "16", + "type": "fontSizes" + }, + "lg": { + "value": "18", + "type": "fontSizes" + }, + "xl": { + "value": "20", + "type": "fontSizes" + } + }, + "leading": { + "xs": { + "value": "16", + "type": "lineHeights" + }, + "sm": { + "value": "20", + "type": "lineHeights" + }, + "base": { + "value": "24", + "type": "lineHeights" + }, + "lg": { + "value": "26", + "type": "lineHeights" + }, + "xl": { + "value": "28", + "type": "lineHeights" + }, + "2xl": { + "value": "30", + "type": "lineHeights" + } + }, + "text-decoration": { + "none": { + "value": "none", + "type": "textDecoration" + } + }, + "ui-text": { + "normal": { + "base": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.sm}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography", + "bold": { + "value": { + "fontFamily": "$text.family.zed-sans", + "fontWeight": "$text.weight.bold", + "lineHeight": "$text.leading.base", + "fontSize": "$text.size.xs", + "letterSpacing": "$text.tracking.default", + "paragraphSpacing": "$text.paragraphSpacing.0", + "textCase": "$text.case.default", + "decoration": "$text.decoration.none", + "textDecoration": "$text.decoration.none" + }, + "type": "typography" + } + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography", + "bold": { + "value": { + "fontFamily": "$text.family.zed-sans", + "fontWeight": "$text.weight.bold", + "lineHeight": "$text.leading.base", + "fontSize": "$text.size.xs", + "letterSpacing": "$text.tracking.default", + "paragraphSpacing": "$text.paragraphSpacing.0", + "textCase": "$text.case.default", + "decoration": "$text.decoration.none", + "textDecoration": "$text.decoration.none" + }, + "type": "typography" + } + } + }, + "bold": { + "base": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.600", + "lineHeight": "{leading.base}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.sm}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.600", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + } + } + }, + "buffer-text": { + "normal": { + "xs": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.sm}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "base": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.lg}", + "fontSize": "{font-size.base}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "$text.decoration.default" + }, + "type": "typography" + }, + "lg": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.lg}", + "fontSize": "{font-size.lg}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "$text.decoration.default" + }, + "type": "typography" + } + } + }, + "letter-spacing": { + "tight": { + "value": "-0.05", + "type": "letterSpacing" + }, + "base": { + "value": "0%", + "type": "letterSpacing" + }, + "wide": { + "value": "0.05", + "type": "letterSpacing" + } + }, + "paragraph-spacing": { + "default": { + "value": "0", + "type": "paragraphSpacing" + } + }, + "text-case": { + "default": { + "value": "none", + "type": "textCase" + }, + "lowercase": { + "value": "lowercase", + "type": "textCase" + }, + "uppercase": { + "value": "uppercase", + "type": "textCase" + } + }, + "space": { + "s-0": { + "value": "0", + "type": "spacing" + }, + "s-4": { + "value": "{var.base}", + "type": "spacing" + }, + "s-8": { + "value": "{var.base} * 2", + "type": "spacing" + }, + "s-12": { + "value": "{var.base} * 3", + "type": "spacing" + }, + "s-16": { + "value": "{var.base} * 4", + "type": "spacing" + } + }, + "internal": { + "mac-os": { + "red": { + "value": "#FF5E57", + "type": "color" + }, + "yellow": { + "value": "#FFBB2E", + "type": "color" + }, + "green": { + "value": "#38C149", + "type": "color" + } + } + }, + "border-radius": { + "xs": { + "value": "2", + "type": "borderRadius" + }, + "sm": { + "value": "4", + "type": "borderRadius" + }, + "base": { + "value": "6", + "type": "borderRadius" + }, + "lg": { + "value": "8", + "type": "borderRadius" + }, + "xl": { + "value": "10", + "type": "borderRadius" + } + }, + "border-width": { + "base": { + "value": "1", + "type": "borderWidth" + } + }, + "elevation": { + "300": { + "value": { + "x": "0", + "y": "4", + "blur": "12", + "spread": "0", + "color": "rgba({color.neutral.900}, {shadow.base})", + "type": "dropShadow" + }, + "type": "boxShadow" + } + }, + "var": { + "base": { + "value": "4", + "type": "other" + } + } + }, + "dark": { + "text-color": { + "primary": { + "value": "{color.neutral.150}", + "type": "color" + }, + "secondary": { + "value": "{color.neutral.350}", + "type": "color" + }, + "muted": { + "value": "{color.neutral.550}", + "type": "color" + }, + "minimal": { + "value": "{color.neutral.750}", + "type": "color" + }, + "active": { + "value": "{color.neutral.0}", + "type": "color" + }, + "disabled": { + "value": "{color.neutral.650}", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "icon-color": { + "primary": { + "value": "{text.secondary}", + "type": "color" + }, + "secondary": { + "value": "{text.muted}", + "type": "color" + }, + "active": { + "value": "{text.active}", + "type": "color" + }, + "disabled": { + "value": "{text.disabled}", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "icon-size": { + "default": { + "value": "16", + "type": "size" + } + }, + "background-color": { + "100": { + "value": "{color.neutral.750}", + "type": "color", + "description": "The app background. Used for title-bar, other daylight." + }, + "300": { + "value": "{color.neutral.800}", + "type": "color", + "description": "The primary surface layer. Used for tabs, panels, pop-overs, etc." + }, + "500": { + "value": "{color.neutral.900}", + "type": "color", + "description": "Used for the buffer background and active buffer tabs." + }, + "active": { + "value": "rgba({icon.active}}, 0.1)", + "type": "color" + }, + "focused": { + "value": "// wip", + "type": "color" + }, + "disabled": { + "value": "// wip", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "border-color": { + "default": { + "value": "{color.neutral.850}", + "type": "color" + }, + "secondary": { + "value": "{color.neutral.700}", + "type": "color" + }, + "minimal": { + "value": "{color.neutral.750}", + "type": "color" + }, + "active": { + "value": "{color.neutral.500}", + "type": "color" + }, + "focused": { + "value": "{color.neutral.100}", + "type": "color" + } + }, + "editor": { + "background-color": { + "value": "{surface.500}", + "type": "color" + }, + "indent-guide": { + "value": "{icon.disabled}", + "type": "color" + }, + "indent-guide-active": { + "value": "{icon.secondary}", + "type": "color" + }, + "highlight": { + "active-line": { + "value": "rgba({color.neutral.0}, 0.08)", + "type": "color" + }, + "selection": { + "value": "{player.selection.one}", + "type": "color" + }, + "folded-line": { + "value": "rgba({surface.500}, 0.03)", + "type": "color" + }, + "occurrence": { + "value": "rgba({text.active}, 0.15)", + "type": "color" + }, + "matching-bracket": { + "value": "rgba({color.indigo.500}, 0.8)", + "type": "color" + }, + "match": { + "value": "rgba({color.blue.500},0.5)", + "type": "color" + }, + "active-match": { + "value": "rgba({color.blue.500},0.8)", + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "{text.muted}", + "type": "color" + }, + "active": { + "value": "{text.active}", + "type": "color" + } + }, + "syntax": { + "primary": { + "value": "{text.primary}", + "type": "color" + }, + "comment": { + "value": "{color.lime.200}", + "type": "color" + }, + "punctuation": { + "value": "{text.secondary}", + "type": "color" + }, + "constant": { + "value": "{syntax.primary}", + "type": "color" + }, + "keyword": { + "value": "{color.sky.400}", + "type": "color" + }, + "function": { + "value": "{color.yellow.200}", + "type": "color" + }, + "type": { + "value": "{color.teal.300}", + "type": "color" + }, + "variant": { + "value": "{syntax.type}", + "type": "color" + }, + "property": { + "value": "{color.sky.300}", + "type": "color" + }, + "enum": { + "value": "{syntax.operator}", + "type": "color" + }, + "operator": { + "value": "{syntax.keyword}", + "type": "color" + }, + "string": { + "value": "{color.orange.300}", + "type": "color" + }, + "number": { + "value": "{syntax.primary}", + "type": "color" + }, + "boolean": { + "value": "{syntax.number}", + "type": "color" + }, + "predictive": { + "value": "{text.muted}", + "type": "color" + } + } + }, + "player": { + "color": { + "1": { + "value": "{color.blue.600}", + "type": "color" + }, + "2": { + "value": "{color.indigo.500}", + "type": "color" + }, + "3": { + "value": "{color.green.500}", + "type": "color" + }, + "4": { + "value": "{color.orange.500}", + "type": "color" + }, + "5": { + "value": "{color.purple.500}", + "type": "color" + }, + "6": { + "value": "{color.teal.400}", + "type": "color" + }, + "7": { + "value": "{color.pink.400}", + "type": "color" + }, + "8": { + "value": "{color.yellow.400}", + "type": "color" + } + }, + "selection": { + "1": { + "value": "rgba({color.blue.600},0.1)", + "type": "color" + }, + "2": { + "value": "rgba({color.indigo.500}, 0.1)", + "type": "color" + }, + "3": { + "value": "rgba({color.green.500}, 0.1)", + "type": "color" + }, + "4": { + "value": "rgba({color.orange.500}, 0.15)", + "type": "color" + }, + "5": { + "value": "rgba({color.purple.500}, 0.1)", + "type": "color" + }, + "6": { + "value": "rgba({color.teal.400}, 0.1)", + "type": "color" + }, + "7": { + "value": "rgba({color.pink.400}, 0.1)", + "type": "color" + }, + "8": { + "value": "rgba({color.yellow.400}, 0.15)", + "type": "color" + } + } + }, + "shadow": { + "base": { + "value": "0.36", + "type": "opacity" + } + } + } +} \ No newline at end of file diff --git a/styles/dark.ts b/styles/dark.ts index efd2d3b8a49b1b43c53b8ee782d13615c0f3e0d2..bfcac3db816697fdb537860e7ed8a4e981ccd860 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -2,455 +2,457 @@ import core from "./core"; import Theme from "./theme"; const backgroundColor = { - 100: { - base: { - value: core.color.neutral[999].value, + 100: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 300: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 500: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, - }, - 300: { - base: { - value: core.color.neutral[999].value, +}; + +const borderColor = { + primary: { + value: "#000000", }, - hovered: { - value: core.color.neutral[999].value, + secondary: { + value: "#000000", }, - active: { - value: core.color.neutral[999].value, + muted: { + value: "#000000", }, focused: { - value: core.color.neutral[999].value, - }, - }, - 500: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: "#000000", + value: "#000000", }, active: { - value: "#000000", - }, - focused: { - value: "#000000", + value: "#000000", }, - }, - ok: { - base: { - value: "#000000", + ok: { + value: "#000000", }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", + error: { + value: "#000000", }, - }, - error: { - base: { - value: "#000000", + warning: { + value: "#000000", }, - hovered: { - value: "#000000", + info: { + value: "#000000", }, - active: { - value: "#000000", +}; + +const textColor = { + primary: { + value: core.color.neutral[150].value, }, - focused: { - value: "#000000", + secondary: { + value: core.color.neutral[350].value, }, - }, - warning: { - base: { - value: "#000000", + muted: { + value: core.color.neutral[550].value, }, - hovered: { - value: "#000000", + placeholder: { + value: core.color.neutral[750].value, }, active: { - value: "#000000", + value: core.color.neutral[0].value, }, - focused: { - value: "#000000", + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, }, - }, - info: { - base: { - value: "#000000", + ok: { + value: core.color.green[600].value, }, - hovered: { - value: "#000000", + error: { + value: core.color.red[400].value, }, - active: { - value: "#000000", + warning: { + value: core.color.amber[300].value, }, - focused: { - value: "#000000", + info: { + value: core.color.blue[500].value, }, - }, -}; - -const borderColor = { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, -}; - -const textColor = { - primary: { - value: core.color.neutral[150].value, - }, - secondary: { - value: core.color.neutral[350].value, - }, - muted: { - value: core.color.neutral[550].value, - }, - placeholder: { - value: core.color.neutral[750].value, - }, - active: { - value: core.color.neutral[0].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, }; const iconColor = { - primary: { - value: core.color.neutral[300].value, - }, - secondary: { - value: core.color.neutral[500].value, - }, - muted: { - value: core.color.neutral[600].value, - }, - placeholder: { - value: core.color.neutral[700].value, - }, - active: { - value: core.color.neutral[50].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, -}; - -const editor = { - background: { - value: backgroundColor[500].base.value, - }, - indent_guide: { - value: core.color.neutral[999].value, - }, - indent_guide_active: { - value: core.color.neutral[999].value, - }, - line: { - active: { - value: core.color.neutral[999].value, - }, - highlighted: { - value: core.color.neutral[999].value, - }, - inserted: { - value: core.color.neutral[999].value, - }, - deleted: { - value: core.color.neutral[999].value, - }, - modified: { - value: core.color.neutral[999].value, + primary: { + value: core.color.neutral[300].value, }, - }, - highlight: { - selection: { - value: core.color.neutral[999].value, + secondary: { + value: core.color.neutral[500].value, }, - occurrence: { - value: core.color.neutral[999].value, + muted: { + value: core.color.neutral[600].value, }, - activeOccurrence: { - value: core.color.neutral[999].value, + placeholder: { + value: core.color.neutral[700].value, }, - matchingBracket: { - value: core.color.neutral[999].value, + active: { + value: core.color.neutral[50].value, }, - match: { - value: core.color.neutral[999].value, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, }, - activeMatch: { - value: core.color.neutral[999].value, + ok: { + value: core.color.green[600].value, }, - related: { - value: core.color.neutral[999].value, + error: { + value: core.color.red[400].value, }, - }, - gutter: { - primary: { - value: core.color.neutral[999].value, + warning: { + value: core.color.amber[300].value, }, - active: { - value: core.color.neutral[999].value, + info: { + value: core.color.blue[500].value, }, - }, }; -const syntax = { - primary: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - comment: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - punctuation: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - constant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - keyword: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - function: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - type: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - variant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - property: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - enum: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - operator: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - string: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - number: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - boolean: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - predictive: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, +const editor = { + background: { + value: backgroundColor[500].base.value, + }, + indent_guide: { + value: core.color.neutral[999].value, + }, + indent_guide_active: { + value: core.color.neutral[999].value, + }, + line: { + active: { + value: core.color.neutral[999].value, + }, + highlighted: { + value: core.color.neutral[999].value, + }, + inserted: { + value: core.color.neutral[999].value, + }, + deleted: { + value: core.color.neutral[999].value, + }, + modified: { + value: core.color.neutral[999].value, + }, + }, + highlight: { + selection: { + value: core.color.neutral[999].value, + }, + occurrence: { + value: core.color.neutral[999].value, + }, + activeOccurrence: { + value: core.color.neutral[999].value, + }, + matchingBracket: { + value: core.color.neutral[999].value, + }, + match: { + value: core.color.neutral[999].value, + }, + activeMatch: { + value: core.color.neutral[999].value, + }, + related: { + value: core.color.neutral[999].value, + }, + }, + gutter: { + primary: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + }, }; -const player = { - 1: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 2: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 3: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 4: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 5: { - baseColor: { - value: core.color.neutral[999].value, +const syntax = { + primary: { + color: { + value: core.color.neutral[150] + }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 6: { - baseColor: { - value: core.color.neutral[999].value, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 7: { - baseColor: { - value: core.color.neutral[999].value, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 8: { - baseColor: { - value: core.color.neutral[999].value, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, +}; + +const player = { + 1: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 2: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 3: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 4: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 5: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 6: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 7: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 8: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, }, - }, }; const shadowAlpha = { - value: 0.32, + value: 0.32, }; export default function dark(): Theme { - return { - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, - }; + return { + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, + }; } From ce8d5bc0db119417bd21824f3a9f7345fa366b50 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 19:05:21 -0700 Subject: [PATCH 013/245] wip --- styles/core.ts | 102 +++++------ styles/dark.ts | 462 +++++++++++++----------------------------------- styles/theme.ts | 358 ++++++++++++++----------------------- 3 files changed, 307 insertions(+), 615 deletions(-) diff --git a/styles/core.ts b/styles/core.ts index e9e81982e456c0ffe151b83ac36767d62140c6ba..49e376b4ebf81968b2681179be46b3c5b27055b6 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,58 +1,58 @@ import { colorRamp } from "./lib"; export default { - fontFamily: { - sans: "Zed Sans", - mono: "Zed Mono", - }, - fontSize: { - "3xs": { - value: "8", - type: "fontSizes", + fontFamily: { + sans: "Zed Sans", + mono: "Zed Mono", }, - "2xs": { - value: "10", - type: "fontSizes", + fontSize: { + "3xs": { + value: "8", + type: "fontSizes", + }, + "2xs": { + value: "10", + type: "fontSizes", + }, + xs: { + value: "12", + type: "fontSizes", + }, + sm: { + value: "14", + type: "fontSizes", + }, + md: { + value: "16", + type: "fontSizes", + }, + lg: { + value: "18", + type: "fontSizes", + }, + xl: { + value: "20", + type: "fontSizes", + }, }, - xs: { - value: "12", - type: "fontSizes", + color: { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), }, - sm: { - value: "14", - type: "fontSizes", - }, - md: { - value: "16", - type: "fontSizes", - }, - lg: { - value: "18", - type: "fontSizes", - }, - xl: { - value: "20", - type: "fontSizes", - }, - }, - color: { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), - rose: colorRamp("#F43F5EFF"), - red: colorRamp("#EF4444FF"), - orange: colorRamp("#F97316FF"), - amber: colorRamp("#F59E0BFF"), - yellow: colorRamp("#EAB308FF"), - lime: colorRamp("#84CC16FF"), - green: colorRamp("#22C55EFF"), - emerald: colorRamp("#10B981FF"), - teal: colorRamp("#14B8A6FF"), - cyan: colorRamp("#06BBD4FF"), - sky: colorRamp("#0EA5E9FF"), - blue: colorRamp("#3B82F6FF"), - indigo: colorRamp("#6366F1FF"), - violet: colorRamp("#8B5CF6FF"), - purple: colorRamp("#A855F7FF"), - fuschia: colorRamp("#D946E4FF"), - pink: colorRamp("#EC4899FF"), - }, }; diff --git a/styles/dark.ts b/styles/dark.ts index bfcac3db816697fdb537860e7ed8a4e981ccd860..5b60bd0316a53fc24a830e23d428088675ac45de 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -1,442 +1,230 @@ import core from "./core"; import Theme from "./theme"; +const { color } = core; + const backgroundColor = { 100: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], }, 300: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], }, 500: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], }, ok: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], }, error: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], }, warning: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], }, info: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], }, }; const borderColor = { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[999], + error: color.neutral[999], + warning: color.neutral[999], + info: color.neutral[999], }; const textColor = { - primary: { - value: core.color.neutral[150].value, - }, - secondary: { - value: core.color.neutral[350].value, - }, - muted: { - value: core.color.neutral[550].value, - }, - placeholder: { - value: core.color.neutral[750].value, - }, - active: { - value: core.color.neutral[0].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: { - value: core.color.neutral[300].value, - }, - secondary: { - value: core.color.neutral[500].value, - }, - muted: { - value: core.color.neutral[600].value, - }, - placeholder: { - value: core.color.neutral[700].value, - }, - active: { - value: core.color.neutral[50].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const editor = { - background: { - value: backgroundColor[500].base.value, - }, - indent_guide: { - value: core.color.neutral[999].value, - }, - indent_guide_active: { - value: core.color.neutral[999].value, - }, + background: backgroundColor[500].base, + indent_guide: color.neutral[999], + indent_guide_active: color.neutral[999], line: { - active: { - value: core.color.neutral[999].value, - }, - highlighted: { - value: core.color.neutral[999].value, - }, - inserted: { - value: core.color.neutral[999].value, - }, - deleted: { - value: core.color.neutral[999].value, - }, - modified: { - value: core.color.neutral[999].value, - }, + active: color.neutral[999], + highlighted: color.neutral[999], + inserted: color.neutral[999], + deleted: color.neutral[999], + modified: color.neutral[999], }, highlight: { - selection: { - value: core.color.neutral[999].value, - }, - occurrence: { - value: core.color.neutral[999].value, - }, - activeOccurrence: { - value: core.color.neutral[999].value, - }, - matchingBracket: { - value: core.color.neutral[999].value, - }, - match: { - value: core.color.neutral[999].value, - }, - activeMatch: { - value: core.color.neutral[999].value, - }, - related: { - value: core.color.neutral[999].value, - }, + selection: color.neutral[999], + occurrence: color.neutral[999], + activeOccurrence: color.neutral[999], + matchingBracket: color.neutral[999], + match: color.neutral[999], + activeMatch: color.neutral[999], + related: color.neutral[999], }, gutter: { - primary: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, + primary: color.neutral[999], + active: color.neutral[999], }, }; const syntax = { primary: { - color: { - value: core.color.neutral[150] - }, + color: textColor.primary, weight: { value: "normal" }, }, comment: { - color: { value: "000000" }, + color: color.lime[200], weight: { value: "normal" }, }, punctuation: { - color: { value: "000000" }, + color: textColor.primary, weight: { value: "normal" }, }, constant: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, keyword: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, function: { - color: { value: "000000" }, + color: color.yellow[200], weight: { value: "normal" }, }, type: { - color: { value: "000000" }, + color: color.teal[300], weight: { value: "normal" }, }, variant: { - color: { value: "000000" }, + color: color.teal[300], weight: { value: "normal" }, }, property: { - color: { value: "000000" }, + color: color.sky[300], weight: { value: "normal" }, }, enum: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, operator: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, string: { - color: { value: "000000" }, + color: color.orange[300], weight: { value: "normal" }, }, number: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, boolean: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, predictive: { - color: { value: "000000" }, + color: textColor.muted, weight: { value: "normal" }, }, }; const player = { 1: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], }, 2: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], }, 3: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], }, 4: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], }, 5: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], }, 6: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], }, 7: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], }, 8: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], }, }; diff --git a/styles/theme.ts b/styles/theme.ts index 9d297d552d38b21154a77b2eed22d49a1ce2a247..9d70ea0227053f81e48d2e3359379db635bed7c8 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,242 +1,146 @@ +export interface NumberToken { + value: number, + type: "number" +} + export type Color = string; +export interface ColorToken { + value: Color; + type: "color"; + step?: number +} export type Weight = - | "thin" - | "extra_light" - | "light" - | "normal" - | "medium" - | "semibold" - | "bold" - | "extra_bold" - | "black"; + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; +export interface WeightToken { + value: Weight, + type: "fontWeight" +} -interface SyntaxHighlightStyle { - color: { value: Color }; - weight: { value: Weight }; +export interface SyntaxHighlightStyle { + color: ColorToken; + weight: WeightToken; } -interface Player { - baseColor: { - value: Color; - }; - cursorColor: { - value: Color; - }; - selectionColor: { - value: Color; - }; - borderColor: { - value: Color; - }; +export interface Player { + baseColor: ColorToken; + cursorColor: ColorToken; + selectionColor: ColorToken; + borderColor: ColorToken; } export interface BackgroundColor { - base: { - value: Color; - }; - hovered: { - value: Color; - }; - active: { - value: Color; - }; - focused: { - value: Color; - }; + base: ColorToken; + hovered: ColorToken; + active: ColorToken; + focused: ColorToken; } export default interface Theme { - backgroundColor: { - 100: BackgroundColor; - 300: BackgroundColor; - 500: BackgroundColor; - ok: BackgroundColor; - error: BackgroundColor; - warning: BackgroundColor; - info: BackgroundColor; - }; - borderColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; - }; - focused: { - value: Color; - }; - active: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - textColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; + backgroundColor: { + 100: BackgroundColor; + 300: BackgroundColor; + 500: BackgroundColor; + ok: BackgroundColor; + error: BackgroundColor; + warning: BackgroundColor; + info: BackgroundColor; + }; + borderColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + focused: ColorToken; + active: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + textColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + iconColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + editor: { + background: ColorToken; + indent_guide: ColorToken; + indent_guide_active: ColorToken; + line: { + active: ColorToken; + highlighted: ColorToken; + inserted: ColorToken; + deleted: ColorToken; + modified: ColorToken; + }; + highlight: { + selection: ColorToken; + occurrence: ColorToken; + activeOccurrence: ColorToken; + matchingBracket: ColorToken; + match: ColorToken; + activeMatch: ColorToken; + related: ColorToken; + }; + gutter: { + primary: ColorToken; + active: ColorToken; + }; }; - placeholder: { - value: Color; - }; - active: { - value: Color; - }; - feature: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - iconColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; - }; - placeholder: { - value: Color; - }; - active: { - value: Color; - }; - feature: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - editor: { - background: { - value: Color; - }; - indent_guide: { - value: Color; - }; - indent_guide_active: { - value: Color; - }; - line: { - active: { - value: Color; - }; - highlighted: { - value: Color; - }; - inserted: { - value: Color; - }; - deleted: { - value: Color; - }; - modified: { - value: Color; - }; - }; - highlight: { - selection: { - value: Color; - }; - occurrence: { - value: Color; - }; - activeOccurrence: { - value: Color; - }; - matchingBracket: { - value: Color; - }; - match: { - value: Color; - }; - activeMatch: { - value: Color; - }; - related: { - value: Color; - }; - }; - gutter: { - primary: { - value: Color; - }; - active: { - value: Color; - }; - }; - }; - syntax: { - primary: SyntaxHighlightStyle; - comment: SyntaxHighlightStyle; - punctuation: SyntaxHighlightStyle; - constant: SyntaxHighlightStyle; - keyword: SyntaxHighlightStyle; - function: SyntaxHighlightStyle; - type: SyntaxHighlightStyle; - variant: SyntaxHighlightStyle; - property: SyntaxHighlightStyle; - enum: SyntaxHighlightStyle; - operator: SyntaxHighlightStyle; - string: SyntaxHighlightStyle; - number: SyntaxHighlightStyle; - boolean: SyntaxHighlightStyle; - predictive: SyntaxHighlightStyle; - }; + syntax: { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; + }; - player: { - 1: Player; - 2: Player; - 3: Player; - 4: Player; - 5: Player; - 6: Player; - 7: Player; - 8: Player; - }; - shadowAlpha: { - value: number; - }; + player: { + 1: Player; + 2: Player; + 3: Player; + 4: Player; + 5: Player; + 6: Player; + 7: Player; + 8: Player; + }; + shadowAlpha: NumberToken; } From e990b46b9de028c46f6f08a2847f4313c4b1fa69 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 20:27:25 -0700 Subject: [PATCH 014/245] Finish dark.ts initial port and restructure files to get ready for build script Build script currently fails to type check. Not sure whats going on. Will fix in the morning. Co-authored-by: Nate Butler --- styles/.gitignore | 1 + styles/buildStyleTree.ts | 11 + styles/{ => styleTree}/app.ts | 0 .../{chat-panel.ts => styleTree/chatPanel.ts} | 0 styles/{ => styleTree}/components.ts | 6 +- styles/{ => styleTree}/editor.ts | 0 .../projectPanel.ts} | 4 +- styles/{ => styleTree}/search.ts | 0 .../selectorModal.ts} | 0 styles/{ => styleTree}/workspace.ts | 0 styles/{ => themes}/dark.ts | 197 +++++++------- styles/themes/light.ts | 251 ++++++++++++++++++ styles/{ => themes}/theme.ts | 36 +-- styles/{ => tokens}/core.ts | 2 +- styles/{lib.ts => utils/color.ts} | 0 15 files changed, 388 insertions(+), 120 deletions(-) create mode 100644 styles/.gitignore create mode 100644 styles/buildStyleTree.ts rename styles/{ => styleTree}/app.ts (100%) rename styles/{chat-panel.ts => styleTree/chatPanel.ts} (100%) rename styles/{ => styleTree}/components.ts (92%) rename styles/{ => styleTree}/editor.ts (100%) rename styles/{project-panel.ts => styleTree/projectPanel.ts} (90%) rename styles/{ => styleTree}/search.ts (100%) rename styles/{selector-modal.ts => styleTree/selectorModal.ts} (100%) rename styles/{ => styleTree}/workspace.ts (100%) rename styles/{ => themes}/dark.ts (71%) create mode 100644 styles/themes/light.ts rename styles/{ => themes}/theme.ts (82%) rename styles/{ => tokens}/core.ts (97%) rename styles/{lib.ts => utils/color.ts} (100%) diff --git a/styles/.gitignore b/styles/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c2658d7d1b31848c3b71960543cb0368e56cd4c7 --- /dev/null +++ b/styles/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/styles/buildStyleTree.ts b/styles/buildStyleTree.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fa1c1576d96f312c79b52d15ce2429f3902ff8a --- /dev/null +++ b/styles/buildStyleTree.ts @@ -0,0 +1,11 @@ +import dark from "./themes/dark"; +import light from "./themes/light"; +import app from "./styleTree/app"; + +for (let theme of [dark, light]) { + let styleTree = app(theme); + + let styleTreeJson = JSON.stringify(styleTree); + console.log(styleTreeJson); + // TODO: Write style tree json to zed crate assets folder +} \ No newline at end of file diff --git a/styles/app.ts b/styles/styleTree/app.ts similarity index 100% rename from styles/app.ts rename to styles/styleTree/app.ts diff --git a/styles/chat-panel.ts b/styles/styleTree/chatPanel.ts similarity index 100% rename from styles/chat-panel.ts rename to styles/styleTree/chatPanel.ts diff --git a/styles/components.ts b/styles/styleTree/components.ts similarity index 92% rename from styles/components.ts rename to styles/styleTree/components.ts index 590c1b5eea9f6779dee0c2697a781d36b3edee60..b54956facccc3874998176870498368dbe8b5b56 100644 --- a/styles/components.ts +++ b/styles/styleTree/components.ts @@ -1,7 +1,7 @@ import chroma from "chroma-js"; -import core from "./core"; -import { Color } from "./lib"; -import Theme, { BackgroundColor, Weight } from "./theme"; +import core from "../tokens/core"; +import { Color } from "../utils/color"; +import Theme, { BackgroundColor, Weight } from "../themes/theme"; export type TextColor = keyof Theme["textColor"]; diff --git a/styles/editor.ts b/styles/styleTree/editor.ts similarity index 100% rename from styles/editor.ts rename to styles/styleTree/editor.ts diff --git a/styles/project-panel.ts b/styles/styleTree/projectPanel.ts similarity index 90% rename from styles/project-panel.ts rename to styles/styleTree/projectPanel.ts index 343e11b96b6e8adb3c6bd223a71de3e6d7d05f40..3b5fba8853da3799e69be735447e615341ef8391 100644 --- a/styles/project-panel.ts +++ b/styles/styleTree/projectPanel.ts @@ -1,7 +1,7 @@ import { panel } from "./app"; import { backgroundColor, iconColor, text, TextColor } from "./components"; -import Theme from "./theme"; -import { Color } from "./lib"; +import Theme from "../themes/theme"; +import { Color } from "../utils/color"; export default function projectPanel(theme: Theme) { function entry(theme: Theme, textColor: TextColor, background?: Color) { diff --git a/styles/search.ts b/styles/styleTree/search.ts similarity index 100% rename from styles/search.ts rename to styles/styleTree/search.ts diff --git a/styles/selector-modal.ts b/styles/styleTree/selectorModal.ts similarity index 100% rename from styles/selector-modal.ts rename to styles/styleTree/selectorModal.ts diff --git a/styles/workspace.ts b/styles/styleTree/workspace.ts similarity index 100% rename from styles/workspace.ts rename to styles/styleTree/workspace.ts diff --git a/styles/dark.ts b/styles/themes/dark.ts similarity index 71% rename from styles/dark.ts rename to styles/themes/dark.ts index 5b60bd0316a53fc24a830e23d428088675ac45de..098677a1e91c898e1e57624fa28a39fe9bbafee9 100644 --- a/styles/dark.ts +++ b/styles/themes/dark.ts @@ -1,5 +1,5 @@ -import core from "./core"; -import Theme from "./theme"; +import core from "../tokens/core"; +import Theme, { NumberToken, Syntax } from "./theme"; const { color } = core; @@ -88,159 +88,162 @@ const iconColor = { info: color.blue[500], }; +const player = { + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, +}; + +// TODO: Fixup const editor = { background: backgroundColor[500].base, - indent_guide: color.neutral[999], - indent_guide_active: color.neutral[999], + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, line: { - active: color.neutral[999], - highlighted: color.neutral[999], - inserted: color.neutral[999], - deleted: color.neutral[999], - modified: color.neutral[999], + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: color.neutral[999], - occurrence: color.neutral[999], - activeOccurrence: color.neutral[999], - matchingBracket: color.neutral[999], - match: color.neutral[999], - activeMatch: color.neutral[999], - related: color.neutral[999], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], }, gutter: { - primary: color.neutral[999], - active: color.neutral[999], + primary: color.neutral[0], + active: color.neutral[0], }, }; -const syntax = { +const syntax: Syntax = { primary: { color: textColor.primary, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, comment: { color: color.lime[200], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, punctuation: { color: textColor.primary, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, constant: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, keyword: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, function: { color: color.yellow[200], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, type: { color: color.teal[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, variant: { color: color.teal[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, property: { color: color.sky[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, enum: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, operator: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, string: { color: color.orange[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, number: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, boolean: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, predictive: { color: textColor.muted, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, }; -const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, +const shadowAlpha: NumberToken = { + value: 0.32, + type: "number" }; -const shadowAlpha = { - value: 0.32, +const theme: Theme = { + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -export default function dark(): Theme { - return { - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, - }; -} +export default theme; \ No newline at end of file diff --git a/styles/themes/light.ts b/styles/themes/light.ts new file mode 100644 index 0000000000000000000000000000000000000000..20760427f273e93d72c2cf7cee6a8c0f6ae7192d --- /dev/null +++ b/styles/themes/light.ts @@ -0,0 +1,251 @@ +import core from "../tokens/core"; +import Theme, { NumberToken, Syntax } from "./theme"; + +const { color } = core; + +// TODO: Replace with light values + +const backgroundColor = { + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, +}; + +const borderColor = { + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[999], + error: color.neutral[999], + warning: color.neutral[999], + info: color.neutral[999], +}; + +const textColor = { + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], +}; + +const iconColor = { + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], +}; + +const player = { + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, +}; + +// TODO: Fixup +const editor = { + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, +}; + +const syntax: Syntax = { + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, +}; + +const shadowAlpha: NumberToken = { + value: 0.32, + type: "number" +}; + +const theme: Theme = { + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, +}; + +export default theme; diff --git a/styles/theme.ts b/styles/themes/theme.ts similarity index 82% rename from styles/theme.ts rename to styles/themes/theme.ts index 9d70ea0227053f81e48d2e3359379db635bed7c8..e319f510c7daa52c64caefc3d8d2c8c7bfde4221 100644 --- a/styles/theme.ts +++ b/styles/themes/theme.ts @@ -43,6 +43,24 @@ export interface BackgroundColor { focused: ColorToken; } +export interface Syntax { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; +}; + export default interface Theme { backgroundColor: { 100: BackgroundColor; @@ -114,23 +132,7 @@ export default interface Theme { }; }; - syntax: { - primary: SyntaxHighlightStyle; - comment: SyntaxHighlightStyle; - punctuation: SyntaxHighlightStyle; - constant: SyntaxHighlightStyle; - keyword: SyntaxHighlightStyle; - function: SyntaxHighlightStyle; - type: SyntaxHighlightStyle; - variant: SyntaxHighlightStyle; - property: SyntaxHighlightStyle; - enum: SyntaxHighlightStyle; - operator: SyntaxHighlightStyle; - string: SyntaxHighlightStyle; - number: SyntaxHighlightStyle; - boolean: SyntaxHighlightStyle; - predictive: SyntaxHighlightStyle; - }; + syntax: Syntax, player: { 1: Player; diff --git a/styles/core.ts b/styles/tokens/core.ts similarity index 97% rename from styles/core.ts rename to styles/tokens/core.ts index 49e376b4ebf81968b2681179be46b3c5b27055b6..38bfe82e28129954a2f5602038d575a3cfbb94af 100644 --- a/styles/core.ts +++ b/styles/tokens/core.ts @@ -1,4 +1,4 @@ -import { colorRamp } from "./lib"; +import { colorRamp } from "../utils/color"; export default { fontFamily: { diff --git a/styles/lib.ts b/styles/utils/color.ts similarity index 100% rename from styles/lib.ts rename to styles/utils/color.ts From 1d42cbcf421e7b39a40ed0de127907f470de878e Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 23:42:45 -0400 Subject: [PATCH 015/245] Type `name` --- styles/themes/theme.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index e319f510c7daa52c64caefc3d8d2c8c7bfde4221..a7760459897b0bedec0d87512e669d1d7ae0a3b4 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -62,6 +62,7 @@ export interface Syntax { }; export default interface Theme { + name: string; backgroundColor: { 100: BackgroundColor; 300: BackgroundColor; From cea3ac62175fa9b64d4e4bbcd2048e222b48e633 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 23:43:01 -0400 Subject: [PATCH 016/245] Update renamed/moved imports --- styles/styleTree/app.ts | 8 ++++---- styles/styleTree/chatPanel.ts | 4 ++-- styles/styleTree/components.ts | 2 +- styles/styleTree/editor.ts | 2 +- styles/styleTree/search.ts | 2 +- styles/styleTree/selectorModal.ts | 2 +- styles/styleTree/workspace.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index a65442db0737630f77d1de92d921d934ed4a8804..c7edfdc2701f06e6cb1b41beb779ad6bc0aca75b 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,10 +1,10 @@ -import chatPanel from "./chat-panel"; +import Theme from "../themes/theme"; +import chatPanel from "./chatPanel"; import { backgroundColor, borderColor, text } from "./components"; import editor from "./editor"; -import projectPanel from "./project-panel"; +import projectPanel from "./projectPanel"; import search from "./search"; -import selectorModal from "./selector-modal"; -import Theme from "./theme"; +import selectorModal from "./selectorModal"; import workspace from "./workspace"; export const panel = { diff --git a/styles/styleTree/chatPanel.ts b/styles/styleTree/chatPanel.ts index c6bf0148ea4c5d9345c29d5df94c978588e4fd0d..ea9a8ffe22a83e2b7135bc886273f2da2d7c1502 100644 --- a/styles/styleTree/chatPanel.ts +++ b/styles/styleTree/chatPanel.ts @@ -1,3 +1,4 @@ +import Theme from "../themes/theme"; import { panel } from "./app"; import { backgroundColor, @@ -5,9 +6,8 @@ import { player, shadow, text, - TextColor, + TextColor } from "./components"; -import Theme from "./theme"; export default function chatPanel(theme: Theme) { function channelSelectItem( diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index b54956facccc3874998176870498368dbe8b5b56..8038cdcd3b37494e1217fc4557090cb7bfe01378 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -1,7 +1,7 @@ import chroma from "chroma-js"; +import Theme, { BackgroundColor, Weight } from "../themes/theme"; import core from "../tokens/core"; import { Color } from "../utils/color"; -import Theme, { BackgroundColor, Weight } from "../themes/theme"; export type TextColor = keyof Theme["textColor"]; diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index a27464eee2182ecfb0633623ff4e773cfb85b35d..5d800881e2750942c2b7d6f1113df203aff97fb3 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -1,3 +1,4 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, @@ -6,7 +7,6 @@ import { text, TextColor } from "./components"; -import Theme from "./theme"; export default function editor(theme: Theme) { const autocompleteItem = { diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index ced2266ea73480da11f880d4c56b4a65aa83f12c..fd2fd2568156f31a877de40773b9382eb5a8e6ca 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, player, text } from "./components"; -import Theme from "./theme"; export default function search(theme: Theme) { const optionButton = { diff --git a/styles/styleTree/selectorModal.ts b/styles/styleTree/selectorModal.ts index ddba32683a976153eac6fc0f49f6a5df9a835a1f..fdebe712fa0f1650a3fe4411b4579aa30bb44e2e 100644 --- a/styles/styleTree/selectorModal.ts +++ b/styles/styleTree/selectorModal.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, player, shadow, text } from "./components"; -import Theme from "./theme"; export default function selectorModal(theme: Theme): Object { const item = { diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 1a50fe9ee1c248de6d48a9521efa9f9cc8f82fbb..e8232442b6f01ec2d0e3486509218f4b4c9e7562 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, iconColor, text } from "./components"; -import Theme from "./theme"; export default function workspace(theme: Theme) { const signInPrompt = { From 99738db8a5dc3cab8eed2f5662dba341142d132b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 08:25:58 -0600 Subject: [PATCH 017/245] Fix TS compile error --- styles/styleTree/components.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index 8038cdcd3b37494e1217fc4557090cb7bfe01378..55a64cb1ecb4ec8f60878d9e795f671a9a5cfede 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -15,7 +15,7 @@ export function text( underline?: boolean; } ) { - const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; + const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md"; const size = core.fontSize[sizeKey].value; return { From 6734a0e69d273abf3f2a5887930285540a65e7bf Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 09:45:11 -0600 Subject: [PATCH 018/245] Write theme JSON files from buildThemes script Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- script/build-themes | 7 + styles/buildStyleTree.ts | 11 - styles/buildThemes.ts | 17 ++ styles/package-lock.json | 279 ++++++++++++++++++++- styles/package.json | 7 +- styles/themes/dark.ts | 432 ++++++++++++++++----------------- styles/themes/light.ts | 430 ++++++++++++++++---------------- styles/tsconfig.json | 12 + styles/utils/decamelizeTree.ts | 21 ++ 9 files changed, 771 insertions(+), 445 deletions(-) create mode 100755 script/build-themes delete mode 100644 styles/buildStyleTree.ts create mode 100644 styles/buildThemes.ts create mode 100644 styles/tsconfig.json create mode 100644 styles/utils/decamelizeTree.ts diff --git a/script/build-themes b/script/build-themes new file mode 100755 index 0000000000000000000000000000000000000000..aef3a4250cdac8a3934938e812d5c7602d388731 --- /dev/null +++ b/script/build-themes @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd styles +npm install +npm run build diff --git a/styles/buildStyleTree.ts b/styles/buildStyleTree.ts deleted file mode 100644 index 6fa1c1576d96f312c79b52d15ce2429f3902ff8a..0000000000000000000000000000000000000000 --- a/styles/buildStyleTree.ts +++ /dev/null @@ -1,11 +0,0 @@ -import dark from "./themes/dark"; -import light from "./themes/light"; -import app from "./styleTree/app"; - -for (let theme of [dark, light]) { - let styleTree = app(theme); - - let styleTreeJson = JSON.stringify(styleTree); - console.log(styleTreeJson); - // TODO: Write style tree json to zed crate assets folder -} \ No newline at end of file diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts new file mode 100644 index 0000000000000000000000000000000000000000..ced82e98664980b3d1af9f50d8f4f8f498f59d49 --- /dev/null +++ b/styles/buildThemes.ts @@ -0,0 +1,17 @@ +import * as fs from "fs"; +import * as path from "path"; +import dark from "./themes/dark"; +import light from "./themes/light"; +import app from "./styleTree/app"; +import decamelizeTree from "./utils/decamelizeTree"; + +const themes = [dark, light]; +for (let theme of themes) { + let styleTree = decamelizeTree(app(theme)); + let styleTreeJSON = JSON.stringify(styleTree, null, 2); + let outPath = path.resolve( + `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` + ); + fs.writeFileSync(outPath, styleTreeJSON); + console.log(`Generated ${outPath}`); +} diff --git a/styles/package-lock.json b/styles/package-lock.json index 7b8503bf720d572d64bb9179a78489beaa068cb4..582f1c84968a5c1a25ddac5fd3c21ba907353c6d 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -10,30 +10,307 @@ "license": "ISC", "dependencies": { "@types/chroma-js": "^2.1.3", - "chroma-js": "^2.4.2" + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2", + "ts-node": "^10.7.0" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + }, "node_modules/@types/chroma-js": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" }, + "node_modules/@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "node_modules/case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } } }, "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + }, "@types/chroma-js": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + } + }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "peer": true + }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" } } } diff --git a/styles/package.json b/styles/package.json index c66da8718b6d4f2047cbc4e7580036946dab1fb8..c270bba0e1563cee758bbf5a02fb9fc1848b37ae 100644 --- a/styles/package.json +++ b/styles/package.json @@ -4,12 +4,15 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "ts-node buildThemes.ts" }, "author": "", "license": "ISC", "dependencies": { "@types/chroma-js": "^2.1.3", - "chroma-js": "^2.4.2" + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2", + "ts-node": "^10.7.0" } } diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 098677a1e91c898e1e57624fa28a39fe9bbafee9..42f80cf4c670deda733f434c3cbab691239f5396 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -4,246 +4,246 @@ import Theme, { NumberToken, Syntax } from "./theme"; const { color } = core; const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[999], - error: color.neutral[999], - warning: color.neutral[999], - info: color.neutral[999], + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[1000], + error: color.neutral[1000], + warning: color.neutral[1000], + info: color.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number" + value: 0.32, + type: "number", }; const theme: Theme = { - name: "dark", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -export default theme; \ No newline at end of file +export default theme; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index 20760427f273e93d72c2cf7cee6a8c0f6ae7192d..7a9bf1b552650b81288e70acc6c7500c80a8246b 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -6,246 +6,246 @@ const { color } = core; // TODO: Replace with light values const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[999], - error: color.neutral[999], - warning: color.neutral[999], - info: color.neutral[999], + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[1000], + error: color.neutral[1000], + warning: color.neutral[1000], + info: color.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number" + value: 0.32, + type: "number", }; const theme: Theme = { - name: "light", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/tsconfig.json b/styles/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..3dfbcc715ef17318d9267709bb8f25a8b91ecac0 --- /dev/null +++ b/styles/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "esModuleInterop": true, + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": true + }, + "exclude": ["node_modules"] + } \ No newline at end of file diff --git a/styles/utils/decamelizeTree.ts b/styles/utils/decamelizeTree.ts new file mode 100644 index 0000000000000000000000000000000000000000..d606902082e974b6cb7b0602e06cc32b0a9e1b5f --- /dev/null +++ b/styles/utils/decamelizeTree.ts @@ -0,0 +1,21 @@ +import { snakeCase } from "case-anything"; + +export default function decamelizeTree(object: { [key: string]: any }) { + const snakeObject: { [key: string]: any } = {}; + for (const key in object) { + snakeObject[snakeCase(key)] = decamelizeValue(object[key]); + } + return snakeObject; +} + +function decamelizeValue(value: any): any { + if (typeof value === "object") { + if (Array.isArray(value)) { + return value.map(decamelizeValue); + } else { + return decamelizeTree(value); + } + } else { + return value; + } +} From 9147a19522b899b837bad38b14b81fe88bb46c1a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 09:56:50 -0600 Subject: [PATCH 019/245] Update style tree based on changes to _base.toml from main Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- styles/styleTree/search.ts | 15 ++++++--------- styles/styleTree/workspace.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index fd2fd2568156f31a877de40773b9382eb5a8e6ca..7ba04cd688e01f5b3a4f47b35311195fde73fefb 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -20,7 +20,6 @@ export default function search(theme: Theme) { }; return { - background: backgroundColor(theme, 300), matchBackground: theme.editor.highlight.match, tabIconSpacing: 4, tabIconWidth: 14, @@ -35,22 +34,20 @@ export default function search(theme: Theme) { editor: { background: backgroundColor(theme, 500), cornerRadius: 6, - maxWidth: 400, + minWidth: 200, + maxWidth: 500, placeholderText: text(theme, "mono", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), border: border(theme, "primary"), margin: { - bottom: 5, - left: 5, right: 5, - top: 5, }, padding: { - bottom: 3, - left: 13, - right: 13, top: 3, + bottom: 3, + left: 14, + right: 14, }, }, hoveredOptionButton: { @@ -62,7 +59,7 @@ export default function search(theme: Theme) { border: border(theme, "error"), }, matchIndex: { - ...text(theme, "mono", "secondary"), + ...text(theme, "mono", "muted"), padding: 6, }, optionButton, diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index e8232442b6f01ec2d0e3486509218f4b4c9e7562..148db089183e77274a81a122d6f02d920b640237 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -127,7 +127,15 @@ export default function workspace(theme: Theme) { }, }, toolbar: { - height: 44, + height: 34, + background: backgroundColor(theme, 300), + border: border(theme, "primary", { bottom: true }), + itemSpacing: 8, + padding: { left: 16, right: 8, top: 4, bottom: 4 }, + }, + breadcrumbs: { + ...text(theme, "mono", "secondary"), + padding: { left: 6 }, }, }; } From 93c0c2af0a7407072802f38a53937d9da2e2b30f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 11:45:08 -0600 Subject: [PATCH 020/245] Start loading new theme JSON format instead of TOML Replaced remaining extends with javascript object extension. Moved tokens/core.ts to tokens.ts and massaged the types to make it more obvious when types don't match up. Co-authored-by: Nathan Sobo --- crates/theme/src/resolution.rs | 497 ----------- crates/theme/src/theme.rs | 3 +- crates/theme/src/theme_registry.rs | 234 +---- crates/zed/assets/themes/_base.toml | 411 --------- crates/zed/assets/themes/black.toml | 67 -- crates/zed/assets/themes/dark.json | 1245 +++++++++++++++++++++++++++ crates/zed/assets/themes/dark.toml | 67 -- crates/zed/assets/themes/light.json | 1245 +++++++++++++++++++++++++++ crates/zed/assets/themes/light.toml | 67 -- crates/zed/src/zed.rs | 3 +- styles/buildThemes.ts | 14 +- styles/styleTree/app.ts | 106 +-- styles/styleTree/components.ts | 14 +- styles/styleTree/contactsPanel.ts | 61 ++ styles/styleTree/editor.ts | 245 +++--- styles/styleTree/projectPanel.ts | 6 +- styles/styleTree/search.ts | 44 +- styles/styleTree/workspace.ts | 5 + styles/themes/dark.ts | 462 +++++----- styles/themes/light.ts | 300 ++++--- styles/themes/theme.ts | 37 +- styles/tokens.ts | 102 +++ styles/tokens/core.ts | 58 -- 23 files changed, 3284 insertions(+), 2009 deletions(-) delete mode 100644 crates/theme/src/resolution.rs delete mode 100644 crates/zed/assets/themes/_base.toml delete mode 100644 crates/zed/assets/themes/black.toml create mode 100644 crates/zed/assets/themes/dark.json delete mode 100644 crates/zed/assets/themes/dark.toml create mode 100644 crates/zed/assets/themes/light.json delete mode 100644 crates/zed/assets/themes/light.toml create mode 100644 styles/styleTree/contactsPanel.ts create mode 100644 styles/tokens.ts delete mode 100644 styles/tokens/core.ts diff --git a/crates/theme/src/resolution.rs b/crates/theme/src/resolution.rs deleted file mode 100644 index acebf72b86120065cb8587d05c2a8db92a00cced..0000000000000000000000000000000000000000 --- a/crates/theme/src/resolution.rs +++ /dev/null @@ -1,497 +0,0 @@ -use anyhow::{anyhow, Result}; -use indexmap::IndexMap; -use serde_json::Value; -use std::{ - cell::RefCell, - mem, - rc::{Rc, Weak}, -}; - -pub fn resolve_references(value: Value) -> Result { - let tree = Tree::from_json(value)?; - tree.resolve()?; - tree.to_json() -} - -#[derive(Clone)] -enum Node { - Reference { - path: String, - parent: Option>>, - }, - Object { - base: Option, - children: IndexMap, - resolved: bool, - parent: Option>>, - }, - Array { - children: Vec, - resolved: bool, - parent: Option>>, - }, - String { - value: String, - parent: Option>>, - }, - Number { - value: serde_json::Number, - parent: Option>>, - }, - Bool { - value: bool, - parent: Option>>, - }, - Null { - parent: Option>>, - }, -} - -#[derive(Clone)] -struct Tree(Rc>); - -impl Tree { - pub fn new(node: Node) -> Self { - Self(Rc::new(RefCell::new(node))) - } - - fn from_json(value: Value) -> Result { - match value { - Value::String(value) => { - if let Some(path) = value.strip_prefix("$") { - Ok(Self::new(Node::Reference { - path: path.to_string(), - parent: None, - })) - } else { - Ok(Self::new(Node::String { - value, - parent: None, - })) - } - } - Value::Number(value) => Ok(Self::new(Node::Number { - value, - parent: None, - })), - Value::Bool(value) => Ok(Self::new(Node::Bool { - value, - parent: None, - })), - Value::Null => Ok(Self::new(Node::Null { parent: None })), - Value::Object(object) => { - let tree = Self::new(Node::Object { - base: Default::default(), - children: Default::default(), - resolved: false, - parent: None, - }); - let mut children = IndexMap::new(); - let mut resolved = true; - let mut base = None; - for (key, value) in object.into_iter() { - let value = if key == "extends" { - if value.is_string() { - if let Value::String(value) = value { - base = value.strip_prefix("$").map(str::to_string); - resolved = false; - Self::new(Node::String { - value, - parent: None, - }) - } else { - unreachable!() - } - } else { - Tree::from_json(value)? - } - } else { - Tree::from_json(value)? - }; - value - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&tree.0))); - resolved &= value.is_resolved(); - children.insert(key.clone(), value); - } - - *tree.0.borrow_mut() = Node::Object { - base, - children, - resolved, - parent: None, - }; - Ok(tree) - } - Value::Array(elements) => { - let tree = Self::new(Node::Array { - children: Default::default(), - resolved: false, - parent: None, - }); - - let mut children = Vec::new(); - let mut resolved = true; - for element in elements { - let child = Tree::from_json(element)?; - child - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&tree.0))); - resolved &= child.is_resolved(); - children.push(child); - } - - *tree.0.borrow_mut() = Node::Array { - children, - resolved, - parent: None, - }; - Ok(tree) - } - } - } - - fn to_json(&self) -> Result { - match &*self.0.borrow() { - Node::Reference { .. } => Err(anyhow!("unresolved tree")), - Node::String { value, .. } => Ok(Value::String(value.clone())), - Node::Number { value, .. } => Ok(Value::Number(value.clone())), - Node::Bool { value, .. } => Ok(Value::Bool(*value)), - Node::Null { .. } => Ok(Value::Null), - Node::Object { children, .. } => { - let mut json_children = serde_json::Map::new(); - for (key, value) in children { - json_children.insert(key.clone(), value.to_json()?); - } - Ok(Value::Object(json_children)) - } - Node::Array { children, .. } => { - let mut json_children = Vec::new(); - for child in children { - json_children.push(child.to_json()?); - } - Ok(Value::Array(json_children)) - } - } - } - - fn parent(&self) -> Option { - match &*self.0.borrow() { - Node::Reference { parent, .. } - | Node::Object { parent, .. } - | Node::Array { parent, .. } - | Node::String { parent, .. } - | Node::Number { parent, .. } - | Node::Bool { parent, .. } - | Node::Null { parent } => parent.as_ref().and_then(|p| p.upgrade()).map(Tree), - } - } - - fn get(&self, path: &str) -> Result> { - let mut tree = self.clone(); - for component in path.split('.') { - let node = tree.0.borrow(); - match &*node { - Node::Object { children, .. } => { - if let Some(subtree) = children.get(component).cloned() { - drop(node); - tree = subtree; - } else { - return Err(anyhow!( - "key \"{}\" does not exist in path \"{}\"", - component, - path - )); - } - } - Node::Reference { .. } => return Ok(None), - Node::Array { .. } - | Node::String { .. } - | Node::Number { .. } - | Node::Bool { .. } - | Node::Null { .. } => { - return Err(anyhow!( - "key \"{}\" in path \"{}\" is not an object", - component, - path - )) - } - } - } - - Ok(Some(tree)) - } - - fn is_resolved(&self) -> bool { - match &*self.0.borrow() { - Node::Reference { .. } => false, - Node::Object { resolved, .. } | Node::Array { resolved, .. } => *resolved, - Node::String { .. } | Node::Number { .. } | Node::Bool { .. } | Node::Null { .. } => { - true - } - } - } - - fn update_resolved(&self) { - match &mut *self.0.borrow_mut() { - Node::Object { - resolved, - base, - children, - .. - } => { - *resolved = base.is_none() && children.values().all(|c| c.is_resolved()); - } - Node::Array { - resolved, children, .. - } => { - *resolved = children.iter().all(|c| c.is_resolved()); - } - _ => {} - } - } - - pub fn resolve(&self) -> Result<()> { - let mut unresolved = vec![self.clone()]; - let mut made_progress = true; - - while made_progress && !unresolved.is_empty() { - made_progress = false; - for mut tree in mem::take(&mut unresolved) { - made_progress |= tree.resolve_subtree(self, &mut unresolved)?; - if tree.is_resolved() { - while let Some(parent) = tree.parent() { - parent.update_resolved(); - if !parent.is_resolved() { - break; - } - tree = parent; - } - } - } - } - - if unresolved.is_empty() { - Ok(()) - } else { - Err(anyhow!("tree contains cycles")) - } - } - - fn resolve_subtree(&self, root: &Tree, unresolved: &mut Vec) -> Result { - let node = self.0.borrow(); - match &*node { - Node::Reference { path, parent } => { - if let Some(subtree) = root.get(&path)? { - if subtree.is_resolved() { - let parent = parent.clone(); - drop(node); - let mut new_node = subtree.0.borrow().clone(); - new_node.set_parent(parent); - *self.0.borrow_mut() = new_node; - Ok(true) - } else { - unresolved.push(self.clone()); - Ok(false) - } - } else { - unresolved.push(self.clone()); - Ok(false) - } - } - Node::Object { - base, - children, - resolved, - .. - } => { - if *resolved { - Ok(false) - } else { - let mut made_progress = false; - let mut children_resolved = true; - for child in children.values() { - made_progress |= child.resolve_subtree(root, unresolved)?; - children_resolved &= child.is_resolved(); - } - - if children_resolved { - let mut has_base = false; - let mut resolved_base = None; - if let Some(base) = base { - has_base = true; - if let Some(base) = root.get(base)? { - if base.is_resolved() { - resolved_base = Some(base); - } - } - } - - drop(node); - - if let Some(base) = resolved_base.as_ref() { - self.extend_from(&base); - made_progress = true; - } - - if let Node::Object { resolved, base, .. } = &mut *self.0.borrow_mut() { - if has_base { - if resolved_base.is_some() { - base.take(); - *resolved = true; - } else { - unresolved.push(self.clone()); - } - } else { - *resolved = true; - } - } - } else if base.is_some() { - unresolved.push(self.clone()); - } - - Ok(made_progress) - } - } - Node::Array { - children, resolved, .. - } => { - if *resolved { - Ok(false) - } else { - let mut made_progress = false; - let mut children_resolved = true; - for child in children.iter() { - made_progress |= child.resolve_subtree(root, unresolved)?; - children_resolved &= child.is_resolved(); - } - - if children_resolved { - drop(node); - - if let Node::Array { resolved, .. } = &mut *self.0.borrow_mut() { - *resolved = true; - } - } - - Ok(made_progress) - } - } - Node::String { .. } | Node::Number { .. } | Node::Bool { .. } | Node::Null { .. } => { - Ok(false) - } - } - } - - fn extend_from(&self, base: &Tree) { - if Rc::ptr_eq(&self.0, &base.0) { - return; - } - - if let ( - Node::Object { children, .. }, - Node::Object { - children: base_children, - .. - }, - ) = (&mut *self.0.borrow_mut(), &*base.0.borrow()) - { - for (key, base_value) in base_children { - if let Some(value) = children.get(key) { - value.extend_from(base_value); - } else { - let base_value = base_value.clone(); - base_value - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&self.0))); - children.insert(key.clone(), base_value); - } - } - } - } -} - -impl Node { - fn set_parent(&mut self, new_parent: Option>>) { - match self { - Node::Reference { parent, .. } - | Node::Object { parent, .. } - | Node::Array { parent, .. } - | Node::String { parent, .. } - | Node::Number { parent, .. } - | Node::Bool { parent, .. } - | Node::Null { parent } => *parent = new_parent, - } - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_references() { - let json = serde_json::json!({ - "a": { - "extends": "$g", - "x": "$b.d" - }, - "b": { - "c": "$a", - "d": "$e.f" - }, - "e": { - "extends": "$a", - "f": "1" - }, - "g": { - "h": 2 - } - }); - - assert_eq!( - resolve_references(json).unwrap(), - serde_json::json!({ - "a": { - "extends": "$g", - "x": "1", - "h": 2 - }, - "b": { - "c": { - "extends": "$g", - "x": "1", - "h": 2 - }, - "d": "1" - }, - "e": { - "extends": "$a", - "f": "1", - "x": "1", - "h": 2 - }, - "g": { - "h": 2 - } - }) - ) - } - - #[test] - fn test_cycles() { - let json = serde_json::json!({ - "a": { - "b": "$c.d" - }, - "c": { - "d": "$a.b", - }, - }); - - assert!(resolve_references(json).is_err()); - } -} diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 8fa15a92359c18ff7986978d66088c4f6a9332c1..b3c239b4b9f119159f76a3ed23ec477069c6bbd8 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -1,4 +1,3 @@ -mod resolution; mod theme_registry; use gpui::{ @@ -12,7 +11,7 @@ use std::{collections::HashMap, sync::Arc}; pub use theme_registry::*; -pub const DEFAULT_THEME_NAME: &'static str = "black"; +pub const DEFAULT_THEME_NAME: &'static str = "dark"; #[derive(Deserialize, Default)] pub struct Theme { diff --git a/crates/theme/src/theme_registry.rs b/crates/theme/src/theme_registry.rs index c3910dc4d28f6877b326b4fda36e59d2922db17c..219828b65083b08f1d7d0a105831acfc27bdf50a 100644 --- a/crates/theme/src/theme_registry.rs +++ b/crates/theme/src/theme_registry.rs @@ -1,8 +1,8 @@ -use crate::{resolution::resolve_references, Theme}; +use crate::Theme; use anyhow::{Context, Result}; use gpui::{fonts, AssetSource, FontCache}; use parking_lot::Mutex; -use serde_json::{Map, Value}; +use serde_json::Value; use std::{collections::HashMap, sync::Arc}; pub struct ThemeRegistry { @@ -25,12 +25,8 @@ impl ThemeRegistry { pub fn list(&self) -> impl Iterator { self.assets.list("themes/").into_iter().filter_map(|path| { let filename = path.strip_prefix("themes/")?; - let theme_name = filename.strip_suffix(".toml")?; - if theme_name.starts_with('_') { - None - } else { - Some(theme_name.to_string()) - } + let theme_name = filename.strip_suffix(".json")?; + Some(theme_name.to_string()) }) } @@ -44,9 +40,14 @@ impl ThemeRegistry { return Ok(theme.clone()); } - let theme_data = self.load(name, true)?; + let asset_path = format!("themes/{}.json", name); + let theme_json = self + .assets + .load(&asset_path) + .with_context(|| format!("failed to load theme file {}", asset_path))?; + let mut theme: Theme = fonts::with_font_cache(self.font_cache.clone(), || { - serde_path_to_error::deserialize(theme_data.as_ref()) + serde_path_to_error::deserialize(&mut serde_json::Deserializer::from_slice(&theme_json)) })?; theme.name = name.into(); @@ -54,217 +55,4 @@ impl ThemeRegistry { self.themes.lock().insert(name.to_string(), theme.clone()); Ok(theme) } - - fn load(&self, name: &str, evaluate_references: bool) -> Result> { - if let Some(data) = self.theme_data.lock().get(name) { - return Ok(data.clone()); - } - - let asset_path = format!("themes/{}.toml", name); - let source_code = self - .assets - .load(&asset_path) - .with_context(|| format!("failed to load theme file {}", asset_path))?; - - let mut theme_data: Map = toml::from_slice(source_code.as_ref()) - .with_context(|| format!("failed to parse {}.toml", name))?; - - // If this theme extends another base theme, deeply merge it into the base theme's data - if let Some(base_name) = theme_data - .get("extends") - .and_then(|name| name.as_str()) - .map(str::to_string) - { - let base_theme_data = self - .load(&base_name, false) - .with_context(|| format!("failed to load base theme {}", base_name))? - .as_ref() - .clone(); - if let Value::Object(mut base_theme_object) = base_theme_data { - deep_merge_json(&mut base_theme_object, theme_data); - theme_data = base_theme_object; - } - } - - let mut theme_data = Value::Object(theme_data); - - // Find all of the key path references in the object, and then sort them according - // to their dependencies. - if evaluate_references { - theme_data = resolve_references(theme_data)?; - } - - let result = Arc::new(theme_data); - self.theme_data - .lock() - .insert(name.to_string(), result.clone()); - - Ok(result) - } -} - -fn deep_merge_json(base: &mut Map, extension: Map) { - for (key, extension_value) in extension { - if let Value::Object(extension_object) = extension_value { - if let Some(base_object) = base.get_mut(&key).and_then(|value| value.as_object_mut()) { - deep_merge_json(base_object, extension_object); - } else { - base.insert(key, Value::Object(extension_object)); - } - } else { - base.insert(key, extension_value); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use anyhow::anyhow; - use gpui::MutableAppContext; - - #[gpui::test] - fn test_theme_extension(cx: &mut MutableAppContext) { - let assets = TestAssets(&[ - ( - "themes/_base.toml", - r##" - [ui.active_tab] - extends = "$ui.tab" - border.color = "#666666" - text = "$text_colors.bright" - - [ui.tab] - extends = "$ui.element" - text = "$text_colors.dull" - - [ui.element] - background = "#111111" - border = {width = 2.0, color = "#00000000"} - - [editor] - background = "#222222" - default_text = "$text_colors.regular" - "##, - ), - ( - "themes/light.toml", - r##" - extends = "_base" - - [text_colors] - bright = "#ffffff" - regular = "#eeeeee" - dull = "#dddddd" - - [editor] - background = "#232323" - "##, - ), - ]); - - let registry = ThemeRegistry::new(assets, cx.font_cache().clone()); - let theme_data = registry.load("light", true).unwrap(); - - assert_eq!( - theme_data.as_ref(), - &serde_json::json!({ - "ui": { - "active_tab": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#666666" - }, - "extends": "$ui.tab", - "text": "#ffffff" - }, - "tab": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#00000000" - }, - "extends": "$ui.element", - "text": "#dddddd" - }, - "element": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#00000000" - } - } - }, - "editor": { - "background": "#232323", - "default_text": "#eeeeee" - }, - "extends": "_base", - "text_colors": { - "bright": "#ffffff", - "regular": "#eeeeee", - "dull": "#dddddd" - } - }) - ); - } - - #[gpui::test] - fn test_nested_extension(cx: &mut MutableAppContext) { - let assets = TestAssets(&[( - "themes/theme.toml", - r##" - [a] - text = { extends = "$text.0" } - - [b] - extends = "$a" - text = { extends = "$text.1" } - - [text] - 0 = { color = "red" } - 1 = { color = "blue" } - "##, - )]); - - let registry = ThemeRegistry::new(assets, cx.font_cache().clone()); - let theme_data = registry.load("theme", true).unwrap(); - assert_eq!( - theme_data - .get("b") - .unwrap() - .get("text") - .unwrap() - .get("color") - .unwrap(), - "blue" - ); - } - - struct TestAssets(&'static [(&'static str, &'static str)]); - - impl AssetSource for TestAssets { - fn load(&self, path: &str) -> Result> { - if let Some(row) = self.0.iter().find(|e| e.0 == path) { - Ok(row.1.as_bytes().into()) - } else { - Err(anyhow!("no such path {}", path)) - } - } - - fn list(&self, prefix: &str) -> Vec> { - self.0 - .iter() - .copied() - .filter_map(|(path, _)| { - if path.starts_with(prefix) { - Some(path.into()) - } else { - None - } - }) - .collect() - } - } } diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml deleted file mode 100644 index 7f235cbf48e322fc60f1cebee27e7d15a53d7014..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/_base.toml +++ /dev/null @@ -1,411 +0,0 @@ -[text] -base = { family = "Zed Sans", size = 14 } - -[workspace] -background = "$surface.0" -pane_divider = { width = 1, color = "$border.0" } -leader_border_opacity = 0.7 -leader_border_width = 2.0 - -[workspace.titlebar] -height = 32 -border = { width = 1, bottom = true, color = "$border.0" } -title = "$text.0" -avatar_width = 18 -avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } } -avatar_ribbon = { background = "#ff0000", height = 3, width = 12 } -outdated_warning = { extends = "$text.2", size = 13 } -share_icon_color = "$text.2.color" -share_icon_active_color = "$text.0.color" - -[workspace.titlebar.sign_in_prompt] -extends = "$text.2" -size = 13 -underline = true -padding = { right = 8 } - -[workspace.titlebar.hovered_sign_in_prompt] -extends = "$workspace.titlebar.sign_in_prompt" -color = "$text.1.color" - -[workspace.titlebar.offline_icon] -padding = { right = 4 } -width = 16 -color = "$text.2.color" - -[workspace.tab] -height = 34 -text = "$text.2" -padding = { left = 12, right = 12 } -icon_width = 8 -spacing = 10 -icon_close = "$text.2.color" -icon_close_active = "$text.0.color" -icon_dirty = "$status.info" -icon_conflict = "$status.warn" -border = { left = true, bottom = true, width = 1, color = "$border.0", overlay = true } - -[workspace.active_tab] -extends = "$workspace.tab" -border.bottom = false -background = "$surface.1" -text = "$text.0" - -[workspace.sidebar] -width = 30 -border = { right = true, width = 1, color = "$border.0" } - -[workspace.sidebar.resize_handle] -padding = { left = 1 } -background = "$border.0" - -[workspace.sidebar.item] -icon_color = "$text.2.color" -icon_size = 18 -height = "$workspace.tab.height" - -[workspace.sidebar.active_item] -extends = "$workspace.sidebar.item" -icon_color = "$text.0.color" - -[workspace.left_sidebar] -extends = "$workspace.sidebar" -border = { width = 1, color = "$border.0", right = true } - -[workspace.right_sidebar] -extends = "$workspace.sidebar" -border = { width = 1, color = "$border.0", left = true } - -[workspace.status_bar] -padding = { left = 6, right = 6 } -height = 24 -item_spacing = 8 -cursor_position = "$text.2" -diagnostic_message = "$text.2" -lsp_message = "$text.2" - -[workspace.toolbar] -background = "$surface.1" -border = { color = "$border.0", width = 1, left = false, right = false, bottom = true, top = false } -height = 34 -item_spacing = 8 -padding = { left = 16, right = 8, top = 4, bottom = 4 } - -[breadcrumbs] -extends = "$text.1" -padding = { left = 6 } - -[panel] -padding = { top = 12, left = 12, bottom = 12, right = 12 } - -[chat_panel] -extends = "$panel" -channel_name = { extends = "$text.0", weight = "bold" } -channel_name_hash = { text = "$text.2", padding.right = 8 } - -[chat_panel.message] -body = "$text.1" -sender = { extends = "$text.0", weight = "bold", margin.right = 8 } -timestamp = "$text.2" -padding.bottom = 6 - -[chat_panel.pending_message] -extends = "$chat_panel.message" -body = { color = "$text.3.color" } -sender = { color = "$text.3.color" } -timestamp = { color = "$text.3.color" } - -[chat_panel.channel_select.item] -padding = 4 -name = "$text.1" -hash = { extends = "$text.2", margin.right = 8 } - -[chat_panel.channel_select.hovered_item] -extends = "$chat_panel.channel_select.item" -background = "$state.hover" -corner_radius = 6 - -[chat_panel.channel_select.active_item] -extends = "$chat_panel.channel_select.item" -name = "$text.0" - -[chat_panel.channel_select.hovered_active_item] -extends = "$chat_panel.channel_select.hovered_item" -name = "$text.0" - -[chat_panel.channel_select.header] -extends = "$chat_panel.channel_select.active_item" -padding.bottom = 4 -padding.left = 0 - -[chat_panel.channel_select.menu] -padding = 4 -corner_radius = 6 -border = { color = "$border.0", width = 1 } -background = "$surface.0" -shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" } - -[chat_panel.input_editor] -background = "$surface.1" -corner_radius = 6 -padding = { left = 8, right = 8, top = 7, bottom = 7 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[chat_panel.sign_in_prompt] -extends = "$text.0" -underline = true - -[chat_panel.hovered_sign_in_prompt] -extends = "$chat_panel.sign_in_prompt" -color = "$text.1.color" - -[contacts_panel] -extends = "$panel" -host_row_height = 28 -host_avatar = { corner_radius = 10, width = 18 } -host_username = { extends = "$text.0", padding.left = 8 } -tree_branch_width = 1 -tree_branch_color = "$surface.2" - -[contacts_panel.project] -height = 24 -padding = { left = 8 } -guest_avatar = { corner_radius = 8, width = 14 } -guest_avatar_spacing = 4 - -[contacts_panel.project.name] -extends = "$text.1" -margin = { right = 6 } - -[contacts_panel.unshared_project] -extends = "$contacts_panel.project" - -[contacts_panel.hovered_unshared_project] -extends = "$contacts_panel.unshared_project" -background = "$state.hover" -corner_radius = 6 - -[contacts_panel.shared_project] -extends = "$contacts_panel.project" -name.color = "$text.0.color" - -[contacts_panel.hovered_shared_project] -extends = "$contacts_panel.shared_project" -background = "$state.hover" -corner_radius = 6 - -[project_panel] -extends = "$panel" -padding.top = 6 # ($workspace.tab.height - $project_panel.entry.height) / 2 - -[project_panel.entry] -text = "$text.1" -height = 22 -icon_color = "$text.3.color" -icon_size = 8 -icon_spacing = 8 - -[project_panel.hovered_entry] -extends = "$project_panel.entry" -background = "$state.hover" - -[project_panel.selected_entry] -extends = "$project_panel.entry" -text = { extends = "$text.0" } - -[project_panel.hovered_selected_entry] -extends = "$project_panel.hovered_entry" -text = { extends = "$text.0" } - -[selector] -background = "$surface.0" -padding = 8 -margin = { top = 52, bottom = 52 } -corner_radius = 6 -shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" } -border = { width = 1, color = "$border.0" } - -[selector.input_editor] -background = "$surface.1" -corner_radius = 6 -padding = { left = 16, right = 16, top = 7, bottom = 7 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[selector.empty] -text = "$text.2" -padding = { left = 16, right = 16, top = 8, bottom = 4 } - -[selector.item] -text = "$text.1" -highlight_text = { extends = "$text.base", color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" } -padding = { left = 16, right = 16, top = 4, bottom = 4 } -corner_radius = 6 - -[selector.active_item] -extends = "$selector.item" -background = "$state.hover" -text = "$text.0" - -[editor] -text_color = "$text.1.color" -background = "$surface.1" -gutter_background = "$surface.1" -gutter_padding_factor = 2.5 -active_line_background = "$state.active_line" -highlighted_line_background = "$state.highlighted_line" -rename_fade = 0.6 -unnecessary_code_fade = 0.5 -document_highlight_read_background = "#99999920" -document_highlight_write_background = "#99999916" -diff_background_deleted = "$state.deleted_line" -diff_background_inserted = "$state.inserted_line" -line_number = "$text.2.color" -line_number_active = "$text.0.color" -selection = "$selection.host" -guest_selections = "$selection.guests" -error_color = "$status.bad" -code_actions_indicator = "$text.3.color" - -[editor.diagnostic_path_header] -background = "$state.active_line" -filename = { extends = "$text.0", size = 14 } -path = { extends = "$text.2", size = 14, margin.left = 12 } -text_scale_factor = 0.857 - -[editor.diagnostic_header] -background = "$editor.background" -border = { width = 1, top = true, bottom = true, color = "$border.1" } -code = { extends = "$text.2", size = 14, margin.left = 10 } -icon_width_factor = 1.5 -text_scale_factor = 0.857 - -[editor.diagnostic_header.message] -text = { extends = "$text.1", size = 14 } -highlight_text = { extends = "$text.0", size = 14, weight = "bold" } - -[editor.error_diagnostic] -header.border = { width = 1, top = true, color = "$border.0" } -text_scale_factor = 0.857 - -[editor.error_diagnostic.message] -text = { extends = "$text.1", size = 14, color = "$status.bad" } -highlight_text = { extends = "$text.1", size = 14, color = "$status.bad", weight = "bold" } - -[editor.warning_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.warn" -message.highlight_text.color = "$status.warn" - -[editor.information_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.info" -message.highlight_text.color = "$status.info" - -[editor.hint_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.info" -message.highlight_text.color = "$status.info" - -[editor.invalid_error_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_warning_diagnostic] -extends = "$editor.warning_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_information_diagnostic] -extends = "$editor.information_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_hint_diagnostic] -extends = "$editor.hint_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.autocomplete] -background = "$surface.2" -border = { width = 2, color = "$border.1" } -corner_radius = 6 -padding = 6 -match_highlight = { color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" } -margin.left = -14 - -[editor.autocomplete.item] -padding = { left = 6, right = 6, top = 2, bottom = 2 } -corner_radius = 6 - -[editor.autocomplete.selected_item] -extends = "$editor.autocomplete.item" -background = "$state.selected" - -[editor.autocomplete.hovered_item] -extends = "$editor.autocomplete.item" -background = "$state.hover" - -[project_diagnostics] -background = "$surface.1" -empty_message = { extends = "$text.0", size = 18 } -status_bar_item = { extends = "$text.2", margin.right = 10 } -tab_icon_width = 13 -tab_icon_spacing = 4 -tab_summary_spacing = 10 - -[search] -match_background = "$state.highlighted_line" -results_status = { extends = "$text.0", size = 18 } -tab_icon_width = 14 -tab_icon_spacing = 4 - -[search.option_button] -extends = "$text.1" -padding = { left = 6, right = 6, top = 1, bottom = 1 } -corner_radius = 6 -background = "$surface.1" -border = { width = 1, color = "$border.0" } -margin.left = 1 -margin.right = 1 - -[search.option_button_group] -padding = { left = 2, right = 2 } - -[search.active_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.hovered_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.active_hovered_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.match_index] -extends = "$text.2" -padding = 6 - -[search.editor] -min_width = 200 -max_width = 500 -background = "$surface.0" -corner_radius = 6 -padding = { left = 14, right = 14, top = 3, bottom = 3 } -margin = { right = 5 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[search.invalid_editor] -extends = "$search.editor" -border = { width = 1, color = "$status.bad" } diff --git a/crates/zed/assets/themes/black.toml b/crates/zed/assets/themes/black.toml deleted file mode 100644 index 34de16627ec3b5c0e9313f1d784881b322ade52e..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/black.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#222222" -1 = "#0f0b0c" -2 = "#131415" - -[border] -0 = "#000000B2" -1 = "#FFFFFF20" - -[text] -0 = { extends = "$text.base", color = "#ffffff" } -1 = { extends = "$text.base", color = "#b3b3b3" } -2 = { extends = "$text.base", color = "#7b7d80" } -3 = { extends = "$text.base", color = "#66686A" } - -[shadow] -0 = "#00000052" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#161313" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#00000033" -selected = "#00000088" - -[editor.syntax] -keyword = { color = "#0086c0", weight = "bold" } -function = "#dcdcaa" -string = "#cb8f77" -type = "#4ec9b0" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#9cdcfe" -title = { color = "#9cdcfe", weight = "bold" } -emphasis = "#4ec9b0" -"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#cb8f77", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000aa" diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json new file mode 100644 index 0000000000000000000000000000000000000000..65bf78b140ff3c94c298982cf2b3a6f6b8210609 --- /dev/null +++ b/crates/zed/assets/themes/dark.json @@ -0,0 +1,1245 @@ +{ + "selector": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 8, + "item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + } + }, + "active_item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + }, + "background": "#e6e6e6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "empty": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 8 + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "placeholder_text": { + "family": "Zed Sans", + "color": "#bfbfbf", + "size": 14 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 16, + "right": 16, + "top": 7 + } + }, + "margin": { + "bottom": 52, + "top": 52 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + }, + "workspace": { + "background": "#e6e6e6", + "leader_border_opacity": 0.7, + "leader_border_width": 2, + "tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": true, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + } + }, + "active_tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": false, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + }, + "background": "#cccccc" + }, + "left_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "right": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "right_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "pane_divider": { + "color": "#d9d9d9", + "width": 1 + }, + "status_bar": { + "height": 24, + "item_spacing": 8, + "padding": { + "left": 6, + "right": 6 + }, + "cursor_position": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "diagnostic_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "lsp_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + } + }, + "titlebar": { + "avatar_width": 18, + "height": 32, + "share_icon_color": "#808080", + "share_icon_active_color": "#0d0d0d", + "title": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "avatar": { + "corner_radius": 10, + "border": { + "color": "#00000088", + "width": 1 + } + }, + "avatar_ribbon": { + "height": 3, + "width": 12 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "size": 13, + "underline": true, + "padding": { + "right": 8 + } + }, + "hovered_sign_in_prompt": { + "family": "Zed Mono", + "color": "#000000", + "size": 16, + "underline": true, + "padding": { + "right": 8 + } + }, + "offline_icon": { + "color": "#999999", + "width": 16, + "padding": { + "right": 4 + } + }, + "outdated_warning": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 13 + } + }, + "toolbar": { + "height": 34, + "background": "#cccccc", + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "item_spacing": 8, + "padding": { + "left": 16, + "right": 8, + "top": 4, + "bottom": 4 + } + }, + "breadcrumbs": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "padding": { + "left": 6 + } + }, + "disconnected_overlay": { + "family": "Zed Sans", + "color": "#ffffff", + "size": 14, + "background": "#000000aa" + } + }, + "editor": { + "text_color": "#595959", + "background": "#cccccc", + "active_line_background": "#000000", + "code_actions_indicator": "#808080", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#e6e6e6", + "document_highlight_write_background": "#e6e6e6", + "error_color": "#f78c8c", + "gutter_background": "#cccccc", + "gutter_padding_factor": 2.5, + "highlighted_line_background": "#000000", + "line_number": "#000000", + "line_number_active": "#000000", + "rename_fade": 0.6, + "unnecessary_code_fade": 0.5, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "guest_selections": [ + { + "cursor": "#777af4", + "selection": "#777af4" + }, + { + "cursor": "#23d464", + "selection": "#23d464" + }, + { + "cursor": "#f98a3d", + "selection": "#f98a3d" + }, + { + "cursor": "#b671f8", + "selection": "#b671f8" + }, + { + "cursor": "#16ddc7", + "selection": "#16ddc7" + }, + { + "cursor": "#f58ac0", + "selection": "#f58ac0" + }, + { + "cursor": "#f6bc09", + "selection": "#f6bc09" + } + ], + "autocomplete": { + "background": "#bfbfbf", + "corner_radius": 6, + "padding": 6, + "border": { + "color": "#b3b3b3", + "width": 1 + }, + "item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + } + }, + "hovered_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + }, + "margin": { + "left": -14 + }, + "match_highlight": { + "color": "#59c3f5", + "weight": "normal" + }, + "selected_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + } + }, + "diagnostic_header": { + "background": "#e6e6e6", + "icon_width_factor": 1.5, + "text_scale_factor": 0.857, + "border": { + "color": "#b3b3b3", + "width": 1, + "bottom": true, + "top": true + }, + "code": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 10 + } + }, + "message": { + "highlight_text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "weight": "bold" + }, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + } + } + }, + "diagnostic_path_header": { + "background": "#000000", + "text_scale_factor": 0.857, + "filename": { + "family": "Zed Mono", + "color": "#262626", + "size": 14 + }, + "path": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 12 + } + } + }, + "error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14, + "weight": "bold" + } + } + }, + "warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14, + "weight": "bold" + } + } + }, + "information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "syntax": {} + }, + "project_diagnostics": { + "background": "#cccccc", + "tab_icon_spacing": 4, + "tab_icon_width": 13, + "tab_summary_spacing": 10, + "empty_message": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "status_bar_item": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 10 + } + } + }, + "project_panel": { + "padding": { + "top": 6 + }, + "entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "hovered_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "selected_entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + }, + "hovered_selected_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + } + }, + "chat_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "channel_name": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14 + }, + "channel_name_hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "padding": { + "right": 8 + } + }, + "channel_select": { + "header": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 0 + }, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "menu": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 4, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + } + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "underline": true, + "size": 14 + }, + "hovered_sign_in_prompt": { + "family": "Zed Sans", + "color": "#262626", + "underline": true, + "size": 14 + }, + "message": { + "body": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "pending_message": { + "body": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#8c8c8c", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "placeholder_text": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 8, + "right": 8, + "top": 7 + } + } + }, + "contacts_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "host_row_height": 28, + "tree_branch_color": "#bfbfbf", + "tree_branch_width": 1, + "host_avatar": { + "corner_radius": 10, + "width": 18 + }, + "host_username": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": { + "left": 8 + } + }, + "project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + }, + "unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + } + }, + "search": { + "match_background": "#000000", + "tab_icon_spacing": 4, + "tab_icon_width": 14, + "active_hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "active_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "invalid_editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#ffffff", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "match_index": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": 6 + }, + "option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#cccccc", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "option_button_group": { + "padding": { + "left": 2, + "right": 2 + } + }, + "results_status": { + "family": "Zed Mono", + "color": "#262626", + "size": 18 + } + }, + "breadcrumbs": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "padding": { + "left": 6 + } + } +} \ No newline at end of file diff --git a/crates/zed/assets/themes/dark.toml b/crates/zed/assets/themes/dark.toml deleted file mode 100644 index fa673ac446426fed977dcf34abaa5361754e4db0..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/dark.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#283340" -1 = "#1C2733" -2 = "#1C2733" - -[border] -0 = "#1B222B" -1 = "#FFFFFF20" - -[text] -0 = { extends = "$text.base", color = "#FFFFFF" } -1 = { extends = "$text.base", color = "#CDD1E2" } -2 = { extends = "$text.base", color = "#9BA8BE" } -3 = { extends = "$text.base", color = "#6E7483" } - -[shadow] -0 = "#00000052" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#00000022" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#00000033" -selected = "#00000088" - -[editor.syntax] -keyword = { color = "#0086c0", weight = "bold" } -function = "#dcdcaa" -string = "#cb8f77" -type = "#4ec9b0" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#9cdcfe" -title = { color = "#9cdcfe", weight = "bold" } -emphasis = "#4ec9b0" -"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#cb8f77", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000aa" diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json new file mode 100644 index 0000000000000000000000000000000000000000..65bf78b140ff3c94c298982cf2b3a6f6b8210609 --- /dev/null +++ b/crates/zed/assets/themes/light.json @@ -0,0 +1,1245 @@ +{ + "selector": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 8, + "item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + } + }, + "active_item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + }, + "background": "#e6e6e6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "empty": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 8 + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "placeholder_text": { + "family": "Zed Sans", + "color": "#bfbfbf", + "size": 14 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 16, + "right": 16, + "top": 7 + } + }, + "margin": { + "bottom": 52, + "top": 52 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + }, + "workspace": { + "background": "#e6e6e6", + "leader_border_opacity": 0.7, + "leader_border_width": 2, + "tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": true, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + } + }, + "active_tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": false, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + }, + "background": "#cccccc" + }, + "left_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "right": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "right_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "pane_divider": { + "color": "#d9d9d9", + "width": 1 + }, + "status_bar": { + "height": 24, + "item_spacing": 8, + "padding": { + "left": 6, + "right": 6 + }, + "cursor_position": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "diagnostic_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "lsp_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + } + }, + "titlebar": { + "avatar_width": 18, + "height": 32, + "share_icon_color": "#808080", + "share_icon_active_color": "#0d0d0d", + "title": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "avatar": { + "corner_radius": 10, + "border": { + "color": "#00000088", + "width": 1 + } + }, + "avatar_ribbon": { + "height": 3, + "width": 12 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "size": 13, + "underline": true, + "padding": { + "right": 8 + } + }, + "hovered_sign_in_prompt": { + "family": "Zed Mono", + "color": "#000000", + "size": 16, + "underline": true, + "padding": { + "right": 8 + } + }, + "offline_icon": { + "color": "#999999", + "width": 16, + "padding": { + "right": 4 + } + }, + "outdated_warning": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 13 + } + }, + "toolbar": { + "height": 34, + "background": "#cccccc", + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "item_spacing": 8, + "padding": { + "left": 16, + "right": 8, + "top": 4, + "bottom": 4 + } + }, + "breadcrumbs": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "padding": { + "left": 6 + } + }, + "disconnected_overlay": { + "family": "Zed Sans", + "color": "#ffffff", + "size": 14, + "background": "#000000aa" + } + }, + "editor": { + "text_color": "#595959", + "background": "#cccccc", + "active_line_background": "#000000", + "code_actions_indicator": "#808080", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#e6e6e6", + "document_highlight_write_background": "#e6e6e6", + "error_color": "#f78c8c", + "gutter_background": "#cccccc", + "gutter_padding_factor": 2.5, + "highlighted_line_background": "#000000", + "line_number": "#000000", + "line_number_active": "#000000", + "rename_fade": 0.6, + "unnecessary_code_fade": 0.5, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "guest_selections": [ + { + "cursor": "#777af4", + "selection": "#777af4" + }, + { + "cursor": "#23d464", + "selection": "#23d464" + }, + { + "cursor": "#f98a3d", + "selection": "#f98a3d" + }, + { + "cursor": "#b671f8", + "selection": "#b671f8" + }, + { + "cursor": "#16ddc7", + "selection": "#16ddc7" + }, + { + "cursor": "#f58ac0", + "selection": "#f58ac0" + }, + { + "cursor": "#f6bc09", + "selection": "#f6bc09" + } + ], + "autocomplete": { + "background": "#bfbfbf", + "corner_radius": 6, + "padding": 6, + "border": { + "color": "#b3b3b3", + "width": 1 + }, + "item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + } + }, + "hovered_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + }, + "margin": { + "left": -14 + }, + "match_highlight": { + "color": "#59c3f5", + "weight": "normal" + }, + "selected_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + } + }, + "diagnostic_header": { + "background": "#e6e6e6", + "icon_width_factor": 1.5, + "text_scale_factor": 0.857, + "border": { + "color": "#b3b3b3", + "width": 1, + "bottom": true, + "top": true + }, + "code": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 10 + } + }, + "message": { + "highlight_text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "weight": "bold" + }, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + } + } + }, + "diagnostic_path_header": { + "background": "#000000", + "text_scale_factor": 0.857, + "filename": { + "family": "Zed Mono", + "color": "#262626", + "size": 14 + }, + "path": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 12 + } + } + }, + "error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14, + "weight": "bold" + } + } + }, + "warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14, + "weight": "bold" + } + } + }, + "information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "syntax": {} + }, + "project_diagnostics": { + "background": "#cccccc", + "tab_icon_spacing": 4, + "tab_icon_width": 13, + "tab_summary_spacing": 10, + "empty_message": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "status_bar_item": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 10 + } + } + }, + "project_panel": { + "padding": { + "top": 6 + }, + "entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "hovered_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "selected_entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + }, + "hovered_selected_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + } + }, + "chat_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "channel_name": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14 + }, + "channel_name_hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "padding": { + "right": 8 + } + }, + "channel_select": { + "header": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 0 + }, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "menu": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 4, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + } + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "underline": true, + "size": 14 + }, + "hovered_sign_in_prompt": { + "family": "Zed Sans", + "color": "#262626", + "underline": true, + "size": 14 + }, + "message": { + "body": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "pending_message": { + "body": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#8c8c8c", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "placeholder_text": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 8, + "right": 8, + "top": 7 + } + } + }, + "contacts_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "host_row_height": 28, + "tree_branch_color": "#bfbfbf", + "tree_branch_width": 1, + "host_avatar": { + "corner_radius": 10, + "width": 18 + }, + "host_username": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": { + "left": 8 + } + }, + "project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + }, + "unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + } + }, + "search": { + "match_background": "#000000", + "tab_icon_spacing": 4, + "tab_icon_width": 14, + "active_hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "active_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "invalid_editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#ffffff", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "match_index": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": 6 + }, + "option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#cccccc", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "option_button_group": { + "padding": { + "left": 2, + "right": 2 + } + }, + "results_status": { + "family": "Zed Mono", + "color": "#262626", + "size": 18 + } + }, + "breadcrumbs": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "padding": { + "left": 6 + } + } +} \ No newline at end of file diff --git a/crates/zed/assets/themes/light.toml b/crates/zed/assets/themes/light.toml deleted file mode 100644 index 2884515e09f41fc1ade19d886604e6af5ff2a1ae..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/light.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#EAEAEB" -1 = "#FAFAFA" -2 = "#FFFFFF" - -[border] -0 = "#DDDDDC" -1 = "#0000000F" - -[text] -0 = { extends = "$text.base", color = "#000000" } -1 = { extends = "$text.base", color = "#29292B" } -2 = { extends = "$text.base", color = "#7E7E83" } -3 = { extends = "$text.base", color = "#939393" } - -[shadow] -0 = "#0000000D" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#00000008" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#0000000D" -selected = "#0000001c" - -[editor.syntax] -keyword = { color = "#0000fa", weight = "bold" } -function = "#795e26" -string = "#a82121" -type = "#267f29" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#5a9ccc" -title = { color = "#5a9ccc", weight = "bold" } -emphasis = "#267f29" -"emphasis.strong" = { color = "#267f29", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#a82121", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000cc" diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index c94f8a0e8164a5f1b7a9cbcd9229f1e65ed59593..436555b3daf365c1dc37abf2e7da413e61252e23 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -976,7 +976,8 @@ mod tests { lazy_static::lazy_static! { static ref DEFAULT_THEME: parking_lot::Mutex>> = Default::default(); static ref FONTS: Vec>> = vec![ - Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into() + Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into(), + Assets.load("fonts/zed-mono/zed-mono-extended.ttf").unwrap().to_vec().into(), ]; } diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index ced82e98664980b3d1af9f50d8f4f8f498f59d49..d67860cee66a0ec7abd7d37da8b10f0a6c930488 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -7,11 +7,11 @@ import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; for (let theme of themes) { - let styleTree = decamelizeTree(app(theme)); - let styleTreeJSON = JSON.stringify(styleTree, null, 2); - let outPath = path.resolve( - `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` - ); - fs.writeFileSync(outPath, styleTreeJSON); - console.log(`Generated ${outPath}`); + let styleTree = decamelizeTree(app(theme)); + let styleTreeJSON = JSON.stringify(styleTree, null, 2); + let outPath = path.resolve( + `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` + ); + fs.writeFileSync(outPath, styleTreeJSON); + console.log(`Generated ${outPath}`); } diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index c7edfdc2701f06e6cb1b41beb779ad6bc0aca75b..d26ada4fc9bc6ebab7c63255245ff003dfae0640 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,6 +1,7 @@ import Theme from "../themes/theme"; import chatPanel from "./chatPanel"; import { backgroundColor, borderColor, text } from "./components"; +import contactsPanel from "./contactsPanel"; import editor from "./editor"; import projectPanel from "./projectPanel"; import search from "./search"; @@ -8,83 +9,38 @@ import selectorModal from "./selectorModal"; import workspace from "./workspace"; export const panel = { - padding: { top: 12, left: 12, bottom: 12, right: 12 }, + padding: { top: 12, left: 12, bottom: 12, right: 12 }, }; export default function app(theme: Theme): Object { - return { - selector: selectorModal(theme), - workspace: workspace(theme), - editor: editor(theme), - projectDiagnostics: { - background: backgroundColor(theme, 300), - tabIconSpacing: 4, - tabIconWidth: 13, - tabSummarySpacing: 10, - emptyMessage: { - ...text(theme, "sans", "primary", { size: "lg" }), - }, - statusBarItem: { - ...text(theme, "sans", "muted"), - margin: { - right: 10, + return { + selector: selectorModal(theme), + workspace: workspace(theme), + editor: editor(theme), + projectDiagnostics: { + background: backgroundColor(theme, 300), + tabIconSpacing: 4, + tabIconWidth: 13, + tabSummarySpacing: 10, + emptyMessage: { + ...text(theme, "sans", "primary", { size: "lg" }), + }, + statusBarItem: { + ...text(theme, "sans", "muted"), + margin: { + right: 10, + }, + }, }, - }, - }, - projectPanel: projectPanel(theme), - chatPanel: chatPanel(theme), - contactsPanel: { - ...panel, - hostRowHeight: 28, - treeBranchColor: borderColor(theme, "muted"), - treeBranchWidth: 1, - hostAvatar: { - cornerRadius: 10, - width: 18, - }, - hostUsername: { - ...text(theme, "mono", "muted"), - padding: { - left: 8, - }, - }, - hoveredSharedProject: { - extends: "$contacts_panel.sharedProject", - background: theme.editor.line.active.value, - cornerRadius: 6, - }, - hoveredUnsharedProject: { - extends: "$contacts_panel.unsharedProject", - background: theme.editor.line.active.value, - cornerRadius: 6, - }, - project: { - guestAvatarSpacing: 4, - height: 24, - guestAvatar: { - cornerRadius: 8, - width: 14, - }, - name: { - extends: text(theme, "mono", "secondary"), - margin: { - right: 6, - }, - }, - padding: { - left: 8, - }, - }, - sharedProject: { - extends: "$contactsPanel.project", - name: { - color: text(theme, "mono", "primary"), - }, - }, - unsharedProject: { - extends: "$contactsPanel.project", - }, - }, - search: search(theme), - }; + projectPanel: projectPanel(theme), + chatPanel: chatPanel(theme), + contactsPanel: contactsPanel(theme), + search: search(theme), + breadcrumbs: { + ...text(theme, "sans", "primary"), + padding: { + left: 6, + }, + } + }; } diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index 55a64cb1ecb4ec8f60878d9e795f671a9a5cfede..205fd9b26200510d7adeb4f226ed893e8a17bbaa 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -1,25 +1,25 @@ import chroma from "chroma-js"; -import Theme, { BackgroundColor, Weight } from "../themes/theme"; -import core from "../tokens/core"; +import Theme, { BackgroundColor } from "../themes/theme"; +import { fontFamilies, fontSizes, FontWeight } from "../tokens"; import { Color } from "../utils/color"; export type TextColor = keyof Theme["textColor"]; export function text( theme: Theme, - fontFamily: keyof typeof core.fontFamily, + fontFamily: keyof typeof fontFamilies, color: TextColor, properties?: { - size?: keyof typeof core["fontSize"]; - weight?: Weight; + size?: keyof typeof fontSizes; + weight?: FontWeight; underline?: boolean; } ) { const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md"; - const size = core.fontSize[sizeKey].value; + const size = fontSizes[sizeKey].value; return { - family: core.fontFamily[fontFamily], + family: fontFamilies[fontFamily].value, color: theme.textColor[color].value, ...properties, size, diff --git a/styles/styleTree/contactsPanel.ts b/styles/styleTree/contactsPanel.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b88a35f13692712cd61c89d4af75476d7bb49c6 --- /dev/null +++ b/styles/styleTree/contactsPanel.ts @@ -0,0 +1,61 @@ +import Theme from "../themes/theme"; +import { panel } from "./app"; +import { borderColor, text } from "./components"; + +export default function(theme: Theme) { + const project = { + guestAvatarSpacing: 4, + height: 24, + guestAvatar: { + cornerRadius: 8, + width: 14, + }, + name: { + ...text(theme, "mono", "secondary"), + margin: { + right: 6, + }, + }, + padding: { + left: 8, + }, + }; + + const sharedProject = { + ...project, + name: { + ...project.name, + ...text(theme, "mono", "primary"), + }, + }; + + return { + ...panel, + hostRowHeight: 28, + treeBranchColor: borderColor(theme, "muted"), + treeBranchWidth: 1, + hostAvatar: { + cornerRadius: 10, + width: 18, + }, + hostUsername: { + ...text(theme, "mono", "muted"), + padding: { + left: 8, + }, + }, + project, + sharedProject, + hoveredSharedProject: { + ...sharedProject, + background: theme.editor.line.active.value, + cornerRadius: 6, + }, + unsharedProject: project, + hoveredUnsharedProject: { + ...project, + background: theme.editor.line.active.value, + cornerRadius: 6, + }, + } +} \ No newline at end of file diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index 5d800881e2750942c2b7d6f1113df203aff97fb3..ebc53b405875dab197a3c95d5373732050e9a7a0 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -1,131 +1,134 @@ import Theme from "../themes/theme"; import { - backgroundColor, - border, - iconColor, - player, - text, - TextColor + backgroundColor, + border, + iconColor, + player, + text, + TextColor, } from "./components"; export default function editor(theme: Theme) { - const autocompleteItem = { - cornerRadius: 6, - padding: { - bottom: 2, - left: 6, - right: 6, - top: 2, - }, - }; - - function diagnostic(theme: Theme, color: TextColor) { - return { - textScaleFactor: 0.857, - header: { - border: border(theme, "primary", { - top: true, - }), - }, - message: { - text: text(theme, "sans", color, { size: "sm" }), - highlightText: text(theme, "sans", color, { - size: "sm", - weight: "bold", - }), - }, + const autocompleteItem = { + cornerRadius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, }; - } - return { - textColor: theme.textColor.secondary.value, - background: backgroundColor(theme, 300), - activeLineBackground: theme.editor.line.active.value, - codeActionsIndicator: iconColor(theme, "secondary"), - diffBackgroundDeleted: backgroundColor(theme, "error"), - diffBackgroundInserted: backgroundColor(theme, "ok"), - documentHighlightReadBackground: theme.editor.highlight.occurrence.value, - documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, - errorColor: theme.textColor.error, - gutterBackground: backgroundColor(theme, 300), - gutterPaddingFactor: 2.5, - highlightedLineBackground: theme.editor.line.highlighted.value, - lineNumber: theme.editor.gutter.primary.value, - lineNumberActive: theme.editor.gutter.active, - renameFade: 0.6, - unnecessaryCodeFade: 0.5, - selection: player(theme, 1).selection, - guestSelections: [ - player(theme, 2).selection, - player(theme, 3).selection, - player(theme, 4).selection, - player(theme, 5).selection, - player(theme, 6).selection, - player(theme, 7).selection, - player(theme, 8).selection, - ], - autocomplete: { - background: backgroundColor(theme, 100), - cornerRadius: 6, - padding: 6, - border: border(theme, "secondary"), - item: autocompleteItem, - hoveredItem: { - ...autocompleteItem, - background: backgroundColor(theme, 100, "hovered"), - }, - margin: { - left: -14, - }, - matchHighlight: { - color: theme.syntax.keyword.color.value, - weight: theme.syntax.keyword.weight.value, - }, - selectedItem: { - ...autocompleteItem, - background: backgroundColor(theme, 100, "active"), - }, - }, - diagnosticHeader: { - background: theme.editor.background.value, - iconWidthFactor: 1.5, - textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. - border: border(theme, "secondary", { - bottom: true, - top: true, - }), - code: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 10, + function diagnostic(theme: Theme, color: TextColor) { + return { + textScaleFactor: 0.857, + header: { + border: border(theme, "primary", { + top: true, + }), + }, + message: { + text: text(theme, "sans", color, { size: "sm" }), + highlightText: text(theme, "sans", color, { + size: "sm", + weight: "bold", + }), + }, + }; + } + + return { + textColor: theme.textColor.secondary.value, + background: backgroundColor(theme, 300), + activeLineBackground: theme.editor.line.active.value, + codeActionsIndicator: iconColor(theme, "secondary"), + diffBackgroundDeleted: backgroundColor(theme, "error"), + diffBackgroundInserted: backgroundColor(theme, "ok"), + documentHighlightReadBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, + errorColor: theme.textColor.error.value, + gutterBackground: backgroundColor(theme, 300), + gutterPaddingFactor: 2.5, + highlightedLineBackground: theme.editor.line.highlighted.value, + lineNumber: theme.editor.gutter.primary.value, + lineNumberActive: theme.editor.gutter.active.value, + renameFade: 0.6, + unnecessaryCodeFade: 0.5, + selection: player(theme, 1).selection, + guestSelections: [ + player(theme, 2).selection, + player(theme, 3).selection, + player(theme, 4).selection, + player(theme, 5).selection, + player(theme, 6).selection, + player(theme, 7).selection, + player(theme, 8).selection, + ], + autocomplete: { + background: backgroundColor(theme, 100), + cornerRadius: 6, + padding: 6, + border: border(theme, "secondary"), + item: autocompleteItem, + hoveredItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "hovered"), + }, + margin: { + left: -14, + }, + matchHighlight: { + color: theme.syntax.keyword.color.value, + weight: theme.syntax.keyword.weight.value, + }, + selectedItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "active"), + }, + }, + diagnosticHeader: { + background: theme.editor.background.value, + iconWidthFactor: 1.5, + textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. + border: border(theme, "secondary", { + bottom: true, + top: true, + }), + code: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 10, + }, + }, + message: { + highlightText: text(theme, "sans", "primary", { + size: "sm", + weight: "bold", + }), + text: text(theme, "sans", "secondary", { size: "sm" }), + }, }, - }, - message: { - highlightText: text(theme, "sans", "primary", { - size: "sm", - weight: "bold", - }), - text: text(theme, "sans", "secondary", { size: "sm" }), - }, - }, - diagnosticPathHeader: { - background: theme.editor.line.active, - textScaleFactor: 0.857, - filename: text(theme, "mono", "primary", { size: "sm" }), - path: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 12, + diagnosticPathHeader: { + background: theme.editor.line.active.value, + textScaleFactor: 0.857, + filename: text(theme, "mono", "primary", { size: "sm" }), + path: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 12, + }, + }, }, - }, - }, - errorDiagnostic: diagnostic(theme, "error"), - warningDiagnostic: diagnostic(theme, "warning"), - informationDiagnostic: diagnostic(theme, "info"), - hintDiagnostic: diagnostic(theme, "info"), - invalidErrorDiagnostic: diagnostic(theme, "muted"), - invalidHintDiagnostic: diagnostic(theme, "muted"), - invalidInformationDiagnostic: diagnostic(theme, "muted"), - invalidWarningDiagnostic: diagnostic(theme, "muted"), - }; + errorDiagnostic: diagnostic(theme, "error"), + warningDiagnostic: diagnostic(theme, "warning"), + informationDiagnostic: diagnostic(theme, "info"), + hintDiagnostic: diagnostic(theme, "info"), + invalidErrorDiagnostic: diagnostic(theme, "muted"), + invalidHintDiagnostic: diagnostic(theme, "muted"), + invalidInformationDiagnostic: diagnostic(theme, "muted"), + invalidWarningDiagnostic: diagnostic(theme, "muted"), + syntax: { + + } + }; } diff --git a/styles/styleTree/projectPanel.ts b/styles/styleTree/projectPanel.ts index 3b5fba8853da3799e69be735447e615341ef8391..cd6fb49b3ada1db47b3dd15637cb1a4a6c5ee516 100644 --- a/styles/styleTree/projectPanel.ts +++ b/styles/styleTree/projectPanel.ts @@ -24,7 +24,11 @@ export default function projectPanel(theme: Theme) { backgroundColor(theme, 300, "hovered") ), selectedEntry: entry(theme, "primary"), - hoveredSelectedEntry: entry(theme, "primary", "hovered"), + hoveredSelectedEntry: entry( + theme, + "primary", + backgroundColor(theme, 300, "hovered") + ), padding: { top: 6, }, diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index 7ba04cd688e01f5b3a4f47b35311195fde73fefb..42b639f57a39d355c8dbf461fb29e64ee71dec2f 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -19,8 +19,28 @@ export default function search(theme: Theme) { }, }; + const editor = { + background: backgroundColor(theme, 500), + cornerRadius: 6, + minWidth: 200, + maxWidth: 500, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + margin: { + right: 5, + }, + padding: { + top: 3, + bottom: 3, + left: 14, + right: 14, + }, + }; + return { - matchBackground: theme.editor.highlight.match, + matchBackground: theme.editor.highlight.match.value, tabIconSpacing: 4, tabIconWidth: 14, activeHoveredOptionButton: { @@ -31,31 +51,13 @@ export default function search(theme: Theme) { ...optionButton, background: backgroundColor(theme, 100), }, - editor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - minWidth: 200, - maxWidth: 500, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "primary"), - margin: { - right: 5, - }, - padding: { - top: 3, - bottom: 3, - left: 14, - right: 14, - }, - }, + editor, hoveredOptionButton: { ...optionButton, background: backgroundColor(theme, 100), }, invalidEditor: { - extends: "$search.editor", + ...editor, border: border(theme, "error"), }, matchIndex: { diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 148db089183e77274a81a122d6f02d920b640237..7e71eaad2a8e258e5aed2476af0b68fbf9c7ba4b 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -137,5 +137,10 @@ export default function workspace(theme: Theme) { ...text(theme, "mono", "secondary"), padding: { left: 6 }, }, + disconnectedOverlay: { + ...text(theme, "sans", "primary"), + color: "#ffffff", + background: "#000000aa", + }, }; } diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 42f80cf4c670deda733f434c3cbab691239f5396..2cadf24601f47cc1172c4d9be753cc80c3a9f20c 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -1,249 +1,273 @@ -import core from "../tokens/core"; -import Theme, { NumberToken, Syntax } from "./theme"; - -const { color } = core; +import { colors, fontWeights, NumberToken } from "../tokens"; +import Theme, { Syntax } from "./theme"; const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: colors.neutral[750], + hovered: colors.neutral[750], + active: colors.neutral[750], + focused: colors.neutral[750], + }, + 300: { + base: colors.neutral[800], + hovered: colors.neutral[800], + active: colors.neutral[800], + focused: colors.neutral[800], + }, + 500: { + base: colors.neutral[900], + hovered: colors.neutral[900], + active: colors.neutral[900], + focused: colors.neutral[900], + }, + ok: { + base: colors.green[600], + hovered: colors.green[600], + active: colors.green[600], + focused: colors.green[600], + }, + error: { + base: colors.red[400], + hovered: colors.red[400], + active: colors.red[400], + focused: colors.red[400], + }, + warning: { + base: colors.amber[300], + hovered: colors.amber[300], + active: colors.amber[300], + focused: colors.amber[300], + }, + info: { + base: colors.blue[500], + hovered: colors.blue[500], + active: colors.blue[500], + focused: colors.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[1000], - error: color.neutral[1000], - warning: color.neutral[1000], - info: color.neutral[1000], + primary: colors.neutral[850], + secondary: colors.neutral[700], + muted: colors.neutral[750], + focused: colors.neutral[100], + active: colors.neutral[500], + ok: colors.neutral[1000], + error: colors.neutral[1000], + warning: colors.neutral[1000], + info: colors.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: colors.neutral[150], + secondary: colors.neutral[350], + muted: colors.neutral[550], + placeholder: colors.neutral[750], + active: colors.neutral[0], + //TODO: (design) define feature and it's correct value + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: colors.neutral[300], + secondary: colors.neutral[500], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[50], + //TODO: (design) define feature and it's correct value + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: colors.blue[600], + cursorColor: colors.blue[600], + selectionColor: colors.blue[600], + borderColor: colors.blue[600], + }, + 2: { + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[500], + borderColor: colors.indigo[500], + }, + 3: { + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[500], + borderColor: colors.green[500], + }, + 4: { + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[500], + borderColor: colors.orange[500], + }, + 5: { + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[500], + borderColor: colors.purple[500], + }, + 6: { + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[400], + borderColor: colors.teal[400], + }, + 7: { + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[400], + borderColor: colors.pink[400], + }, + 8: { + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[400], + borderColor: colors.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], + }, + gutter: { + primary: colors.neutral[0], + active: colors.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: fontWeights.normal, + }, + comment: { + color: colors.lime[200], + weight: fontWeights.normal, + }, + punctuation: { + color: textColor.primary, + weight: fontWeights.normal, + }, + constant: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + keyword: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + function: { + color: colors.yellow[200], + weight: fontWeights.normal, + }, + type: { + color: colors.teal[300], + weight: fontWeights.normal, + }, + variant: { + color: colors.teal[300], + weight: fontWeights.normal, + }, + property: { + color: colors.sky[300], + weight: fontWeights.normal, + }, + enum: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + operator: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + string: { + color: colors.orange[300], + weight: fontWeights.normal, + }, + number: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + boolean: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + predictive: { + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, + listMarker: { + color: colors.sky[400], + weight: fontWeights.normal, + } }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number", + value: 0.32, + type: "number", }; const theme: Theme = { - name: "dark", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index 7a9bf1b552650b81288e70acc6c7500c80a8246b..acb704de74b99b91c2b41a739c751003670c5864 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -1,143 +1,141 @@ -import core from "../tokens/core"; -import Theme, { NumberToken, Syntax } from "./theme"; - -const { color } = core; +import { colors, fontWeights, NumberToken } from "../tokens"; +import Theme, { Syntax } from "./theme"; // TODO: Replace with light values const backgroundColor = { 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], + base: colors.neutral[750], + hovered: colors.neutral[750], + active: colors.neutral[750], + focused: colors.neutral[750], }, 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], + base: colors.neutral[800], + hovered: colors.neutral[800], + active: colors.neutral[800], + focused: colors.neutral[800], }, 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], + base: colors.neutral[900], + hovered: colors.neutral[900], + active: colors.neutral[900], + focused: colors.neutral[900], }, ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], + base: colors.green[600], + hovered: colors.green[600], + active: colors.green[600], + focused: colors.green[600], }, error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], + base: colors.red[400], + hovered: colors.red[400], + active: colors.red[400], + focused: colors.red[400], }, warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], + base: colors.amber[300], + hovered: colors.amber[300], + active: colors.amber[300], + focused: colors.amber[300], }, info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], + base: colors.blue[500], + hovered: colors.blue[500], + active: colors.blue[500], + focused: colors.blue[500], }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[1000], - error: color.neutral[1000], - warning: color.neutral[1000], - info: color.neutral[1000], + primary: colors.neutral[850], + secondary: colors.neutral[700], + muted: colors.neutral[750], + focused: colors.neutral[100], + active: colors.neutral[500], + ok: colors.neutral[1000], + error: colors.neutral[1000], + warning: colors.neutral[1000], + info: colors.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], + primary: colors.neutral[150], + secondary: colors.neutral[350], + muted: colors.neutral[550], + placeholder: colors.neutral[750], + active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], + primary: colors.neutral[300], + secondary: colors.neutral[500], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[50], //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const player = { 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], + baseColor: colors.blue[600], + cursorColor: colors.blue[600], + selectionColor: colors.blue[600], + borderColor: colors.blue[600], }, 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[500], + borderColor: colors.indigo[500], }, 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[500], + borderColor: colors.green[500], }, 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[500], + borderColor: colors.orange[500], }, 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[500], + borderColor: colors.purple[500], }, 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[400], + borderColor: colors.teal[400], }, 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[400], + borderColor: colors.pink[400], }, 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[400], + borderColor: colors.yellow[400], }, }; @@ -147,88 +145,114 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], }, gutter: { - primary: color.neutral[0], - active: color.neutral[0], + primary: colors.neutral[0], + active: colors.neutral[0], }, }; const syntax: Syntax = { primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, + color: textColor.primary, + weight: fontWeights.normal, }, comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, + color: colors.lime[200], + weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, + color: textColor.primary, + weight: fontWeights.normal, }, constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, + color: colors.yellow[200], + weight: fontWeights.normal, }, type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.teal[300], + weight: fontWeights.normal, }, variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.teal[300], + weight: fontWeights.normal, }, property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[300], + weight: fontWeights.normal, }, enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.orange[300], + weight: fontWeights.normal, }, number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, + listMarker: { + color: colors.sky[400], + weight: fontWeights.normal, + } }; const shadowAlpha: NumberToken = { diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index a7760459897b0bedec0d87512e669d1d7ae0a3b4..f95d58e49484aea340693ff289f19cb8cf8a4b0a 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -1,32 +1,8 @@ -export interface NumberToken { - value: number, - type: "number" -} - -export type Color = string; -export interface ColorToken { - value: Color; - type: "color"; - step?: number -} -export type Weight = - | "thin" - | "extra_light" - | "light" - | "normal" - | "medium" - | "semibold" - | "bold" - | "extra_bold" - | "black"; -export interface WeightToken { - value: Weight, - type: "fontWeight" -} +import { FontWeightToken, ColorToken, NumberToken } from "../tokens"; export interface SyntaxHighlightStyle { color: ColorToken; - weight: WeightToken; + weight: FontWeightToken; } export interface Player { @@ -43,7 +19,7 @@ export interface BackgroundColor { focused: ColorToken; } -export interface Syntax { +export interface Syntax { primary: SyntaxHighlightStyle; comment: SyntaxHighlightStyle; punctuation: SyntaxHighlightStyle; @@ -59,6 +35,13 @@ export interface Syntax { number: SyntaxHighlightStyle; boolean: SyntaxHighlightStyle; predictive: SyntaxHighlightStyle; + // TODO: Either move the following or rename + title: SyntaxHighlightStyle; + emphasis: SyntaxHighlightStyle; + emphasisStrong: SyntaxHighlightStyle; + linkUrl: SyntaxHighlightStyle; + linkText: SyntaxHighlightStyle; + listMarker: SyntaxHighlightStyle; }; export default interface Theme { diff --git a/styles/tokens.ts b/styles/tokens.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e0df5032d09ee72ce31fc2b9de256174b6bf905 --- /dev/null +++ b/styles/tokens.ts @@ -0,0 +1,102 @@ +import { colorRamp } from "./utils/color"; + +interface Token { + value: V, + type: T +} + +export type FontFamily = string; +export type FontFamilyToken = Token; +function fontFamily(value: FontFamily): FontFamilyToken { + return { + value, + type: "fontFamily" + } +} +export const fontFamilies = { + sans: fontFamily("Zed Sans"), + mono: fontFamily("Zed Mono"), +} + +export type FontSize = number; +export type FontSizeToken = Token; +function fontSize(value: FontSize) { + return { + value, + type: "fontSize" + }; +} +export const fontSizes = { + "3xs": fontSize(8), + "2xs": fontSize(10), + xs: fontSize(12), + sm: fontSize(14), + md: fontSize(16), + lg: fontSize(18), + xl: fontSize(20), +}; + +export type FontWeight = + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; +export type FontWeightToken = Token; +function fontWeight(value: FontWeight): FontWeightToken { + return { + value, + type: "fontWeight" + }; +} +export const fontWeights = { + "thin": fontWeight("thin"), + "extra_light": fontWeight("extra_light"), + "light": fontWeight("light"), + "normal": fontWeight("normal"), + "medium": fontWeight("medium"), + "semibold": fontWeight("semibold"), + "bold": fontWeight("bold"), + "extra_bold": fontWeight("extra_bold"), + "black": fontWeight("black"), +} + +export type Color = string; +export interface ColorToken { + value: Color, + type: "color", + step?: number, +} +export const colors = { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), +} + +export type NumberToken = Token; + +export default { + fontFamilies, + fontSizes, + fontWeights, + colors, +}; diff --git a/styles/tokens/core.ts b/styles/tokens/core.ts deleted file mode 100644 index 38bfe82e28129954a2f5602038d575a3cfbb94af..0000000000000000000000000000000000000000 --- a/styles/tokens/core.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { colorRamp } from "../utils/color"; - -export default { - fontFamily: { - sans: "Zed Sans", - mono: "Zed Mono", - }, - fontSize: { - "3xs": { - value: "8", - type: "fontSizes", - }, - "2xs": { - value: "10", - type: "fontSizes", - }, - xs: { - value: "12", - type: "fontSizes", - }, - sm: { - value: "14", - type: "fontSizes", - }, - md: { - value: "16", - type: "fontSizes", - }, - lg: { - value: "18", - type: "fontSizes", - }, - xl: { - value: "20", - type: "fontSizes", - }, - }, - color: { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), - rose: colorRamp("#F43F5EFF"), - red: colorRamp("#EF4444FF"), - orange: colorRamp("#F97316FF"), - amber: colorRamp("#F59E0BFF"), - yellow: colorRamp("#EAB308FF"), - lime: colorRamp("#84CC16FF"), - green: colorRamp("#22C55EFF"), - emerald: colorRamp("#10B981FF"), - teal: colorRamp("#14B8A6FF"), - cyan: colorRamp("#06BBD4FF"), - sky: colorRamp("#0EA5E9FF"), - blue: colorRamp("#3B82F6FF"), - indigo: colorRamp("#6366F1FF"), - violet: colorRamp("#8B5CF6FF"), - purple: colorRamp("#A855F7FF"), - fuschia: colorRamp("#D946E4FF"), - pink: colorRamp("#EC4899FF"), - }, -}; From f633e98081e9b3f4b48a15097434796d64a4c4a6 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 22:39:18 -0400 Subject: [PATCH 021/245] Add "npm run watch" command to live reload changes --- styles/nodemon.json | 6 + styles/package-lock.json | 2501 ++++++++++++++++++++++++++++++++++++-- styles/package.json | 6 +- 3 files changed, 2398 insertions(+), 115 deletions(-) create mode 100644 styles/nodemon.json diff --git a/styles/nodemon.json b/styles/nodemon.json new file mode 100644 index 0000000000000000000000000000000000000000..24022a55ad3aa2137a6fec03cdc1c97fa4e59e76 --- /dev/null +++ b/styles/nodemon.json @@ -0,0 +1,6 @@ +{ + "watch": ["./**/*"], + "ext": "ts", + "ignore": [], + "exec": "ts-node buildThemes.ts" +} \ No newline at end of file diff --git a/styles/package-lock.json b/styles/package-lock.json index 582f1c84968a5c1a25ddac5fd3c21ba907353c6d..43c9b19ea1224415c654186ed6203c48e776e2da 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -12,7 +12,10 @@ "@types/chroma-js": "^2.1.3", "@types/node": "^17.0.23", "case-anything": "^2.1.10", - "chroma-js": "^2.4.2", + "chroma-js": "^2.4.2" + }, + "devDependencies": { + "nodemon": "^2.0.15", "ts-node": "^10.7.0" } }, @@ -20,6 +23,7 @@ "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, "engines": { "node": ">= 12" } @@ -28,6 +32,7 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, "dependencies": { "@cspotcode/source-map-consumer": "0.8.0" }, @@ -35,25 +40,50 @@ "node": ">=12" } }, + "node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true }, "node_modules/@tsconfig/node12": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true }, "node_modules/@tsconfig/node14": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true }, "node_modules/@tsconfig/node16": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true }, "node_modules/@types/chroma-js": { "version": "2.1.3", @@ -65,10 +95,17 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -80,14 +117,175 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/case-anything": { "version": "2.1.10", @@ -100,186 +298,2136 @@ "url": "https://github.com/sponsors/mesqueeb" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, "engines": { "node": ">=0.3.1" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" + "is-obj": "^2.0.0" }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } + "engines": { + "node": ">=6" } }, - "node_modules/typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" }, "engines": { - "node": ">=4.2.0" + "node": ">= 6" } }, - "node_modules/v8-compile-cache-lib": { + "node_modules/global-dirs": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, "engines": { - "node": ">=6" + "node": ">=8.6" } - } - }, - "dependencies": { - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" }, - "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "requires": { - "@cspotcode/source-map-consumer": "0.8.0" + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" } }, - "@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true }, - "@tsconfig/node14": { + "node_modules/ignore-by-default": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true }, - "@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + "node_modules/import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true, + "engines": { + "node": ">=4" + } }, - "@types/chroma-js": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", - "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } }, - "@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" }, - "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true }, "case-anything": { "version": "2.1.10", "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "requires": { + "ini": "2.0.0" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + } + }, + "is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } }, "ts-node": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, "requires": { "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", @@ -296,21 +2444,146 @@ "yn": "3.1.1" } }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typescript": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, "peer": true }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "requires": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, "v8-compile-cache-lib": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/styles/package.json b/styles/package.json index c270bba0e1563cee758bbf5a02fb9fc1848b37ae..8576a35d34956a0dd438e35f6989dd9b68b217c2 100644 --- a/styles/package.json +++ b/styles/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "build": "ts-node buildThemes.ts" + "build": "ts-node buildThemes.ts", + "watch": "nodemon" }, "author": "", "license": "ISC", @@ -14,5 +15,8 @@ "case-anything": "^2.1.10", "chroma-js": "^2.4.2", "ts-node": "^10.7.0" + }, + "devDependencies": { + "nodemon": "^2.0.15" } } From ffc271e100158bec7f88bc65ec396c3bf422f21b Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 23:58:04 -0400 Subject: [PATCH 022/245] WIP --- crates/zed/assets/themes/dark.json | 351 ++++++++++++------------ crates/zed/assets/themes/light.json | 411 ++++++++++++++-------------- styles/buildThemes.ts | 2 +- styles/styleTree/chatPanel.ts | 8 +- styles/styleTree/editor.ts | 14 +- styles/styleTree/projectPanel.ts | 7 +- styles/styleTree/workspace.ts | 29 +- styles/themes/dark.ts | 24 +- styles/themes/light.ts | 288 ++++++++++--------- styles/themes/theme.ts | 2 +- styles/tokens.ts | 2 +- 11 files changed, 576 insertions(+), 562 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 65bf78b140ff3c94c298982cf2b3a6f6b8210609..fd11fc6c3a64a6fd6d878b935941d21960c12f37 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "padding": 8, "item": { @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#90df17", "weight": "bold", "size": 14 } @@ -33,25 +33,25 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#90df17", "weight": "bold", "size": 14 }, - "background": "#e6e6e6" + "background": "#000000" }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "empty": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -62,11 +62,11 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 14 }, "selection": { @@ -75,11 +75,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "padding": { @@ -103,24 +103,25 @@ } }, "workspace": { - "background": "#e6e6e6", + "background": "#1c1c1c", "leader_border_opacity": 0.7, "leader_border_width": 2, "tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#1c1c1c", + "icon_close": "#717171", + "icon_close_active": "#f1f1f1", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true, "bottom": true, @@ -132,20 +133,21 @@ } }, "active_tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#000000", + "icon_close": "#717171", + "icon_close_active": "#f1f1f1", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#ffffff", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true, "bottom": false, @@ -154,28 +156,28 @@ "padding": { "left": 12, "right": 12 - }, - "background": "#cccccc" + } }, "left_sidebar": { "width": 30, + "background": "#1c1c1c", "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#f1f1f1", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#0e0e0e", "padding": { "left": 1 } @@ -183,30 +185,31 @@ }, "right_sidebar": { "width": 30, + "background": "#1c1c1c", "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#f1f1f1", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#0e0e0e", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "status_bar": { @@ -218,28 +221,29 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 } }, "titlebar": { "avatar_width": 18, "height": 32, - "share_icon_color": "#808080", - "share_icon_active_color": "#0d0d0d", + "background": "#393939", + "share_icon_color": "#717171", + "share_icon_active_color": "#f1f1f1", "title": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "avatar": { @@ -254,13 +258,13 @@ "width": 12 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "bottom": true }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 13, "underline": true, "padding": { @@ -269,15 +273,15 @@ }, "hovered_sign_in_prompt": { "family": "Zed Mono", - "color": "#000000", - "size": 16, + "color": "#ffffff", + "size": 13, "underline": true, "padding": { "right": 8 } }, "offline_icon": { - "color": "#999999", + "color": "#717171", "width": 16, "padding": { "right": 4 @@ -285,15 +289,15 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#f8c570", "size": 13 } }, "toolbar": { "height": 34, - "background": "#cccccc", + "background": "#000000", "border": { - "color": "#d9d9d9", + "color": "#2b2b2b", "width": 1, "bottom": true }, @@ -307,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "padding": { "left": 6 @@ -321,20 +325,20 @@ } }, "editor": { - "text_color": "#595959", - "background": "#cccccc", - "active_line_background": "#000000", - "code_actions_indicator": "#808080", + "text_color": "#9c9c9c", + "background": "#000000", + "active_line_background": "#ffffff", + "code_actions_indicator": "#717171", "diff_background_deleted": "#f78c8c", "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#e6e6e6", - "document_highlight_write_background": "#e6e6e6", + "document_highlight_read_background": "#000000", + "document_highlight_write_background": "#000000", "error_color": "#f78c8c", - "gutter_background": "#cccccc", + "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#000000", - "line_number": "#000000", - "line_number_active": "#000000", + "highlighted_line_background": "#ffffff", + "line_number": "#ffffff", + "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { @@ -372,11 +376,11 @@ } ], "autocomplete": { - "background": "#bfbfbf", + "background": "#000000", "corner_radius": 6, "padding": 6, "border": { - "color": "#b3b3b3", + "color": "#393939", "width": 1 }, "item": { @@ -396,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#000000" }, "margin": { "left": -14 @@ -413,22 +417,22 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#000000" } }, "diagnostic_header": { - "background": "#e6e6e6", + "background": "#1c1c1c", "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#b3b3b3", + "color": "#393939", "width": 1, "bottom": true, "top": true }, "code": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "left": 10 @@ -437,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 } } }, "diagnostic_path_header": { - "background": "#000000", + "background": "#ffffff", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "left": 12 @@ -469,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -492,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -515,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -538,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -561,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -569,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -584,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -592,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -607,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -615,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -630,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -638,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -652,18 +656,18 @@ "syntax": {} }, "project_diagnostics": { - "background": "#cccccc", + "background": "#1c1c1c", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 10 @@ -672,52 +676,53 @@ }, "project_panel": { "padding": { - "top": 6 + "top": 6, + "left": 12 }, "entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 } }, "hovered_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#1c1c1c", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 } }, "selected_entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#d5d5d5", + "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#1c1c1c", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#d5d5d5", + "size": 14 } } }, @@ -730,13 +735,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "padding": { "right": 8 @@ -746,7 +751,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": { @@ -755,7 +760,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -766,13 +771,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -783,31 +788,31 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -818,27 +823,27 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6 }, "menu": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "padding": 4, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "shadow": { @@ -853,25 +858,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -879,7 +884,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "weight": "bold", "size": 14, "margin": { @@ -890,12 +895,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -903,7 +908,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "weight": "bold", "size": 14, "margin": { @@ -912,24 +917,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#000000", "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#8c8c8c", - "size": 16 + "color": "#2b2b2b", + "size": 14 }, "selection": { "cursor": "#4287f6", "selection": "#4287f6" }, "border": { - "color": "#d9d9d9", + "color": "#393939", "width": 1 }, "padding": { @@ -948,7 +953,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#bfbfbf", + "tree_branch_color": "#2b2b2b", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -956,7 +961,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 16, "padding": { "left": 8 @@ -971,7 +976,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -990,7 +995,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16, "margin": { "right": 6 @@ -1009,7 +1014,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16, "margin": { "right": 6 @@ -1018,7 +1023,7 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 }, "unshared_project": { @@ -1030,7 +1035,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -1049,7 +1054,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -1058,22 +1063,22 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 } }, "search": { - "match_background": "#000000", + "match_background": "#ffffff", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1089,12 +1094,12 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1109,13 +1114,13 @@ } }, "editor": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 16 }, "selection": { @@ -1124,11 +1129,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1143,12 +1148,12 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1163,13 +1168,13 @@ } }, "invalid_editor": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 16 }, "selection": { @@ -1178,11 +1183,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#ffffff", + "color": "#f47171", "width": 1 }, "margin": { @@ -1197,18 +1202,18 @@ }, "match_index": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1230,13 +1235,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 65bf78b140ff3c94c298982cf2b3a6f6b8210609..219f958e876dcb36abd4edf2e2986c7fb26f32c3 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "padding": 8, "item": { @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#4287f6", "weight": "bold", "size": 14 } @@ -33,25 +33,25 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#4287f6", "weight": "bold", "size": 14 }, - "background": "#e6e6e6" + "background": "#e3e3e3" }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "empty": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -62,24 +62,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#f1f1f1", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#bfbfbf", + "color": "#717171", "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "padding": { @@ -95,7 +95,7 @@ }, "shadow": { "blur": 16, - "color": "#00000052", + "color": "#0000001f", "offset": [ 0, 2 @@ -103,24 +103,25 @@ } }, "workspace": { - "background": "#e6e6e6", + "background": "#f1f1f1", "leader_border_opacity": 0.7, "leader_border_width": 2, "tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#f1f1f1", + "icon_close": "#717171", + "icon_close_active": "#000000", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true, "bottom": true, @@ -132,20 +133,21 @@ } }, "active_tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#ffffff", + "icon_close": "#717171", + "icon_close_active": "#000000", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#000000", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true, "bottom": false, @@ -154,28 +156,28 @@ "padding": { "left": 12, "right": 12 - }, - "background": "#cccccc" + } }, "left_sidebar": { "width": 30, + "background": "#f1f1f1", "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#000000", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#c6c6c6", "padding": { "left": 1 } @@ -183,30 +185,31 @@ }, "right_sidebar": { "width": 30, + "background": "#f1f1f1", "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#000000", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#c6c6c6", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "status_bar": { @@ -218,28 +221,29 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 } }, "titlebar": { "avatar_width": 18, "height": 32, - "share_icon_color": "#808080", - "share_icon_active_color": "#0d0d0d", + "background": "#e3e3e3", + "share_icon_color": "#717171", + "share_icon_active_color": "#000000", "title": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "avatar": { @@ -254,13 +258,13 @@ "width": 12 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "bottom": true }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 13, "underline": true, "padding": { @@ -270,14 +274,14 @@ "hovered_sign_in_prompt": { "family": "Zed Mono", "color": "#000000", - "size": 16, + "size": 13, "underline": true, "padding": { "right": 8 } }, "offline_icon": { - "color": "#999999", + "color": "#717171", "width": 16, "padding": { "right": 4 @@ -285,15 +289,15 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#b48d14", "size": 13 } }, "toolbar": { "height": 34, - "background": "#cccccc", + "background": "#ffffff", "border": { - "color": "#d9d9d9", + "color": "#f1f1f1", "width": 1, "bottom": true }, @@ -307,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "padding": { "left": 6 @@ -315,68 +319,68 @@ }, "disconnected_overlay": { "family": "Zed Sans", - "color": "#ffffff", + "color": "#000000", "size": 14, "background": "#000000aa" } }, "editor": { - "text_color": "#595959", - "background": "#cccccc", - "active_line_background": "#000000", - "code_actions_indicator": "#808080", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#e6e6e6", - "document_highlight_write_background": "#e6e6e6", - "error_color": "#f78c8c", - "gutter_background": "#cccccc", + "text_color": "#393939", + "background": "#ffffff", + "active_line_background": "#ffffff", + "code_actions_indicator": "#717171", + "diff_background_deleted": "#fdd4d4", + "diff_background_inserted": "#befad2", + "document_highlight_read_background": "#e3e3e3", + "document_highlight_write_background": "#e3e3e3", + "error_color": "#d11c1c", + "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#000000", - "line_number": "#000000", - "line_number_active": "#000000", + "highlighted_line_background": "#ffffff", + "line_number": "#ffffff", + "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "guest_selections": [ { "cursor": "#777af4", - "selection": "#777af4" + "selection": "#d4d5fd" }, { "cursor": "#23d464", - "selection": "#23d464" + "selection": "#befad2" }, { "cursor": "#f98a3d", - "selection": "#f98a3d" + "selection": "#fde0cd" }, { "cursor": "#b671f8", - "selection": "#b671f8" + "selection": "#e9d4fd" }, { "cursor": "#16ddc7", - "selection": "#16ddc7" + "selection": "#b4faf2" }, { "cursor": "#f58ac0", - "selection": "#f58ac0" + "selection": "#fcd4e8" }, { "cursor": "#f6bc09", - "selection": "#f6bc09" + "selection": "#fceabc" } ], "autocomplete": { - "background": "#bfbfbf", + "background": "#ffffff", "corner_radius": 6, "padding": 6, "border": { - "color": "#b3b3b3", + "color": "#e3e3e3", "width": 1 }, "item": { @@ -396,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#f1f1f1" }, "margin": { "left": -14 @@ -413,22 +417,22 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#e3e3e3" } }, "diagnostic_header": { - "background": "#e6e6e6", + "background": "#f1f1f1", "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#b3b3b3", + "color": "#e3e3e3", "width": 1, "bottom": true, "top": true }, "code": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "left": 10 @@ -437,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 } } }, "diagnostic_path_header": { - "background": "#000000", + "background": "#ffffff", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "left": 12 @@ -469,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -477,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d11c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d11c1c", "size": 14, "weight": "bold" } @@ -492,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -500,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#b48d14", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#b48d14", "size": 14, "weight": "bold" } @@ -515,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -523,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14, "weight": "bold" } @@ -538,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -546,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14, "weight": "bold" } @@ -561,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -569,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -584,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -592,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -607,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -615,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -630,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -638,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -652,18 +656,18 @@ "syntax": {} }, "project_diagnostics": { - "background": "#cccccc", + "background": "#f1f1f1", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 10 @@ -672,52 +676,53 @@ }, "project_panel": { "padding": { - "top": 6 + "top": 6, + "left": 12 }, "entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 } }, "hovered_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#e3e3e3", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 } }, "selected_entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#1c1c1c", + "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#e3e3e3", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#1c1c1c", + "size": 14 } } }, @@ -730,13 +735,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "padding": { "right": 8 @@ -746,7 +751,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": { @@ -755,7 +760,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -766,13 +771,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -783,31 +788,31 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#e3e3e3", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -818,32 +823,32 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#e3e3e3", "corner_radius": 6 }, "menu": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "padding": 4, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "shadow": { "blur": 16, - "color": "#00000052", + "color": "#0000001f", "offset": [ 0, 2 @@ -853,25 +858,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -879,7 +884,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "weight": "bold", "size": 14, "margin": { @@ -890,12 +895,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -903,7 +908,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "weight": "bold", "size": 14, "margin": { @@ -912,24 +917,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#ffffff", "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#8c8c8c", - "size": 16 + "color": "#717171", + "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "border": { - "color": "#d9d9d9", + "color": "#e3e3e3", "width": 1 }, "padding": { @@ -948,7 +953,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#bfbfbf", + "tree_branch_color": "#f1f1f1", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -956,7 +961,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 16, "padding": { "left": 8 @@ -971,7 +976,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -990,7 +995,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16, "margin": { "right": 6 @@ -1009,7 +1014,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16, "margin": { "right": 6 @@ -1018,7 +1023,7 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 }, "unshared_project": { @@ -1030,7 +1035,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -1049,7 +1054,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -1058,22 +1063,22 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 } }, "search": { - "match_background": "#000000", + "match_background": "#ffffff", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1089,12 +1094,12 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1109,26 +1114,26 @@ } }, "editor": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#717171", "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1143,12 +1148,12 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1163,26 +1168,26 @@ } }, "invalid_editor": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#717171", "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#ffffff", + "color": "#fbbdbd", "width": 1 }, "margin": { @@ -1197,18 +1202,18 @@ }, "match_index": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#cccccc", + "background": "#f1f1f1", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1230,13 +1235,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14, "padding": { "left": 6 diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index d67860cee66a0ec7abd7d37da8b10f0a6c930488..9128eff45d46a0a11b9a8ddb04013b3b59faf87a 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -1,8 +1,8 @@ import * as fs from "fs"; import * as path from "path"; +import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; -import app from "./styleTree/app"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; diff --git a/styles/styleTree/chatPanel.ts b/styles/styleTree/chatPanel.ts index ea9a8ffe22a83e2b7135bc886273f2da2d7c1502..69b5f3baa0d74c03e4ff5e0a81ff4fc6616afdfc 100644 --- a/styles/styleTree/chatPanel.ts +++ b/styles/styleTree/chatPanel.ts @@ -31,7 +31,7 @@ export default function chatPanel(theme: Theme) { const message = { body: text(theme, "sans", "secondary"), - timestamp: text(theme, "sans", "muted"), + timestamp: text(theme, "sans", "muted", { size: "sm" }), padding: { bottom: 6, }, @@ -91,12 +91,12 @@ export default function chatPanel(theme: Theme) { }, }, inputEditor: { - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), cornerRadius: 6, text: text(theme, "mono", "primary"), - placeholderText: text(theme, "mono", "muted"), + placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), selection: player(theme, 1).selection, - border: border(theme, "primary"), + border: border(theme, "secondary"), padding: { bottom: 7, left: 8, diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index ebc53b405875dab197a3c95d5373732050e9a7a0..eb379ce520bfb5b53b85e5d8e28be639d598a6f9 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -5,7 +5,7 @@ import { iconColor, player, text, - TextColor, + TextColor } from "./components"; export default function editor(theme: Theme) { @@ -39,7 +39,7 @@ export default function editor(theme: Theme) { return { textColor: theme.textColor.secondary.value, - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active.value, codeActionsIndicator: iconColor(theme, "secondary"), diffBackgroundDeleted: backgroundColor(theme, "error"), @@ -47,7 +47,7 @@ export default function editor(theme: Theme) { documentHighlightReadBackground: theme.editor.highlight.occurrence.value, documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, errorColor: theme.textColor.error.value, - gutterBackground: backgroundColor(theme, 300), + gutterBackground: backgroundColor(theme, 500), gutterPaddingFactor: 2.5, highlightedLineBackground: theme.editor.line.highlighted.value, lineNumber: theme.editor.gutter.primary.value, @@ -65,14 +65,14 @@ export default function editor(theme: Theme) { player(theme, 8).selection, ], autocomplete: { - background: backgroundColor(theme, 100), + background: backgroundColor(theme, 500), cornerRadius: 6, padding: 6, border: border(theme, "secondary"), item: autocompleteItem, hoveredItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "hovered"), + background: backgroundColor(theme, 500, "hovered"), }, margin: { left: -14, @@ -83,11 +83,11 @@ export default function editor(theme: Theme) { }, selectedItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "active"), + background: backgroundColor(theme, 500, "active"), }, }, diagnosticHeader: { - background: theme.editor.background.value, + background: backgroundColor(theme, 300), iconWidthFactor: 1.5, textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. border: border(theme, "secondary", { diff --git a/styles/styleTree/projectPanel.ts b/styles/styleTree/projectPanel.ts index cd6fb49b3ada1db47b3dd15637cb1a4a6c5ee516..e27cd94414a031f64dbc0ee5e232d2666944462a 100644 --- a/styles/styleTree/projectPanel.ts +++ b/styles/styleTree/projectPanel.ts @@ -1,7 +1,7 @@ -import { panel } from "./app"; -import { backgroundColor, iconColor, text, TextColor } from "./components"; import Theme from "../themes/theme"; import { Color } from "../utils/color"; +import { panel } from "./app"; +import { backgroundColor, iconColor, text, TextColor } from "./components"; export default function projectPanel(theme: Theme) { function entry(theme: Theme, textColor: TextColor, background?: Color) { @@ -11,7 +11,7 @@ export default function projectPanel(theme: Theme) { iconColor: iconColor(theme, "muted"), iconSize: 8, iconSpacing: 8, - text: text(theme, "mono", textColor), + text: text(theme, "mono", textColor, { size: "sm" }), }; } @@ -31,6 +31,7 @@ export default function projectPanel(theme: Theme) { ), padding: { top: 6, + left: 12, }, }; } diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 7e71eaad2a8e258e5aed2476af0b68fbf9c7ba4b..a734528d744c21896cb73c090b482615bb3544b3 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -12,14 +12,15 @@ export default function workspace(theme: Theme) { }; const tab = { - height: 34, + height: 32, + background: backgroundColor(theme, 300), iconClose: iconColor(theme, "secondary"), iconCloseActive: iconColor(theme, "active"), iconConflict: iconColor(theme, "warning"), iconDirty: iconColor(theme, "info"), iconWidth: 8, spacing: 10, - text: text(theme, "mono", "secondary"), + text: text(theme, "mono", "secondary", { size: "sm" }), border: border(theme, "primary", { left: true, bottom: true, @@ -33,8 +34,8 @@ export default function workspace(theme: Theme) { const activeTab = { ...tab, - background: backgroundColor(theme, 300), - text: text(theme, "mono", "primary"), + background: backgroundColor(theme, 500), + text: text(theme, "mono", "active", { size: "sm" }), border: { ...tab.border, bottom: false, @@ -48,11 +49,12 @@ export default function workspace(theme: Theme) { }; const sidebar = { width: 30, + background: backgroundColor(theme, 300), border: border(theme, "primary", { right: true }), item: sidebarItem, activeItem: { ...sidebarItem, - iconColor: iconColor(theme, "primary"), + iconColor: iconColor(theme, "active"), }, resizeHandle: { background: border(theme, "primary").color, @@ -63,7 +65,7 @@ export default function workspace(theme: Theme) { }; return { - background: backgroundColor(theme, 500), + background: backgroundColor(theme, 300), leaderBorderOpacity: 0.7, leaderBorderWidth: 2.0, tab, @@ -94,6 +96,7 @@ export default function workspace(theme: Theme) { titlebar: { avatarWidth: 18, height: 32, + background: backgroundColor(theme, 100), shareIconColor: iconColor(theme, "secondary"), shareIconActiveColor: iconColor(theme, "active"), title: text(theme, "sans", "primary"), @@ -107,29 +110,32 @@ export default function workspace(theme: Theme) { avatarRibbon: { height: 3, width: 12, + // TODO: The background for this ideally should be + // set with a token, not hardcoded in rust }, border: border(theme, "primary", { bottom: true }), signInPrompt, hoveredSignInPrompt: { ...signInPrompt, ...text(theme, "mono", "active"), + size: 13, }, offlineIcon: { - color: iconColor(theme, "muted"), + color: iconColor(theme, "secondary"), width: 16, padding: { right: 4, }, }, outdatedWarning: { - ...text(theme, "sans", "muted"), + ...text(theme, "sans", "warning"), size: 13, }, }, toolbar: { height: 34, - background: backgroundColor(theme, 300), - border: border(theme, "primary", { bottom: true }), + background: backgroundColor(theme, 500), + border: border(theme, "muted", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, @@ -138,8 +144,7 @@ export default function workspace(theme: Theme) { padding: { left: 6 }, }, disconnectedOverlay: { - ...text(theme, "sans", "primary"), - color: "#ffffff", + ...text(theme, "sans", "active"), background: "#000000aa", }, }; diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 2cadf24601f47cc1172c4d9be753cc80c3a9f20c..f8e0c0fcb6b00e157bf577fca2024ca286561c5d 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -3,10 +3,10 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[750], - hovered: colors.neutral[750], - active: colors.neutral[750], - focused: colors.neutral[750], + base: colors.neutral[700], + hovered: colors.neutral[700], + active: colors.neutral[700], + focused: colors.neutral[700], }, 300: { base: colors.neutral[800], @@ -52,10 +52,10 @@ const borderColor = { muted: colors.neutral[750], focused: colors.neutral[100], active: colors.neutral[500], - ok: colors.neutral[1000], - error: colors.neutral[1000], - warning: colors.neutral[1000], - info: colors.neutral[1000], + ok: colors.green[500], + error: colors.red[500], + warning: colors.amber[500], + info: colors.blue[500], }; const textColor = { @@ -65,7 +65,7 @@ const textColor = { placeholder: colors.neutral[750], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + feature: colors.lime[400], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], @@ -81,9 +81,9 @@ const iconColor = { //TODO: (design) define feature and it's correct value feature: colors.sky[500], ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + error: colors.red[500], + warning: colors.amber[400], + info: colors.blue[600], }; const player = { diff --git a/styles/themes/light.ts b/styles/themes/light.ts index acb704de74b99b91c2b41a739c751003670c5864..c543c78a302e3579970998ad1fb23847b1e1f694 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -5,73 +5,72 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[750], - hovered: colors.neutral[750], - active: colors.neutral[750], - focused: colors.neutral[750], + base: colors.neutral[100], + hovered: colors.neutral[150], + active: colors.neutral[200], + focused: colors.neutral[150], }, 300: { - base: colors.neutral[800], - hovered: colors.neutral[800], - active: colors.neutral[800], - focused: colors.neutral[800], + base: colors.neutral[50], + hovered: colors.neutral[100], + active: colors.neutral[150], + focused: colors.neutral[100], }, 500: { - base: colors.neutral[900], - hovered: colors.neutral[900], - active: colors.neutral[900], - focused: colors.neutral[900], + base: colors.neutral[0], + hovered: colors.neutral[50], + active: colors.neutral[100], + focused: colors.neutral[50], }, ok: { - base: colors.green[600], - hovered: colors.green[600], - active: colors.green[600], - focused: colors.green[600], + base: colors.green[100], + hovered: colors.green[100], + active: colors.green[100], + focused: colors.green[100], }, error: { - base: colors.red[400], - hovered: colors.red[400], - active: colors.red[400], - focused: colors.red[400], + base: colors.red[100], + hovered: colors.red[100], + active: colors.red[100], + focused: colors.red[100], }, warning: { - base: colors.amber[300], - hovered: colors.amber[300], - active: colors.amber[300], - focused: colors.amber[300], + base: colors.yellow[100], + hovered: colors.yellow[100], + active: colors.yellow[100], + focused: colors.yellow[100], }, info: { - base: colors.blue[500], - hovered: colors.blue[500], - active: colors.blue[500], - focused: colors.blue[500], + base: colors.blue[100], + hovered: colors.blue[100], + active: colors.blue[100], + focused: colors.blue[100], }, }; const borderColor = { - primary: colors.neutral[850], - secondary: colors.neutral[700], - muted: colors.neutral[750], + primary: colors.neutral[200], + secondary: colors.neutral[100], + muted: colors.neutral[50], focused: colors.neutral[100], - active: colors.neutral[500], - ok: colors.neutral[1000], - error: colors.neutral[1000], - warning: colors.neutral[1000], - info: colors.neutral[1000], + active: colors.neutral[250], + ok: colors.green[200], + error: colors.red[200], + warning: colors.yellow[200], + info: colors.blue[200], }; const textColor = { - primary: colors.neutral[150], - secondary: colors.neutral[350], - muted: colors.neutral[550], - placeholder: colors.neutral[750], - active: colors.neutral[0], - //TODO: (design) define feature and it's correct value - feature: colors.sky[500], - ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + primary: colors.neutral[800], + secondary: colors.neutral[700], + muted: colors.neutral[600], + placeholder: colors.neutral[500], + active: colors.neutral[900], + feature: colors.blue[600], + ok: colors.green[800], + error: colors.red[800], + warning: colors.yellow[800], + info: colors.blue[800], }; const iconColor = { @@ -79,63 +78,62 @@ const iconColor = { secondary: colors.neutral[500], muted: colors.neutral[600], placeholder: colors.neutral[700], - active: colors.neutral[50], - //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + active: colors.neutral[900], + feature: colors.sky[600], ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + error: colors.red[600], + warning: colors.yellow[400], + info: colors.blue[600], }; const player = { 1: { - baseColor: colors.blue[600], - cursorColor: colors.blue[600], - selectionColor: colors.blue[600], - borderColor: colors.blue[600], + baseColor: colors.blue[600], + cursorColor: colors.blue[500], + selectionColor: colors.blue[100], + borderColor: colors.blue[500], }, 2: { - baseColor: colors.indigo[500], - cursorColor: colors.indigo[500], - selectionColor: colors.indigo[500], - borderColor: colors.indigo[500], + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[100], + borderColor: colors.indigo[500], }, 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[500], - borderColor: colors.green[500], + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[100], + borderColor: colors.green[500], }, 4: { - baseColor: colors.orange[500], - cursorColor: colors.orange[500], - selectionColor: colors.orange[500], - borderColor: colors.orange[500], + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[100], + borderColor: colors.orange[500], }, 5: { - baseColor: colors.purple[500], - cursorColor: colors.purple[500], - selectionColor: colors.purple[500], - borderColor: colors.purple[500], + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[100], + borderColor: colors.purple[500], }, 6: { - baseColor: colors.teal[400], - cursorColor: colors.teal[400], - selectionColor: colors.teal[400], - borderColor: colors.teal[400], + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[100], + borderColor: colors.teal[400], }, 7: { - baseColor: colors.pink[400], - cursorColor: colors.pink[400], - selectionColor: colors.pink[400], - borderColor: colors.pink[400], + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[100], + borderColor: colors.pink[400], }, 8: { - baseColor: colors.yellow[400], - cursorColor: colors.yellow[400], - selectionColor: colors.yellow[400], - borderColor: colors.yellow[400], + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[100], + borderColor: colors.yellow[400], }, }; @@ -145,118 +143,118 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: colors.neutral[0], - matchingBracket: colors.neutral[0], - match: colors.neutral[0], - activeMatch: colors.neutral[0], - related: colors.neutral[0], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: colors.neutral[0], + active: colors.neutral[0], }, }; const syntax: Syntax = { primary: { - color: textColor.primary, - weight: fontWeights.normal, + color: textColor.primary, + weight: fontWeights.normal, }, comment: { - color: colors.lime[200], - weight: fontWeights.normal, + color: colors.lime[200], + weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, - weight: fontWeights.normal, + color: textColor.primary, + weight: fontWeights.normal, }, constant: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, function: { - color: colors.yellow[200], - weight: fontWeights.normal, + color: colors.yellow[200], + weight: fontWeights.normal, }, type: { - color: colors.teal[300], - weight: fontWeights.normal, + color: colors.teal[300], + weight: fontWeights.normal, }, variant: { - color: colors.teal[300], - weight: fontWeights.normal, + color: colors.teal[300], + weight: fontWeights.normal, }, property: { - color: colors.sky[300], - weight: fontWeights.normal, + color: colors.sky[300], + weight: fontWeights.normal, }, enum: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, operator: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, string: { - color: colors.orange[300], - weight: fontWeights.normal, + color: colors.orange[300], + weight: fontWeights.normal, }, number: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, predictive: { - color: textColor.muted, - weight: fontWeights.normal, + color: textColor.muted, + weight: fontWeights.normal, }, title: { - color: colors.sky[500], - weight: fontWeights.bold, + color: colors.sky[500], + weight: fontWeights.bold, }, emphasis: { - color: textColor.active, - weight: fontWeights.normal, + color: textColor.active, + weight: fontWeights.normal, }, emphasisStrong: { - color: textColor.active, - weight: fontWeights.bold, + color: textColor.active, + weight: fontWeights.bold, }, linkUrl: { - color: colors.lime[500], - weight: fontWeights.normal, - // TODO: add underline + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline }, linkText: { - color: colors.orange[500], - weight: fontWeights.normal, - // TODO: add italic + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic }, listMarker: { - color: colors.sky[400], - weight: fontWeights.normal, - } + color: colors.sky[400], + weight: fontWeights.normal, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, + value: 0.12, type: "number", }; diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index f95d58e49484aea340693ff289f19cb8cf8a4b0a..7f8305c1d539d24fe50f23d650844c0670506dc1 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -1,4 +1,4 @@ -import { FontWeightToken, ColorToken, NumberToken } from "../tokens"; +import { ColorToken, FontWeightToken, NumberToken } from "../tokens"; export interface SyntaxHighlightStyle { color: ColorToken; diff --git a/styles/tokens.ts b/styles/tokens.ts index 1e0df5032d09ee72ce31fc2b9de256174b6bf905..63c19a9d6439a77db5d1d9cd7924966e117a931a 100644 --- a/styles/tokens.ts +++ b/styles/tokens.ts @@ -72,7 +72,7 @@ export interface ColorToken { step?: number, } export const colors = { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + neutral: colorRamp(["white", "black"], { steps: 19, increment: 50 }), rose: colorRamp("#F43F5EFF"), red: colorRamp("#EF4444FF"), orange: colorRamp("#F97316FF"), From b7214729912bcc75f731d87400f273f263359a1c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 23:59:20 -0400 Subject: [PATCH 023/245] Add greg to .zed.toml --- .zed.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zed.toml b/.zed.toml index 0cbe5c59a550cbdae9b8d016123ef315bbd0e18e..fae32125f4f236c7bc99f57f5bf9e6e041984069 100644 --- a/.zed.toml +++ b/.zed.toml @@ -1 +1 @@ -collaborators = ["nathansobo", "as-cii", "maxbrunsfeld", "iamnbutler", "Kethku"] +collaborators = ["nathansobo", "as-cii", "maxbrunsfeld", "iamnbutler", "gibusu", "Kethku"] From 2af313c8e2bbe1b0959f1d48b5aa01aff1c8aa07 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sat, 2 Apr 2022 01:05:28 -0400 Subject: [PATCH 024/245] WIP --- crates/zed/assets/themes/dark.json | 157 +++++++++--------- crates/zed/assets/themes/light.json | 245 ++++++++++++++-------------- styles/styleTree/app.ts | 3 +- styles/styleTree/editor.ts | 3 +- styles/themes/dark.ts | 54 +++--- styles/themes/light.ts | 38 ++--- styles/utils/color.ts | 4 +- 7 files changed, 251 insertions(+), 253 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index fd11fc6c3a64a6fd6d878b935941d21960c12f37..0abf380cc18fc7ecb252d8d062b2ff53aeb4ad7c 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#90df17", + "color": "#72ad19", "weight": "bold", "size": 14 } @@ -33,16 +33,16 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#90df17", + "color": "#72ad19", "weight": "bold", "size": 14 }, - "background": "#000000" + "background": "#1c1c1c" }, "border": { "color": "#0e0e0e", @@ -70,12 +70,12 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#717171", "icon_close_active": "#f1f1f1", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#c38214", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#717171", "icon_close_active": "#f1f1f1", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#c38214", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -243,7 +243,7 @@ "share_icon_active_color": "#f1f1f1", "title": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "avatar": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 13 } }, @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#9c9c9c", + "text_color": "#e3e3e3", "background": "#000000", - "active_line_background": "#ffffff", + "active_line_background": "#1c1c1c", "code_actions_indicator": "#717171", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#000000", - "document_highlight_write_background": "#000000", - "error_color": "#f78c8c", + "diff_background_deleted": "#d71c1c", + "diff_background_inserted": "#1ea34f", + "document_highlight_read_background": "#1e22db", + "document_highlight_write_background": "#1e22db", + "error_color": "#d71c1c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#ffffff", - "line_number": "#ffffff", + "highlighted_line_background": "#0e0e0e", + "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "guest_selections": [ { - "cursor": "#777af4", - "selection": "#777af4" + "cursor": "#70a919", + "selection": "#80c517" }, { - "cursor": "#23d464", - "selection": "#23d464" + "cursor": "#1e22db", + "selection": "#5558ee" }, { - "cursor": "#f98a3d", - "selection": "#f98a3d" + "cursor": "#c45c14", + "selection": "#f66e0f" }, { - "cursor": "#b671f8", - "selection": "#b671f8" + "cursor": "#7d19dc", + "selection": "#a048f4" }, { - "cursor": "#16ddc7", - "selection": "#16ddc7" + "cursor": "#17a293", + "selection": "#15b3a2" }, { - "cursor": "#f58ac0", - "selection": "#f58ac0" + "cursor": "#d51e79", + "selection": "#e93d92" }, { - "cursor": "#f6bc09", - "selection": "#f6bc09" + "cursor": "#bc9212", + "selection": "#e0ac0b" } ], "autocomplete": { @@ -400,13 +400,13 @@ "right": 6, "top": 2 }, - "background": "#000000" + "background": "#0e0e0e" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#1588bc", "weight": "normal" }, "selected_item": { @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#000000" + "background": "#1c1c1c" } }, "diagnostic_header": { @@ -441,7 +441,7 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14, "weight": "bold" }, @@ -453,11 +453,11 @@ } }, "diagnostic_path_header": { - "background": "#ffffff", + "background": "#1c1c1c", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "path": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d71c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d71c1c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -656,13 +656,12 @@ "syntax": {} }, "project_diagnostics": { - "background": "#1c1c1c", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "status_bar_item": { @@ -709,7 +708,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 } }, @@ -721,7 +720,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 } } @@ -735,7 +734,7 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "weight": "bold", "size": 14 }, @@ -751,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": { @@ -806,7 +805,7 @@ "active_item": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": 4, @@ -823,7 +822,7 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": 4, @@ -864,7 +863,7 @@ }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "underline": true, "size": 14 }, @@ -884,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "weight": "bold", "size": 14, "margin": { @@ -921,7 +920,7 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "placeholder_text": { @@ -930,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "border": { "color": "#393939", @@ -995,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16, "margin": { "right": 6 @@ -1014,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16, "margin": { "right": 6 @@ -1023,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#1c1c1c", "corner_radius": 6 }, "unshared_project": { @@ -1063,12 +1062,12 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#1c1c1c", "corner_radius": 6 } }, "search": { - "match_background": "#ffffff", + "match_background": "#70a919", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1124,12 +1123,12 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { @@ -1178,16 +1177,16 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { - "color": "#f47171", + "color": "#cd1c1c", "width": 1 }, "margin": { @@ -1235,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 219f958e876dcb36abd4edf2e2986c7fb26f32c3..1024764540e55f20505b6864ca6bdddd95881edd 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#4287f6", + "color": "#185fd0", "weight": "bold", "size": 14 } @@ -33,12 +33,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#4287f6", + "color": "#185fd0", "weight": "bold", "size": 14 }, @@ -51,7 +51,7 @@ "empty": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -66,16 +66,16 @@ "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#717171", + "color": "#aaaaaa", "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { @@ -111,13 +111,13 @@ "background": "#f1f1f1", "icon_close": "#717171", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#bc9212", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 }, "border": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#717171", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#bc9212", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -221,17 +221,17 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 } }, @@ -243,7 +243,7 @@ "share_icon_active_color": "#000000", "title": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "avatar": { @@ -264,7 +264,7 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 13, "underline": true, "padding": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 13 } }, @@ -311,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "padding": { "left": 6 @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#393939", + "text_color": "#2b2b2b", "background": "#ffffff", - "active_line_background": "#ffffff", + "active_line_background": "#e3e3e3", "code_actions_indicator": "#717171", - "diff_background_deleted": "#fdd4d4", - "diff_background_inserted": "#befad2", + "diff_background_deleted": "#ec3939", + "diff_background_inserted": "#21bf5b", "document_highlight_read_background": "#e3e3e3", "document_highlight_write_background": "#e3e3e3", - "error_color": "#d11c1c", + "error_color": "#cd1c1c", "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#ffffff", - "line_number": "#ffffff", - "line_number_active": "#ffffff", + "highlighted_line_background": "#e3e3e3", + "line_number": "#808080", + "line_number_active": "#000000", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "guest_selections": [ { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#70a919", + "selection": "#80c517" }, { - "cursor": "#23d464", - "selection": "#befad2" + "cursor": "#1e22db", + "selection": "#5558ee" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#c45c14", + "selection": "#f66e0f" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#7d19dc", + "selection": "#a048f4" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#17a293", + "selection": "#15b3a2" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#d51e79", + "selection": "#e93d92" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#bc9212", + "selection": "#e0ac0b" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#1588bc", "weight": "normal" }, "selected_item": { @@ -432,7 +432,7 @@ }, "code": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "left": 10 @@ -441,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 } } }, "diagnostic_path_header": { - "background": "#ffffff", + "background": "#e3e3e3", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "left": 12 @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#d11c1c", + "color": "#cd1c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#d11c1c", + "color": "#cd1c1c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -573,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -596,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -619,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -642,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -656,18 +656,17 @@ "syntax": {} }, "project_diagnostics": { - "background": "#f1f1f1", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 10 @@ -686,7 +685,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 } }, @@ -698,7 +697,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 } }, @@ -709,7 +708,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 } }, @@ -721,7 +720,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 } } @@ -735,13 +734,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "padding": { "right": 8 @@ -751,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": { @@ -760,7 +759,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -771,13 +770,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -788,13 +787,13 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -806,13 +805,13 @@ "active_item": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -823,13 +822,13 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -858,25 +857,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -884,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "weight": "bold", "size": 14, "margin": { @@ -895,12 +894,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -908,7 +907,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "weight": "bold", "size": 14, "margin": { @@ -921,17 +920,17 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "border": { "color": "#e3e3e3", @@ -961,7 +960,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 16, "padding": { "left": 8 @@ -976,7 +975,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -995,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16, "margin": { "right": 6 @@ -1014,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16, "margin": { "right": 6 @@ -1023,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#e3e3e3", "corner_radius": 6 }, "unshared_project": { @@ -1035,7 +1034,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -1054,7 +1053,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -1063,7 +1062,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#e3e3e3", "corner_radius": 6 } }, @@ -1073,7 +1072,7 @@ "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1094,7 +1093,7 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1120,16 +1119,16 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { @@ -1148,7 +1147,7 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1174,20 +1173,20 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { - "color": "#fbbdbd", + "color": "#e72727", "width": 1 }, "margin": { @@ -1202,13 +1201,13 @@ }, "match_index": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#f1f1f1", "corner_radius": 6, @@ -1235,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14, "padding": { "left": 6 diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index d26ada4fc9bc6ebab7c63255245ff003dfae0640..10439b5a0056e8f8ac6ec29e10b4094f1aae26a8 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,6 +1,6 @@ import Theme from "../themes/theme"; import chatPanel from "./chatPanel"; -import { backgroundColor, borderColor, text } from "./components"; +import { text } from "./components"; import contactsPanel from "./contactsPanel"; import editor from "./editor"; import projectPanel from "./projectPanel"; @@ -18,7 +18,6 @@ export default function app(theme: Theme): Object { workspace: workspace(theme), editor: editor(theme), projectDiagnostics: { - background: backgroundColor(theme, 300), tabIconSpacing: 4, tabIconWidth: 13, tabSummarySpacing: 10, diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index eb379ce520bfb5b53b85e5d8e28be639d598a6f9..e760ecec6a57997c48238e0fdeb16d457c2c3e69 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -38,7 +38,8 @@ export default function editor(theme: Theme) { } return { - textColor: theme.textColor.secondary.value, + // textColor: theme.syntax.primary.color, + textColor: theme.syntax.primary.color.value, background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active.value, codeActionsIndicator: iconColor(theme, "secondary"), diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index f8e0c0fcb6b00e157bf577fca2024ca286561c5d..fa05576cd2c3dd191385965c8d5ec9a1ceafc0b7 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -16,9 +16,9 @@ const backgroundColor = { }, 500: { base: colors.neutral[900], - hovered: colors.neutral[900], - active: colors.neutral[900], - focused: colors.neutral[900], + hovered: colors.neutral[850], + active: colors.neutral[800], + focused: colors.neutral[850], }, ok: { base: colors.green[600], @@ -59,7 +59,7 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[150], + primary: colors.neutral[100], secondary: colors.neutral[350], muted: colors.neutral[550], placeholder: colors.neutral[750], @@ -90,49 +90,49 @@ const player = { 1: { baseColor: colors.blue[600], cursorColor: colors.blue[600], - selectionColor: colors.blue[600], + selectionColor: colors.blue[100], borderColor: colors.blue[600], }, 2: { + baseColor: colors.lime[500], + cursorColor: colors.lime[500], + selectionColor: colors.lime[100], + borderColor: colors.lime[500], + }, + 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], - selectionColor: colors.indigo[500], + selectionColor: colors.indigo[100], borderColor: colors.indigo[500], }, - 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[500], - borderColor: colors.green[500], - }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], - selectionColor: colors.orange[500], + selectionColor: colors.orange[100], borderColor: colors.orange[500], }, 5: { baseColor: colors.purple[500], cursorColor: colors.purple[500], - selectionColor: colors.purple[500], + selectionColor: colors.purple[100], borderColor: colors.purple[500], }, 6: { baseColor: colors.teal[400], cursorColor: colors.teal[400], - selectionColor: colors.teal[400], + selectionColor: colors.teal[100], borderColor: colors.teal[400], }, 7: { baseColor: colors.pink[400], cursorColor: colors.pink[400], - selectionColor: colors.pink[400], + selectionColor: colors.pink[100], borderColor: colors.pink[400], }, 8: { baseColor: colors.yellow[400], cursorColor: colors.yellow[400], - selectionColor: colors.yellow[400], + selectionColor: colors.yellow[100], borderColor: colors.yellow[400], }, }; @@ -143,24 +143,24 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], + active: backgroundColor[500].active, + highlighted: backgroundColor[500].hovered, inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, }, highlight: { selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: colors.neutral[0], - matchingBracket: colors.neutral[0], - match: colors.neutral[0], - activeMatch: colors.neutral[0], - related: colors.neutral[0], + occurrence: colors.indigo[500], // TODO: Why does indigo[500], indigo[100], and indigo[900] all give me the same color? @kethku + activeOccurrence: colors.indigo[400], // TODO: We don't seem to be using this right now in rust + matchingBracket: backgroundColor[500].active, + match: colors.lime[500], + activeMatch: colors.lime[400], + related: backgroundColor[500].focused, }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: textColor.muted, + active: textColor.active, }, }; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index c543c78a302e3579970998ad1fb23847b1e1f694..ee94e18b19869727eae1c973d908ed3202282c77 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -61,16 +61,16 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[800], - secondary: colors.neutral[700], - muted: colors.neutral[600], - placeholder: colors.neutral[500], + primary: colors.neutral[750], + secondary: colors.neutral[600], + muted: colors.neutral[450], + placeholder: colors.neutral[300], active: colors.neutral[900], - feature: colors.blue[600], - ok: colors.green[800], - error: colors.red[800], - warning: colors.yellow[800], - info: colors.blue[800], + feature: colors.blue[500], + ok: colors.green[500], + error: colors.red[500], + warning: colors.yellow[500], + info: colors.blue[500], }; const iconColor = { @@ -94,17 +94,17 @@ const player = { borderColor: colors.blue[500], }, 2: { + baseColor: colors.lime[500], + cursorColor: colors.lime[500], + selectionColor: colors.lime[100], + borderColor: colors.lime[500], + }, + 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], selectionColor: colors.indigo[100], borderColor: colors.indigo[500], }, - 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[100], - borderColor: colors.green[500], - }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], @@ -143,8 +143,8 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], + active: backgroundColor[500].active, + highlighted: backgroundColor[500].active, inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, @@ -159,8 +159,8 @@ const editor = { related: colors.neutral[0], }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: textColor.muted, + active: textColor.active, }, }; diff --git a/styles/utils/color.ts b/styles/utils/color.ts index b59f4fa69479a1f886229afe1953284f6626f9d8..1042899c737681ddc8e074b19723ed5ba3ad0117 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -22,8 +22,8 @@ export function colorRamp( .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") - .gamma(1) - .correctLightness(true) + .gamma(0.2) + // .correctLightness(true) .padding([0, 0.15]); } From 6a7c8a69953bd0418e4244a2c15fa7665ff248c7 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 01:04:34 -0400 Subject: [PATCH 025/245] Refined dark theme styles --- crates/zed/assets/themes/dark.json | 166 ++++++++++++++-------------- crates/zed/assets/themes/light.json | 14 +-- styles/buildThemes.ts | 3 + styles/styleTree/selectorModal.ts | 8 +- styles/styleTree/workspace.ts | 4 +- styles/themes/dark.ts | 38 +++---- styles/tokens.ts | 2 +- styles/utils/color.ts | 2 +- 8 files changed, 120 insertions(+), 117 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 0abf380cc18fc7ecb252d8d062b2ff53aeb4ad7c..25568bf17c9dafaf92beb11be5e4514377f57e76 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#000000", + "background": "#1c1c1c", "corner_radius": 6, "padding": 8, "item": { @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#72ad19", + "color": "#1684b6", "weight": "bold", "size": 14 } @@ -33,19 +33,19 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#72ad19", + "color": "#1684b6", "weight": "bold", "size": 14 }, - "background": "#1c1c1c" + "background": "#2b2b2b" }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "empty": { @@ -62,7 +62,7 @@ } }, "input_editor": { - "background": "#1c1c1c", + "background": "#000000", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", @@ -75,11 +75,11 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { - "color": "#0e0e0e", + "color": "#151515", "width": 1 }, "padding": { @@ -109,8 +109,8 @@ "tab": { "height": 32, "background": "#1c1c1c", - "icon_close": "#717171", - "icon_close_active": "#f1f1f1", + "icon_close": "#555555", + "icon_close_active": "#ffffff", "icon_conflict": "#c38214", "icon_dirty": "#195cc8", "icon_width": 8, @@ -121,7 +121,7 @@ "size": 14 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true, "bottom": true, @@ -135,8 +135,8 @@ "active_tab": { "height": 32, "background": "#000000", - "icon_close": "#717171", - "icon_close_active": "#f1f1f1", + "icon_close": "#555555", + "icon_close_active": "#ffffff", "icon_conflict": "#c38214", "icon_dirty": "#195cc8", "icon_width": 8, @@ -147,7 +147,7 @@ "size": 14 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true, "bottom": false, @@ -162,22 +162,22 @@ "width": 30, "background": "#1c1c1c", "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#f1f1f1", + "icon_color": "#ffffff", "icon_size": 18 }, "resize_handle": { - "background": "#0e0e0e", + "background": "#070707", "padding": { "left": 1 } @@ -187,29 +187,29 @@ "width": 30, "background": "#1c1c1c", "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#f1f1f1", + "icon_color": "#ffffff", "icon_size": 18 }, "resize_handle": { - "background": "#0e0e0e", + "background": "#070707", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "status_bar": { @@ -238,12 +238,12 @@ "titlebar": { "avatar_width": 18, "height": 32, - "background": "#393939", - "share_icon_color": "#717171", - "share_icon_active_color": "#f1f1f1", + "background": "#2b2b2b", + "share_icon_color": "#9c9c9c", + "share_icon_active_color": "#ffffff", "title": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "avatar": { @@ -258,7 +258,7 @@ "width": 12 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "bottom": true }, @@ -281,7 +281,7 @@ } }, "offline_icon": { - "color": "#717171", + "color": "#9c9c9c", "width": 16, "padding": { "right": 4 @@ -297,7 +297,7 @@ "height": 34, "background": "#000000", "border": { - "color": "#2b2b2b", + "color": "#070707", "width": 1, "bottom": true }, @@ -325,10 +325,10 @@ } }, "editor": { - "text_color": "#e3e3e3", + "text_color": "#f1f1f1", "background": "#000000", - "active_line_background": "#1c1c1c", - "code_actions_indicator": "#717171", + "active_line_background": "#0e0e0e", + "code_actions_indicator": "#9c9c9c", "diff_background_deleted": "#d71c1c", "diff_background_inserted": "#1ea34f", "document_highlight_read_background": "#1e22db", @@ -336,7 +336,7 @@ "error_color": "#d71c1c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#0e0e0e", + "highlighted_line_background": "#070707", "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, @@ -380,7 +380,7 @@ "corner_radius": 6, "padding": 6, "border": { - "color": "#393939", + "color": "#151515", "width": 1 }, "item": { @@ -400,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#0e0e0e" + "background": "#070707" }, "margin": { "left": -14 @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#1c1c1c" + "background": "#0e0e0e" } }, "diagnostic_header": { @@ -425,7 +425,7 @@ "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#393939", + "color": "#151515", "width": 1, "bottom": true, "top": true @@ -441,7 +441,7 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14, "weight": "bold" }, @@ -453,11 +453,11 @@ } }, "diagnostic_path_header": { - "background": "#1c1c1c", + "background": "#0e0e0e", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "path": { @@ -473,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -496,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -519,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -542,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -565,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -588,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -611,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -634,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -661,7 +661,7 @@ "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "status_bar_item": { @@ -691,7 +691,7 @@ }, "hovered_entry": { "height": 22, - "background": "#1c1c1c", + "background": "#232323", "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, @@ -708,19 +708,19 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#1c1c1c", + "background": "#232323", "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 } } @@ -734,7 +734,7 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "weight": "bold", "size": 14 }, @@ -750,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": { @@ -799,13 +799,13 @@ "right": 8 } }, - "background": "#1c1c1c", + "background": "#232323", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": 4, @@ -822,7 +822,7 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": 4, @@ -834,7 +834,7 @@ "right": 8 } }, - "background": "#1c1c1c", + "background": "#232323", "corner_radius": 6 }, "menu": { @@ -842,7 +842,7 @@ "corner_radius": 6, "padding": 4, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "shadow": { @@ -863,7 +863,7 @@ }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "underline": true, "size": 14 }, @@ -883,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "weight": "bold", "size": 14, "margin": { @@ -920,7 +920,7 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "placeholder_text": { @@ -933,7 +933,7 @@ "selection": "#307af3" }, "border": { - "color": "#393939", + "color": "#151515", "width": 1 }, "padding": { @@ -952,7 +952,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#2b2b2b", + "tree_branch_color": "#232323", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -994,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16, "margin": { "right": 6 @@ -1013,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16, "margin": { "right": 6 @@ -1022,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#1c1c1c", + "background": "#0e0e0e", "corner_radius": 6 }, "unshared_project": { @@ -1062,7 +1062,7 @@ "padding": { "left": 8 }, - "background": "#1c1c1c", + "background": "#0e0e0e", "corner_radius": 6 } }, @@ -1074,10 +1074,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1095,10 +1095,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1128,11 +1128,11 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1149,10 +1149,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1182,7 +1182,7 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { @@ -1212,7 +1212,7 @@ "background": "#1c1c1c", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1234,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 1024764540e55f20505b6864ca6bdddd95881edd..76fe01501d181cdcbdea018c21357a2c65a728ab 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#ffffff", + "background": "#f1f1f1", "corner_radius": 6, "padding": 8, "item": { @@ -42,7 +42,7 @@ "weight": "bold", "size": 14 }, - "background": "#e3e3e3" + "background": "#d5d5d5" }, "border": { "color": "#c6c6c6", @@ -62,7 +62,7 @@ } }, "input_editor": { - "background": "#f1f1f1", + "background": "#ffffff", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", @@ -79,7 +79,7 @@ "size": 16 }, "border": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1 }, "padding": { @@ -109,7 +109,7 @@ "tab": { "height": 32, "background": "#f1f1f1", - "icon_close": "#717171", + "icon_close": "#555555", "icon_close_active": "#000000", "icon_conflict": "#bc9212", "icon_dirty": "#195cc8", @@ -135,7 +135,7 @@ "active_tab": { "height": 32, "background": "#ffffff", - "icon_close": "#717171", + "icon_close": "#555555", "icon_close_active": "#000000", "icon_conflict": "#bc9212", "icon_dirty": "#195cc8", @@ -297,7 +297,7 @@ "height": 34, "background": "#ffffff", "border": { - "color": "#f1f1f1", + "color": "#c6c6c6", "width": 1, "bottom": true }, diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index 9128eff45d46a0a11b9a8ddb04013b3b59faf87a..a1a07ecb2d7fa69cdb6d83c8024ec173b1e27127 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -3,6 +3,7 @@ import * as path from "path"; import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; +import { colors } from "./tokens"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; @@ -14,4 +15,6 @@ for (let theme of themes) { ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`Generated ${outPath}`); + + console.log(JSON.stringify(colors.indigo, null, 2)); } diff --git a/styles/styleTree/selectorModal.ts b/styles/styleTree/selectorModal.ts index fdebe712fa0f1650a3fe4411b4579aa30bb44e2e..47355cff116ff985ac62fd8d1665056422cfcd3c 100644 --- a/styles/styleTree/selectorModal.ts +++ b/styles/styleTree/selectorModal.ts @@ -16,12 +16,12 @@ export default function selectorModal(theme: Theme): Object { const activeItem = { ...item, - background: backgroundColor(theme, 500, "active"), + background: backgroundColor(theme, 300, "active"), text: text(theme, "sans", "primary"), }; return { - background: backgroundColor(theme, 500), + background: backgroundColor(theme, 300), cornerRadius: 6, padding: 8, item, @@ -37,12 +37,12 @@ export default function selectorModal(theme: Theme): Object { }, }, inputEditor: { - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), corner_radius: 6, placeholderText: text(theme, "sans", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), - border: border(theme, "primary"), + border: border(theme, "secondary"), padding: { bottom: 7, left: 16, diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index a734528d744c21896cb73c090b482615bb3544b3..4349ba0ab6861080a146e6d25b8be9d6af801d71 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -14,7 +14,7 @@ export default function workspace(theme: Theme) { const tab = { height: 32, background: backgroundColor(theme, 300), - iconClose: iconColor(theme, "secondary"), + iconClose: iconColor(theme, "muted"), iconCloseActive: iconColor(theme, "active"), iconConflict: iconColor(theme, "warning"), iconDirty: iconColor(theme, "info"), @@ -135,7 +135,7 @@ export default function workspace(theme: Theme) { toolbar: { height: 34, background: backgroundColor(theme, 500), - border: border(theme, "muted", { bottom: true }), + border: border(theme, "primary", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index fa05576cd2c3dd191385965c8d5ec9a1ceafc0b7..3cb3b653b4a6407d197049b0baf1ff72997b02c7 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -3,22 +3,22 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[700], - hovered: colors.neutral[700], + base: colors.neutral[750], + hovered: colors.neutral[725], active: colors.neutral[700], - focused: colors.neutral[700], + focused: colors.neutral[675], }, 300: { base: colors.neutral[800], - hovered: colors.neutral[800], - active: colors.neutral[800], - focused: colors.neutral[800], + hovered: colors.neutral[775], + active: colors.neutral[750], + focused: colors.neutral[725], }, 500: { base: colors.neutral[900], - hovered: colors.neutral[850], - active: colors.neutral[800], - focused: colors.neutral[850], + hovered: colors.neutral[875], + active: colors.neutral[850], + focused: colors.neutral[825], }, ok: { base: colors.green[600], @@ -47,11 +47,11 @@ const backgroundColor = { }; const borderColor = { - primary: colors.neutral[850], - secondary: colors.neutral[700], - muted: colors.neutral[750], - focused: colors.neutral[100], - active: colors.neutral[500], + primary: colors.neutral[875], + secondary: colors.neutral[825], + muted: colors.neutral[775], + focused: colors.neutral[500], + active: colors.neutral[900], ok: colors.green[500], error: colors.red[500], warning: colors.amber[500], @@ -59,13 +59,13 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[100], + primary: colors.neutral[50], secondary: colors.neutral[350], muted: colors.neutral[550], placeholder: colors.neutral[750], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.lime[400], + feature: colors.sky[500], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], @@ -73,11 +73,11 @@ const textColor = { }; const iconColor = { - primary: colors.neutral[300], - secondary: colors.neutral[500], + primary: colors.neutral[200], + secondary: colors.neutral[350], muted: colors.neutral[600], placeholder: colors.neutral[700], - active: colors.neutral[50], + active: colors.neutral[0], //TODO: (design) define feature and it's correct value feature: colors.sky[500], ok: colors.green[600], diff --git a/styles/tokens.ts b/styles/tokens.ts index 63c19a9d6439a77db5d1d9cd7924966e117a931a..aa865ae6943603cda17dbac9f3a4a786cdc45367 100644 --- a/styles/tokens.ts +++ b/styles/tokens.ts @@ -72,7 +72,7 @@ export interface ColorToken { step?: number, } export const colors = { - neutral: colorRamp(["white", "black"], { steps: 19, increment: 50 }), + neutral: colorRamp(["white", "black"], { steps: 37, increment: 25 }), // (900/25) + 1 rose: colorRamp("#F43F5EFF"), red: colorRamp("#EF4444FF"), orange: colorRamp("#F97316FF"), diff --git a/styles/utils/color.ts b/styles/utils/color.ts index 1042899c737681ddc8e074b19723ed5ba3ad0117..c7506f696d4cebd54ebc2045be2b7dc9d14f2c7b 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -8,7 +8,7 @@ export type ColorRamp = { export function colorRamp( color: Color | [Color, Color], - options?: { steps?: number; increment?: number } + options?: { steps?: number; increment?: number; } ): ColorRamp { let scale: Scale; if (Array.isArray(color)) { From 433c095f5139497e59c77881c789f41c8573b5ad Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 10:50:41 -0400 Subject: [PATCH 026/245] Remove leftover console.log --- styles/buildThemes.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index a1a07ecb2d7fa69cdb6d83c8024ec173b1e27127..9128eff45d46a0a11b9a8ddb04013b3b59faf87a 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -3,7 +3,6 @@ import * as path from "path"; import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; -import { colors } from "./tokens"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; @@ -15,6 +14,4 @@ for (let theme of themes) { ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`Generated ${outPath}`); - - console.log(JSON.stringify(colors.indigo, null, 2)); } From 60295af00a9d552de1bcaaca06a463e7cc05324f Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 13:30:59 -0400 Subject: [PATCH 027/245] Add basic support for exporting tokens to Figma Tokens. (#724) * WIP on figma token export * WIP Working export * Tidy up the figma tokens script * Correctly format theme json structure for Figma Tokens * Finish up themeTokens imports --- styles/buildFigmaTokens.ts | 99 ++++ styles/figma/core.json | 1155 ++++++++++++++++++++++++++++++++++++ styles/figma/dark.json | 637 ++++++++++++++++++++ styles/figma/light.json | 637 ++++++++++++++++++++ 4 files changed, 2528 insertions(+) create mode 100644 styles/buildFigmaTokens.ts create mode 100644 styles/figma/core.json create mode 100644 styles/figma/dark.json create mode 100644 styles/figma/light.json diff --git a/styles/buildFigmaTokens.ts b/styles/buildFigmaTokens.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b3285e58e24c7f0fefa67a40c512202fdbe4c5b --- /dev/null +++ b/styles/buildFigmaTokens.ts @@ -0,0 +1,99 @@ +import * as fs from "fs"; +import * as path from "path"; +import dark from "./themes/dark"; +import light from "./themes/light"; +import Theme from "./themes/theme"; +import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; + +// Organize theme tokens +function themeTokens(theme: Theme): Object { + return { + meta: { + themeName: theme.name, + }, + text: theme.textColor, + icon: theme.iconColor, + background: theme.backgroundColor, + border: theme.borderColor, + editor: theme.editor, + syntax: { + primary: { + value: theme.syntax.primary.color.value, + type: "color", + }, + comment: { + value: theme.syntax.comment.color.value, + type: "color", + }, + keyword: { + value: theme.syntax.keyword.color.value, + type: "color", + }, + function: { + value: theme.syntax.function.color.value, + type: "color", + }, + type: { + value: theme.syntax.type.color.value, + type: "color", + }, + variant: { + value: theme.syntax.variant.color.value, + type: "color", + }, + property: { + value: theme.syntax.property.color.value, + type: "color", + }, + enum: { + value: theme.syntax.enum.color.value, + type: "color", + }, + operator: { + value: theme.syntax.operator.color.value, + type: "color", + }, + string: { + value: theme.syntax.string.color.value, + type: "color", + }, + number: { + value: theme.syntax.number.color.value, + type: "color", + }, + boolean: { + value: theme.syntax.boolean.color.value, + type: "color", + }, + }, + player: theme.player, + shadowAlpha: theme.shadowAlpha, + }; +} + +let themes = [themeTokens(dark), themeTokens(light)]; + +// Create {theme}.json +const themePath = path.resolve(`${__dirname}/figma`); +themes.forEach((theme) => { + const tokenJSON = JSON.stringify(theme, null, 2); + //@ts-ignore //TODO: IDK what the hell TS wants me to do here + fs.writeFileSync(`${themePath}/${theme.meta.themeName}.json`, tokenJSON); +}); + +// Organize core tokens +const coreTokens = { + color: { + ...colors, + }, + text: { + family: fontFamilies, + weight: fontWeights, + }, + size: fontSizes, +}; + +// Create core.json +const corePath = path.resolve(`${__dirname}/figma/core.json`); +const coreTokenJSON = JSON.stringify(coreTokens, null, 2); +fs.writeFileSync(corePath, coreTokenJSON); diff --git a/styles/figma/core.json b/styles/figma/core.json new file mode 100644 index 0000000000000000000000000000000000000000..77dabe6b4e4462acc636427c388d161bb3c54a33 --- /dev/null +++ b/styles/figma/core.json @@ -0,0 +1,1155 @@ +{ + "color": { + "neutral": { + "0": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "25": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "50": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "75": { + "value": "#eaeaea", + "step": 75, + "type": "color" + }, + "100": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "125": { + "value": "#dcdcdc", + "step": 125, + "type": "color" + }, + "150": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "175": { + "value": "#cdcdcd", + "step": 175, + "type": "color" + }, + "200": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "225": { + "value": "#bfbfbf", + "step": 225, + "type": "color" + }, + "250": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "275": { + "value": "#b1b1b1", + "step": 275, + "type": "color" + }, + "300": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "325": { + "value": "#a3a3a3", + "step": 325, + "type": "color" + }, + "350": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "375": { + "value": "#959595", + "step": 375, + "type": "color" + }, + "400": { + "value": "#8e8e8e", + "step": 400, + "type": "color" + }, + "425": { + "value": "#878787", + "step": 425, + "type": "color" + }, + "450": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "475": { + "value": "#787878", + "step": 475, + "type": "color" + }, + "500": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "525": { + "value": "#6a6a6a", + "step": 525, + "type": "color" + }, + "550": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "575": { + "value": "#5c5c5c", + "step": 575, + "type": "color" + }, + "600": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "625": { + "value": "#4e4e4e", + "step": 625, + "type": "color" + }, + "650": { + "value": "#474747", + "step": 650, + "type": "color" + }, + "675": { + "value": "#404040", + "step": 675, + "type": "color" + }, + "700": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "725": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "750": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "775": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "800": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "825": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "850": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "875": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "900": { + "value": "#000000", + "step": 900, + "type": "color" + } + }, + "rose": { + "0": { + "value": "#feecef", + "step": 0, + "type": "color" + }, + "100": { + "value": "#f13455", + "step": 100, + "type": "color" + }, + "200": { + "value": "#eb2245", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e7183b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#da193a", + "step": 400, + "type": "color" + }, + "500": { + "value": "#d01939", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c81a37", + "step": 600, + "type": "color" + }, + "700": { + "value": "#c01a36", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ba1a36", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b41a35", + "step": 900, + "type": "color" + } + }, + "red": { + "0": { + "value": "#feecec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e72727", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e31c1c", + "step": 300, + "type": "color" + }, + "400": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "500": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c51c1c", + "step": 600, + "type": "color" + }, + "700": { + "value": "#be1c1c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b81c1c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21c1c", + "step": 900, + "type": "color" + } + }, + "orange": { + "0": { + "value": "#fef3ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e5660f", + "step": 200, + "type": "color" + }, + "300": { + "value": "#d66211", + "step": 300, + "type": "color" + }, + "400": { + "value": "#cc5f13", + "step": 400, + "type": "color" + }, + "500": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "600": { + "value": "#bc5a15", + "step": 600, + "type": "color" + }, + "700": { + "value": "#b65816", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b15617", + "step": 800, + "type": "color" + }, + "900": { + "value": "#ac5517", + "step": 900, + "type": "color" + } + }, + "amber": { + "0": { + "value": "#fef7ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#eb980d", + "step": 100, + "type": "color" + }, + "200": { + "value": "#d88e10", + "step": 200, + "type": "color" + }, + "300": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c38214", + "step": 400, + "type": "color" + }, + "500": { + "value": "#bb7e15", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b57a16", + "step": 600, + "type": "color" + }, + "700": { + "value": "#b07717", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ab7517", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a77218", + "step": 900, + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#fef9ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "200": { + "value": "#cfa00f", + "step": 200, + "type": "color" + }, + "300": { + "value": "#c49811", + "step": 300, + "type": "color" + }, + "400": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b68e14", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b08a15", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ac8615", + "step": 700, + "type": "color" + }, + "800": { + "value": "#a88316", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a48117", + "step": 900, + "type": "color" + } + }, + "lime": { + "0": { + "value": "#f7feec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "200": { + "value": "#7aba18", + "step": 200, + "type": "color" + }, + "300": { + "value": "#76b318", + "step": 300, + "type": "color" + }, + "400": { + "value": "#72ad19", + "step": 400, + "type": "color" + }, + "500": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "600": { + "value": "#6ea519", + "step": 600, + "type": "color" + }, + "700": { + "value": "#6ca219", + "step": 700, + "type": "color" + }, + "800": { + "value": "#6a9f1a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#699c1a", + "step": 900, + "type": "color" + } + }, + "green": { + "0": { + "value": "#ecfef2", + "step": 0, + "type": "color" + }, + "100": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "200": { + "value": "#20b557", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1faf54", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1faa52", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1da04d", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1d9d4c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d9b4b", + "step": 900, + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ecfef8", + "step": 0, + "type": "color" + }, + "100": { + "value": "#11b47e", + "step": 100, + "type": "color" + }, + "200": { + "value": "#13ac79", + "step": 200, + "type": "color" + }, + "300": { + "value": "#14a776", + "step": 300, + "type": "color" + }, + "400": { + "value": "#15a374", + "step": 400, + "type": "color" + }, + "500": { + "value": "#16a072", + "step": 500, + "type": "color" + }, + "600": { + "value": "#169d70", + "step": 600, + "type": "color" + }, + "700": { + "value": "#179b6f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#17996e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#18976c", + "step": 900, + "type": "color" + } + }, + "teal": { + "0": { + "value": "#ecfefc", + "step": 0, + "type": "color" + }, + "100": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#16ab9b", + "step": 200, + "type": "color" + }, + "300": { + "value": "#17a696", + "step": 300, + "type": "color" + }, + "400": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "500": { + "value": "#189f90", + "step": 500, + "type": "color" + }, + "600": { + "value": "#189d8e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#189a8c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#19988a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#199788", + "step": 900, + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ecfcfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#09b5cc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#0daabf", + "step": 200, + "type": "color" + }, + "300": { + "value": "#0fa3b7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#119eb1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1299ac", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1396a8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1493a4", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1590a1", + "step": 800, + "type": "color" + }, + "900": { + "value": "#168e9e", + "step": 900, + "type": "color" + } + }, + "sky": { + "0": { + "value": "#ecf8fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#109fdf", + "step": 100, + "type": "color" + }, + "200": { + "value": "#1394cf", + "step": 200, + "type": "color" + }, + "300": { + "value": "#148dc4", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1588bc", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1780b0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#177dac", + "step": 700, + "type": "color" + }, + "800": { + "value": "#187ba8", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1878a4", + "step": 900, + "type": "color" + } + }, + "blue": { + "0": { + "value": "#ecf3fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#1f6eed", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1666e7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1762db", + "step": 400, + "type": "color" + }, + "500": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1959c0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1957ba", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1a55b4", + "step": 900, + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#ececfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "200": { + "value": "#3d41e9", + "step": 200, + "type": "color" + }, + "300": { + "value": "#2e32e5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#2327e2", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1e22d1", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1e21c9", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1e21c1", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d20bb", + "step": 900, + "type": "color" + } + }, + "violet": { + "0": { + "value": "#f1ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#804ef3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#6e37ee", + "step": 200, + "type": "color" + }, + "300": { + "value": "#6329e9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#5a1ee6", + "step": 400, + "type": "color" + }, + "500": { + "value": "#551bde", + "step": 500, + "type": "color" + }, + "600": { + "value": "#531bd4", + "step": 600, + "type": "color" + }, + "700": { + "value": "#501bcb", + "step": 700, + "type": "color" + }, + "800": { + "value": "#4e1bc3", + "step": 800, + "type": "color" + }, + "900": { + "value": "#4c1bbc", + "step": 900, + "type": "color" + } + }, + "purple": { + "0": { + "value": "#f5ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#9332ee", + "step": 200, + "type": "color" + }, + "300": { + "value": "#8a24ea", + "step": 300, + "type": "color" + }, + "400": { + "value": "#831ae7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "600": { + "value": "#781ad2", + "step": 600, + "type": "color" + }, + "700": { + "value": "#741ac9", + "step": 700, + "type": "color" + }, + "800": { + "value": "#701bc2", + "step": 800, + "type": "color" + }, + "900": { + "value": "#6d1bbb", + "step": 900, + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#fdecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d63be2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#d12ade", + "step": 200, + "type": "color" + }, + "300": { + "value": "#ca23d6", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c122cc", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b921c4", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b320bd", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ad20b7", + "step": 700, + "type": "color" + }, + "800": { + "value": "#a81fb2", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a41ead", + "step": 900, + "type": "color" + } + }, + "pink": { + "0": { + "value": "#feecf5", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e42a87", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e11e7f", + "step": 300, + "type": "color" + }, + "400": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "500": { + "value": "#cc1e75", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c41e71", + "step": 600, + "type": "color" + }, + "700": { + "value": "#bd1d6d", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b71d6a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21d67", + "step": 900, + "type": "color" + } + } + }, + "text": { + "family": { + "sans": { + "value": "Zed Sans", + "type": "fontFamily" + }, + "mono": { + "value": "Zed Mono", + "type": "fontFamily" + } + }, + "weight": { + "thin": { + "value": "thin", + "type": "fontWeight" + }, + "extra_light": { + "value": "extra_light", + "type": "fontWeight" + }, + "light": { + "value": "light", + "type": "fontWeight" + }, + "normal": { + "value": "normal", + "type": "fontWeight" + }, + "medium": { + "value": "medium", + "type": "fontWeight" + }, + "semibold": { + "value": "semibold", + "type": "fontWeight" + }, + "bold": { + "value": "bold", + "type": "fontWeight" + }, + "extra_bold": { + "value": "extra_bold", + "type": "fontWeight" + }, + "black": { + "value": "black", + "type": "fontWeight" + } + } + }, + "size": { + "3xs": { + "value": 8, + "type": "fontSize" + }, + "2xs": { + "value": 10, + "type": "fontSize" + }, + "xs": { + "value": 12, + "type": "fontSize" + }, + "sm": { + "value": 14, + "type": "fontSize" + }, + "md": { + "value": 16, + "type": "fontSize" + }, + "lg": { + "value": 18, + "type": "fontSize" + }, + "xl": { + "value": 20, + "type": "fontSize" + } + } +} \ No newline at end of file diff --git a/styles/figma/dark.json b/styles/figma/dark.json new file mode 100644 index 0000000000000000000000000000000000000000..fadaf7c19e3459fb3b20cd9af5fc930a2231f010 --- /dev/null +++ b/styles/figma/dark.json @@ -0,0 +1,637 @@ +{ + "meta": { + "themeName": "dark" + }, + "text": { + "primary": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "placeholder": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "warning": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#c38214", + "step": 400, + "type": "color" + }, + "info": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "hovered": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "active": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "focused": { + "value": "#404040", + "step": 675, + "type": "color" + } + }, + "300": { + "base": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "hovered": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "active": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "focused": { + "value": "#323232", + "step": 725, + "type": "color" + } + }, + "500": { + "base": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "focused": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "hovered": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "active": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "focused": { + "value": "#1ea34f", + "step": 600, + "type": "color" + } + }, + "error": { + "base": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "hovered": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "active": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "focused": { + "value": "#d71c1c", + "step": 400, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "hovered": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "active": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "focused": { + "value": "#cc8712", + "step": 300, + "type": "color" + } + }, + "info": { + "base": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "hovered": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "active": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "focused": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "secondary": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "muted": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "ok": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#bb7e15", + "step": 500, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "indent_guide": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "indent_guide_active": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "line": { + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "highlighted": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "inserted": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "deleted": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "modified": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "activeOccurrence": { + "value": "#2327e2", + "step": 400, + "type": "color" + }, + "matchingBracket": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "match": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "activeMatch": { + "value": "#72ad19", + "step": 400, + "type": "color" + }, + "related": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#f1f1f1", + "type": "color" + }, + "comment": { + "value": "#7aba18", + "type": "color" + }, + "keyword": { + "value": "#1588bc", + "type": "color" + }, + "function": { + "value": "#cfa00f", + "type": "color" + }, + "type": { + "value": "#17a696", + "type": "color" + }, + "variant": { + "value": "#17a696", + "type": "color" + }, + "property": { + "value": "#148dc4", + "type": "color" + }, + "enum": { + "value": "#1588bc", + "type": "color" + }, + "operator": { + "value": "#1588bc", + "type": "color" + }, + "string": { + "value": "#d66211", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "selectionColor": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#70a919", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#17a293", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.32, + "type": "number" + } +} \ No newline at end of file diff --git a/styles/figma/light.json b/styles/figma/light.json new file mode 100644 index 0000000000000000000000000000000000000000..415ab40933c5be2c343b8174c95c9e9917e76675 --- /dev/null +++ b/styles/figma/light.json @@ -0,0 +1,637 @@ +{ + "meta": { + "themeName": "light" + }, + "text": { + "primary": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "secondary": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "muted": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "placeholder": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#b68e14", + "step": 500, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "secondary": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#1780b0", + "step": 600, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#c51c1c", + "step": 600, + "type": "color" + }, + "warning": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "info": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "active": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "focused": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + } + }, + "300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "500": { + "base": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "hovered": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "active": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#21bf5b", + "step": 100, + "type": "color" + } + }, + "error": { + "base": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "active": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#ec3939", + "step": 100, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "active": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + } + }, + "info": { + "base": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#307af3", + "step": 100, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "muted": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "ok": { + "value": "#20b557", + "step": 200, + "type": "color" + }, + "error": { + "value": "#e72727", + "step": 200, + "type": "color" + }, + "warning": { + "value": "#cfa00f", + "step": 200, + "type": "color" + }, + "info": { + "value": "#1f6eed", + "step": 200, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "indent_guide": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "indent_guide_active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "line": { + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "highlighted": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "inserted": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "deleted": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "modified": { + "value": "#307af3", + "step": 100, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "activeOccurrence": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "matchingBracket": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "match": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "activeMatch": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "related": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#2b2b2b", + "type": "color" + }, + "comment": { + "value": "#7aba18", + "type": "color" + }, + "keyword": { + "value": "#1588bc", + "type": "color" + }, + "function": { + "value": "#cfa00f", + "type": "color" + }, + "type": { + "value": "#17a696", + "type": "color" + }, + "variant": { + "value": "#17a696", + "type": "color" + }, + "property": { + "value": "#148dc4", + "type": "color" + }, + "enum": { + "value": "#1588bc", + "type": "color" + }, + "operator": { + "value": "#1588bc", + "type": "color" + }, + "string": { + "value": "#d66211", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#70a919", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#17a293", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.12, + "type": "number" + } +} \ No newline at end of file From d029a5c376231751e65ccb5e4e09a5a378cf3044 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 13:37:47 -0400 Subject: [PATCH 028/245] Fix incorrect ramp preset values in `color.ts` - Regenerate themes and tokens as well --- crates/zed/assets/themes/dark.json | 94 +++++----- crates/zed/assets/themes/light.json | 88 ++++----- styles/figma/core.json | 272 ++++++++++++++-------------- styles/figma/dark.json | 158 ++++++++-------- styles/figma/light.json | 150 +++++++-------- styles/utils/color.ts | 4 +- 6 files changed, 383 insertions(+), 383 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 25568bf17c9dafaf92beb11be5e4514377f57e76..da7fa4650ee609d46ce2eacf5dcf8eb4a3f8088c 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1684b6", + "color": "#2db4f3", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1684b6", + "color": "#2db4f3", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#c38214", - "icon_dirty": "#195cc8", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#c38214", - "icon_dirty": "#195cc8", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 13 } }, @@ -329,11 +329,11 @@ "background": "#000000", "active_line_background": "#0e0e0e", "code_actions_indicator": "#9c9c9c", - "diff_background_deleted": "#d71c1c", - "diff_background_inserted": "#1ea34f", - "document_highlight_read_background": "#1e22db", - "document_highlight_write_background": "#1e22db", - "error_color": "#d71c1c", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#777af4", + "document_highlight_write_background": "#777af4", + "error_color": "#f78c8c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, "highlighted_line_background": "#070707", @@ -342,37 +342,37 @@ "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "guest_selections": [ { - "cursor": "#70a919", - "selection": "#80c517" + "cursor": "#87d116", + "selection": "#dbf9ac" }, { - "cursor": "#1e22db", - "selection": "#5558ee" + "cursor": "#777af4", + "selection": "#d4d5fd" }, { - "cursor": "#c45c14", - "selection": "#f66e0f" + "cursor": "#f98a3d", + "selection": "#fde0cd" }, { - "cursor": "#7d19dc", - "selection": "#a048f4" + "cursor": "#b671f8", + "selection": "#e9d4fd" }, { - "cursor": "#17a293", - "selection": "#15b3a2" + "cursor": "#16ddc7", + "selection": "#b4faf2" }, { - "cursor": "#d51e79", - "selection": "#e93d92" + "cursor": "#f58ac0", + "selection": "#fcd4e8" }, { - "cursor": "#bc9212", - "selection": "#e0ac0b" + "cursor": "#f6bc09", + "selection": "#fceabc" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#1588bc", + "color": "#59c3f5", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#d71c1c", + "color": "#f78c8c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#d71c1c", + "color": "#f78c8c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -929,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "border": { "color": "#151515", @@ -1067,7 +1067,7 @@ } }, "search": { - "match_background": "#70a919", + "match_background": "#87d116", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1123,8 +1123,8 @@ "size": 16 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1177,8 +1177,8 @@ "size": 16 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1186,7 +1186,7 @@ "size": 16 }, "border": { - "color": "#cd1c1c", + "color": "#f47171", "width": 1 }, "margin": { diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 76fe01501d181cdcbdea018c21357a2c65a728ab..dcff3352f75703a64030db29cde7797dd038c432 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#f1f1f1", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#bc9212", - "icon_dirty": "#195cc8", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#bc9212", - "icon_dirty": "#195cc8", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 13 } }, @@ -329,11 +329,11 @@ "background": "#ffffff", "active_line_background": "#e3e3e3", "code_actions_indicator": "#717171", - "diff_background_deleted": "#ec3939", - "diff_background_inserted": "#21bf5b", + "diff_background_deleted": "#fdd4d4", + "diff_background_inserted": "#befad2", "document_highlight_read_background": "#e3e3e3", "document_highlight_write_background": "#e3e3e3", - "error_color": "#cd1c1c", + "error_color": "#f47171", "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, "highlighted_line_background": "#e3e3e3", @@ -342,37 +342,37 @@ "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "guest_selections": [ { - "cursor": "#70a919", - "selection": "#80c517" + "cursor": "#87d116", + "selection": "#dbf9ac" }, { - "cursor": "#1e22db", - "selection": "#5558ee" + "cursor": "#777af4", + "selection": "#d4d5fd" }, { - "cursor": "#c45c14", - "selection": "#f66e0f" + "cursor": "#f98a3d", + "selection": "#fde0cd" }, { - "cursor": "#7d19dc", - "selection": "#a048f4" + "cursor": "#b671f8", + "selection": "#e9d4fd" }, { - "cursor": "#17a293", - "selection": "#15b3a2" + "cursor": "#16ddc7", + "selection": "#b4faf2" }, { - "cursor": "#d51e79", - "selection": "#e93d92" + "cursor": "#f58ac0", + "selection": "#fcd4e8" }, { - "cursor": "#bc9212", - "selection": "#e0ac0b" + "cursor": "#f6bc09", + "selection": "#fceabc" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#1588bc", + "color": "#59c3f5", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#cd1c1c", + "color": "#f47171", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#cd1c1c", + "color": "#f47171", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -929,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "border": { "color": "#e3e3e3", @@ -1123,8 +1123,8 @@ "size": 16 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1177,8 +1177,8 @@ "size": 16 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1186,7 +1186,7 @@ "size": 16 }, "border": { - "color": "#e72727", + "color": "#fbbdbd", "width": 1 }, "margin": { diff --git a/styles/figma/core.json b/styles/figma/core.json index 77dabe6b4e4462acc636427c388d161bb3c54a33..b3e13f1c7a9f4e048bf7065278ebc1527c4a11cc 100644 --- a/styles/figma/core.json +++ b/styles/figma/core.json @@ -194,42 +194,42 @@ "type": "color" }, "100": { - "value": "#f13455", + "value": "#fdd5db", "step": 100, "type": "color" }, "200": { - "value": "#eb2245", + "value": "#fbbdc8", "step": 200, "type": "color" }, "300": { - "value": "#e7183b", + "value": "#faa4b3", "step": 300, "type": "color" }, "400": { - "value": "#da193a", + "value": "#f98a9d", "step": 400, "type": "color" }, "500": { - "value": "#d01939", + "value": "#f76e86", "step": 500, "type": "color" }, "600": { - "value": "#c81a37", + "value": "#f54c69", "step": 600, "type": "color" }, "700": { - "value": "#c01a36", + "value": "#ec2548", "step": 700, "type": "color" }, "800": { - "value": "#ba1a36", + "value": "#d21939", "step": 800, "type": "color" }, @@ -246,42 +246,42 @@ "type": "color" }, "100": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "200": { - "value": "#e72727", + "value": "#fbbdbd", "step": 200, "type": "color" }, "300": { - "value": "#e31c1c", + "value": "#f9a5a5", "step": 300, "type": "color" }, "400": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "500": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "600": { - "value": "#c51c1c", + "value": "#f15252", "step": 600, "type": "color" }, "700": { - "value": "#be1c1c", + "value": "#e82c2c", "step": 700, "type": "color" }, "800": { - "value": "#b81c1c", + "value": "#d11c1c", "step": 800, "type": "color" }, @@ -298,42 +298,42 @@ "type": "color" }, "100": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "200": { - "value": "#e5660f", + "value": "#fbccac", "step": 200, "type": "color" }, "300": { - "value": "#d66211", + "value": "#fab78b", "step": 300, "type": "color" }, "400": { - "value": "#cc5f13", + "value": "#faa266", "step": 400, "type": "color" }, "500": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "600": { - "value": "#bc5a15", + "value": "#f77113", "step": 600, "type": "color" }, "700": { - "value": "#b65816", + "value": "#e0650f", "step": 700, "type": "color" }, "800": { - "value": "#b15617", + "value": "#c65d14", "step": 800, "type": "color" }, @@ -350,42 +350,42 @@ "type": "color" }, "100": { - "value": "#eb980d", + "value": "#fce7c4", "step": 100, "type": "color" }, "200": { - "value": "#d88e10", + "value": "#fad69d", "step": 200, "type": "color" }, "300": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "400": { - "value": "#c38214", + "value": "#f7b241", "step": 400, "type": "color" }, "500": { - "value": "#bb7e15", + "value": "#f59f0c", "step": 500, "type": "color" }, "600": { - "value": "#b57a16", + "value": "#e1930e", "step": 600, "type": "color" }, "700": { - "value": "#b07717", + "value": "#cd8812", "step": 700, "type": "color" }, "800": { - "value": "#ab7517", + "value": "#ba7d15", "step": 800, "type": "color" }, @@ -402,42 +402,42 @@ "type": "color" }, "100": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "200": { - "value": "#cfa00f", + "value": "#fadc89", "step": 200, "type": "color" }, "300": { - "value": "#c49811", + "value": "#f8cc4e", "step": 300, "type": "color" }, "400": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "500": { - "value": "#b68e14", + "value": "#e5af09", "step": 500, "type": "color" }, "600": { - "value": "#b08a15", + "value": "#d4a30d", "step": 600, "type": "color" }, "700": { - "value": "#ac8615", + "value": "#c49811", "step": 700, "type": "color" }, "800": { - "value": "#a88316", + "value": "#b48d14", "step": 800, "type": "color" }, @@ -454,42 +454,42 @@ "type": "color" }, "100": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "200": { - "value": "#7aba18", + "value": "#bdf36b", "step": 200, "type": "color" }, "300": { - "value": "#76b318", + "value": "#9feb2b", "step": 300, "type": "color" }, "400": { - "value": "#72ad19", + "value": "#90df17", "step": 400, "type": "color" }, "500": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "600": { - "value": "#6ea519", + "value": "#7fc417", "step": 600, "type": "color" }, "700": { - "value": "#6ca219", + "value": "#78b618", "step": 700, "type": "color" }, "800": { - "value": "#6a9f1a", + "value": "#70aa19", "step": 800, "type": "color" }, @@ -506,42 +506,42 @@ "type": "color" }, "100": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "200": { - "value": "#20b557", + "value": "#8ff4b2", "step": 200, "type": "color" }, "300": { - "value": "#1faf54", + "value": "#60ec92", "step": 300, "type": "color" }, "400": { - "value": "#1faa52", + "value": "#34e173", "step": 400, "type": "color" }, "500": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "600": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "700": { - "value": "#1da04d", + "value": "#20b658", "step": 700, "type": "color" }, "800": { - "value": "#1d9d4c", + "value": "#1ea851", "step": 800, "type": "color" }, @@ -558,42 +558,42 @@ "type": "color" }, "100": { - "value": "#11b47e", + "value": "#b3fbe3", "step": 100, "type": "color" }, "200": { - "value": "#13ac79", + "value": "#72f6ca", "step": 200, "type": "color" }, "300": { - "value": "#14a776", + "value": "#1feda9", "step": 300, "type": "color" }, "400": { - "value": "#15a374", + "value": "#12e09b", "step": 400, "type": "color" }, "500": { - "value": "#16a072", + "value": "#11d091", "step": 500, "type": "color" }, "600": { - "value": "#169d70", + "value": "#11c287", "step": 600, "type": "color" }, "700": { - "value": "#179b6f", + "value": "#11b37e", "step": 700, "type": "color" }, "800": { - "value": "#17996e", + "value": "#15a575", "step": 800, "type": "color" }, @@ -610,42 +610,42 @@ "type": "color" }, "100": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "200": { - "value": "#16ab9b", + "value": "#73f4e6", "step": 200, "type": "color" }, "300": { - "value": "#17a696", + "value": "#26ebd5", "step": 300, "type": "color" }, "400": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "500": { - "value": "#189f90", + "value": "#15cfba", "step": 500, "type": "color" }, "600": { - "value": "#189d8e", + "value": "#15c1ae", "step": 600, "type": "color" }, "700": { - "value": "#189a8c", + "value": "#15b2a1", "step": 700, "type": "color" }, "800": { - "value": "#19988a", + "value": "#17a495", "step": 800, "type": "color" }, @@ -662,42 +662,42 @@ "type": "color" }, "100": { - "value": "#09b5cc", + "value": "#bcf5fc", "step": 100, "type": "color" }, "200": { - "value": "#0daabf", + "value": "#86edfa", "step": 200, "type": "color" }, "300": { - "value": "#0fa3b7", + "value": "#41e3f8", "step": 300, "type": "color" }, "400": { - "value": "#119eb1", + "value": "#07d5f1", "step": 400, "type": "color" }, "500": { - "value": "#1299ac", + "value": "#07c7e1", "step": 500, "type": "color" }, "600": { - "value": "#1396a8", + "value": "#07b8d0", "step": 600, "type": "color" }, "700": { - "value": "#1493a4", + "value": "#0daabf", "step": 700, "type": "color" }, "800": { - "value": "#1590a1", + "value": "#119bae", "step": 800, "type": "color" }, @@ -714,42 +714,42 @@ "type": "color" }, "100": { - "value": "#109fdf", + "value": "#caecfc", "step": 100, "type": "color" }, "200": { - "value": "#1394cf", + "value": "#a6defa", "step": 200, "type": "color" }, "300": { - "value": "#148dc4", + "value": "#81d2f8", "step": 300, "type": "color" }, "400": { - "value": "#1588bc", + "value": "#59c3f5", "step": 400, "type": "color" }, "500": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "600": { - "value": "#1780b0", + "value": "#0ea5e8", "step": 600, "type": "color" }, "700": { - "value": "#177dac", + "value": "#1296d1", "step": 700, "type": "color" }, "800": { - "value": "#187ba8", + "value": "#1686ba", "step": 800, "type": "color" }, @@ -766,42 +766,42 @@ "type": "color" }, "100": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "200": { - "value": "#1f6eed", + "value": "#b4cffb", "step": 200, "type": "color" }, "300": { - "value": "#1666e7", + "value": "#99befa", "step": 300, "type": "color" }, "400": { - "value": "#1762db", + "value": "#7cacf9", "step": 400, "type": "color" }, "500": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "600": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "700": { - "value": "#1959c0", + "value": "#2774f0", "step": 700, "type": "color" }, "800": { - "value": "#1957ba", + "value": "#1762db", "step": 800, "type": "color" }, @@ -818,42 +818,42 @@ "type": "color" }, "100": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "200": { - "value": "#3d41e9", + "value": "#bebefb", "step": 200, "type": "color" }, "300": { - "value": "#2e32e5", + "value": "#a7a8f9", "step": 300, "type": "color" }, "400": { - "value": "#2327e2", + "value": "#8f90f6", "step": 400, "type": "color" }, "500": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "600": { - "value": "#1e22d1", + "value": "#5f62f0", "step": 600, "type": "color" }, "700": { - "value": "#1e21c9", + "value": "#464aeb", "step": 700, "type": "color" }, "800": { - "value": "#1e21c1", + "value": "#292de4", "step": 800, "type": "color" }, @@ -870,42 +870,42 @@ "type": "color" }, "100": { - "value": "#804ef3", + "value": "#e0d5fd", "step": 100, "type": "color" }, "200": { - "value": "#6e37ee", + "value": "#cfbcfb", "step": 200, "type": "color" }, "300": { - "value": "#6329e9", + "value": "#bda4fa", "step": 300, "type": "color" }, "400": { - "value": "#5a1ee6", + "value": "#ad8cf9", "step": 400, "type": "color" }, "500": { - "value": "#551bde", + "value": "#9b73f7", "step": 500, "type": "color" }, "600": { - "value": "#531bd4", + "value": "#8959f6", "step": 600, "type": "color" }, "700": { - "value": "#501bcb", + "value": "#7540f0", "step": 700, "type": "color" }, "800": { - "value": "#4e1bc3", + "value": "#5e22e7", "step": 800, "type": "color" }, @@ -922,42 +922,42 @@ "type": "color" }, "100": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "200": { - "value": "#9332ee", + "value": "#dcbcfc", "step": 200, "type": "color" }, "300": { - "value": "#8a24ea", + "value": "#d0a4fa", "step": 300, "type": "color" }, "400": { - "value": "#831ae7", + "value": "#c38bf9", "step": 400, "type": "color" }, "500": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "600": { - "value": "#781ad2", + "value": "#a856f7", "step": 600, "type": "color" }, "700": { - "value": "#741ac9", + "value": "#9739f1", "step": 700, "type": "color" }, "800": { - "value": "#701bc2", + "value": "#831ae6", "step": 800, "type": "color" }, @@ -974,42 +974,42 @@ "type": "color" }, "100": { - "value": "#d63be2", + "value": "#fad4fc", "step": 100, "type": "color" }, "200": { - "value": "#d12ade", + "value": "#f6bbfa", "step": 200, "type": "color" }, "300": { - "value": "#ca23d6", + "value": "#f1a2f7", "step": 300, "type": "color" }, "400": { - "value": "#c122cc", + "value": "#ec8af3", "step": 400, "type": "color" }, "500": { - "value": "#b921c4", + "value": "#e56fee", "step": 500, "type": "color" }, "600": { - "value": "#b320bd", + "value": "#dd51e7", "step": 600, "type": "color" }, "700": { - "value": "#ad20b7", + "value": "#d32edf", "step": 700, "type": "color" }, "800": { - "value": "#a81fb2", + "value": "#bc21c8", "step": 800, "type": "color" }, @@ -1026,42 +1026,42 @@ "type": "color" }, "100": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "200": { - "value": "#e42a87", + "value": "#fbbcdb", "step": 200, "type": "color" }, "300": { - "value": "#e11e7f", + "value": "#f8a5ce", "step": 300, "type": "color" }, "400": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "500": { - "value": "#cc1e75", + "value": "#f26fb0", "step": 500, "type": "color" }, "600": { - "value": "#c41e71", + "value": "#ee519e", "step": 600, "type": "color" }, "700": { - "value": "#bd1d6d", + "value": "#e52e89", "step": 700, "type": "color" }, "800": { - "value": "#b71d6a", + "value": "#ce1e76", "step": 800, "type": "color" }, diff --git a/styles/figma/dark.json b/styles/figma/dark.json index fadaf7c19e3459fb3b20cd9af5fc930a2231f010..568f53b8154003fb1805de4c2ae420f0f2a94e89 100644 --- a/styles/figma/dark.json +++ b/styles/figma/dark.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "warning": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#c38214", + "value": "#f7b241", "step": 400, "type": "color" }, "info": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } @@ -175,88 +175,88 @@ }, "ok": { "base": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "hovered": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "active": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "focused": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" } }, "error": { "base": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "hovered": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "active": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "focused": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" } }, "warning": { "base": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "hovered": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "active": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "focused": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" } }, "info": { "base": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "hovered": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "active": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "focused": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#bb7e15", + "value": "#f59f0c", "step": 500, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -337,34 +337,34 @@ "type": "color" }, "inserted": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "deleted": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "modified": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } }, "highlight": { "selection": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "occurrence": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "activeOccurrence": { - "value": "#2327e2", + "value": "#8f90f6", "step": 400, "type": "color" }, @@ -374,12 +374,12 @@ "type": "color" }, "match": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "activeMatch": { - "value": "#72ad19", + "value": "#90df17", "step": 400, "type": "color" }, @@ -408,39 +408,39 @@ "type": "color" }, "comment": { - "value": "#7aba18", + "value": "#bdf36b", "type": "color" }, "keyword": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "function": { - "value": "#cfa00f", + "value": "#fadc89", "type": "color" }, "type": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "variant": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "property": { - "value": "#148dc4", + "value": "#81d2f8", "type": "color" }, "enum": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "operator": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "string": { - "value": "#d66211", + "value": "#fab78b", "type": "color" }, "number": { @@ -455,176 +455,176 @@ "player": { "1": { "baseColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "cursorColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "selectionColor": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } }, "2": { "baseColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "cursorColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "selectionColor": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "borderColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "cursorColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "selectionColor": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "cursorColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "selectionColor": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "borderColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "cursorColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "selectionColor": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "cursorColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "selectionColor": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "cursorColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "borderColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "cursorColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "borderColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" } diff --git a/styles/figma/light.json b/styles/figma/light.json index 415ab40933c5be2c343b8174c95c9e9917e76675..c8ef9e5dcd69332fc33abda730f08b7f7190d574 100644 --- a/styles/figma/light.json +++ b/styles/figma/light.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "ok": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#b68e14", + "value": "#e5af09", "step": 500, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#1780b0", + "value": "#0ea5e8", "step": 600, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#c51c1c", + "value": "#f15252", "step": 600, "type": "color" }, "warning": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "info": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } @@ -175,88 +175,88 @@ }, "ok": { "base": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "hovered": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "active": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "focused": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" } }, "error": { "base": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "hovered": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "active": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "focused": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" } }, "warning": { "base": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "hovered": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "active": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "focused": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" } }, "info": { "base": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "hovered": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "active": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "focused": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#20b557", + "value": "#8ff4b2", "step": 200, "type": "color" }, "error": { - "value": "#e72727", + "value": "#fbbdbd", "step": 200, "type": "color" }, "warning": { - "value": "#cfa00f", + "value": "#fadc89", "step": 200, "type": "color" }, "info": { - "value": "#1f6eed", + "value": "#b4cffb", "step": 200, "type": "color" } @@ -337,24 +337,24 @@ "type": "color" }, "inserted": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "deleted": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "modified": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" } }, "highlight": { "selection": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, @@ -408,39 +408,39 @@ "type": "color" }, "comment": { - "value": "#7aba18", + "value": "#bdf36b", "type": "color" }, "keyword": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "function": { - "value": "#cfa00f", + "value": "#fadc89", "type": "color" }, "type": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "variant": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "property": { - "value": "#148dc4", + "value": "#81d2f8", "type": "color" }, "enum": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "operator": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "string": { - "value": "#d66211", + "value": "#fab78b", "type": "color" }, "number": { @@ -455,176 +455,176 @@ "player": { "1": { "baseColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "cursorColor": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "selectionColor": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "cursorColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "selectionColor": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "borderColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "cursorColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "selectionColor": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "cursorColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "selectionColor": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "borderColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "cursorColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "selectionColor": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "cursorColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "selectionColor": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "cursorColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "borderColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "cursorColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "borderColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" } diff --git a/styles/utils/color.ts b/styles/utils/color.ts index c7506f696d4cebd54ebc2045be2b7dc9d14f2c7b..156fc5ba41b2bbf0cfc9dd8080db9bf6cd6c320d 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -22,8 +22,8 @@ export function colorRamp( .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") - .gamma(0.2) - // .correctLightness(true) + .gamma(1) + .correctLightness(true) .padding([0, 0.15]); } From 2d51b103d2c1b25c6d848ff98625dccacf09684c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 15:03:38 -0400 Subject: [PATCH 029/245] Add a combined `tokens.json` for Figma Tokens - Having individual json files for themes and core is useful for copy+pasting while exploring changes - Figma github sync requires a single json file to pull down --- styles/buildFigmaTokens.ts | 42 +- styles/figma/tokens.json | 2431 ++++++++++++++++++++++++++++++++++++ 2 files changed, 2460 insertions(+), 13 deletions(-) create mode 100644 styles/figma/tokens.json diff --git a/styles/buildFigmaTokens.ts b/styles/buildFigmaTokens.ts index 6b3285e58e24c7f0fefa67a40c512202fdbe4c5b..bb77046e85c53007c272ac791e104b9a908fd80d 100644 --- a/styles/buildFigmaTokens.ts +++ b/styles/buildFigmaTokens.ts @@ -5,8 +5,13 @@ import light from "./themes/light"; import Theme from "./themes/theme"; import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; +let themes = [ + dark, + light +]; + // Organize theme tokens -function themeTokens(theme: Theme): Object { +function themeTokens(theme: Theme) { return { meta: { themeName: theme.name, @@ -71,16 +76,6 @@ function themeTokens(theme: Theme): Object { }; } -let themes = [themeTokens(dark), themeTokens(light)]; - -// Create {theme}.json -const themePath = path.resolve(`${__dirname}/figma`); -themes.forEach((theme) => { - const tokenJSON = JSON.stringify(theme, null, 2); - //@ts-ignore //TODO: IDK what the hell TS wants me to do here - fs.writeFileSync(`${themePath}/${theme.meta.themeName}.json`, tokenJSON); -}); - // Organize core tokens const coreTokens = { color: { @@ -93,7 +88,28 @@ const coreTokens = { size: fontSizes, }; +const combinedTokens = { + core: coreTokens, + dark: themeTokens(dark), + light: themeTokens(light) +} + // Create core.json const corePath = path.resolve(`${__dirname}/figma/core.json`); -const coreTokenJSON = JSON.stringify(coreTokens, null, 2); -fs.writeFileSync(corePath, coreTokenJSON); +const coreJSON = JSON.stringify(coreTokens, null, 2); +fs.writeFileSync(corePath, coreJSON); +console.log(`- Core: core.json created`); + +// Create {theme}.json +const themePath = path.resolve(`${__dirname}/figma`); +themes.forEach((theme) => { + const tokenJSON = JSON.stringify(themeTokens(theme), null, 2); + fs.writeFileSync(`${themePath}/${theme.name}.json`, tokenJSON); + console.log(`- Theme: ${theme.name}.json created`); +}); + +// Create combined tokens.json +const combinedPath = path.resolve(`${__dirname}/figma/tokens.json`); +const combinedJSON = JSON.stringify(combinedTokens, null, 2); +fs.writeFileSync(combinedPath, combinedJSON); +console.log(`- Combined: tokens.json created`); \ No newline at end of file diff --git a/styles/figma/tokens.json b/styles/figma/tokens.json new file mode 100644 index 0000000000000000000000000000000000000000..cffc3ed16de7a4dec1fa38fa2026243c81629055 --- /dev/null +++ b/styles/figma/tokens.json @@ -0,0 +1,2431 @@ +{ + "core": { + "color": { + "neutral": { + "0": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "25": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "50": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "75": { + "value": "#eaeaea", + "step": 75, + "type": "color" + }, + "100": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "125": { + "value": "#dcdcdc", + "step": 125, + "type": "color" + }, + "150": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "175": { + "value": "#cdcdcd", + "step": 175, + "type": "color" + }, + "200": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "225": { + "value": "#bfbfbf", + "step": 225, + "type": "color" + }, + "250": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "275": { + "value": "#b1b1b1", + "step": 275, + "type": "color" + }, + "300": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "325": { + "value": "#a3a3a3", + "step": 325, + "type": "color" + }, + "350": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "375": { + "value": "#959595", + "step": 375, + "type": "color" + }, + "400": { + "value": "#8e8e8e", + "step": 400, + "type": "color" + }, + "425": { + "value": "#878787", + "step": 425, + "type": "color" + }, + "450": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "475": { + "value": "#787878", + "step": 475, + "type": "color" + }, + "500": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "525": { + "value": "#6a6a6a", + "step": 525, + "type": "color" + }, + "550": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "575": { + "value": "#5c5c5c", + "step": 575, + "type": "color" + }, + "600": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "625": { + "value": "#4e4e4e", + "step": 625, + "type": "color" + }, + "650": { + "value": "#474747", + "step": 650, + "type": "color" + }, + "675": { + "value": "#404040", + "step": 675, + "type": "color" + }, + "700": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "725": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "750": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "775": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "800": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "825": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "850": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "875": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "900": { + "value": "#000000", + "step": 900, + "type": "color" + } + }, + "rose": { + "0": { + "value": "#feecef", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fdd5db", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbdc8", + "step": 200, + "type": "color" + }, + "300": { + "value": "#faa4b3", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f98a9d", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f76e86", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f54c69", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ec2548", + "step": 700, + "type": "color" + }, + "800": { + "value": "#d21939", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b41a35", + "step": 900, + "type": "color" + } + }, + "red": { + "0": { + "value": "#feecec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbdbd", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f9a5a5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f15252", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e82c2c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#d11c1c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21c1c", + "step": 900, + "type": "color" + } + }, + "orange": { + "0": { + "value": "#fef3ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbccac", + "step": 200, + "type": "color" + }, + "300": { + "value": "#fab78b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#faa266", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f77113", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e0650f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#c65d14", + "step": 800, + "type": "color" + }, + "900": { + "value": "#ac5517", + "step": 900, + "type": "color" + } + }, + "amber": { + "0": { + "value": "#fef7ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fce7c4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fad69d", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f7b241", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f59f0c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#e1930e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#cd8812", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ba7d15", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a77218", + "step": 900, + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#fef9ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fadc89", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8cc4e", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "500": { + "value": "#e5af09", + "step": 500, + "type": "color" + }, + "600": { + "value": "#d4a30d", + "step": 600, + "type": "color" + }, + "700": { + "value": "#c49811", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b48d14", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a48117", + "step": 900, + "type": "color" + } + }, + "lime": { + "0": { + "value": "#f7feec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "200": { + "value": "#bdf36b", + "step": 200, + "type": "color" + }, + "300": { + "value": "#9feb2b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#90df17", + "step": 400, + "type": "color" + }, + "500": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "600": { + "value": "#7fc417", + "step": 600, + "type": "color" + }, + "700": { + "value": "#78b618", + "step": 700, + "type": "color" + }, + "800": { + "value": "#70aa19", + "step": 800, + "type": "color" + }, + "900": { + "value": "#699c1a", + "step": 900, + "type": "color" + } + }, + "green": { + "0": { + "value": "#ecfef2", + "step": 0, + "type": "color" + }, + "100": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#8ff4b2", + "step": 200, + "type": "color" + }, + "300": { + "value": "#60ec92", + "step": 300, + "type": "color" + }, + "400": { + "value": "#34e173", + "step": 400, + "type": "color" + }, + "500": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "600": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#20b658", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1ea851", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d9b4b", + "step": 900, + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ecfef8", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b3fbe3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#72f6ca", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1feda9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#12e09b", + "step": 400, + "type": "color" + }, + "500": { + "value": "#11d091", + "step": 500, + "type": "color" + }, + "600": { + "value": "#11c287", + "step": 600, + "type": "color" + }, + "700": { + "value": "#11b37e", + "step": 700, + "type": "color" + }, + "800": { + "value": "#15a575", + "step": 800, + "type": "color" + }, + "900": { + "value": "#18976c", + "step": 900, + "type": "color" + } + }, + "teal": { + "0": { + "value": "#ecfefc", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#73f4e6", + "step": 200, + "type": "color" + }, + "300": { + "value": "#26ebd5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#15cfba", + "step": 500, + "type": "color" + }, + "600": { + "value": "#15c1ae", + "step": 600, + "type": "color" + }, + "700": { + "value": "#15b2a1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#17a495", + "step": 800, + "type": "color" + }, + "900": { + "value": "#199788", + "step": 900, + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ecfcfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#bcf5fc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#86edfa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#41e3f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#07d5f1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#07c7e1", + "step": 500, + "type": "color" + }, + "600": { + "value": "#07b8d0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#0daabf", + "step": 700, + "type": "color" + }, + "800": { + "value": "#119bae", + "step": 800, + "type": "color" + }, + "900": { + "value": "#168e9e", + "step": 900, + "type": "color" + } + }, + "sky": { + "0": { + "value": "#ecf8fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#caecfc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#a6defa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#81d2f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#59c3f5", + "step": 400, + "type": "color" + }, + "500": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "600": { + "value": "#0ea5e8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1296d1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1686ba", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1878a4", + "step": 900, + "type": "color" + } + }, + "blue": { + "0": { + "value": "#ecf3fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#b4cffb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#99befa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#7cacf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "600": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "700": { + "value": "#2774f0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1762db", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1a55b4", + "step": 900, + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#ececfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#bebefb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#a7a8f9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#8f90f6", + "step": 400, + "type": "color" + }, + "500": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "600": { + "value": "#5f62f0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#464aeb", + "step": 700, + "type": "color" + }, + "800": { + "value": "#292de4", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d20bb", + "step": 900, + "type": "color" + } + }, + "violet": { + "0": { + "value": "#f1ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e0d5fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#cfbcfb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#bda4fa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#ad8cf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#9b73f7", + "step": 500, + "type": "color" + }, + "600": { + "value": "#8959f6", + "step": 600, + "type": "color" + }, + "700": { + "value": "#7540f0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#5e22e7", + "step": 800, + "type": "color" + }, + "900": { + "value": "#4c1bbc", + "step": 900, + "type": "color" + } + }, + "purple": { + "0": { + "value": "#f5ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#dcbcfc", + "step": 200, + "type": "color" + }, + "300": { + "value": "#d0a4fa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c38bf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "600": { + "value": "#a856f7", + "step": 600, + "type": "color" + }, + "700": { + "value": "#9739f1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#831ae6", + "step": 800, + "type": "color" + }, + "900": { + "value": "#6d1bbb", + "step": 900, + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#fdecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fad4fc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f6bbfa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f1a2f7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#ec8af3", + "step": 400, + "type": "color" + }, + "500": { + "value": "#e56fee", + "step": 500, + "type": "color" + }, + "600": { + "value": "#dd51e7", + "step": 600, + "type": "color" + }, + "700": { + "value": "#d32edf", + "step": 700, + "type": "color" + }, + "800": { + "value": "#bc21c8", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a41ead", + "step": 900, + "type": "color" + } + }, + "pink": { + "0": { + "value": "#feecf5", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbcdb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8a5ce", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f26fb0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#ee519e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e52e89", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ce1e76", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21d67", + "step": 900, + "type": "color" + } + } + }, + "text": { + "family": { + "sans": { + "value": "Zed Sans", + "type": "fontFamily" + }, + "mono": { + "value": "Zed Mono", + "type": "fontFamily" + } + }, + "weight": { + "thin": { + "value": "thin", + "type": "fontWeight" + }, + "extra_light": { + "value": "extra_light", + "type": "fontWeight" + }, + "light": { + "value": "light", + "type": "fontWeight" + }, + "normal": { + "value": "normal", + "type": "fontWeight" + }, + "medium": { + "value": "medium", + "type": "fontWeight" + }, + "semibold": { + "value": "semibold", + "type": "fontWeight" + }, + "bold": { + "value": "bold", + "type": "fontWeight" + }, + "extra_bold": { + "value": "extra_bold", + "type": "fontWeight" + }, + "black": { + "value": "black", + "type": "fontWeight" + } + } + }, + "size": { + "3xs": { + "value": 8, + "type": "fontSize" + }, + "2xs": { + "value": 10, + "type": "fontSize" + }, + "xs": { + "value": 12, + "type": "fontSize" + }, + "sm": { + "value": 14, + "type": "fontSize" + }, + "md": { + "value": 16, + "type": "fontSize" + }, + "lg": { + "value": 18, + "type": "fontSize" + }, + "xl": { + "value": 20, + "type": "fontSize" + } + } + }, + "dark": { + "meta": { + "themeName": "dark" + }, + "text": { + "primary": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "placeholder": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "warning": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#f7b241", + "step": 400, + "type": "color" + }, + "info": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "hovered": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "active": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "focused": { + "value": "#404040", + "step": 675, + "type": "color" + } + }, + "300": { + "base": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "hovered": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "active": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "focused": { + "value": "#323232", + "step": 725, + "type": "color" + } + }, + "500": { + "base": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "focused": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "hovered": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "active": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "focused": { + "value": "#22c55e", + "step": 600, + "type": "color" + } + }, + "error": { + "base": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "hovered": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "active": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "focused": { + "value": "#f78c8c", + "step": 400, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "hovered": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "active": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "focused": { + "value": "#f8c570", + "step": 300, + "type": "color" + } + }, + "info": { + "base": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "hovered": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "active": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "focused": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "secondary": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "muted": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "ok": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#f59f0c", + "step": 500, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "indent_guide": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "indent_guide_active": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "line": { + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "highlighted": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "inserted": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "deleted": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "modified": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "activeOccurrence": { + "value": "#8f90f6", + "step": 400, + "type": "color" + }, + "matchingBracket": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "match": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "activeMatch": { + "value": "#90df17", + "step": 400, + "type": "color" + }, + "related": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#f1f1f1", + "type": "color" + }, + "comment": { + "value": "#bdf36b", + "type": "color" + }, + "keyword": { + "value": "#59c3f5", + "type": "color" + }, + "function": { + "value": "#fadc89", + "type": "color" + }, + "type": { + "value": "#26ebd5", + "type": "color" + }, + "variant": { + "value": "#26ebd5", + "type": "color" + }, + "property": { + "value": "#81d2f8", + "type": "color" + }, + "enum": { + "value": "#59c3f5", + "type": "color" + }, + "operator": { + "value": "#59c3f5", + "type": "color" + }, + "string": { + "value": "#fab78b", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "selectionColor": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#87d116", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#777af4", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.32, + "type": "number" + } + }, + "light": { + "meta": { + "themeName": "light" + }, + "text": { + "primary": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "secondary": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "muted": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "placeholder": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#e5af09", + "step": 500, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "secondary": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#0ea5e8", + "step": 600, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f15252", + "step": 600, + "type": "color" + }, + "warning": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "info": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "active": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "focused": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + } + }, + "300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "500": { + "base": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "hovered": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "active": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#befad2", + "step": 100, + "type": "color" + } + }, + "error": { + "base": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "active": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "active": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#fceabc", + "step": 100, + "type": "color" + } + }, + "info": { + "base": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "muted": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "ok": { + "value": "#8ff4b2", + "step": 200, + "type": "color" + }, + "error": { + "value": "#fbbdbd", + "step": 200, + "type": "color" + }, + "warning": { + "value": "#fadc89", + "step": 200, + "type": "color" + }, + "info": { + "value": "#b4cffb", + "step": 200, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "indent_guide": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "indent_guide_active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "line": { + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "highlighted": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "inserted": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "deleted": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "modified": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "activeOccurrence": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "matchingBracket": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "match": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "activeMatch": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "related": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#2b2b2b", + "type": "color" + }, + "comment": { + "value": "#bdf36b", + "type": "color" + }, + "keyword": { + "value": "#59c3f5", + "type": "color" + }, + "function": { + "value": "#fadc89", + "type": "color" + }, + "type": { + "value": "#26ebd5", + "type": "color" + }, + "variant": { + "value": "#26ebd5", + "type": "color" + }, + "property": { + "value": "#81d2f8", + "type": "color" + }, + "enum": { + "value": "#59c3f5", + "type": "color" + }, + "operator": { + "value": "#59c3f5", + "type": "color" + }, + "string": { + "value": "#fab78b", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#87d116", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#777af4", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.12, + "type": "number" + } + } +} \ No newline at end of file From b6f85e4895d79bb94cb2b6a2bd0333df4a6c5d77 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 21:15:14 -0400 Subject: [PATCH 030/245] Update dark, light themes. --- crates/zed/assets/themes/dark.json | 130 +++++++++++++++---------- crates/zed/assets/themes/light.json | 142 +++++++++++++++++----------- styles/styleTree/editor.ts | 20 +++- styles/styleTree/workspace.ts | 2 +- styles/themes/dark.ts | 48 +++++----- styles/themes/light.ts | 38 ++++---- styles/utils/color.ts | 6 +- 7 files changed, 228 insertions(+), 158 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index da7fa4650ee609d46ce2eacf5dcf8eb4a3f8088c..1334a65727f8d099b5bc363fd0e432ef828808ba 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#1096d3", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#1096d3", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#f6a724", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#f6a724", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 13 } }, @@ -297,7 +297,7 @@ "height": 34, "background": "#000000", "border": { - "color": "#070707", + "color": "#151515", "width": 1, "bottom": true }, @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#f1f1f1", + "text_color": "#d5d5d5", "background": "#000000", "active_line_background": "#0e0e0e", "code_actions_indicator": "#9c9c9c", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#777af4", - "document_highlight_write_background": "#777af4", - "error_color": "#f78c8c", + "diff_background_deleted": "#f15656", + "diff_background_inserted": "#1b9447", + "document_highlight_read_background": "#2b2b2b", + "document_highlight_write_background": "#2b2b2b", + "error_color": "#f15656", "gutter_background": "#000000", - "gutter_padding_factor": 2.5, + "gutter_padding_factor": 3.5, "highlighted_line_background": "#070707", "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "guest_selections": [ { - "cursor": "#87d116", - "selection": "#dbf9ac" + "cursor": "#79ba16", + "selection": "#38530f" }, { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#484bed", + "selection": "#121269" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#ee670a", + "selection": "#5d2f0e" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#993bf3", + "selection": "#3e1169" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#16d6c1", + "selection": "#0e4f48" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#ef59a3", + "selection": "#fbc6e1" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#f7bf17", + "selection": "#fce9b7" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#4f8ff7", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#f15656", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#f15656", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -653,7 +653,35 @@ } } }, - "syntax": {} + "syntax": { + "keyword": "#4f8ff7", + "function": "#f9da82", + "string": "#f99d5f", + "type": "#3eeeda", + "number": "#aeef4b", + "comment": "#aaaaaa", + "property": "#4f8ff7", + "variant": "#53c1f5", + "constant": "#d5d5d5", + "title": { + "color": "#de900c", + "weight": "bold" + }, + "emphasis": "#1096d3", + "emphasis_strong": { + "color": "#1096d3", + "weight": "bold" + }, + "link_uri": { + "color": "#79ba16", + "underline": true + }, + "link_text": { + "color": "#ee670a", + "italic": true + }, + "list_marker": "#20b0f2" + } }, "project_diagnostics": { "tab_icon_spacing": 4, @@ -929,8 +957,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "border": { "color": "#151515", @@ -1067,7 +1095,7 @@ } }, "search": { - "match_background": "#87d116", + "match_background": "#0a2633", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1123,8 +1151,8 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -1177,8 +1205,8 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -1186,7 +1214,7 @@ "size": 16 }, "border": { - "color": "#f47171", + "color": "#eb2d2d", "width": 1 }, "margin": { diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index dcff3352f75703a64030db29cde7797dd038c432..283b3b10b32e3886fe15736e8e6d9cbb7091e3a5 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#f1f1f1", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#f7bf17", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#f7bf17", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 13 } }, @@ -297,7 +297,7 @@ "height": 34, "background": "#ffffff", "border": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1, "bottom": true }, @@ -327,52 +327,52 @@ "editor": { "text_color": "#2b2b2b", "background": "#ffffff", - "active_line_background": "#e3e3e3", + "active_line_background": "#f1f1f1", "code_actions_indicator": "#717171", - "diff_background_deleted": "#fdd4d4", - "diff_background_inserted": "#befad2", - "document_highlight_read_background": "#e3e3e3", - "document_highlight_write_background": "#e3e3e3", - "error_color": "#f47171", + "diff_background_deleted": "#fcc6c6", + "diff_background_inserted": "#b7f9ce", + "document_highlight_read_background": "#f1f1f1", + "document_highlight_write_background": "#f1f1f1", + "error_color": "#eb2d2d", "gutter_background": "#ffffff", - "gutter_padding_factor": 2.5, - "highlighted_line_background": "#e3e3e3", - "line_number": "#808080", + "gutter_padding_factor": 3.5, + "highlighted_line_background": "#f1f1f1", + "line_number": "#aaaaaa", "line_number_active": "#000000", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "guest_selections": [ { - "cursor": "#87d116", - "selection": "#dbf9ac" + "cursor": "#79ba16", + "selection": "#dffab5" }, { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#484bed", + "selection": "#cdcdfc" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#ee670a", + "selection": "#fcd6bd" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#993bf3", + "selection": "#e4cbfc" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#16d6c1", + "selection": "#b1faf2" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#ef59a3", + "selection": "#fbc6e1" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#f7bf17", + "selection": "#fce9b7" } ], "autocomplete": { @@ -400,13 +400,13 @@ "right": 6, "top": 2 }, - "background": "#f1f1f1" + "background": "#f8f8f8" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#103063", "weight": "normal" }, "selected_item": { @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#e3e3e3" + "background": "#f1f1f1" } }, "diagnostic_header": { @@ -453,7 +453,7 @@ } }, "diagnostic_path_header": { - "background": "#e3e3e3", + "background": "#f1f1f1", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f47171", + "color": "#eb2d2d", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f47171", + "color": "#eb2d2d", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -653,7 +653,35 @@ } } }, - "syntax": {} + "syntax": { + "keyword": "#103063", + "function": "#1b9447", + "string": "#bb550e", + "type": "#138a7d", + "number": "#14a898", + "comment": "#555555", + "property": "#134697", + "variant": "#1179a8", + "constant": "#393939", + "title": { + "color": "#1096d3", + "weight": "bold" + }, + "emphasis": "#2472f2", + "emphasis_strong": { + "color": "#2472f2", + "weight": "bold" + }, + "link_uri": { + "color": "#14a898", + "underline": true + }, + "link_text": { + "color": "#ee670a", + "italic": true + }, + "list_marker": "#20b0f2" + } }, "project_diagnostics": { "tab_icon_spacing": 4, @@ -929,8 +957,8 @@ "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "border": { "color": "#e3e3e3", @@ -1022,7 +1050,7 @@ "padding": { "left": 8 }, - "background": "#e3e3e3", + "background": "#f1f1f1", "corner_radius": 6 }, "unshared_project": { @@ -1062,7 +1090,7 @@ "padding": { "left": 8 }, - "background": "#e3e3e3", + "background": "#f1f1f1", "corner_radius": 6 } }, @@ -1123,8 +1151,8 @@ "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -1177,8 +1205,8 @@ "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -1186,7 +1214,7 @@ "size": 16 }, "border": { - "color": "#fbbdbd", + "color": "#f9a0a0", "width": 1 }, "margin": { diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index e760ecec6a57997c48238e0fdeb16d457c2c3e69..23c1e67ac6e6c1dcc75e1d638e760184bfc66e0f 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -49,7 +49,7 @@ export default function editor(theme: Theme) { documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, errorColor: theme.textColor.error.value, gutterBackground: backgroundColor(theme, 500), - gutterPaddingFactor: 2.5, + gutterPaddingFactor: 3.5, highlightedLineBackground: theme.editor.line.highlighted.value, lineNumber: theme.editor.gutter.primary.value, lineNumberActive: theme.editor.gutter.active.value, @@ -129,7 +129,21 @@ export default function editor(theme: Theme) { invalidInformationDiagnostic: diagnostic(theme, "muted"), invalidWarningDiagnostic: diagnostic(theme, "muted"), syntax: { - - } + keyword: theme.syntax.keyword.color.value, + function: theme.syntax.function.color.value, + string: theme.syntax.string.color.value, + type: theme.syntax.type.color.value, + number: theme.syntax.number.color.value, + comment: theme.syntax.comment.color.value, + property: theme.syntax.property.color.value, + variant: theme.syntax.variant.color.value, + constant: theme.syntax.constant.color.value, + title: { color: theme.syntax.title.color.value, weight: "bold" }, + emphasis: theme.textColor.feature.value, + "emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" }, + link_uri: { color: theme.syntax.linkUrl.color.value, underline: true }, + link_text: { color: theme.syntax.linkText.color.value, italic: true }, + list_marker: theme.syntax.listMarker.color.value, + }, }; } diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 4349ba0ab6861080a146e6d25b8be9d6af801d71..030f8edc95e758b574b2df7378acc1bbf498ad3f 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -135,7 +135,7 @@ export default function workspace(theme: Theme) { toolbar: { height: 34, background: backgroundColor(theme, 500), - border: border(theme, "primary", { bottom: true }), + border: border(theme, "secondary", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 3cb3b653b4a6407d197049b0baf1ff72997b02c7..3351d3d3fab34f33e033eb610f701555da34f4b2 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -88,39 +88,39 @@ const iconColor = { const player = { 1: { - baseColor: colors.blue[600], - cursorColor: colors.blue[600], - selectionColor: colors.blue[100], - borderColor: colors.blue[600], + baseColor: colors.blue[500], + cursorColor: colors.blue[500], + selectionColor: colors.blue[800], + borderColor: colors.blue[800], }, 2: { baseColor: colors.lime[500], cursorColor: colors.lime[500], - selectionColor: colors.lime[100], + selectionColor: colors.lime[800], borderColor: colors.lime[500], }, 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], - selectionColor: colors.indigo[100], + selectionColor: colors.indigo[800], borderColor: colors.indigo[500], }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], - selectionColor: colors.orange[100], + selectionColor: colors.orange[800], borderColor: colors.orange[500], }, 5: { baseColor: colors.purple[500], cursorColor: colors.purple[500], - selectionColor: colors.purple[100], + selectionColor: colors.purple[800], borderColor: colors.purple[500], }, 6: { baseColor: colors.teal[400], cursorColor: colors.teal[400], - selectionColor: colors.teal[100], + selectionColor: colors.teal[800], borderColor: colors.teal[400], }, 7: { @@ -151,11 +151,11 @@ const editor = { }, highlight: { selection: player[1].selectionColor, - occurrence: colors.indigo[500], // TODO: Why does indigo[500], indigo[100], and indigo[900] all give me the same color? @kethku - activeOccurrence: colors.indigo[400], // TODO: We don't seem to be using this right now in rust + occurrence: colors.neutral[750], + activeOccurrence: colors.neutral[700], matchingBracket: backgroundColor[500].active, - match: colors.lime[500], - activeMatch: colors.lime[400], + match: colors.sky[900], + activeMatch: colors.sky[800], related: backgroundColor[500].focused, }, gutter: { @@ -166,15 +166,15 @@ const editor = { const syntax: Syntax = { primary: { - color: textColor.primary, + color: colors.neutral[150], weight: fontWeights.normal, }, comment: { - color: colors.lime[200], + color: colors.neutral[300], weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, + color: colors.neutral[200], weight: fontWeights.normal, }, constant: { @@ -182,7 +182,7 @@ const syntax: Syntax = { weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], + color: colors.blue[400], weight: fontWeights.normal, }, function: { @@ -194,19 +194,19 @@ const syntax: Syntax = { weight: fontWeights.normal, }, variant: { - color: colors.teal[300], + color: colors.sky[300], weight: fontWeights.normal, }, property: { - color: colors.sky[300], + color: colors.blue[400], weight: fontWeights.normal, }, enum: { - color: colors.sky[400], + color: colors.orange[500], weight: fontWeights.normal, }, operator: { - color: colors.sky[400], + color: colors.orange[500], weight: fontWeights.normal, }, string: { @@ -214,11 +214,11 @@ const syntax: Syntax = { weight: fontWeights.normal, }, number: { - color: colors.neutral[150], + color: colors.lime[300], weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], + color: colors.lime[300], weight: fontWeights.normal, }, predictive: { @@ -226,7 +226,7 @@ const syntax: Syntax = { weight: fontWeights.normal, }, title: { - color: colors.sky[500], + color: colors.amber[500], weight: fontWeights.bold, }, emphasis: { diff --git a/styles/themes/light.ts b/styles/themes/light.ts index ee94e18b19869727eae1c973d908ed3202282c77..649fd719a8f75bd47e4c07e8744a4863ae1f5d9f 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -18,9 +18,9 @@ const backgroundColor = { }, 500: { base: colors.neutral[0], - hovered: colors.neutral[50], - active: colors.neutral[100], - focused: colors.neutral[50], + hovered: colors.neutral[25], + active: colors.neutral[50], + focused: colors.neutral[75], }, ok: { base: colors.green[100], @@ -159,66 +159,66 @@ const editor = { related: colors.neutral[0], }, gutter: { - primary: textColor.muted, + primary: colors.neutral[300], active: textColor.active, }, }; const syntax: Syntax = { primary: { - color: textColor.primary, + color: colors.neutral[750], weight: fontWeights.normal, }, comment: { - color: colors.lime[200], + color: colors.neutral[600], weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, + color: colors.neutral[700], weight: fontWeights.normal, }, constant: { - color: colors.neutral[150], + color: colors.neutral[700], weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], + color: colors.blue[800], weight: fontWeights.normal, }, function: { - color: colors.yellow[200], + color: colors.green[600], weight: fontWeights.normal, }, type: { - color: colors.teal[300], + color: colors.teal[600], weight: fontWeights.normal, }, variant: { - color: colors.teal[300], + color: colors.sky[600], weight: fontWeights.normal, }, property: { - color: colors.sky[300], + color: colors.blue[700], weight: fontWeights.normal, }, enum: { - color: colors.sky[400], + color: colors.orange[600], weight: fontWeights.normal, }, operator: { - color: colors.sky[400], + color: colors.orange[600], weight: fontWeights.normal, }, string: { - color: colors.orange[300], + color: colors.orange[600], weight: fontWeights.normal, }, number: { - color: colors.neutral[150], + color: colors.teal[500], weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], + color: colors.amber[600], weight: fontWeights.normal, }, predictive: { @@ -238,7 +238,7 @@ const syntax: Syntax = { weight: fontWeights.bold, }, linkUrl: { - color: colors.lime[500], + color: colors.teal[500], weight: fontWeights.normal, // TODO: add underline }, diff --git a/styles/utils/color.ts b/styles/utils/color.ts index 156fc5ba41b2bbf0cfc9dd8080db9bf6cd6c320d..e69d903a431cdef0dc9acdc3f76eb8b535d519f4 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -17,14 +17,14 @@ export function colorRamp( } else { let hue = Math.round(chroma(color).hsl()[0]); let startColor = chroma.hsl(hue, 0.88, 0.96); - let endColor = chroma.hsl(hue, 0.68, 0.32); + let endColor = chroma.hsl(hue, 0.68, 0.12); scale = chroma .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") .gamma(1) - .correctLightness(true) - .padding([0, 0.15]); + // .correctLightness(true) + .padding([0, 0]); } const ramp: ColorRamp = {}; From 2aebb04a8482e842daf018dfec8c7f0edc9fa6a6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 29 Mar 2022 13:08:00 -0600 Subject: [PATCH 031/245] Start on TypeScript-based styling system Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- .gitignore | 1 + styles/app.ts | 632 +++++++++++++++++++++++++++++++++++++++ styles/components.ts | 62 ++++ styles/core.ts | 38 +++ styles/package-lock.json | 28 ++ styles/package.json | 14 + styles/selector-modal.ts | 59 ++++ styles/theme.ts | 121 ++++++++ 8 files changed, 955 insertions(+) create mode 100644 styles/app.ts create mode 100644 styles/components.ts create mode 100644 styles/core.ts create mode 100644 styles/package-lock.json create mode 100644 styles/package.json create mode 100644 styles/selector-modal.ts create mode 100644 styles/theme.ts diff --git a/.gitignore b/.gitignore index e88434ce4e718285669691175d297842a3b16b33..140053fc2c507f788748b43136b1eaa5c52680da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /zed.xcworkspace .DS_Store /script/node_modules +/styles/node_modules /crates/server/.env.toml /crates/server/static/styles.css /vendor/bin diff --git a/styles/app.ts b/styles/app.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7ae4348bea1d2e0861d0d4a957cd6eb7a3c7adf --- /dev/null +++ b/styles/app.ts @@ -0,0 +1,632 @@ +import { selectorModal } from "./selector-modal"; +import Theme from "./theme"; + +export default function app(theme: Theme): Object { + return { + selector: selectorModal(theme), + workspace: { + background: "$surface.500", + leaderBorderOpacity: 0.7, + leader_border_width: 2.0, + active_tab: { + background: "$surface.300", + extends: "$workspace.tab", + text: "$text.primary", + border: { + bottom: false, + }, + }, + left_sidebar: { + extends: "$workspace.sidebar", + border: { + color: "$border.primary", + right: true, + width: 1, + }, + }, + pane_divider: { + color: "$border.primary", + width: 1, + }, + right_sidebar: { + extends: "$workspace.sidebar", + border: { + color: "$border.primary", + left: true, + width: 1, + }, + }, + sidebar: { + width: 30, + active_item: { + extends: "$workspace.sidebar.item", + icon_color: "$text.primary.color", + }, + border: { + color: "$border.primary", + right: true, + width: 1, + }, + item: { + height: "$workspace.tab.height", + icon_color: "$text.muted.color", + icon_size: 18, + }, + resize_handle: { + background: "$border.primary", + padding: { + left: 1, + }, + }, + }, + status_bar: { + cursor_position: "$text.muted", + diagnostic_message: "$text.muted", + height: 24, + item_spacing: 8, + lsp_message: "$text.muted", + padding: { + left: 6, + right: 6, + }, + }, + tab: { + height: 34, + icon_close: "$text.muted.color", + icon_close_active: "$text.primary.color", + icon_conflict: "$status.warn", + icon_dirty: "$status.info", + icon_width: 8, + spacing: 10, + text: "$text.muted", + border: { + bottom: true, + color: "$border.primary", + left: true, + overlay: true, + width: 1, + }, + padding: { + left: 12, + right: 12, + }, + }, + titlebar: { + avatar_width: 18, + height: 32, + share_icon_active_color: "$text.primary.color", + share_icon_color: "$text.muted.color", + title: "$text.primary", + avatar: { + corner_radius: 10, + border: { + color: "#00000088", + width: 1, + }, + }, + avatar_ribbon: { + background: "#ff0000", + height: 3, + width: 12, + }, + border: { + bottom: true, + color: "$border.primary", + width: 1, + }, + hovered_sign_in_prompt: { + color: "$text.secondary.color", + extends: "$workspace.titlebar.sign_in_prompt", + }, + offline_icon: { + color: "$text.muted.color", + width: 16, + padding: { + right: 4, + }, + }, + outdated_warning: { + extends: "$text.muted", + size: 13, + }, + sign_in_prompt: { + extends: "$text.muted", + size: 13, + underline: true, + padding: { + right: 8, + }, + }, + }, + toolbar: { + height: 44, + }, + }, + chat_panel: { + extends: "$panel", + channel_name: { + extends: "$text.primary", + weight: "bold", + }, + channel_name_hash: { + text: "$text.muted", + padding: { + right: 8, + }, + }, + channel_select: { + active_item: { + extends: "$chat_panel.channel_select.item", + name: "$text.primary", + }, + header: { + extends: "$chat_panel.channel_select.active_item", + padding: { + bottom: 4, + left: 0, + }, + }, + hovered_active_item: { + extends: "$chat_panel.channel_select.hovered_item", + name: "$text.primary", + }, + hovered_item: { + background: "$state.hover", + corner_radius: 6, + extends: "$chat_panel.channel_select.item", + }, + item: { + name: "$text.secondary", + padding: 4, + hash: { + extends: "$text.muted", + margin: { + right: 8, + }, + }, + }, + menu: { + background: "$surface.500", + corner_radius: 6, + padding: 4, + border: { + color: "$border.primary", + width: 1, + }, + shadow: { + blur: 16, + color: "$shadow.0", + offset: [0, 2], + }, + }, + }, + hovered_sign_in_prompt: { + color: "$text.secondary.color", + extends: "$chat_panel.sign_in_prompt", + }, + input_editor: { + background: "$surface.300", + corner_radius: 6, + placeholder_text: "$text.muted", + selection: "$selection.host", + text: "$text.primary", + border: { + color: "$border.primary", + width: 1, + }, + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + message: { + body: "$text.secondary", + timestamp: "$text.muted", + padding: { + bottom: 6, + }, + sender: { + extends: "$text.primary", + weight: "bold", + margin: { + right: 8, + }, + }, + }, + pending_message: { + extends: "$chat_panel.message", + body: { + color: "$text.muted.color", + }, + sender: { + color: "$text.muted.color", + }, + timestamp: { + color: "$text.muted.color", + }, + }, + sign_in_prompt: { + extends: "$text.primary", + underline: true, + }, + }, + contacts_panel: { + extends: "$panel", + host_row_height: 28, + tree_branch_color: "$surface.100", + tree_branch_width: 1, + host_avatar: { + corner_radius: 10, + width: 18, + }, + host_username: { + extends: "$text.primary", + padding: { + left: 8, + }, + }, + hovered_shared_project: { + background: "$state.hover", + corner_radius: 6, + extends: "$contacts_panel.shared_project", + }, + hovered_unshared_project: { + background: "$state.hover", + corner_radius: 6, + extends: "$contacts_panel.unshared_project", + }, + project: { + guest_avatar_spacing: 4, + height: 24, + guest_avatar: { + corner_radius: 8, + width: 14, + }, + name: { + extends: "$text.secondary", + margin: { + right: 6, + }, + }, + padding: { + left: 8, + }, + }, + shared_project: { + extends: "$contacts_panel.project", + name: { + color: "$text.primary.color", + }, + }, + unshared_project: { + extends: "$contacts_panel.project", + }, + }, + editor: { + active_line_background: "$state.active_line", + background: "$surface.300", + code_actions_indicator: "$text.muted.color", + diff_background_deleted: "$state.deleted_line", + diff_background_inserted: "$state.inserted_line", + document_highlight_read_background: "#99999920", + document_highlight_write_background: "#99999916", + error_color: "$status.bad", + guest_selections: "$selection.guests", + gutter_background: "$surface.300", + gutter_padding_factor: 2.5, + highlighted_line_background: "$state.highlighted_line", + line_number: "$text.muted.color", + line_number_active: "$text.primary.color", + rename_fade: 0.6, + selection: "$selection.host", + text_color: "$text.secondary.color", + unnecessary_code_fade: 0.5, + autocomplete: { + background: "$surface.100", + corner_radius: 6, + padding: 6, + border: { + color: "$border.secondary", + width: 2, + }, + hovered_item: { + background: "$state.hover", + extends: "$editor.autocomplete.item", + }, + item: { + corner_radius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, + }, + margin: { + left: -14, + }, + match_highlight: { + color: "$editor.syntax.keyword.color", + weight: "$editor.syntax.keyword.weight", + }, + selected_item: { + background: "$state.selected", + extends: "$editor.autocomplete.item", + }, + }, + diagnostic_header: { + background: "$editor.background", + icon_width_factor: 1.5, + text_scale_factor: 0.857, + border: { + bottom: true, + color: "$border.secondary", + top: true, + width: 1, + }, + code: { + extends: "$text.muted", + size: 14, + margin: { + left: 10, + }, + }, + message: { + highlight_text: { + extends: "$text.primary", + size: 14, + weight: "bold", + }, + text: { + extends: "$text.secondary", + size: 14, + }, + }, + }, + diagnostic_path_header: { + background: "$state.active_line", + text_scale_factor: 0.857, + filename: { + extends: "$text.primary", + size: 14, + }, + path: { + extends: "$text.muted", + size: 14, + margin: { + left: 12, + }, + }, + }, + error_diagnostic: { + text_scale_factor: 0.857, + header: { + border: { + color: "$border.primary", + top: true, + width: 1, + }, + }, + message: { + highlight_text: { + color: "$status.bad", + extends: "$text.secondary", + size: 14, + weight: "bold", + }, + text: { + color: "$status.bad", + extends: "$text.secondary", + size: 14, + }, + }, + }, + hint_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.info", + }, + text: { + color: "$status.info", + }, + }, + }, + information_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.info", + }, + text: { + color: "$status.info", + }, + }, + }, + invalid_error_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_hint_diagnostic: { + extends: "$editor.hint_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_information_diagnostic: { + extends: "$editor.information_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + invalid_warning_diagnostic: { + extends: "$editor.warning_diagnostic", + message: { + highlight_text: { + color: "$text.muted.color", + }, + text: { + color: "$text.muted.color", + }, + }, + }, + warning_diagnostic: { + extends: "$editor.error_diagnostic", + message: { + highlight_text: { + color: "$status.warn", + }, + text: { + color: "$status.warn", + }, + }, + }, + }, + project_diagnostics: { + background: "$surface.300", + tab_icon_spacing: 4, + tab_icon_width: 13, + tab_summary_spacing: 10, + empty_message: { + extends: "$text.primary", + size: 18, + }, + status_bar_item: { + extends: "$text.muted", + margin: { + right: 10, + }, + }, + }, + project_panel: { + extends: "$panel", + entry: { + height: 22, + icon_color: "$text.muted.color", + icon_size: 8, + icon_spacing: 8, + text: "$text.secondary", + }, + hovered_entry: { + background: "$state.hover", + extends: "$project_panel.entry", + }, + hovered_selected_entry: { + extends: "$project_panel.hovered_entry", + text: { + extends: "$text.primary", + }, + }, + padding: { + top: 6, + }, + selected_entry: { + extends: "$project_panel.entry", + text: { + extends: "$text.primary", + }, + }, + }, + search: { + background: "$surface.300", + match_background: "$state.highlighted_line", + tab_icon_spacing: 4, + tab_icon_width: 14, + active_hovered_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + active_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + editor: { + background: "$surface.500", + corner_radius: 6, + max_width: 400, + placeholder_text: "$text.muted", + selection: "$selection.host", + text: "$text.primary", + border: { + color: "$border.primary", + width: 1, + }, + margin: { + bottom: 5, + left: 5, + right: 5, + top: 5, + }, + padding: { + bottom: 3, + left: 13, + right: 13, + top: 3, + }, + }, + hovered_option_button: { + background: "$surface.100", + extends: "$search.option_button", + }, + invalid_editor: { + extends: "$search.editor", + border: { + color: "$status.bad", + width: 1, + }, + }, + match_index: { + extends: "$text.secondary", + padding: 6, + }, + option_button: { + background: "$surface.300", + corner_radius: 6, + extends: "$text.secondary", + border: { + color: "$border.primary", + width: 1, + }, + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }, + option_button_group: { + padding: { + left: 2, + right: 2, + }, + }, + results_status: { + extends: "$text.primary", + size: 18, + }, + }, + }; +} diff --git a/styles/components.ts b/styles/components.ts new file mode 100644 index 0000000000000000000000000000000000000000..226d1d9e374274ce82938f85c1a73d0c669a468c --- /dev/null +++ b/styles/components.ts @@ -0,0 +1,62 @@ +import chroma from "chroma-js"; +import core, { Color } from "./core"; +import Theme, { BackgroundColor, Weight } from "./theme"; + +export function text( + theme: Theme, + fontFamily: keyof typeof core.fontFamily, + color: keyof Theme["textColor"], + properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } +) { + const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; + const size = core.fontSize[sizeKey].value; + + return { + family: core.fontFamily[fontFamily], + color: theme.textColor[color].value, + ...properties, + size, + }; +} + +export function border(theme: Theme, color: keyof Theme["borderColor"]) { + return { + color: theme.borderColor[color].value, + width: 1, + }; +} + +export interface Player { + selection: { + cursor: Color; + selection: Color; + }; +} + +export function player( + theme: Theme, + playerNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 +): Player { + return { + selection: { + cursor: theme.player[playerNumber].cursorColor.value, + selection: theme.player[playerNumber].selectionColor.value, + }, + }; +} + +export function backgroundColor( + theme: Theme, + name: keyof Theme["backgroundColor"], + state?: keyof BackgroundColor +): Color { + return theme.backgroundColor[name][state || "base"].value; +} + +export function shadow(theme) { + return { + blur: 16, + color: chroma("black").alpha(theme.shadowAlpha.value).hex(), + offset: [0, 2], + }; +} diff --git a/styles/core.ts b/styles/core.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c63b2285ea0406363f05938e956029db5cc39dd --- /dev/null +++ b/styles/core.ts @@ -0,0 +1,38 @@ +export type Color = string; + +export default { + fontFamily: { + sans: "Zed Sans", + mono: "Zed Mono", + }, + fontSize: { + "3xs": { + value: "8", + type: "fontSizes", + }, + "2xs": { + value: "10", + type: "fontSizes", + }, + xs: { + value: "12", + type: "fontSizes", + }, + sm: { + value: "14", + type: "fontSizes", + }, + md: { + value: "16", + type: "fontSizes", + }, + lg: { + value: "18", + type: "fontSizes", + }, + xl: { + value: "20", + type: "fontSizes", + }, + }, +}; diff --git a/styles/package-lock.json b/styles/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..3abb465628bd5400de8fccf399c5e62025600ab1 --- /dev/null +++ b/styles/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "styles", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "styles", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "chroma-js": "^2.4.2" + } + }, + "node_modules/chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + } + }, + "dependencies": { + "chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + } + } +} diff --git a/styles/package.json b/styles/package.json new file mode 100644 index 0000000000000000000000000000000000000000..92f0546c561f768847c081fca7465d28822798ff --- /dev/null +++ b/styles/package.json @@ -0,0 +1,14 @@ +{ + "name": "styles", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "chroma-js": "^2.4.2" + } +} diff --git a/styles/selector-modal.ts b/styles/selector-modal.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7101c915138e61d6147f4f12e82e58310ae9637 --- /dev/null +++ b/styles/selector-modal.ts @@ -0,0 +1,59 @@ +import { backgroundColor, border, player, shadow, text } from "./components"; +import Theme from "./theme"; + +export function selectorModal(theme: Theme): Object { + const item = { + padding: { + bottom: 4, + left: 16, + right: 16, + top: 4, + }, + cornerRadius: 6, + text: text(theme, "sans", "secondary"), + highlightText: text(theme, "sans", "feature", { weight: "bold" }), + }; + + const activeItem = { + ...item, + background: backgroundColor(theme, 500, "active"), + text: text(theme, "sans", "primary"), + }; + + return { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 8, + item, + activeItem, + border: border(theme, "primary"), + empty: { + text: text(theme, "sans", "muted"), + padding: { + bottom: 4, + left: 16, + right: 16, + top: 8, + }, + }, + inputEditor: { + background: backgroundColor(theme, 300), + corner_radius: 6, + placeholderText: text(theme, "sans", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + padding: { + bottom: 7, + left: 16, + right: 16, + top: 7, + }, + }, + margin: { + bottom: 52, + top: 52, + }, + shadow: shadow(theme), + }; +} diff --git a/styles/theme.ts b/styles/theme.ts new file mode 100644 index 0000000000000000000000000000000000000000..5363a8c01c08697f90fa9a37ffba2c6d50305c5c --- /dev/null +++ b/styles/theme.ts @@ -0,0 +1,121 @@ +export type Color = string; +export type Weight = + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; + +interface SyntaxHighlightStyle { + color: { value: Color }; + weight: { value: Weight }; +} + +interface Player { + baseColor: { + value: Color; + }; + cursorColor: { + value: Color; + }; + selectionColor: { + value: Color; + }; + borderColor: { + value: Color; + }; +} + +export interface BackgroundColor { + base: { + value: Color; + }; + hover: { + value: Color; + }; + active: { + value: Color; + }; + focused: { + value: Color; + }; +} + +export default interface Theme { + backgroundColor: { + 100: BackgroundColor; + 300: BackgroundColor; + 500: BackgroundColor; + }; + borderColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + focused: { + value: Color; + }; + active: { + value: Color; + }; + }; + textColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + placeholder: { + value: Color; + }; + active: { + value: Color; + }; + feature: { + value: Color; + }; + }; + syntax: { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; + }; + player: { + 1: Player; + 2: Player; + 3: Player; + 4: Player; + 5: Player; + 6: Player; + 7: Player; + 8: Player; + }; + shadowAlpha: { + value: number; + }; +} From bfce4a61041e7353492cd5f6ca61d235addb142a Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 29 Mar 2022 15:33:03 -0400 Subject: [PATCH 032/245] WIP: Add `rose` color tokens to `core.ts` --- styles/core.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/styles/core.ts b/styles/core.ts index 6c63b2285ea0406363f05938e956029db5cc39dd..164b6dba003b391e73717d232fb8b9c94ecbcba2 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,6 +1,51 @@ +import chroma from "chroma-js"; + export type Color = string; +function getColorRamp(colorName, baseColor, steps = 10) { + let hsl = chroma(baseColor).hsl(); + let h = Math.round(hsl[0]); + let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); + let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); + + let ramp = chroma + .scale([lightColor, baseColor, darkColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]) + .colors(steps); + + let tokens = {}; + let token = {}; + let colorNumber = 0; + + for (let i = 0; i < steps; i++) { + if (i !== 0) { + colorNumber = i * 100; + } + + token = { + [`${colorName}_${colorNumber}`]: { + value: ramp[i].value, + rootValue: baseColor, + step: i, + type: "color", + }, + }; + + Object.assign(token, tokens); + } + + return tokens; +} + export default { + color: { + rose: getColorRamp("rose", "#F43F5E", 10), + }, + fontFamily: { sans: "Zed Sans", mono: "Zed Mono", From 1f71e742c5834ac08a58e4be014df92d238554c3 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 29 Mar 2022 17:10:46 -0400 Subject: [PATCH 033/245] WIP: Color WIP --- styles/core.color.ts | 93 ++++++++++++++++++++++++++++++++++++++++++++ styles/core.ts | 45 +-------------------- 2 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 styles/core.color.ts diff --git a/styles/core.color.ts b/styles/core.color.ts new file mode 100644 index 0000000000000000000000000000000000000000..004e7209a2c124bfa74bfaec6d598389e187d9ad --- /dev/null +++ b/styles/core.color.ts @@ -0,0 +1,93 @@ +import chroma from "chroma-js"; + +export type Color = string; + +function returnTokens( + colorName: string, + ramp: Array, // help, have no clue on type here +) { + let tokens = {}; + let token = {}; + let colorNumber = 0; + let increment = 0; + + for (let i = 0; i < ramp.len; i++) { + if (i > 11 ) { + increment = 50; + } else { + increment = 100; + } + + if (i !== 0) { + colorNumber = i * increment; + } + + token = { + [`${colorName}_${colorNumber}`]: { + value: ramp[i].value, + step: i, + type: "color", + }, + }; + + Object.assign(token, tokens); + } + return tokens; +} + +function oneColorRamp( + colorName: string, + baseColor: string, + steps: number = 10 +) { + let hsl = chroma(baseColor).hsl(); + let h = Math.round(hsl[0]); + let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); + let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); + + let ramp = chroma + .scale([lightColor, baseColor, darkColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]) + .colors(steps) + .hex(); + + return returnTokens(colorName, ramp); +} + +function colorRamp( + colorName: string, + startColor: string, + endColor: string, + steps: number +) { + let ramp = chroma.scale([startColor, endColor]).mode("hsl").colors(steps).hex(); + + return returnTokens(colorName, ramp); +} + +export default { + color: { + neutral: colorRamp("neutral", "black", "white", 21), // colorName, startColor, endColor, steps + rose: oneColorRamp("rose", "#F43F5EFF"), // colorName, baseColor, steps(optional) + red: oneColorRamp("red", "#EF4444FF"), + orange: oneColorRamp("orange", "#F97316FF"), + amber: oneColorRamp("amber", "#F59E0BFF"), + yellow: oneColorRamp("yellow", "#EAB308FF"), + lime: oneColorRamp("lime", "#84CC16FF"), + green: oneColorRamp("green", "#22C55EFF"), + emerald: oneColorRamp("emerald", "#10B981FF"), + teal: oneColorRamp("teal", "#14B8A6FF"), + cyan: oneColorRamp("cyan", "#06BBD4FF"), + sky: oneColorRamp("sky", "#0EA5E9FF"), + blue: oneColorRamp("blue", "#3B82F6FF"), + indigo: oneColorRamp("indigo", "#6366F1FF"), + violet: oneColorRamp("violet", "#8B5CF6FF"), + purple: oneColorRamp("purple", "#A855F7FF"), + fuschia: oneColorRamp("fuschia", "#D946E4FF"), + pink: oneColorRamp("pink", "#EC4899FF"), + }, +}; diff --git a/styles/core.ts b/styles/core.ts index 164b6dba003b391e73717d232fb8b9c94ecbcba2..6444ef9a1c96b26c85ec5181871005650443ce22 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,50 +1,9 @@ -import chroma from "chroma-js"; +import color from "./core.color"; export type Color = string; -function getColorRamp(colorName, baseColor, steps = 10) { - let hsl = chroma(baseColor).hsl(); - let h = Math.round(hsl[0]); - let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); - let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); - - let ramp = chroma - .scale([lightColor, baseColor, darkColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - .correctLightness(true) - .padding([0, 0.15]) - .colors(steps); - - let tokens = {}; - let token = {}; - let colorNumber = 0; - - for (let i = 0; i < steps; i++) { - if (i !== 0) { - colorNumber = i * 100; - } - - token = { - [`${colorName}_${colorNumber}`]: { - value: ramp[i].value, - rootValue: baseColor, - step: i, - type: "color", - }, - }; - - Object.assign(token, tokens); - } - - return tokens; -} - export default { - color: { - rose: getColorRamp("rose", "#F43F5E", 10), - }, + color: color, fontFamily: { sans: "Zed Sans", From 8b33a58076e5a0c2b41a58f2e34d5c9a6ebe5310 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 29 Mar 2022 16:28:19 -0600 Subject: [PATCH 034/245] Express workspace in terms of new components Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- styles/app.ts | 155 +++------------------------------------ styles/components.ts | 23 +++++- styles/core.color.ts | 93 ----------------------- styles/core.ts | 26 +++++-- styles/lib.ts | 44 +++++++++++ styles/package-lock.json | 11 +++ styles/package.json | 1 + styles/selector-modal.ts | 2 +- styles/theme.ts | 46 ++++++++++++ styles/workspace.ts | 133 +++++++++++++++++++++++++++++++++ 10 files changed, 288 insertions(+), 246 deletions(-) delete mode 100644 styles/core.color.ts create mode 100644 styles/lib.ts create mode 100644 styles/workspace.ts diff --git a/styles/app.ts b/styles/app.ts index a7ae4348bea1d2e0861d0d4a957cd6eb7a3c7adf..4f40577ae9ada410e9cab6c76bfb950660b6b94b 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,147 +1,12 @@ -import { selectorModal } from "./selector-modal"; +import { backgroundColor } from "./components"; +import selectorModal from "./selector-modal"; +import workspace from "./workspace"; import Theme from "./theme"; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), - workspace: { - background: "$surface.500", - leaderBorderOpacity: 0.7, - leader_border_width: 2.0, - active_tab: { - background: "$surface.300", - extends: "$workspace.tab", - text: "$text.primary", - border: { - bottom: false, - }, - }, - left_sidebar: { - extends: "$workspace.sidebar", - border: { - color: "$border.primary", - right: true, - width: 1, - }, - }, - pane_divider: { - color: "$border.primary", - width: 1, - }, - right_sidebar: { - extends: "$workspace.sidebar", - border: { - color: "$border.primary", - left: true, - width: 1, - }, - }, - sidebar: { - width: 30, - active_item: { - extends: "$workspace.sidebar.item", - icon_color: "$text.primary.color", - }, - border: { - color: "$border.primary", - right: true, - width: 1, - }, - item: { - height: "$workspace.tab.height", - icon_color: "$text.muted.color", - icon_size: 18, - }, - resize_handle: { - background: "$border.primary", - padding: { - left: 1, - }, - }, - }, - status_bar: { - cursor_position: "$text.muted", - diagnostic_message: "$text.muted", - height: 24, - item_spacing: 8, - lsp_message: "$text.muted", - padding: { - left: 6, - right: 6, - }, - }, - tab: { - height: 34, - icon_close: "$text.muted.color", - icon_close_active: "$text.primary.color", - icon_conflict: "$status.warn", - icon_dirty: "$status.info", - icon_width: 8, - spacing: 10, - text: "$text.muted", - border: { - bottom: true, - color: "$border.primary", - left: true, - overlay: true, - width: 1, - }, - padding: { - left: 12, - right: 12, - }, - }, - titlebar: { - avatar_width: 18, - height: 32, - share_icon_active_color: "$text.primary.color", - share_icon_color: "$text.muted.color", - title: "$text.primary", - avatar: { - corner_radius: 10, - border: { - color: "#00000088", - width: 1, - }, - }, - avatar_ribbon: { - background: "#ff0000", - height: 3, - width: 12, - }, - border: { - bottom: true, - color: "$border.primary", - width: 1, - }, - hovered_sign_in_prompt: { - color: "$text.secondary.color", - extends: "$workspace.titlebar.sign_in_prompt", - }, - offline_icon: { - color: "$text.muted.color", - width: 16, - padding: { - right: 4, - }, - }, - outdated_warning: { - extends: "$text.muted", - size: 13, - }, - sign_in_prompt: { - extends: "$text.muted", - size: 13, - underline: true, - padding: { - right: 8, - }, - }, - }, - toolbar: { - height: 44, - }, - }, + workspace: workspace(theme), chat_panel: { extends: "$panel", channel_name: { @@ -205,7 +70,7 @@ export default function app(theme: Theme): Object { extends: "$chat_panel.sign_in_prompt", }, input_editor: { - background: "$surface.300", + background: backgroundColor(theme, 300), corner_radius: 6, placeholder_text: "$text.muted", selection: "$selection.host", @@ -306,7 +171,7 @@ export default function app(theme: Theme): Object { }, editor: { active_line_background: "$state.active_line", - background: "$surface.300", + background: backgroundColor(theme, 300), code_actions_indicator: "$text.muted.color", diff_background_deleted: "$state.deleted_line", diff_background_inserted: "$state.inserted_line", @@ -314,7 +179,7 @@ export default function app(theme: Theme): Object { document_highlight_write_background: "#99999916", error_color: "$status.bad", guest_selections: "$selection.guests", - gutter_background: "$surface.300", + gutter_background: backgroundColor(theme, 300), gutter_padding_factor: 2.5, highlighted_line_background: "$state.highlighted_line", line_number: "$text.muted.color", @@ -502,7 +367,7 @@ export default function app(theme: Theme): Object { }, }, project_diagnostics: { - background: "$surface.300", + background: backgroundColor(theme, 300), tab_icon_spacing: 4, tab_icon_width: 13, tab_summary_spacing: 10, @@ -547,7 +412,7 @@ export default function app(theme: Theme): Object { }, }, search: { - background: "$surface.300", + background: backgroundColor(theme, 300), match_background: "$state.highlighted_line", tab_icon_spacing: 4, tab_icon_width: 14, @@ -599,7 +464,7 @@ export default function app(theme: Theme): Object { padding: 6, }, option_button: { - background: "$surface.300", + background: backgroundColor(theme, 300), corner_radius: 6, extends: "$text.secondary", border: { diff --git a/styles/components.ts b/styles/components.ts index 226d1d9e374274ce82938f85c1a73d0c669a468c..9cc58046ffba77646dc07342b1485e0877305f69 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -1,5 +1,6 @@ import chroma from "chroma-js"; -import core, { Color } from "./core"; +import core from "./core"; +import { Color } from "./lib"; import Theme, { BackgroundColor, Weight } from "./theme"; export function text( @@ -19,13 +20,31 @@ export function text( }; } -export function border(theme: Theme, color: keyof Theme["borderColor"]) { +export interface BorderOptions { + width?: number; + top?: boolean; + bottom?: boolean; + left?: boolean; + right?: boolean; + overlay?: boolean; +} + +export function border( + theme: Theme, + color: keyof Theme["borderColor"], + options?: BorderOptions +) { return { color: theme.borderColor[color].value, width: 1, + ...options, }; } +export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { + return theme.iconColor[color].value; +} + export interface Player { selection: { cursor: Color; diff --git a/styles/core.color.ts b/styles/core.color.ts deleted file mode 100644 index 004e7209a2c124bfa74bfaec6d598389e187d9ad..0000000000000000000000000000000000000000 --- a/styles/core.color.ts +++ /dev/null @@ -1,93 +0,0 @@ -import chroma from "chroma-js"; - -export type Color = string; - -function returnTokens( - colorName: string, - ramp: Array, // help, have no clue on type here -) { - let tokens = {}; - let token = {}; - let colorNumber = 0; - let increment = 0; - - for (let i = 0; i < ramp.len; i++) { - if (i > 11 ) { - increment = 50; - } else { - increment = 100; - } - - if (i !== 0) { - colorNumber = i * increment; - } - - token = { - [`${colorName}_${colorNumber}`]: { - value: ramp[i].value, - step: i, - type: "color", - }, - }; - - Object.assign(token, tokens); - } - return tokens; -} - -function oneColorRamp( - colorName: string, - baseColor: string, - steps: number = 10 -) { - let hsl = chroma(baseColor).hsl(); - let h = Math.round(hsl[0]); - let lightColor = chroma.hsl(h, 0.88, 0.96).hex(); - let darkColor = chroma.hsl(h, 0.68, 0.32).hex(); - - let ramp = chroma - .scale([lightColor, baseColor, darkColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - .correctLightness(true) - .padding([0, 0.15]) - .colors(steps) - .hex(); - - return returnTokens(colorName, ramp); -} - -function colorRamp( - colorName: string, - startColor: string, - endColor: string, - steps: number -) { - let ramp = chroma.scale([startColor, endColor]).mode("hsl").colors(steps).hex(); - - return returnTokens(colorName, ramp); -} - -export default { - color: { - neutral: colorRamp("neutral", "black", "white", 21), // colorName, startColor, endColor, steps - rose: oneColorRamp("rose", "#F43F5EFF"), // colorName, baseColor, steps(optional) - red: oneColorRamp("red", "#EF4444FF"), - orange: oneColorRamp("orange", "#F97316FF"), - amber: oneColorRamp("amber", "#F59E0BFF"), - yellow: oneColorRamp("yellow", "#EAB308FF"), - lime: oneColorRamp("lime", "#84CC16FF"), - green: oneColorRamp("green", "#22C55EFF"), - emerald: oneColorRamp("emerald", "#10B981FF"), - teal: oneColorRamp("teal", "#14B8A6FF"), - cyan: oneColorRamp("cyan", "#06BBD4FF"), - sky: oneColorRamp("sky", "#0EA5E9FF"), - blue: oneColorRamp("blue", "#3B82F6FF"), - indigo: oneColorRamp("indigo", "#6366F1FF"), - violet: oneColorRamp("violet", "#8B5CF6FF"), - purple: oneColorRamp("purple", "#A855F7FF"), - fuschia: oneColorRamp("fuschia", "#D946E4FF"), - pink: oneColorRamp("pink", "#EC4899FF"), - }, -}; diff --git a/styles/core.ts b/styles/core.ts index 6444ef9a1c96b26c85ec5181871005650443ce22..e9e81982e456c0ffe151b83ac36767d62140c6ba 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,10 +1,6 @@ -import color from "./core.color"; - -export type Color = string; +import { colorRamp } from "./lib"; export default { - color: color, - fontFamily: { sans: "Zed Sans", mono: "Zed Mono", @@ -39,4 +35,24 @@ export default { type: "fontSizes", }, }, + color: { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), + }, }; diff --git a/styles/lib.ts b/styles/lib.ts new file mode 100644 index 0000000000000000000000000000000000000000..b59f4fa69479a1f886229afe1953284f6626f9d8 --- /dev/null +++ b/styles/lib.ts @@ -0,0 +1,44 @@ +import chroma, { Scale } from "chroma-js"; + +export type Color = string; +export type ColorRampStep = { value: Color; type: "color"; step: number }; +export type ColorRamp = { + [index: number]: ColorRampStep; +}; + +export function colorRamp( + color: Color | [Color, Color], + options?: { steps?: number; increment?: number } +): ColorRamp { + let scale: Scale; + if (Array.isArray(color)) { + const [startColor, endColor] = color; + scale = chroma.scale([startColor, endColor]); + } else { + let hue = Math.round(chroma(color).hsl()[0]); + let startColor = chroma.hsl(hue, 0.88, 0.96); + let endColor = chroma.hsl(hue, 0.68, 0.32); + scale = chroma + .scale([startColor, color, endColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + .correctLightness(true) + .padding([0, 0.15]); + } + + const ramp: ColorRamp = {}; + const steps = options?.steps || 10; + const increment = options?.increment || 100; + + scale.colors(steps, "hex").forEach((color, ix) => { + const step = ix * increment; + ramp[step] = { + value: color, + step, + type: "color", + }; + }); + + return ramp; +} diff --git a/styles/package-lock.json b/styles/package-lock.json index 3abb465628bd5400de8fccf399c5e62025600ab1..7b8503bf720d572d64bb9179a78489beaa068cb4 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -9,9 +9,15 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@types/chroma-js": "^2.1.3", "chroma-js": "^2.4.2" } }, + "node_modules/@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", @@ -19,6 +25,11 @@ } }, "dependencies": { + "@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", diff --git a/styles/package.json b/styles/package.json index 92f0546c561f768847c081fca7465d28822798ff..c66da8718b6d4f2047cbc4e7580036946dab1fb8 100644 --- a/styles/package.json +++ b/styles/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "@types/chroma-js": "^2.1.3", "chroma-js": "^2.4.2" } } diff --git a/styles/selector-modal.ts b/styles/selector-modal.ts index f7101c915138e61d6147f4f12e82e58310ae9637..ddba32683a976153eac6fc0f49f6a5df9a835a1f 100644 --- a/styles/selector-modal.ts +++ b/styles/selector-modal.ts @@ -1,7 +1,7 @@ import { backgroundColor, border, player, shadow, text } from "./components"; import Theme from "./theme"; -export function selectorModal(theme: Theme): Object { +export default function selectorModal(theme: Theme): Object { const item = { padding: { bottom: 4, diff --git a/styles/theme.ts b/styles/theme.ts index 5363a8c01c08697f90fa9a37ffba2c6d50305c5c..ddfa6414f49e5e94236f3c2d316896869f832986 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,3 +1,5 @@ +import { colorRamp } from "./lib"; + export type Color = string; export type Weight = | "thin" @@ -87,6 +89,50 @@ export default interface Theme { feature: { value: Color; }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; + }; + iconColor: { + primary: { + value: Color; + }; + secondary: { + value: Color; + }; + muted: { + value: Color; + }; + placeholder: { + value: Color; + }; + active: { + value: Color; + }; + feature: { + value: Color; + }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; }; syntax: { primary: SyntaxHighlightStyle; diff --git a/styles/workspace.ts b/styles/workspace.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ecb3a378c8d1a5acedc5100203c9b9306e36dca --- /dev/null +++ b/styles/workspace.ts @@ -0,0 +1,133 @@ +import { backgroundColor, border, iconColor, text } from "./components"; +import Theme from "./theme"; + +export default function workspace(theme: Theme) { + const signInPrompt = { + ...text(theme, "sans", "secondary"), + size: 13, + underline: true, + padding: { + right: 8, + }, + }; + + const tab = { + height: 34, + iconClose: iconColor(theme, "secondary"), + iconCloseActive: iconColor(theme, "active"), + iconConflict: iconColor(theme, "warning"), + iconDirty: iconColor(theme, "info"), + iconWidth: 8, + spacing: 10, + text: text(theme, "mono", "secondary"), + border: border(theme, "primary", { + left: true, + bottom: true, + overlay: true, + }), + padding: { + left: 12, + right: 12, + }, + }; + + const activeTab = { + ...tab, + background: backgroundColor(theme, 300), + text: text(theme, "mono", "primary"), + border: { + ...tab.border, + bottom: false, + }, + }; + + const sidebarItem = { + height: "$workspace.tab.height", + iconColor: "$text.muted.color", + iconSize: 18, + }; + const sidebar = { + width: 30, + border: border(theme, "primary", { right: true }), + item: sidebarItem, + activeItem: { + ...sidebarItem, + iconColor: iconColor(theme, "primary"), + }, + resizeHandle: { + background: border(theme, "primary").color, + padding: { + left: 1, + }, + }, + }; + + return { + background: backgroundColor(theme, 500), + leaderBorderOpacity: 0.7, + leaderBorderWidth: 2.0, + tab, + activeTab, + leftSidebar: { + ...sidebar, + border: border(theme, "primary", { right: true }), + }, + rightSidebar: { + ...sidebar, + border: border(theme, "primary", { left: true }), + }, + paneDivider: { + color: border(theme, "primary").color, + width: 1, + }, + status_bar: { + height: 24, + itemSpacing: 8, + padding: { + left: 6, + right: 6, + }, + cursorPosition: text(theme, "sans", "muted"), + diagnosticMessage: text(theme, "sans", "muted"), + lspMessage: text(theme, "sans", "muted"), + }, + titlebar: { + avatarWidth: 18, + height: 32, + shareIconColor: iconColor(theme, "secondary"), + shareIconActiveColor: iconColor(theme, "active"), + title: text(theme, "sans", "primary"), + avatar: { + cornerRadius: 10, + border: { + color: "#00000088", + width: 1, + }, + }, + avatarRibbon: { + height: 3, + width: 12, + }, + border: border(theme, "primary", { bottom: true }), + signInPrompt, + hoveredSignInPrompt: { + ...signInPrompt, + ...text(theme, "mono", "active"), + }, + offlineIcon: { + color: iconColor(theme, "muted"), + width: 16, + padding: { + right: 4, + }, + }, + outdatedWarning: { + ...text(theme, "sans", "muted"), + size: 13, + }, + }, + toolbar: { + height: 44, + }, + }; +} From cb3c111401b5ed438733826d7cc850ff5f9bfd62 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 17:59:35 -0600 Subject: [PATCH 035/245] Convert editor styles to TypeScript --- styles/app.ts | 201 +------------------------------------------ styles/components.ts | 4 +- styles/editor.ts | 143 ++++++++++++++++++++++++++++++ styles/theme.ts | 65 ++++++++++++++ 4 files changed, 214 insertions(+), 199 deletions(-) create mode 100644 styles/editor.ts diff --git a/styles/app.ts b/styles/app.ts index 4f40577ae9ada410e9cab6c76bfb950660b6b94b..a421da8f07dc854931d64268d84ae2cf9f4ec5e3 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,13 +1,15 @@ import { backgroundColor } from "./components"; import selectorModal from "./selector-modal"; import workspace from "./workspace"; +import editor from "./editor"; import Theme from "./theme"; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), workspace: workspace(theme), - chat_panel: { + editor: editor(theme), + chatPanel: { extends: "$panel", channel_name: { extends: "$text.primary", @@ -169,203 +171,6 @@ export default function app(theme: Theme): Object { extends: "$contacts_panel.project", }, }, - editor: { - active_line_background: "$state.active_line", - background: backgroundColor(theme, 300), - code_actions_indicator: "$text.muted.color", - diff_background_deleted: "$state.deleted_line", - diff_background_inserted: "$state.inserted_line", - document_highlight_read_background: "#99999920", - document_highlight_write_background: "#99999916", - error_color: "$status.bad", - guest_selections: "$selection.guests", - gutter_background: backgroundColor(theme, 300), - gutter_padding_factor: 2.5, - highlighted_line_background: "$state.highlighted_line", - line_number: "$text.muted.color", - line_number_active: "$text.primary.color", - rename_fade: 0.6, - selection: "$selection.host", - text_color: "$text.secondary.color", - unnecessary_code_fade: 0.5, - autocomplete: { - background: "$surface.100", - corner_radius: 6, - padding: 6, - border: { - color: "$border.secondary", - width: 2, - }, - hovered_item: { - background: "$state.hover", - extends: "$editor.autocomplete.item", - }, - item: { - corner_radius: 6, - padding: { - bottom: 2, - left: 6, - right: 6, - top: 2, - }, - }, - margin: { - left: -14, - }, - match_highlight: { - color: "$editor.syntax.keyword.color", - weight: "$editor.syntax.keyword.weight", - }, - selected_item: { - background: "$state.selected", - extends: "$editor.autocomplete.item", - }, - }, - diagnostic_header: { - background: "$editor.background", - icon_width_factor: 1.5, - text_scale_factor: 0.857, - border: { - bottom: true, - color: "$border.secondary", - top: true, - width: 1, - }, - code: { - extends: "$text.muted", - size: 14, - margin: { - left: 10, - }, - }, - message: { - highlight_text: { - extends: "$text.primary", - size: 14, - weight: "bold", - }, - text: { - extends: "$text.secondary", - size: 14, - }, - }, - }, - diagnostic_path_header: { - background: "$state.active_line", - text_scale_factor: 0.857, - filename: { - extends: "$text.primary", - size: 14, - }, - path: { - extends: "$text.muted", - size: 14, - margin: { - left: 12, - }, - }, - }, - error_diagnostic: { - text_scale_factor: 0.857, - header: { - border: { - color: "$border.primary", - top: true, - width: 1, - }, - }, - message: { - highlight_text: { - color: "$status.bad", - extends: "$text.secondary", - size: 14, - weight: "bold", - }, - text: { - color: "$status.bad", - extends: "$text.secondary", - size: 14, - }, - }, - }, - hint_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.info", - }, - text: { - color: "$status.info", - }, - }, - }, - information_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.info", - }, - text: { - color: "$status.info", - }, - }, - }, - invalid_error_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_hint_diagnostic: { - extends: "$editor.hint_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_information_diagnostic: { - extends: "$editor.information_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - invalid_warning_diagnostic: { - extends: "$editor.warning_diagnostic", - message: { - highlight_text: { - color: "$text.muted.color", - }, - text: { - color: "$text.muted.color", - }, - }, - }, - warning_diagnostic: { - extends: "$editor.error_diagnostic", - message: { - highlight_text: { - color: "$status.warn", - }, - text: { - color: "$status.warn", - }, - }, - }, - }, project_diagnostics: { background: backgroundColor(theme, 300), tab_icon_spacing: 4, diff --git a/styles/components.ts b/styles/components.ts index 9cc58046ffba77646dc07342b1485e0877305f69..14becaf2af30e94d4c6d3a0250b0e3f3aab52faf 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -3,10 +3,12 @@ import core from "./core"; import { Color } from "./lib"; import Theme, { BackgroundColor, Weight } from "./theme"; +export type TextColor = keyof Theme["textColor"]; + export function text( theme: Theme, fontFamily: keyof typeof core.fontFamily, - color: keyof Theme["textColor"], + color: TextColor, properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } ) { const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; diff --git a/styles/editor.ts b/styles/editor.ts new file mode 100644 index 0000000000000000000000000000000000000000..9edfdc4716bea35b4c7e3cf83967383b4f6a3850 --- /dev/null +++ b/styles/editor.ts @@ -0,0 +1,143 @@ +import { + backgroundColor, + border, + iconColor, + player, + text, + TextColor, +} from "./components"; +import Theme from "./theme"; + +export default function editor(theme: Theme) { + const autocompleteItem = { + cornerRadius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, + }; + + function diagnostic(theme: Theme, color: TextColor) { + return { + textScaleFactor: 0.857, + header: { + border: border(theme, "primary", { + top: true, + }), + }, + message: { + text: { + ...text(theme, "sans", color), + size: 14, + }, + highlightText: { + ...text(theme, "sans", color, { weight: "bold" }), + size: 14, + }, + }, + }; + } + + return { + textColor: theme.textColor.secondary.value, + background: backgroundColor(theme, 300), + activeLineBackground: theme.editor.line.active.value, + codeActionsIndicator: iconColor(theme, "secondary"), + diffBackgroundDeleted: backgroundColor(theme, "error"), + diffBackgroundInserted: backgroundColor(theme, "ok"), + documentHighlightReadBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, + errorColor: theme.textColor.error, + gutterBackground: backgroundColor(theme, 300), + gutterPaddingFactor: 2.5, + highlightedLineBackground: theme.editor.line.highlighted.value, + lineNumber: theme.editor.gutter.primary.value, + lineNumberActive: theme.editor.gutter.active, + renameFade: 0.6, + unnecessaryCodeFade: 0.5, + selection: player(theme, 1).selection, + guestSelections: [ + player(theme, 2).selection, + player(theme, 3).selection, + player(theme, 4).selection, + player(theme, 5).selection, + player(theme, 6).selection, + player(theme, 7).selection, + player(theme, 8).selection, + ], + autocomplete: { + background: backgroundColor(theme, 100), + cornerRadius: 6, + padding: 6, + border: border(theme, "secondary"), + item: autocompleteItem, + hoveredItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "hover"), + }, + margin: { + left: -14, + }, + matchHighlight: { + color: theme.syntax.keyword.color.value, + weight: theme.syntax.keyword.weight.value, + }, + selectedItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "active"), + }, + }, + diagnosticHeader: { + background: theme.editor.background.value, + iconWidthFactor: 1.5, + textScaleFactor: 0.857, + border: border(theme, "secondary", { + bottom: true, + top: true, + }), + code: { + ...text(theme, "mono", "muted"), + size: 14, + margin: { + left: 10, + }, + }, + message: { + highlightText: { + ...text(theme, "sans", "primary"), + size: 14, + weight: "bold", + }, + text: { + ...text(theme, "sans", "secondary"), + size: 14, + }, + }, + }, + diagnosticPathHeader: { + background: theme.editor.line.active, + textScaleFactor: 0.857, + filename: { + ...text(theme, "mono", "primary"), + size: 14, + }, + path: { + ...text(theme, "mono", "muted"), + size: 14, + margin: { + left: 12, + }, + }, + }, + errorDiagnostic: diagnostic(theme, "error"), + warningDiagnostic: diagnostic(theme, "warning"), + informationDiagnostic: diagnostic(theme, "info"), + hintDiagnostic: diagnostic(theme, "info"), + invalidErrorDiagnostic: diagnostic(theme, "muted"), + invalidHintDiagnostic: diagnostic(theme, "muted"), + invalidInformationDiagnostic: diagnostic(theme, "muted"), + invalidWarningDiagnostic: diagnostic(theme, "muted"), + }; +} diff --git a/styles/theme.ts b/styles/theme.ts index ddfa6414f49e5e94236f3c2d316896869f832986..5220c962c9d2032d35b15e32d12547f92d4c4679 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -52,6 +52,10 @@ export default interface Theme { 100: BackgroundColor; 300: BackgroundColor; 500: BackgroundColor; + ok: BackgroundColor; + error: BackgroundColor; + warning: BackgroundColor; + info: BackgroundColor; }; borderColor: { primary: { @@ -134,6 +138,66 @@ export default interface Theme { value: Color; }; }; + editor: { + background: { + value: Color; + }; + indent_guide: { + value: Color; + }; + indent_guide_active: { + value: Color; + }; + line: { + active: { + value: Color; + }; + highlighted: { + value: Color; + }; + inserted: { + value: Color; + }; + deleted: { + value: Color; + }; + modified: { + value: Color; + }; + }; + highlight: { + selection: { + value: Color; + }; + occurrence: { + value: Color; + }; + activeOccurrence: { + value: Color; + }; + matchingBracket: { + value: Color; + }; + match: { + value: Color; + }; + activeMatch: { + value: Color; + }; + related: { + value: Color; + }; + }; + gutter: { + primary: { + value: Color; + }; + active: { + value: Color; + }; + }; + }; + syntax: { primary: SyntaxHighlightStyle; comment: SyntaxHighlightStyle; @@ -151,6 +215,7 @@ export default interface Theme { boolean: SyntaxHighlightStyle; predictive: SyntaxHighlightStyle; }; + player: { 1: Player; 2: Player; From 189db6311cdd13f3286652dedb831b33014492ed Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 18:26:47 -0600 Subject: [PATCH 036/245] Convert project panel styles --- styles/app.ts | 180 +++++++++++++++++----------------------- styles/editor.ts | 38 +++------ styles/project-panel.ts | 32 +++++++ styles/theme.ts | 4 +- 4 files changed, 124 insertions(+), 130 deletions(-) create mode 100644 styles/project-panel.ts diff --git a/styles/app.ts b/styles/app.ts index a421da8f07dc854931d64268d84ae2cf9f4ec5e3..ae0f0717bb5dc13e20db348d36bdeb1d562e0885 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,46 +1,67 @@ -import { backgroundColor } from "./components"; +import { backgroundColor, text } from "./components"; import selectorModal from "./selector-modal"; import workspace from "./workspace"; import editor from "./editor"; import Theme from "./theme"; +import projectPanel from "./project-panel"; + +export const panel = { + padding: { top: 12, left: 12, bottom: 12, right: 12 }, +}; export default function app(theme: Theme): Object { return { selector: selectorModal(theme), workspace: workspace(theme), editor: editor(theme), + projectDiagnostics: { + background: backgroundColor(theme, 300), + tabIconSpacing: 4, + tabIconWidth: 13, + tabSummarySpacing: 10, + emptyMessage: { + ...text(theme, "sans", "primary", { size: "lg" }), + }, + statusBarItem: { + ...text(theme, "sans", "muted"), + margin: { + right: 10, + }, + }, + }, + projectPanel: projectPanel(theme), chatPanel: { extends: "$panel", - channel_name: { + channelName: { extends: "$text.primary", weight: "bold", }, - channel_name_hash: { + channelNameHash: { text: "$text.muted", padding: { right: 8, }, }, - channel_select: { - active_item: { - extends: "$chat_panel.channel_select.item", + channelSelect: { + activeItem: { + extends: "$chatPanel.channel_select.item", name: "$text.primary", }, header: { - extends: "$chat_panel.channel_select.active_item", + extends: "$chat_panel.channel_select.activeItem", padding: { bottom: 4, left: 0, }, }, - hovered_active_item: { - extends: "$chat_panel.channel_select.hovered_item", + hoveredActiveItem: { + extends: "$chatPanel.channelSelect.hoveredItem", name: "$text.primary", }, - hovered_item: { + hoveredItem: { background: "$state.hover", - corner_radius: 6, - extends: "$chat_panel.channel_select.item", + cornerRadius: 6, + extends: "$chat_panel.channelSelect.item", }, item: { name: "$text.secondary", @@ -54,7 +75,7 @@ export default function app(theme: Theme): Object { }, menu: { background: "$surface.500", - corner_radius: 6, + cornerRadius: 6, padding: 4, border: { color: "$border.primary", @@ -67,14 +88,14 @@ export default function app(theme: Theme): Object { }, }, }, - hovered_sign_in_prompt: { + hoveredSignInPrompt: { color: "$text.secondary.color", - extends: "$chat_panel.sign_in_prompt", + extends: "$chatPanel.signInPrompt", }, - input_editor: { + inputEditor: { background: backgroundColor(theme, 300), - corner_radius: 6, - placeholder_text: "$text.muted", + cornerRadius: 6, + placeholderText: "$text.muted", selection: "$selection.host", text: "$text.primary", border: { @@ -102,8 +123,8 @@ export default function app(theme: Theme): Object { }, }, }, - pending_message: { - extends: "$chat_panel.message", + pendingMessage: { + extends: "$chatPanel.message", body: { color: "$text.muted.color", }, @@ -114,41 +135,41 @@ export default function app(theme: Theme): Object { color: "$text.muted.color", }, }, - sign_in_prompt: { + signInPrompt: { extends: "$text.primary", underline: true, }, }, - contacts_panel: { + contactsPanel: { extends: "$panel", - host_row_height: 28, - tree_branch_color: "$surface.100", - tree_branch_width: 1, - host_avatar: { - corner_radius: 10, + hostRowHeight: 28, + treeBranchColor: "$surface.100", + treeBranchWidth: 1, + hostAvatar: { + cornerRadius: 10, width: 18, }, - host_username: { + hostUsername: { extends: "$text.primary", padding: { left: 8, }, }, - hovered_shared_project: { + hoveredSharedProject: { background: "$state.hover", - corner_radius: 6, - extends: "$contacts_panel.shared_project", + cornerRadius: 6, + extends: "$contacts_panel.sharedProject", }, - hovered_unshared_project: { + hoveredUnsharedProject: { background: "$state.hover", - corner_radius: 6, - extends: "$contacts_panel.unshared_project", + cornerRadius: 6, + extends: "$contacts_panel.unsharedProject", }, project: { - guest_avatar_spacing: 4, + guestAvatarSpacing: 4, height: 24, - guest_avatar: { - corner_radius: 8, + guestAvatar: { + cornerRadius: 8, width: 14, }, name: { @@ -161,79 +182,34 @@ export default function app(theme: Theme): Object { left: 8, }, }, - shared_project: { - extends: "$contacts_panel.project", + sharedProject: { + extends: "$contactsPanel.project", name: { color: "$text.primary.color", }, }, - unshared_project: { - extends: "$contacts_panel.project", - }, - }, - project_diagnostics: { - background: backgroundColor(theme, 300), - tab_icon_spacing: 4, - tab_icon_width: 13, - tab_summary_spacing: 10, - empty_message: { - extends: "$text.primary", - size: 18, - }, - status_bar_item: { - extends: "$text.muted", - margin: { - right: 10, - }, - }, - }, - project_panel: { - extends: "$panel", - entry: { - height: 22, - icon_color: "$text.muted.color", - icon_size: 8, - icon_spacing: 8, - text: "$text.secondary", - }, - hovered_entry: { - background: "$state.hover", - extends: "$project_panel.entry", - }, - hovered_selected_entry: { - extends: "$project_panel.hovered_entry", - text: { - extends: "$text.primary", - }, - }, - padding: { - top: 6, - }, - selected_entry: { - extends: "$project_panel.entry", - text: { - extends: "$text.primary", - }, + unsharedProject: { + extends: "$contactsPanel.project", }, }, search: { background: backgroundColor(theme, 300), - match_background: "$state.highlighted_line", - tab_icon_spacing: 4, - tab_icon_width: 14, - active_hovered_option_button: { + matchBackground: "$state.highlightedLine", + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { background: "$surface.100", extends: "$search.option_button", }, - active_option_button: { + activeOptionButton: { background: "$surface.100", extends: "$search.option_button", }, editor: { background: "$surface.500", - corner_radius: 6, - max_width: 400, - placeholder_text: "$text.muted", + cornerRadius: 6, + maxWidth: 400, + placeholderText: "$text.muted", selection: "$selection.host", text: "$text.primary", border: { @@ -253,24 +229,24 @@ export default function app(theme: Theme): Object { top: 3, }, }, - hovered_option_button: { + hoveredOptionButton: { background: "$surface.100", - extends: "$search.option_button", + extends: "$search.optionButton", }, - invalid_editor: { + invalidEditor: { extends: "$search.editor", border: { color: "$status.bad", width: 1, }, }, - match_index: { + matchIndex: { extends: "$text.secondary", padding: 6, }, - option_button: { + optionButton: { background: backgroundColor(theme, 300), - corner_radius: 6, + cornerRadius: 6, extends: "$text.secondary", border: { color: "$border.primary", @@ -287,13 +263,13 @@ export default function app(theme: Theme): Object { top: 1, }, }, - option_button_group: { + optionButtonGroup: { padding: { left: 2, right: 2, }, }, - results_status: { + resultsStatus: { extends: "$text.primary", size: 18, }, diff --git a/styles/editor.ts b/styles/editor.ts index 9edfdc4716bea35b4c7e3cf83967383b4f6a3850..ea7012d2092ebd0d7df324762f4703693b32a89d 100644 --- a/styles/editor.ts +++ b/styles/editor.ts @@ -28,14 +28,11 @@ export default function editor(theme: Theme) { }), }, message: { - text: { - ...text(theme, "sans", color), - size: 14, - }, - highlightText: { - ...text(theme, "sans", color, { weight: "bold" }), - size: 14, - }, + text: text(theme, "sans", color, { size: "sm" }), + highlightText: text(theme, "sans", color, { + size: "sm", + weight: "bold", + }), }, }; } @@ -75,7 +72,7 @@ export default function editor(theme: Theme) { item: autocompleteItem, hoveredItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "hover"), + background: backgroundColor(theme, 100, "hovered"), }, margin: { left: -14, @@ -98,34 +95,25 @@ export default function editor(theme: Theme) { top: true, }), code: { - ...text(theme, "mono", "muted"), - size: 14, + ...text(theme, "mono", "muted", { size: "sm" }), margin: { left: 10, }, }, message: { - highlightText: { - ...text(theme, "sans", "primary"), - size: 14, + highlightText: text(theme, "sans", "primary", { + size: "sm", weight: "bold", - }, - text: { - ...text(theme, "sans", "secondary"), - size: 14, - }, + }), + text: text(theme, "sans", "secondary", { size: "sm" }), }, }, diagnosticPathHeader: { background: theme.editor.line.active, textScaleFactor: 0.857, - filename: { - ...text(theme, "mono", "primary"), - size: 14, - }, + filename: text(theme, "mono", "primary", { size: "sm" }), path: { - ...text(theme, "mono", "muted"), - size: 14, + ...text(theme, "mono", "muted", { size: "sm" }), margin: { left: 12, }, diff --git a/styles/project-panel.ts b/styles/project-panel.ts new file mode 100644 index 0000000000000000000000000000000000000000..343e11b96b6e8adb3c6bd223a71de3e6d7d05f40 --- /dev/null +++ b/styles/project-panel.ts @@ -0,0 +1,32 @@ +import { panel } from "./app"; +import { backgroundColor, iconColor, text, TextColor } from "./components"; +import Theme from "./theme"; +import { Color } from "./lib"; + +export default function projectPanel(theme: Theme) { + function entry(theme: Theme, textColor: TextColor, background?: Color) { + return { + height: 22, + background, + iconColor: iconColor(theme, "muted"), + iconSize: 8, + iconSpacing: 8, + text: text(theme, "mono", textColor), + }; + } + + return { + ...panel, + entry: entry(theme, "secondary"), + hoveredEntry: entry( + theme, + "secondary", + backgroundColor(theme, 300, "hovered") + ), + selectedEntry: entry(theme, "primary"), + hoveredSelectedEntry: entry(theme, "primary", "hovered"), + padding: { + top: 6, + }, + }; +} diff --git a/styles/theme.ts b/styles/theme.ts index 5220c962c9d2032d35b15e32d12547f92d4c4679..27f578f4366bacae8fdc5d4dc366375532e7f2b8 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,5 +1,3 @@ -import { colorRamp } from "./lib"; - export type Color = string; export type Weight = | "thin" @@ -36,7 +34,7 @@ export interface BackgroundColor { base: { value: Color; }; - hover: { + hovered: { value: Color; }; active: { From 70b15e4c909b8723442b6d6ec1dc61d2aab2803f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Mar 2022 18:45:34 -0600 Subject: [PATCH 037/245] Convert chat panel --- styles/app.ts | 112 +------------------------------------------ styles/chat-panel.ts | 108 +++++++++++++++++++++++++++++++++++++++++ styles/components.ts | 8 +++- 3 files changed, 116 insertions(+), 112 deletions(-) create mode 100644 styles/chat-panel.ts diff --git a/styles/app.ts b/styles/app.ts index ae0f0717bb5dc13e20db348d36bdeb1d562e0885..5f2993d30a68cad4410992387bf65a6d76c72a34 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -4,6 +4,7 @@ import workspace from "./workspace"; import editor from "./editor"; import Theme from "./theme"; import projectPanel from "./project-panel"; +import chatPanel from "./chat-panel"; export const panel = { padding: { top: 12, left: 12, bottom: 12, right: 12 }, @@ -30,116 +31,7 @@ export default function app(theme: Theme): Object { }, }, projectPanel: projectPanel(theme), - chatPanel: { - extends: "$panel", - channelName: { - extends: "$text.primary", - weight: "bold", - }, - channelNameHash: { - text: "$text.muted", - padding: { - right: 8, - }, - }, - channelSelect: { - activeItem: { - extends: "$chatPanel.channel_select.item", - name: "$text.primary", - }, - header: { - extends: "$chat_panel.channel_select.activeItem", - padding: { - bottom: 4, - left: 0, - }, - }, - hoveredActiveItem: { - extends: "$chatPanel.channelSelect.hoveredItem", - name: "$text.primary", - }, - hoveredItem: { - background: "$state.hover", - cornerRadius: 6, - extends: "$chat_panel.channelSelect.item", - }, - item: { - name: "$text.secondary", - padding: 4, - hash: { - extends: "$text.muted", - margin: { - right: 8, - }, - }, - }, - menu: { - background: "$surface.500", - cornerRadius: 6, - padding: 4, - border: { - color: "$border.primary", - width: 1, - }, - shadow: { - blur: 16, - color: "$shadow.0", - offset: [0, 2], - }, - }, - }, - hoveredSignInPrompt: { - color: "$text.secondary.color", - extends: "$chatPanel.signInPrompt", - }, - inputEditor: { - background: backgroundColor(theme, 300), - cornerRadius: 6, - placeholderText: "$text.muted", - selection: "$selection.host", - text: "$text.primary", - border: { - color: "$border.primary", - width: 1, - }, - padding: { - bottom: 7, - left: 8, - right: 8, - top: 7, - }, - }, - message: { - body: "$text.secondary", - timestamp: "$text.muted", - padding: { - bottom: 6, - }, - sender: { - extends: "$text.primary", - weight: "bold", - margin: { - right: 8, - }, - }, - }, - pendingMessage: { - extends: "$chatPanel.message", - body: { - color: "$text.muted.color", - }, - sender: { - color: "$text.muted.color", - }, - timestamp: { - color: "$text.muted.color", - }, - }, - signInPrompt: { - extends: "$text.primary", - underline: true, - }, - }, + chatPanel: chatPanel(theme), contactsPanel: { extends: "$panel", hostRowHeight: 28, diff --git a/styles/chat-panel.ts b/styles/chat-panel.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6bf0148ea4c5d9345c29d5df94c978588e4fd0d --- /dev/null +++ b/styles/chat-panel.ts @@ -0,0 +1,108 @@ +import { panel } from "./app"; +import { + backgroundColor, + border, + player, + shadow, + text, + TextColor, +} from "./components"; +import Theme from "./theme"; + +export default function chatPanel(theme: Theme) { + function channelSelectItem( + theme: Theme, + textColor: TextColor, + hovered: boolean + ) { + return { + name: text(theme, "sans", textColor), + padding: 4, + hash: { + ...text(theme, "sans", "muted"), + margin: { + right: 8, + }, + }, + background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, + cornerRadius: hovered ? 6 : 0, + }; + } + + const message = { + body: text(theme, "sans", "secondary"), + timestamp: text(theme, "sans", "muted"), + padding: { + bottom: 6, + }, + sender: { + ...text(theme, "sans", "primary", { weight: "bold" }), + margin: { + right: 8, + }, + }, + }; + + return { + ...panel, + channelName: text(theme, "sans", "primary", { weight: "bold" }), + channelNameHash: { + ...text(theme, "sans", "muted"), + padding: { + right: 8, + }, + }, + channelSelect: { + header: { + ...channelSelectItem(theme, "primary", false), + padding: { + bottom: 4, + left: 0, + }, + }, + item: channelSelectItem(theme, "secondary", false), + hoveredItem: channelSelectItem(theme, "secondary", true), + activeItem: channelSelectItem(theme, "primary", false), + hoveredActiveItem: channelSelectItem(theme, "primary", true), + menu: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 4, + border: border(theme, "primary"), + shadow: shadow(theme), + }, + }, + signInPrompt: text(theme, "sans", "secondary", { underline: true }), + hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), + message, + pendingMessage: { + ...message, + body: { + ...message.body, + color: theme.textColor.muted.value, + }, + sender: { + ...message.sender, + color: theme.textColor.muted.value, + }, + timestamp: { + ...message.timestamp, + color: theme.textColor.muted.value, + }, + }, + inputEditor: { + background: backgroundColor(theme, 300), + cornerRadius: 6, + text: text(theme, "mono", "primary"), + placeholderText: text(theme, "mono", "muted"), + selection: player(theme, 1).selection, + border: border(theme, "primary"), + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + }; +} diff --git a/styles/components.ts b/styles/components.ts index 14becaf2af30e94d4c6d3a0250b0e3f3aab52faf..28d883927bb8f7d6f333a1cf8e45c1149910ba63 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -9,7 +9,11 @@ export function text( theme: Theme, fontFamily: keyof typeof core.fontFamily, color: TextColor, - properties?: { size?: keyof typeof core["fontSize"]; weight?: Weight } + properties?: { + size?: keyof typeof core["fontSize"]; + weight?: Weight; + underline?: boolean; + } ) { const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; const size = core.fontSize[sizeKey].value; @@ -74,7 +78,7 @@ export function backgroundColor( return theme.backgroundColor[name][state || "base"].value; } -export function shadow(theme) { +export function shadow(theme: Theme) { return { blur: 16, color: chroma("black").alpha(theme.shadowAlpha.value).hex(), From d88e20477df2cffa2b10b64dc65ce68066fd40f7 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 01:38:18 -0400 Subject: [PATCH 038/245] Update app.ts, editor.ts --- styles/app.ts | 63 +++++++++++++++++++------------------------- styles/components.ts | 4 +++ styles/editor.ts | 4 +-- styles/theme.ts | 12 +++++++++ styles/workspace.ts | 4 +-- 5 files changed, 47 insertions(+), 40 deletions(-) diff --git a/styles/app.ts b/styles/app.ts index 5f2993d30a68cad4410992387bf65a6d76c72a34..11e476baf73ec97e010288edcad2ce730299833b 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,10 +1,10 @@ -import { backgroundColor, text } from "./components"; -import selectorModal from "./selector-modal"; -import workspace from "./workspace"; +import chatPanel from "./chat-panel"; +import { backgroundColor, border, borderColor, player, text } from "./components"; import editor from "./editor"; -import Theme from "./theme"; import projectPanel from "./project-panel"; -import chatPanel from "./chat-panel"; +import selectorModal from "./selector-modal"; +import Theme from "./theme"; +import workspace from "./workspace"; export const panel = { padding: { top: 12, left: 12, bottom: 12, right: 12 }, @@ -35,27 +35,27 @@ export default function app(theme: Theme): Object { contactsPanel: { extends: "$panel", hostRowHeight: 28, - treeBranchColor: "$surface.100", + treeBranchColor: borderColor(theme, "muted"), treeBranchWidth: 1, hostAvatar: { cornerRadius: 10, width: 18, }, hostUsername: { - extends: "$text.primary", + ...text(theme, "mono", "muted"), padding: { left: 8, }, }, hoveredSharedProject: { - background: "$state.hover", - cornerRadius: 6, extends: "$contacts_panel.sharedProject", + background: theme.editor.line.active.value, + cornerRadius: 6, }, hoveredUnsharedProject: { - background: "$state.hover", - cornerRadius: 6, extends: "$contacts_panel.unsharedProject", + background: theme.editor.line.active.value, + cornerRadius: 6, }, project: { guestAvatarSpacing: 4, @@ -65,7 +65,7 @@ export default function app(theme: Theme): Object { width: 14, }, name: { - extends: "$text.secondary", + extends: text(theme, "mono", "secondary"), margin: { right: 6, }, @@ -77,7 +77,7 @@ export default function app(theme: Theme): Object { sharedProject: { extends: "$contactsPanel.project", name: { - color: "$text.primary.color", + color: text(theme, "mono", "primary"), }, }, unsharedProject: { @@ -86,28 +86,25 @@ export default function app(theme: Theme): Object { }, search: { background: backgroundColor(theme, 300), - matchBackground: "$state.highlightedLine", + matchBackground: theme.editor.highlight.match, tabIconSpacing: 4, tabIconWidth: 14, activeHoveredOptionButton: { - background: "$surface.100", extends: "$search.option_button", + background: backgroundColor(theme, 100), }, activeOptionButton: { - background: "$surface.100", extends: "$search.option_button", + background: backgroundColor(theme, 100), }, editor: { - background: "$surface.500", + background: backgroundColor(theme, 500), cornerRadius: 6, maxWidth: 400, - placeholderText: "$text.muted", - selection: "$selection.host", - text: "$text.primary", - border: { - color: "$border.primary", - width: 1, - }, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), margin: { bottom: 5, left: 5, @@ -122,28 +119,22 @@ export default function app(theme: Theme): Object { }, }, hoveredOptionButton: { - background: "$surface.100", extends: "$search.optionButton", + background: backgroundColor(theme, 100), }, invalidEditor: { extends: "$search.editor", - border: { - color: "$status.bad", - width: 1, - }, + border: border(theme, "error"), }, matchIndex: { - extends: "$text.secondary", + ...text(theme, "mono", "secondary"), padding: 6, }, optionButton: { + ...text(theme, "mono", "secondary"), background: backgroundColor(theme, 300), cornerRadius: 6, - extends: "$text.secondary", - border: { - color: "$border.primary", - width: 1, - }, + border: border(theme, "primary"), margin: { left: 1, right: 1, @@ -162,7 +153,7 @@ export default function app(theme: Theme): Object { }, }, resultsStatus: { - extends: "$text.primary", + ...text(theme, "mono", "primary"), size: 18, }, }, diff --git a/styles/components.ts b/styles/components.ts index 28d883927bb8f7d6f333a1cf8e45c1149910ba63..c8b2f87638a004365596f0ec11bab644580ed255 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -47,6 +47,10 @@ export function border( }; } +export function borderColor(theme: Theme, color: keyof Theme["borderColor"]) { + return theme.borderColor[color].value; +} + export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { return theme.iconColor[color].value; } diff --git a/styles/editor.ts b/styles/editor.ts index ea7012d2092ebd0d7df324762f4703693b32a89d..a27464eee2182ecfb0633623ff4e773cfb85b35d 100644 --- a/styles/editor.ts +++ b/styles/editor.ts @@ -4,7 +4,7 @@ import { iconColor, player, text, - TextColor, + TextColor } from "./components"; import Theme from "./theme"; @@ -89,7 +89,7 @@ export default function editor(theme: Theme) { diagnosticHeader: { background: theme.editor.background.value, iconWidthFactor: 1.5, - textScaleFactor: 0.857, + textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. border: border(theme, "secondary", { bottom: true, top: true, diff --git a/styles/theme.ts b/styles/theme.ts index 27f578f4366bacae8fdc5d4dc366375532e7f2b8..9d297d552d38b21154a77b2eed22d49a1ce2a247 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -71,6 +71,18 @@ export default interface Theme { active: { value: Color; }; + ok: { + value: Color; + }; + error: { + value: Color; + }; + warning: { + value: Color; + }; + info: { + value: Color; + }; }; textColor: { primary: { diff --git a/styles/workspace.ts b/styles/workspace.ts index 5ecb3a378c8d1a5acedc5100203c9b9306e36dca..1a50fe9ee1c248de6d48a9521efa9f9cc8f82fbb 100644 --- a/styles/workspace.ts +++ b/styles/workspace.ts @@ -42,8 +42,8 @@ export default function workspace(theme: Theme) { }; const sidebarItem = { - height: "$workspace.tab.height", - iconColor: "$text.muted.color", + height: 32, + iconColor: iconColor(theme, "secondary"), iconSize: 18, }; const sidebar = { From c008e65de6cfdae9b1a3f3fc73c53aeef1f790c6 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 11:27:02 -0400 Subject: [PATCH 039/245] Extract `search` from `app` - Also update border to use borderColor( ) --- styles/app.ts | 79 +++---------------------------------------- styles/components.ts | 2 +- styles/search.ts | 80 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 76 deletions(-) create mode 100644 styles/search.ts diff --git a/styles/app.ts b/styles/app.ts index 11e476baf73ec97e010288edcad2ce730299833b..a65442db0737630f77d1de92d921d934ed4a8804 100644 --- a/styles/app.ts +++ b/styles/app.ts @@ -1,7 +1,8 @@ import chatPanel from "./chat-panel"; -import { backgroundColor, border, borderColor, player, text } from "./components"; +import { backgroundColor, borderColor, text } from "./components"; import editor from "./editor"; import projectPanel from "./project-panel"; +import search from "./search"; import selectorModal from "./selector-modal"; import Theme from "./theme"; import workspace from "./workspace"; @@ -33,7 +34,7 @@ export default function app(theme: Theme): Object { projectPanel: projectPanel(theme), chatPanel: chatPanel(theme), contactsPanel: { - extends: "$panel", + ...panel, hostRowHeight: 28, treeBranchColor: borderColor(theme, "muted"), treeBranchWidth: 1, @@ -84,78 +85,6 @@ export default function app(theme: Theme): Object { extends: "$contactsPanel.project", }, }, - search: { - background: backgroundColor(theme, 300), - matchBackground: theme.editor.highlight.match, - tabIconSpacing: 4, - tabIconWidth: 14, - activeHoveredOptionButton: { - extends: "$search.option_button", - background: backgroundColor(theme, 100), - }, - activeOptionButton: { - extends: "$search.option_button", - background: backgroundColor(theme, 100), - }, - editor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - maxWidth: 400, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "primary"), - margin: { - bottom: 5, - left: 5, - right: 5, - top: 5, - }, - padding: { - bottom: 3, - left: 13, - right: 13, - top: 3, - }, - }, - hoveredOptionButton: { - extends: "$search.optionButton", - background: backgroundColor(theme, 100), - }, - invalidEditor: { - extends: "$search.editor", - border: border(theme, "error"), - }, - matchIndex: { - ...text(theme, "mono", "secondary"), - padding: 6, - }, - optionButton: { - ...text(theme, "mono", "secondary"), - background: backgroundColor(theme, 300), - cornerRadius: 6, - border: border(theme, "primary"), - margin: { - left: 1, - right: 1, - }, - padding: { - bottom: 1, - left: 6, - right: 6, - top: 1, - }, - }, - optionButtonGroup: { - padding: { - left: 2, - right: 2, - }, - }, - resultsStatus: { - ...text(theme, "mono", "primary"), - size: 18, - }, - }, + search: search(theme), }; } diff --git a/styles/components.ts b/styles/components.ts index c8b2f87638a004365596f0ec11bab644580ed255..590c1b5eea9f6779dee0c2697a781d36b3edee60 100644 --- a/styles/components.ts +++ b/styles/components.ts @@ -41,7 +41,7 @@ export function border( options?: BorderOptions ) { return { - color: theme.borderColor[color].value, + color: borderColor(theme, color), width: 1, ...options, }; diff --git a/styles/search.ts b/styles/search.ts new file mode 100644 index 0000000000000000000000000000000000000000..ced2266ea73480da11f880d4c56b4a65aa83f12c --- /dev/null +++ b/styles/search.ts @@ -0,0 +1,80 @@ +import { backgroundColor, border, player, text } from "./components"; +import Theme from "./theme"; + +export default function search(theme: Theme) { + const optionButton = { + ...text(theme, "mono", "secondary"), + background: backgroundColor(theme, 300), + cornerRadius: 6, + border: border(theme, "primary"), + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }; + + return { + background: backgroundColor(theme, 300), + matchBackground: theme.editor.highlight.match, + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + activeOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + editor: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + maxWidth: 400, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + margin: { + bottom: 5, + left: 5, + right: 5, + top: 5, + }, + padding: { + bottom: 3, + left: 13, + right: 13, + top: 3, + }, + }, + hoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + invalidEditor: { + extends: "$search.editor", + border: border(theme, "error"), + }, + matchIndex: { + ...text(theme, "mono", "secondary"), + padding: 6, + }, + optionButton, + optionButtonGroup: { + padding: { + left: 2, + right: 2, + }, + }, + resultsStatus: { + ...text(theme, "mono", "primary"), + size: 18, + }, + }; +} From ae8b610d85aac1d46782113ee1ad38a0650279af Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 19:10:44 -0400 Subject: [PATCH 040/245] WIP: Scaffold tokens in dark.ts, no real values yet. --- styles/dark.ts | 438 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 styles/dark.ts diff --git a/styles/dark.ts b/styles/dark.ts new file mode 100644 index 0000000000000000000000000000000000000000..019f50e40cec8ede5e62d2db37e97e691fbce8d6 --- /dev/null +++ b/styles/dark.ts @@ -0,0 +1,438 @@ +import Theme from "./theme"; + +export default function dark(): Theme { + return { + backgroundColor: { + 100: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + 300: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + 500: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + }, + borderColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + active: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + textColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + placeholder: { + value: "#000000", + }, + active: { + value: "#000000", + }, + feature: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + iconColor: { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + placeholder: { + value: "#000000", + }, + active: { + value: "#000000", + }, + feature: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, + }, + editor: { + background: { + value: "#000000", + }, + indent_guide: { + value: "#000000", + }, + indent_guide_active: { + value: "#000000", + }, + line: { + active: { + value: "#000000", + }, + highlighted: { + value: "#000000", + }, + inserted: { + value: "#000000", + }, + deleted: { + value: "#000000", + }, + modified: { + value: "#000000", + }, + }, + highlight: { + selection: { + value: "#000000", + }, + occurrence: { + value: "#000000", + }, + activeOccurrence: { + value: "#000000", + }, + matchingBracket: { + value: "#000000", + }, + match: { + value: "#000000", + }, + activeMatch: { + value: "#000000", + }, + related: { + value: "#000000", + }, + }, + gutter: { + primary: { + value: "#000000", + }, + active: { + value: "#000000", + }, + }, + }, + + syntax: { + primary: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + }, + player: { + 1: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 2: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 3: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 4: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 5: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 6: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 7: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + 8: { + baseColor: { + value: "#000000", + }, + cursorColor: { + value: "#000000", + }, + selectionColor: { + value: "#000000", + }, + borderColor: { + value: "#000000", + }, + }, + }, + shadowAlpha: { + value: 0.32, + }, + }; +} \ No newline at end of file From 083c1f7c0ea8fe94a794d31f3a583566fc8db905 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 20:32:47 -0400 Subject: [PATCH 041/245] WIP for keith --- styles/dark.ts | 880 +++++++++++++++++++++++++------------------------ 1 file changed, 449 insertions(+), 431 deletions(-) diff --git a/styles/dark.ts b/styles/dark.ts index 019f50e40cec8ede5e62d2db37e97e691fbce8d6..efd2d3b8a49b1b43c53b8ee782d13615c0f3e0d2 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -1,438 +1,456 @@ +import core from "./core"; import Theme from "./theme"; -export default function dark(): Theme { - return { - backgroundColor: { - 100: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - 300: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - 500: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - ok: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - error: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - warning: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, - info: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - }, +const backgroundColor = { + 100: { + base: { + value: core.color.neutral[999].value, }, - borderColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - textColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - placeholder: { - value: "#000000", - }, - active: { - value: "#000000", - }, - feature: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - iconColor: { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - placeholder: { - value: "#000000", - }, - active: { - value: "#000000", - }, - feature: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, - }, - editor: { - background: { - value: "#000000", - }, - indent_guide: { - value: "#000000", - }, - indent_guide_active: { - value: "#000000", - }, - line: { - active: { - value: "#000000", - }, - highlighted: { - value: "#000000", - }, - inserted: { - value: "#000000", - }, - deleted: { - value: "#000000", - }, - modified: { - value: "#000000", - }, - }, - highlight: { - selection: { - value: "#000000", - }, - occurrence: { - value: "#000000", - }, - activeOccurrence: { - value: "#000000", - }, - matchingBracket: { - value: "#000000", - }, - match: { - value: "#000000", - }, - activeMatch: { - value: "#000000", - }, - related: { - value: "#000000", - }, - }, - gutter: { - primary: { - value: "#000000", - }, - active: { - value: "#000000", - }, - }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 300: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 500: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, +}; - syntax: { - primary: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - comment: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - punctuation: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - constant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - keyword: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - function: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - type: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - variant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - property: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - enum: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - operator: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - string: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - number: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - boolean: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - predictive: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - }, - player: { - 1: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 2: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 3: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 4: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 5: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 6: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 7: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - 8: { - baseColor: { - value: "#000000", - }, - cursorColor: { - value: "#000000", - }, - selectionColor: { - value: "#000000", - }, - borderColor: { - value: "#000000", - }, - }, - }, - shadowAlpha: { - value: 0.32, +const borderColor = { + primary: { + value: "#000000", + }, + secondary: { + value: "#000000", + }, + muted: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + active: { + value: "#000000", + }, + ok: { + value: "#000000", + }, + error: { + value: "#000000", + }, + warning: { + value: "#000000", + }, + info: { + value: "#000000", + }, +}; + +const textColor = { + primary: { + value: core.color.neutral[150].value, + }, + secondary: { + value: core.color.neutral[350].value, + }, + muted: { + value: core.color.neutral[550].value, + }, + placeholder: { + value: core.color.neutral[750].value, + }, + active: { + value: core.color.neutral[0].value, + }, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, + }, + ok: { + value: core.color.green[600].value, + }, + error: { + value: core.color.red[400].value, + }, + warning: { + value: core.color.amber[300].value, + }, + info: { + value: core.color.blue[500].value, + }, +}; + +const iconColor = { + primary: { + value: core.color.neutral[300].value, + }, + secondary: { + value: core.color.neutral[500].value, + }, + muted: { + value: core.color.neutral[600].value, + }, + placeholder: { + value: core.color.neutral[700].value, + }, + active: { + value: core.color.neutral[50].value, + }, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, + }, + ok: { + value: core.color.green[600].value, + }, + error: { + value: core.color.red[400].value, + }, + warning: { + value: core.color.amber[300].value, + }, + info: { + value: core.color.blue[500].value, + }, +}; + +const editor = { + background: { + value: backgroundColor[500].base.value, + }, + indent_guide: { + value: core.color.neutral[999].value, + }, + indent_guide_active: { + value: core.color.neutral[999].value, + }, + line: { + active: { + value: core.color.neutral[999].value, + }, + highlighted: { + value: core.color.neutral[999].value, + }, + inserted: { + value: core.color.neutral[999].value, + }, + deleted: { + value: core.color.neutral[999].value, }, + modified: { + value: core.color.neutral[999].value, + }, + }, + highlight: { + selection: { + value: core.color.neutral[999].value, + }, + occurrence: { + value: core.color.neutral[999].value, + }, + activeOccurrence: { + value: core.color.neutral[999].value, + }, + matchingBracket: { + value: core.color.neutral[999].value, + }, + match: { + value: core.color.neutral[999].value, + }, + activeMatch: { + value: core.color.neutral[999].value, + }, + related: { + value: core.color.neutral[999].value, + }, + }, + gutter: { + primary: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + }, +}; + +const syntax = { + primary: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, + }, +}; + +const player = { + 1: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 2: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 3: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 4: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 5: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 6: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 7: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 8: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, +}; + +const shadowAlpha = { + value: 0.32, +}; + +export default function dark(): Theme { + return { + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -} \ No newline at end of file +} From 210eb2f6b141cfdbf7bb47a0cc74a25a7925a2ad Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 17:51:25 -0700 Subject: [PATCH 042/245] wip --- message.txt | 1672 ++++++++++++++++++++++++++++++++++++++++++++++++ styles/dark.ts | 780 +++++++++++----------- 2 files changed, 2063 insertions(+), 389 deletions(-) create mode 100644 message.txt diff --git a/message.txt b/message.txt new file mode 100644 index 0000000000000000000000000000000000000000..f086360d37f8ee060cb030b5f2026d7a81f4864c --- /dev/null +++ b/message.txt @@ -0,0 +1,1672 @@ +{ + "core": { + "color": { + "neutral": { + "0": { + "value": "#FFFFFF", + "type": "color" + }, + "50": { + "value": "#F8F8F8", + "type": "color" + }, + "100": { + "value": "#F0F0F0", + "type": "color" + }, + "150": { + "value": "#E1E1E1", + "type": "color" + }, + "200": { + "value": "#D2D2D2", + "type": "color" + }, + "250": { + "value": "#C3C3C3", + "type": "color" + }, + "300": { + "value": "#B4B4B4", + "type": "color" + }, + "350": { + "value": "#A5A5A5", + "type": "color" + }, + "400": { + "value": "#969696", + "type": "color" + }, + "450": { + "value": "#878787", + "type": "color" + }, + "500": { + "value": "#787878", + "type": "color" + }, + "550": { + "value": "#696969", + "type": "color" + }, + "600": { + "value": "#5A5A5A", + "type": "color" + }, + "650": { + "value": "#4B4B4B", + "type": "color" + }, + "700": { + "value": "#3C3C3C", + "type": "color" + }, + "750": { + "value": "#262626", + "type": "color" + }, + "800": { + "value": "#1E1E1E", + "type": "color" + }, + "850": { + "value": "#0F0F0F", + "type": "color" + }, + "900": { + "value": "#000000", + "type": "color" + } + }, + "steel": { + "0": { + "value": "#F8FAFC", + "type": "color" + }, + "100": { + "value": "#F1F5F9", + "type": "color" + }, + "200": { + "value": "#E2E8F0", + "type": "color" + }, + "300": { + "value": "#CBD5E1", + "type": "color" + }, + "400": { + "value": "#94A3BA", + "type": "color" + }, + "500": { + "value": "#64748B", + "type": "color" + }, + "600": { + "value": "#475569", + "type": "color" + }, + "700": { + "value": "#334155", + "type": "color" + }, + "800": { + "value": "#1E293B", + "type": "color" + }, + "900": { + "value": "#0F172A", + "type": "color" + } + }, + "gray": { + "0": { + "value": "#FAFAFA", + "type": "color" + }, + "100": { + "value": "#F4F4F5", + "type": "color" + }, + "200": { + "value": "#E4E4E7", + "type": "color" + }, + "300": { + "value": "#D4D4D8", + "type": "color" + }, + "400": { + "value": "#A1A1AA", + "type": "color" + }, + "500": { + "value": "#71717A", + "type": "color" + }, + "600": { + "value": "#52525B", + "type": "color" + }, + "700": { + "value": "#3F3F46", + "type": "color" + }, + "800": { + "value": "#27272A", + "type": "color" + }, + "900": { + "value": "#18181B", + "type": "color" + } + }, + "rose": { + "0": { + "value": "#FFF1F2", + "type": "color" + }, + "100": { + "value": "#FFE4E6", + "type": "color" + }, + "200": { + "value": "#FECDD3", + "type": "color" + }, + "300": { + "value": "#FDA4AF", + "type": "color" + }, + "400": { + "value": "#FB7185", + "type": "color" + }, + "500": { + "value": "#F43F5E", + "type": "color" + }, + "600": { + "value": "#E11D48", + "type": "color" + }, + "700": { + "value": "#BE123C", + "type": "color" + }, + "800": { + "value": "#9F1239", + "type": "color" + }, + "900": { + "value": "#881337", + "type": "color" + } + }, + "red": { + "0": { + "value": "#FEF2F2", + "type": "color" + }, + "100": { + "value": "#FEE2E2", + "type": "color" + }, + "200": { + "value": "#FECACA", + "type": "color" + }, + "300": { + "value": "#FCA5A5", + "type": "color" + }, + "400": { + "value": "#F87171", + "type": "color" + }, + "500": { + "value": "#EF4444", + "type": "color" + }, + "600": { + "value": "#DC2626", + "type": "color" + }, + "700": { + "value": "#B91C1C", + "type": "color" + }, + "800": { + "value": "#991B1B", + "type": "color" + }, + "900": { + "value": "#7F1D1D", + "type": "color" + } + }, + "orange": { + "0": { + "value": "#FFF7ED", + "type": "color" + }, + "100": { + "value": "#FFEDD5", + "type": "color" + }, + "200": { + "value": "#FED7AA", + "type": "color" + }, + "300": { + "value": "#FDBA74", + "type": "color" + }, + "400": { + "value": "#FB923C", + "type": "color" + }, + "500": { + "value": "#F97316", + "type": "color" + }, + "600": { + "value": "#EA580C", + "type": "color" + }, + "700": { + "value": "#C2410C", + "type": "color" + }, + "800": { + "value": "#9A3412", + "type": "color" + }, + "900": { + "value": "#7C2D12", + "type": "color" + } + }, + "amber": { + "0": { + "value": "#FFFBEB", + "type": "color" + }, + "100": { + "value": "#FEF3C7", + "type": "color" + }, + "200": { + "value": "#FDE68A", + "type": "color" + }, + "300": { + "value": "#FCD34D", + "type": "color" + }, + "400": { + "value": "#FBBF24", + "type": "color" + }, + "500": { + "value": "#F59E0B", + "type": "color" + }, + "600": { + "value": "#D97706", + "type": "color" + }, + "700": { + "value": "#B45309", + "type": "color" + }, + "800": { + "value": "#92400E", + "type": "color" + }, + "900": { + "value": "#78350F", + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#FEFCE8", + "type": "color" + }, + "100": { + "value": "#FEF9C3", + "type": "color" + }, + "200": { + "value": "#FEF08A", + "type": "color" + }, + "300": { + "value": "#FDE047", + "type": "color" + }, + "400": { + "value": "#FACC15", + "type": "color" + }, + "500": { + "value": "#EAB308", + "type": "color" + }, + "600": { + "value": "#CA8A04", + "type": "color" + }, + "700": { + "value": "#A16207", + "type": "color" + }, + "800": { + "value": "#854D0E", + "type": "color" + }, + "900": { + "value": "#713F12", + "type": "color" + } + }, + "lime": { + "0": { + "value": "#F7FEE7", + "type": "color" + }, + "100": { + "value": "#ECFCCB", + "type": "color" + }, + "200": { + "value": "#D9F99D", + "type": "color" + }, + "300": { + "value": "#BEF264", + "type": "color" + }, + "400": { + "value": "#A3E635", + "type": "color" + }, + "500": { + "value": "#84CC16", + "type": "color" + }, + "600": { + "value": "#65A30D", + "type": "color" + }, + "700": { + "value": "#4D7C0F", + "type": "color" + }, + "800": { + "value": "#3F6212", + "type": "color" + }, + "900": { + "value": "#365314", + "type": "color" + } + }, + "green": { + "0": { + "value": "#F0FDF4", + "type": "color" + }, + "100": { + "value": "#DCFCE7", + "type": "color" + }, + "200": { + "value": "#BBF7D0", + "type": "color" + }, + "300": { + "value": "#86EFAC", + "type": "color" + }, + "400": { + "value": "#4ADE80", + "type": "color" + }, + "500": { + "value": "#22C55E", + "type": "color" + }, + "600": { + "value": "#16A34A", + "type": "color" + }, + "700": { + "value": "#15803D", + "type": "color" + }, + "800": { + "value": "#166534", + "type": "color" + }, + "900": { + "value": "#14532D", + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ECFDF5", + "type": "color" + }, + "100": { + "value": "#D1FAE5", + "type": "color" + }, + "200": { + "value": "#A7F3D0", + "type": "color" + }, + "300": { + "value": "#6EE7B7", + "type": "color" + }, + "400": { + "value": "#34D399", + "type": "color" + }, + "500": { + "value": "#10B981", + "type": "color" + }, + "600": { + "value": "#059669", + "type": "color" + }, + "700": { + "value": "#047857", + "type": "color" + }, + "800": { + "value": "#065F46", + "type": "color" + }, + "900": { + "value": "#064E3B", + "type": "color" + } + }, + "teal": { + "0": { + "value": "#F0FDFA", + "type": "color" + }, + "100": { + "value": "#CCFBF1", + "type": "color" + }, + "200": { + "value": "#99F6E4", + "type": "color" + }, + "300": { + "value": "#5EEAD4", + "type": "color" + }, + "400": { + "value": "#2DD4BF", + "type": "color" + }, + "500": { + "value": "#14B8A6", + "type": "color" + }, + "600": { + "value": "#0D9488", + "type": "color" + }, + "700": { + "value": "#0F766E", + "type": "color" + }, + "800": { + "value": "#115E59", + "type": "color" + }, + "900": { + "value": "#134E4A", + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ECFEFF", + "type": "color" + }, + "100": { + "value": "#CFFAFE", + "type": "color" + }, + "200": { + "value": "#A5F3FC", + "type": "color" + }, + "300": { + "value": "#67E8F9", + "type": "color" + }, + "400": { + "value": "#22D3EE", + "type": "color" + }, + "500": { + "value": "#06BBD4", + "type": "color" + }, + "600": { + "value": "#0891B2", + "type": "color" + }, + "700": { + "value": "#0E7490", + "type": "color" + }, + "800": { + "value": "#155E75", + "type": "color" + }, + "900": { + "value": "#164E63", + "type": "color" + } + }, + "sky": { + "0": { + "value": "#F0F9FF", + "type": "color" + }, + "100": { + "value": "#E0F2FE", + "type": "color" + }, + "200": { + "value": "#BAE6FD", + "type": "color" + }, + "300": { + "value": "#7DD3FC", + "type": "color" + }, + "400": { + "value": "#38BDF8", + "type": "color" + }, + "500": { + "value": "#0EA5E9", + "type": "color" + }, + "600": { + "value": "#0284C7", + "type": "color" + }, + "700": { + "value": "#0369A1", + "type": "color" + }, + "800": { + "value": "#075985", + "type": "color" + }, + "900": { + "value": "#0C4A6E", + "type": "color" + } + }, + "blue": { + "0": { + "value": "#EFF6FF", + "type": "color" + }, + "100": { + "value": "#DBEAFE", + "type": "color" + }, + "200": { + "value": "#BFDBFE", + "type": "color" + }, + "300": { + "value": "#93C5FD", + "type": "color" + }, + "400": { + "value": "#60A5FA", + "type": "color" + }, + "500": { + "value": "#3B82F6", + "type": "color" + }, + "600": { + "value": "#2563EB", + "type": "color" + }, + "700": { + "value": "#1D4ED8", + "type": "color" + }, + "800": { + "value": "#1E40A4", + "type": "color" + }, + "900": { + "value": "#1E3A8A", + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#EEF2FF", + "type": "color" + }, + "100": { + "value": "#E0E7FF", + "type": "color" + }, + "200": { + "value": "#C7D2FE", + "type": "color" + }, + "300": { + "value": "#A5B4FC", + "type": "color" + }, + "400": { + "value": "#818CF8", + "type": "color" + }, + "500": { + "value": "#6366F1", + "type": "color" + }, + "600": { + "value": "#4F46E5", + "type": "color" + }, + "700": { + "value": "#4338CA", + "type": "color" + }, + "800": { + "value": "#3730A3", + "type": "color" + }, + "900": { + "value": "#312E81", + "type": "color" + } + }, + "violet": { + "0": { + "value": "#F5F3FF", + "type": "color" + }, + "100": { + "value": "#EDE9FE", + "type": "color" + }, + "200": { + "value": "#DDD6FE", + "type": "color" + }, + "300": { + "value": "#C4B5FD", + "type": "color" + }, + "400": { + "value": "#A78BFA", + "type": "color" + }, + "500": { + "value": "#8B5CF6", + "type": "color" + }, + "600": { + "value": "#7C3AED", + "type": "color" + }, + "700": { + "value": "#6D28D9", + "type": "color" + }, + "800": { + "value": "#5B21B6", + "type": "color" + }, + "900": { + "value": "#4C1D95", + "type": "color" + } + }, + "purple": { + "0": { + "value": "#FAF5FF", + "type": "color" + }, + "100": { + "value": "#F3E8FF", + "type": "color" + }, + "200": { + "value": "#E9D5FF", + "type": "color" + }, + "300": { + "value": "#D8B4FE", + "type": "color" + }, + "400": { + "value": "#C084FC", + "type": "color" + }, + "500": { + "value": "#A855F7", + "type": "color" + }, + "600": { + "value": "#9333EA", + "type": "color" + }, + "700": { + "value": "#7E22CE", + "type": "color" + }, + "800": { + "value": "#6B21A8", + "type": "color" + }, + "900": { + "value": "#581C87", + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#FDF4FF", + "type": "color" + }, + "100": { + "value": "#FAE8FF", + "type": "color" + }, + "200": { + "value": "#F5D0FE", + "type": "color" + }, + "300": { + "value": "#F0ABFC", + "type": "color" + }, + "400": { + "value": "#E879F9", + "type": "color" + }, + "500": { + "value": "#D946E4", + "type": "color" + }, + "600": { + "value": "#C026D3", + "type": "color" + }, + "700": { + "value": "#A21CAF", + "type": "color" + }, + "800": { + "value": "#86198F", + "type": "color" + }, + "900": { + "value": "#701A75", + "type": "color" + } + }, + "pink": { + "0": { + "value": "#FDF2F8", + "type": "color" + }, + "100": { + "value": "#FCE7F3", + "type": "color" + }, + "200": { + "value": "#FBCFE8", + "type": "color" + }, + "300": { + "value": "#F988D4", + "type": "color" + }, + "400": { + "value": "#F472B6", + "type": "color" + }, + "500": { + "value": "#EC4899", + "type": "color" + }, + "600": { + "value": "#DB2777", + "type": "color" + }, + "700": { + "value": "#BE185D", + "type": "color" + }, + "800": { + "value": "#9D174D", + "type": "color" + }, + "900": { + "value": "#831843", + "type": "color" + } + } + }, + "font-weight": { + "normal": { + "100": { + "value": "Thin", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "normal-bold": { + "100": { + "value": "Thin", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "italic": { + "100": { + "value": "Thin Italic", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + }, + "italic-bold": { + "100": { + "value": "Thin Italic", + "type": "fontWeights" + }, + "200": { + "value": "Light", + "type": "fontWeights" + }, + "400": { + "value": "Regular", + "type": "fontWeights" + }, + "500": { + "value": "Semibold", + "type": "fontWeights" + }, + "600": { + "value": "Bold", + "type": "fontWeights" + }, + "800": { + "value": "Heavy", + "type": "fontWeights" + } + } + }, + "font-family": { + "zed-mono": { + "value": "Zed Mono", + "type": "fontFamilies" + }, + "zed-sans": { + "value": "Zed Sans", + "type": "fontFamilies" + } + }, + "font-size": { + "3xs": { + "value": "8", + "type": "fontSizes" + }, + "2xs": { + "value": "10", + "type": "fontSizes" + }, + "xs": { + "value": "12", + "type": "fontSizes" + }, + "sm": { + "value": "14", + "type": "fontSizes" + }, + "base": { + "value": "16", + "type": "fontSizes" + }, + "lg": { + "value": "18", + "type": "fontSizes" + }, + "xl": { + "value": "20", + "type": "fontSizes" + } + }, + "leading": { + "xs": { + "value": "16", + "type": "lineHeights" + }, + "sm": { + "value": "20", + "type": "lineHeights" + }, + "base": { + "value": "24", + "type": "lineHeights" + }, + "lg": { + "value": "26", + "type": "lineHeights" + }, + "xl": { + "value": "28", + "type": "lineHeights" + }, + "2xl": { + "value": "30", + "type": "lineHeights" + } + }, + "text-decoration": { + "none": { + "value": "none", + "type": "textDecoration" + } + }, + "ui-text": { + "normal": { + "base": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.sm}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography", + "bold": { + "value": { + "fontFamily": "$text.family.zed-sans", + "fontWeight": "$text.weight.bold", + "lineHeight": "$text.leading.base", + "fontSize": "$text.size.xs", + "letterSpacing": "$text.tracking.default", + "paragraphSpacing": "$text.paragraphSpacing.0", + "textCase": "$text.case.default", + "decoration": "$text.decoration.none", + "textDecoration": "$text.decoration.none" + }, + "type": "typography" + } + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography", + "bold": { + "value": { + "fontFamily": "$text.family.zed-sans", + "fontWeight": "$text.weight.bold", + "lineHeight": "$text.leading.base", + "fontSize": "$text.size.xs", + "letterSpacing": "$text.tracking.default", + "paragraphSpacing": "$text.paragraphSpacing.0", + "textCase": "$text.case.default", + "decoration": "$text.decoration.none", + "textDecoration": "$text.decoration.none" + }, + "type": "typography" + } + } + }, + "bold": { + "base": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.600", + "lineHeight": "{leading.base}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.sm}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-sans}", + "fontWeight": "$font-weight.normal.600", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + } + } + }, + "buffer-text": { + "normal": { + "xs": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.xs}", + "fontSize": "{font-size.xs}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "sm": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.sm}", + "fontSize": "{font-size.sm}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "{text-decoration.none}" + }, + "type": "typography" + }, + "base": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.lg}", + "fontSize": "{font-size.base}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "$text.decoration.default" + }, + "type": "typography" + }, + "lg": { + "value": { + "fontFamily": "{font-family.zed-mono}", + "fontWeight": "$font-weight.normal.400", + "lineHeight": "{leading.lg}", + "fontSize": "{font-size.lg}", + "letterSpacing": "{letter-spacing.base}", + "paragraphSpacing": "{paragraph-spacing.default}", + "textCase": "{text-case.default}", + "decoration": "{text-decoration.none}", + "textDecoration": "$text.decoration.default" + }, + "type": "typography" + } + } + }, + "letter-spacing": { + "tight": { + "value": "-0.05", + "type": "letterSpacing" + }, + "base": { + "value": "0%", + "type": "letterSpacing" + }, + "wide": { + "value": "0.05", + "type": "letterSpacing" + } + }, + "paragraph-spacing": { + "default": { + "value": "0", + "type": "paragraphSpacing" + } + }, + "text-case": { + "default": { + "value": "none", + "type": "textCase" + }, + "lowercase": { + "value": "lowercase", + "type": "textCase" + }, + "uppercase": { + "value": "uppercase", + "type": "textCase" + } + }, + "space": { + "s-0": { + "value": "0", + "type": "spacing" + }, + "s-4": { + "value": "{var.base}", + "type": "spacing" + }, + "s-8": { + "value": "{var.base} * 2", + "type": "spacing" + }, + "s-12": { + "value": "{var.base} * 3", + "type": "spacing" + }, + "s-16": { + "value": "{var.base} * 4", + "type": "spacing" + } + }, + "internal": { + "mac-os": { + "red": { + "value": "#FF5E57", + "type": "color" + }, + "yellow": { + "value": "#FFBB2E", + "type": "color" + }, + "green": { + "value": "#38C149", + "type": "color" + } + } + }, + "border-radius": { + "xs": { + "value": "2", + "type": "borderRadius" + }, + "sm": { + "value": "4", + "type": "borderRadius" + }, + "base": { + "value": "6", + "type": "borderRadius" + }, + "lg": { + "value": "8", + "type": "borderRadius" + }, + "xl": { + "value": "10", + "type": "borderRadius" + } + }, + "border-width": { + "base": { + "value": "1", + "type": "borderWidth" + } + }, + "elevation": { + "300": { + "value": { + "x": "0", + "y": "4", + "blur": "12", + "spread": "0", + "color": "rgba({color.neutral.900}, {shadow.base})", + "type": "dropShadow" + }, + "type": "boxShadow" + } + }, + "var": { + "base": { + "value": "4", + "type": "other" + } + } + }, + "dark": { + "text-color": { + "primary": { + "value": "{color.neutral.150}", + "type": "color" + }, + "secondary": { + "value": "{color.neutral.350}", + "type": "color" + }, + "muted": { + "value": "{color.neutral.550}", + "type": "color" + }, + "minimal": { + "value": "{color.neutral.750}", + "type": "color" + }, + "active": { + "value": "{color.neutral.0}", + "type": "color" + }, + "disabled": { + "value": "{color.neutral.650}", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "icon-color": { + "primary": { + "value": "{text.secondary}", + "type": "color" + }, + "secondary": { + "value": "{text.muted}", + "type": "color" + }, + "active": { + "value": "{text.active}", + "type": "color" + }, + "disabled": { + "value": "{text.disabled}", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "icon-size": { + "default": { + "value": "16", + "type": "size" + } + }, + "background-color": { + "100": { + "value": "{color.neutral.750}", + "type": "color", + "description": "The app background. Used for title-bar, other daylight." + }, + "300": { + "value": "{color.neutral.800}", + "type": "color", + "description": "The primary surface layer. Used for tabs, panels, pop-overs, etc." + }, + "500": { + "value": "{color.neutral.900}", + "type": "color", + "description": "Used for the buffer background and active buffer tabs." + }, + "active": { + "value": "rgba({icon.active}}, 0.1)", + "type": "color" + }, + "focused": { + "value": "// wip", + "type": "color" + }, + "disabled": { + "value": "// wip", + "type": "color" + }, + "positive": { + "value": "{color.green.600}", + "type": "color" + }, + "negative": { + "value": "{color.red.400}", + "type": "color" + }, + "warning": { + "value": "{color.amber.300}", + "type": "color" + }, + "info": { + "value": "{color.blue.500}", + "type": "color" + } + }, + "border-color": { + "default": { + "value": "{color.neutral.850}", + "type": "color" + }, + "secondary": { + "value": "{color.neutral.700}", + "type": "color" + }, + "minimal": { + "value": "{color.neutral.750}", + "type": "color" + }, + "active": { + "value": "{color.neutral.500}", + "type": "color" + }, + "focused": { + "value": "{color.neutral.100}", + "type": "color" + } + }, + "editor": { + "background-color": { + "value": "{surface.500}", + "type": "color" + }, + "indent-guide": { + "value": "{icon.disabled}", + "type": "color" + }, + "indent-guide-active": { + "value": "{icon.secondary}", + "type": "color" + }, + "highlight": { + "active-line": { + "value": "rgba({color.neutral.0}, 0.08)", + "type": "color" + }, + "selection": { + "value": "{player.selection.one}", + "type": "color" + }, + "folded-line": { + "value": "rgba({surface.500}, 0.03)", + "type": "color" + }, + "occurrence": { + "value": "rgba({text.active}, 0.15)", + "type": "color" + }, + "matching-bracket": { + "value": "rgba({color.indigo.500}, 0.8)", + "type": "color" + }, + "match": { + "value": "rgba({color.blue.500},0.5)", + "type": "color" + }, + "active-match": { + "value": "rgba({color.blue.500},0.8)", + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "{text.muted}", + "type": "color" + }, + "active": { + "value": "{text.active}", + "type": "color" + } + }, + "syntax": { + "primary": { + "value": "{text.primary}", + "type": "color" + }, + "comment": { + "value": "{color.lime.200}", + "type": "color" + }, + "punctuation": { + "value": "{text.secondary}", + "type": "color" + }, + "constant": { + "value": "{syntax.primary}", + "type": "color" + }, + "keyword": { + "value": "{color.sky.400}", + "type": "color" + }, + "function": { + "value": "{color.yellow.200}", + "type": "color" + }, + "type": { + "value": "{color.teal.300}", + "type": "color" + }, + "variant": { + "value": "{syntax.type}", + "type": "color" + }, + "property": { + "value": "{color.sky.300}", + "type": "color" + }, + "enum": { + "value": "{syntax.operator}", + "type": "color" + }, + "operator": { + "value": "{syntax.keyword}", + "type": "color" + }, + "string": { + "value": "{color.orange.300}", + "type": "color" + }, + "number": { + "value": "{syntax.primary}", + "type": "color" + }, + "boolean": { + "value": "{syntax.number}", + "type": "color" + }, + "predictive": { + "value": "{text.muted}", + "type": "color" + } + } + }, + "player": { + "color": { + "1": { + "value": "{color.blue.600}", + "type": "color" + }, + "2": { + "value": "{color.indigo.500}", + "type": "color" + }, + "3": { + "value": "{color.green.500}", + "type": "color" + }, + "4": { + "value": "{color.orange.500}", + "type": "color" + }, + "5": { + "value": "{color.purple.500}", + "type": "color" + }, + "6": { + "value": "{color.teal.400}", + "type": "color" + }, + "7": { + "value": "{color.pink.400}", + "type": "color" + }, + "8": { + "value": "{color.yellow.400}", + "type": "color" + } + }, + "selection": { + "1": { + "value": "rgba({color.blue.600},0.1)", + "type": "color" + }, + "2": { + "value": "rgba({color.indigo.500}, 0.1)", + "type": "color" + }, + "3": { + "value": "rgba({color.green.500}, 0.1)", + "type": "color" + }, + "4": { + "value": "rgba({color.orange.500}, 0.15)", + "type": "color" + }, + "5": { + "value": "rgba({color.purple.500}, 0.1)", + "type": "color" + }, + "6": { + "value": "rgba({color.teal.400}, 0.1)", + "type": "color" + }, + "7": { + "value": "rgba({color.pink.400}, 0.1)", + "type": "color" + }, + "8": { + "value": "rgba({color.yellow.400}, 0.15)", + "type": "color" + } + } + }, + "shadow": { + "base": { + "value": "0.36", + "type": "opacity" + } + } + } +} \ No newline at end of file diff --git a/styles/dark.ts b/styles/dark.ts index efd2d3b8a49b1b43c53b8ee782d13615c0f3e0d2..bfcac3db816697fdb537860e7ed8a4e981ccd860 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -2,455 +2,457 @@ import core from "./core"; import Theme from "./theme"; const backgroundColor = { - 100: { - base: { - value: core.color.neutral[999].value, + 100: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 300: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + focused: { + value: core.color.neutral[999].value, + }, + }, + 500: { + base: { + value: core.color.neutral[999].value, + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + ok: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + error: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + warning: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, + }, + info: { + base: { + value: "#000000", + }, + hovered: { + value: "#000000", + }, + active: { + value: "#000000", + }, + focused: { + value: "#000000", + }, }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, - }, - 300: { - base: { - value: core.color.neutral[999].value, +}; + +const borderColor = { + primary: { + value: "#000000", }, - hovered: { - value: core.color.neutral[999].value, + secondary: { + value: "#000000", }, - active: { - value: core.color.neutral[999].value, + muted: { + value: "#000000", }, focused: { - value: core.color.neutral[999].value, - }, - }, - 500: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: "#000000", + value: "#000000", }, active: { - value: "#000000", - }, - focused: { - value: "#000000", + value: "#000000", }, - }, - ok: { - base: { - value: "#000000", + ok: { + value: "#000000", }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", + error: { + value: "#000000", }, - }, - error: { - base: { - value: "#000000", + warning: { + value: "#000000", }, - hovered: { - value: "#000000", + info: { + value: "#000000", }, - active: { - value: "#000000", +}; + +const textColor = { + primary: { + value: core.color.neutral[150].value, }, - focused: { - value: "#000000", + secondary: { + value: core.color.neutral[350].value, }, - }, - warning: { - base: { - value: "#000000", + muted: { + value: core.color.neutral[550].value, }, - hovered: { - value: "#000000", + placeholder: { + value: core.color.neutral[750].value, }, active: { - value: "#000000", + value: core.color.neutral[0].value, }, - focused: { - value: "#000000", + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, }, - }, - info: { - base: { - value: "#000000", + ok: { + value: core.color.green[600].value, }, - hovered: { - value: "#000000", + error: { + value: core.color.red[400].value, }, - active: { - value: "#000000", + warning: { + value: core.color.amber[300].value, }, - focused: { - value: "#000000", + info: { + value: core.color.blue[500].value, }, - }, -}; - -const borderColor = { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, -}; - -const textColor = { - primary: { - value: core.color.neutral[150].value, - }, - secondary: { - value: core.color.neutral[350].value, - }, - muted: { - value: core.color.neutral[550].value, - }, - placeholder: { - value: core.color.neutral[750].value, - }, - active: { - value: core.color.neutral[0].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, }; const iconColor = { - primary: { - value: core.color.neutral[300].value, - }, - secondary: { - value: core.color.neutral[500].value, - }, - muted: { - value: core.color.neutral[600].value, - }, - placeholder: { - value: core.color.neutral[700].value, - }, - active: { - value: core.color.neutral[50].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, -}; - -const editor = { - background: { - value: backgroundColor[500].base.value, - }, - indent_guide: { - value: core.color.neutral[999].value, - }, - indent_guide_active: { - value: core.color.neutral[999].value, - }, - line: { - active: { - value: core.color.neutral[999].value, - }, - highlighted: { - value: core.color.neutral[999].value, - }, - inserted: { - value: core.color.neutral[999].value, - }, - deleted: { - value: core.color.neutral[999].value, - }, - modified: { - value: core.color.neutral[999].value, + primary: { + value: core.color.neutral[300].value, }, - }, - highlight: { - selection: { - value: core.color.neutral[999].value, + secondary: { + value: core.color.neutral[500].value, }, - occurrence: { - value: core.color.neutral[999].value, + muted: { + value: core.color.neutral[600].value, }, - activeOccurrence: { - value: core.color.neutral[999].value, + placeholder: { + value: core.color.neutral[700].value, }, - matchingBracket: { - value: core.color.neutral[999].value, + active: { + value: core.color.neutral[50].value, }, - match: { - value: core.color.neutral[999].value, + feature: { + //TODO: (design) define feature and it's correct value + value: core.color.sky[500].value, }, - activeMatch: { - value: core.color.neutral[999].value, + ok: { + value: core.color.green[600].value, }, - related: { - value: core.color.neutral[999].value, + error: { + value: core.color.red[400].value, }, - }, - gutter: { - primary: { - value: core.color.neutral[999].value, + warning: { + value: core.color.amber[300].value, }, - active: { - value: core.color.neutral[999].value, + info: { + value: core.color.blue[500].value, }, - }, }; -const syntax = { - primary: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - comment: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - punctuation: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - constant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - keyword: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - function: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - type: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - variant: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - property: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - enum: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - operator: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - string: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - number: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - boolean: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, - predictive: { - color: { value: "000000" }, - weight: { value: "normal" }, - }, +const editor = { + background: { + value: backgroundColor[500].base.value, + }, + indent_guide: { + value: core.color.neutral[999].value, + }, + indent_guide_active: { + value: core.color.neutral[999].value, + }, + line: { + active: { + value: core.color.neutral[999].value, + }, + highlighted: { + value: core.color.neutral[999].value, + }, + inserted: { + value: core.color.neutral[999].value, + }, + deleted: { + value: core.color.neutral[999].value, + }, + modified: { + value: core.color.neutral[999].value, + }, + }, + highlight: { + selection: { + value: core.color.neutral[999].value, + }, + occurrence: { + value: core.color.neutral[999].value, + }, + activeOccurrence: { + value: core.color.neutral[999].value, + }, + matchingBracket: { + value: core.color.neutral[999].value, + }, + match: { + value: core.color.neutral[999].value, + }, + activeMatch: { + value: core.color.neutral[999].value, + }, + related: { + value: core.color.neutral[999].value, + }, + }, + gutter: { + primary: { + value: core.color.neutral[999].value, + }, + active: { + value: core.color.neutral[999].value, + }, + }, }; -const player = { - 1: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 2: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 3: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 4: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, - }, - 5: { - baseColor: { - value: core.color.neutral[999].value, +const syntax = { + primary: { + color: { + value: core.color.neutral[150] + }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + comment: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + punctuation: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + constant: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 6: { - baseColor: { - value: core.color.neutral[999].value, + keyword: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + function: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + type: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + variant: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 7: { - baseColor: { - value: core.color.neutral[999].value, + property: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + enum: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + operator: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, + string: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - }, - 8: { - baseColor: { - value: core.color.neutral[999].value, + number: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - cursorColor: { - value: core.color.neutral[999].value, + boolean: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - selectionColor: { - value: core.color.neutral[999].value, + predictive: { + color: { value: "000000" }, + weight: { value: "normal" }, }, - borderColor: { - value: core.color.neutral[999].value, +}; + +const player = { + 1: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 2: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 3: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 4: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 5: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 6: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 7: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, + }, + 8: { + baseColor: { + value: core.color.neutral[999].value, + }, + cursorColor: { + value: core.color.neutral[999].value, + }, + selectionColor: { + value: core.color.neutral[999].value, + }, + borderColor: { + value: core.color.neutral[999].value, + }, }, - }, }; const shadowAlpha = { - value: 0.32, + value: 0.32, }; export default function dark(): Theme { - return { - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, - }; + return { + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, + }; } From f11e0aeda936b60ff42578e82a4a6cca43eb5813 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 19:05:21 -0700 Subject: [PATCH 043/245] wip --- styles/core.ts | 102 +++++------ styles/dark.ts | 462 +++++++++++++----------------------------------- styles/theme.ts | 358 ++++++++++++++----------------------- 3 files changed, 307 insertions(+), 615 deletions(-) diff --git a/styles/core.ts b/styles/core.ts index e9e81982e456c0ffe151b83ac36767d62140c6ba..49e376b4ebf81968b2681179be46b3c5b27055b6 100644 --- a/styles/core.ts +++ b/styles/core.ts @@ -1,58 +1,58 @@ import { colorRamp } from "./lib"; export default { - fontFamily: { - sans: "Zed Sans", - mono: "Zed Mono", - }, - fontSize: { - "3xs": { - value: "8", - type: "fontSizes", + fontFamily: { + sans: "Zed Sans", + mono: "Zed Mono", }, - "2xs": { - value: "10", - type: "fontSizes", + fontSize: { + "3xs": { + value: "8", + type: "fontSizes", + }, + "2xs": { + value: "10", + type: "fontSizes", + }, + xs: { + value: "12", + type: "fontSizes", + }, + sm: { + value: "14", + type: "fontSizes", + }, + md: { + value: "16", + type: "fontSizes", + }, + lg: { + value: "18", + type: "fontSizes", + }, + xl: { + value: "20", + type: "fontSizes", + }, }, - xs: { - value: "12", - type: "fontSizes", + color: { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), }, - sm: { - value: "14", - type: "fontSizes", - }, - md: { - value: "16", - type: "fontSizes", - }, - lg: { - value: "18", - type: "fontSizes", - }, - xl: { - value: "20", - type: "fontSizes", - }, - }, - color: { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), - rose: colorRamp("#F43F5EFF"), - red: colorRamp("#EF4444FF"), - orange: colorRamp("#F97316FF"), - amber: colorRamp("#F59E0BFF"), - yellow: colorRamp("#EAB308FF"), - lime: colorRamp("#84CC16FF"), - green: colorRamp("#22C55EFF"), - emerald: colorRamp("#10B981FF"), - teal: colorRamp("#14B8A6FF"), - cyan: colorRamp("#06BBD4FF"), - sky: colorRamp("#0EA5E9FF"), - blue: colorRamp("#3B82F6FF"), - indigo: colorRamp("#6366F1FF"), - violet: colorRamp("#8B5CF6FF"), - purple: colorRamp("#A855F7FF"), - fuschia: colorRamp("#D946E4FF"), - pink: colorRamp("#EC4899FF"), - }, }; diff --git a/styles/dark.ts b/styles/dark.ts index bfcac3db816697fdb537860e7ed8a4e981ccd860..5b60bd0316a53fc24a830e23d428088675ac45de 100644 --- a/styles/dark.ts +++ b/styles/dark.ts @@ -1,442 +1,230 @@ import core from "./core"; import Theme from "./theme"; +const { color } = core; + const backgroundColor = { 100: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], }, 300: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, - focused: { - value: core.color.neutral[999].value, - }, + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], }, 500: { - base: { - value: core.color.neutral[999].value, - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], }, ok: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], }, error: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], }, warning: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], }, info: { - base: { - value: "#000000", - }, - hovered: { - value: "#000000", - }, - active: { - value: "#000000", - }, - focused: { - value: "#000000", - }, + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], }, }; const borderColor = { - primary: { - value: "#000000", - }, - secondary: { - value: "#000000", - }, - muted: { - value: "#000000", - }, - focused: { - value: "#000000", - }, - active: { - value: "#000000", - }, - ok: { - value: "#000000", - }, - error: { - value: "#000000", - }, - warning: { - value: "#000000", - }, - info: { - value: "#000000", - }, + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[999], + error: color.neutral[999], + warning: color.neutral[999], + info: color.neutral[999], }; const textColor = { - primary: { - value: core.color.neutral[150].value, - }, - secondary: { - value: core.color.neutral[350].value, - }, - muted: { - value: core.color.neutral[550].value, - }, - placeholder: { - value: core.color.neutral[750].value, - }, - active: { - value: core.color.neutral[0].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: { - value: core.color.neutral[300].value, - }, - secondary: { - value: core.color.neutral[500].value, - }, - muted: { - value: core.color.neutral[600].value, - }, - placeholder: { - value: core.color.neutral[700].value, - }, - active: { - value: core.color.neutral[50].value, - }, - feature: { - //TODO: (design) define feature and it's correct value - value: core.color.sky[500].value, - }, - ok: { - value: core.color.green[600].value, - }, - error: { - value: core.color.red[400].value, - }, - warning: { - value: core.color.amber[300].value, - }, - info: { - value: core.color.blue[500].value, - }, + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const editor = { - background: { - value: backgroundColor[500].base.value, - }, - indent_guide: { - value: core.color.neutral[999].value, - }, - indent_guide_active: { - value: core.color.neutral[999].value, - }, + background: backgroundColor[500].base, + indent_guide: color.neutral[999], + indent_guide_active: color.neutral[999], line: { - active: { - value: core.color.neutral[999].value, - }, - highlighted: { - value: core.color.neutral[999].value, - }, - inserted: { - value: core.color.neutral[999].value, - }, - deleted: { - value: core.color.neutral[999].value, - }, - modified: { - value: core.color.neutral[999].value, - }, + active: color.neutral[999], + highlighted: color.neutral[999], + inserted: color.neutral[999], + deleted: color.neutral[999], + modified: color.neutral[999], }, highlight: { - selection: { - value: core.color.neutral[999].value, - }, - occurrence: { - value: core.color.neutral[999].value, - }, - activeOccurrence: { - value: core.color.neutral[999].value, - }, - matchingBracket: { - value: core.color.neutral[999].value, - }, - match: { - value: core.color.neutral[999].value, - }, - activeMatch: { - value: core.color.neutral[999].value, - }, - related: { - value: core.color.neutral[999].value, - }, + selection: color.neutral[999], + occurrence: color.neutral[999], + activeOccurrence: color.neutral[999], + matchingBracket: color.neutral[999], + match: color.neutral[999], + activeMatch: color.neutral[999], + related: color.neutral[999], }, gutter: { - primary: { - value: core.color.neutral[999].value, - }, - active: { - value: core.color.neutral[999].value, - }, + primary: color.neutral[999], + active: color.neutral[999], }, }; const syntax = { primary: { - color: { - value: core.color.neutral[150] - }, + color: textColor.primary, weight: { value: "normal" }, }, comment: { - color: { value: "000000" }, + color: color.lime[200], weight: { value: "normal" }, }, punctuation: { - color: { value: "000000" }, + color: textColor.primary, weight: { value: "normal" }, }, constant: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, keyword: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, function: { - color: { value: "000000" }, + color: color.yellow[200], weight: { value: "normal" }, }, type: { - color: { value: "000000" }, + color: color.teal[300], weight: { value: "normal" }, }, variant: { - color: { value: "000000" }, + color: color.teal[300], weight: { value: "normal" }, }, property: { - color: { value: "000000" }, + color: color.sky[300], weight: { value: "normal" }, }, enum: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, operator: { - color: { value: "000000" }, + color: color.sky[400], weight: { value: "normal" }, }, string: { - color: { value: "000000" }, + color: color.orange[300], weight: { value: "normal" }, }, number: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, boolean: { - color: { value: "000000" }, + color: color.neutral[150], weight: { value: "normal" }, }, predictive: { - color: { value: "000000" }, + color: textColor.muted, weight: { value: "normal" }, }, }; const player = { 1: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], }, 2: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], }, 3: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], }, 4: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], }, 5: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], }, 6: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], }, 7: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], }, 8: { - baseColor: { - value: core.color.neutral[999].value, - }, - cursorColor: { - value: core.color.neutral[999].value, - }, - selectionColor: { - value: core.color.neutral[999].value, - }, - borderColor: { - value: core.color.neutral[999].value, - }, + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], }, }; diff --git a/styles/theme.ts b/styles/theme.ts index 9d297d552d38b21154a77b2eed22d49a1ce2a247..9d70ea0227053f81e48d2e3359379db635bed7c8 100644 --- a/styles/theme.ts +++ b/styles/theme.ts @@ -1,242 +1,146 @@ +export interface NumberToken { + value: number, + type: "number" +} + export type Color = string; +export interface ColorToken { + value: Color; + type: "color"; + step?: number +} export type Weight = - | "thin" - | "extra_light" - | "light" - | "normal" - | "medium" - | "semibold" - | "bold" - | "extra_bold" - | "black"; + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; +export interface WeightToken { + value: Weight, + type: "fontWeight" +} -interface SyntaxHighlightStyle { - color: { value: Color }; - weight: { value: Weight }; +export interface SyntaxHighlightStyle { + color: ColorToken; + weight: WeightToken; } -interface Player { - baseColor: { - value: Color; - }; - cursorColor: { - value: Color; - }; - selectionColor: { - value: Color; - }; - borderColor: { - value: Color; - }; +export interface Player { + baseColor: ColorToken; + cursorColor: ColorToken; + selectionColor: ColorToken; + borderColor: ColorToken; } export interface BackgroundColor { - base: { - value: Color; - }; - hovered: { - value: Color; - }; - active: { - value: Color; - }; - focused: { - value: Color; - }; + base: ColorToken; + hovered: ColorToken; + active: ColorToken; + focused: ColorToken; } export default interface Theme { - backgroundColor: { - 100: BackgroundColor; - 300: BackgroundColor; - 500: BackgroundColor; - ok: BackgroundColor; - error: BackgroundColor; - warning: BackgroundColor; - info: BackgroundColor; - }; - borderColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; - }; - focused: { - value: Color; - }; - active: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - textColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; + backgroundColor: { + 100: BackgroundColor; + 300: BackgroundColor; + 500: BackgroundColor; + ok: BackgroundColor; + error: BackgroundColor; + warning: BackgroundColor; + info: BackgroundColor; + }; + borderColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + focused: ColorToken; + active: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + textColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + iconColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + editor: { + background: ColorToken; + indent_guide: ColorToken; + indent_guide_active: ColorToken; + line: { + active: ColorToken; + highlighted: ColorToken; + inserted: ColorToken; + deleted: ColorToken; + modified: ColorToken; + }; + highlight: { + selection: ColorToken; + occurrence: ColorToken; + activeOccurrence: ColorToken; + matchingBracket: ColorToken; + match: ColorToken; + activeMatch: ColorToken; + related: ColorToken; + }; + gutter: { + primary: ColorToken; + active: ColorToken; + }; }; - placeholder: { - value: Color; - }; - active: { - value: Color; - }; - feature: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - iconColor: { - primary: { - value: Color; - }; - secondary: { - value: Color; - }; - muted: { - value: Color; - }; - placeholder: { - value: Color; - }; - active: { - value: Color; - }; - feature: { - value: Color; - }; - ok: { - value: Color; - }; - error: { - value: Color; - }; - warning: { - value: Color; - }; - info: { - value: Color; - }; - }; - editor: { - background: { - value: Color; - }; - indent_guide: { - value: Color; - }; - indent_guide_active: { - value: Color; - }; - line: { - active: { - value: Color; - }; - highlighted: { - value: Color; - }; - inserted: { - value: Color; - }; - deleted: { - value: Color; - }; - modified: { - value: Color; - }; - }; - highlight: { - selection: { - value: Color; - }; - occurrence: { - value: Color; - }; - activeOccurrence: { - value: Color; - }; - matchingBracket: { - value: Color; - }; - match: { - value: Color; - }; - activeMatch: { - value: Color; - }; - related: { - value: Color; - }; - }; - gutter: { - primary: { - value: Color; - }; - active: { - value: Color; - }; - }; - }; - syntax: { - primary: SyntaxHighlightStyle; - comment: SyntaxHighlightStyle; - punctuation: SyntaxHighlightStyle; - constant: SyntaxHighlightStyle; - keyword: SyntaxHighlightStyle; - function: SyntaxHighlightStyle; - type: SyntaxHighlightStyle; - variant: SyntaxHighlightStyle; - property: SyntaxHighlightStyle; - enum: SyntaxHighlightStyle; - operator: SyntaxHighlightStyle; - string: SyntaxHighlightStyle; - number: SyntaxHighlightStyle; - boolean: SyntaxHighlightStyle; - predictive: SyntaxHighlightStyle; - }; + syntax: { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; + }; - player: { - 1: Player; - 2: Player; - 3: Player; - 4: Player; - 5: Player; - 6: Player; - 7: Player; - 8: Player; - }; - shadowAlpha: { - value: number; - }; + player: { + 1: Player; + 2: Player; + 3: Player; + 4: Player; + 5: Player; + 6: Player; + 7: Player; + 8: Player; + }; + shadowAlpha: NumberToken; } From bfeb6abb4bedfbb414841b41a72cd435b11b8379 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 31 Mar 2022 20:27:25 -0700 Subject: [PATCH 044/245] Finish dark.ts initial port and restructure files to get ready for build script Build script currently fails to type check. Not sure whats going on. Will fix in the morning. Co-authored-by: Nate Butler --- styles/.gitignore | 1 + styles/buildStyleTree.ts | 11 + styles/{ => styleTree}/app.ts | 0 .../{chat-panel.ts => styleTree/chatPanel.ts} | 0 styles/{ => styleTree}/components.ts | 6 +- styles/{ => styleTree}/editor.ts | 0 .../projectPanel.ts} | 4 +- styles/{ => styleTree}/search.ts | 0 .../selectorModal.ts} | 0 styles/{ => styleTree}/workspace.ts | 0 styles/{ => themes}/dark.ts | 197 +++++++------- styles/themes/light.ts | 251 ++++++++++++++++++ styles/{ => themes}/theme.ts | 36 +-- styles/{ => tokens}/core.ts | 2 +- styles/{lib.ts => utils/color.ts} | 0 15 files changed, 388 insertions(+), 120 deletions(-) create mode 100644 styles/.gitignore create mode 100644 styles/buildStyleTree.ts rename styles/{ => styleTree}/app.ts (100%) rename styles/{chat-panel.ts => styleTree/chatPanel.ts} (100%) rename styles/{ => styleTree}/components.ts (92%) rename styles/{ => styleTree}/editor.ts (100%) rename styles/{project-panel.ts => styleTree/projectPanel.ts} (90%) rename styles/{ => styleTree}/search.ts (100%) rename styles/{selector-modal.ts => styleTree/selectorModal.ts} (100%) rename styles/{ => styleTree}/workspace.ts (100%) rename styles/{ => themes}/dark.ts (71%) create mode 100644 styles/themes/light.ts rename styles/{ => themes}/theme.ts (82%) rename styles/{ => tokens}/core.ts (97%) rename styles/{lib.ts => utils/color.ts} (100%) diff --git a/styles/.gitignore b/styles/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c2658d7d1b31848c3b71960543cb0368e56cd4c7 --- /dev/null +++ b/styles/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/styles/buildStyleTree.ts b/styles/buildStyleTree.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fa1c1576d96f312c79b52d15ce2429f3902ff8a --- /dev/null +++ b/styles/buildStyleTree.ts @@ -0,0 +1,11 @@ +import dark from "./themes/dark"; +import light from "./themes/light"; +import app from "./styleTree/app"; + +for (let theme of [dark, light]) { + let styleTree = app(theme); + + let styleTreeJson = JSON.stringify(styleTree); + console.log(styleTreeJson); + // TODO: Write style tree json to zed crate assets folder +} \ No newline at end of file diff --git a/styles/app.ts b/styles/styleTree/app.ts similarity index 100% rename from styles/app.ts rename to styles/styleTree/app.ts diff --git a/styles/chat-panel.ts b/styles/styleTree/chatPanel.ts similarity index 100% rename from styles/chat-panel.ts rename to styles/styleTree/chatPanel.ts diff --git a/styles/components.ts b/styles/styleTree/components.ts similarity index 92% rename from styles/components.ts rename to styles/styleTree/components.ts index 590c1b5eea9f6779dee0c2697a781d36b3edee60..b54956facccc3874998176870498368dbe8b5b56 100644 --- a/styles/components.ts +++ b/styles/styleTree/components.ts @@ -1,7 +1,7 @@ import chroma from "chroma-js"; -import core from "./core"; -import { Color } from "./lib"; -import Theme, { BackgroundColor, Weight } from "./theme"; +import core from "../tokens/core"; +import { Color } from "../utils/color"; +import Theme, { BackgroundColor, Weight } from "../themes/theme"; export type TextColor = keyof Theme["textColor"]; diff --git a/styles/editor.ts b/styles/styleTree/editor.ts similarity index 100% rename from styles/editor.ts rename to styles/styleTree/editor.ts diff --git a/styles/project-panel.ts b/styles/styleTree/projectPanel.ts similarity index 90% rename from styles/project-panel.ts rename to styles/styleTree/projectPanel.ts index 343e11b96b6e8adb3c6bd223a71de3e6d7d05f40..3b5fba8853da3799e69be735447e615341ef8391 100644 --- a/styles/project-panel.ts +++ b/styles/styleTree/projectPanel.ts @@ -1,7 +1,7 @@ import { panel } from "./app"; import { backgroundColor, iconColor, text, TextColor } from "./components"; -import Theme from "./theme"; -import { Color } from "./lib"; +import Theme from "../themes/theme"; +import { Color } from "../utils/color"; export default function projectPanel(theme: Theme) { function entry(theme: Theme, textColor: TextColor, background?: Color) { diff --git a/styles/search.ts b/styles/styleTree/search.ts similarity index 100% rename from styles/search.ts rename to styles/styleTree/search.ts diff --git a/styles/selector-modal.ts b/styles/styleTree/selectorModal.ts similarity index 100% rename from styles/selector-modal.ts rename to styles/styleTree/selectorModal.ts diff --git a/styles/workspace.ts b/styles/styleTree/workspace.ts similarity index 100% rename from styles/workspace.ts rename to styles/styleTree/workspace.ts diff --git a/styles/dark.ts b/styles/themes/dark.ts similarity index 71% rename from styles/dark.ts rename to styles/themes/dark.ts index 5b60bd0316a53fc24a830e23d428088675ac45de..098677a1e91c898e1e57624fa28a39fe9bbafee9 100644 --- a/styles/dark.ts +++ b/styles/themes/dark.ts @@ -1,5 +1,5 @@ -import core from "./core"; -import Theme from "./theme"; +import core from "../tokens/core"; +import Theme, { NumberToken, Syntax } from "./theme"; const { color } = core; @@ -88,159 +88,162 @@ const iconColor = { info: color.blue[500], }; +const player = { + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, +}; + +// TODO: Fixup const editor = { background: backgroundColor[500].base, - indent_guide: color.neutral[999], - indent_guide_active: color.neutral[999], + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, line: { - active: color.neutral[999], - highlighted: color.neutral[999], - inserted: color.neutral[999], - deleted: color.neutral[999], - modified: color.neutral[999], + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: color.neutral[999], - occurrence: color.neutral[999], - activeOccurrence: color.neutral[999], - matchingBracket: color.neutral[999], - match: color.neutral[999], - activeMatch: color.neutral[999], - related: color.neutral[999], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], }, gutter: { - primary: color.neutral[999], - active: color.neutral[999], + primary: color.neutral[0], + active: color.neutral[0], }, }; -const syntax = { +const syntax: Syntax = { primary: { color: textColor.primary, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, comment: { color: color.lime[200], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, punctuation: { color: textColor.primary, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, constant: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, keyword: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, function: { color: color.yellow[200], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, type: { color: color.teal[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, variant: { color: color.teal[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, property: { color: color.sky[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, enum: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, operator: { color: color.sky[400], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, string: { color: color.orange[300], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, number: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, boolean: { color: color.neutral[150], - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, predictive: { color: textColor.muted, - weight: { value: "normal" }, + weight: { value: "normal", type: "fontWeight" }, }, }; -const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, +const shadowAlpha: NumberToken = { + value: 0.32, + type: "number" }; -const shadowAlpha = { - value: 0.32, +const theme: Theme = { + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -export default function dark(): Theme { - return { - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, - }; -} +export default theme; \ No newline at end of file diff --git a/styles/themes/light.ts b/styles/themes/light.ts new file mode 100644 index 0000000000000000000000000000000000000000..20760427f273e93d72c2cf7cee6a8c0f6ae7192d --- /dev/null +++ b/styles/themes/light.ts @@ -0,0 +1,251 @@ +import core from "../tokens/core"; +import Theme, { NumberToken, Syntax } from "./theme"; + +const { color } = core; + +// TODO: Replace with light values + +const backgroundColor = { + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, +}; + +const borderColor = { + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[999], + error: color.neutral[999], + warning: color.neutral[999], + info: color.neutral[999], +}; + +const textColor = { + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], +}; + +const iconColor = { + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], +}; + +const player = { + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, +}; + +// TODO: Fixup +const editor = { + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, +}; + +const syntax: Syntax = { + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, +}; + +const shadowAlpha: NumberToken = { + value: 0.32, + type: "number" +}; + +const theme: Theme = { + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, +}; + +export default theme; diff --git a/styles/theme.ts b/styles/themes/theme.ts similarity index 82% rename from styles/theme.ts rename to styles/themes/theme.ts index 9d70ea0227053f81e48d2e3359379db635bed7c8..e319f510c7daa52c64caefc3d8d2c8c7bfde4221 100644 --- a/styles/theme.ts +++ b/styles/themes/theme.ts @@ -43,6 +43,24 @@ export interface BackgroundColor { focused: ColorToken; } +export interface Syntax { + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; +}; + export default interface Theme { backgroundColor: { 100: BackgroundColor; @@ -114,23 +132,7 @@ export default interface Theme { }; }; - syntax: { - primary: SyntaxHighlightStyle; - comment: SyntaxHighlightStyle; - punctuation: SyntaxHighlightStyle; - constant: SyntaxHighlightStyle; - keyword: SyntaxHighlightStyle; - function: SyntaxHighlightStyle; - type: SyntaxHighlightStyle; - variant: SyntaxHighlightStyle; - property: SyntaxHighlightStyle; - enum: SyntaxHighlightStyle; - operator: SyntaxHighlightStyle; - string: SyntaxHighlightStyle; - number: SyntaxHighlightStyle; - boolean: SyntaxHighlightStyle; - predictive: SyntaxHighlightStyle; - }; + syntax: Syntax, player: { 1: Player; diff --git a/styles/core.ts b/styles/tokens/core.ts similarity index 97% rename from styles/core.ts rename to styles/tokens/core.ts index 49e376b4ebf81968b2681179be46b3c5b27055b6..38bfe82e28129954a2f5602038d575a3cfbb94af 100644 --- a/styles/core.ts +++ b/styles/tokens/core.ts @@ -1,4 +1,4 @@ -import { colorRamp } from "./lib"; +import { colorRamp } from "../utils/color"; export default { fontFamily: { diff --git a/styles/lib.ts b/styles/utils/color.ts similarity index 100% rename from styles/lib.ts rename to styles/utils/color.ts From 43a7cadf5bf2c3c7cad3c3fd9a04e153728ff452 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 23:42:45 -0400 Subject: [PATCH 045/245] Type `name` --- styles/themes/theme.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index e319f510c7daa52c64caefc3d8d2c8c7bfde4221..a7760459897b0bedec0d87512e669d1d7ae0a3b4 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -62,6 +62,7 @@ export interface Syntax { }; export default interface Theme { + name: string; backgroundColor: { 100: BackgroundColor; 300: BackgroundColor; From 211c473d32c0e09f8855d2d504cb1a356d3e58a1 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 31 Mar 2022 23:43:01 -0400 Subject: [PATCH 046/245] Update renamed/moved imports --- styles/styleTree/app.ts | 8 ++++---- styles/styleTree/chatPanel.ts | 4 ++-- styles/styleTree/components.ts | 2 +- styles/styleTree/editor.ts | 2 +- styles/styleTree/search.ts | 2 +- styles/styleTree/selectorModal.ts | 2 +- styles/styleTree/workspace.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index a65442db0737630f77d1de92d921d934ed4a8804..c7edfdc2701f06e6cb1b41beb779ad6bc0aca75b 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,10 +1,10 @@ -import chatPanel from "./chat-panel"; +import Theme from "../themes/theme"; +import chatPanel from "./chatPanel"; import { backgroundColor, borderColor, text } from "./components"; import editor from "./editor"; -import projectPanel from "./project-panel"; +import projectPanel from "./projectPanel"; import search from "./search"; -import selectorModal from "./selector-modal"; -import Theme from "./theme"; +import selectorModal from "./selectorModal"; import workspace from "./workspace"; export const panel = { diff --git a/styles/styleTree/chatPanel.ts b/styles/styleTree/chatPanel.ts index c6bf0148ea4c5d9345c29d5df94c978588e4fd0d..ea9a8ffe22a83e2b7135bc886273f2da2d7c1502 100644 --- a/styles/styleTree/chatPanel.ts +++ b/styles/styleTree/chatPanel.ts @@ -1,3 +1,4 @@ +import Theme from "../themes/theme"; import { panel } from "./app"; import { backgroundColor, @@ -5,9 +6,8 @@ import { player, shadow, text, - TextColor, + TextColor } from "./components"; -import Theme from "./theme"; export default function chatPanel(theme: Theme) { function channelSelectItem( diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index b54956facccc3874998176870498368dbe8b5b56..8038cdcd3b37494e1217fc4557090cb7bfe01378 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -1,7 +1,7 @@ import chroma from "chroma-js"; +import Theme, { BackgroundColor, Weight } from "../themes/theme"; import core from "../tokens/core"; import { Color } from "../utils/color"; -import Theme, { BackgroundColor, Weight } from "../themes/theme"; export type TextColor = keyof Theme["textColor"]; diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index a27464eee2182ecfb0633623ff4e773cfb85b35d..5d800881e2750942c2b7d6f1113df203aff97fb3 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -1,3 +1,4 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, @@ -6,7 +7,6 @@ import { text, TextColor } from "./components"; -import Theme from "./theme"; export default function editor(theme: Theme) { const autocompleteItem = { diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index ced2266ea73480da11f880d4c56b4a65aa83f12c..fd2fd2568156f31a877de40773b9382eb5a8e6ca 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, player, text } from "./components"; -import Theme from "./theme"; export default function search(theme: Theme) { const optionButton = { diff --git a/styles/styleTree/selectorModal.ts b/styles/styleTree/selectorModal.ts index ddba32683a976153eac6fc0f49f6a5df9a835a1f..fdebe712fa0f1650a3fe4411b4579aa30bb44e2e 100644 --- a/styles/styleTree/selectorModal.ts +++ b/styles/styleTree/selectorModal.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, player, shadow, text } from "./components"; -import Theme from "./theme"; export default function selectorModal(theme: Theme): Object { const item = { diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 1a50fe9ee1c248de6d48a9521efa9f9cc8f82fbb..e8232442b6f01ec2d0e3486509218f4b4c9e7562 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -1,5 +1,5 @@ +import Theme from "../themes/theme"; import { backgroundColor, border, iconColor, text } from "./components"; -import Theme from "./theme"; export default function workspace(theme: Theme) { const signInPrompt = { From 70a783c8d103461d720c332f78054168486ab99b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 08:25:58 -0600 Subject: [PATCH 047/245] Fix TS compile error --- styles/styleTree/components.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index 8038cdcd3b37494e1217fc4557090cb7bfe01378..55a64cb1ecb4ec8f60878d9e795f671a9a5cfede 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -15,7 +15,7 @@ export function text( underline?: boolean; } ) { - const sizeKey = properties.size || fontFamily === "sans" ? "sm" : "md"; + const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md"; const size = core.fontSize[sizeKey].value; return { From d2a070c345d338a46d968d61a6ee0115629f9698 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 09:45:11 -0600 Subject: [PATCH 048/245] Write theme JSON files from buildThemes script Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- script/build-themes | 7 + styles/buildStyleTree.ts | 11 - styles/buildThemes.ts | 17 ++ styles/package-lock.json | 279 ++++++++++++++++++++- styles/package.json | 7 +- styles/themes/dark.ts | 432 ++++++++++++++++----------------- styles/themes/light.ts | 430 ++++++++++++++++---------------- styles/tsconfig.json | 12 + styles/utils/decamelizeTree.ts | 21 ++ 9 files changed, 771 insertions(+), 445 deletions(-) create mode 100755 script/build-themes delete mode 100644 styles/buildStyleTree.ts create mode 100644 styles/buildThemes.ts create mode 100644 styles/tsconfig.json create mode 100644 styles/utils/decamelizeTree.ts diff --git a/script/build-themes b/script/build-themes new file mode 100755 index 0000000000000000000000000000000000000000..aef3a4250cdac8a3934938e812d5c7602d388731 --- /dev/null +++ b/script/build-themes @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd styles +npm install +npm run build diff --git a/styles/buildStyleTree.ts b/styles/buildStyleTree.ts deleted file mode 100644 index 6fa1c1576d96f312c79b52d15ce2429f3902ff8a..0000000000000000000000000000000000000000 --- a/styles/buildStyleTree.ts +++ /dev/null @@ -1,11 +0,0 @@ -import dark from "./themes/dark"; -import light from "./themes/light"; -import app from "./styleTree/app"; - -for (let theme of [dark, light]) { - let styleTree = app(theme); - - let styleTreeJson = JSON.stringify(styleTree); - console.log(styleTreeJson); - // TODO: Write style tree json to zed crate assets folder -} \ No newline at end of file diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts new file mode 100644 index 0000000000000000000000000000000000000000..ced82e98664980b3d1af9f50d8f4f8f498f59d49 --- /dev/null +++ b/styles/buildThemes.ts @@ -0,0 +1,17 @@ +import * as fs from "fs"; +import * as path from "path"; +import dark from "./themes/dark"; +import light from "./themes/light"; +import app from "./styleTree/app"; +import decamelizeTree from "./utils/decamelizeTree"; + +const themes = [dark, light]; +for (let theme of themes) { + let styleTree = decamelizeTree(app(theme)); + let styleTreeJSON = JSON.stringify(styleTree, null, 2); + let outPath = path.resolve( + `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` + ); + fs.writeFileSync(outPath, styleTreeJSON); + console.log(`Generated ${outPath}`); +} diff --git a/styles/package-lock.json b/styles/package-lock.json index 7b8503bf720d572d64bb9179a78489beaa068cb4..582f1c84968a5c1a25ddac5fd3c21ba907353c6d 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -10,30 +10,307 @@ "license": "ISC", "dependencies": { "@types/chroma-js": "^2.1.3", - "chroma-js": "^2.4.2" + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2", + "ts-node": "^10.7.0" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + }, "node_modules/@types/chroma-js": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" }, + "node_modules/@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "node_modules/case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } } }, "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + }, "@types/chroma-js": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + } + }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "peer": true + }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" } } } diff --git a/styles/package.json b/styles/package.json index c66da8718b6d4f2047cbc4e7580036946dab1fb8..c270bba0e1563cee758bbf5a02fb9fc1848b37ae 100644 --- a/styles/package.json +++ b/styles/package.json @@ -4,12 +4,15 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "ts-node buildThemes.ts" }, "author": "", "license": "ISC", "dependencies": { "@types/chroma-js": "^2.1.3", - "chroma-js": "^2.4.2" + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2", + "ts-node": "^10.7.0" } } diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 098677a1e91c898e1e57624fa28a39fe9bbafee9..42f80cf4c670deda733f434c3cbab691239f5396 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -4,246 +4,246 @@ import Theme, { NumberToken, Syntax } from "./theme"; const { color } = core; const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[999], - error: color.neutral[999], - warning: color.neutral[999], - info: color.neutral[999], + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[1000], + error: color.neutral[1000], + warning: color.neutral[1000], + info: color.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number" + value: 0.32, + type: "number", }; const theme: Theme = { - name: "dark", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; -export default theme; \ No newline at end of file +export default theme; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index 20760427f273e93d72c2cf7cee6a8c0f6ae7192d..7a9bf1b552650b81288e70acc6c7500c80a8246b 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -6,246 +6,246 @@ const { color } = core; // TODO: Replace with light values const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: color.neutral[750], + hovered: color.neutral[750], + active: color.neutral[750], + focused: color.neutral[750], + }, + 300: { + base: color.neutral[800], + hovered: color.neutral[800], + active: color.neutral[800], + focused: color.neutral[800], + }, + 500: { + base: color.neutral[900], + hovered: color.neutral[900], + active: color.neutral[900], + focused: color.neutral[900], + }, + ok: { + base: color.green[600], + hovered: color.green[600], + active: color.green[600], + focused: color.green[600], + }, + error: { + base: color.red[400], + hovered: color.red[400], + active: color.red[400], + focused: color.red[400], + }, + warning: { + base: color.amber[300], + hovered: color.amber[300], + active: color.amber[300], + focused: color.amber[300], + }, + info: { + base: color.blue[500], + hovered: color.blue[500], + active: color.blue[500], + focused: color.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[999], - error: color.neutral[999], - warning: color.neutral[999], - info: color.neutral[999], + primary: color.neutral[850], + secondary: color.neutral[700], + muted: color.neutral[750], + focused: color.neutral[100], + active: color.neutral[500], + ok: color.neutral[1000], + error: color.neutral[1000], + warning: color.neutral[1000], + info: color.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[150], + secondary: color.neutral[350], + muted: color.neutral[550], + placeholder: color.neutral[750], + active: color.neutral[0], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: color.neutral[300], + secondary: color.neutral[500], + muted: color.neutral[600], + placeholder: color.neutral[700], + active: color.neutral[50], + //TODO: (design) define feature and it's correct value + feature: color.sky[500], + ok: color.green[600], + error: color.red[400], + warning: color.amber[300], + info: color.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: color.blue[600], + cursorColor: color.blue[600], + selectionColor: color.blue[600], + borderColor: color.blue[600], + }, + 2: { + baseColor: color.indigo[500], + cursorColor: color.indigo[500], + selectionColor: color.indigo[500], + borderColor: color.indigo[500], + }, + 3: { + baseColor: color.green[500], + cursorColor: color.green[500], + selectionColor: color.green[500], + borderColor: color.green[500], + }, + 4: { + baseColor: color.orange[500], + cursorColor: color.orange[500], + selectionColor: color.orange[500], + borderColor: color.orange[500], + }, + 5: { + baseColor: color.purple[500], + cursorColor: color.purple[500], + selectionColor: color.purple[500], + borderColor: color.purple[500], + }, + 6: { + baseColor: color.teal[400], + cursorColor: color.teal[400], + selectionColor: color.teal[400], + borderColor: color.teal[400], + }, + 7: { + baseColor: color.pink[400], + cursorColor: color.pink[400], + selectionColor: color.pink[400], + borderColor: color.pink[400], + }, + 8: { + baseColor: color.yellow[400], + cursorColor: color.yellow[400], + selectionColor: color.yellow[400], + borderColor: color.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: color.neutral[0], + highlighted: color.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: color.neutral[0], + matchingBracket: color.neutral[0], + match: color.neutral[0], + activeMatch: color.neutral[0], + related: color.neutral[0], + }, + gutter: { + primary: color.neutral[0], + active: color.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + comment: { + color: color.lime[200], + weight: { value: "normal", type: "fontWeight" }, + }, + punctuation: { + color: textColor.primary, + weight: { value: "normal", type: "fontWeight" }, + }, + constant: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + keyword: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + function: { + color: color.yellow[200], + weight: { value: "normal", type: "fontWeight" }, + }, + type: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + variant: { + color: color.teal[300], + weight: { value: "normal", type: "fontWeight" }, + }, + property: { + color: color.sky[300], + weight: { value: "normal", type: "fontWeight" }, + }, + enum: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + operator: { + color: color.sky[400], + weight: { value: "normal", type: "fontWeight" }, + }, + string: { + color: color.orange[300], + weight: { value: "normal", type: "fontWeight" }, + }, + number: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + boolean: { + color: color.neutral[150], + weight: { value: "normal", type: "fontWeight" }, + }, + predictive: { + color: textColor.muted, + weight: { value: "normal", type: "fontWeight" }, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number" + value: 0.32, + type: "number", }; const theme: Theme = { - name: "light", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/tsconfig.json b/styles/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..3dfbcc715ef17318d9267709bb8f25a8b91ecac0 --- /dev/null +++ b/styles/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "esModuleInterop": true, + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": true + }, + "exclude": ["node_modules"] + } \ No newline at end of file diff --git a/styles/utils/decamelizeTree.ts b/styles/utils/decamelizeTree.ts new file mode 100644 index 0000000000000000000000000000000000000000..d606902082e974b6cb7b0602e06cc32b0a9e1b5f --- /dev/null +++ b/styles/utils/decamelizeTree.ts @@ -0,0 +1,21 @@ +import { snakeCase } from "case-anything"; + +export default function decamelizeTree(object: { [key: string]: any }) { + const snakeObject: { [key: string]: any } = {}; + for (const key in object) { + snakeObject[snakeCase(key)] = decamelizeValue(object[key]); + } + return snakeObject; +} + +function decamelizeValue(value: any): any { + if (typeof value === "object") { + if (Array.isArray(value)) { + return value.map(decamelizeValue); + } else { + return decamelizeTree(value); + } + } else { + return value; + } +} From 371ea7c5529aa670e9b5aded82b2762be6073a38 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 09:56:50 -0600 Subject: [PATCH 049/245] Update style tree based on changes to _base.toml from main Co-Authored-By: Nate Butler <1714999+iamnbutler@users.noreply.github.com> --- styles/styleTree/search.ts | 15 ++++++--------- styles/styleTree/workspace.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index fd2fd2568156f31a877de40773b9382eb5a8e6ca..7ba04cd688e01f5b3a4f47b35311195fde73fefb 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -20,7 +20,6 @@ export default function search(theme: Theme) { }; return { - background: backgroundColor(theme, 300), matchBackground: theme.editor.highlight.match, tabIconSpacing: 4, tabIconWidth: 14, @@ -35,22 +34,20 @@ export default function search(theme: Theme) { editor: { background: backgroundColor(theme, 500), cornerRadius: 6, - maxWidth: 400, + minWidth: 200, + maxWidth: 500, placeholderText: text(theme, "mono", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), border: border(theme, "primary"), margin: { - bottom: 5, - left: 5, right: 5, - top: 5, }, padding: { - bottom: 3, - left: 13, - right: 13, top: 3, + bottom: 3, + left: 14, + right: 14, }, }, hoveredOptionButton: { @@ -62,7 +59,7 @@ export default function search(theme: Theme) { border: border(theme, "error"), }, matchIndex: { - ...text(theme, "mono", "secondary"), + ...text(theme, "mono", "muted"), padding: 6, }, optionButton, diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index e8232442b6f01ec2d0e3486509218f4b4c9e7562..148db089183e77274a81a122d6f02d920b640237 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -127,7 +127,15 @@ export default function workspace(theme: Theme) { }, }, toolbar: { - height: 44, + height: 34, + background: backgroundColor(theme, 300), + border: border(theme, "primary", { bottom: true }), + itemSpacing: 8, + padding: { left: 16, right: 8, top: 4, bottom: 4 }, + }, + breadcrumbs: { + ...text(theme, "mono", "secondary"), + padding: { left: 6 }, }, }; } From 391aed3d66c194e5c66781fdec736c577a0c347e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Apr 2022 11:45:08 -0600 Subject: [PATCH 050/245] Start loading new theme JSON format instead of TOML Replaced remaining extends with javascript object extension. Moved tokens/core.ts to tokens.ts and massaged the types to make it more obvious when types don't match up. Co-authored-by: Nathan Sobo --- crates/theme/src/resolution.rs | 497 ----------- crates/theme/src/theme.rs | 3 +- crates/theme/src/theme_registry.rs | 234 +---- crates/zed/assets/themes/_base.toml | 411 --------- crates/zed/assets/themes/black.toml | 67 -- crates/zed/assets/themes/dark.json | 1245 +++++++++++++++++++++++++++ crates/zed/assets/themes/dark.toml | 67 -- crates/zed/assets/themes/light.json | 1245 +++++++++++++++++++++++++++ crates/zed/assets/themes/light.toml | 67 -- crates/zed/src/zed.rs | 3 +- styles/buildThemes.ts | 14 +- styles/styleTree/app.ts | 106 +-- styles/styleTree/components.ts | 14 +- styles/styleTree/contactsPanel.ts | 61 ++ styles/styleTree/editor.ts | 245 +++--- styles/styleTree/projectPanel.ts | 6 +- styles/styleTree/search.ts | 44 +- styles/styleTree/workspace.ts | 5 + styles/themes/dark.ts | 462 +++++----- styles/themes/light.ts | 300 ++++--- styles/themes/theme.ts | 37 +- styles/tokens.ts | 102 +++ styles/tokens/core.ts | 58 -- 23 files changed, 3284 insertions(+), 2009 deletions(-) delete mode 100644 crates/theme/src/resolution.rs delete mode 100644 crates/zed/assets/themes/_base.toml delete mode 100644 crates/zed/assets/themes/black.toml create mode 100644 crates/zed/assets/themes/dark.json delete mode 100644 crates/zed/assets/themes/dark.toml create mode 100644 crates/zed/assets/themes/light.json delete mode 100644 crates/zed/assets/themes/light.toml create mode 100644 styles/styleTree/contactsPanel.ts create mode 100644 styles/tokens.ts delete mode 100644 styles/tokens/core.ts diff --git a/crates/theme/src/resolution.rs b/crates/theme/src/resolution.rs deleted file mode 100644 index acebf72b86120065cb8587d05c2a8db92a00cced..0000000000000000000000000000000000000000 --- a/crates/theme/src/resolution.rs +++ /dev/null @@ -1,497 +0,0 @@ -use anyhow::{anyhow, Result}; -use indexmap::IndexMap; -use serde_json::Value; -use std::{ - cell::RefCell, - mem, - rc::{Rc, Weak}, -}; - -pub fn resolve_references(value: Value) -> Result { - let tree = Tree::from_json(value)?; - tree.resolve()?; - tree.to_json() -} - -#[derive(Clone)] -enum Node { - Reference { - path: String, - parent: Option>>, - }, - Object { - base: Option, - children: IndexMap, - resolved: bool, - parent: Option>>, - }, - Array { - children: Vec, - resolved: bool, - parent: Option>>, - }, - String { - value: String, - parent: Option>>, - }, - Number { - value: serde_json::Number, - parent: Option>>, - }, - Bool { - value: bool, - parent: Option>>, - }, - Null { - parent: Option>>, - }, -} - -#[derive(Clone)] -struct Tree(Rc>); - -impl Tree { - pub fn new(node: Node) -> Self { - Self(Rc::new(RefCell::new(node))) - } - - fn from_json(value: Value) -> Result { - match value { - Value::String(value) => { - if let Some(path) = value.strip_prefix("$") { - Ok(Self::new(Node::Reference { - path: path.to_string(), - parent: None, - })) - } else { - Ok(Self::new(Node::String { - value, - parent: None, - })) - } - } - Value::Number(value) => Ok(Self::new(Node::Number { - value, - parent: None, - })), - Value::Bool(value) => Ok(Self::new(Node::Bool { - value, - parent: None, - })), - Value::Null => Ok(Self::new(Node::Null { parent: None })), - Value::Object(object) => { - let tree = Self::new(Node::Object { - base: Default::default(), - children: Default::default(), - resolved: false, - parent: None, - }); - let mut children = IndexMap::new(); - let mut resolved = true; - let mut base = None; - for (key, value) in object.into_iter() { - let value = if key == "extends" { - if value.is_string() { - if let Value::String(value) = value { - base = value.strip_prefix("$").map(str::to_string); - resolved = false; - Self::new(Node::String { - value, - parent: None, - }) - } else { - unreachable!() - } - } else { - Tree::from_json(value)? - } - } else { - Tree::from_json(value)? - }; - value - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&tree.0))); - resolved &= value.is_resolved(); - children.insert(key.clone(), value); - } - - *tree.0.borrow_mut() = Node::Object { - base, - children, - resolved, - parent: None, - }; - Ok(tree) - } - Value::Array(elements) => { - let tree = Self::new(Node::Array { - children: Default::default(), - resolved: false, - parent: None, - }); - - let mut children = Vec::new(); - let mut resolved = true; - for element in elements { - let child = Tree::from_json(element)?; - child - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&tree.0))); - resolved &= child.is_resolved(); - children.push(child); - } - - *tree.0.borrow_mut() = Node::Array { - children, - resolved, - parent: None, - }; - Ok(tree) - } - } - } - - fn to_json(&self) -> Result { - match &*self.0.borrow() { - Node::Reference { .. } => Err(anyhow!("unresolved tree")), - Node::String { value, .. } => Ok(Value::String(value.clone())), - Node::Number { value, .. } => Ok(Value::Number(value.clone())), - Node::Bool { value, .. } => Ok(Value::Bool(*value)), - Node::Null { .. } => Ok(Value::Null), - Node::Object { children, .. } => { - let mut json_children = serde_json::Map::new(); - for (key, value) in children { - json_children.insert(key.clone(), value.to_json()?); - } - Ok(Value::Object(json_children)) - } - Node::Array { children, .. } => { - let mut json_children = Vec::new(); - for child in children { - json_children.push(child.to_json()?); - } - Ok(Value::Array(json_children)) - } - } - } - - fn parent(&self) -> Option { - match &*self.0.borrow() { - Node::Reference { parent, .. } - | Node::Object { parent, .. } - | Node::Array { parent, .. } - | Node::String { parent, .. } - | Node::Number { parent, .. } - | Node::Bool { parent, .. } - | Node::Null { parent } => parent.as_ref().and_then(|p| p.upgrade()).map(Tree), - } - } - - fn get(&self, path: &str) -> Result> { - let mut tree = self.clone(); - for component in path.split('.') { - let node = tree.0.borrow(); - match &*node { - Node::Object { children, .. } => { - if let Some(subtree) = children.get(component).cloned() { - drop(node); - tree = subtree; - } else { - return Err(anyhow!( - "key \"{}\" does not exist in path \"{}\"", - component, - path - )); - } - } - Node::Reference { .. } => return Ok(None), - Node::Array { .. } - | Node::String { .. } - | Node::Number { .. } - | Node::Bool { .. } - | Node::Null { .. } => { - return Err(anyhow!( - "key \"{}\" in path \"{}\" is not an object", - component, - path - )) - } - } - } - - Ok(Some(tree)) - } - - fn is_resolved(&self) -> bool { - match &*self.0.borrow() { - Node::Reference { .. } => false, - Node::Object { resolved, .. } | Node::Array { resolved, .. } => *resolved, - Node::String { .. } | Node::Number { .. } | Node::Bool { .. } | Node::Null { .. } => { - true - } - } - } - - fn update_resolved(&self) { - match &mut *self.0.borrow_mut() { - Node::Object { - resolved, - base, - children, - .. - } => { - *resolved = base.is_none() && children.values().all(|c| c.is_resolved()); - } - Node::Array { - resolved, children, .. - } => { - *resolved = children.iter().all(|c| c.is_resolved()); - } - _ => {} - } - } - - pub fn resolve(&self) -> Result<()> { - let mut unresolved = vec![self.clone()]; - let mut made_progress = true; - - while made_progress && !unresolved.is_empty() { - made_progress = false; - for mut tree in mem::take(&mut unresolved) { - made_progress |= tree.resolve_subtree(self, &mut unresolved)?; - if tree.is_resolved() { - while let Some(parent) = tree.parent() { - parent.update_resolved(); - if !parent.is_resolved() { - break; - } - tree = parent; - } - } - } - } - - if unresolved.is_empty() { - Ok(()) - } else { - Err(anyhow!("tree contains cycles")) - } - } - - fn resolve_subtree(&self, root: &Tree, unresolved: &mut Vec) -> Result { - let node = self.0.borrow(); - match &*node { - Node::Reference { path, parent } => { - if let Some(subtree) = root.get(&path)? { - if subtree.is_resolved() { - let parent = parent.clone(); - drop(node); - let mut new_node = subtree.0.borrow().clone(); - new_node.set_parent(parent); - *self.0.borrow_mut() = new_node; - Ok(true) - } else { - unresolved.push(self.clone()); - Ok(false) - } - } else { - unresolved.push(self.clone()); - Ok(false) - } - } - Node::Object { - base, - children, - resolved, - .. - } => { - if *resolved { - Ok(false) - } else { - let mut made_progress = false; - let mut children_resolved = true; - for child in children.values() { - made_progress |= child.resolve_subtree(root, unresolved)?; - children_resolved &= child.is_resolved(); - } - - if children_resolved { - let mut has_base = false; - let mut resolved_base = None; - if let Some(base) = base { - has_base = true; - if let Some(base) = root.get(base)? { - if base.is_resolved() { - resolved_base = Some(base); - } - } - } - - drop(node); - - if let Some(base) = resolved_base.as_ref() { - self.extend_from(&base); - made_progress = true; - } - - if let Node::Object { resolved, base, .. } = &mut *self.0.borrow_mut() { - if has_base { - if resolved_base.is_some() { - base.take(); - *resolved = true; - } else { - unresolved.push(self.clone()); - } - } else { - *resolved = true; - } - } - } else if base.is_some() { - unresolved.push(self.clone()); - } - - Ok(made_progress) - } - } - Node::Array { - children, resolved, .. - } => { - if *resolved { - Ok(false) - } else { - let mut made_progress = false; - let mut children_resolved = true; - for child in children.iter() { - made_progress |= child.resolve_subtree(root, unresolved)?; - children_resolved &= child.is_resolved(); - } - - if children_resolved { - drop(node); - - if let Node::Array { resolved, .. } = &mut *self.0.borrow_mut() { - *resolved = true; - } - } - - Ok(made_progress) - } - } - Node::String { .. } | Node::Number { .. } | Node::Bool { .. } | Node::Null { .. } => { - Ok(false) - } - } - } - - fn extend_from(&self, base: &Tree) { - if Rc::ptr_eq(&self.0, &base.0) { - return; - } - - if let ( - Node::Object { children, .. }, - Node::Object { - children: base_children, - .. - }, - ) = (&mut *self.0.borrow_mut(), &*base.0.borrow()) - { - for (key, base_value) in base_children { - if let Some(value) = children.get(key) { - value.extend_from(base_value); - } else { - let base_value = base_value.clone(); - base_value - .0 - .borrow_mut() - .set_parent(Some(Rc::downgrade(&self.0))); - children.insert(key.clone(), base_value); - } - } - } - } -} - -impl Node { - fn set_parent(&mut self, new_parent: Option>>) { - match self { - Node::Reference { parent, .. } - | Node::Object { parent, .. } - | Node::Array { parent, .. } - | Node::String { parent, .. } - | Node::Number { parent, .. } - | Node::Bool { parent, .. } - | Node::Null { parent } => *parent = new_parent, - } - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_references() { - let json = serde_json::json!({ - "a": { - "extends": "$g", - "x": "$b.d" - }, - "b": { - "c": "$a", - "d": "$e.f" - }, - "e": { - "extends": "$a", - "f": "1" - }, - "g": { - "h": 2 - } - }); - - assert_eq!( - resolve_references(json).unwrap(), - serde_json::json!({ - "a": { - "extends": "$g", - "x": "1", - "h": 2 - }, - "b": { - "c": { - "extends": "$g", - "x": "1", - "h": 2 - }, - "d": "1" - }, - "e": { - "extends": "$a", - "f": "1", - "x": "1", - "h": 2 - }, - "g": { - "h": 2 - } - }) - ) - } - - #[test] - fn test_cycles() { - let json = serde_json::json!({ - "a": { - "b": "$c.d" - }, - "c": { - "d": "$a.b", - }, - }); - - assert!(resolve_references(json).is_err()); - } -} diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 8fa15a92359c18ff7986978d66088c4f6a9332c1..b3c239b4b9f119159f76a3ed23ec477069c6bbd8 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -1,4 +1,3 @@ -mod resolution; mod theme_registry; use gpui::{ @@ -12,7 +11,7 @@ use std::{collections::HashMap, sync::Arc}; pub use theme_registry::*; -pub const DEFAULT_THEME_NAME: &'static str = "black"; +pub const DEFAULT_THEME_NAME: &'static str = "dark"; #[derive(Deserialize, Default)] pub struct Theme { diff --git a/crates/theme/src/theme_registry.rs b/crates/theme/src/theme_registry.rs index c3910dc4d28f6877b326b4fda36e59d2922db17c..219828b65083b08f1d7d0a105831acfc27bdf50a 100644 --- a/crates/theme/src/theme_registry.rs +++ b/crates/theme/src/theme_registry.rs @@ -1,8 +1,8 @@ -use crate::{resolution::resolve_references, Theme}; +use crate::Theme; use anyhow::{Context, Result}; use gpui::{fonts, AssetSource, FontCache}; use parking_lot::Mutex; -use serde_json::{Map, Value}; +use serde_json::Value; use std::{collections::HashMap, sync::Arc}; pub struct ThemeRegistry { @@ -25,12 +25,8 @@ impl ThemeRegistry { pub fn list(&self) -> impl Iterator { self.assets.list("themes/").into_iter().filter_map(|path| { let filename = path.strip_prefix("themes/")?; - let theme_name = filename.strip_suffix(".toml")?; - if theme_name.starts_with('_') { - None - } else { - Some(theme_name.to_string()) - } + let theme_name = filename.strip_suffix(".json")?; + Some(theme_name.to_string()) }) } @@ -44,9 +40,14 @@ impl ThemeRegistry { return Ok(theme.clone()); } - let theme_data = self.load(name, true)?; + let asset_path = format!("themes/{}.json", name); + let theme_json = self + .assets + .load(&asset_path) + .with_context(|| format!("failed to load theme file {}", asset_path))?; + let mut theme: Theme = fonts::with_font_cache(self.font_cache.clone(), || { - serde_path_to_error::deserialize(theme_data.as_ref()) + serde_path_to_error::deserialize(&mut serde_json::Deserializer::from_slice(&theme_json)) })?; theme.name = name.into(); @@ -54,217 +55,4 @@ impl ThemeRegistry { self.themes.lock().insert(name.to_string(), theme.clone()); Ok(theme) } - - fn load(&self, name: &str, evaluate_references: bool) -> Result> { - if let Some(data) = self.theme_data.lock().get(name) { - return Ok(data.clone()); - } - - let asset_path = format!("themes/{}.toml", name); - let source_code = self - .assets - .load(&asset_path) - .with_context(|| format!("failed to load theme file {}", asset_path))?; - - let mut theme_data: Map = toml::from_slice(source_code.as_ref()) - .with_context(|| format!("failed to parse {}.toml", name))?; - - // If this theme extends another base theme, deeply merge it into the base theme's data - if let Some(base_name) = theme_data - .get("extends") - .and_then(|name| name.as_str()) - .map(str::to_string) - { - let base_theme_data = self - .load(&base_name, false) - .with_context(|| format!("failed to load base theme {}", base_name))? - .as_ref() - .clone(); - if let Value::Object(mut base_theme_object) = base_theme_data { - deep_merge_json(&mut base_theme_object, theme_data); - theme_data = base_theme_object; - } - } - - let mut theme_data = Value::Object(theme_data); - - // Find all of the key path references in the object, and then sort them according - // to their dependencies. - if evaluate_references { - theme_data = resolve_references(theme_data)?; - } - - let result = Arc::new(theme_data); - self.theme_data - .lock() - .insert(name.to_string(), result.clone()); - - Ok(result) - } -} - -fn deep_merge_json(base: &mut Map, extension: Map) { - for (key, extension_value) in extension { - if let Value::Object(extension_object) = extension_value { - if let Some(base_object) = base.get_mut(&key).and_then(|value| value.as_object_mut()) { - deep_merge_json(base_object, extension_object); - } else { - base.insert(key, Value::Object(extension_object)); - } - } else { - base.insert(key, extension_value); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use anyhow::anyhow; - use gpui::MutableAppContext; - - #[gpui::test] - fn test_theme_extension(cx: &mut MutableAppContext) { - let assets = TestAssets(&[ - ( - "themes/_base.toml", - r##" - [ui.active_tab] - extends = "$ui.tab" - border.color = "#666666" - text = "$text_colors.bright" - - [ui.tab] - extends = "$ui.element" - text = "$text_colors.dull" - - [ui.element] - background = "#111111" - border = {width = 2.0, color = "#00000000"} - - [editor] - background = "#222222" - default_text = "$text_colors.regular" - "##, - ), - ( - "themes/light.toml", - r##" - extends = "_base" - - [text_colors] - bright = "#ffffff" - regular = "#eeeeee" - dull = "#dddddd" - - [editor] - background = "#232323" - "##, - ), - ]); - - let registry = ThemeRegistry::new(assets, cx.font_cache().clone()); - let theme_data = registry.load("light", true).unwrap(); - - assert_eq!( - theme_data.as_ref(), - &serde_json::json!({ - "ui": { - "active_tab": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#666666" - }, - "extends": "$ui.tab", - "text": "#ffffff" - }, - "tab": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#00000000" - }, - "extends": "$ui.element", - "text": "#dddddd" - }, - "element": { - "background": "#111111", - "border": { - "width": 2.0, - "color": "#00000000" - } - } - }, - "editor": { - "background": "#232323", - "default_text": "#eeeeee" - }, - "extends": "_base", - "text_colors": { - "bright": "#ffffff", - "regular": "#eeeeee", - "dull": "#dddddd" - } - }) - ); - } - - #[gpui::test] - fn test_nested_extension(cx: &mut MutableAppContext) { - let assets = TestAssets(&[( - "themes/theme.toml", - r##" - [a] - text = { extends = "$text.0" } - - [b] - extends = "$a" - text = { extends = "$text.1" } - - [text] - 0 = { color = "red" } - 1 = { color = "blue" } - "##, - )]); - - let registry = ThemeRegistry::new(assets, cx.font_cache().clone()); - let theme_data = registry.load("theme", true).unwrap(); - assert_eq!( - theme_data - .get("b") - .unwrap() - .get("text") - .unwrap() - .get("color") - .unwrap(), - "blue" - ); - } - - struct TestAssets(&'static [(&'static str, &'static str)]); - - impl AssetSource for TestAssets { - fn load(&self, path: &str) -> Result> { - if let Some(row) = self.0.iter().find(|e| e.0 == path) { - Ok(row.1.as_bytes().into()) - } else { - Err(anyhow!("no such path {}", path)) - } - } - - fn list(&self, prefix: &str) -> Vec> { - self.0 - .iter() - .copied() - .filter_map(|(path, _)| { - if path.starts_with(prefix) { - Some(path.into()) - } else { - None - } - }) - .collect() - } - } } diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml deleted file mode 100644 index 7f235cbf48e322fc60f1cebee27e7d15a53d7014..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/_base.toml +++ /dev/null @@ -1,411 +0,0 @@ -[text] -base = { family = "Zed Sans", size = 14 } - -[workspace] -background = "$surface.0" -pane_divider = { width = 1, color = "$border.0" } -leader_border_opacity = 0.7 -leader_border_width = 2.0 - -[workspace.titlebar] -height = 32 -border = { width = 1, bottom = true, color = "$border.0" } -title = "$text.0" -avatar_width = 18 -avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } } -avatar_ribbon = { background = "#ff0000", height = 3, width = 12 } -outdated_warning = { extends = "$text.2", size = 13 } -share_icon_color = "$text.2.color" -share_icon_active_color = "$text.0.color" - -[workspace.titlebar.sign_in_prompt] -extends = "$text.2" -size = 13 -underline = true -padding = { right = 8 } - -[workspace.titlebar.hovered_sign_in_prompt] -extends = "$workspace.titlebar.sign_in_prompt" -color = "$text.1.color" - -[workspace.titlebar.offline_icon] -padding = { right = 4 } -width = 16 -color = "$text.2.color" - -[workspace.tab] -height = 34 -text = "$text.2" -padding = { left = 12, right = 12 } -icon_width = 8 -spacing = 10 -icon_close = "$text.2.color" -icon_close_active = "$text.0.color" -icon_dirty = "$status.info" -icon_conflict = "$status.warn" -border = { left = true, bottom = true, width = 1, color = "$border.0", overlay = true } - -[workspace.active_tab] -extends = "$workspace.tab" -border.bottom = false -background = "$surface.1" -text = "$text.0" - -[workspace.sidebar] -width = 30 -border = { right = true, width = 1, color = "$border.0" } - -[workspace.sidebar.resize_handle] -padding = { left = 1 } -background = "$border.0" - -[workspace.sidebar.item] -icon_color = "$text.2.color" -icon_size = 18 -height = "$workspace.tab.height" - -[workspace.sidebar.active_item] -extends = "$workspace.sidebar.item" -icon_color = "$text.0.color" - -[workspace.left_sidebar] -extends = "$workspace.sidebar" -border = { width = 1, color = "$border.0", right = true } - -[workspace.right_sidebar] -extends = "$workspace.sidebar" -border = { width = 1, color = "$border.0", left = true } - -[workspace.status_bar] -padding = { left = 6, right = 6 } -height = 24 -item_spacing = 8 -cursor_position = "$text.2" -diagnostic_message = "$text.2" -lsp_message = "$text.2" - -[workspace.toolbar] -background = "$surface.1" -border = { color = "$border.0", width = 1, left = false, right = false, bottom = true, top = false } -height = 34 -item_spacing = 8 -padding = { left = 16, right = 8, top = 4, bottom = 4 } - -[breadcrumbs] -extends = "$text.1" -padding = { left = 6 } - -[panel] -padding = { top = 12, left = 12, bottom = 12, right = 12 } - -[chat_panel] -extends = "$panel" -channel_name = { extends = "$text.0", weight = "bold" } -channel_name_hash = { text = "$text.2", padding.right = 8 } - -[chat_panel.message] -body = "$text.1" -sender = { extends = "$text.0", weight = "bold", margin.right = 8 } -timestamp = "$text.2" -padding.bottom = 6 - -[chat_panel.pending_message] -extends = "$chat_panel.message" -body = { color = "$text.3.color" } -sender = { color = "$text.3.color" } -timestamp = { color = "$text.3.color" } - -[chat_panel.channel_select.item] -padding = 4 -name = "$text.1" -hash = { extends = "$text.2", margin.right = 8 } - -[chat_panel.channel_select.hovered_item] -extends = "$chat_panel.channel_select.item" -background = "$state.hover" -corner_radius = 6 - -[chat_panel.channel_select.active_item] -extends = "$chat_panel.channel_select.item" -name = "$text.0" - -[chat_panel.channel_select.hovered_active_item] -extends = "$chat_panel.channel_select.hovered_item" -name = "$text.0" - -[chat_panel.channel_select.header] -extends = "$chat_panel.channel_select.active_item" -padding.bottom = 4 -padding.left = 0 - -[chat_panel.channel_select.menu] -padding = 4 -corner_radius = 6 -border = { color = "$border.0", width = 1 } -background = "$surface.0" -shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" } - -[chat_panel.input_editor] -background = "$surface.1" -corner_radius = 6 -padding = { left = 8, right = 8, top = 7, bottom = 7 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[chat_panel.sign_in_prompt] -extends = "$text.0" -underline = true - -[chat_panel.hovered_sign_in_prompt] -extends = "$chat_panel.sign_in_prompt" -color = "$text.1.color" - -[contacts_panel] -extends = "$panel" -host_row_height = 28 -host_avatar = { corner_radius = 10, width = 18 } -host_username = { extends = "$text.0", padding.left = 8 } -tree_branch_width = 1 -tree_branch_color = "$surface.2" - -[contacts_panel.project] -height = 24 -padding = { left = 8 } -guest_avatar = { corner_radius = 8, width = 14 } -guest_avatar_spacing = 4 - -[contacts_panel.project.name] -extends = "$text.1" -margin = { right = 6 } - -[contacts_panel.unshared_project] -extends = "$contacts_panel.project" - -[contacts_panel.hovered_unshared_project] -extends = "$contacts_panel.unshared_project" -background = "$state.hover" -corner_radius = 6 - -[contacts_panel.shared_project] -extends = "$contacts_panel.project" -name.color = "$text.0.color" - -[contacts_panel.hovered_shared_project] -extends = "$contacts_panel.shared_project" -background = "$state.hover" -corner_radius = 6 - -[project_panel] -extends = "$panel" -padding.top = 6 # ($workspace.tab.height - $project_panel.entry.height) / 2 - -[project_panel.entry] -text = "$text.1" -height = 22 -icon_color = "$text.3.color" -icon_size = 8 -icon_spacing = 8 - -[project_panel.hovered_entry] -extends = "$project_panel.entry" -background = "$state.hover" - -[project_panel.selected_entry] -extends = "$project_panel.entry" -text = { extends = "$text.0" } - -[project_panel.hovered_selected_entry] -extends = "$project_panel.hovered_entry" -text = { extends = "$text.0" } - -[selector] -background = "$surface.0" -padding = 8 -margin = { top = 52, bottom = 52 } -corner_radius = 6 -shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" } -border = { width = 1, color = "$border.0" } - -[selector.input_editor] -background = "$surface.1" -corner_radius = 6 -padding = { left = 16, right = 16, top = 7, bottom = 7 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[selector.empty] -text = "$text.2" -padding = { left = 16, right = 16, top = 8, bottom = 4 } - -[selector.item] -text = "$text.1" -highlight_text = { extends = "$text.base", color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" } -padding = { left = 16, right = 16, top = 4, bottom = 4 } -corner_radius = 6 - -[selector.active_item] -extends = "$selector.item" -background = "$state.hover" -text = "$text.0" - -[editor] -text_color = "$text.1.color" -background = "$surface.1" -gutter_background = "$surface.1" -gutter_padding_factor = 2.5 -active_line_background = "$state.active_line" -highlighted_line_background = "$state.highlighted_line" -rename_fade = 0.6 -unnecessary_code_fade = 0.5 -document_highlight_read_background = "#99999920" -document_highlight_write_background = "#99999916" -diff_background_deleted = "$state.deleted_line" -diff_background_inserted = "$state.inserted_line" -line_number = "$text.2.color" -line_number_active = "$text.0.color" -selection = "$selection.host" -guest_selections = "$selection.guests" -error_color = "$status.bad" -code_actions_indicator = "$text.3.color" - -[editor.diagnostic_path_header] -background = "$state.active_line" -filename = { extends = "$text.0", size = 14 } -path = { extends = "$text.2", size = 14, margin.left = 12 } -text_scale_factor = 0.857 - -[editor.diagnostic_header] -background = "$editor.background" -border = { width = 1, top = true, bottom = true, color = "$border.1" } -code = { extends = "$text.2", size = 14, margin.left = 10 } -icon_width_factor = 1.5 -text_scale_factor = 0.857 - -[editor.diagnostic_header.message] -text = { extends = "$text.1", size = 14 } -highlight_text = { extends = "$text.0", size = 14, weight = "bold" } - -[editor.error_diagnostic] -header.border = { width = 1, top = true, color = "$border.0" } -text_scale_factor = 0.857 - -[editor.error_diagnostic.message] -text = { extends = "$text.1", size = 14, color = "$status.bad" } -highlight_text = { extends = "$text.1", size = 14, color = "$status.bad", weight = "bold" } - -[editor.warning_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.warn" -message.highlight_text.color = "$status.warn" - -[editor.information_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.info" -message.highlight_text.color = "$status.info" - -[editor.hint_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$status.info" -message.highlight_text.color = "$status.info" - -[editor.invalid_error_diagnostic] -extends = "$editor.error_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_warning_diagnostic] -extends = "$editor.warning_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_information_diagnostic] -extends = "$editor.information_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.invalid_hint_diagnostic] -extends = "$editor.hint_diagnostic" -message.text.color = "$text.3.color" -message.highlight_text.color = "$text.3.color" - -[editor.autocomplete] -background = "$surface.2" -border = { width = 2, color = "$border.1" } -corner_radius = 6 -padding = 6 -match_highlight = { color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" } -margin.left = -14 - -[editor.autocomplete.item] -padding = { left = 6, right = 6, top = 2, bottom = 2 } -corner_radius = 6 - -[editor.autocomplete.selected_item] -extends = "$editor.autocomplete.item" -background = "$state.selected" - -[editor.autocomplete.hovered_item] -extends = "$editor.autocomplete.item" -background = "$state.hover" - -[project_diagnostics] -background = "$surface.1" -empty_message = { extends = "$text.0", size = 18 } -status_bar_item = { extends = "$text.2", margin.right = 10 } -tab_icon_width = 13 -tab_icon_spacing = 4 -tab_summary_spacing = 10 - -[search] -match_background = "$state.highlighted_line" -results_status = { extends = "$text.0", size = 18 } -tab_icon_width = 14 -tab_icon_spacing = 4 - -[search.option_button] -extends = "$text.1" -padding = { left = 6, right = 6, top = 1, bottom = 1 } -corner_radius = 6 -background = "$surface.1" -border = { width = 1, color = "$border.0" } -margin.left = 1 -margin.right = 1 - -[search.option_button_group] -padding = { left = 2, right = 2 } - -[search.active_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.hovered_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.active_hovered_option_button] -extends = "$search.option_button" -background = "$surface.2" - -[search.match_index] -extends = "$text.2" -padding = 6 - -[search.editor] -min_width = 200 -max_width = 500 -background = "$surface.0" -corner_radius = 6 -padding = { left = 14, right = 14, top = 3, bottom = 3 } -margin = { right = 5 } -text = "$text.0" -placeholder_text = "$text.2" -selection = "$selection.host" -border = { width = 1, color = "$border.0" } - -[search.invalid_editor] -extends = "$search.editor" -border = { width = 1, color = "$status.bad" } diff --git a/crates/zed/assets/themes/black.toml b/crates/zed/assets/themes/black.toml deleted file mode 100644 index 34de16627ec3b5c0e9313f1d784881b322ade52e..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/black.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#222222" -1 = "#0f0b0c" -2 = "#131415" - -[border] -0 = "#000000B2" -1 = "#FFFFFF20" - -[text] -0 = { extends = "$text.base", color = "#ffffff" } -1 = { extends = "$text.base", color = "#b3b3b3" } -2 = { extends = "$text.base", color = "#7b7d80" } -3 = { extends = "$text.base", color = "#66686A" } - -[shadow] -0 = "#00000052" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#161313" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#00000033" -selected = "#00000088" - -[editor.syntax] -keyword = { color = "#0086c0", weight = "bold" } -function = "#dcdcaa" -string = "#cb8f77" -type = "#4ec9b0" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#9cdcfe" -title = { color = "#9cdcfe", weight = "bold" } -emphasis = "#4ec9b0" -"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#cb8f77", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000aa" diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json new file mode 100644 index 0000000000000000000000000000000000000000..65bf78b140ff3c94c298982cf2b3a6f6b8210609 --- /dev/null +++ b/crates/zed/assets/themes/dark.json @@ -0,0 +1,1245 @@ +{ + "selector": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 8, + "item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + } + }, + "active_item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + }, + "background": "#e6e6e6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "empty": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 8 + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "placeholder_text": { + "family": "Zed Sans", + "color": "#bfbfbf", + "size": 14 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 16, + "right": 16, + "top": 7 + } + }, + "margin": { + "bottom": 52, + "top": 52 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + }, + "workspace": { + "background": "#e6e6e6", + "leader_border_opacity": 0.7, + "leader_border_width": 2, + "tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": true, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + } + }, + "active_tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": false, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + }, + "background": "#cccccc" + }, + "left_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "right": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "right_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "pane_divider": { + "color": "#d9d9d9", + "width": 1 + }, + "status_bar": { + "height": 24, + "item_spacing": 8, + "padding": { + "left": 6, + "right": 6 + }, + "cursor_position": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "diagnostic_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "lsp_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + } + }, + "titlebar": { + "avatar_width": 18, + "height": 32, + "share_icon_color": "#808080", + "share_icon_active_color": "#0d0d0d", + "title": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "avatar": { + "corner_radius": 10, + "border": { + "color": "#00000088", + "width": 1 + } + }, + "avatar_ribbon": { + "height": 3, + "width": 12 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "size": 13, + "underline": true, + "padding": { + "right": 8 + } + }, + "hovered_sign_in_prompt": { + "family": "Zed Mono", + "color": "#000000", + "size": 16, + "underline": true, + "padding": { + "right": 8 + } + }, + "offline_icon": { + "color": "#999999", + "width": 16, + "padding": { + "right": 4 + } + }, + "outdated_warning": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 13 + } + }, + "toolbar": { + "height": 34, + "background": "#cccccc", + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "item_spacing": 8, + "padding": { + "left": 16, + "right": 8, + "top": 4, + "bottom": 4 + } + }, + "breadcrumbs": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "padding": { + "left": 6 + } + }, + "disconnected_overlay": { + "family": "Zed Sans", + "color": "#ffffff", + "size": 14, + "background": "#000000aa" + } + }, + "editor": { + "text_color": "#595959", + "background": "#cccccc", + "active_line_background": "#000000", + "code_actions_indicator": "#808080", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#e6e6e6", + "document_highlight_write_background": "#e6e6e6", + "error_color": "#f78c8c", + "gutter_background": "#cccccc", + "gutter_padding_factor": 2.5, + "highlighted_line_background": "#000000", + "line_number": "#000000", + "line_number_active": "#000000", + "rename_fade": 0.6, + "unnecessary_code_fade": 0.5, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "guest_selections": [ + { + "cursor": "#777af4", + "selection": "#777af4" + }, + { + "cursor": "#23d464", + "selection": "#23d464" + }, + { + "cursor": "#f98a3d", + "selection": "#f98a3d" + }, + { + "cursor": "#b671f8", + "selection": "#b671f8" + }, + { + "cursor": "#16ddc7", + "selection": "#16ddc7" + }, + { + "cursor": "#f58ac0", + "selection": "#f58ac0" + }, + { + "cursor": "#f6bc09", + "selection": "#f6bc09" + } + ], + "autocomplete": { + "background": "#bfbfbf", + "corner_radius": 6, + "padding": 6, + "border": { + "color": "#b3b3b3", + "width": 1 + }, + "item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + } + }, + "hovered_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + }, + "margin": { + "left": -14 + }, + "match_highlight": { + "color": "#59c3f5", + "weight": "normal" + }, + "selected_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + } + }, + "diagnostic_header": { + "background": "#e6e6e6", + "icon_width_factor": 1.5, + "text_scale_factor": 0.857, + "border": { + "color": "#b3b3b3", + "width": 1, + "bottom": true, + "top": true + }, + "code": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 10 + } + }, + "message": { + "highlight_text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "weight": "bold" + }, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + } + } + }, + "diagnostic_path_header": { + "background": "#000000", + "text_scale_factor": 0.857, + "filename": { + "family": "Zed Mono", + "color": "#262626", + "size": 14 + }, + "path": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 12 + } + } + }, + "error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14, + "weight": "bold" + } + } + }, + "warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14, + "weight": "bold" + } + } + }, + "information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "syntax": {} + }, + "project_diagnostics": { + "background": "#cccccc", + "tab_icon_spacing": 4, + "tab_icon_width": 13, + "tab_summary_spacing": 10, + "empty_message": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "status_bar_item": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 10 + } + } + }, + "project_panel": { + "padding": { + "top": 6 + }, + "entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "hovered_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "selected_entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + }, + "hovered_selected_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + } + }, + "chat_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "channel_name": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14 + }, + "channel_name_hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "padding": { + "right": 8 + } + }, + "channel_select": { + "header": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 0 + }, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "menu": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 4, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + } + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "underline": true, + "size": 14 + }, + "hovered_sign_in_prompt": { + "family": "Zed Sans", + "color": "#262626", + "underline": true, + "size": 14 + }, + "message": { + "body": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "pending_message": { + "body": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#8c8c8c", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "placeholder_text": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 8, + "right": 8, + "top": 7 + } + } + }, + "contacts_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "host_row_height": 28, + "tree_branch_color": "#bfbfbf", + "tree_branch_width": 1, + "host_avatar": { + "corner_radius": 10, + "width": 18 + }, + "host_username": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": { + "left": 8 + } + }, + "project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + }, + "unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + } + }, + "search": { + "match_background": "#000000", + "tab_icon_spacing": 4, + "tab_icon_width": 14, + "active_hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "active_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "invalid_editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#ffffff", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "match_index": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": 6 + }, + "option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#cccccc", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "option_button_group": { + "padding": { + "left": 2, + "right": 2 + } + }, + "results_status": { + "family": "Zed Mono", + "color": "#262626", + "size": 18 + } + }, + "breadcrumbs": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "padding": { + "left": 6 + } + } +} \ No newline at end of file diff --git a/crates/zed/assets/themes/dark.toml b/crates/zed/assets/themes/dark.toml deleted file mode 100644 index fa673ac446426fed977dcf34abaa5361754e4db0..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/dark.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#283340" -1 = "#1C2733" -2 = "#1C2733" - -[border] -0 = "#1B222B" -1 = "#FFFFFF20" - -[text] -0 = { extends = "$text.base", color = "#FFFFFF" } -1 = { extends = "$text.base", color = "#CDD1E2" } -2 = { extends = "$text.base", color = "#9BA8BE" } -3 = { extends = "$text.base", color = "#6E7483" } - -[shadow] -0 = "#00000052" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#00000022" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#00000033" -selected = "#00000088" - -[editor.syntax] -keyword = { color = "#0086c0", weight = "bold" } -function = "#dcdcaa" -string = "#cb8f77" -type = "#4ec9b0" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#9cdcfe" -title = { color = "#9cdcfe", weight = "bold" } -emphasis = "#4ec9b0" -"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#cb8f77", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000aa" diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json new file mode 100644 index 0000000000000000000000000000000000000000..65bf78b140ff3c94c298982cf2b3a6f6b8210609 --- /dev/null +++ b/crates/zed/assets/themes/light.json @@ -0,0 +1,1245 @@ +{ + "selector": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 8, + "item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + } + }, + "active_item": { + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 4 + }, + "corner_radius": 6, + "text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#2db4f3", + "weight": "bold", + "size": 14 + }, + "background": "#e6e6e6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "empty": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 16, + "right": 16, + "top": 8 + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "placeholder_text": { + "family": "Zed Sans", + "color": "#bfbfbf", + "size": 14 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 16, + "right": 16, + "top": 7 + } + }, + "margin": { + "bottom": 52, + "top": 52 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + }, + "workspace": { + "background": "#e6e6e6", + "leader_border_opacity": 0.7, + "leader_border_width": 2, + "tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": true, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + } + }, + "active_tab": { + "height": 34, + "icon_close": "#808080", + "icon_close_active": "#0d0d0d", + "icon_conflict": "#f8c570", + "icon_dirty": "#6099f7", + "icon_width": 8, + "spacing": 10, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true, + "bottom": false, + "overlay": true + }, + "padding": { + "left": 12, + "right": 12 + }, + "background": "#cccccc" + }, + "left_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "right": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "right_sidebar": { + "width": 30, + "border": { + "color": "#d9d9d9", + "width": 1, + "left": true + }, + "item": { + "height": 32, + "icon_color": "#808080", + "icon_size": 18 + }, + "active_item": { + "height": 32, + "icon_color": "#4d4d4d", + "icon_size": 18 + }, + "resize_handle": { + "background": "#d9d9d9", + "padding": { + "left": 1 + } + } + }, + "pane_divider": { + "color": "#d9d9d9", + "width": 1 + }, + "status_bar": { + "height": 24, + "item_spacing": 8, + "padding": { + "left": 6, + "right": 6 + }, + "cursor_position": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "diagnostic_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "lsp_message": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + } + }, + "titlebar": { + "avatar_width": 18, + "height": 32, + "share_icon_color": "#808080", + "share_icon_active_color": "#0d0d0d", + "title": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "avatar": { + "corner_radius": 10, + "border": { + "color": "#00000088", + "width": 1 + } + }, + "avatar_ribbon": { + "height": 3, + "width": 12 + }, + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "size": 13, + "underline": true, + "padding": { + "right": 8 + } + }, + "hovered_sign_in_prompt": { + "family": "Zed Mono", + "color": "#000000", + "size": 16, + "underline": true, + "padding": { + "right": 8 + } + }, + "offline_icon": { + "color": "#999999", + "width": 16, + "padding": { + "right": 4 + } + }, + "outdated_warning": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 13 + } + }, + "toolbar": { + "height": 34, + "background": "#cccccc", + "border": { + "color": "#d9d9d9", + "width": 1, + "bottom": true + }, + "item_spacing": 8, + "padding": { + "left": 16, + "right": 8, + "top": 4, + "bottom": 4 + } + }, + "breadcrumbs": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "padding": { + "left": 6 + } + }, + "disconnected_overlay": { + "family": "Zed Sans", + "color": "#ffffff", + "size": 14, + "background": "#000000aa" + } + }, + "editor": { + "text_color": "#595959", + "background": "#cccccc", + "active_line_background": "#000000", + "code_actions_indicator": "#808080", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#e6e6e6", + "document_highlight_write_background": "#e6e6e6", + "error_color": "#f78c8c", + "gutter_background": "#cccccc", + "gutter_padding_factor": 2.5, + "highlighted_line_background": "#000000", + "line_number": "#000000", + "line_number_active": "#000000", + "rename_fade": 0.6, + "unnecessary_code_fade": 0.5, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "guest_selections": [ + { + "cursor": "#777af4", + "selection": "#777af4" + }, + { + "cursor": "#23d464", + "selection": "#23d464" + }, + { + "cursor": "#f98a3d", + "selection": "#f98a3d" + }, + { + "cursor": "#b671f8", + "selection": "#b671f8" + }, + { + "cursor": "#16ddc7", + "selection": "#16ddc7" + }, + { + "cursor": "#f58ac0", + "selection": "#f58ac0" + }, + { + "cursor": "#f6bc09", + "selection": "#f6bc09" + } + ], + "autocomplete": { + "background": "#bfbfbf", + "corner_radius": 6, + "padding": 6, + "border": { + "color": "#b3b3b3", + "width": 1 + }, + "item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + } + }, + "hovered_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + }, + "margin": { + "left": -14 + }, + "match_highlight": { + "color": "#59c3f5", + "weight": "normal" + }, + "selected_item": { + "corner_radius": 6, + "padding": { + "bottom": 2, + "left": 6, + "right": 6, + "top": 2 + }, + "background": "#bfbfbf" + } + }, + "diagnostic_header": { + "background": "#e6e6e6", + "icon_width_factor": 1.5, + "text_scale_factor": 0.857, + "border": { + "color": "#b3b3b3", + "width": 1, + "bottom": true, + "top": true + }, + "code": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 10 + } + }, + "message": { + "highlight_text": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "weight": "bold" + }, + "text": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + } + } + }, + "diagnostic_path_header": { + "background": "#000000", + "text_scale_factor": 0.857, + "filename": { + "family": "Zed Mono", + "color": "#262626", + "size": 14 + }, + "path": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 14, + "margin": { + "left": 12 + } + } + }, + "error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f78c8c", + "size": 14, + "weight": "bold" + } + } + }, + "warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#f8c570", + "size": 14, + "weight": "bold" + } + } + }, + "information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#6099f7", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_error_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_hint_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_information_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "invalid_warning_diagnostic": { + "text_scale_factor": 0.857, + "header": { + "border": { + "color": "#d9d9d9", + "width": 1, + "top": true + } + }, + "message": { + "text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "highlight_text": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "weight": "bold" + } + } + }, + "syntax": {} + }, + "project_diagnostics": { + "background": "#cccccc", + "tab_icon_spacing": 4, + "tab_icon_width": 13, + "tab_summary_spacing": 10, + "empty_message": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "status_bar_item": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 10 + } + } + }, + "project_panel": { + "padding": { + "top": 6 + }, + "entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "hovered_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#595959", + "size": 16 + } + }, + "selected_entry": { + "height": 22, + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + }, + "hovered_selected_entry": { + "height": 22, + "background": "#cccccc", + "icon_color": "#999999", + "icon_size": 8, + "icon_spacing": 8, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + } + } + }, + "chat_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "channel_name": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14 + }, + "channel_name_hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "padding": { + "right": 8 + } + }, + "channel_select": { + "header": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": { + "bottom": 4, + "left": 0 + }, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_item": { + "name": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "corner_radius": 0 + }, + "hovered_active_item": { + "name": { + "family": "Zed Sans", + "color": "#262626", + "size": 14 + }, + "padding": 4, + "hash": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14, + "margin": { + "right": 8 + } + }, + "background": "#cccccc", + "corner_radius": 6 + }, + "menu": { + "background": "#e6e6e6", + "corner_radius": 6, + "padding": 4, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "shadow": { + "blur": 16, + "color": "#00000052", + "offset": [ + 0, + 2 + ] + } + } + }, + "sign_in_prompt": { + "family": "Zed Sans", + "color": "#595959", + "underline": true, + "size": 14 + }, + "hovered_sign_in_prompt": { + "family": "Zed Sans", + "color": "#262626", + "underline": true, + "size": 14 + }, + "message": { + "body": { + "family": "Zed Sans", + "color": "#595959", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#262626", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "pending_message": { + "body": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "timestamp": { + "family": "Zed Sans", + "color": "#8c8c8c", + "size": 14 + }, + "padding": { + "bottom": 6 + }, + "sender": { + "family": "Zed Sans", + "color": "#8c8c8c", + "weight": "bold", + "size": 14, + "margin": { + "right": 8 + } + } + }, + "input_editor": { + "background": "#cccccc", + "corner_radius": 6, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "placeholder_text": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "padding": { + "bottom": 7, + "left": 8, + "right": 8, + "top": 7 + } + } + }, + "contacts_panel": { + "padding": { + "top": 12, + "left": 12, + "bottom": 12, + "right": 12 + }, + "host_row_height": 28, + "tree_branch_color": "#bfbfbf", + "tree_branch_width": 1, + "host_avatar": { + "corner_radius": 10, + "width": 18 + }, + "host_username": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": { + "left": 8 + } + }, + "project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_shared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#262626", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + }, + "unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + } + }, + "hovered_unshared_project": { + "guest_avatar_spacing": 4, + "height": 24, + "guest_avatar": { + "corner_radius": 8, + "width": 14 + }, + "name": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "margin": { + "right": 6 + } + }, + "padding": { + "left": 8 + }, + "background": "#000000", + "corner_radius": 6 + } + }, + "search": { + "match_background": "#000000", + "tab_icon_spacing": 4, + "tab_icon_width": 14, + "active_hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "active_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "hovered_option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#bfbfbf", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "invalid_editor": { + "background": "#e6e6e6", + "corner_radius": 6, + "min_width": 200, + "max_width": 500, + "placeholder_text": { + "family": "Zed Mono", + "color": "#bfbfbf", + "size": 16 + }, + "selection": { + "cursor": "#4287f6", + "selection": "#4287f6" + }, + "text": { + "family": "Zed Mono", + "color": "#262626", + "size": 16 + }, + "border": { + "color": "#ffffff", + "width": 1 + }, + "margin": { + "right": 5 + }, + "padding": { + "top": 3, + "bottom": 3, + "left": 14, + "right": 14 + } + }, + "match_index": { + "family": "Zed Mono", + "color": "#8c8c8c", + "size": 16, + "padding": 6 + }, + "option_button": { + "family": "Zed Mono", + "color": "#595959", + "size": 16, + "background": "#cccccc", + "corner_radius": 6, + "border": { + "color": "#d9d9d9", + "width": 1 + }, + "margin": { + "left": 1, + "right": 1 + }, + "padding": { + "bottom": 1, + "left": 6, + "right": 6, + "top": 1 + } + }, + "option_button_group": { + "padding": { + "left": 2, + "right": 2 + } + }, + "results_status": { + "family": "Zed Mono", + "color": "#262626", + "size": 18 + } + }, + "breadcrumbs": { + "family": "Zed Sans", + "color": "#262626", + "size": 14, + "padding": { + "left": 6 + } + } +} \ No newline at end of file diff --git a/crates/zed/assets/themes/light.toml b/crates/zed/assets/themes/light.toml deleted file mode 100644 index 2884515e09f41fc1ade19d886604e6af5ff2a1ae..0000000000000000000000000000000000000000 --- a/crates/zed/assets/themes/light.toml +++ /dev/null @@ -1,67 +0,0 @@ -extends = "_base" - -[surface] -0 = "#EAEAEB" -1 = "#FAFAFA" -2 = "#FFFFFF" - -[border] -0 = "#DDDDDC" -1 = "#0000000F" - -[text] -0 = { extends = "$text.base", color = "#000000" } -1 = { extends = "$text.base", color = "#29292B" } -2 = { extends = "$text.base", color = "#7E7E83" } -3 = { extends = "$text.base", color = "#939393" } - -[shadow] -0 = "#0000000D" - -[selection] -host = { selection = "#3B57BC55", cursor = "$text.0.color" } -guests = [ - { selection = "#D0453B33", cursor = "#D0453B" }, - { selection = "#3B874B33", cursor = "#3B874B" }, - { selection = "#BD7CB433", cursor = "#BD7CB4" }, - { selection = "#EE823133", cursor = "#EE8231" }, - { selection = "#5A2B9233", cursor = "#5A2B92" }, - { selection = "#FDF35133", cursor = "#FDF351" }, - { selection = "#4EACAD33", cursor = "#4EACAD" }, -] - -[status] -good = "#4fac63" -info = "#3c5dd4" -warn = "#faca50" -bad = "#b7372e" - -[state] -active_line = "#00000008" -highlighted_line = "#faca5033" -deleted_line = "#dd000036" -inserted_line = "#00dd0036" -hover = "#0000000D" -selected = "#0000001c" - -[editor.syntax] -keyword = { color = "#0000fa", weight = "bold" } -function = "#795e26" -string = "#a82121" -type = "#267f29" -number = "#b5cea8" -comment = "#6a9955" -property = "#4e94ce" -variant = "#4fc1ff" -constant = "#5a9ccc" -title = { color = "#5a9ccc", weight = "bold" } -emphasis = "#267f29" -"emphasis.strong" = { color = "#267f29", weight = "bold" } -link_uri = { color = "#6a9955", underline = true } -link_text = { color = "#a82121", italic = true } -list_marker = "#4e94ce" - -[workspace.disconnected_overlay] -extends = "$text.base" -color = "#ffffff" -background = "#000000cc" diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index aec0bc533e4a1842789b813c4fc060eaa334e165..dd4268fd76902294345138e4c9d340378c894434 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -988,7 +988,8 @@ mod tests { lazy_static::lazy_static! { static ref DEFAULT_THEME: parking_lot::Mutex>> = Default::default(); static ref FONTS: Vec>> = vec![ - Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into() + Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into(), + Assets.load("fonts/zed-mono/zed-mono-extended.ttf").unwrap().to_vec().into(), ]; } diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index ced82e98664980b3d1af9f50d8f4f8f498f59d49..d67860cee66a0ec7abd7d37da8b10f0a6c930488 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -7,11 +7,11 @@ import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; for (let theme of themes) { - let styleTree = decamelizeTree(app(theme)); - let styleTreeJSON = JSON.stringify(styleTree, null, 2); - let outPath = path.resolve( - `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` - ); - fs.writeFileSync(outPath, styleTreeJSON); - console.log(`Generated ${outPath}`); + let styleTree = decamelizeTree(app(theme)); + let styleTreeJSON = JSON.stringify(styleTree, null, 2); + let outPath = path.resolve( + `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` + ); + fs.writeFileSync(outPath, styleTreeJSON); + console.log(`Generated ${outPath}`); } diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index c7edfdc2701f06e6cb1b41beb779ad6bc0aca75b..d26ada4fc9bc6ebab7c63255245ff003dfae0640 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,6 +1,7 @@ import Theme from "../themes/theme"; import chatPanel from "./chatPanel"; import { backgroundColor, borderColor, text } from "./components"; +import contactsPanel from "./contactsPanel"; import editor from "./editor"; import projectPanel from "./projectPanel"; import search from "./search"; @@ -8,83 +9,38 @@ import selectorModal from "./selectorModal"; import workspace from "./workspace"; export const panel = { - padding: { top: 12, left: 12, bottom: 12, right: 12 }, + padding: { top: 12, left: 12, bottom: 12, right: 12 }, }; export default function app(theme: Theme): Object { - return { - selector: selectorModal(theme), - workspace: workspace(theme), - editor: editor(theme), - projectDiagnostics: { - background: backgroundColor(theme, 300), - tabIconSpacing: 4, - tabIconWidth: 13, - tabSummarySpacing: 10, - emptyMessage: { - ...text(theme, "sans", "primary", { size: "lg" }), - }, - statusBarItem: { - ...text(theme, "sans", "muted"), - margin: { - right: 10, + return { + selector: selectorModal(theme), + workspace: workspace(theme), + editor: editor(theme), + projectDiagnostics: { + background: backgroundColor(theme, 300), + tabIconSpacing: 4, + tabIconWidth: 13, + tabSummarySpacing: 10, + emptyMessage: { + ...text(theme, "sans", "primary", { size: "lg" }), + }, + statusBarItem: { + ...text(theme, "sans", "muted"), + margin: { + right: 10, + }, + }, }, - }, - }, - projectPanel: projectPanel(theme), - chatPanel: chatPanel(theme), - contactsPanel: { - ...panel, - hostRowHeight: 28, - treeBranchColor: borderColor(theme, "muted"), - treeBranchWidth: 1, - hostAvatar: { - cornerRadius: 10, - width: 18, - }, - hostUsername: { - ...text(theme, "mono", "muted"), - padding: { - left: 8, - }, - }, - hoveredSharedProject: { - extends: "$contacts_panel.sharedProject", - background: theme.editor.line.active.value, - cornerRadius: 6, - }, - hoveredUnsharedProject: { - extends: "$contacts_panel.unsharedProject", - background: theme.editor.line.active.value, - cornerRadius: 6, - }, - project: { - guestAvatarSpacing: 4, - height: 24, - guestAvatar: { - cornerRadius: 8, - width: 14, - }, - name: { - extends: text(theme, "mono", "secondary"), - margin: { - right: 6, - }, - }, - padding: { - left: 8, - }, - }, - sharedProject: { - extends: "$contactsPanel.project", - name: { - color: text(theme, "mono", "primary"), - }, - }, - unsharedProject: { - extends: "$contactsPanel.project", - }, - }, - search: search(theme), - }; + projectPanel: projectPanel(theme), + chatPanel: chatPanel(theme), + contactsPanel: contactsPanel(theme), + search: search(theme), + breadcrumbs: { + ...text(theme, "sans", "primary"), + padding: { + left: 6, + }, + } + }; } diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts index 55a64cb1ecb4ec8f60878d9e795f671a9a5cfede..205fd9b26200510d7adeb4f226ed893e8a17bbaa 100644 --- a/styles/styleTree/components.ts +++ b/styles/styleTree/components.ts @@ -1,25 +1,25 @@ import chroma from "chroma-js"; -import Theme, { BackgroundColor, Weight } from "../themes/theme"; -import core from "../tokens/core"; +import Theme, { BackgroundColor } from "../themes/theme"; +import { fontFamilies, fontSizes, FontWeight } from "../tokens"; import { Color } from "../utils/color"; export type TextColor = keyof Theme["textColor"]; export function text( theme: Theme, - fontFamily: keyof typeof core.fontFamily, + fontFamily: keyof typeof fontFamilies, color: TextColor, properties?: { - size?: keyof typeof core["fontSize"]; - weight?: Weight; + size?: keyof typeof fontSizes; + weight?: FontWeight; underline?: boolean; } ) { const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md"; - const size = core.fontSize[sizeKey].value; + const size = fontSizes[sizeKey].value; return { - family: core.fontFamily[fontFamily], + family: fontFamilies[fontFamily].value, color: theme.textColor[color].value, ...properties, size, diff --git a/styles/styleTree/contactsPanel.ts b/styles/styleTree/contactsPanel.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b88a35f13692712cd61c89d4af75476d7bb49c6 --- /dev/null +++ b/styles/styleTree/contactsPanel.ts @@ -0,0 +1,61 @@ +import Theme from "../themes/theme"; +import { panel } from "./app"; +import { borderColor, text } from "./components"; + +export default function(theme: Theme) { + const project = { + guestAvatarSpacing: 4, + height: 24, + guestAvatar: { + cornerRadius: 8, + width: 14, + }, + name: { + ...text(theme, "mono", "secondary"), + margin: { + right: 6, + }, + }, + padding: { + left: 8, + }, + }; + + const sharedProject = { + ...project, + name: { + ...project.name, + ...text(theme, "mono", "primary"), + }, + }; + + return { + ...panel, + hostRowHeight: 28, + treeBranchColor: borderColor(theme, "muted"), + treeBranchWidth: 1, + hostAvatar: { + cornerRadius: 10, + width: 18, + }, + hostUsername: { + ...text(theme, "mono", "muted"), + padding: { + left: 8, + }, + }, + project, + sharedProject, + hoveredSharedProject: { + ...sharedProject, + background: theme.editor.line.active.value, + cornerRadius: 6, + }, + unsharedProject: project, + hoveredUnsharedProject: { + ...project, + background: theme.editor.line.active.value, + cornerRadius: 6, + }, + } +} \ No newline at end of file diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index 5d800881e2750942c2b7d6f1113df203aff97fb3..ebc53b405875dab197a3c95d5373732050e9a7a0 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -1,131 +1,134 @@ import Theme from "../themes/theme"; import { - backgroundColor, - border, - iconColor, - player, - text, - TextColor + backgroundColor, + border, + iconColor, + player, + text, + TextColor, } from "./components"; export default function editor(theme: Theme) { - const autocompleteItem = { - cornerRadius: 6, - padding: { - bottom: 2, - left: 6, - right: 6, - top: 2, - }, - }; - - function diagnostic(theme: Theme, color: TextColor) { - return { - textScaleFactor: 0.857, - header: { - border: border(theme, "primary", { - top: true, - }), - }, - message: { - text: text(theme, "sans", color, { size: "sm" }), - highlightText: text(theme, "sans", color, { - size: "sm", - weight: "bold", - }), - }, + const autocompleteItem = { + cornerRadius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, }; - } - return { - textColor: theme.textColor.secondary.value, - background: backgroundColor(theme, 300), - activeLineBackground: theme.editor.line.active.value, - codeActionsIndicator: iconColor(theme, "secondary"), - diffBackgroundDeleted: backgroundColor(theme, "error"), - diffBackgroundInserted: backgroundColor(theme, "ok"), - documentHighlightReadBackground: theme.editor.highlight.occurrence.value, - documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, - errorColor: theme.textColor.error, - gutterBackground: backgroundColor(theme, 300), - gutterPaddingFactor: 2.5, - highlightedLineBackground: theme.editor.line.highlighted.value, - lineNumber: theme.editor.gutter.primary.value, - lineNumberActive: theme.editor.gutter.active, - renameFade: 0.6, - unnecessaryCodeFade: 0.5, - selection: player(theme, 1).selection, - guestSelections: [ - player(theme, 2).selection, - player(theme, 3).selection, - player(theme, 4).selection, - player(theme, 5).selection, - player(theme, 6).selection, - player(theme, 7).selection, - player(theme, 8).selection, - ], - autocomplete: { - background: backgroundColor(theme, 100), - cornerRadius: 6, - padding: 6, - border: border(theme, "secondary"), - item: autocompleteItem, - hoveredItem: { - ...autocompleteItem, - background: backgroundColor(theme, 100, "hovered"), - }, - margin: { - left: -14, - }, - matchHighlight: { - color: theme.syntax.keyword.color.value, - weight: theme.syntax.keyword.weight.value, - }, - selectedItem: { - ...autocompleteItem, - background: backgroundColor(theme, 100, "active"), - }, - }, - diagnosticHeader: { - background: theme.editor.background.value, - iconWidthFactor: 1.5, - textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. - border: border(theme, "secondary", { - bottom: true, - top: true, - }), - code: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 10, + function diagnostic(theme: Theme, color: TextColor) { + return { + textScaleFactor: 0.857, + header: { + border: border(theme, "primary", { + top: true, + }), + }, + message: { + text: text(theme, "sans", color, { size: "sm" }), + highlightText: text(theme, "sans", color, { + size: "sm", + weight: "bold", + }), + }, + }; + } + + return { + textColor: theme.textColor.secondary.value, + background: backgroundColor(theme, 300), + activeLineBackground: theme.editor.line.active.value, + codeActionsIndicator: iconColor(theme, "secondary"), + diffBackgroundDeleted: backgroundColor(theme, "error"), + diffBackgroundInserted: backgroundColor(theme, "ok"), + documentHighlightReadBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, + errorColor: theme.textColor.error.value, + gutterBackground: backgroundColor(theme, 300), + gutterPaddingFactor: 2.5, + highlightedLineBackground: theme.editor.line.highlighted.value, + lineNumber: theme.editor.gutter.primary.value, + lineNumberActive: theme.editor.gutter.active.value, + renameFade: 0.6, + unnecessaryCodeFade: 0.5, + selection: player(theme, 1).selection, + guestSelections: [ + player(theme, 2).selection, + player(theme, 3).selection, + player(theme, 4).selection, + player(theme, 5).selection, + player(theme, 6).selection, + player(theme, 7).selection, + player(theme, 8).selection, + ], + autocomplete: { + background: backgroundColor(theme, 100), + cornerRadius: 6, + padding: 6, + border: border(theme, "secondary"), + item: autocompleteItem, + hoveredItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "hovered"), + }, + margin: { + left: -14, + }, + matchHighlight: { + color: theme.syntax.keyword.color.value, + weight: theme.syntax.keyword.weight.value, + }, + selectedItem: { + ...autocompleteItem, + background: backgroundColor(theme, 100, "active"), + }, + }, + diagnosticHeader: { + background: theme.editor.background.value, + iconWidthFactor: 1.5, + textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. + border: border(theme, "secondary", { + bottom: true, + top: true, + }), + code: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 10, + }, + }, + message: { + highlightText: text(theme, "sans", "primary", { + size: "sm", + weight: "bold", + }), + text: text(theme, "sans", "secondary", { size: "sm" }), + }, }, - }, - message: { - highlightText: text(theme, "sans", "primary", { - size: "sm", - weight: "bold", - }), - text: text(theme, "sans", "secondary", { size: "sm" }), - }, - }, - diagnosticPathHeader: { - background: theme.editor.line.active, - textScaleFactor: 0.857, - filename: text(theme, "mono", "primary", { size: "sm" }), - path: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 12, + diagnosticPathHeader: { + background: theme.editor.line.active.value, + textScaleFactor: 0.857, + filename: text(theme, "mono", "primary", { size: "sm" }), + path: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 12, + }, + }, }, - }, - }, - errorDiagnostic: diagnostic(theme, "error"), - warningDiagnostic: diagnostic(theme, "warning"), - informationDiagnostic: diagnostic(theme, "info"), - hintDiagnostic: diagnostic(theme, "info"), - invalidErrorDiagnostic: diagnostic(theme, "muted"), - invalidHintDiagnostic: diagnostic(theme, "muted"), - invalidInformationDiagnostic: diagnostic(theme, "muted"), - invalidWarningDiagnostic: diagnostic(theme, "muted"), - }; + errorDiagnostic: diagnostic(theme, "error"), + warningDiagnostic: diagnostic(theme, "warning"), + informationDiagnostic: diagnostic(theme, "info"), + hintDiagnostic: diagnostic(theme, "info"), + invalidErrorDiagnostic: diagnostic(theme, "muted"), + invalidHintDiagnostic: diagnostic(theme, "muted"), + invalidInformationDiagnostic: diagnostic(theme, "muted"), + invalidWarningDiagnostic: diagnostic(theme, "muted"), + syntax: { + + } + }; } diff --git a/styles/styleTree/projectPanel.ts b/styles/styleTree/projectPanel.ts index 3b5fba8853da3799e69be735447e615341ef8391..cd6fb49b3ada1db47b3dd15637cb1a4a6c5ee516 100644 --- a/styles/styleTree/projectPanel.ts +++ b/styles/styleTree/projectPanel.ts @@ -24,7 +24,11 @@ export default function projectPanel(theme: Theme) { backgroundColor(theme, 300, "hovered") ), selectedEntry: entry(theme, "primary"), - hoveredSelectedEntry: entry(theme, "primary", "hovered"), + hoveredSelectedEntry: entry( + theme, + "primary", + backgroundColor(theme, 300, "hovered") + ), padding: { top: 6, }, diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts index 7ba04cd688e01f5b3a4f47b35311195fde73fefb..42b639f57a39d355c8dbf461fb29e64ee71dec2f 100644 --- a/styles/styleTree/search.ts +++ b/styles/styleTree/search.ts @@ -19,8 +19,28 @@ export default function search(theme: Theme) { }, }; + const editor = { + background: backgroundColor(theme, 500), + cornerRadius: 6, + minWidth: 200, + maxWidth: 500, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + margin: { + right: 5, + }, + padding: { + top: 3, + bottom: 3, + left: 14, + right: 14, + }, + }; + return { - matchBackground: theme.editor.highlight.match, + matchBackground: theme.editor.highlight.match.value, tabIconSpacing: 4, tabIconWidth: 14, activeHoveredOptionButton: { @@ -31,31 +51,13 @@ export default function search(theme: Theme) { ...optionButton, background: backgroundColor(theme, 100), }, - editor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - minWidth: 200, - maxWidth: 500, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "primary"), - margin: { - right: 5, - }, - padding: { - top: 3, - bottom: 3, - left: 14, - right: 14, - }, - }, + editor, hoveredOptionButton: { ...optionButton, background: backgroundColor(theme, 100), }, invalidEditor: { - extends: "$search.editor", + ...editor, border: border(theme, "error"), }, matchIndex: { diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 148db089183e77274a81a122d6f02d920b640237..7e71eaad2a8e258e5aed2476af0b68fbf9c7ba4b 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -137,5 +137,10 @@ export default function workspace(theme: Theme) { ...text(theme, "mono", "secondary"), padding: { left: 6 }, }, + disconnectedOverlay: { + ...text(theme, "sans", "primary"), + color: "#ffffff", + background: "#000000aa", + }, }; } diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 42f80cf4c670deda733f434c3cbab691239f5396..2cadf24601f47cc1172c4d9be753cc80c3a9f20c 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -1,249 +1,273 @@ -import core from "../tokens/core"; -import Theme, { NumberToken, Syntax } from "./theme"; - -const { color } = core; +import { colors, fontWeights, NumberToken } from "../tokens"; +import Theme, { Syntax } from "./theme"; const backgroundColor = { - 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], - }, - 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], - }, - 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], - }, - ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], - }, - error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], - }, - warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], - }, - info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], - }, + 100: { + base: colors.neutral[750], + hovered: colors.neutral[750], + active: colors.neutral[750], + focused: colors.neutral[750], + }, + 300: { + base: colors.neutral[800], + hovered: colors.neutral[800], + active: colors.neutral[800], + focused: colors.neutral[800], + }, + 500: { + base: colors.neutral[900], + hovered: colors.neutral[900], + active: colors.neutral[900], + focused: colors.neutral[900], + }, + ok: { + base: colors.green[600], + hovered: colors.green[600], + active: colors.green[600], + focused: colors.green[600], + }, + error: { + base: colors.red[400], + hovered: colors.red[400], + active: colors.red[400], + focused: colors.red[400], + }, + warning: { + base: colors.amber[300], + hovered: colors.amber[300], + active: colors.amber[300], + focused: colors.amber[300], + }, + info: { + base: colors.blue[500], + hovered: colors.blue[500], + active: colors.blue[500], + focused: colors.blue[500], + }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[1000], - error: color.neutral[1000], - warning: color.neutral[1000], - info: color.neutral[1000], + primary: colors.neutral[850], + secondary: colors.neutral[700], + muted: colors.neutral[750], + focused: colors.neutral[100], + active: colors.neutral[500], + ok: colors.neutral[1000], + error: colors.neutral[1000], + warning: colors.neutral[1000], + info: colors.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: colors.neutral[150], + secondary: colors.neutral[350], + muted: colors.neutral[550], + placeholder: colors.neutral[750], + active: colors.neutral[0], + //TODO: (design) define feature and it's correct value + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], - //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + primary: colors.neutral[300], + secondary: colors.neutral[500], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[50], + //TODO: (design) define feature and it's correct value + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const player = { - 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], - }, - 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], - }, - 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], - }, - 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], - }, - 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], - }, - 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], - }, - 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], - }, - 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], - }, + 1: { + baseColor: colors.blue[600], + cursorColor: colors.blue[600], + selectionColor: colors.blue[600], + borderColor: colors.blue[600], + }, + 2: { + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[500], + borderColor: colors.indigo[500], + }, + 3: { + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[500], + borderColor: colors.green[500], + }, + 4: { + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[500], + borderColor: colors.orange[500], + }, + 5: { + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[500], + borderColor: colors.purple[500], + }, + 6: { + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[400], + borderColor: colors.teal[400], + }, + 7: { + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[400], + borderColor: colors.pink[400], + }, + 8: { + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[400], + borderColor: colors.yellow[400], + }, }; // TODO: Fixup const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], - }, - gutter: { - primary: color.neutral[0], - active: color.neutral[0], - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], + }, + gutter: { + primary: colors.neutral[0], + active: colors.neutral[0], + }, }; const syntax: Syntax = { - primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, - }, - punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, - }, - constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, - }, - type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, - }, - property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, - }, - enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, - }, - string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, - }, - number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, - }, - predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + primary: { + color: textColor.primary, + weight: fontWeights.normal, + }, + comment: { + color: colors.lime[200], + weight: fontWeights.normal, + }, + punctuation: { + color: textColor.primary, + weight: fontWeights.normal, + }, + constant: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + keyword: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + function: { + color: colors.yellow[200], + weight: fontWeights.normal, + }, + type: { + color: colors.teal[300], + weight: fontWeights.normal, + }, + variant: { + color: colors.teal[300], + weight: fontWeights.normal, + }, + property: { + color: colors.sky[300], + weight: fontWeights.normal, + }, + enum: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + operator: { + color: colors.sky[400], + weight: fontWeights.normal, + }, + string: { + color: colors.orange[300], + weight: fontWeights.normal, + }, + number: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + boolean: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + predictive: { + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, + listMarker: { + color: colors.sky[400], + weight: fontWeights.normal, + } }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number", + value: 0.32, + type: "number", }; const theme: Theme = { - name: "dark", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index 7a9bf1b552650b81288e70acc6c7500c80a8246b..acb704de74b99b91c2b41a739c751003670c5864 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -1,143 +1,141 @@ -import core from "../tokens/core"; -import Theme, { NumberToken, Syntax } from "./theme"; - -const { color } = core; +import { colors, fontWeights, NumberToken } from "../tokens"; +import Theme, { Syntax } from "./theme"; // TODO: Replace with light values const backgroundColor = { 100: { - base: color.neutral[750], - hovered: color.neutral[750], - active: color.neutral[750], - focused: color.neutral[750], + base: colors.neutral[750], + hovered: colors.neutral[750], + active: colors.neutral[750], + focused: colors.neutral[750], }, 300: { - base: color.neutral[800], - hovered: color.neutral[800], - active: color.neutral[800], - focused: color.neutral[800], + base: colors.neutral[800], + hovered: colors.neutral[800], + active: colors.neutral[800], + focused: colors.neutral[800], }, 500: { - base: color.neutral[900], - hovered: color.neutral[900], - active: color.neutral[900], - focused: color.neutral[900], + base: colors.neutral[900], + hovered: colors.neutral[900], + active: colors.neutral[900], + focused: colors.neutral[900], }, ok: { - base: color.green[600], - hovered: color.green[600], - active: color.green[600], - focused: color.green[600], + base: colors.green[600], + hovered: colors.green[600], + active: colors.green[600], + focused: colors.green[600], }, error: { - base: color.red[400], - hovered: color.red[400], - active: color.red[400], - focused: color.red[400], + base: colors.red[400], + hovered: colors.red[400], + active: colors.red[400], + focused: colors.red[400], }, warning: { - base: color.amber[300], - hovered: color.amber[300], - active: color.amber[300], - focused: color.amber[300], + base: colors.amber[300], + hovered: colors.amber[300], + active: colors.amber[300], + focused: colors.amber[300], }, info: { - base: color.blue[500], - hovered: color.blue[500], - active: color.blue[500], - focused: color.blue[500], + base: colors.blue[500], + hovered: colors.blue[500], + active: colors.blue[500], + focused: colors.blue[500], }, }; const borderColor = { - primary: color.neutral[850], - secondary: color.neutral[700], - muted: color.neutral[750], - focused: color.neutral[100], - active: color.neutral[500], - ok: color.neutral[1000], - error: color.neutral[1000], - warning: color.neutral[1000], - info: color.neutral[1000], + primary: colors.neutral[850], + secondary: colors.neutral[700], + muted: colors.neutral[750], + focused: colors.neutral[100], + active: colors.neutral[500], + ok: colors.neutral[1000], + error: colors.neutral[1000], + warning: colors.neutral[1000], + info: colors.neutral[1000], }; const textColor = { - primary: color.neutral[150], - secondary: color.neutral[350], - muted: color.neutral[550], - placeholder: color.neutral[750], - active: color.neutral[0], + primary: colors.neutral[150], + secondary: colors.neutral[350], + muted: colors.neutral[550], + placeholder: colors.neutral[750], + active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const iconColor = { - primary: color.neutral[300], - secondary: color.neutral[500], - muted: color.neutral[600], - placeholder: color.neutral[700], - active: color.neutral[50], + primary: colors.neutral[300], + secondary: colors.neutral[500], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[50], //TODO: (design) define feature and it's correct value - feature: color.sky[500], - ok: color.green[600], - error: color.red[400], - warning: color.amber[300], - info: color.blue[500], + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const player = { 1: { - baseColor: color.blue[600], - cursorColor: color.blue[600], - selectionColor: color.blue[600], - borderColor: color.blue[600], + baseColor: colors.blue[600], + cursorColor: colors.blue[600], + selectionColor: colors.blue[600], + borderColor: colors.blue[600], }, 2: { - baseColor: color.indigo[500], - cursorColor: color.indigo[500], - selectionColor: color.indigo[500], - borderColor: color.indigo[500], + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[500], + borderColor: colors.indigo[500], }, 3: { - baseColor: color.green[500], - cursorColor: color.green[500], - selectionColor: color.green[500], - borderColor: color.green[500], + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[500], + borderColor: colors.green[500], }, 4: { - baseColor: color.orange[500], - cursorColor: color.orange[500], - selectionColor: color.orange[500], - borderColor: color.orange[500], + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[500], + borderColor: colors.orange[500], }, 5: { - baseColor: color.purple[500], - cursorColor: color.purple[500], - selectionColor: color.purple[500], - borderColor: color.purple[500], + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[500], + borderColor: colors.purple[500], }, 6: { - baseColor: color.teal[400], - cursorColor: color.teal[400], - selectionColor: color.teal[400], - borderColor: color.teal[400], + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[400], + borderColor: colors.teal[400], }, 7: { - baseColor: color.pink[400], - cursorColor: color.pink[400], - selectionColor: color.pink[400], - borderColor: color.pink[400], + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[400], + borderColor: colors.pink[400], }, 8: { - baseColor: color.yellow[400], - cursorColor: color.yellow[400], - selectionColor: color.yellow[400], - borderColor: color.yellow[400], + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[400], + borderColor: colors.yellow[400], }, }; @@ -147,88 +145,114 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: color.neutral[0], - highlighted: color.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: color.neutral[0], - matchingBracket: color.neutral[0], - match: color.neutral[0], - activeMatch: color.neutral[0], - related: color.neutral[0], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], }, gutter: { - primary: color.neutral[0], - active: color.neutral[0], + primary: colors.neutral[0], + active: colors.neutral[0], }, }; const syntax: Syntax = { primary: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, + color: textColor.primary, + weight: fontWeights.normal, }, comment: { - color: color.lime[200], - weight: { value: "normal", type: "fontWeight" }, + color: colors.lime[200], + weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, - weight: { value: "normal", type: "fontWeight" }, + color: textColor.primary, + weight: fontWeights.normal, }, constant: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, keyword: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, function: { - color: color.yellow[200], - weight: { value: "normal", type: "fontWeight" }, + color: colors.yellow[200], + weight: fontWeights.normal, }, type: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.teal[300], + weight: fontWeights.normal, }, variant: { - color: color.teal[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.teal[300], + weight: fontWeights.normal, }, property: { - color: color.sky[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[300], + weight: fontWeights.normal, }, enum: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, operator: { - color: color.sky[400], - weight: { value: "normal", type: "fontWeight" }, + color: colors.sky[400], + weight: fontWeights.normal, }, string: { - color: color.orange[300], - weight: { value: "normal", type: "fontWeight" }, + color: colors.orange[300], + weight: fontWeights.normal, }, number: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, boolean: { - color: color.neutral[150], - weight: { value: "normal", type: "fontWeight" }, + color: colors.neutral[150], + weight: fontWeights.normal, }, predictive: { - color: textColor.muted, - weight: { value: "normal", type: "fontWeight" }, - }, + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, + listMarker: { + color: colors.sky[400], + weight: fontWeights.normal, + } }; const shadowAlpha: NumberToken = { diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index a7760459897b0bedec0d87512e669d1d7ae0a3b4..f95d58e49484aea340693ff289f19cb8cf8a4b0a 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -1,32 +1,8 @@ -export interface NumberToken { - value: number, - type: "number" -} - -export type Color = string; -export interface ColorToken { - value: Color; - type: "color"; - step?: number -} -export type Weight = - | "thin" - | "extra_light" - | "light" - | "normal" - | "medium" - | "semibold" - | "bold" - | "extra_bold" - | "black"; -export interface WeightToken { - value: Weight, - type: "fontWeight" -} +import { FontWeightToken, ColorToken, NumberToken } from "../tokens"; export interface SyntaxHighlightStyle { color: ColorToken; - weight: WeightToken; + weight: FontWeightToken; } export interface Player { @@ -43,7 +19,7 @@ export interface BackgroundColor { focused: ColorToken; } -export interface Syntax { +export interface Syntax { primary: SyntaxHighlightStyle; comment: SyntaxHighlightStyle; punctuation: SyntaxHighlightStyle; @@ -59,6 +35,13 @@ export interface Syntax { number: SyntaxHighlightStyle; boolean: SyntaxHighlightStyle; predictive: SyntaxHighlightStyle; + // TODO: Either move the following or rename + title: SyntaxHighlightStyle; + emphasis: SyntaxHighlightStyle; + emphasisStrong: SyntaxHighlightStyle; + linkUrl: SyntaxHighlightStyle; + linkText: SyntaxHighlightStyle; + listMarker: SyntaxHighlightStyle; }; export default interface Theme { diff --git a/styles/tokens.ts b/styles/tokens.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e0df5032d09ee72ce31fc2b9de256174b6bf905 --- /dev/null +++ b/styles/tokens.ts @@ -0,0 +1,102 @@ +import { colorRamp } from "./utils/color"; + +interface Token { + value: V, + type: T +} + +export type FontFamily = string; +export type FontFamilyToken = Token; +function fontFamily(value: FontFamily): FontFamilyToken { + return { + value, + type: "fontFamily" + } +} +export const fontFamilies = { + sans: fontFamily("Zed Sans"), + mono: fontFamily("Zed Mono"), +} + +export type FontSize = number; +export type FontSizeToken = Token; +function fontSize(value: FontSize) { + return { + value, + type: "fontSize" + }; +} +export const fontSizes = { + "3xs": fontSize(8), + "2xs": fontSize(10), + xs: fontSize(12), + sm: fontSize(14), + md: fontSize(16), + lg: fontSize(18), + xl: fontSize(20), +}; + +export type FontWeight = + | "thin" + | "extra_light" + | "light" + | "normal" + | "medium" + | "semibold" + | "bold" + | "extra_bold" + | "black"; +export type FontWeightToken = Token; +function fontWeight(value: FontWeight): FontWeightToken { + return { + value, + type: "fontWeight" + }; +} +export const fontWeights = { + "thin": fontWeight("thin"), + "extra_light": fontWeight("extra_light"), + "light": fontWeight("light"), + "normal": fontWeight("normal"), + "medium": fontWeight("medium"), + "semibold": fontWeight("semibold"), + "bold": fontWeight("bold"), + "extra_bold": fontWeight("extra_bold"), + "black": fontWeight("black"), +} + +export type Color = string; +export interface ColorToken { + value: Color, + type: "color", + step?: number, +} +export const colors = { + neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + rose: colorRamp("#F43F5EFF"), + red: colorRamp("#EF4444FF"), + orange: colorRamp("#F97316FF"), + amber: colorRamp("#F59E0BFF"), + yellow: colorRamp("#EAB308FF"), + lime: colorRamp("#84CC16FF"), + green: colorRamp("#22C55EFF"), + emerald: colorRamp("#10B981FF"), + teal: colorRamp("#14B8A6FF"), + cyan: colorRamp("#06BBD4FF"), + sky: colorRamp("#0EA5E9FF"), + blue: colorRamp("#3B82F6FF"), + indigo: colorRamp("#6366F1FF"), + violet: colorRamp("#8B5CF6FF"), + purple: colorRamp("#A855F7FF"), + fuschia: colorRamp("#D946E4FF"), + pink: colorRamp("#EC4899FF"), +} + +export type NumberToken = Token; + +export default { + fontFamilies, + fontSizes, + fontWeights, + colors, +}; diff --git a/styles/tokens/core.ts b/styles/tokens/core.ts deleted file mode 100644 index 38bfe82e28129954a2f5602038d575a3cfbb94af..0000000000000000000000000000000000000000 --- a/styles/tokens/core.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { colorRamp } from "../utils/color"; - -export default { - fontFamily: { - sans: "Zed Sans", - mono: "Zed Mono", - }, - fontSize: { - "3xs": { - value: "8", - type: "fontSizes", - }, - "2xs": { - value: "10", - type: "fontSizes", - }, - xs: { - value: "12", - type: "fontSizes", - }, - sm: { - value: "14", - type: "fontSizes", - }, - md: { - value: "16", - type: "fontSizes", - }, - lg: { - value: "18", - type: "fontSizes", - }, - xl: { - value: "20", - type: "fontSizes", - }, - }, - color: { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), - rose: colorRamp("#F43F5EFF"), - red: colorRamp("#EF4444FF"), - orange: colorRamp("#F97316FF"), - amber: colorRamp("#F59E0BFF"), - yellow: colorRamp("#EAB308FF"), - lime: colorRamp("#84CC16FF"), - green: colorRamp("#22C55EFF"), - emerald: colorRamp("#10B981FF"), - teal: colorRamp("#14B8A6FF"), - cyan: colorRamp("#06BBD4FF"), - sky: colorRamp("#0EA5E9FF"), - blue: colorRamp("#3B82F6FF"), - indigo: colorRamp("#6366F1FF"), - violet: colorRamp("#8B5CF6FF"), - purple: colorRamp("#A855F7FF"), - fuschia: colorRamp("#D946E4FF"), - pink: colorRamp("#EC4899FF"), - }, -}; From c812adde7f893b932fcd7fc7df401c5a83515ea4 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 22:39:18 -0400 Subject: [PATCH 051/245] Add "npm run watch" command to live reload changes --- styles/nodemon.json | 6 + styles/package-lock.json | 2501 ++++++++++++++++++++++++++++++++++++-- styles/package.json | 6 +- 3 files changed, 2398 insertions(+), 115 deletions(-) create mode 100644 styles/nodemon.json diff --git a/styles/nodemon.json b/styles/nodemon.json new file mode 100644 index 0000000000000000000000000000000000000000..24022a55ad3aa2137a6fec03cdc1c97fa4e59e76 --- /dev/null +++ b/styles/nodemon.json @@ -0,0 +1,6 @@ +{ + "watch": ["./**/*"], + "ext": "ts", + "ignore": [], + "exec": "ts-node buildThemes.ts" +} \ No newline at end of file diff --git a/styles/package-lock.json b/styles/package-lock.json index 582f1c84968a5c1a25ddac5fd3c21ba907353c6d..43c9b19ea1224415c654186ed6203c48e776e2da 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -12,7 +12,10 @@ "@types/chroma-js": "^2.1.3", "@types/node": "^17.0.23", "case-anything": "^2.1.10", - "chroma-js": "^2.4.2", + "chroma-js": "^2.4.2" + }, + "devDependencies": { + "nodemon": "^2.0.15", "ts-node": "^10.7.0" } }, @@ -20,6 +23,7 @@ "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, "engines": { "node": ">= 12" } @@ -28,6 +32,7 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, "dependencies": { "@cspotcode/source-map-consumer": "0.8.0" }, @@ -35,25 +40,50 @@ "node": ">=12" } }, + "node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true }, "node_modules/@tsconfig/node12": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true }, "node_modules/@tsconfig/node14": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true }, "node_modules/@tsconfig/node16": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true }, "node_modules/@types/chroma-js": { "version": "2.1.3", @@ -65,10 +95,17 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -80,14 +117,175 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/case-anything": { "version": "2.1.10", @@ -100,186 +298,2136 @@ "url": "https://github.com/sponsors/mesqueeb" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, "engines": { "node": ">=0.3.1" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" + "is-obj": "^2.0.0" }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } + "engines": { + "node": ">=6" } }, - "node_modules/typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" }, "engines": { - "node": ">=4.2.0" + "node": ">= 6" } }, - "node_modules/v8-compile-cache-lib": { + "node_modules/global-dirs": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, "engines": { - "node": ">=6" + "node": ">=8.6" } - } - }, - "dependencies": { - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" }, - "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "requires": { - "@cspotcode/source-map-consumer": "0.8.0" + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" } }, - "@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true }, - "@tsconfig/node14": { + "node_modules/ignore-by-default": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true }, - "@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + "node_modules/import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true, + "engines": { + "node": ">=4" + } }, - "@types/chroma-js": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", - "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } }, - "@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" }, - "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true }, "case-anything": { "version": "2.1.10", "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "chroma-js": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "requires": { + "ini": "2.0.0" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + } + }, + "is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } }, "ts-node": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, "requires": { "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", @@ -296,21 +2444,146 @@ "yn": "3.1.1" } }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typescript": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, "peer": true }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "requires": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, "v8-compile-cache-lib": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/styles/package.json b/styles/package.json index c270bba0e1563cee758bbf5a02fb9fc1848b37ae..8576a35d34956a0dd438e35f6989dd9b68b217c2 100644 --- a/styles/package.json +++ b/styles/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "build": "ts-node buildThemes.ts" + "build": "ts-node buildThemes.ts", + "watch": "nodemon" }, "author": "", "license": "ISC", @@ -14,5 +15,8 @@ "case-anything": "^2.1.10", "chroma-js": "^2.4.2", "ts-node": "^10.7.0" + }, + "devDependencies": { + "nodemon": "^2.0.15" } } From 381d50bac62fee058721839a2e983b35445a1ad6 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 23:58:04 -0400 Subject: [PATCH 052/245] WIP --- crates/zed/assets/themes/dark.json | 351 ++++++++++++------------ crates/zed/assets/themes/light.json | 411 ++++++++++++++-------------- styles/buildThemes.ts | 2 +- styles/styleTree/chatPanel.ts | 8 +- styles/styleTree/editor.ts | 14 +- styles/styleTree/projectPanel.ts | 7 +- styles/styleTree/workspace.ts | 29 +- styles/themes/dark.ts | 24 +- styles/themes/light.ts | 288 ++++++++++--------- styles/themes/theme.ts | 2 +- styles/tokens.ts | 2 +- 11 files changed, 576 insertions(+), 562 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 65bf78b140ff3c94c298982cf2b3a6f6b8210609..fd11fc6c3a64a6fd6d878b935941d21960c12f37 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "padding": 8, "item": { @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#90df17", "weight": "bold", "size": 14 } @@ -33,25 +33,25 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#90df17", "weight": "bold", "size": 14 }, - "background": "#e6e6e6" + "background": "#000000" }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "empty": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -62,11 +62,11 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 14 }, "selection": { @@ -75,11 +75,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "padding": { @@ -103,24 +103,25 @@ } }, "workspace": { - "background": "#e6e6e6", + "background": "#1c1c1c", "leader_border_opacity": 0.7, "leader_border_width": 2, "tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#1c1c1c", + "icon_close": "#717171", + "icon_close_active": "#f1f1f1", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true, "bottom": true, @@ -132,20 +133,21 @@ } }, "active_tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#000000", + "icon_close": "#717171", + "icon_close_active": "#f1f1f1", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#ffffff", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true, "bottom": false, @@ -154,28 +156,28 @@ "padding": { "left": 12, "right": 12 - }, - "background": "#cccccc" + } }, "left_sidebar": { "width": 30, + "background": "#1c1c1c", "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#f1f1f1", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#0e0e0e", "padding": { "left": 1 } @@ -183,30 +185,31 @@ }, "right_sidebar": { "width": 30, + "background": "#1c1c1c", "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#f1f1f1", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#0e0e0e", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "status_bar": { @@ -218,28 +221,29 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 } }, "titlebar": { "avatar_width": 18, "height": 32, - "share_icon_color": "#808080", - "share_icon_active_color": "#0d0d0d", + "background": "#393939", + "share_icon_color": "#717171", + "share_icon_active_color": "#f1f1f1", "title": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "avatar": { @@ -254,13 +258,13 @@ "width": 12 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "bottom": true }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 13, "underline": true, "padding": { @@ -269,15 +273,15 @@ }, "hovered_sign_in_prompt": { "family": "Zed Mono", - "color": "#000000", - "size": 16, + "color": "#ffffff", + "size": 13, "underline": true, "padding": { "right": 8 } }, "offline_icon": { - "color": "#999999", + "color": "#717171", "width": 16, "padding": { "right": 4 @@ -285,15 +289,15 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#f8c570", "size": 13 } }, "toolbar": { "height": 34, - "background": "#cccccc", + "background": "#000000", "border": { - "color": "#d9d9d9", + "color": "#2b2b2b", "width": 1, "bottom": true }, @@ -307,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "padding": { "left": 6 @@ -321,20 +325,20 @@ } }, "editor": { - "text_color": "#595959", - "background": "#cccccc", - "active_line_background": "#000000", - "code_actions_indicator": "#808080", + "text_color": "#9c9c9c", + "background": "#000000", + "active_line_background": "#ffffff", + "code_actions_indicator": "#717171", "diff_background_deleted": "#f78c8c", "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#e6e6e6", - "document_highlight_write_background": "#e6e6e6", + "document_highlight_read_background": "#000000", + "document_highlight_write_background": "#000000", "error_color": "#f78c8c", - "gutter_background": "#cccccc", + "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#000000", - "line_number": "#000000", - "line_number_active": "#000000", + "highlighted_line_background": "#ffffff", + "line_number": "#ffffff", + "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { @@ -372,11 +376,11 @@ } ], "autocomplete": { - "background": "#bfbfbf", + "background": "#000000", "corner_radius": 6, "padding": 6, "border": { - "color": "#b3b3b3", + "color": "#393939", "width": 1 }, "item": { @@ -396,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#000000" }, "margin": { "left": -14 @@ -413,22 +417,22 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#000000" } }, "diagnostic_header": { - "background": "#e6e6e6", + "background": "#1c1c1c", "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#b3b3b3", + "color": "#393939", "width": 1, "bottom": true, "top": true }, "code": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "left": 10 @@ -437,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 } } }, "diagnostic_path_header": { - "background": "#000000", + "background": "#ffffff", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "left": 12 @@ -469,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -492,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -515,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -538,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -561,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -569,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -584,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -592,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -607,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -615,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -630,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1, "top": true } @@ -638,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "weight": "bold" } @@ -652,18 +656,18 @@ "syntax": {} }, "project_diagnostics": { - "background": "#cccccc", + "background": "#1c1c1c", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 10 @@ -672,52 +676,53 @@ }, "project_panel": { "padding": { - "top": 6 + "top": 6, + "left": 12 }, "entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 } }, "hovered_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#1c1c1c", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#9c9c9c", + "size": 14 } }, "selected_entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#d5d5d5", + "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#1c1c1c", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#d5d5d5", + "size": 14 } } }, @@ -730,13 +735,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "padding": { "right": 8 @@ -746,7 +751,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": { @@ -755,7 +760,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -766,13 +771,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -783,31 +788,31 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -818,27 +823,27 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6 }, "menu": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "padding": 4, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "shadow": { @@ -853,25 +858,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#595959", + "color": "#9c9c9c", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -879,7 +884,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "weight": "bold", "size": 14, "margin": { @@ -890,12 +895,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "size": 14 }, "padding": { @@ -903,7 +908,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#636363", "weight": "bold", "size": 14, "margin": { @@ -912,24 +917,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#000000", "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#8c8c8c", - "size": 16 + "color": "#2b2b2b", + "size": 14 }, "selection": { "cursor": "#4287f6", "selection": "#4287f6" }, "border": { - "color": "#d9d9d9", + "color": "#393939", "width": 1 }, "padding": { @@ -948,7 +953,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#bfbfbf", + "tree_branch_color": "#2b2b2b", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -956,7 +961,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 16, "padding": { "left": 8 @@ -971,7 +976,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -990,7 +995,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16, "margin": { "right": 6 @@ -1009,7 +1014,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16, "margin": { "right": 6 @@ -1018,7 +1023,7 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 }, "unshared_project": { @@ -1030,7 +1035,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -1049,7 +1054,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, "margin": { "right": 6 @@ -1058,22 +1063,22 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 } }, "search": { - "match_background": "#000000", + "match_background": "#ffffff", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1089,12 +1094,12 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1109,13 +1114,13 @@ } }, "editor": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 16 }, "selection": { @@ -1124,11 +1129,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1143,12 +1148,12 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#bfbfbf", + "background": "#393939", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1163,13 +1168,13 @@ } }, "invalid_editor": { - "background": "#e6e6e6", + "background": "#000000", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#2b2b2b", "size": 16 }, "selection": { @@ -1178,11 +1183,11 @@ }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 16 }, "border": { - "color": "#ffffff", + "color": "#f47171", "width": 1 }, "margin": { @@ -1197,18 +1202,18 @@ }, "match_index": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#636363", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#9c9c9c", "size": 16, - "background": "#cccccc", + "background": "#1c1c1c", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#0e0e0e", "width": 1 }, "margin": { @@ -1230,13 +1235,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#262626", + "color": "#d5d5d5", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#262626", + "color": "#d5d5d5", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 65bf78b140ff3c94c298982cf2b3a6f6b8210609..219f958e876dcb36abd4edf2e2986c7fb26f32c3 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "padding": 8, "item": { @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#4287f6", "weight": "bold", "size": 14 } @@ -33,25 +33,25 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#4287f6", "weight": "bold", "size": 14 }, - "background": "#e6e6e6" + "background": "#e3e3e3" }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "empty": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -62,24 +62,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#f1f1f1", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#bfbfbf", + "color": "#717171", "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "padding": { @@ -95,7 +95,7 @@ }, "shadow": { "blur": 16, - "color": "#00000052", + "color": "#0000001f", "offset": [ 0, 2 @@ -103,24 +103,25 @@ } }, "workspace": { - "background": "#e6e6e6", + "background": "#f1f1f1", "leader_border_opacity": 0.7, "leader_border_width": 2, "tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#f1f1f1", + "icon_close": "#717171", + "icon_close_active": "#000000", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true, "bottom": true, @@ -132,20 +133,21 @@ } }, "active_tab": { - "height": 34, - "icon_close": "#808080", - "icon_close_active": "#0d0d0d", - "icon_conflict": "#f8c570", - "icon_dirty": "#6099f7", + "height": 32, + "background": "#ffffff", + "icon_close": "#717171", + "icon_close_active": "#000000", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#000000", + "size": 14 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true, "bottom": false, @@ -154,28 +156,28 @@ "padding": { "left": 12, "right": 12 - }, - "background": "#cccccc" + } }, "left_sidebar": { "width": 30, + "background": "#f1f1f1", "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#000000", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#c6c6c6", "padding": { "left": 1 } @@ -183,30 +185,31 @@ }, "right_sidebar": { "width": 30, + "background": "#f1f1f1", "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#808080", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#4d4d4d", + "icon_color": "#000000", "icon_size": 18 }, "resize_handle": { - "background": "#d9d9d9", + "background": "#c6c6c6", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "status_bar": { @@ -218,28 +221,29 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 } }, "titlebar": { "avatar_width": 18, "height": 32, - "share_icon_color": "#808080", - "share_icon_active_color": "#0d0d0d", + "background": "#e3e3e3", + "share_icon_color": "#717171", + "share_icon_active_color": "#000000", "title": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "avatar": { @@ -254,13 +258,13 @@ "width": 12 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "bottom": true }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 13, "underline": true, "padding": { @@ -270,14 +274,14 @@ "hovered_sign_in_prompt": { "family": "Zed Mono", "color": "#000000", - "size": 16, + "size": 13, "underline": true, "padding": { "right": 8 } }, "offline_icon": { - "color": "#999999", + "color": "#717171", "width": 16, "padding": { "right": 4 @@ -285,15 +289,15 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#b48d14", "size": 13 } }, "toolbar": { "height": 34, - "background": "#cccccc", + "background": "#ffffff", "border": { - "color": "#d9d9d9", + "color": "#f1f1f1", "width": 1, "bottom": true }, @@ -307,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "padding": { "left": 6 @@ -315,68 +319,68 @@ }, "disconnected_overlay": { "family": "Zed Sans", - "color": "#ffffff", + "color": "#000000", "size": 14, "background": "#000000aa" } }, "editor": { - "text_color": "#595959", - "background": "#cccccc", - "active_line_background": "#000000", - "code_actions_indicator": "#808080", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#e6e6e6", - "document_highlight_write_background": "#e6e6e6", - "error_color": "#f78c8c", - "gutter_background": "#cccccc", + "text_color": "#393939", + "background": "#ffffff", + "active_line_background": "#ffffff", + "code_actions_indicator": "#717171", + "diff_background_deleted": "#fdd4d4", + "diff_background_inserted": "#befad2", + "document_highlight_read_background": "#e3e3e3", + "document_highlight_write_background": "#e3e3e3", + "error_color": "#d11c1c", + "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#000000", - "line_number": "#000000", - "line_number_active": "#000000", + "highlighted_line_background": "#ffffff", + "line_number": "#ffffff", + "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "guest_selections": [ { "cursor": "#777af4", - "selection": "#777af4" + "selection": "#d4d5fd" }, { "cursor": "#23d464", - "selection": "#23d464" + "selection": "#befad2" }, { "cursor": "#f98a3d", - "selection": "#f98a3d" + "selection": "#fde0cd" }, { "cursor": "#b671f8", - "selection": "#b671f8" + "selection": "#e9d4fd" }, { "cursor": "#16ddc7", - "selection": "#16ddc7" + "selection": "#b4faf2" }, { "cursor": "#f58ac0", - "selection": "#f58ac0" + "selection": "#fcd4e8" }, { "cursor": "#f6bc09", - "selection": "#f6bc09" + "selection": "#fceabc" } ], "autocomplete": { - "background": "#bfbfbf", + "background": "#ffffff", "corner_radius": 6, "padding": 6, "border": { - "color": "#b3b3b3", + "color": "#e3e3e3", "width": 1 }, "item": { @@ -396,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#f1f1f1" }, "margin": { "left": -14 @@ -413,22 +417,22 @@ "right": 6, "top": 2 }, - "background": "#bfbfbf" + "background": "#e3e3e3" } }, "diagnostic_header": { - "background": "#e6e6e6", + "background": "#f1f1f1", "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#b3b3b3", + "color": "#e3e3e3", "width": 1, "bottom": true, "top": true }, "code": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "left": 10 @@ -437,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 } } }, "diagnostic_path_header": { - "background": "#000000", + "background": "#ffffff", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "left": 12 @@ -469,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -477,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d11c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d11c1c", "size": 14, "weight": "bold" } @@ -492,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -500,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#b48d14", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#b48d14", "size": 14, "weight": "bold" } @@ -515,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -523,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14, "weight": "bold" } @@ -538,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -546,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#1762db", "size": 14, "weight": "bold" } @@ -561,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -569,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -584,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -592,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -607,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -615,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -630,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1, "top": true } @@ -638,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "weight": "bold" } @@ -652,18 +656,18 @@ "syntax": {} }, "project_diagnostics": { - "background": "#cccccc", + "background": "#f1f1f1", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 10 @@ -672,52 +676,53 @@ }, "project_panel": { "padding": { - "top": 6 + "top": 6, + "left": 12 }, "entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 } }, "hovered_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#e3e3e3", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#595959", - "size": 16 + "color": "#393939", + "size": 14 } }, "selected_entry": { "height": 22, - "icon_color": "#999999", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#1c1c1c", + "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#cccccc", - "icon_color": "#999999", + "background": "#e3e3e3", + "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#262626", - "size": 16 + "color": "#1c1c1c", + "size": 14 } } }, @@ -730,13 +735,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "padding": { "right": 8 @@ -746,7 +751,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": { @@ -755,7 +760,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -766,13 +771,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -783,31 +788,31 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#e3e3e3", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 @@ -818,32 +823,32 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14, "margin": { "right": 8 } }, - "background": "#cccccc", + "background": "#e3e3e3", "corner_radius": 6 }, "menu": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "padding": 4, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "shadow": { "blur": 16, - "color": "#00000052", + "color": "#0000001f", "offset": [ 0, 2 @@ -853,25 +858,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#595959", + "color": "#393939", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -879,7 +884,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "weight": "bold", "size": 14, "margin": { @@ -890,12 +895,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "size": 14 }, "padding": { @@ -903,7 +908,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#8c8c8c", + "color": "#555555", "weight": "bold", "size": 14, "margin": { @@ -912,24 +917,24 @@ } }, "input_editor": { - "background": "#cccccc", + "background": "#ffffff", "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#8c8c8c", - "size": 16 + "color": "#717171", + "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "border": { - "color": "#d9d9d9", + "color": "#e3e3e3", "width": 1 }, "padding": { @@ -948,7 +953,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#bfbfbf", + "tree_branch_color": "#f1f1f1", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -956,7 +961,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 16, "padding": { "left": 8 @@ -971,7 +976,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -990,7 +995,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16, "margin": { "right": 6 @@ -1009,7 +1014,7 @@ }, "name": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16, "margin": { "right": 6 @@ -1018,7 +1023,7 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 }, "unshared_project": { @@ -1030,7 +1035,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -1049,7 +1054,7 @@ }, "name": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, "margin": { "right": 6 @@ -1058,22 +1063,22 @@ "padding": { "left": 8 }, - "background": "#000000", + "background": "#ffffff", "corner_radius": 6 } }, "search": { - "match_background": "#000000", + "match_background": "#ffffff", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1089,12 +1094,12 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1109,26 +1114,26 @@ } }, "editor": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#717171", "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1143,12 +1148,12 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#bfbfbf", + "background": "#e3e3e3", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1163,26 +1168,26 @@ } }, "invalid_editor": { - "background": "#e6e6e6", + "background": "#ffffff", "corner_radius": 6, "min_width": 200, "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#bfbfbf", + "color": "#717171", "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 16 }, "border": { - "color": "#ffffff", + "color": "#fbbdbd", "width": 1 }, "margin": { @@ -1197,18 +1202,18 @@ }, "match_index": { "family": "Zed Mono", - "color": "#8c8c8c", + "color": "#555555", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#595959", + "color": "#393939", "size": 16, - "background": "#cccccc", + "background": "#f1f1f1", "corner_radius": 6, "border": { - "color": "#d9d9d9", + "color": "#c6c6c6", "width": 1 }, "margin": { @@ -1230,13 +1235,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#262626", + "color": "#1c1c1c", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#262626", + "color": "#1c1c1c", "size": 14, "padding": { "left": 6 diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index d67860cee66a0ec7abd7d37da8b10f0a6c930488..9128eff45d46a0a11b9a8ddb04013b3b59faf87a 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -1,8 +1,8 @@ import * as fs from "fs"; import * as path from "path"; +import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; -import app from "./styleTree/app"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; diff --git a/styles/styleTree/chatPanel.ts b/styles/styleTree/chatPanel.ts index ea9a8ffe22a83e2b7135bc886273f2da2d7c1502..69b5f3baa0d74c03e4ff5e0a81ff4fc6616afdfc 100644 --- a/styles/styleTree/chatPanel.ts +++ b/styles/styleTree/chatPanel.ts @@ -31,7 +31,7 @@ export default function chatPanel(theme: Theme) { const message = { body: text(theme, "sans", "secondary"), - timestamp: text(theme, "sans", "muted"), + timestamp: text(theme, "sans", "muted", { size: "sm" }), padding: { bottom: 6, }, @@ -91,12 +91,12 @@ export default function chatPanel(theme: Theme) { }, }, inputEditor: { - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), cornerRadius: 6, text: text(theme, "mono", "primary"), - placeholderText: text(theme, "mono", "muted"), + placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), selection: player(theme, 1).selection, - border: border(theme, "primary"), + border: border(theme, "secondary"), padding: { bottom: 7, left: 8, diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index ebc53b405875dab197a3c95d5373732050e9a7a0..eb379ce520bfb5b53b85e5d8e28be639d598a6f9 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -5,7 +5,7 @@ import { iconColor, player, text, - TextColor, + TextColor } from "./components"; export default function editor(theme: Theme) { @@ -39,7 +39,7 @@ export default function editor(theme: Theme) { return { textColor: theme.textColor.secondary.value, - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active.value, codeActionsIndicator: iconColor(theme, "secondary"), diffBackgroundDeleted: backgroundColor(theme, "error"), @@ -47,7 +47,7 @@ export default function editor(theme: Theme) { documentHighlightReadBackground: theme.editor.highlight.occurrence.value, documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, errorColor: theme.textColor.error.value, - gutterBackground: backgroundColor(theme, 300), + gutterBackground: backgroundColor(theme, 500), gutterPaddingFactor: 2.5, highlightedLineBackground: theme.editor.line.highlighted.value, lineNumber: theme.editor.gutter.primary.value, @@ -65,14 +65,14 @@ export default function editor(theme: Theme) { player(theme, 8).selection, ], autocomplete: { - background: backgroundColor(theme, 100), + background: backgroundColor(theme, 500), cornerRadius: 6, padding: 6, border: border(theme, "secondary"), item: autocompleteItem, hoveredItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "hovered"), + background: backgroundColor(theme, 500, "hovered"), }, margin: { left: -14, @@ -83,11 +83,11 @@ export default function editor(theme: Theme) { }, selectedItem: { ...autocompleteItem, - background: backgroundColor(theme, 100, "active"), + background: backgroundColor(theme, 500, "active"), }, }, diagnosticHeader: { - background: theme.editor.background.value, + background: backgroundColor(theme, 300), iconWidthFactor: 1.5, textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. border: border(theme, "secondary", { diff --git a/styles/styleTree/projectPanel.ts b/styles/styleTree/projectPanel.ts index cd6fb49b3ada1db47b3dd15637cb1a4a6c5ee516..e27cd94414a031f64dbc0ee5e232d2666944462a 100644 --- a/styles/styleTree/projectPanel.ts +++ b/styles/styleTree/projectPanel.ts @@ -1,7 +1,7 @@ -import { panel } from "./app"; -import { backgroundColor, iconColor, text, TextColor } from "./components"; import Theme from "../themes/theme"; import { Color } from "../utils/color"; +import { panel } from "./app"; +import { backgroundColor, iconColor, text, TextColor } from "./components"; export default function projectPanel(theme: Theme) { function entry(theme: Theme, textColor: TextColor, background?: Color) { @@ -11,7 +11,7 @@ export default function projectPanel(theme: Theme) { iconColor: iconColor(theme, "muted"), iconSize: 8, iconSpacing: 8, - text: text(theme, "mono", textColor), + text: text(theme, "mono", textColor, { size: "sm" }), }; } @@ -31,6 +31,7 @@ export default function projectPanel(theme: Theme) { ), padding: { top: 6, + left: 12, }, }; } diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 7e71eaad2a8e258e5aed2476af0b68fbf9c7ba4b..a734528d744c21896cb73c090b482615bb3544b3 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -12,14 +12,15 @@ export default function workspace(theme: Theme) { }; const tab = { - height: 34, + height: 32, + background: backgroundColor(theme, 300), iconClose: iconColor(theme, "secondary"), iconCloseActive: iconColor(theme, "active"), iconConflict: iconColor(theme, "warning"), iconDirty: iconColor(theme, "info"), iconWidth: 8, spacing: 10, - text: text(theme, "mono", "secondary"), + text: text(theme, "mono", "secondary", { size: "sm" }), border: border(theme, "primary", { left: true, bottom: true, @@ -33,8 +34,8 @@ export default function workspace(theme: Theme) { const activeTab = { ...tab, - background: backgroundColor(theme, 300), - text: text(theme, "mono", "primary"), + background: backgroundColor(theme, 500), + text: text(theme, "mono", "active", { size: "sm" }), border: { ...tab.border, bottom: false, @@ -48,11 +49,12 @@ export default function workspace(theme: Theme) { }; const sidebar = { width: 30, + background: backgroundColor(theme, 300), border: border(theme, "primary", { right: true }), item: sidebarItem, activeItem: { ...sidebarItem, - iconColor: iconColor(theme, "primary"), + iconColor: iconColor(theme, "active"), }, resizeHandle: { background: border(theme, "primary").color, @@ -63,7 +65,7 @@ export default function workspace(theme: Theme) { }; return { - background: backgroundColor(theme, 500), + background: backgroundColor(theme, 300), leaderBorderOpacity: 0.7, leaderBorderWidth: 2.0, tab, @@ -94,6 +96,7 @@ export default function workspace(theme: Theme) { titlebar: { avatarWidth: 18, height: 32, + background: backgroundColor(theme, 100), shareIconColor: iconColor(theme, "secondary"), shareIconActiveColor: iconColor(theme, "active"), title: text(theme, "sans", "primary"), @@ -107,29 +110,32 @@ export default function workspace(theme: Theme) { avatarRibbon: { height: 3, width: 12, + // TODO: The background for this ideally should be + // set with a token, not hardcoded in rust }, border: border(theme, "primary", { bottom: true }), signInPrompt, hoveredSignInPrompt: { ...signInPrompt, ...text(theme, "mono", "active"), + size: 13, }, offlineIcon: { - color: iconColor(theme, "muted"), + color: iconColor(theme, "secondary"), width: 16, padding: { right: 4, }, }, outdatedWarning: { - ...text(theme, "sans", "muted"), + ...text(theme, "sans", "warning"), size: 13, }, }, toolbar: { height: 34, - background: backgroundColor(theme, 300), - border: border(theme, "primary", { bottom: true }), + background: backgroundColor(theme, 500), + border: border(theme, "muted", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, @@ -138,8 +144,7 @@ export default function workspace(theme: Theme) { padding: { left: 6 }, }, disconnectedOverlay: { - ...text(theme, "sans", "primary"), - color: "#ffffff", + ...text(theme, "sans", "active"), background: "#000000aa", }, }; diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 2cadf24601f47cc1172c4d9be753cc80c3a9f20c..f8e0c0fcb6b00e157bf577fca2024ca286561c5d 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -3,10 +3,10 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[750], - hovered: colors.neutral[750], - active: colors.neutral[750], - focused: colors.neutral[750], + base: colors.neutral[700], + hovered: colors.neutral[700], + active: colors.neutral[700], + focused: colors.neutral[700], }, 300: { base: colors.neutral[800], @@ -52,10 +52,10 @@ const borderColor = { muted: colors.neutral[750], focused: colors.neutral[100], active: colors.neutral[500], - ok: colors.neutral[1000], - error: colors.neutral[1000], - warning: colors.neutral[1000], - info: colors.neutral[1000], + ok: colors.green[500], + error: colors.red[500], + warning: colors.amber[500], + info: colors.blue[500], }; const textColor = { @@ -65,7 +65,7 @@ const textColor = { placeholder: colors.neutral[750], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + feature: colors.lime[400], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], @@ -81,9 +81,9 @@ const iconColor = { //TODO: (design) define feature and it's correct value feature: colors.sky[500], ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + error: colors.red[500], + warning: colors.amber[400], + info: colors.blue[600], }; const player = { diff --git a/styles/themes/light.ts b/styles/themes/light.ts index acb704de74b99b91c2b41a739c751003670c5864..c543c78a302e3579970998ad1fb23847b1e1f694 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -5,73 +5,72 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[750], - hovered: colors.neutral[750], - active: colors.neutral[750], - focused: colors.neutral[750], + base: colors.neutral[100], + hovered: colors.neutral[150], + active: colors.neutral[200], + focused: colors.neutral[150], }, 300: { - base: colors.neutral[800], - hovered: colors.neutral[800], - active: colors.neutral[800], - focused: colors.neutral[800], + base: colors.neutral[50], + hovered: colors.neutral[100], + active: colors.neutral[150], + focused: colors.neutral[100], }, 500: { - base: colors.neutral[900], - hovered: colors.neutral[900], - active: colors.neutral[900], - focused: colors.neutral[900], + base: colors.neutral[0], + hovered: colors.neutral[50], + active: colors.neutral[100], + focused: colors.neutral[50], }, ok: { - base: colors.green[600], - hovered: colors.green[600], - active: colors.green[600], - focused: colors.green[600], + base: colors.green[100], + hovered: colors.green[100], + active: colors.green[100], + focused: colors.green[100], }, error: { - base: colors.red[400], - hovered: colors.red[400], - active: colors.red[400], - focused: colors.red[400], + base: colors.red[100], + hovered: colors.red[100], + active: colors.red[100], + focused: colors.red[100], }, warning: { - base: colors.amber[300], - hovered: colors.amber[300], - active: colors.amber[300], - focused: colors.amber[300], + base: colors.yellow[100], + hovered: colors.yellow[100], + active: colors.yellow[100], + focused: colors.yellow[100], }, info: { - base: colors.blue[500], - hovered: colors.blue[500], - active: colors.blue[500], - focused: colors.blue[500], + base: colors.blue[100], + hovered: colors.blue[100], + active: colors.blue[100], + focused: colors.blue[100], }, }; const borderColor = { - primary: colors.neutral[850], - secondary: colors.neutral[700], - muted: colors.neutral[750], + primary: colors.neutral[200], + secondary: colors.neutral[100], + muted: colors.neutral[50], focused: colors.neutral[100], - active: colors.neutral[500], - ok: colors.neutral[1000], - error: colors.neutral[1000], - warning: colors.neutral[1000], - info: colors.neutral[1000], + active: colors.neutral[250], + ok: colors.green[200], + error: colors.red[200], + warning: colors.yellow[200], + info: colors.blue[200], }; const textColor = { - primary: colors.neutral[150], - secondary: colors.neutral[350], - muted: colors.neutral[550], - placeholder: colors.neutral[750], - active: colors.neutral[0], - //TODO: (design) define feature and it's correct value - feature: colors.sky[500], - ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + primary: colors.neutral[800], + secondary: colors.neutral[700], + muted: colors.neutral[600], + placeholder: colors.neutral[500], + active: colors.neutral[900], + feature: colors.blue[600], + ok: colors.green[800], + error: colors.red[800], + warning: colors.yellow[800], + info: colors.blue[800], }; const iconColor = { @@ -79,63 +78,62 @@ const iconColor = { secondary: colors.neutral[500], muted: colors.neutral[600], placeholder: colors.neutral[700], - active: colors.neutral[50], - //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + active: colors.neutral[900], + feature: colors.sky[600], ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + error: colors.red[600], + warning: colors.yellow[400], + info: colors.blue[600], }; const player = { 1: { - baseColor: colors.blue[600], - cursorColor: colors.blue[600], - selectionColor: colors.blue[600], - borderColor: colors.blue[600], + baseColor: colors.blue[600], + cursorColor: colors.blue[500], + selectionColor: colors.blue[100], + borderColor: colors.blue[500], }, 2: { - baseColor: colors.indigo[500], - cursorColor: colors.indigo[500], - selectionColor: colors.indigo[500], - borderColor: colors.indigo[500], + baseColor: colors.indigo[500], + cursorColor: colors.indigo[500], + selectionColor: colors.indigo[100], + borderColor: colors.indigo[500], }, 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[500], - borderColor: colors.green[500], + baseColor: colors.green[500], + cursorColor: colors.green[500], + selectionColor: colors.green[100], + borderColor: colors.green[500], }, 4: { - baseColor: colors.orange[500], - cursorColor: colors.orange[500], - selectionColor: colors.orange[500], - borderColor: colors.orange[500], + baseColor: colors.orange[500], + cursorColor: colors.orange[500], + selectionColor: colors.orange[100], + borderColor: colors.orange[500], }, 5: { - baseColor: colors.purple[500], - cursorColor: colors.purple[500], - selectionColor: colors.purple[500], - borderColor: colors.purple[500], + baseColor: colors.purple[500], + cursorColor: colors.purple[500], + selectionColor: colors.purple[100], + borderColor: colors.purple[500], }, 6: { - baseColor: colors.teal[400], - cursorColor: colors.teal[400], - selectionColor: colors.teal[400], - borderColor: colors.teal[400], + baseColor: colors.teal[400], + cursorColor: colors.teal[400], + selectionColor: colors.teal[100], + borderColor: colors.teal[400], }, 7: { - baseColor: colors.pink[400], - cursorColor: colors.pink[400], - selectionColor: colors.pink[400], - borderColor: colors.pink[400], + baseColor: colors.pink[400], + cursorColor: colors.pink[400], + selectionColor: colors.pink[100], + borderColor: colors.pink[400], }, 8: { - baseColor: colors.yellow[400], - cursorColor: colors.yellow[400], - selectionColor: colors.yellow[400], - borderColor: colors.yellow[400], + baseColor: colors.yellow[400], + cursorColor: colors.yellow[400], + selectionColor: colors.yellow[100], + borderColor: colors.yellow[400], }, }; @@ -145,118 +143,118 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, + active: colors.neutral[0], + highlighted: colors.neutral[0], + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, }, highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: colors.neutral[0], - matchingBracket: colors.neutral[0], - match: colors.neutral[0], - activeMatch: colors.neutral[0], - related: colors.neutral[0], + selection: player[1].selectionColor, + occurrence: backgroundColor[500].active, + activeOccurrence: colors.neutral[0], + matchingBracket: colors.neutral[0], + match: colors.neutral[0], + activeMatch: colors.neutral[0], + related: colors.neutral[0], }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: colors.neutral[0], + active: colors.neutral[0], }, }; const syntax: Syntax = { primary: { - color: textColor.primary, - weight: fontWeights.normal, + color: textColor.primary, + weight: fontWeights.normal, }, comment: { - color: colors.lime[200], - weight: fontWeights.normal, + color: colors.lime[200], + weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, - weight: fontWeights.normal, + color: textColor.primary, + weight: fontWeights.normal, }, constant: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, function: { - color: colors.yellow[200], - weight: fontWeights.normal, + color: colors.yellow[200], + weight: fontWeights.normal, }, type: { - color: colors.teal[300], - weight: fontWeights.normal, + color: colors.teal[300], + weight: fontWeights.normal, }, variant: { - color: colors.teal[300], - weight: fontWeights.normal, + color: colors.teal[300], + weight: fontWeights.normal, }, property: { - color: colors.sky[300], - weight: fontWeights.normal, + color: colors.sky[300], + weight: fontWeights.normal, }, enum: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, operator: { - color: colors.sky[400], - weight: fontWeights.normal, + color: colors.sky[400], + weight: fontWeights.normal, }, string: { - color: colors.orange[300], - weight: fontWeights.normal, + color: colors.orange[300], + weight: fontWeights.normal, }, number: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], - weight: fontWeights.normal, + color: colors.neutral[150], + weight: fontWeights.normal, }, predictive: { - color: textColor.muted, - weight: fontWeights.normal, + color: textColor.muted, + weight: fontWeights.normal, }, title: { - color: colors.sky[500], - weight: fontWeights.bold, + color: colors.sky[500], + weight: fontWeights.bold, }, emphasis: { - color: textColor.active, - weight: fontWeights.normal, + color: textColor.active, + weight: fontWeights.normal, }, emphasisStrong: { - color: textColor.active, - weight: fontWeights.bold, + color: textColor.active, + weight: fontWeights.bold, }, linkUrl: { - color: colors.lime[500], - weight: fontWeights.normal, - // TODO: add underline + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline }, linkText: { - color: colors.orange[500], - weight: fontWeights.normal, - // TODO: add italic + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic }, listMarker: { - color: colors.sky[400], - weight: fontWeights.normal, - } + color: colors.sky[400], + weight: fontWeights.normal, + }, }; const shadowAlpha: NumberToken = { - value: 0.32, + value: 0.12, type: "number", }; diff --git a/styles/themes/theme.ts b/styles/themes/theme.ts index f95d58e49484aea340693ff289f19cb8cf8a4b0a..7f8305c1d539d24fe50f23d650844c0670506dc1 100644 --- a/styles/themes/theme.ts +++ b/styles/themes/theme.ts @@ -1,4 +1,4 @@ -import { FontWeightToken, ColorToken, NumberToken } from "../tokens"; +import { ColorToken, FontWeightToken, NumberToken } from "../tokens"; export interface SyntaxHighlightStyle { color: ColorToken; diff --git a/styles/tokens.ts b/styles/tokens.ts index 1e0df5032d09ee72ce31fc2b9de256174b6bf905..63c19a9d6439a77db5d1d9cd7924966e117a931a 100644 --- a/styles/tokens.ts +++ b/styles/tokens.ts @@ -72,7 +72,7 @@ export interface ColorToken { step?: number, } export const colors = { - neutral: colorRamp(["black", "white"], { steps: 21, increment: 50 }), + neutral: colorRamp(["white", "black"], { steps: 19, increment: 50 }), rose: colorRamp("#F43F5EFF"), red: colorRamp("#EF4444FF"), orange: colorRamp("#F97316FF"), From bfde9dca4e0dc1b50f2eb0927efcc6b7985e9dc3 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 1 Apr 2022 23:59:20 -0400 Subject: [PATCH 053/245] Add greg to .zed.toml --- .zed.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zed.toml b/.zed.toml index 0cbe5c59a550cbdae9b8d016123ef315bbd0e18e..fae32125f4f236c7bc99f57f5bf9e6e041984069 100644 --- a/.zed.toml +++ b/.zed.toml @@ -1 +1 @@ -collaborators = ["nathansobo", "as-cii", "maxbrunsfeld", "iamnbutler", "Kethku"] +collaborators = ["nathansobo", "as-cii", "maxbrunsfeld", "iamnbutler", "gibusu", "Kethku"] From c374fd2f548471b587f33ff9d04e21a373cdd1fd Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sat, 2 Apr 2022 01:05:28 -0400 Subject: [PATCH 054/245] WIP --- crates/zed/assets/themes/dark.json | 157 +++++++++--------- crates/zed/assets/themes/light.json | 245 ++++++++++++++-------------- styles/styleTree/app.ts | 3 +- styles/styleTree/editor.ts | 3 +- styles/themes/dark.ts | 54 +++--- styles/themes/light.ts | 38 ++--- styles/utils/color.ts | 4 +- 7 files changed, 251 insertions(+), 253 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index fd11fc6c3a64a6fd6d878b935941d21960c12f37..0abf380cc18fc7ecb252d8d062b2ff53aeb4ad7c 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#90df17", + "color": "#72ad19", "weight": "bold", "size": 14 } @@ -33,16 +33,16 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#90df17", + "color": "#72ad19", "weight": "bold", "size": 14 }, - "background": "#000000" + "background": "#1c1c1c" }, "border": { "color": "#0e0e0e", @@ -70,12 +70,12 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#717171", "icon_close_active": "#f1f1f1", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#c38214", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#717171", "icon_close_active": "#f1f1f1", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#c38214", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -243,7 +243,7 @@ "share_icon_active_color": "#f1f1f1", "title": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "avatar": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 13 } }, @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#9c9c9c", + "text_color": "#e3e3e3", "background": "#000000", - "active_line_background": "#ffffff", + "active_line_background": "#1c1c1c", "code_actions_indicator": "#717171", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#000000", - "document_highlight_write_background": "#000000", - "error_color": "#f78c8c", + "diff_background_deleted": "#d71c1c", + "diff_background_inserted": "#1ea34f", + "document_highlight_read_background": "#1e22db", + "document_highlight_write_background": "#1e22db", + "error_color": "#d71c1c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#ffffff", - "line_number": "#ffffff", + "highlighted_line_background": "#0e0e0e", + "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "guest_selections": [ { - "cursor": "#777af4", - "selection": "#777af4" + "cursor": "#70a919", + "selection": "#80c517" }, { - "cursor": "#23d464", - "selection": "#23d464" + "cursor": "#1e22db", + "selection": "#5558ee" }, { - "cursor": "#f98a3d", - "selection": "#f98a3d" + "cursor": "#c45c14", + "selection": "#f66e0f" }, { - "cursor": "#b671f8", - "selection": "#b671f8" + "cursor": "#7d19dc", + "selection": "#a048f4" }, { - "cursor": "#16ddc7", - "selection": "#16ddc7" + "cursor": "#17a293", + "selection": "#15b3a2" }, { - "cursor": "#f58ac0", - "selection": "#f58ac0" + "cursor": "#d51e79", + "selection": "#e93d92" }, { - "cursor": "#f6bc09", - "selection": "#f6bc09" + "cursor": "#bc9212", + "selection": "#e0ac0b" } ], "autocomplete": { @@ -400,13 +400,13 @@ "right": 6, "top": 2 }, - "background": "#000000" + "background": "#0e0e0e" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#1588bc", "weight": "normal" }, "selected_item": { @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#000000" + "background": "#1c1c1c" } }, "diagnostic_header": { @@ -441,7 +441,7 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14, "weight": "bold" }, @@ -453,11 +453,11 @@ } }, "diagnostic_path_header": { - "background": "#ffffff", + "background": "#1c1c1c", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "path": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d71c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#d71c1c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#cc8712", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -656,13 +656,12 @@ "syntax": {} }, "project_diagnostics": { - "background": "#1c1c1c", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "status_bar_item": { @@ -709,7 +708,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 } }, @@ -721,7 +720,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 } } @@ -735,7 +734,7 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "weight": "bold", "size": 14 }, @@ -751,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": { @@ -806,7 +805,7 @@ "active_item": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": 4, @@ -823,7 +822,7 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14 }, "padding": 4, @@ -864,7 +863,7 @@ }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "underline": true, "size": 14 }, @@ -884,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "weight": "bold", "size": 14, "margin": { @@ -921,7 +920,7 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "placeholder_text": { @@ -930,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "border": { "color": "#393939", @@ -995,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16, "margin": { "right": 6 @@ -1014,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16, "margin": { "right": 6 @@ -1023,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#1c1c1c", "corner_radius": 6 }, "unshared_project": { @@ -1063,12 +1062,12 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#1c1c1c", "corner_radius": 6 } }, "search": { - "match_background": "#ffffff", + "match_background": "#70a919", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1124,12 +1123,12 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { @@ -1178,16 +1177,16 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#4287f6" + "cursor": "#195cc8", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 16 }, "border": { - "color": "#f47171", + "color": "#cd1c1c", "width": 1 }, "margin": { @@ -1235,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#d5d5d5", + "color": "#e3e3e3", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 219f958e876dcb36abd4edf2e2986c7fb26f32c3..1024764540e55f20505b6864ca6bdddd95881edd 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#4287f6", + "color": "#185fd0", "weight": "bold", "size": 14 } @@ -33,12 +33,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#4287f6", + "color": "#185fd0", "weight": "bold", "size": 14 }, @@ -51,7 +51,7 @@ "empty": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -66,16 +66,16 @@ "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#717171", + "color": "#aaaaaa", "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { @@ -111,13 +111,13 @@ "background": "#f1f1f1", "icon_close": "#717171", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#bc9212", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 }, "border": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#717171", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#bc9212", + "icon_dirty": "#195cc8", "icon_width": 8, "spacing": 10, "text": { @@ -221,17 +221,17 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 } }, @@ -243,7 +243,7 @@ "share_icon_active_color": "#000000", "title": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "avatar": { @@ -264,7 +264,7 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 13, "underline": true, "padding": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 13 } }, @@ -311,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "padding": { "left": 6 @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#393939", + "text_color": "#2b2b2b", "background": "#ffffff", - "active_line_background": "#ffffff", + "active_line_background": "#e3e3e3", "code_actions_indicator": "#717171", - "diff_background_deleted": "#fdd4d4", - "diff_background_inserted": "#befad2", + "diff_background_deleted": "#ec3939", + "diff_background_inserted": "#21bf5b", "document_highlight_read_background": "#e3e3e3", "document_highlight_write_background": "#e3e3e3", - "error_color": "#d11c1c", + "error_color": "#cd1c1c", "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#ffffff", - "line_number": "#ffffff", - "line_number_active": "#ffffff", + "highlighted_line_background": "#e3e3e3", + "line_number": "#808080", + "line_number_active": "#000000", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "guest_selections": [ { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#70a919", + "selection": "#80c517" }, { - "cursor": "#23d464", - "selection": "#befad2" + "cursor": "#1e22db", + "selection": "#5558ee" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#c45c14", + "selection": "#f66e0f" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#7d19dc", + "selection": "#a048f4" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#17a293", + "selection": "#15b3a2" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#d51e79", + "selection": "#e93d92" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#bc9212", + "selection": "#e0ac0b" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#1588bc", "weight": "normal" }, "selected_item": { @@ -432,7 +432,7 @@ }, "code": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "left": 10 @@ -441,28 +441,28 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14, "weight": "bold" }, "text": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 } } }, "diagnostic_path_header": { - "background": "#ffffff", + "background": "#e3e3e3", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "path": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "left": 12 @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#d11c1c", + "color": "#cd1c1c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#d11c1c", + "color": "#cd1c1c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#b48d14", + "color": "#b68e14", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#1762db", + "color": "#185fd0", "size": 14, "weight": "bold" } @@ -573,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -596,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -619,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -642,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "weight": "bold" } @@ -656,18 +656,17 @@ "syntax": {} }, "project_diagnostics": { - "background": "#f1f1f1", "tab_icon_spacing": 4, "tab_icon_width": 13, "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "status_bar_item": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 10 @@ -686,7 +685,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 } }, @@ -698,7 +697,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 14 } }, @@ -709,7 +708,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 } }, @@ -721,7 +720,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 } } @@ -735,13 +734,13 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "weight": "bold", "size": 14 }, "channel_name_hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "padding": { "right": 8 @@ -751,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": { @@ -760,7 +759,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -771,13 +770,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -788,13 +787,13 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -806,13 +805,13 @@ "active_item": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -823,13 +822,13 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -858,25 +857,25 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "underline": true, "size": 14 }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "underline": true, "size": 14 }, "message": { "body": { "family": "Zed Sans", - "color": "#393939", + "color": "#555555", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -884,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "weight": "bold", "size": 14, "margin": { @@ -895,12 +894,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "size": 14 }, "padding": { @@ -908,7 +907,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#555555", + "color": "#808080", "weight": "bold", "size": 14, "margin": { @@ -921,17 +920,17 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "border": { "color": "#e3e3e3", @@ -961,7 +960,7 @@ }, "host_username": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 16, "padding": { "left": 8 @@ -976,7 +975,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -995,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16, "margin": { "right": 6 @@ -1014,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16, "margin": { "right": 6 @@ -1023,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#e3e3e3", "corner_radius": 6 }, "unshared_project": { @@ -1035,7 +1034,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -1054,7 +1053,7 @@ }, "name": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "margin": { "right": 6 @@ -1063,7 +1062,7 @@ "padding": { "left": 8 }, - "background": "#ffffff", + "background": "#e3e3e3", "corner_radius": 6 } }, @@ -1073,7 +1072,7 @@ "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1094,7 +1093,7 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1120,16 +1119,16 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { @@ -1148,7 +1147,7 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#e3e3e3", "corner_radius": 6, @@ -1174,20 +1173,20 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#717171", + "color": "#aaaaaa", "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#185fd0", + "selection": "#307af3" }, "text": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 16 }, "border": { - "color": "#fbbdbd", + "color": "#e72727", "width": 1 }, "margin": { @@ -1202,13 +1201,13 @@ }, "match_index": { "family": "Zed Mono", - "color": "#555555", + "color": "#808080", "size": 16, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#393939", + "color": "#555555", "size": 16, "background": "#f1f1f1", "corner_radius": 6, @@ -1235,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#1c1c1c", + "color": "#2b2b2b", "size": 14, "padding": { "left": 6 diff --git a/styles/styleTree/app.ts b/styles/styleTree/app.ts index d26ada4fc9bc6ebab7c63255245ff003dfae0640..10439b5a0056e8f8ac6ec29e10b4094f1aae26a8 100644 --- a/styles/styleTree/app.ts +++ b/styles/styleTree/app.ts @@ -1,6 +1,6 @@ import Theme from "../themes/theme"; import chatPanel from "./chatPanel"; -import { backgroundColor, borderColor, text } from "./components"; +import { text } from "./components"; import contactsPanel from "./contactsPanel"; import editor from "./editor"; import projectPanel from "./projectPanel"; @@ -18,7 +18,6 @@ export default function app(theme: Theme): Object { workspace: workspace(theme), editor: editor(theme), projectDiagnostics: { - background: backgroundColor(theme, 300), tabIconSpacing: 4, tabIconWidth: 13, tabSummarySpacing: 10, diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index eb379ce520bfb5b53b85e5d8e28be639d598a6f9..e760ecec6a57997c48238e0fdeb16d457c2c3e69 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -38,7 +38,8 @@ export default function editor(theme: Theme) { } return { - textColor: theme.textColor.secondary.value, + // textColor: theme.syntax.primary.color, + textColor: theme.syntax.primary.color.value, background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active.value, codeActionsIndicator: iconColor(theme, "secondary"), diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index f8e0c0fcb6b00e157bf577fca2024ca286561c5d..fa05576cd2c3dd191385965c8d5ec9a1ceafc0b7 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -16,9 +16,9 @@ const backgroundColor = { }, 500: { base: colors.neutral[900], - hovered: colors.neutral[900], - active: colors.neutral[900], - focused: colors.neutral[900], + hovered: colors.neutral[850], + active: colors.neutral[800], + focused: colors.neutral[850], }, ok: { base: colors.green[600], @@ -59,7 +59,7 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[150], + primary: colors.neutral[100], secondary: colors.neutral[350], muted: colors.neutral[550], placeholder: colors.neutral[750], @@ -90,49 +90,49 @@ const player = { 1: { baseColor: colors.blue[600], cursorColor: colors.blue[600], - selectionColor: colors.blue[600], + selectionColor: colors.blue[100], borderColor: colors.blue[600], }, 2: { + baseColor: colors.lime[500], + cursorColor: colors.lime[500], + selectionColor: colors.lime[100], + borderColor: colors.lime[500], + }, + 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], - selectionColor: colors.indigo[500], + selectionColor: colors.indigo[100], borderColor: colors.indigo[500], }, - 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[500], - borderColor: colors.green[500], - }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], - selectionColor: colors.orange[500], + selectionColor: colors.orange[100], borderColor: colors.orange[500], }, 5: { baseColor: colors.purple[500], cursorColor: colors.purple[500], - selectionColor: colors.purple[500], + selectionColor: colors.purple[100], borderColor: colors.purple[500], }, 6: { baseColor: colors.teal[400], cursorColor: colors.teal[400], - selectionColor: colors.teal[400], + selectionColor: colors.teal[100], borderColor: colors.teal[400], }, 7: { baseColor: colors.pink[400], cursorColor: colors.pink[400], - selectionColor: colors.pink[400], + selectionColor: colors.pink[100], borderColor: colors.pink[400], }, 8: { baseColor: colors.yellow[400], cursorColor: colors.yellow[400], - selectionColor: colors.yellow[400], + selectionColor: colors.yellow[100], borderColor: colors.yellow[400], }, }; @@ -143,24 +143,24 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], + active: backgroundColor[500].active, + highlighted: backgroundColor[500].hovered, inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, }, highlight: { selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: colors.neutral[0], - matchingBracket: colors.neutral[0], - match: colors.neutral[0], - activeMatch: colors.neutral[0], - related: colors.neutral[0], + occurrence: colors.indigo[500], // TODO: Why does indigo[500], indigo[100], and indigo[900] all give me the same color? @kethku + activeOccurrence: colors.indigo[400], // TODO: We don't seem to be using this right now in rust + matchingBracket: backgroundColor[500].active, + match: colors.lime[500], + activeMatch: colors.lime[400], + related: backgroundColor[500].focused, }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: textColor.muted, + active: textColor.active, }, }; diff --git a/styles/themes/light.ts b/styles/themes/light.ts index c543c78a302e3579970998ad1fb23847b1e1f694..ee94e18b19869727eae1c973d908ed3202282c77 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -61,16 +61,16 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[800], - secondary: colors.neutral[700], - muted: colors.neutral[600], - placeholder: colors.neutral[500], + primary: colors.neutral[750], + secondary: colors.neutral[600], + muted: colors.neutral[450], + placeholder: colors.neutral[300], active: colors.neutral[900], - feature: colors.blue[600], - ok: colors.green[800], - error: colors.red[800], - warning: colors.yellow[800], - info: colors.blue[800], + feature: colors.blue[500], + ok: colors.green[500], + error: colors.red[500], + warning: colors.yellow[500], + info: colors.blue[500], }; const iconColor = { @@ -94,17 +94,17 @@ const player = { borderColor: colors.blue[500], }, 2: { + baseColor: colors.lime[500], + cursorColor: colors.lime[500], + selectionColor: colors.lime[100], + borderColor: colors.lime[500], + }, + 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], selectionColor: colors.indigo[100], borderColor: colors.indigo[500], }, - 3: { - baseColor: colors.green[500], - cursorColor: colors.green[500], - selectionColor: colors.green[100], - borderColor: colors.green[500], - }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], @@ -143,8 +143,8 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: colors.neutral[0], - highlighted: colors.neutral[0], + active: backgroundColor[500].active, + highlighted: backgroundColor[500].active, inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, @@ -159,8 +159,8 @@ const editor = { related: colors.neutral[0], }, gutter: { - primary: colors.neutral[0], - active: colors.neutral[0], + primary: textColor.muted, + active: textColor.active, }, }; diff --git a/styles/utils/color.ts b/styles/utils/color.ts index b59f4fa69479a1f886229afe1953284f6626f9d8..1042899c737681ddc8e074b19723ed5ba3ad0117 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -22,8 +22,8 @@ export function colorRamp( .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") - .gamma(1) - .correctLightness(true) + .gamma(0.2) + // .correctLightness(true) .padding([0, 0.15]); } From 631d8d034440c3e59410a1e59cf3bf51e0d12a86 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 01:04:34 -0400 Subject: [PATCH 055/245] Refined dark theme styles --- crates/zed/assets/themes/dark.json | 166 ++++++++++++++-------------- crates/zed/assets/themes/light.json | 14 +-- styles/buildThemes.ts | 3 + styles/styleTree/selectorModal.ts | 8 +- styles/styleTree/workspace.ts | 4 +- styles/themes/dark.ts | 38 +++---- styles/tokens.ts | 2 +- styles/utils/color.ts | 2 +- 8 files changed, 120 insertions(+), 117 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 0abf380cc18fc7ecb252d8d062b2ff53aeb4ad7c..25568bf17c9dafaf92beb11be5e4514377f57e76 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#000000", + "background": "#1c1c1c", "corner_radius": 6, "padding": 8, "item": { @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#72ad19", + "color": "#1684b6", "weight": "bold", "size": 14 } @@ -33,19 +33,19 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#72ad19", + "color": "#1684b6", "weight": "bold", "size": 14 }, - "background": "#1c1c1c" + "background": "#2b2b2b" }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "empty": { @@ -62,7 +62,7 @@ } }, "input_editor": { - "background": "#1c1c1c", + "background": "#000000", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", @@ -75,11 +75,11 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { - "color": "#0e0e0e", + "color": "#151515", "width": 1 }, "padding": { @@ -109,8 +109,8 @@ "tab": { "height": 32, "background": "#1c1c1c", - "icon_close": "#717171", - "icon_close_active": "#f1f1f1", + "icon_close": "#555555", + "icon_close_active": "#ffffff", "icon_conflict": "#c38214", "icon_dirty": "#195cc8", "icon_width": 8, @@ -121,7 +121,7 @@ "size": 14 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true, "bottom": true, @@ -135,8 +135,8 @@ "active_tab": { "height": 32, "background": "#000000", - "icon_close": "#717171", - "icon_close_active": "#f1f1f1", + "icon_close": "#555555", + "icon_close_active": "#ffffff", "icon_conflict": "#c38214", "icon_dirty": "#195cc8", "icon_width": 8, @@ -147,7 +147,7 @@ "size": 14 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true, "bottom": false, @@ -162,22 +162,22 @@ "width": 30, "background": "#1c1c1c", "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#f1f1f1", + "icon_color": "#ffffff", "icon_size": 18 }, "resize_handle": { - "background": "#0e0e0e", + "background": "#070707", "padding": { "left": 1 } @@ -187,29 +187,29 @@ "width": 30, "background": "#1c1c1c", "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 18 }, "active_item": { "height": 32, - "icon_color": "#f1f1f1", + "icon_color": "#ffffff", "icon_size": 18 }, "resize_handle": { - "background": "#0e0e0e", + "background": "#070707", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "status_bar": { @@ -238,12 +238,12 @@ "titlebar": { "avatar_width": 18, "height": 32, - "background": "#393939", - "share_icon_color": "#717171", - "share_icon_active_color": "#f1f1f1", + "background": "#2b2b2b", + "share_icon_color": "#9c9c9c", + "share_icon_active_color": "#ffffff", "title": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "avatar": { @@ -258,7 +258,7 @@ "width": 12 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "bottom": true }, @@ -281,7 +281,7 @@ } }, "offline_icon": { - "color": "#717171", + "color": "#9c9c9c", "width": 16, "padding": { "right": 4 @@ -297,7 +297,7 @@ "height": 34, "background": "#000000", "border": { - "color": "#2b2b2b", + "color": "#070707", "width": 1, "bottom": true }, @@ -325,10 +325,10 @@ } }, "editor": { - "text_color": "#e3e3e3", + "text_color": "#f1f1f1", "background": "#000000", - "active_line_background": "#1c1c1c", - "code_actions_indicator": "#717171", + "active_line_background": "#0e0e0e", + "code_actions_indicator": "#9c9c9c", "diff_background_deleted": "#d71c1c", "diff_background_inserted": "#1ea34f", "document_highlight_read_background": "#1e22db", @@ -336,7 +336,7 @@ "error_color": "#d71c1c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, - "highlighted_line_background": "#0e0e0e", + "highlighted_line_background": "#070707", "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, @@ -380,7 +380,7 @@ "corner_radius": 6, "padding": 6, "border": { - "color": "#393939", + "color": "#151515", "width": 1 }, "item": { @@ -400,7 +400,7 @@ "right": 6, "top": 2 }, - "background": "#0e0e0e" + "background": "#070707" }, "margin": { "left": -14 @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#1c1c1c" + "background": "#0e0e0e" } }, "diagnostic_header": { @@ -425,7 +425,7 @@ "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#393939", + "color": "#151515", "width": 1, "bottom": true, "top": true @@ -441,7 +441,7 @@ "message": { "highlight_text": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14, "weight": "bold" }, @@ -453,11 +453,11 @@ } }, "diagnostic_path_header": { - "background": "#1c1c1c", + "background": "#0e0e0e", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "path": { @@ -473,7 +473,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -496,7 +496,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -519,7 +519,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -542,7 +542,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -565,7 +565,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -588,7 +588,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -611,7 +611,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -634,7 +634,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1, "top": true } @@ -661,7 +661,7 @@ "tab_summary_spacing": 10, "empty_message": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "status_bar_item": { @@ -691,7 +691,7 @@ }, "hovered_entry": { "height": 22, - "background": "#1c1c1c", + "background": "#232323", "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, @@ -708,19 +708,19 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 } }, "hovered_selected_entry": { "height": 22, - "background": "#1c1c1c", + "background": "#232323", "icon_color": "#555555", "icon_size": 8, "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 } } @@ -734,7 +734,7 @@ }, "channel_name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "weight": "bold", "size": 14 }, @@ -750,7 +750,7 @@ "header": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": { @@ -799,13 +799,13 @@ "right": 8 } }, - "background": "#1c1c1c", + "background": "#232323", "corner_radius": 6 }, "active_item": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": 4, @@ -822,7 +822,7 @@ "hovered_active_item": { "name": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14 }, "padding": 4, @@ -834,7 +834,7 @@ "right": 8 } }, - "background": "#1c1c1c", + "background": "#232323", "corner_radius": 6 }, "menu": { @@ -842,7 +842,7 @@ "corner_radius": 6, "padding": 4, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "shadow": { @@ -863,7 +863,7 @@ }, "hovered_sign_in_prompt": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "underline": true, "size": 14 }, @@ -883,7 +883,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "weight": "bold", "size": 14, "margin": { @@ -920,7 +920,7 @@ "corner_radius": 6, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "placeholder_text": { @@ -933,7 +933,7 @@ "selection": "#307af3" }, "border": { - "color": "#393939", + "color": "#151515", "width": 1 }, "padding": { @@ -952,7 +952,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#2b2b2b", + "tree_branch_color": "#232323", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -994,7 +994,7 @@ }, "name": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16, "margin": { "right": 6 @@ -1013,7 +1013,7 @@ }, "name": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16, "margin": { "right": 6 @@ -1022,7 +1022,7 @@ "padding": { "left": 8 }, - "background": "#1c1c1c", + "background": "#0e0e0e", "corner_radius": 6 }, "unshared_project": { @@ -1062,7 +1062,7 @@ "padding": { "left": 8 }, - "background": "#1c1c1c", + "background": "#0e0e0e", "corner_radius": 6 } }, @@ -1074,10 +1074,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1095,10 +1095,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1128,11 +1128,11 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1149,10 +1149,10 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 16, - "background": "#393939", + "background": "#2b2b2b", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1182,7 +1182,7 @@ }, "text": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 16 }, "border": { @@ -1212,7 +1212,7 @@ "background": "#1c1c1c", "corner_radius": 6, "border": { - "color": "#0e0e0e", + "color": "#070707", "width": 1 }, "margin": { @@ -1234,13 +1234,13 @@ }, "results_status": { "family": "Zed Mono", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 18 } }, "breadcrumbs": { "family": "Zed Sans", - "color": "#e3e3e3", + "color": "#f1f1f1", "size": 14, "padding": { "left": 6 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 1024764540e55f20505b6864ca6bdddd95881edd..76fe01501d181cdcbdea018c21357a2c65a728ab 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#ffffff", + "background": "#f1f1f1", "corner_radius": 6, "padding": 8, "item": { @@ -42,7 +42,7 @@ "weight": "bold", "size": 14 }, - "background": "#e3e3e3" + "background": "#d5d5d5" }, "border": { "color": "#c6c6c6", @@ -62,7 +62,7 @@ } }, "input_editor": { - "background": "#f1f1f1", + "background": "#ffffff", "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", @@ -79,7 +79,7 @@ "size": 16 }, "border": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1 }, "padding": { @@ -109,7 +109,7 @@ "tab": { "height": 32, "background": "#f1f1f1", - "icon_close": "#717171", + "icon_close": "#555555", "icon_close_active": "#000000", "icon_conflict": "#bc9212", "icon_dirty": "#195cc8", @@ -135,7 +135,7 @@ "active_tab": { "height": 32, "background": "#ffffff", - "icon_close": "#717171", + "icon_close": "#555555", "icon_close_active": "#000000", "icon_conflict": "#bc9212", "icon_dirty": "#195cc8", @@ -297,7 +297,7 @@ "height": 34, "background": "#ffffff", "border": { - "color": "#f1f1f1", + "color": "#c6c6c6", "width": 1, "bottom": true }, diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index 9128eff45d46a0a11b9a8ddb04013b3b59faf87a..a1a07ecb2d7fa69cdb6d83c8024ec173b1e27127 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -3,6 +3,7 @@ import * as path from "path"; import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; +import { colors } from "./tokens"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; @@ -14,4 +15,6 @@ for (let theme of themes) { ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`Generated ${outPath}`); + + console.log(JSON.stringify(colors.indigo, null, 2)); } diff --git a/styles/styleTree/selectorModal.ts b/styles/styleTree/selectorModal.ts index fdebe712fa0f1650a3fe4411b4579aa30bb44e2e..47355cff116ff985ac62fd8d1665056422cfcd3c 100644 --- a/styles/styleTree/selectorModal.ts +++ b/styles/styleTree/selectorModal.ts @@ -16,12 +16,12 @@ export default function selectorModal(theme: Theme): Object { const activeItem = { ...item, - background: backgroundColor(theme, 500, "active"), + background: backgroundColor(theme, 300, "active"), text: text(theme, "sans", "primary"), }; return { - background: backgroundColor(theme, 500), + background: backgroundColor(theme, 300), cornerRadius: 6, padding: 8, item, @@ -37,12 +37,12 @@ export default function selectorModal(theme: Theme): Object { }, }, inputEditor: { - background: backgroundColor(theme, 300), + background: backgroundColor(theme, 500), corner_radius: 6, placeholderText: text(theme, "sans", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), - border: border(theme, "primary"), + border: border(theme, "secondary"), padding: { bottom: 7, left: 16, diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index a734528d744c21896cb73c090b482615bb3544b3..4349ba0ab6861080a146e6d25b8be9d6af801d71 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -14,7 +14,7 @@ export default function workspace(theme: Theme) { const tab = { height: 32, background: backgroundColor(theme, 300), - iconClose: iconColor(theme, "secondary"), + iconClose: iconColor(theme, "muted"), iconCloseActive: iconColor(theme, "active"), iconConflict: iconColor(theme, "warning"), iconDirty: iconColor(theme, "info"), @@ -135,7 +135,7 @@ export default function workspace(theme: Theme) { toolbar: { height: 34, background: backgroundColor(theme, 500), - border: border(theme, "muted", { bottom: true }), + border: border(theme, "primary", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index fa05576cd2c3dd191385965c8d5ec9a1ceafc0b7..3cb3b653b4a6407d197049b0baf1ff72997b02c7 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -3,22 +3,22 @@ import Theme, { Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[700], - hovered: colors.neutral[700], + base: colors.neutral[750], + hovered: colors.neutral[725], active: colors.neutral[700], - focused: colors.neutral[700], + focused: colors.neutral[675], }, 300: { base: colors.neutral[800], - hovered: colors.neutral[800], - active: colors.neutral[800], - focused: colors.neutral[800], + hovered: colors.neutral[775], + active: colors.neutral[750], + focused: colors.neutral[725], }, 500: { base: colors.neutral[900], - hovered: colors.neutral[850], - active: colors.neutral[800], - focused: colors.neutral[850], + hovered: colors.neutral[875], + active: colors.neutral[850], + focused: colors.neutral[825], }, ok: { base: colors.green[600], @@ -47,11 +47,11 @@ const backgroundColor = { }; const borderColor = { - primary: colors.neutral[850], - secondary: colors.neutral[700], - muted: colors.neutral[750], - focused: colors.neutral[100], - active: colors.neutral[500], + primary: colors.neutral[875], + secondary: colors.neutral[825], + muted: colors.neutral[775], + focused: colors.neutral[500], + active: colors.neutral[900], ok: colors.green[500], error: colors.red[500], warning: colors.amber[500], @@ -59,13 +59,13 @@ const borderColor = { }; const textColor = { - primary: colors.neutral[100], + primary: colors.neutral[50], secondary: colors.neutral[350], muted: colors.neutral[550], placeholder: colors.neutral[750], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.lime[400], + feature: colors.sky[500], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], @@ -73,11 +73,11 @@ const textColor = { }; const iconColor = { - primary: colors.neutral[300], - secondary: colors.neutral[500], + primary: colors.neutral[200], + secondary: colors.neutral[350], muted: colors.neutral[600], placeholder: colors.neutral[700], - active: colors.neutral[50], + active: colors.neutral[0], //TODO: (design) define feature and it's correct value feature: colors.sky[500], ok: colors.green[600], diff --git a/styles/tokens.ts b/styles/tokens.ts index 63c19a9d6439a77db5d1d9cd7924966e117a931a..aa865ae6943603cda17dbac9f3a4a786cdc45367 100644 --- a/styles/tokens.ts +++ b/styles/tokens.ts @@ -72,7 +72,7 @@ export interface ColorToken { step?: number, } export const colors = { - neutral: colorRamp(["white", "black"], { steps: 19, increment: 50 }), + neutral: colorRamp(["white", "black"], { steps: 37, increment: 25 }), // (900/25) + 1 rose: colorRamp("#F43F5EFF"), red: colorRamp("#EF4444FF"), orange: colorRamp("#F97316FF"), diff --git a/styles/utils/color.ts b/styles/utils/color.ts index 1042899c737681ddc8e074b19723ed5ba3ad0117..c7506f696d4cebd54ebc2045be2b7dc9d14f2c7b 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -8,7 +8,7 @@ export type ColorRamp = { export function colorRamp( color: Color | [Color, Color], - options?: { steps?: number; increment?: number } + options?: { steps?: number; increment?: number; } ): ColorRamp { let scale: Scale; if (Array.isArray(color)) { From e0e9a145905299a9e0819b46c7e942596b9541c2 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 10:50:41 -0400 Subject: [PATCH 056/245] Remove leftover console.log --- styles/buildThemes.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/styles/buildThemes.ts b/styles/buildThemes.ts index a1a07ecb2d7fa69cdb6d83c8024ec173b1e27127..9128eff45d46a0a11b9a8ddb04013b3b59faf87a 100644 --- a/styles/buildThemes.ts +++ b/styles/buildThemes.ts @@ -3,7 +3,6 @@ import * as path from "path"; import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; -import { colors } from "./tokens"; import decamelizeTree from "./utils/decamelizeTree"; const themes = [dark, light]; @@ -15,6 +14,4 @@ for (let theme of themes) { ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`Generated ${outPath}`); - - console.log(JSON.stringify(colors.indigo, null, 2)); } From 37441bf3420ddc24fa4b812abd0402d62fbbe564 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 13:30:59 -0400 Subject: [PATCH 057/245] Add basic support for exporting tokens to Figma Tokens. (#724) * WIP on figma token export * WIP Working export * Tidy up the figma tokens script * Correctly format theme json structure for Figma Tokens * Finish up themeTokens imports --- styles/buildFigmaTokens.ts | 99 ++++ styles/figma/core.json | 1155 ++++++++++++++++++++++++++++++++++++ styles/figma/dark.json | 637 ++++++++++++++++++++ styles/figma/light.json | 637 ++++++++++++++++++++ 4 files changed, 2528 insertions(+) create mode 100644 styles/buildFigmaTokens.ts create mode 100644 styles/figma/core.json create mode 100644 styles/figma/dark.json create mode 100644 styles/figma/light.json diff --git a/styles/buildFigmaTokens.ts b/styles/buildFigmaTokens.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b3285e58e24c7f0fefa67a40c512202fdbe4c5b --- /dev/null +++ b/styles/buildFigmaTokens.ts @@ -0,0 +1,99 @@ +import * as fs from "fs"; +import * as path from "path"; +import dark from "./themes/dark"; +import light from "./themes/light"; +import Theme from "./themes/theme"; +import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; + +// Organize theme tokens +function themeTokens(theme: Theme): Object { + return { + meta: { + themeName: theme.name, + }, + text: theme.textColor, + icon: theme.iconColor, + background: theme.backgroundColor, + border: theme.borderColor, + editor: theme.editor, + syntax: { + primary: { + value: theme.syntax.primary.color.value, + type: "color", + }, + comment: { + value: theme.syntax.comment.color.value, + type: "color", + }, + keyword: { + value: theme.syntax.keyword.color.value, + type: "color", + }, + function: { + value: theme.syntax.function.color.value, + type: "color", + }, + type: { + value: theme.syntax.type.color.value, + type: "color", + }, + variant: { + value: theme.syntax.variant.color.value, + type: "color", + }, + property: { + value: theme.syntax.property.color.value, + type: "color", + }, + enum: { + value: theme.syntax.enum.color.value, + type: "color", + }, + operator: { + value: theme.syntax.operator.color.value, + type: "color", + }, + string: { + value: theme.syntax.string.color.value, + type: "color", + }, + number: { + value: theme.syntax.number.color.value, + type: "color", + }, + boolean: { + value: theme.syntax.boolean.color.value, + type: "color", + }, + }, + player: theme.player, + shadowAlpha: theme.shadowAlpha, + }; +} + +let themes = [themeTokens(dark), themeTokens(light)]; + +// Create {theme}.json +const themePath = path.resolve(`${__dirname}/figma`); +themes.forEach((theme) => { + const tokenJSON = JSON.stringify(theme, null, 2); + //@ts-ignore //TODO: IDK what the hell TS wants me to do here + fs.writeFileSync(`${themePath}/${theme.meta.themeName}.json`, tokenJSON); +}); + +// Organize core tokens +const coreTokens = { + color: { + ...colors, + }, + text: { + family: fontFamilies, + weight: fontWeights, + }, + size: fontSizes, +}; + +// Create core.json +const corePath = path.resolve(`${__dirname}/figma/core.json`); +const coreTokenJSON = JSON.stringify(coreTokens, null, 2); +fs.writeFileSync(corePath, coreTokenJSON); diff --git a/styles/figma/core.json b/styles/figma/core.json new file mode 100644 index 0000000000000000000000000000000000000000..77dabe6b4e4462acc636427c388d161bb3c54a33 --- /dev/null +++ b/styles/figma/core.json @@ -0,0 +1,1155 @@ +{ + "color": { + "neutral": { + "0": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "25": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "50": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "75": { + "value": "#eaeaea", + "step": 75, + "type": "color" + }, + "100": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "125": { + "value": "#dcdcdc", + "step": 125, + "type": "color" + }, + "150": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "175": { + "value": "#cdcdcd", + "step": 175, + "type": "color" + }, + "200": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "225": { + "value": "#bfbfbf", + "step": 225, + "type": "color" + }, + "250": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "275": { + "value": "#b1b1b1", + "step": 275, + "type": "color" + }, + "300": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "325": { + "value": "#a3a3a3", + "step": 325, + "type": "color" + }, + "350": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "375": { + "value": "#959595", + "step": 375, + "type": "color" + }, + "400": { + "value": "#8e8e8e", + "step": 400, + "type": "color" + }, + "425": { + "value": "#878787", + "step": 425, + "type": "color" + }, + "450": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "475": { + "value": "#787878", + "step": 475, + "type": "color" + }, + "500": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "525": { + "value": "#6a6a6a", + "step": 525, + "type": "color" + }, + "550": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "575": { + "value": "#5c5c5c", + "step": 575, + "type": "color" + }, + "600": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "625": { + "value": "#4e4e4e", + "step": 625, + "type": "color" + }, + "650": { + "value": "#474747", + "step": 650, + "type": "color" + }, + "675": { + "value": "#404040", + "step": 675, + "type": "color" + }, + "700": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "725": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "750": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "775": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "800": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "825": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "850": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "875": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "900": { + "value": "#000000", + "step": 900, + "type": "color" + } + }, + "rose": { + "0": { + "value": "#feecef", + "step": 0, + "type": "color" + }, + "100": { + "value": "#f13455", + "step": 100, + "type": "color" + }, + "200": { + "value": "#eb2245", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e7183b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#da193a", + "step": 400, + "type": "color" + }, + "500": { + "value": "#d01939", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c81a37", + "step": 600, + "type": "color" + }, + "700": { + "value": "#c01a36", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ba1a36", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b41a35", + "step": 900, + "type": "color" + } + }, + "red": { + "0": { + "value": "#feecec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e72727", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e31c1c", + "step": 300, + "type": "color" + }, + "400": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "500": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c51c1c", + "step": 600, + "type": "color" + }, + "700": { + "value": "#be1c1c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b81c1c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21c1c", + "step": 900, + "type": "color" + } + }, + "orange": { + "0": { + "value": "#fef3ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e5660f", + "step": 200, + "type": "color" + }, + "300": { + "value": "#d66211", + "step": 300, + "type": "color" + }, + "400": { + "value": "#cc5f13", + "step": 400, + "type": "color" + }, + "500": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "600": { + "value": "#bc5a15", + "step": 600, + "type": "color" + }, + "700": { + "value": "#b65816", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b15617", + "step": 800, + "type": "color" + }, + "900": { + "value": "#ac5517", + "step": 900, + "type": "color" + } + }, + "amber": { + "0": { + "value": "#fef7ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#eb980d", + "step": 100, + "type": "color" + }, + "200": { + "value": "#d88e10", + "step": 200, + "type": "color" + }, + "300": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c38214", + "step": 400, + "type": "color" + }, + "500": { + "value": "#bb7e15", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b57a16", + "step": 600, + "type": "color" + }, + "700": { + "value": "#b07717", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ab7517", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a77218", + "step": 900, + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#fef9ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "200": { + "value": "#cfa00f", + "step": 200, + "type": "color" + }, + "300": { + "value": "#c49811", + "step": 300, + "type": "color" + }, + "400": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b68e14", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b08a15", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ac8615", + "step": 700, + "type": "color" + }, + "800": { + "value": "#a88316", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a48117", + "step": 900, + "type": "color" + } + }, + "lime": { + "0": { + "value": "#f7feec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "200": { + "value": "#7aba18", + "step": 200, + "type": "color" + }, + "300": { + "value": "#76b318", + "step": 300, + "type": "color" + }, + "400": { + "value": "#72ad19", + "step": 400, + "type": "color" + }, + "500": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "600": { + "value": "#6ea519", + "step": 600, + "type": "color" + }, + "700": { + "value": "#6ca219", + "step": 700, + "type": "color" + }, + "800": { + "value": "#6a9f1a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#699c1a", + "step": 900, + "type": "color" + } + }, + "green": { + "0": { + "value": "#ecfef2", + "step": 0, + "type": "color" + }, + "100": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "200": { + "value": "#20b557", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1faf54", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1faa52", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1da04d", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1d9d4c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d9b4b", + "step": 900, + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ecfef8", + "step": 0, + "type": "color" + }, + "100": { + "value": "#11b47e", + "step": 100, + "type": "color" + }, + "200": { + "value": "#13ac79", + "step": 200, + "type": "color" + }, + "300": { + "value": "#14a776", + "step": 300, + "type": "color" + }, + "400": { + "value": "#15a374", + "step": 400, + "type": "color" + }, + "500": { + "value": "#16a072", + "step": 500, + "type": "color" + }, + "600": { + "value": "#169d70", + "step": 600, + "type": "color" + }, + "700": { + "value": "#179b6f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#17996e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#18976c", + "step": 900, + "type": "color" + } + }, + "teal": { + "0": { + "value": "#ecfefc", + "step": 0, + "type": "color" + }, + "100": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#16ab9b", + "step": 200, + "type": "color" + }, + "300": { + "value": "#17a696", + "step": 300, + "type": "color" + }, + "400": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "500": { + "value": "#189f90", + "step": 500, + "type": "color" + }, + "600": { + "value": "#189d8e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#189a8c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#19988a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#199788", + "step": 900, + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ecfcfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#09b5cc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#0daabf", + "step": 200, + "type": "color" + }, + "300": { + "value": "#0fa3b7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#119eb1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1299ac", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1396a8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1493a4", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1590a1", + "step": 800, + "type": "color" + }, + "900": { + "value": "#168e9e", + "step": 900, + "type": "color" + } + }, + "sky": { + "0": { + "value": "#ecf8fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#109fdf", + "step": 100, + "type": "color" + }, + "200": { + "value": "#1394cf", + "step": 200, + "type": "color" + }, + "300": { + "value": "#148dc4", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1588bc", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1780b0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#177dac", + "step": 700, + "type": "color" + }, + "800": { + "value": "#187ba8", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1878a4", + "step": 900, + "type": "color" + } + }, + "blue": { + "0": { + "value": "#ecf3fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#1f6eed", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1666e7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#1762db", + "step": 400, + "type": "color" + }, + "500": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1959c0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1957ba", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1a55b4", + "step": 900, + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#ececfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "200": { + "value": "#3d41e9", + "step": 200, + "type": "color" + }, + "300": { + "value": "#2e32e5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#2327e2", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1e22d1", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1e21c9", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1e21c1", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d20bb", + "step": 900, + "type": "color" + } + }, + "violet": { + "0": { + "value": "#f1ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#804ef3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#6e37ee", + "step": 200, + "type": "color" + }, + "300": { + "value": "#6329e9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#5a1ee6", + "step": 400, + "type": "color" + }, + "500": { + "value": "#551bde", + "step": 500, + "type": "color" + }, + "600": { + "value": "#531bd4", + "step": 600, + "type": "color" + }, + "700": { + "value": "#501bcb", + "step": 700, + "type": "color" + }, + "800": { + "value": "#4e1bc3", + "step": 800, + "type": "color" + }, + "900": { + "value": "#4c1bbc", + "step": 900, + "type": "color" + } + }, + "purple": { + "0": { + "value": "#f5ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#9332ee", + "step": 200, + "type": "color" + }, + "300": { + "value": "#8a24ea", + "step": 300, + "type": "color" + }, + "400": { + "value": "#831ae7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "600": { + "value": "#781ad2", + "step": 600, + "type": "color" + }, + "700": { + "value": "#741ac9", + "step": 700, + "type": "color" + }, + "800": { + "value": "#701bc2", + "step": 800, + "type": "color" + }, + "900": { + "value": "#6d1bbb", + "step": 900, + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#fdecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d63be2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#d12ade", + "step": 200, + "type": "color" + }, + "300": { + "value": "#ca23d6", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c122cc", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b921c4", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b320bd", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ad20b7", + "step": 700, + "type": "color" + }, + "800": { + "value": "#a81fb2", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a41ead", + "step": 900, + "type": "color" + } + }, + "pink": { + "0": { + "value": "#feecf5", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "200": { + "value": "#e42a87", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e11e7f", + "step": 300, + "type": "color" + }, + "400": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "500": { + "value": "#cc1e75", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c41e71", + "step": 600, + "type": "color" + }, + "700": { + "value": "#bd1d6d", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b71d6a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21d67", + "step": 900, + "type": "color" + } + } + }, + "text": { + "family": { + "sans": { + "value": "Zed Sans", + "type": "fontFamily" + }, + "mono": { + "value": "Zed Mono", + "type": "fontFamily" + } + }, + "weight": { + "thin": { + "value": "thin", + "type": "fontWeight" + }, + "extra_light": { + "value": "extra_light", + "type": "fontWeight" + }, + "light": { + "value": "light", + "type": "fontWeight" + }, + "normal": { + "value": "normal", + "type": "fontWeight" + }, + "medium": { + "value": "medium", + "type": "fontWeight" + }, + "semibold": { + "value": "semibold", + "type": "fontWeight" + }, + "bold": { + "value": "bold", + "type": "fontWeight" + }, + "extra_bold": { + "value": "extra_bold", + "type": "fontWeight" + }, + "black": { + "value": "black", + "type": "fontWeight" + } + } + }, + "size": { + "3xs": { + "value": 8, + "type": "fontSize" + }, + "2xs": { + "value": 10, + "type": "fontSize" + }, + "xs": { + "value": 12, + "type": "fontSize" + }, + "sm": { + "value": 14, + "type": "fontSize" + }, + "md": { + "value": 16, + "type": "fontSize" + }, + "lg": { + "value": 18, + "type": "fontSize" + }, + "xl": { + "value": 20, + "type": "fontSize" + } + } +} \ No newline at end of file diff --git a/styles/figma/dark.json b/styles/figma/dark.json new file mode 100644 index 0000000000000000000000000000000000000000..fadaf7c19e3459fb3b20cd9af5fc930a2231f010 --- /dev/null +++ b/styles/figma/dark.json @@ -0,0 +1,637 @@ +{ + "meta": { + "themeName": "dark" + }, + "text": { + "primary": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "placeholder": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "warning": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#1684b6", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#c38214", + "step": 400, + "type": "color" + }, + "info": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "hovered": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "active": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "focused": { + "value": "#404040", + "step": 675, + "type": "color" + } + }, + "300": { + "base": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "hovered": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "active": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "focused": { + "value": "#323232", + "step": 725, + "type": "color" + } + }, + "500": { + "base": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "focused": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "hovered": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "active": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "focused": { + "value": "#1ea34f", + "step": 600, + "type": "color" + } + }, + "error": { + "base": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "hovered": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "active": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "focused": { + "value": "#d71c1c", + "step": 400, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "hovered": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "active": { + "value": "#cc8712", + "step": 300, + "type": "color" + }, + "focused": { + "value": "#cc8712", + "step": 300, + "type": "color" + } + }, + "info": { + "base": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "hovered": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "active": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "focused": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "secondary": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "muted": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "ok": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#bb7e15", + "step": 500, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "indent_guide": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "indent_guide_active": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "line": { + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "highlighted": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "inserted": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "deleted": { + "value": "#d71c1c", + "step": 400, + "type": "color" + }, + "modified": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "activeOccurrence": { + "value": "#2327e2", + "step": 400, + "type": "color" + }, + "matchingBracket": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "match": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "activeMatch": { + "value": "#72ad19", + "step": 400, + "type": "color" + }, + "related": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#f1f1f1", + "type": "color" + }, + "comment": { + "value": "#7aba18", + "type": "color" + }, + "keyword": { + "value": "#1588bc", + "type": "color" + }, + "function": { + "value": "#cfa00f", + "type": "color" + }, + "type": { + "value": "#17a696", + "type": "color" + }, + "variant": { + "value": "#17a696", + "type": "color" + }, + "property": { + "value": "#148dc4", + "type": "color" + }, + "enum": { + "value": "#1588bc", + "type": "color" + }, + "operator": { + "value": "#1588bc", + "type": "color" + }, + "string": { + "value": "#d66211", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "selectionColor": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#70a919", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#17a293", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.32, + "type": "number" + } +} \ No newline at end of file diff --git a/styles/figma/light.json b/styles/figma/light.json new file mode 100644 index 0000000000000000000000000000000000000000..415ab40933c5be2c343b8174c95c9e9917e76675 --- /dev/null +++ b/styles/figma/light.json @@ -0,0 +1,637 @@ +{ + "meta": { + "themeName": "light" + }, + "text": { + "primary": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "secondary": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "muted": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "placeholder": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#1ea650", + "step": 500, + "type": "color" + }, + "error": { + "value": "#cd1c1c", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#b68e14", + "step": 500, + "type": "color" + }, + "info": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "secondary": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#1780b0", + "step": 600, + "type": "color" + }, + "ok": { + "value": "#1ea34f", + "step": 600, + "type": "color" + }, + "error": { + "value": "#c51c1c", + "step": 600, + "type": "color" + }, + "warning": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "info": { + "value": "#195cc8", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "active": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "focused": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + } + }, + "300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "500": { + "base": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "hovered": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "active": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#21bf5b", + "step": 100, + "type": "color" + } + }, + "error": { + "base": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "active": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#ec3939", + "step": 100, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "active": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + } + }, + "info": { + "base": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#307af3", + "step": 100, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "muted": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "ok": { + "value": "#20b557", + "step": 200, + "type": "color" + }, + "error": { + "value": "#e72727", + "step": 200, + "type": "color" + }, + "warning": { + "value": "#cfa00f", + "step": 200, + "type": "color" + }, + "info": { + "value": "#1f6eed", + "step": 200, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "indent_guide": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "indent_guide_active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "line": { + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "highlighted": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "inserted": { + "value": "#21bf5b", + "step": 100, + "type": "color" + }, + "deleted": { + "value": "#ec3939", + "step": 100, + "type": "color" + }, + "modified": { + "value": "#307af3", + "step": 100, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "activeOccurrence": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "matchingBracket": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "match": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "activeMatch": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "related": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#2b2b2b", + "type": "color" + }, + "comment": { + "value": "#7aba18", + "type": "color" + }, + "keyword": { + "value": "#1588bc", + "type": "color" + }, + "function": { + "value": "#cfa00f", + "type": "color" + }, + "type": { + "value": "#17a696", + "type": "color" + }, + "variant": { + "value": "#17a696", + "type": "color" + }, + "property": { + "value": "#148dc4", + "type": "color" + }, + "enum": { + "value": "#1588bc", + "type": "color" + }, + "operator": { + "value": "#1588bc", + "type": "color" + }, + "string": { + "value": "#d66211", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#195cc8", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#185fd0", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#307af3", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#185fd0", + "step": 500, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#70a919", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#80c517", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#70a919", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#5558ee", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#1e22db", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#f66e0f", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#c45c14", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#a048f4", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#7d19dc", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#17a293", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#15b3a2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#17a293", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e93d92", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#d51e79", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#e0ac0b", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#bc9212", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.12, + "type": "number" + } +} \ No newline at end of file From 90df8a31e77c02e81bc55f45ba676a65e4c42f02 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 13:37:47 -0400 Subject: [PATCH 058/245] Fix incorrect ramp preset values in `color.ts` - Regenerate themes and tokens as well --- crates/zed/assets/themes/dark.json | 94 +++++----- crates/zed/assets/themes/light.json | 88 ++++----- styles/figma/core.json | 272 ++++++++++++++-------------- styles/figma/dark.json | 158 ++++++++-------- styles/figma/light.json | 150 +++++++-------- styles/utils/color.ts | 4 +- 6 files changed, 383 insertions(+), 383 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 25568bf17c9dafaf92beb11be5e4514377f57e76..da7fa4650ee609d46ce2eacf5dcf8eb4a3f8088c 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1684b6", + "color": "#2db4f3", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1684b6", + "color": "#2db4f3", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#c38214", - "icon_dirty": "#195cc8", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#c38214", - "icon_dirty": "#195cc8", + "icon_conflict": "#f7b241", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 13 } }, @@ -329,11 +329,11 @@ "background": "#000000", "active_line_background": "#0e0e0e", "code_actions_indicator": "#9c9c9c", - "diff_background_deleted": "#d71c1c", - "diff_background_inserted": "#1ea34f", - "document_highlight_read_background": "#1e22db", - "document_highlight_write_background": "#1e22db", - "error_color": "#d71c1c", + "diff_background_deleted": "#f78c8c", + "diff_background_inserted": "#22c55e", + "document_highlight_read_background": "#777af4", + "document_highlight_write_background": "#777af4", + "error_color": "#f78c8c", "gutter_background": "#000000", "gutter_padding_factor": 2.5, "highlighted_line_background": "#070707", @@ -342,37 +342,37 @@ "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "guest_selections": [ { - "cursor": "#70a919", - "selection": "#80c517" + "cursor": "#87d116", + "selection": "#dbf9ac" }, { - "cursor": "#1e22db", - "selection": "#5558ee" + "cursor": "#777af4", + "selection": "#d4d5fd" }, { - "cursor": "#c45c14", - "selection": "#f66e0f" + "cursor": "#f98a3d", + "selection": "#fde0cd" }, { - "cursor": "#7d19dc", - "selection": "#a048f4" + "cursor": "#b671f8", + "selection": "#e9d4fd" }, { - "cursor": "#17a293", - "selection": "#15b3a2" + "cursor": "#16ddc7", + "selection": "#b4faf2" }, { - "cursor": "#d51e79", - "selection": "#e93d92" + "cursor": "#f58ac0", + "selection": "#fcd4e8" }, { - "cursor": "#bc9212", - "selection": "#e0ac0b" + "cursor": "#f6bc09", + "selection": "#fceabc" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#1588bc", + "color": "#59c3f5", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#d71c1c", + "color": "#f78c8c", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#d71c1c", + "color": "#f78c8c", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#cc8712", + "color": "#f8c570", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -929,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "border": { "color": "#151515", @@ -1067,7 +1067,7 @@ } }, "search": { - "match_background": "#70a919", + "match_background": "#87d116", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1123,8 +1123,8 @@ "size": 16 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1177,8 +1177,8 @@ "size": 16 }, "selection": { - "cursor": "#195cc8", - "selection": "#307af3" + "cursor": "#4287f6", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1186,7 +1186,7 @@ "size": 16 }, "border": { - "color": "#cd1c1c", + "color": "#f47171", "width": 1 }, "margin": { diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 76fe01501d181cdcbdea018c21357a2c65a728ab..dcff3352f75703a64030db29cde7797dd038c432 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#f1f1f1", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#bc9212", - "icon_dirty": "#195cc8", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#bc9212", - "icon_dirty": "#195cc8", + "icon_conflict": "#f6bc09", + "icon_dirty": "#4287f6", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 13 } }, @@ -329,11 +329,11 @@ "background": "#ffffff", "active_line_background": "#e3e3e3", "code_actions_indicator": "#717171", - "diff_background_deleted": "#ec3939", - "diff_background_inserted": "#21bf5b", + "diff_background_deleted": "#fdd4d4", + "diff_background_inserted": "#befad2", "document_highlight_read_background": "#e3e3e3", "document_highlight_write_background": "#e3e3e3", - "error_color": "#cd1c1c", + "error_color": "#f47171", "gutter_background": "#ffffff", "gutter_padding_factor": 2.5, "highlighted_line_background": "#e3e3e3", @@ -342,37 +342,37 @@ "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "guest_selections": [ { - "cursor": "#70a919", - "selection": "#80c517" + "cursor": "#87d116", + "selection": "#dbf9ac" }, { - "cursor": "#1e22db", - "selection": "#5558ee" + "cursor": "#777af4", + "selection": "#d4d5fd" }, { - "cursor": "#c45c14", - "selection": "#f66e0f" + "cursor": "#f98a3d", + "selection": "#fde0cd" }, { - "cursor": "#7d19dc", - "selection": "#a048f4" + "cursor": "#b671f8", + "selection": "#e9d4fd" }, { - "cursor": "#17a293", - "selection": "#15b3a2" + "cursor": "#16ddc7", + "selection": "#b4faf2" }, { - "cursor": "#d51e79", - "selection": "#e93d92" + "cursor": "#f58ac0", + "selection": "#fcd4e8" }, { - "cursor": "#bc9212", - "selection": "#e0ac0b" + "cursor": "#f6bc09", + "selection": "#fceabc" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#1588bc", + "color": "#59c3f5", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#cd1c1c", + "color": "#f47171", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#cd1c1c", + "color": "#f47171", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#b68e14", + "color": "#e5af09", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#185fd0", + "color": "#6099f7", "size": 14, "weight": "bold" } @@ -929,8 +929,8 @@ "size": 14 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "border": { "color": "#e3e3e3", @@ -1123,8 +1123,8 @@ "size": 16 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1177,8 +1177,8 @@ "size": 16 }, "selection": { - "cursor": "#185fd0", - "selection": "#307af3" + "cursor": "#6099f7", + "selection": "#d0e2fd" }, "text": { "family": "Zed Mono", @@ -1186,7 +1186,7 @@ "size": 16 }, "border": { - "color": "#e72727", + "color": "#fbbdbd", "width": 1 }, "margin": { diff --git a/styles/figma/core.json b/styles/figma/core.json index 77dabe6b4e4462acc636427c388d161bb3c54a33..b3e13f1c7a9f4e048bf7065278ebc1527c4a11cc 100644 --- a/styles/figma/core.json +++ b/styles/figma/core.json @@ -194,42 +194,42 @@ "type": "color" }, "100": { - "value": "#f13455", + "value": "#fdd5db", "step": 100, "type": "color" }, "200": { - "value": "#eb2245", + "value": "#fbbdc8", "step": 200, "type": "color" }, "300": { - "value": "#e7183b", + "value": "#faa4b3", "step": 300, "type": "color" }, "400": { - "value": "#da193a", + "value": "#f98a9d", "step": 400, "type": "color" }, "500": { - "value": "#d01939", + "value": "#f76e86", "step": 500, "type": "color" }, "600": { - "value": "#c81a37", + "value": "#f54c69", "step": 600, "type": "color" }, "700": { - "value": "#c01a36", + "value": "#ec2548", "step": 700, "type": "color" }, "800": { - "value": "#ba1a36", + "value": "#d21939", "step": 800, "type": "color" }, @@ -246,42 +246,42 @@ "type": "color" }, "100": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "200": { - "value": "#e72727", + "value": "#fbbdbd", "step": 200, "type": "color" }, "300": { - "value": "#e31c1c", + "value": "#f9a5a5", "step": 300, "type": "color" }, "400": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "500": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "600": { - "value": "#c51c1c", + "value": "#f15252", "step": 600, "type": "color" }, "700": { - "value": "#be1c1c", + "value": "#e82c2c", "step": 700, "type": "color" }, "800": { - "value": "#b81c1c", + "value": "#d11c1c", "step": 800, "type": "color" }, @@ -298,42 +298,42 @@ "type": "color" }, "100": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "200": { - "value": "#e5660f", + "value": "#fbccac", "step": 200, "type": "color" }, "300": { - "value": "#d66211", + "value": "#fab78b", "step": 300, "type": "color" }, "400": { - "value": "#cc5f13", + "value": "#faa266", "step": 400, "type": "color" }, "500": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "600": { - "value": "#bc5a15", + "value": "#f77113", "step": 600, "type": "color" }, "700": { - "value": "#b65816", + "value": "#e0650f", "step": 700, "type": "color" }, "800": { - "value": "#b15617", + "value": "#c65d14", "step": 800, "type": "color" }, @@ -350,42 +350,42 @@ "type": "color" }, "100": { - "value": "#eb980d", + "value": "#fce7c4", "step": 100, "type": "color" }, "200": { - "value": "#d88e10", + "value": "#fad69d", "step": 200, "type": "color" }, "300": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "400": { - "value": "#c38214", + "value": "#f7b241", "step": 400, "type": "color" }, "500": { - "value": "#bb7e15", + "value": "#f59f0c", "step": 500, "type": "color" }, "600": { - "value": "#b57a16", + "value": "#e1930e", "step": 600, "type": "color" }, "700": { - "value": "#b07717", + "value": "#cd8812", "step": 700, "type": "color" }, "800": { - "value": "#ab7517", + "value": "#ba7d15", "step": 800, "type": "color" }, @@ -402,42 +402,42 @@ "type": "color" }, "100": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "200": { - "value": "#cfa00f", + "value": "#fadc89", "step": 200, "type": "color" }, "300": { - "value": "#c49811", + "value": "#f8cc4e", "step": 300, "type": "color" }, "400": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "500": { - "value": "#b68e14", + "value": "#e5af09", "step": 500, "type": "color" }, "600": { - "value": "#b08a15", + "value": "#d4a30d", "step": 600, "type": "color" }, "700": { - "value": "#ac8615", + "value": "#c49811", "step": 700, "type": "color" }, "800": { - "value": "#a88316", + "value": "#b48d14", "step": 800, "type": "color" }, @@ -454,42 +454,42 @@ "type": "color" }, "100": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "200": { - "value": "#7aba18", + "value": "#bdf36b", "step": 200, "type": "color" }, "300": { - "value": "#76b318", + "value": "#9feb2b", "step": 300, "type": "color" }, "400": { - "value": "#72ad19", + "value": "#90df17", "step": 400, "type": "color" }, "500": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "600": { - "value": "#6ea519", + "value": "#7fc417", "step": 600, "type": "color" }, "700": { - "value": "#6ca219", + "value": "#78b618", "step": 700, "type": "color" }, "800": { - "value": "#6a9f1a", + "value": "#70aa19", "step": 800, "type": "color" }, @@ -506,42 +506,42 @@ "type": "color" }, "100": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "200": { - "value": "#20b557", + "value": "#8ff4b2", "step": 200, "type": "color" }, "300": { - "value": "#1faf54", + "value": "#60ec92", "step": 300, "type": "color" }, "400": { - "value": "#1faa52", + "value": "#34e173", "step": 400, "type": "color" }, "500": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "600": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "700": { - "value": "#1da04d", + "value": "#20b658", "step": 700, "type": "color" }, "800": { - "value": "#1d9d4c", + "value": "#1ea851", "step": 800, "type": "color" }, @@ -558,42 +558,42 @@ "type": "color" }, "100": { - "value": "#11b47e", + "value": "#b3fbe3", "step": 100, "type": "color" }, "200": { - "value": "#13ac79", + "value": "#72f6ca", "step": 200, "type": "color" }, "300": { - "value": "#14a776", + "value": "#1feda9", "step": 300, "type": "color" }, "400": { - "value": "#15a374", + "value": "#12e09b", "step": 400, "type": "color" }, "500": { - "value": "#16a072", + "value": "#11d091", "step": 500, "type": "color" }, "600": { - "value": "#169d70", + "value": "#11c287", "step": 600, "type": "color" }, "700": { - "value": "#179b6f", + "value": "#11b37e", "step": 700, "type": "color" }, "800": { - "value": "#17996e", + "value": "#15a575", "step": 800, "type": "color" }, @@ -610,42 +610,42 @@ "type": "color" }, "100": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "200": { - "value": "#16ab9b", + "value": "#73f4e6", "step": 200, "type": "color" }, "300": { - "value": "#17a696", + "value": "#26ebd5", "step": 300, "type": "color" }, "400": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "500": { - "value": "#189f90", + "value": "#15cfba", "step": 500, "type": "color" }, "600": { - "value": "#189d8e", + "value": "#15c1ae", "step": 600, "type": "color" }, "700": { - "value": "#189a8c", + "value": "#15b2a1", "step": 700, "type": "color" }, "800": { - "value": "#19988a", + "value": "#17a495", "step": 800, "type": "color" }, @@ -662,42 +662,42 @@ "type": "color" }, "100": { - "value": "#09b5cc", + "value": "#bcf5fc", "step": 100, "type": "color" }, "200": { - "value": "#0daabf", + "value": "#86edfa", "step": 200, "type": "color" }, "300": { - "value": "#0fa3b7", + "value": "#41e3f8", "step": 300, "type": "color" }, "400": { - "value": "#119eb1", + "value": "#07d5f1", "step": 400, "type": "color" }, "500": { - "value": "#1299ac", + "value": "#07c7e1", "step": 500, "type": "color" }, "600": { - "value": "#1396a8", + "value": "#07b8d0", "step": 600, "type": "color" }, "700": { - "value": "#1493a4", + "value": "#0daabf", "step": 700, "type": "color" }, "800": { - "value": "#1590a1", + "value": "#119bae", "step": 800, "type": "color" }, @@ -714,42 +714,42 @@ "type": "color" }, "100": { - "value": "#109fdf", + "value": "#caecfc", "step": 100, "type": "color" }, "200": { - "value": "#1394cf", + "value": "#a6defa", "step": 200, "type": "color" }, "300": { - "value": "#148dc4", + "value": "#81d2f8", "step": 300, "type": "color" }, "400": { - "value": "#1588bc", + "value": "#59c3f5", "step": 400, "type": "color" }, "500": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "600": { - "value": "#1780b0", + "value": "#0ea5e8", "step": 600, "type": "color" }, "700": { - "value": "#177dac", + "value": "#1296d1", "step": 700, "type": "color" }, "800": { - "value": "#187ba8", + "value": "#1686ba", "step": 800, "type": "color" }, @@ -766,42 +766,42 @@ "type": "color" }, "100": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "200": { - "value": "#1f6eed", + "value": "#b4cffb", "step": 200, "type": "color" }, "300": { - "value": "#1666e7", + "value": "#99befa", "step": 300, "type": "color" }, "400": { - "value": "#1762db", + "value": "#7cacf9", "step": 400, "type": "color" }, "500": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "600": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "700": { - "value": "#1959c0", + "value": "#2774f0", "step": 700, "type": "color" }, "800": { - "value": "#1957ba", + "value": "#1762db", "step": 800, "type": "color" }, @@ -818,42 +818,42 @@ "type": "color" }, "100": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "200": { - "value": "#3d41e9", + "value": "#bebefb", "step": 200, "type": "color" }, "300": { - "value": "#2e32e5", + "value": "#a7a8f9", "step": 300, "type": "color" }, "400": { - "value": "#2327e2", + "value": "#8f90f6", "step": 400, "type": "color" }, "500": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "600": { - "value": "#1e22d1", + "value": "#5f62f0", "step": 600, "type": "color" }, "700": { - "value": "#1e21c9", + "value": "#464aeb", "step": 700, "type": "color" }, "800": { - "value": "#1e21c1", + "value": "#292de4", "step": 800, "type": "color" }, @@ -870,42 +870,42 @@ "type": "color" }, "100": { - "value": "#804ef3", + "value": "#e0d5fd", "step": 100, "type": "color" }, "200": { - "value": "#6e37ee", + "value": "#cfbcfb", "step": 200, "type": "color" }, "300": { - "value": "#6329e9", + "value": "#bda4fa", "step": 300, "type": "color" }, "400": { - "value": "#5a1ee6", + "value": "#ad8cf9", "step": 400, "type": "color" }, "500": { - "value": "#551bde", + "value": "#9b73f7", "step": 500, "type": "color" }, "600": { - "value": "#531bd4", + "value": "#8959f6", "step": 600, "type": "color" }, "700": { - "value": "#501bcb", + "value": "#7540f0", "step": 700, "type": "color" }, "800": { - "value": "#4e1bc3", + "value": "#5e22e7", "step": 800, "type": "color" }, @@ -922,42 +922,42 @@ "type": "color" }, "100": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "200": { - "value": "#9332ee", + "value": "#dcbcfc", "step": 200, "type": "color" }, "300": { - "value": "#8a24ea", + "value": "#d0a4fa", "step": 300, "type": "color" }, "400": { - "value": "#831ae7", + "value": "#c38bf9", "step": 400, "type": "color" }, "500": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "600": { - "value": "#781ad2", + "value": "#a856f7", "step": 600, "type": "color" }, "700": { - "value": "#741ac9", + "value": "#9739f1", "step": 700, "type": "color" }, "800": { - "value": "#701bc2", + "value": "#831ae6", "step": 800, "type": "color" }, @@ -974,42 +974,42 @@ "type": "color" }, "100": { - "value": "#d63be2", + "value": "#fad4fc", "step": 100, "type": "color" }, "200": { - "value": "#d12ade", + "value": "#f6bbfa", "step": 200, "type": "color" }, "300": { - "value": "#ca23d6", + "value": "#f1a2f7", "step": 300, "type": "color" }, "400": { - "value": "#c122cc", + "value": "#ec8af3", "step": 400, "type": "color" }, "500": { - "value": "#b921c4", + "value": "#e56fee", "step": 500, "type": "color" }, "600": { - "value": "#b320bd", + "value": "#dd51e7", "step": 600, "type": "color" }, "700": { - "value": "#ad20b7", + "value": "#d32edf", "step": 700, "type": "color" }, "800": { - "value": "#a81fb2", + "value": "#bc21c8", "step": 800, "type": "color" }, @@ -1026,42 +1026,42 @@ "type": "color" }, "100": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "200": { - "value": "#e42a87", + "value": "#fbbcdb", "step": 200, "type": "color" }, "300": { - "value": "#e11e7f", + "value": "#f8a5ce", "step": 300, "type": "color" }, "400": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "500": { - "value": "#cc1e75", + "value": "#f26fb0", "step": 500, "type": "color" }, "600": { - "value": "#c41e71", + "value": "#ee519e", "step": 600, "type": "color" }, "700": { - "value": "#bd1d6d", + "value": "#e52e89", "step": 700, "type": "color" }, "800": { - "value": "#b71d6a", + "value": "#ce1e76", "step": 800, "type": "color" }, diff --git a/styles/figma/dark.json b/styles/figma/dark.json index fadaf7c19e3459fb3b20cd9af5fc930a2231f010..568f53b8154003fb1805de4c2ae420f0f2a94e89 100644 --- a/styles/figma/dark.json +++ b/styles/figma/dark.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "warning": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#1684b6", + "value": "#2db4f3", "step": 500, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#c38214", + "value": "#f7b241", "step": 400, "type": "color" }, "info": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } @@ -175,88 +175,88 @@ }, "ok": { "base": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "hovered": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "active": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "focused": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" } }, "error": { "base": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "hovered": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "active": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "focused": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" } }, "warning": { "base": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "hovered": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "active": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" }, "focused": { - "value": "#cc8712", + "value": "#f8c570", "step": 300, "type": "color" } }, "info": { "base": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "hovered": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "active": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "focused": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#bb7e15", + "value": "#f59f0c", "step": 500, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -337,34 +337,34 @@ "type": "color" }, "inserted": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "deleted": { - "value": "#d71c1c", + "value": "#f78c8c", "step": 400, "type": "color" }, "modified": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } }, "highlight": { "selection": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "occurrence": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "activeOccurrence": { - "value": "#2327e2", + "value": "#8f90f6", "step": 400, "type": "color" }, @@ -374,12 +374,12 @@ "type": "color" }, "match": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "activeMatch": { - "value": "#72ad19", + "value": "#90df17", "step": 400, "type": "color" }, @@ -408,39 +408,39 @@ "type": "color" }, "comment": { - "value": "#7aba18", + "value": "#bdf36b", "type": "color" }, "keyword": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "function": { - "value": "#cfa00f", + "value": "#fadc89", "type": "color" }, "type": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "variant": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "property": { - "value": "#148dc4", + "value": "#81d2f8", "type": "color" }, "enum": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "operator": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "string": { - "value": "#d66211", + "value": "#fab78b", "type": "color" }, "number": { @@ -455,176 +455,176 @@ "player": { "1": { "baseColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "cursorColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "selectionColor": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } }, "2": { "baseColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "cursorColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "selectionColor": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "borderColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "cursorColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "selectionColor": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "cursorColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "selectionColor": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "borderColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "cursorColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "selectionColor": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "cursorColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "selectionColor": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "cursorColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "borderColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "cursorColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "borderColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" } diff --git a/styles/figma/light.json b/styles/figma/light.json index 415ab40933c5be2c343b8174c95c9e9917e76675..c8ef9e5dcd69332fc33abda730f08b7f7190d574 100644 --- a/styles/figma/light.json +++ b/styles/figma/light.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "ok": { - "value": "#1ea650", + "value": "#23d464", "step": 500, "type": "color" }, "error": { - "value": "#cd1c1c", + "value": "#f47171", "step": 500, "type": "color" }, "warning": { - "value": "#b68e14", + "value": "#e5af09", "step": 500, "type": "color" }, "info": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#1780b0", + "value": "#0ea5e8", "step": 600, "type": "color" }, "ok": { - "value": "#1ea34f", + "value": "#22c55e", "step": 600, "type": "color" }, "error": { - "value": "#c51c1c", + "value": "#f15252", "step": 600, "type": "color" }, "warning": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "info": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" } @@ -175,88 +175,88 @@ }, "ok": { "base": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "hovered": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "active": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "focused": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" } }, "error": { "base": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "hovered": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "active": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "focused": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" } }, "warning": { "base": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "hovered": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "active": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "focused": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" } }, "info": { "base": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "hovered": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "active": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "focused": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#20b557", + "value": "#8ff4b2", "step": 200, "type": "color" }, "error": { - "value": "#e72727", + "value": "#fbbdbd", "step": 200, "type": "color" }, "warning": { - "value": "#cfa00f", + "value": "#fadc89", "step": 200, "type": "color" }, "info": { - "value": "#1f6eed", + "value": "#b4cffb", "step": 200, "type": "color" } @@ -337,24 +337,24 @@ "type": "color" }, "inserted": { - "value": "#21bf5b", + "value": "#befad2", "step": 100, "type": "color" }, "deleted": { - "value": "#ec3939", + "value": "#fdd4d4", "step": 100, "type": "color" }, "modified": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" } }, "highlight": { "selection": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, @@ -408,39 +408,39 @@ "type": "color" }, "comment": { - "value": "#7aba18", + "value": "#bdf36b", "type": "color" }, "keyword": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "function": { - "value": "#cfa00f", + "value": "#fadc89", "type": "color" }, "type": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "variant": { - "value": "#17a696", + "value": "#26ebd5", "type": "color" }, "property": { - "value": "#148dc4", + "value": "#81d2f8", "type": "color" }, "enum": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "operator": { - "value": "#1588bc", + "value": "#59c3f5", "type": "color" }, "string": { - "value": "#d66211", + "value": "#fab78b", "type": "color" }, "number": { @@ -455,176 +455,176 @@ "player": { "1": { "baseColor": { - "value": "#195cc8", + "value": "#4287f6", "step": 600, "type": "color" }, "cursorColor": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" }, "selectionColor": { - "value": "#307af3", + "value": "#d0e2fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#185fd0", + "value": "#6099f7", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "cursorColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" }, "selectionColor": { - "value": "#80c517", + "value": "#dbf9ac", "step": 100, "type": "color" }, "borderColor": { - "value": "#70a919", + "value": "#87d116", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "cursorColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" }, "selectionColor": { - "value": "#5558ee", + "value": "#d4d5fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#1e22db", + "value": "#777af4", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "cursorColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" }, "selectionColor": { - "value": "#f66e0f", + "value": "#fde0cd", "step": 100, "type": "color" }, "borderColor": { - "value": "#c45c14", + "value": "#f98a3d", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "cursorColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" }, "selectionColor": { - "value": "#a048f4", + "value": "#e9d4fd", "step": 100, "type": "color" }, "borderColor": { - "value": "#7d19dc", + "value": "#b671f8", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "cursorColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" }, "selectionColor": { - "value": "#15b3a2", + "value": "#b4faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#17a293", + "value": "#16ddc7", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "cursorColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e93d92", + "value": "#fcd4e8", "step": 100, "type": "color" }, "borderColor": { - "value": "#d51e79", + "value": "#f58ac0", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "cursorColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" }, "selectionColor": { - "value": "#e0ac0b", + "value": "#fceabc", "step": 100, "type": "color" }, "borderColor": { - "value": "#bc9212", + "value": "#f6bc09", "step": 400, "type": "color" } diff --git a/styles/utils/color.ts b/styles/utils/color.ts index c7506f696d4cebd54ebc2045be2b7dc9d14f2c7b..156fc5ba41b2bbf0cfc9dd8080db9bf6cd6c320d 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -22,8 +22,8 @@ export function colorRamp( .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") - .gamma(0.2) - // .correctLightness(true) + .gamma(1) + .correctLightness(true) .padding([0, 0.15]); } From a3fc719a526e985d5f5296471751ac94b020f55e Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 15:03:38 -0400 Subject: [PATCH 059/245] Add a combined `tokens.json` for Figma Tokens - Having individual json files for themes and core is useful for copy+pasting while exploring changes - Figma github sync requires a single json file to pull down --- styles/buildFigmaTokens.ts | 42 +- styles/figma/tokens.json | 2431 ++++++++++++++++++++++++++++++++++++ 2 files changed, 2460 insertions(+), 13 deletions(-) create mode 100644 styles/figma/tokens.json diff --git a/styles/buildFigmaTokens.ts b/styles/buildFigmaTokens.ts index 6b3285e58e24c7f0fefa67a40c512202fdbe4c5b..bb77046e85c53007c272ac791e104b9a908fd80d 100644 --- a/styles/buildFigmaTokens.ts +++ b/styles/buildFigmaTokens.ts @@ -5,8 +5,13 @@ import light from "./themes/light"; import Theme from "./themes/theme"; import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; +let themes = [ + dark, + light +]; + // Organize theme tokens -function themeTokens(theme: Theme): Object { +function themeTokens(theme: Theme) { return { meta: { themeName: theme.name, @@ -71,16 +76,6 @@ function themeTokens(theme: Theme): Object { }; } -let themes = [themeTokens(dark), themeTokens(light)]; - -// Create {theme}.json -const themePath = path.resolve(`${__dirname}/figma`); -themes.forEach((theme) => { - const tokenJSON = JSON.stringify(theme, null, 2); - //@ts-ignore //TODO: IDK what the hell TS wants me to do here - fs.writeFileSync(`${themePath}/${theme.meta.themeName}.json`, tokenJSON); -}); - // Organize core tokens const coreTokens = { color: { @@ -93,7 +88,28 @@ const coreTokens = { size: fontSizes, }; +const combinedTokens = { + core: coreTokens, + dark: themeTokens(dark), + light: themeTokens(light) +} + // Create core.json const corePath = path.resolve(`${__dirname}/figma/core.json`); -const coreTokenJSON = JSON.stringify(coreTokens, null, 2); -fs.writeFileSync(corePath, coreTokenJSON); +const coreJSON = JSON.stringify(coreTokens, null, 2); +fs.writeFileSync(corePath, coreJSON); +console.log(`- Core: core.json created`); + +// Create {theme}.json +const themePath = path.resolve(`${__dirname}/figma`); +themes.forEach((theme) => { + const tokenJSON = JSON.stringify(themeTokens(theme), null, 2); + fs.writeFileSync(`${themePath}/${theme.name}.json`, tokenJSON); + console.log(`- Theme: ${theme.name}.json created`); +}); + +// Create combined tokens.json +const combinedPath = path.resolve(`${__dirname}/figma/tokens.json`); +const combinedJSON = JSON.stringify(combinedTokens, null, 2); +fs.writeFileSync(combinedPath, combinedJSON); +console.log(`- Combined: tokens.json created`); \ No newline at end of file diff --git a/styles/figma/tokens.json b/styles/figma/tokens.json new file mode 100644 index 0000000000000000000000000000000000000000..cffc3ed16de7a4dec1fa38fa2026243c81629055 --- /dev/null +++ b/styles/figma/tokens.json @@ -0,0 +1,2431 @@ +{ + "core": { + "color": { + "neutral": { + "0": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "25": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "50": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "75": { + "value": "#eaeaea", + "step": 75, + "type": "color" + }, + "100": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "125": { + "value": "#dcdcdc", + "step": 125, + "type": "color" + }, + "150": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "175": { + "value": "#cdcdcd", + "step": 175, + "type": "color" + }, + "200": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "225": { + "value": "#bfbfbf", + "step": 225, + "type": "color" + }, + "250": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "275": { + "value": "#b1b1b1", + "step": 275, + "type": "color" + }, + "300": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "325": { + "value": "#a3a3a3", + "step": 325, + "type": "color" + }, + "350": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "375": { + "value": "#959595", + "step": 375, + "type": "color" + }, + "400": { + "value": "#8e8e8e", + "step": 400, + "type": "color" + }, + "425": { + "value": "#878787", + "step": 425, + "type": "color" + }, + "450": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "475": { + "value": "#787878", + "step": 475, + "type": "color" + }, + "500": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "525": { + "value": "#6a6a6a", + "step": 525, + "type": "color" + }, + "550": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "575": { + "value": "#5c5c5c", + "step": 575, + "type": "color" + }, + "600": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "625": { + "value": "#4e4e4e", + "step": 625, + "type": "color" + }, + "650": { + "value": "#474747", + "step": 650, + "type": "color" + }, + "675": { + "value": "#404040", + "step": 675, + "type": "color" + }, + "700": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "725": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "750": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "775": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "800": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "825": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "850": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "875": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "900": { + "value": "#000000", + "step": 900, + "type": "color" + } + }, + "rose": { + "0": { + "value": "#feecef", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fdd5db", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbdc8", + "step": 200, + "type": "color" + }, + "300": { + "value": "#faa4b3", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f98a9d", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f76e86", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f54c69", + "step": 600, + "type": "color" + }, + "700": { + "value": "#ec2548", + "step": 700, + "type": "color" + }, + "800": { + "value": "#d21939", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b41a35", + "step": 900, + "type": "color" + } + }, + "red": { + "0": { + "value": "#feecec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbdbd", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f9a5a5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f15252", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e82c2c", + "step": 700, + "type": "color" + }, + "800": { + "value": "#d11c1c", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21c1c", + "step": 900, + "type": "color" + } + }, + "orange": { + "0": { + "value": "#fef3ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbccac", + "step": 200, + "type": "color" + }, + "300": { + "value": "#fab78b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#faa266", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "600": { + "value": "#f77113", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e0650f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#c65d14", + "step": 800, + "type": "color" + }, + "900": { + "value": "#ac5517", + "step": 900, + "type": "color" + } + }, + "amber": { + "0": { + "value": "#fef7ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fce7c4", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fad69d", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f7b241", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f59f0c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#e1930e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#cd8812", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ba7d15", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a77218", + "step": 900, + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#fef9ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fadc89", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8cc4e", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "500": { + "value": "#e5af09", + "step": 500, + "type": "color" + }, + "600": { + "value": "#d4a30d", + "step": 600, + "type": "color" + }, + "700": { + "value": "#c49811", + "step": 700, + "type": "color" + }, + "800": { + "value": "#b48d14", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a48117", + "step": 900, + "type": "color" + } + }, + "lime": { + "0": { + "value": "#f7feec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "200": { + "value": "#bdf36b", + "step": 200, + "type": "color" + }, + "300": { + "value": "#9feb2b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#90df17", + "step": 400, + "type": "color" + }, + "500": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "600": { + "value": "#7fc417", + "step": 600, + "type": "color" + }, + "700": { + "value": "#78b618", + "step": 700, + "type": "color" + }, + "800": { + "value": "#70aa19", + "step": 800, + "type": "color" + }, + "900": { + "value": "#699c1a", + "step": 900, + "type": "color" + } + }, + "green": { + "0": { + "value": "#ecfef2", + "step": 0, + "type": "color" + }, + "100": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#8ff4b2", + "step": 200, + "type": "color" + }, + "300": { + "value": "#60ec92", + "step": 300, + "type": "color" + }, + "400": { + "value": "#34e173", + "step": 400, + "type": "color" + }, + "500": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "600": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#20b658", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1ea851", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d9b4b", + "step": 900, + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ecfef8", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b3fbe3", + "step": 100, + "type": "color" + }, + "200": { + "value": "#72f6ca", + "step": 200, + "type": "color" + }, + "300": { + "value": "#1feda9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#12e09b", + "step": 400, + "type": "color" + }, + "500": { + "value": "#11d091", + "step": 500, + "type": "color" + }, + "600": { + "value": "#11c287", + "step": 600, + "type": "color" + }, + "700": { + "value": "#11b37e", + "step": 700, + "type": "color" + }, + "800": { + "value": "#15a575", + "step": 800, + "type": "color" + }, + "900": { + "value": "#18976c", + "step": 900, + "type": "color" + } + }, + "teal": { + "0": { + "value": "#ecfefc", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#73f4e6", + "step": 200, + "type": "color" + }, + "300": { + "value": "#26ebd5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#15cfba", + "step": 500, + "type": "color" + }, + "600": { + "value": "#15c1ae", + "step": 600, + "type": "color" + }, + "700": { + "value": "#15b2a1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#17a495", + "step": 800, + "type": "color" + }, + "900": { + "value": "#199788", + "step": 900, + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ecfcfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#bcf5fc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#86edfa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#41e3f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#07d5f1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#07c7e1", + "step": 500, + "type": "color" + }, + "600": { + "value": "#07b8d0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#0daabf", + "step": 700, + "type": "color" + }, + "800": { + "value": "#119bae", + "step": 800, + "type": "color" + }, + "900": { + "value": "#168e9e", + "step": 900, + "type": "color" + } + }, + "sky": { + "0": { + "value": "#ecf8fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#caecfc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#a6defa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#81d2f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#59c3f5", + "step": 400, + "type": "color" + }, + "500": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "600": { + "value": "#0ea5e8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1296d1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1686ba", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1878a4", + "step": 900, + "type": "color" + } + }, + "blue": { + "0": { + "value": "#ecf3fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#b4cffb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#99befa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#7cacf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "600": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "700": { + "value": "#2774f0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#1762db", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1a55b4", + "step": 900, + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#ececfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#bebefb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#a7a8f9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#8f90f6", + "step": 400, + "type": "color" + }, + "500": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "600": { + "value": "#5f62f0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#464aeb", + "step": 700, + "type": "color" + }, + "800": { + "value": "#292de4", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1d20bb", + "step": 900, + "type": "color" + } + }, + "violet": { + "0": { + "value": "#f1ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e0d5fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#cfbcfb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#bda4fa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#ad8cf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#9b73f7", + "step": 500, + "type": "color" + }, + "600": { + "value": "#8959f6", + "step": 600, + "type": "color" + }, + "700": { + "value": "#7540f0", + "step": 700, + "type": "color" + }, + "800": { + "value": "#5e22e7", + "step": 800, + "type": "color" + }, + "900": { + "value": "#4c1bbc", + "step": 900, + "type": "color" + } + }, + "purple": { + "0": { + "value": "#f5ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#dcbcfc", + "step": 200, + "type": "color" + }, + "300": { + "value": "#d0a4fa", + "step": 300, + "type": "color" + }, + "400": { + "value": "#c38bf9", + "step": 400, + "type": "color" + }, + "500": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "600": { + "value": "#a856f7", + "step": 600, + "type": "color" + }, + "700": { + "value": "#9739f1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#831ae6", + "step": 800, + "type": "color" + }, + "900": { + "value": "#6d1bbb", + "step": 900, + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#fdecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fad4fc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f6bbfa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f1a2f7", + "step": 300, + "type": "color" + }, + "400": { + "value": "#ec8af3", + "step": 400, + "type": "color" + }, + "500": { + "value": "#e56fee", + "step": 500, + "type": "color" + }, + "600": { + "value": "#dd51e7", + "step": 600, + "type": "color" + }, + "700": { + "value": "#d32edf", + "step": 700, + "type": "color" + }, + "800": { + "value": "#bc21c8", + "step": 800, + "type": "color" + }, + "900": { + "value": "#a41ead", + "step": 900, + "type": "color" + } + }, + "pink": { + "0": { + "value": "#feecf5", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fbbcdb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8a5ce", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f26fb0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#ee519e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#e52e89", + "step": 700, + "type": "color" + }, + "800": { + "value": "#ce1e76", + "step": 800, + "type": "color" + }, + "900": { + "value": "#b21d67", + "step": 900, + "type": "color" + } + } + }, + "text": { + "family": { + "sans": { + "value": "Zed Sans", + "type": "fontFamily" + }, + "mono": { + "value": "Zed Mono", + "type": "fontFamily" + } + }, + "weight": { + "thin": { + "value": "thin", + "type": "fontWeight" + }, + "extra_light": { + "value": "extra_light", + "type": "fontWeight" + }, + "light": { + "value": "light", + "type": "fontWeight" + }, + "normal": { + "value": "normal", + "type": "fontWeight" + }, + "medium": { + "value": "medium", + "type": "fontWeight" + }, + "semibold": { + "value": "semibold", + "type": "fontWeight" + }, + "bold": { + "value": "bold", + "type": "fontWeight" + }, + "extra_bold": { + "value": "extra_bold", + "type": "fontWeight" + }, + "black": { + "value": "black", + "type": "fontWeight" + } + } + }, + "size": { + "3xs": { + "value": 8, + "type": "fontSize" + }, + "2xs": { + "value": 10, + "type": "fontSize" + }, + "xs": { + "value": 12, + "type": "fontSize" + }, + "sm": { + "value": 14, + "type": "fontSize" + }, + "md": { + "value": 16, + "type": "fontSize" + }, + "lg": { + "value": 18, + "type": "fontSize" + }, + "xl": { + "value": 20, + "type": "fontSize" + } + } + }, + "dark": { + "meta": { + "themeName": "dark" + }, + "text": { + "primary": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "placeholder": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "warning": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "feature": { + "value": "#2db4f3", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#f7b241", + "step": 400, + "type": "color" + }, + "info": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "hovered": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "active": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "focused": { + "value": "#404040", + "step": 675, + "type": "color" + } + }, + "300": { + "base": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "hovered": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "active": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "focused": { + "value": "#323232", + "step": 725, + "type": "color" + } + }, + "500": { + "base": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "focused": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "hovered": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "active": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "focused": { + "value": "#22c55e", + "step": 600, + "type": "color" + } + }, + "error": { + "base": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "hovered": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "active": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "focused": { + "value": "#f78c8c", + "step": 400, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "hovered": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "active": { + "value": "#f8c570", + "step": 300, + "type": "color" + }, + "focused": { + "value": "#f8c570", + "step": 300, + "type": "color" + } + }, + "info": { + "base": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "hovered": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "active": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "focused": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "secondary": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "muted": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "ok": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#f59f0c", + "step": 500, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "indent_guide": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "indent_guide_active": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "line": { + "active": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "highlighted": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "inserted": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "deleted": { + "value": "#f78c8c", + "step": 400, + "type": "color" + }, + "modified": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "activeOccurrence": { + "value": "#8f90f6", + "step": 400, + "type": "color" + }, + "matchingBracket": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "match": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "activeMatch": { + "value": "#90df17", + "step": 400, + "type": "color" + }, + "related": { + "value": "#151515", + "step": 825, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#f1f1f1", + "type": "color" + }, + "comment": { + "value": "#bdf36b", + "type": "color" + }, + "keyword": { + "value": "#59c3f5", + "type": "color" + }, + "function": { + "value": "#fadc89", + "type": "color" + }, + "type": { + "value": "#26ebd5", + "type": "color" + }, + "variant": { + "value": "#26ebd5", + "type": "color" + }, + "property": { + "value": "#81d2f8", + "type": "color" + }, + "enum": { + "value": "#59c3f5", + "type": "color" + }, + "operator": { + "value": "#59c3f5", + "type": "color" + }, + "string": { + "value": "#fab78b", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "selectionColor": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#87d116", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#777af4", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.32, + "type": "number" + } + }, + "light": { + "meta": { + "themeName": "light" + }, + "text": { + "primary": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "secondary": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "muted": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "placeholder": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "ok": { + "value": "#23d464", + "step": 500, + "type": "color" + }, + "error": { + "value": "#f47171", + "step": 500, + "type": "color" + }, + "warning": { + "value": "#e5af09", + "step": 500, + "type": "color" + }, + "info": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "icon": { + "primary": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "secondary": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "muted": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "placeholder": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "feature": { + "value": "#0ea5e8", + "step": 600, + "type": "color" + }, + "ok": { + "value": "#22c55e", + "step": 600, + "type": "color" + }, + "error": { + "value": "#f15252", + "step": 600, + "type": "color" + }, + "warning": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "info": { + "value": "#4287f6", + "step": 600, + "type": "color" + } + }, + "background": { + "100": { + "base": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "active": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "focused": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + } + }, + "300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "500": { + "base": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "hovered": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + } + }, + "ok": { + "base": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "active": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#befad2", + "step": 100, + "type": "color" + } + }, + "error": { + "base": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "active": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + } + }, + "warning": { + "base": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "active": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#fceabc", + "step": 100, + "type": "color" + } + }, + "info": { + "base": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "hovered": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "focused": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + } + } + }, + "border": { + "primary": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "secondary": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "muted": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "ok": { + "value": "#8ff4b2", + "step": 200, + "type": "color" + }, + "error": { + "value": "#fbbdbd", + "step": 200, + "type": "color" + }, + "warning": { + "value": "#fadc89", + "step": 200, + "type": "color" + }, + "info": { + "value": "#b4cffb", + "step": 200, + "type": "color" + } + }, + "editor": { + "background": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "indent_guide": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "indent_guide_active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "line": { + "active": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "highlighted": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "inserted": { + "value": "#befad2", + "step": 100, + "type": "color" + }, + "deleted": { + "value": "#fdd4d4", + "step": 100, + "type": "color" + }, + "modified": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + } + }, + "highlight": { + "selection": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "occurrence": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "activeOccurrence": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "matchingBracket": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "match": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "activeMatch": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "related": { + "value": "#ffffff", + "step": 0, + "type": "color" + } + }, + "gutter": { + "primary": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + } + } + }, + "syntax": { + "primary": { + "value": "#2b2b2b", + "type": "color" + }, + "comment": { + "value": "#bdf36b", + "type": "color" + }, + "keyword": { + "value": "#59c3f5", + "type": "color" + }, + "function": { + "value": "#fadc89", + "type": "color" + }, + "type": { + "value": "#26ebd5", + "type": "color" + }, + "variant": { + "value": "#26ebd5", + "type": "color" + }, + "property": { + "value": "#81d2f8", + "type": "color" + }, + "enum": { + "value": "#59c3f5", + "type": "color" + }, + "operator": { + "value": "#59c3f5", + "type": "color" + }, + "string": { + "value": "#fab78b", + "type": "color" + }, + "number": { + "value": "#d5d5d5", + "type": "color" + }, + "boolean": { + "value": "#d5d5d5", + "type": "color" + } + }, + "player": { + "1": { + "baseColor": { + "value": "#4287f6", + "step": 600, + "type": "color" + }, + "cursorColor": { + "value": "#6099f7", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d0e2fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#6099f7", + "step": 500, + "type": "color" + } + }, + "2": { + "baseColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#87d116", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#dbf9ac", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#87d116", + "step": 500, + "type": "color" + } + }, + "3": { + "baseColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#777af4", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#d4d5fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#777af4", + "step": 500, + "type": "color" + } + }, + "4": { + "baseColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#fde0cd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f98a3d", + "step": 500, + "type": "color" + } + }, + "5": { + "baseColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "cursorColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + }, + "selectionColor": { + "value": "#e9d4fd", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#b671f8", + "step": 500, + "type": "color" + } + }, + "6": { + "baseColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#b4faf2", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#16ddc7", + "step": 400, + "type": "color" + } + }, + "7": { + "baseColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fcd4e8", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f58ac0", + "step": 400, + "type": "color" + } + }, + "8": { + "baseColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "cursorColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + }, + "selectionColor": { + "value": "#fceabc", + "step": 100, + "type": "color" + }, + "borderColor": { + "value": "#f6bc09", + "step": 400, + "type": "color" + } + } + }, + "shadowAlpha": { + "value": 0.12, + "type": "number" + } + } +} \ No newline at end of file From 3dc99a874330b0a93afa5f41956b9e687e8a967d Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 3 Apr 2022 21:15:14 -0400 Subject: [PATCH 060/245] Update dark, light themes. --- crates/zed/assets/themes/dark.json | 130 +++++++++++++++---------- crates/zed/assets/themes/light.json | 142 +++++++++++++++++----------- styles/styleTree/editor.ts | 20 +++- styles/styleTree/workspace.ts | 2 +- styles/themes/dark.ts | 48 +++++----- styles/themes/light.ts | 38 ++++---- styles/utils/color.ts | 6 +- 7 files changed, 228 insertions(+), 158 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index da7fa4650ee609d46ce2eacf5dcf8eb4a3f8088c..1334a65727f8d099b5bc363fd0e432ef828808ba 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#1096d3", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#2db4f3", + "color": "#1096d3", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#1c1c1c", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#f6a724", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#000000", "icon_close": "#555555", "icon_close_active": "#ffffff", - "icon_conflict": "#f7b241", - "icon_dirty": "#4287f6", + "icon_conflict": "#f6a724", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 13 } }, @@ -297,7 +297,7 @@ "height": 34, "background": "#000000", "border": { - "color": "#070707", + "color": "#151515", "width": 1, "bottom": true }, @@ -325,54 +325,54 @@ } }, "editor": { - "text_color": "#f1f1f1", + "text_color": "#d5d5d5", "background": "#000000", "active_line_background": "#0e0e0e", "code_actions_indicator": "#9c9c9c", - "diff_background_deleted": "#f78c8c", - "diff_background_inserted": "#22c55e", - "document_highlight_read_background": "#777af4", - "document_highlight_write_background": "#777af4", - "error_color": "#f78c8c", + "diff_background_deleted": "#f15656", + "diff_background_inserted": "#1b9447", + "document_highlight_read_background": "#2b2b2b", + "document_highlight_write_background": "#2b2b2b", + "error_color": "#f15656", "gutter_background": "#000000", - "gutter_padding_factor": 2.5, + "gutter_padding_factor": 3.5, "highlighted_line_background": "#070707", "line_number": "#636363", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "guest_selections": [ { - "cursor": "#87d116", - "selection": "#dbf9ac" + "cursor": "#79ba16", + "selection": "#38530f" }, { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#484bed", + "selection": "#121269" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#ee670a", + "selection": "#5d2f0e" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#993bf3", + "selection": "#3e1169" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#16d6c1", + "selection": "#0e4f48" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#ef59a3", + "selection": "#fbc6e1" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#f7bf17", + "selection": "#fce9b7" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#4f8ff7", "weight": "normal" }, "selected_item": { @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#f15656", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f78c8c", + "color": "#f15656", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f8c570", + "color": "#f7bb57", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -653,7 +653,35 @@ } } }, - "syntax": {} + "syntax": { + "keyword": "#4f8ff7", + "function": "#f9da82", + "string": "#f99d5f", + "type": "#3eeeda", + "number": "#aeef4b", + "comment": "#aaaaaa", + "property": "#4f8ff7", + "variant": "#53c1f5", + "constant": "#d5d5d5", + "title": { + "color": "#de900c", + "weight": "bold" + }, + "emphasis": "#1096d3", + "emphasis_strong": { + "color": "#1096d3", + "weight": "bold" + }, + "link_uri": { + "color": "#79ba16", + "underline": true + }, + "link_text": { + "color": "#ee670a", + "italic": true + }, + "list_marker": "#20b0f2" + } }, "project_diagnostics": { "tab_icon_spacing": 4, @@ -929,8 +957,8 @@ "size": 14 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "border": { "color": "#151515", @@ -1067,7 +1095,7 @@ } }, "search": { - "match_background": "#87d116", + "match_background": "#0a2633", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { @@ -1123,8 +1151,8 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -1177,8 +1205,8 @@ "size": 16 }, "selection": { - "cursor": "#4287f6", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#103063" }, "text": { "family": "Zed Mono", @@ -1186,7 +1214,7 @@ "size": 16 }, "border": { - "color": "#f47171", + "color": "#eb2d2d", "width": 1 }, "margin": { diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index dcff3352f75703a64030db29cde7797dd038c432..283b3b10b32e3886fe15736e8e6d9cbb7091e3a5 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "weight": "bold", "size": 14 }, @@ -70,8 +70,8 @@ "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -111,8 +111,8 @@ "background": "#f1f1f1", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#f7bf17", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -137,8 +137,8 @@ "background": "#ffffff", "icon_close": "#555555", "icon_close_active": "#000000", - "icon_conflict": "#f6bc09", - "icon_dirty": "#4287f6", + "icon_conflict": "#f7bf17", + "icon_dirty": "#135acd", "icon_width": 8, "spacing": 10, "text": { @@ -289,7 +289,7 @@ }, "outdated_warning": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 13 } }, @@ -297,7 +297,7 @@ "height": 34, "background": "#ffffff", "border": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1, "bottom": true }, @@ -327,52 +327,52 @@ "editor": { "text_color": "#2b2b2b", "background": "#ffffff", - "active_line_background": "#e3e3e3", + "active_line_background": "#f1f1f1", "code_actions_indicator": "#717171", - "diff_background_deleted": "#fdd4d4", - "diff_background_inserted": "#befad2", - "document_highlight_read_background": "#e3e3e3", - "document_highlight_write_background": "#e3e3e3", - "error_color": "#f47171", + "diff_background_deleted": "#fcc6c6", + "diff_background_inserted": "#b7f9ce", + "document_highlight_read_background": "#f1f1f1", + "document_highlight_write_background": "#f1f1f1", + "error_color": "#eb2d2d", "gutter_background": "#ffffff", - "gutter_padding_factor": 2.5, - "highlighted_line_background": "#e3e3e3", - "line_number": "#808080", + "gutter_padding_factor": 3.5, + "highlighted_line_background": "#f1f1f1", + "line_number": "#aaaaaa", "line_number_active": "#000000", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "guest_selections": [ { - "cursor": "#87d116", - "selection": "#dbf9ac" + "cursor": "#79ba16", + "selection": "#dffab5" }, { - "cursor": "#777af4", - "selection": "#d4d5fd" + "cursor": "#484bed", + "selection": "#cdcdfc" }, { - "cursor": "#f98a3d", - "selection": "#fde0cd" + "cursor": "#ee670a", + "selection": "#fcd6bd" }, { - "cursor": "#b671f8", - "selection": "#e9d4fd" + "cursor": "#993bf3", + "selection": "#e4cbfc" }, { - "cursor": "#16ddc7", - "selection": "#b4faf2" + "cursor": "#16d6c1", + "selection": "#b1faf2" }, { - "cursor": "#f58ac0", - "selection": "#fcd4e8" + "cursor": "#ef59a3", + "selection": "#fbc6e1" }, { - "cursor": "#f6bc09", - "selection": "#fceabc" + "cursor": "#f7bf17", + "selection": "#fce9b7" } ], "autocomplete": { @@ -400,13 +400,13 @@ "right": 6, "top": 2 }, - "background": "#f1f1f1" + "background": "#f8f8f8" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#59c3f5", + "color": "#103063", "weight": "normal" }, "selected_item": { @@ -417,7 +417,7 @@ "right": 6, "top": 2 }, - "background": "#e3e3e3" + "background": "#f1f1f1" } }, "diagnostic_header": { @@ -453,7 +453,7 @@ } }, "diagnostic_path_header": { - "background": "#e3e3e3", + "background": "#f1f1f1", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", @@ -481,12 +481,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#f47171", + "color": "#eb2d2d", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#f47171", + "color": "#eb2d2d", "size": 14, "weight": "bold" } @@ -504,12 +504,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#e5af09", + "color": "#d3a20b", "size": 14, "weight": "bold" } @@ -527,12 +527,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -550,12 +550,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#6099f7", + "color": "#2472f2", "size": 14, "weight": "bold" } @@ -653,7 +653,35 @@ } } }, - "syntax": {} + "syntax": { + "keyword": "#103063", + "function": "#1b9447", + "string": "#bb550e", + "type": "#138a7d", + "number": "#14a898", + "comment": "#555555", + "property": "#134697", + "variant": "#1179a8", + "constant": "#393939", + "title": { + "color": "#1096d3", + "weight": "bold" + }, + "emphasis": "#2472f2", + "emphasis_strong": { + "color": "#2472f2", + "weight": "bold" + }, + "link_uri": { + "color": "#14a898", + "underline": true + }, + "link_text": { + "color": "#ee670a", + "italic": true + }, + "list_marker": "#20b0f2" + } }, "project_diagnostics": { "tab_icon_spacing": 4, @@ -929,8 +957,8 @@ "size": 14 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "border": { "color": "#e3e3e3", @@ -1022,7 +1050,7 @@ "padding": { "left": 8 }, - "background": "#e3e3e3", + "background": "#f1f1f1", "corner_radius": 6 }, "unshared_project": { @@ -1062,7 +1090,7 @@ "padding": { "left": 8 }, - "background": "#e3e3e3", + "background": "#f1f1f1", "corner_radius": 6 } }, @@ -1123,8 +1151,8 @@ "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -1177,8 +1205,8 @@ "size": 16 }, "selection": { - "cursor": "#6099f7", - "selection": "#d0e2fd" + "cursor": "#2472f2", + "selection": "#c5dafc" }, "text": { "family": "Zed Mono", @@ -1186,7 +1214,7 @@ "size": 16 }, "border": { - "color": "#fbbdbd", + "color": "#f9a0a0", "width": 1 }, "margin": { diff --git a/styles/styleTree/editor.ts b/styles/styleTree/editor.ts index e760ecec6a57997c48238e0fdeb16d457c2c3e69..23c1e67ac6e6c1dcc75e1d638e760184bfc66e0f 100644 --- a/styles/styleTree/editor.ts +++ b/styles/styleTree/editor.ts @@ -49,7 +49,7 @@ export default function editor(theme: Theme) { documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, errorColor: theme.textColor.error.value, gutterBackground: backgroundColor(theme, 500), - gutterPaddingFactor: 2.5, + gutterPaddingFactor: 3.5, highlightedLineBackground: theme.editor.line.highlighted.value, lineNumber: theme.editor.gutter.primary.value, lineNumberActive: theme.editor.gutter.active.value, @@ -129,7 +129,21 @@ export default function editor(theme: Theme) { invalidInformationDiagnostic: diagnostic(theme, "muted"), invalidWarningDiagnostic: diagnostic(theme, "muted"), syntax: { - - } + keyword: theme.syntax.keyword.color.value, + function: theme.syntax.function.color.value, + string: theme.syntax.string.color.value, + type: theme.syntax.type.color.value, + number: theme.syntax.number.color.value, + comment: theme.syntax.comment.color.value, + property: theme.syntax.property.color.value, + variant: theme.syntax.variant.color.value, + constant: theme.syntax.constant.color.value, + title: { color: theme.syntax.title.color.value, weight: "bold" }, + emphasis: theme.textColor.feature.value, + "emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" }, + link_uri: { color: theme.syntax.linkUrl.color.value, underline: true }, + link_text: { color: theme.syntax.linkText.color.value, italic: true }, + list_marker: theme.syntax.listMarker.color.value, + }, }; } diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts index 4349ba0ab6861080a146e6d25b8be9d6af801d71..030f8edc95e758b574b2df7378acc1bbf498ad3f 100644 --- a/styles/styleTree/workspace.ts +++ b/styles/styleTree/workspace.ts @@ -135,7 +135,7 @@ export default function workspace(theme: Theme) { toolbar: { height: 34, background: backgroundColor(theme, 500), - border: border(theme, "primary", { bottom: true }), + border: border(theme, "secondary", { bottom: true }), itemSpacing: 8, padding: { left: 16, right: 8, top: 4, bottom: 4 }, }, diff --git a/styles/themes/dark.ts b/styles/themes/dark.ts index 3cb3b653b4a6407d197049b0baf1ff72997b02c7..3351d3d3fab34f33e033eb610f701555da34f4b2 100644 --- a/styles/themes/dark.ts +++ b/styles/themes/dark.ts @@ -88,39 +88,39 @@ const iconColor = { const player = { 1: { - baseColor: colors.blue[600], - cursorColor: colors.blue[600], - selectionColor: colors.blue[100], - borderColor: colors.blue[600], + baseColor: colors.blue[500], + cursorColor: colors.blue[500], + selectionColor: colors.blue[800], + borderColor: colors.blue[800], }, 2: { baseColor: colors.lime[500], cursorColor: colors.lime[500], - selectionColor: colors.lime[100], + selectionColor: colors.lime[800], borderColor: colors.lime[500], }, 3: { baseColor: colors.indigo[500], cursorColor: colors.indigo[500], - selectionColor: colors.indigo[100], + selectionColor: colors.indigo[800], borderColor: colors.indigo[500], }, 4: { baseColor: colors.orange[500], cursorColor: colors.orange[500], - selectionColor: colors.orange[100], + selectionColor: colors.orange[800], borderColor: colors.orange[500], }, 5: { baseColor: colors.purple[500], cursorColor: colors.purple[500], - selectionColor: colors.purple[100], + selectionColor: colors.purple[800], borderColor: colors.purple[500], }, 6: { baseColor: colors.teal[400], cursorColor: colors.teal[400], - selectionColor: colors.teal[100], + selectionColor: colors.teal[800], borderColor: colors.teal[400], }, 7: { @@ -151,11 +151,11 @@ const editor = { }, highlight: { selection: player[1].selectionColor, - occurrence: colors.indigo[500], // TODO: Why does indigo[500], indigo[100], and indigo[900] all give me the same color? @kethku - activeOccurrence: colors.indigo[400], // TODO: We don't seem to be using this right now in rust + occurrence: colors.neutral[750], + activeOccurrence: colors.neutral[700], matchingBracket: backgroundColor[500].active, - match: colors.lime[500], - activeMatch: colors.lime[400], + match: colors.sky[900], + activeMatch: colors.sky[800], related: backgroundColor[500].focused, }, gutter: { @@ -166,15 +166,15 @@ const editor = { const syntax: Syntax = { primary: { - color: textColor.primary, + color: colors.neutral[150], weight: fontWeights.normal, }, comment: { - color: colors.lime[200], + color: colors.neutral[300], weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, + color: colors.neutral[200], weight: fontWeights.normal, }, constant: { @@ -182,7 +182,7 @@ const syntax: Syntax = { weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], + color: colors.blue[400], weight: fontWeights.normal, }, function: { @@ -194,19 +194,19 @@ const syntax: Syntax = { weight: fontWeights.normal, }, variant: { - color: colors.teal[300], + color: colors.sky[300], weight: fontWeights.normal, }, property: { - color: colors.sky[300], + color: colors.blue[400], weight: fontWeights.normal, }, enum: { - color: colors.sky[400], + color: colors.orange[500], weight: fontWeights.normal, }, operator: { - color: colors.sky[400], + color: colors.orange[500], weight: fontWeights.normal, }, string: { @@ -214,11 +214,11 @@ const syntax: Syntax = { weight: fontWeights.normal, }, number: { - color: colors.neutral[150], + color: colors.lime[300], weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], + color: colors.lime[300], weight: fontWeights.normal, }, predictive: { @@ -226,7 +226,7 @@ const syntax: Syntax = { weight: fontWeights.normal, }, title: { - color: colors.sky[500], + color: colors.amber[500], weight: fontWeights.bold, }, emphasis: { diff --git a/styles/themes/light.ts b/styles/themes/light.ts index ee94e18b19869727eae1c973d908ed3202282c77..649fd719a8f75bd47e4c07e8744a4863ae1f5d9f 100644 --- a/styles/themes/light.ts +++ b/styles/themes/light.ts @@ -18,9 +18,9 @@ const backgroundColor = { }, 500: { base: colors.neutral[0], - hovered: colors.neutral[50], - active: colors.neutral[100], - focused: colors.neutral[50], + hovered: colors.neutral[25], + active: colors.neutral[50], + focused: colors.neutral[75], }, ok: { base: colors.green[100], @@ -159,66 +159,66 @@ const editor = { related: colors.neutral[0], }, gutter: { - primary: textColor.muted, + primary: colors.neutral[300], active: textColor.active, }, }; const syntax: Syntax = { primary: { - color: textColor.primary, + color: colors.neutral[750], weight: fontWeights.normal, }, comment: { - color: colors.lime[200], + color: colors.neutral[600], weight: fontWeights.normal, }, punctuation: { - color: textColor.primary, + color: colors.neutral[700], weight: fontWeights.normal, }, constant: { - color: colors.neutral[150], + color: colors.neutral[700], weight: fontWeights.normal, }, keyword: { - color: colors.sky[400], + color: colors.blue[800], weight: fontWeights.normal, }, function: { - color: colors.yellow[200], + color: colors.green[600], weight: fontWeights.normal, }, type: { - color: colors.teal[300], + color: colors.teal[600], weight: fontWeights.normal, }, variant: { - color: colors.teal[300], + color: colors.sky[600], weight: fontWeights.normal, }, property: { - color: colors.sky[300], + color: colors.blue[700], weight: fontWeights.normal, }, enum: { - color: colors.sky[400], + color: colors.orange[600], weight: fontWeights.normal, }, operator: { - color: colors.sky[400], + color: colors.orange[600], weight: fontWeights.normal, }, string: { - color: colors.orange[300], + color: colors.orange[600], weight: fontWeights.normal, }, number: { - color: colors.neutral[150], + color: colors.teal[500], weight: fontWeights.normal, }, boolean: { - color: colors.neutral[150], + color: colors.amber[600], weight: fontWeights.normal, }, predictive: { @@ -238,7 +238,7 @@ const syntax: Syntax = { weight: fontWeights.bold, }, linkUrl: { - color: colors.lime[500], + color: colors.teal[500], weight: fontWeights.normal, // TODO: add underline }, diff --git a/styles/utils/color.ts b/styles/utils/color.ts index 156fc5ba41b2bbf0cfc9dd8080db9bf6cd6c320d..e69d903a431cdef0dc9acdc3f76eb8b535d519f4 100644 --- a/styles/utils/color.ts +++ b/styles/utils/color.ts @@ -17,14 +17,14 @@ export function colorRamp( } else { let hue = Math.round(chroma(color).hsl()[0]); let startColor = chroma.hsl(hue, 0.88, 0.96); - let endColor = chroma.hsl(hue, 0.68, 0.32); + let endColor = chroma.hsl(hue, 0.68, 0.12); scale = chroma .scale([startColor, color, endColor]) .domain([0, 0.5, 1]) .mode("hsl") .gamma(1) - .correctLightness(true) - .padding([0, 0.15]); + // .correctLightness(true) + .padding([0, 0]); } const ramp: ColorRamp = {}; From 6a1be11aa63fc0ddbdd782fd14de3c19d1a36edf Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 4 Apr 2022 15:07:55 -0600 Subject: [PATCH 061/245] Wait to create access token until we impersonate a user We need to wait to create the token until we decide on whether we're impersonating a different user, otherwise we'll create the token for the original user and the impersonated user won't be able to authenticate. --- crates/server/src/api.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/server/src/api.rs b/crates/server/src/api.rs index 69b60fe9ec4ae21359e5cdfe932d244b1aea67f6..c909650f26e7466e09ab845b6174da062747da95 100644 --- a/crates/server/src/api.rs +++ b/crates/server/src/api.rs @@ -111,7 +111,6 @@ async fn create_access_token(request: Request) -> tide::Result { .get_user_by_github_login(request.param("github_login")?) .await? .ok_or_else(|| surf::Error::from_str(StatusCode::NotFound, "user not found"))?; - let access_token = auth::create_access_token(request.db().as_ref(), user.id).await?; #[derive(Deserialize)] struct QueryParams { @@ -123,9 +122,6 @@ async fn create_access_token(request: Request) -> tide::Result { surf::Error::from_str(StatusCode::UnprocessableEntity, "invalid query params") })?; - let encrypted_access_token = - auth::encrypt_access_token(&access_token, query_params.public_key.clone())?; - let mut user_id = user.id; if let Some(impersonate) = query_params.impersonate { if user.admin { @@ -151,6 +147,10 @@ async fn create_access_token(request: Request) -> tide::Result { } } + let access_token = auth::create_access_token(request.db().as_ref(), user_id).await?; + let encrypted_access_token = + auth::encrypt_access_token(&access_token, query_params.public_key.clone())?; + Ok(tide::Response::builder(StatusCode::Ok) .body(json!({"user_id": user_id, "encrypted_access_token": encrypted_access_token})) .build()) From 05a05157faff225158b38431a4b83b5cebd1336c Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 4 Apr 2022 14:39:28 -0700 Subject: [PATCH 062/245] Move style source files to src and build to dist Co-authored-by: Nate Butler --- crates/editor/src/context_menu.rs | 272 + styles/buildFigmaTokens.ts | 115 - styles/dist/figma/core.json | 1155 +++++ styles/package-lock.json | 5156 +++++++++---------- styles/package.json | 39 +- styles/src/buildFigmaTokens.ts | 110 + styles/{ => src}/buildThemes.ts | 6 +- styles/{ => src}/figma/core.json | 0 styles/{ => src}/figma/dark.json | 192 +- styles/{ => src}/figma/light.json | 182 +- styles/{ => src}/figma/tokens.json | 678 +-- styles/{ => src}/styleTree/app.ts | 4 +- styles/src/styleTree/chatPanel.ts | 108 + styles/src/styleTree/components.ts | 96 + styles/{ => src}/styleTree/contactsPanel.ts | 0 styles/{ => src}/styleTree/editor.ts | 6 +- styles/src/styleTree/projectPanel.ts | 37 + styles/src/styleTree/search.ts | 79 + styles/src/styleTree/selectorModal.ts | 59 + styles/src/styleTree/workspace.ts | 151 + styles/{ => src}/themes/dark.ts | 74 +- styles/src/themes/light.ts | 228 + styles/{ => src}/themes/theme.ts | 14 + styles/{ => src}/tokens.ts | 0 styles/src/utils/color.ts | 52 + styles/src/utils/snakeCase.ts | 35 + styles/styleTree/chatPanel.ts | 108 - styles/styleTree/components.ts | 91 - styles/styleTree/projectPanel.ts | 37 - styles/styleTree/search.ts | 79 - styles/styleTree/selectorModal.ts | 59 - styles/styleTree/workspace.ts | 151 - styles/themes/light.ts | 273 - styles/utils/color.ts | 44 - styles/utils/decamelizeTree.ts | 21 - 35 files changed, 5541 insertions(+), 4170 deletions(-) create mode 100644 crates/editor/src/context_menu.rs delete mode 100644 styles/buildFigmaTokens.ts create mode 100644 styles/dist/figma/core.json create mode 100644 styles/src/buildFigmaTokens.ts rename styles/{ => src}/buildThemes.ts (70%) rename styles/{ => src}/figma/core.json (100%) rename styles/{ => src}/figma/dark.json (79%) rename styles/{ => src}/figma/light.json (80%) rename styles/{ => src}/figma/tokens.json (80%) rename styles/{ => src}/styleTree/app.ts (91%) create mode 100644 styles/src/styleTree/chatPanel.ts create mode 100644 styles/src/styleTree/components.ts rename styles/{ => src}/styleTree/contactsPanel.ts (100%) rename styles/{ => src}/styleTree/editor.ts (97%) create mode 100644 styles/src/styleTree/projectPanel.ts create mode 100644 styles/src/styleTree/search.ts create mode 100644 styles/src/styleTree/selectorModal.ts create mode 100644 styles/src/styleTree/workspace.ts rename styles/{ => src}/themes/dark.ts (74%) create mode 100644 styles/src/themes/light.ts rename styles/{ => src}/themes/theme.ts (88%) rename styles/{ => src}/tokens.ts (100%) create mode 100644 styles/src/utils/color.ts create mode 100644 styles/src/utils/snakeCase.ts delete mode 100644 styles/styleTree/chatPanel.ts delete mode 100644 styles/styleTree/components.ts delete mode 100644 styles/styleTree/projectPanel.ts delete mode 100644 styles/styleTree/search.ts delete mode 100644 styles/styleTree/selectorModal.ts delete mode 100644 styles/styleTree/workspace.ts delete mode 100644 styles/themes/light.ts delete mode 100644 styles/utils/color.ts delete mode 100644 styles/utils/decamelizeTree.ts diff --git a/crates/editor/src/context_menu.rs b/crates/editor/src/context_menu.rs new file mode 100644 index 0000000000000000000000000000000000000000..b1c4a1b51cbac521c0a3879501398ef1eb899b88 --- /dev/null +++ b/crates/editor/src/context_menu.rs @@ -0,0 +1,272 @@ +pub enum ContextMenu { + Completions(CompletionsMenu), + CodeActions(CodeActionsMenu), +} + +impl ContextMenu { + pub fn select_prev(&mut self, cx: &mut ViewContext) -> bool { + if self.visible() { + match self { + ContextMenu::Completions(menu) => menu.select_prev(cx), + ContextMenu::CodeActions(menu) => menu.select_prev(cx), + } + true + } else { + false + } + } + + pub fn select_next(&mut self, cx: &mut ViewContext) -> bool { + if self.visible() { + match self { + ContextMenu::Completions(menu) => menu.select_next(cx), + ContextMenu::CodeActions(menu) => menu.select_next(cx), + } + true + } else { + false + } + } + + pub fn visible(&self) -> bool { + match self { + ContextMenu::Completions(menu) => menu.visible(), + ContextMenu::CodeActions(menu) => menu.visible(), + } + } + + pub fn render( + &self, + cursor_position: DisplayPoint, + style: EditorStyle, + cx: &AppContext, + ) -> (DisplayPoint, ElementBox) { + match self { + ContextMenu::Completions(menu) => (cursor_position, menu.render(style, cx)), + ContextMenu::CodeActions(menu) => menu.render(cursor_position, style), + } + } +} + +struct CompletionsMenu { + id: CompletionId, + initial_position: Anchor, + buffer: ModelHandle, + completions: Arc<[Completion]>, + match_candidates: Vec, + matches: Arc<[StringMatch]>, + selected_item: usize, + list: UniformListState, +} + +impl CompletionsMenu { + fn select_prev(&mut self, cx: &mut ViewContext) { + if self.selected_item > 0 { + self.selected_item -= 1; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); + } + cx.notify(); + } + + fn select_next(&mut self, cx: &mut ViewContext) { + if self.selected_item + 1 < self.matches.len() { + self.selected_item += 1; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); + } + cx.notify(); + } + + fn visible(&self) -> bool { + !self.matches.is_empty() + } + + fn render(&self, style: EditorStyle, _: &AppContext) -> ElementBox { + enum CompletionTag {} + + let completions = self.completions.clone(); + let matches = self.matches.clone(); + let selected_item = self.selected_item; + let container_style = style.autocomplete.container; + UniformList::new(self.list.clone(), matches.len(), move |range, items, cx| { + let start_ix = range.start; + for (ix, mat) in matches[range].iter().enumerate() { + let completion = &completions[mat.candidate_id]; + let item_ix = start_ix + ix; + items.push( + MouseEventHandler::new::( + mat.candidate_id, + cx, + |state, _| { + let item_style = if item_ix == selected_item { + style.autocomplete.selected_item + } else if state.hovered { + style.autocomplete.hovered_item + } else { + style.autocomplete.item + }; + + Text::new(completion.label.text.clone(), style.text.clone()) + .with_soft_wrap(false) + .with_highlights(combine_syntax_and_fuzzy_match_highlights( + &completion.label.text, + style.text.color.into(), + styled_runs_for_code_label(&completion.label, &style.syntax), + &mat.positions, + )) + .contained() + .with_style(item_style) + .boxed() + }, + ) + .with_cursor_style(CursorStyle::PointingHand) + .on_mouse_down(move |cx| { + cx.dispatch_action(ConfirmCompletion(Some(item_ix))); + }) + .boxed(), + ); + } + }) + .with_width_from_item( + self.matches + .iter() + .enumerate() + .max_by_key(|(_, mat)| { + self.completions[mat.candidate_id] + .label + .text + .chars() + .count() + }) + .map(|(ix, _)| ix), + ) + .contained() + .with_style(container_style) + .boxed() + } + + pub async fn filter(&mut self, query: Option<&str>, executor: Arc) { + let mut matches = if let Some(query) = query { + fuzzy::match_strings( + &self.match_candidates, + query, + false, + 100, + &Default::default(), + executor, + ) + .await + } else { + self.match_candidates + .iter() + .enumerate() + .map(|(candidate_id, candidate)| StringMatch { + candidate_id, + score: Default::default(), + positions: Default::default(), + string: candidate.string.clone(), + }) + .collect() + }; + matches.sort_unstable_by_key(|mat| { + ( + Reverse(OrderedFloat(mat.score)), + self.completions[mat.candidate_id].sort_key(), + ) + }); + + for mat in &mut matches { + let filter_start = self.completions[mat.candidate_id].label.filter_range.start; + for position in &mut mat.positions { + *position += filter_start; + } + } + + self.matches = matches.into(); + } +} + +#[derive(Clone)] +struct CodeActionsMenu { + actions: Arc<[CodeAction]>, + buffer: ModelHandle, + selected_item: usize, + list: UniformListState, + deployed_from_indicator: bool, +} + +impl CodeActionsMenu { + fn select_prev(&mut self, cx: &mut ViewContext) { + if self.selected_item > 0 { + self.selected_item -= 1; + cx.notify() + } + } + + fn select_next(&mut self, cx: &mut ViewContext) { + if self.selected_item + 1 < self.actions.len() { + self.selected_item += 1; + cx.notify() + } + } + + fn visible(&self) -> bool { + !self.actions.is_empty() + } + + fn render( + &self, + mut cursor_position: DisplayPoint, + style: EditorStyle, + ) -> (DisplayPoint, ElementBox) { + enum ActionTag {} + + let container_style = style.autocomplete.container; + let actions = self.actions.clone(); + let selected_item = self.selected_item; + let element = + UniformList::new(self.list.clone(), actions.len(), move |range, items, cx| { + let start_ix = range.start; + for (ix, action) in actions[range].iter().enumerate() { + let item_ix = start_ix + ix; + items.push( + MouseEventHandler::new::(item_ix, cx, |state, _| { + let item_style = if item_ix == selected_item { + style.autocomplete.selected_item + } else if state.hovered { + style.autocomplete.hovered_item + } else { + style.autocomplete.item + }; + + Text::new(action.lsp_action.title.clone(), style.text.clone()) + .with_soft_wrap(false) + .contained() + .with_style(item_style) + .boxed() + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_mouse_down(move |cx| { + cx.dispatch_action(ConfirmCodeAction(Some(item_ix))); + }) + .boxed(), + ); + } + }) + .with_width_from_item( + self.actions + .iter() + .enumerate() + .max_by_key(|(_, action)| action.lsp_action.title.chars().count()) + .map(|(ix, _)| ix), + ) + .contained() + .with_style(container_style) + .boxed(); + + if self.deployed_from_indicator { + *cursor_position.column_mut() = 0; + } + + (cursor_position, element) + } +} diff --git a/styles/buildFigmaTokens.ts b/styles/buildFigmaTokens.ts deleted file mode 100644 index bb77046e85c53007c272ac791e104b9a908fd80d..0000000000000000000000000000000000000000 --- a/styles/buildFigmaTokens.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as fs from "fs"; -import * as path from "path"; -import dark from "./themes/dark"; -import light from "./themes/light"; -import Theme from "./themes/theme"; -import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; - -let themes = [ - dark, - light -]; - -// Organize theme tokens -function themeTokens(theme: Theme) { - return { - meta: { - themeName: theme.name, - }, - text: theme.textColor, - icon: theme.iconColor, - background: theme.backgroundColor, - border: theme.borderColor, - editor: theme.editor, - syntax: { - primary: { - value: theme.syntax.primary.color.value, - type: "color", - }, - comment: { - value: theme.syntax.comment.color.value, - type: "color", - }, - keyword: { - value: theme.syntax.keyword.color.value, - type: "color", - }, - function: { - value: theme.syntax.function.color.value, - type: "color", - }, - type: { - value: theme.syntax.type.color.value, - type: "color", - }, - variant: { - value: theme.syntax.variant.color.value, - type: "color", - }, - property: { - value: theme.syntax.property.color.value, - type: "color", - }, - enum: { - value: theme.syntax.enum.color.value, - type: "color", - }, - operator: { - value: theme.syntax.operator.color.value, - type: "color", - }, - string: { - value: theme.syntax.string.color.value, - type: "color", - }, - number: { - value: theme.syntax.number.color.value, - type: "color", - }, - boolean: { - value: theme.syntax.boolean.color.value, - type: "color", - }, - }, - player: theme.player, - shadowAlpha: theme.shadowAlpha, - }; -} - -// Organize core tokens -const coreTokens = { - color: { - ...colors, - }, - text: { - family: fontFamilies, - weight: fontWeights, - }, - size: fontSizes, -}; - -const combinedTokens = { - core: coreTokens, - dark: themeTokens(dark), - light: themeTokens(light) -} - -// Create core.json -const corePath = path.resolve(`${__dirname}/figma/core.json`); -const coreJSON = JSON.stringify(coreTokens, null, 2); -fs.writeFileSync(corePath, coreJSON); -console.log(`- Core: core.json created`); - -// Create {theme}.json -const themePath = path.resolve(`${__dirname}/figma`); -themes.forEach((theme) => { - const tokenJSON = JSON.stringify(themeTokens(theme), null, 2); - fs.writeFileSync(`${themePath}/${theme.name}.json`, tokenJSON); - console.log(`- Theme: ${theme.name}.json created`); -}); - -// Create combined tokens.json -const combinedPath = path.resolve(`${__dirname}/figma/tokens.json`); -const combinedJSON = JSON.stringify(combinedTokens, null, 2); -fs.writeFileSync(combinedPath, combinedJSON); -console.log(`- Combined: tokens.json created`); \ No newline at end of file diff --git a/styles/dist/figma/core.json b/styles/dist/figma/core.json new file mode 100644 index 0000000000000000000000000000000000000000..f44b1d210c30493ee350126c1272c64578edbd01 --- /dev/null +++ b/styles/dist/figma/core.json @@ -0,0 +1,1155 @@ +{ + "color": { + "neutral": { + "0": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "25": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "50": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "75": { + "value": "#eaeaea", + "step": 75, + "type": "color" + }, + "100": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "125": { + "value": "#dcdcdc", + "step": 125, + "type": "color" + }, + "150": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "175": { + "value": "#cdcdcd", + "step": 175, + "type": "color" + }, + "200": { + "value": "#c6c6c6", + "step": 200, + "type": "color" + }, + "225": { + "value": "#bfbfbf", + "step": 225, + "type": "color" + }, + "250": { + "value": "#b8b8b8", + "step": 250, + "type": "color" + }, + "275": { + "value": "#b1b1b1", + "step": 275, + "type": "color" + }, + "300": { + "value": "#aaaaaa", + "step": 300, + "type": "color" + }, + "325": { + "value": "#a3a3a3", + "step": 325, + "type": "color" + }, + "350": { + "value": "#9c9c9c", + "step": 350, + "type": "color" + }, + "375": { + "value": "#959595", + "step": 375, + "type": "color" + }, + "400": { + "value": "#8e8e8e", + "step": 400, + "type": "color" + }, + "425": { + "value": "#878787", + "step": 425, + "type": "color" + }, + "450": { + "value": "#808080", + "step": 450, + "type": "color" + }, + "475": { + "value": "#787878", + "step": 475, + "type": "color" + }, + "500": { + "value": "#717171", + "step": 500, + "type": "color" + }, + "525": { + "value": "#6a6a6a", + "step": 525, + "type": "color" + }, + "550": { + "value": "#636363", + "step": 550, + "type": "color" + }, + "575": { + "value": "#5c5c5c", + "step": 575, + "type": "color" + }, + "600": { + "value": "#555555", + "step": 600, + "type": "color" + }, + "625": { + "value": "#4e4e4e", + "step": 625, + "type": "color" + }, + "650": { + "value": "#474747", + "step": 650, + "type": "color" + }, + "675": { + "value": "#404040", + "step": 675, + "type": "color" + }, + "700": { + "value": "#393939", + "step": 700, + "type": "color" + }, + "725": { + "value": "#323232", + "step": 725, + "type": "color" + }, + "750": { + "value": "#2b2b2b", + "step": 750, + "type": "color" + }, + "775": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "800": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "825": { + "value": "#151515", + "step": 825, + "type": "color" + }, + "850": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "875": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "900": { + "value": "#000000", + "step": 900, + "type": "color" + } + }, + "rose": { + "0": { + "value": "#feecef", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fcc5cf", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fa9fae", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8788e", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f5526e", + "step": 400, + "type": "color" + }, + "500": { + "value": "#f0284a", + "step": 500, + "type": "color" + }, + "600": { + "value": "#cd1434", + "step": 600, + "type": "color" + }, + "700": { + "value": "#97142a", + "step": 700, + "type": "color" + }, + "800": { + "value": "#64101e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#330a11", + "step": 900, + "type": "color" + } + }, + "red": { + "0": { + "value": "#feecec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fcc6c6", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f9a0a0", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f57b7b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f15656", + "step": 400, + "type": "color" + }, + "500": { + "value": "#eb2d2d", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c91818", + "step": 600, + "type": "color" + }, + "700": { + "value": "#951515", + "step": 700, + "type": "color" + }, + "800": { + "value": "#631111", + "step": 800, + "type": "color" + }, + "900": { + "value": "#330a0a", + "step": 900, + "type": "color" + } + }, + "orange": { + "0": { + "value": "#fef3ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fcd6bd", + "step": 100, + "type": "color" + }, + "200": { + "value": "#fab98e", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f99d5f", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f9812e", + "step": 400, + "type": "color" + }, + "500": { + "value": "#ee670a", + "step": 500, + "type": "color" + }, + "600": { + "value": "#bb550e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#8b4210", + "step": 700, + "type": "color" + }, + "800": { + "value": "#5d2f0e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#331b0a", + "step": 900, + "type": "color" + } + }, + "amber": { + "0": { + "value": "#fef7ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fce2ba", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f9ce89", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f7bb57", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f6a724", + "step": 400, + "type": "color" + }, + "500": { + "value": "#de900c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b0740f", + "step": 600, + "type": "color" + }, + "700": { + "value": "#845910", + "step": 700, + "type": "color" + }, + "800": { + "value": "#5a3e0e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#33240a", + "step": 900, + "type": "color" + } + }, + "yellow": { + "0": { + "value": "#fef9ec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fce9b7", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f9da82", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f8cc4d", + "step": 300, + "type": "color" + }, + "400": { + "value": "#f7bf17", + "step": 400, + "type": "color" + }, + "500": { + "value": "#d3a20b", + "step": 500, + "type": "color" + }, + "600": { + "value": "#a8820e", + "step": 600, + "type": "color" + }, + "700": { + "value": "#7e630f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#58460e", + "step": 800, + "type": "color" + }, + "900": { + "value": "#33290a", + "step": 900, + "type": "color" + } + }, + "lime": { + "0": { + "value": "#f7feec", + "step": 0, + "type": "color" + }, + "100": { + "value": "#dffab5", + "step": 100, + "type": "color" + }, + "200": { + "value": "#c7f57f", + "step": 200, + "type": "color" + }, + "300": { + "value": "#aeef4b", + "step": 300, + "type": "color" + }, + "400": { + "value": "#96e818", + "step": 400, + "type": "color" + }, + "500": { + "value": "#79ba16", + "step": 500, + "type": "color" + }, + "600": { + "value": "#639714", + "step": 600, + "type": "color" + }, + "700": { + "value": "#4e7412", + "step": 700, + "type": "color" + }, + "800": { + "value": "#38530f", + "step": 800, + "type": "color" + }, + "900": { + "value": "#23330a", + "step": 900, + "type": "color" + } + }, + "green": { + "0": { + "value": "#ecfef2", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b7f9ce", + "step": 100, + "type": "color" + }, + "200": { + "value": "#84f2ab", + "step": 200, + "type": "color" + }, + "300": { + "value": "#54e989", + "step": 300, + "type": "color" + }, + "400": { + "value": "#27dd69", + "step": 400, + "type": "color" + }, + "500": { + "value": "#20b456", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1b9447", + "step": 600, + "type": "color" + }, + "700": { + "value": "#157338", + "step": 700, + "type": "color" + }, + "800": { + "value": "#105328", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a3319", + "step": 900, + "type": "color" + } + }, + "emerald": { + "0": { + "value": "#ecfef8", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b0fae1", + "step": 100, + "type": "color" + }, + "200": { + "value": "#74f6cb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#39f0b3", + "step": 300, + "type": "color" + }, + "400": { + "value": "#12d796", + "step": 400, + "type": "color" + }, + "500": { + "value": "#10a977", + "step": 500, + "type": "color" + }, + "600": { + "value": "#118a62", + "step": 600, + "type": "color" + }, + "700": { + "value": "#106c4e", + "step": 700, + "type": "color" + }, + "800": { + "value": "#0d4f3a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a3326", + "step": 900, + "type": "color" + } + }, + "teal": { + "0": { + "value": "#ecfefc", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b1faf2", + "step": 100, + "type": "color" + }, + "200": { + "value": "#76f5e7", + "step": 200, + "type": "color" + }, + "300": { + "value": "#3eeeda", + "step": 300, + "type": "color" + }, + "400": { + "value": "#16d6c1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#14a898", + "step": 500, + "type": "color" + }, + "600": { + "value": "#138a7d", + "step": 600, + "type": "color" + }, + "700": { + "value": "#116c62", + "step": 700, + "type": "color" + }, + "800": { + "value": "#0e4f48", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a332f", + "step": 900, + "type": "color" + } + }, + "cyan": { + "0": { + "value": "#ecfcfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b2f3fb", + "step": 100, + "type": "color" + }, + "200": { + "value": "#78eaf9", + "step": 200, + "type": "color" + }, + "300": { + "value": "#3de2f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#07d5f1", + "step": 400, + "type": "color" + }, + "500": { + "value": "#09aac0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#0c8a9a", + "step": 600, + "type": "color" + }, + "700": { + "value": "#0e6a75", + "step": 700, + "type": "color" + }, + "800": { + "value": "#0d4c53", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a2f33", + "step": 900, + "type": "color" + } + }, + "sky": { + "0": { + "value": "#ecf8fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#b9e5fb", + "step": 100, + "type": "color" + }, + "200": { + "value": "#86d3f8", + "step": 200, + "type": "color" + }, + "300": { + "value": "#53c1f5", + "step": 300, + "type": "color" + }, + "400": { + "value": "#20b0f2", + "step": 400, + "type": "color" + }, + "500": { + "value": "#1096d3", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1179a8", + "step": 600, + "type": "color" + }, + "700": { + "value": "#115c7f", + "step": 700, + "type": "color" + }, + "800": { + "value": "#0e4158", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a2633", + "step": 900, + "type": "color" + } + }, + "blue": { + "0": { + "value": "#ecf3fe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#c5dafc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#9ec1fa", + "step": 200, + "type": "color" + }, + "300": { + "value": "#76a8f8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#4f8ff7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#2472f2", + "step": 500, + "type": "color" + }, + "600": { + "value": "#135acd", + "step": 600, + "type": "color" + }, + "700": { + "value": "#134697", + "step": 700, + "type": "color" + }, + "800": { + "value": "#103063", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a1a33", + "step": 900, + "type": "color" + } + }, + "indigo": { + "0": { + "value": "#ececfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#cdcdfc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#aeaff9", + "step": 200, + "type": "color" + }, + "300": { + "value": "#9091f6", + "step": 300, + "type": "color" + }, + "400": { + "value": "#7274f3", + "step": 400, + "type": "color" + }, + "500": { + "value": "#484bed", + "step": 500, + "type": "color" + }, + "600": { + "value": "#1b1edc", + "step": 600, + "type": "color" + }, + "700": { + "value": "#1819a1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#121269", + "step": 800, + "type": "color" + }, + "900": { + "value": "#0a0a33", + "step": 900, + "type": "color" + } + }, + "violet": { + "0": { + "value": "#f1ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#daccfc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#c3acfb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#ac8cf9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#966cf7", + "step": 400, + "type": "color" + }, + "500": { + "value": "#7741f2", + "step": 500, + "type": "color" + }, + "600": { + "value": "#5316e0", + "step": 600, + "type": "color" + }, + "700": { + "value": "#3f15a3", + "step": 700, + "type": "color" + }, + "800": { + "value": "#2b116a", + "step": 800, + "type": "color" + }, + "900": { + "value": "#160a33", + "step": 900, + "type": "color" + } + }, + "purple": { + "0": { + "value": "#f5ecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#e4cbfc", + "step": 100, + "type": "color" + }, + "200": { + "value": "#d2a9fb", + "step": 200, + "type": "color" + }, + "300": { + "value": "#c188f9", + "step": 300, + "type": "color" + }, + "400": { + "value": "#b066f8", + "step": 400, + "type": "color" + }, + "500": { + "value": "#993bf3", + "step": 500, + "type": "color" + }, + "600": { + "value": "#7b14dd", + "step": 600, + "type": "color" + }, + "700": { + "value": "#5c14a1", + "step": 700, + "type": "color" + }, + "800": { + "value": "#3e1169", + "step": 800, + "type": "color" + }, + "900": { + "value": "#1f0a33", + "step": 900, + "type": "color" + } + }, + "fuschia": { + "0": { + "value": "#fdecfe", + "step": 0, + "type": "color" + }, + "100": { + "value": "#f8c5fb", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f19ff6", + "step": 200, + "type": "color" + }, + "300": { + "value": "#e87af0", + "step": 300, + "type": "color" + }, + "400": { + "value": "#de57e8", + "step": 400, + "type": "color" + }, + "500": { + "value": "#d430e0", + "step": 500, + "type": "color" + }, + "600": { + "value": "#b31fbc", + "step": 600, + "type": "color" + }, + "700": { + "value": "#87198e", + "step": 700, + "type": "color" + }, + "800": { + "value": "#5c1260", + "step": 800, + "type": "color" + }, + "900": { + "value": "#310a33", + "step": 900, + "type": "color" + } + }, + "pink": { + "0": { + "value": "#feecf5", + "step": 0, + "type": "color" + }, + "100": { + "value": "#fbc6e1", + "step": 100, + "type": "color" + }, + "200": { + "value": "#f8a1cc", + "step": 200, + "type": "color" + }, + "300": { + "value": "#f47db8", + "step": 300, + "type": "color" + }, + "400": { + "value": "#ef59a3", + "step": 400, + "type": "color" + }, + "500": { + "value": "#e8318c", + "step": 500, + "type": "color" + }, + "600": { + "value": "#c71a71", + "step": 600, + "type": "color" + }, + "700": { + "value": "#941756", + "step": 700, + "type": "color" + }, + "800": { + "value": "#63113b", + "step": 800, + "type": "color" + }, + "900": { + "value": "#330a1f", + "step": 900, + "type": "color" + } + } + }, + "text": { + "family": { + "sans": { + "value": "Zed Sans", + "type": "fontFamily" + }, + "mono": { + "value": "Zed Mono", + "type": "fontFamily" + } + }, + "weight": { + "thin": { + "value": "thin", + "type": "fontWeight" + }, + "extra_light": { + "value": "extra_light", + "type": "fontWeight" + }, + "light": { + "value": "light", + "type": "fontWeight" + }, + "normal": { + "value": "normal", + "type": "fontWeight" + }, + "medium": { + "value": "medium", + "type": "fontWeight" + }, + "semibold": { + "value": "semibold", + "type": "fontWeight" + }, + "bold": { + "value": "bold", + "type": "fontWeight" + }, + "extra_bold": { + "value": "extra_bold", + "type": "fontWeight" + }, + "black": { + "value": "black", + "type": "fontWeight" + } + } + }, + "size": { + "3xs": { + "value": 8, + "type": "fontSize" + }, + "2xs": { + "value": 10, + "type": "fontSize" + }, + "xs": { + "value": 12, + "type": "fontSize" + }, + "sm": { + "value": 14, + "type": "fontSize" + }, + "md": { + "value": 16, + "type": "fontSize" + }, + "lg": { + "value": 18, + "type": "fontSize" + }, + "xl": { + "value": 20, + "type": "fontSize" + } + } +} \ No newline at end of file diff --git a/styles/package-lock.json b/styles/package-lock.json index 43c9b19ea1224415c654186ed6203c48e776e2da..ade0a53052268990346f470de96522408fea5fd5 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -1,2589 +1,2589 @@ { - "name": "styles", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "styles", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@types/chroma-js": "^2.1.3", - "@types/node": "^17.0.23", - "case-anything": "^2.1.10", - "chroma-js": "^2.4.2" - }, - "devDependencies": { - "nodemon": "^2.0.15", - "ts-node": "^10.7.0" - } - }, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "engines": { - "node": ">= 12" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "dependencies": { - "defer-to-connect": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true - }, - "node_modules/@types/chroma-js": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", - "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" - }, - "node_modules/@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", - "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "dependencies": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cacheable-request/node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/case-anything": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", - "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==", - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chroma-js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", - "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" - }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "node_modules/cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "node_modules/configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "dependencies": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "dependencies": { - "ini": "2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", - "dev": true - }, - "node_modules/import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "dependencies": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "node_modules/is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.0" - } - }, - "node_modules/latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "dependencies": { - "package-json": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/nodemon": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", - "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5", - "update-notifier": "^5.1.0" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "dependencies": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "dependencies": { - "escape-goat": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "dependencies": { - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver-diff/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "dev": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "node_modules/unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "dependencies": { - "crypto-random-string": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "dependencies": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/yeoman/update-notifier?sponsor=1" - } - }, - "node_modules/update-notifier/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "node_modules/widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "dependencies": { - "string-width": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - } - }, - "dependencies": { - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true - }, - "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "requires": { - "@cspotcode/source-map-consumer": "0.8.0" - } - }, - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "requires": { - "defer-to-connect": "^1.0.1" - } - }, - "@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true - }, - "@types/chroma-js": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", - "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" - }, - "@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", - "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "requires": { - "string-width": "^4.1.0" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "requires": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } + "name": "styles", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "styles", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@types/chroma-js": "^2.1.3", + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2" + }, + "devDependencies": { + "nodemon": "^2.0.15", + "ts-node": "^10.7.0" + } + }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "node_modules/@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, + "node_modules/@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "node_modules/import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } } - } - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true }, - "case-anything": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", - "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { + "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@types/chroma-js": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", + "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" + }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==" + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "case-anything": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz", + "integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "requires": { + "ini": "2.0.0" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true + }, "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "chroma-js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", - "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true - }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - } - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true - }, - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true - }, - "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "requires": { - "ini": "2.0.0" - } - }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true - }, - "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", - "dev": true - }, - "import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "requires": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - } - }, - "is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true - }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "requires": { - "json-buffer": "3.0.0" - } - }, - "latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "requires": { - "package-json": "^6.3.0" - } - }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "nodemon": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", - "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", - "dev": true, - "requires": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5", - "update-notifier": "^5.1.0" - } - }, - "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true - }, - "package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "requires": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, - "pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "requires": { - "escape-goat": "^2.0.0" - } - }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { "ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - } - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "requires": { - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "requires": { - "nopt": "~1.0.10" - } - }, - "ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "dev": true, - "peer": true - }, - "undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "requires": { - "crypto-random-string": "^2.0.0" - } - }, - "update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "requires": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "dependencies": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + } + }, + "is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "nodemon": { + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", + "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } + }, + "ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true + }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "requires": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } - } - }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "requires": { - "prepend-http": "^2.0.0" - } - }, - "v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "requires": { - "string-width": "^4.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true } - } } diff --git a/styles/package.json b/styles/package.json index 8576a35d34956a0dd438e35f6989dd9b68b217c2..e11cb6108499c2ca4c4383caad9551f3ab98f581 100644 --- a/styles/package.json +++ b/styles/package.json @@ -1,22 +1,21 @@ { - "name": "styles", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "build": "ts-node buildThemes.ts", - "watch": "nodemon" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@types/chroma-js": "^2.1.3", - "@types/node": "^17.0.23", - "case-anything": "^2.1.10", - "chroma-js": "^2.4.2", - "ts-node": "^10.7.0" - }, - "devDependencies": { - "nodemon": "^2.0.15" - } + "name": "styles", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build-themes": "ts-node ./src/buildThemes.ts", + "build-figma": "ts-node ./src/buildFigmaTokens.ts", + "watch": "nodemon" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@types/chroma-js": "^2.1.3", + "@types/node": "^17.0.23", + "case-anything": "^2.1.10", + "chroma-js": "^2.4.2", + "ts-node": "^10.7.0", + "nodemon": "^2.0.15" + } } diff --git a/styles/src/buildFigmaTokens.ts b/styles/src/buildFigmaTokens.ts new file mode 100644 index 0000000000000000000000000000000000000000..70704088a43f8cdf583f4995b56ad43e1c852fb4 --- /dev/null +++ b/styles/src/buildFigmaTokens.ts @@ -0,0 +1,110 @@ +import * as fs from "fs"; +import * as path from "path"; +import dark from "./themes/dark"; +import light from "./themes/light"; +import Theme from "./themes/theme"; +import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; + +// Organize theme tokens +function themeTokens(theme: Theme) { + return { + meta: { + themeName: theme.name, + }, + text: theme.textColor, + icon: theme.iconColor, + background: theme.backgroundColor, + border: theme.borderColor, + editor: theme.editor, + syntax: { + primary: { + value: theme.syntax.primary.color.value, + type: "color", + }, + comment: { + value: theme.syntax.comment.color.value, + type: "color", + }, + keyword: { + value: theme.syntax.keyword.color.value, + type: "color", + }, + function: { + value: theme.syntax.function.color.value, + type: "color", + }, + type: { + value: theme.syntax.type.color.value, + type: "color", + }, + variant: { + value: theme.syntax.variant.color.value, + type: "color", + }, + property: { + value: theme.syntax.property.color.value, + type: "color", + }, + enum: { + value: theme.syntax.enum.color.value, + type: "color", + }, + operator: { + value: theme.syntax.operator.color.value, + type: "color", + }, + string: { + value: theme.syntax.string.color.value, + type: "color", + }, + number: { + value: theme.syntax.number.color.value, + type: "color", + }, + boolean: { + value: theme.syntax.boolean.color.value, + type: "color", + }, + }, + player: theme.player, + shadowAlpha: theme.shadowAlpha, + }; +} + +// Organize core tokens +const coreTokens = { + color: { + ...colors, + }, + text: { + family: fontFamilies, + weight: fontWeights, + }, + size: fontSizes, +}; + +const combinedTokens: any = { + core: coreTokens, +} + +// Create core.json +const corePath = path.resolve(`${__dirname}/../dist/figma/core.json`); +const coreJSON = JSON.stringify(coreTokens, null, 2); +fs.writeFileSync(corePath, coreJSON); +console.log(`- Core: core.json created`); + +// Create {theme}.json +let themes = [dark, light]; +const themePath = path.resolve(`${__dirname}/figma`); +themes.forEach((theme) => { + const tokenJSON = JSON.stringify(themeTokens(theme), null, 2); + fs.writeFileSync(`${themePath}/${theme.name}.json`, tokenJSON); + console.log(`- Theme: ${theme.name}.json created`); + combinedTokens[theme.name] = themeTokens(theme); +}); + +// Create combined tokens.json +const combinedPath = path.resolve(`${__dirname}/figma/tokens.json`); +const combinedJSON = JSON.stringify(combinedTokens, null, 2); +fs.writeFileSync(combinedPath, combinedJSON); +console.log(`- Combined: tokens.json created`); \ No newline at end of file diff --git a/styles/buildThemes.ts b/styles/src/buildThemes.ts similarity index 70% rename from styles/buildThemes.ts rename to styles/src/buildThemes.ts index 9128eff45d46a0a11b9a8ddb04013b3b59faf87a..8772b5fee2926739d6f6bb809ef3b7b3fc67fe7f 100644 --- a/styles/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -3,14 +3,14 @@ import * as path from "path"; import app from "./styleTree/app"; import dark from "./themes/dark"; import light from "./themes/light"; -import decamelizeTree from "./utils/decamelizeTree"; +import snakeCase from "./utils/snakeCase"; const themes = [dark, light]; for (let theme of themes) { - let styleTree = decamelizeTree(app(theme)); + let styleTree = snakeCase(app(theme)); let styleTreeJSON = JSON.stringify(styleTree, null, 2); let outPath = path.resolve( - `${__dirname}/../crates/zed/assets/themes/${theme.name}.json` + `${__dirname}/../../crates/zed/assets/themes/${theme.name}.json` ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`Generated ${outPath}`); diff --git a/styles/figma/core.json b/styles/src/figma/core.json similarity index 100% rename from styles/figma/core.json rename to styles/src/figma/core.json diff --git a/styles/figma/dark.json b/styles/src/figma/dark.json similarity index 79% rename from styles/figma/dark.json rename to styles/src/figma/dark.json index 568f53b8154003fb1805de4c2ae420f0f2a94e89..28c27bfc23c2b520360f74634c6bd453643f58aa 100644 --- a/styles/figma/dark.json +++ b/styles/src/figma/dark.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#2db4f3", + "value": "#1096d3", "step": 500, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "warning": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#2db4f3", + "value": "#1096d3", "step": 500, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#f7b241", + "value": "#f6a724", "step": 400, "type": "color" }, "info": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" } @@ -175,88 +175,88 @@ }, "ok": { "base": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "hovered": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "active": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "focused": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" } }, "error": { "base": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "hovered": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "active": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "focused": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" } }, "warning": { "base": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "hovered": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "active": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "focused": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" } }, "info": { "base": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "hovered": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "active": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "focused": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#23d464", + "value": "#20b456", "step": 500, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#f59f0c", + "value": "#de900c", "step": 500, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -337,35 +337,35 @@ "type": "color" }, "inserted": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "deleted": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "modified": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } }, "highlight": { "selection": { - "value": "#d0e2fd", - "step": 100, + "value": "#103063", + "step": 800, "type": "color" }, "occurrence": { - "value": "#777af4", - "step": 500, + "value": "#2b2b2b", + "step": 750, "type": "color" }, "activeOccurrence": { - "value": "#8f90f6", - "step": 400, + "value": "#393939", + "step": 700, "type": "color" }, "matchingBracket": { @@ -374,13 +374,13 @@ "type": "color" }, "match": { - "value": "#87d116", - "step": 500, + "value": "#0a2633", + "step": 900, "type": "color" }, "activeMatch": { - "value": "#90df17", - "step": 400, + "value": "#0e4158", + "step": 800, "type": "color" }, "related": { @@ -404,227 +404,227 @@ }, "syntax": { "primary": { - "value": "#f1f1f1", + "value": "#d5d5d5", "type": "color" }, "comment": { - "value": "#bdf36b", + "value": "#aaaaaa", "type": "color" }, "keyword": { - "value": "#59c3f5", + "value": "#4f8ff7", "type": "color" }, "function": { - "value": "#fadc89", + "value": "#f9da82", "type": "color" }, "type": { - "value": "#26ebd5", + "value": "#3eeeda", "type": "color" }, "variant": { - "value": "#26ebd5", + "value": "#53c1f5", "type": "color" }, "property": { - "value": "#81d2f8", + "value": "#4f8ff7", "type": "color" }, "enum": { - "value": "#59c3f5", + "value": "#ee670a", "type": "color" }, "operator": { - "value": "#59c3f5", + "value": "#ee670a", "type": "color" }, "string": { - "value": "#fab78b", + "value": "#f99d5f", "type": "color" }, "number": { - "value": "#d5d5d5", + "value": "#aeef4b", "type": "color" }, "boolean": { - "value": "#d5d5d5", + "value": "#aeef4b", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#4287f6", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "cursorColor": { - "value": "#4287f6", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "selectionColor": { - "value": "#d0e2fd", - "step": 100, + "value": "#103063", + "step": 800, "type": "color" }, "borderColor": { - "value": "#4287f6", - "step": 600, + "value": "#103063", + "step": 800, "type": "color" } }, "2": { "baseColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "cursorColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "selectionColor": { - "value": "#dbf9ac", - "step": 100, + "value": "#38530f", + "step": 800, "type": "color" }, "borderColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "cursorColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d4d5fd", - "step": 100, + "value": "#121269", + "step": 800, "type": "color" }, "borderColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "cursorColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "selectionColor": { - "value": "#fde0cd", - "step": 100, + "value": "#5d2f0e", + "step": 800, "type": "color" }, "borderColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "cursorColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "selectionColor": { - "value": "#e9d4fd", - "step": 100, + "value": "#3e1169", + "step": 800, "type": "color" }, "borderColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "cursorColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "selectionColor": { - "value": "#b4faf2", - "step": 100, + "value": "#0e4f48", + "step": 800, "type": "color" }, "borderColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd4e8", + "value": "#fbc6e1", "step": 100, "type": "color" }, "borderColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "borderColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" } diff --git a/styles/figma/light.json b/styles/src/figma/light.json similarity index 80% rename from styles/figma/light.json rename to styles/src/figma/light.json index c8ef9e5dcd69332fc33abda730f08b7f7190d574..f4ed9e74013880772816eac62e9d934eb607c6c6 100644 --- a/styles/figma/light.json +++ b/styles/src/figma/light.json @@ -29,27 +29,27 @@ "type": "color" }, "feature": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "ok": { - "value": "#23d464", + "value": "#20b456", "step": 500, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#e5af09", + "value": "#d3a20b", "step": 500, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -81,27 +81,27 @@ "type": "color" }, "feature": { - "value": "#0ea5e8", + "value": "#1179a8", "step": 600, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f15252", + "value": "#c91818", "step": 600, "type": "color" }, "warning": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "info": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" } @@ -158,105 +158,105 @@ "type": "color" }, "hovered": { - "value": "#f1f1f1", - "step": 50, + "value": "#f8f8f8", + "step": 25, "type": "color" }, "active": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "focused": { - "value": "#f1f1f1", - "step": 50, + "value": "#eaeaea", + "step": 75, "type": "color" } }, "ok": { "base": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "hovered": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "active": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "focused": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" } }, "error": { "base": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "hovered": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "active": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "focused": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" } }, "warning": { "base": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "hovered": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "active": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "focused": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" } }, "info": { "base": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "hovered": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "active": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "focused": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" } @@ -289,22 +289,22 @@ "type": "color" }, "ok": { - "value": "#8ff4b2", + "value": "#84f2ab", "step": 200, "type": "color" }, "error": { - "value": "#fbbdbd", + "value": "#f9a0a0", "step": 200, "type": "color" }, "warning": { - "value": "#fadc89", + "value": "#f9da82", "step": 200, "type": "color" }, "info": { - "value": "#b4cffb", + "value": "#9ec1fa", "step": 200, "type": "color" } @@ -327,40 +327,40 @@ }, "line": { "active": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "highlighted": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "inserted": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "deleted": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "modified": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" } }, "highlight": { "selection": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "occurrence": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "activeOccurrence": { @@ -391,8 +391,8 @@ }, "gutter": { "primary": { - "value": "#808080", - "step": 450, + "value": "#aaaaaa", + "step": 300, "type": "color" }, "active": { @@ -408,223 +408,223 @@ "type": "color" }, "comment": { - "value": "#bdf36b", + "value": "#555555", "type": "color" }, "keyword": { - "value": "#59c3f5", + "value": "#103063", "type": "color" }, "function": { - "value": "#fadc89", + "value": "#1b9447", "type": "color" }, "type": { - "value": "#26ebd5", + "value": "#138a7d", "type": "color" }, "variant": { - "value": "#26ebd5", + "value": "#1179a8", "type": "color" }, "property": { - "value": "#81d2f8", + "value": "#134697", "type": "color" }, "enum": { - "value": "#59c3f5", + "value": "#bb550e", "type": "color" }, "operator": { - "value": "#59c3f5", + "value": "#bb550e", "type": "color" }, "string": { - "value": "#fab78b", + "value": "#bb550e", "type": "color" }, "number": { - "value": "#d5d5d5", + "value": "#14a898", "type": "color" }, "boolean": { - "value": "#d5d5d5", + "value": "#b0740f", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" }, "cursorColor": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "borderColor": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "cursorColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "selectionColor": { - "value": "#dbf9ac", + "value": "#dffab5", "step": 100, "type": "color" }, "borderColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "cursorColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d4d5fd", + "value": "#cdcdfc", "step": 100, "type": "color" }, "borderColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "cursorColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "selectionColor": { - "value": "#fde0cd", + "value": "#fcd6bd", "step": 100, "type": "color" }, "borderColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "cursorColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "selectionColor": { - "value": "#e9d4fd", + "value": "#e4cbfc", "step": 100, "type": "color" }, "borderColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "cursorColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "selectionColor": { - "value": "#b4faf2", + "value": "#b1faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd4e8", + "value": "#fbc6e1", "step": 100, "type": "color" }, "borderColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "borderColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" } diff --git a/styles/figma/tokens.json b/styles/src/figma/tokens.json similarity index 80% rename from styles/figma/tokens.json rename to styles/src/figma/tokens.json index cffc3ed16de7a4dec1fa38fa2026243c81629055..79f3737ef6dea28f3e7cb823f1f2a42f129ee571 100644 --- a/styles/figma/tokens.json +++ b/styles/src/figma/tokens.json @@ -195,47 +195,47 @@ "type": "color" }, "100": { - "value": "#fdd5db", + "value": "#fcc5cf", "step": 100, "type": "color" }, "200": { - "value": "#fbbdc8", + "value": "#fa9fae", "step": 200, "type": "color" }, "300": { - "value": "#faa4b3", + "value": "#f8788e", "step": 300, "type": "color" }, "400": { - "value": "#f98a9d", + "value": "#f5526e", "step": 400, "type": "color" }, "500": { - "value": "#f76e86", + "value": "#f0284a", "step": 500, "type": "color" }, "600": { - "value": "#f54c69", + "value": "#cd1434", "step": 600, "type": "color" }, "700": { - "value": "#ec2548", + "value": "#97142a", "step": 700, "type": "color" }, "800": { - "value": "#d21939", + "value": "#64101e", "step": 800, "type": "color" }, "900": { - "value": "#b41a35", + "value": "#330a11", "step": 900, "type": "color" } @@ -247,47 +247,47 @@ "type": "color" }, "100": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "200": { - "value": "#fbbdbd", + "value": "#f9a0a0", "step": 200, "type": "color" }, "300": { - "value": "#f9a5a5", + "value": "#f57b7b", "step": 300, "type": "color" }, "400": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "500": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "600": { - "value": "#f15252", + "value": "#c91818", "step": 600, "type": "color" }, "700": { - "value": "#e82c2c", + "value": "#951515", "step": 700, "type": "color" }, "800": { - "value": "#d11c1c", + "value": "#631111", "step": 800, "type": "color" }, "900": { - "value": "#b21c1c", + "value": "#330a0a", "step": 900, "type": "color" } @@ -299,47 +299,47 @@ "type": "color" }, "100": { - "value": "#fde0cd", + "value": "#fcd6bd", "step": 100, "type": "color" }, "200": { - "value": "#fbccac", + "value": "#fab98e", "step": 200, "type": "color" }, "300": { - "value": "#fab78b", + "value": "#f99d5f", "step": 300, "type": "color" }, "400": { - "value": "#faa266", + "value": "#f9812e", "step": 400, "type": "color" }, "500": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "600": { - "value": "#f77113", + "value": "#bb550e", "step": 600, "type": "color" }, "700": { - "value": "#e0650f", + "value": "#8b4210", "step": 700, "type": "color" }, "800": { - "value": "#c65d14", + "value": "#5d2f0e", "step": 800, "type": "color" }, "900": { - "value": "#ac5517", + "value": "#331b0a", "step": 900, "type": "color" } @@ -351,47 +351,47 @@ "type": "color" }, "100": { - "value": "#fce7c4", + "value": "#fce2ba", "step": 100, "type": "color" }, "200": { - "value": "#fad69d", + "value": "#f9ce89", "step": 200, "type": "color" }, "300": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "400": { - "value": "#f7b241", + "value": "#f6a724", "step": 400, "type": "color" }, "500": { - "value": "#f59f0c", + "value": "#de900c", "step": 500, "type": "color" }, "600": { - "value": "#e1930e", + "value": "#b0740f", "step": 600, "type": "color" }, "700": { - "value": "#cd8812", + "value": "#845910", "step": 700, "type": "color" }, "800": { - "value": "#ba7d15", + "value": "#5a3e0e", "step": 800, "type": "color" }, "900": { - "value": "#a77218", + "value": "#33240a", "step": 900, "type": "color" } @@ -403,47 +403,47 @@ "type": "color" }, "100": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "200": { - "value": "#fadc89", + "value": "#f9da82", "step": 200, "type": "color" }, "300": { - "value": "#f8cc4e", + "value": "#f8cc4d", "step": 300, "type": "color" }, "400": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "500": { - "value": "#e5af09", + "value": "#d3a20b", "step": 500, "type": "color" }, "600": { - "value": "#d4a30d", + "value": "#a8820e", "step": 600, "type": "color" }, "700": { - "value": "#c49811", + "value": "#7e630f", "step": 700, "type": "color" }, "800": { - "value": "#b48d14", + "value": "#58460e", "step": 800, "type": "color" }, "900": { - "value": "#a48117", + "value": "#33290a", "step": 900, "type": "color" } @@ -455,47 +455,47 @@ "type": "color" }, "100": { - "value": "#dbf9ac", + "value": "#dffab5", "step": 100, "type": "color" }, "200": { - "value": "#bdf36b", + "value": "#c7f57f", "step": 200, "type": "color" }, "300": { - "value": "#9feb2b", + "value": "#aeef4b", "step": 300, "type": "color" }, "400": { - "value": "#90df17", + "value": "#96e818", "step": 400, "type": "color" }, "500": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "600": { - "value": "#7fc417", + "value": "#639714", "step": 600, "type": "color" }, "700": { - "value": "#78b618", + "value": "#4e7412", "step": 700, "type": "color" }, "800": { - "value": "#70aa19", + "value": "#38530f", "step": 800, "type": "color" }, "900": { - "value": "#699c1a", + "value": "#23330a", "step": 900, "type": "color" } @@ -507,47 +507,47 @@ "type": "color" }, "100": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "200": { - "value": "#8ff4b2", + "value": "#84f2ab", "step": 200, "type": "color" }, "300": { - "value": "#60ec92", + "value": "#54e989", "step": 300, "type": "color" }, "400": { - "value": "#34e173", + "value": "#27dd69", "step": 400, "type": "color" }, "500": { - "value": "#23d464", + "value": "#20b456", "step": 500, "type": "color" }, "600": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "700": { - "value": "#20b658", + "value": "#157338", "step": 700, "type": "color" }, "800": { - "value": "#1ea851", + "value": "#105328", "step": 800, "type": "color" }, "900": { - "value": "#1d9b4b", + "value": "#0a3319", "step": 900, "type": "color" } @@ -559,47 +559,47 @@ "type": "color" }, "100": { - "value": "#b3fbe3", + "value": "#b0fae1", "step": 100, "type": "color" }, "200": { - "value": "#72f6ca", + "value": "#74f6cb", "step": 200, "type": "color" }, "300": { - "value": "#1feda9", + "value": "#39f0b3", "step": 300, "type": "color" }, "400": { - "value": "#12e09b", + "value": "#12d796", "step": 400, "type": "color" }, "500": { - "value": "#11d091", + "value": "#10a977", "step": 500, "type": "color" }, "600": { - "value": "#11c287", + "value": "#118a62", "step": 600, "type": "color" }, "700": { - "value": "#11b37e", + "value": "#106c4e", "step": 700, "type": "color" }, "800": { - "value": "#15a575", + "value": "#0d4f3a", "step": 800, "type": "color" }, "900": { - "value": "#18976c", + "value": "#0a3326", "step": 900, "type": "color" } @@ -611,47 +611,47 @@ "type": "color" }, "100": { - "value": "#b4faf2", + "value": "#b1faf2", "step": 100, "type": "color" }, "200": { - "value": "#73f4e6", + "value": "#76f5e7", "step": 200, "type": "color" }, "300": { - "value": "#26ebd5", + "value": "#3eeeda", "step": 300, "type": "color" }, "400": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "500": { - "value": "#15cfba", + "value": "#14a898", "step": 500, "type": "color" }, "600": { - "value": "#15c1ae", + "value": "#138a7d", "step": 600, "type": "color" }, "700": { - "value": "#15b2a1", + "value": "#116c62", "step": 700, "type": "color" }, "800": { - "value": "#17a495", + "value": "#0e4f48", "step": 800, "type": "color" }, "900": { - "value": "#199788", + "value": "#0a332f", "step": 900, "type": "color" } @@ -663,17 +663,17 @@ "type": "color" }, "100": { - "value": "#bcf5fc", + "value": "#b2f3fb", "step": 100, "type": "color" }, "200": { - "value": "#86edfa", + "value": "#78eaf9", "step": 200, "type": "color" }, "300": { - "value": "#41e3f8", + "value": "#3de2f8", "step": 300, "type": "color" }, @@ -683,27 +683,27 @@ "type": "color" }, "500": { - "value": "#07c7e1", + "value": "#09aac0", "step": 500, "type": "color" }, "600": { - "value": "#07b8d0", + "value": "#0c8a9a", "step": 600, "type": "color" }, "700": { - "value": "#0daabf", + "value": "#0e6a75", "step": 700, "type": "color" }, "800": { - "value": "#119bae", + "value": "#0d4c53", "step": 800, "type": "color" }, "900": { - "value": "#168e9e", + "value": "#0a2f33", "step": 900, "type": "color" } @@ -715,47 +715,47 @@ "type": "color" }, "100": { - "value": "#caecfc", + "value": "#b9e5fb", "step": 100, "type": "color" }, "200": { - "value": "#a6defa", + "value": "#86d3f8", "step": 200, "type": "color" }, "300": { - "value": "#81d2f8", + "value": "#53c1f5", "step": 300, "type": "color" }, "400": { - "value": "#59c3f5", + "value": "#20b0f2", "step": 400, "type": "color" }, "500": { - "value": "#2db4f3", + "value": "#1096d3", "step": 500, "type": "color" }, "600": { - "value": "#0ea5e8", + "value": "#1179a8", "step": 600, "type": "color" }, "700": { - "value": "#1296d1", + "value": "#115c7f", "step": 700, "type": "color" }, "800": { - "value": "#1686ba", + "value": "#0e4158", "step": 800, "type": "color" }, "900": { - "value": "#1878a4", + "value": "#0a2633", "step": 900, "type": "color" } @@ -767,47 +767,47 @@ "type": "color" }, "100": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "200": { - "value": "#b4cffb", + "value": "#9ec1fa", "step": 200, "type": "color" }, "300": { - "value": "#99befa", + "value": "#76a8f8", "step": 300, "type": "color" }, "400": { - "value": "#7cacf9", + "value": "#4f8ff7", "step": 400, "type": "color" }, "500": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "600": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" }, "700": { - "value": "#2774f0", + "value": "#134697", "step": 700, "type": "color" }, "800": { - "value": "#1762db", + "value": "#103063", "step": 800, "type": "color" }, "900": { - "value": "#1a55b4", + "value": "#0a1a33", "step": 900, "type": "color" } @@ -819,47 +819,47 @@ "type": "color" }, "100": { - "value": "#d4d5fd", + "value": "#cdcdfc", "step": 100, "type": "color" }, "200": { - "value": "#bebefb", + "value": "#aeaff9", "step": 200, "type": "color" }, "300": { - "value": "#a7a8f9", + "value": "#9091f6", "step": 300, "type": "color" }, "400": { - "value": "#8f90f6", + "value": "#7274f3", "step": 400, "type": "color" }, "500": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "600": { - "value": "#5f62f0", + "value": "#1b1edc", "step": 600, "type": "color" }, "700": { - "value": "#464aeb", + "value": "#1819a1", "step": 700, "type": "color" }, "800": { - "value": "#292de4", + "value": "#121269", "step": 800, "type": "color" }, "900": { - "value": "#1d20bb", + "value": "#0a0a33", "step": 900, "type": "color" } @@ -871,47 +871,47 @@ "type": "color" }, "100": { - "value": "#e0d5fd", + "value": "#daccfc", "step": 100, "type": "color" }, "200": { - "value": "#cfbcfb", + "value": "#c3acfb", "step": 200, "type": "color" }, "300": { - "value": "#bda4fa", + "value": "#ac8cf9", "step": 300, "type": "color" }, "400": { - "value": "#ad8cf9", + "value": "#966cf7", "step": 400, "type": "color" }, "500": { - "value": "#9b73f7", + "value": "#7741f2", "step": 500, "type": "color" }, "600": { - "value": "#8959f6", + "value": "#5316e0", "step": 600, "type": "color" }, "700": { - "value": "#7540f0", + "value": "#3f15a3", "step": 700, "type": "color" }, "800": { - "value": "#5e22e7", + "value": "#2b116a", "step": 800, "type": "color" }, "900": { - "value": "#4c1bbc", + "value": "#160a33", "step": 900, "type": "color" } @@ -923,47 +923,47 @@ "type": "color" }, "100": { - "value": "#e9d4fd", + "value": "#e4cbfc", "step": 100, "type": "color" }, "200": { - "value": "#dcbcfc", + "value": "#d2a9fb", "step": 200, "type": "color" }, "300": { - "value": "#d0a4fa", + "value": "#c188f9", "step": 300, "type": "color" }, "400": { - "value": "#c38bf9", + "value": "#b066f8", "step": 400, "type": "color" }, "500": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "600": { - "value": "#a856f7", + "value": "#7b14dd", "step": 600, "type": "color" }, "700": { - "value": "#9739f1", + "value": "#5c14a1", "step": 700, "type": "color" }, "800": { - "value": "#831ae6", + "value": "#3e1169", "step": 800, "type": "color" }, "900": { - "value": "#6d1bbb", + "value": "#1f0a33", "step": 900, "type": "color" } @@ -975,47 +975,47 @@ "type": "color" }, "100": { - "value": "#fad4fc", + "value": "#f8c5fb", "step": 100, "type": "color" }, "200": { - "value": "#f6bbfa", + "value": "#f19ff6", "step": 200, "type": "color" }, "300": { - "value": "#f1a2f7", + "value": "#e87af0", "step": 300, "type": "color" }, "400": { - "value": "#ec8af3", + "value": "#de57e8", "step": 400, "type": "color" }, "500": { - "value": "#e56fee", + "value": "#d430e0", "step": 500, "type": "color" }, "600": { - "value": "#dd51e7", + "value": "#b31fbc", "step": 600, "type": "color" }, "700": { - "value": "#d32edf", + "value": "#87198e", "step": 700, "type": "color" }, "800": { - "value": "#bc21c8", + "value": "#5c1260", "step": 800, "type": "color" }, "900": { - "value": "#a41ead", + "value": "#310a33", "step": 900, "type": "color" } @@ -1027,47 +1027,47 @@ "type": "color" }, "100": { - "value": "#fcd4e8", + "value": "#fbc6e1", "step": 100, "type": "color" }, "200": { - "value": "#fbbcdb", + "value": "#f8a1cc", "step": 200, "type": "color" }, "300": { - "value": "#f8a5ce", + "value": "#f47db8", "step": 300, "type": "color" }, "400": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "500": { - "value": "#f26fb0", + "value": "#e8318c", "step": 500, "type": "color" }, "600": { - "value": "#ee519e", + "value": "#c71a71", "step": 600, "type": "color" }, "700": { - "value": "#e52e89", + "value": "#941756", "step": 700, "type": "color" }, "800": { - "value": "#ce1e76", + "value": "#63113b", "step": 800, "type": "color" }, "900": { - "value": "#b21d67", + "value": "#330a1f", "step": 900, "type": "color" } @@ -1185,27 +1185,27 @@ "type": "color" }, "feature": { - "value": "#2db4f3", + "value": "#1096d3", "step": 500, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "warning": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -1237,27 +1237,27 @@ "type": "color" }, "feature": { - "value": "#2db4f3", + "value": "#1096d3", "step": 500, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#f7b241", + "value": "#f6a724", "step": 400, "type": "color" }, "info": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" } @@ -1331,88 +1331,88 @@ }, "ok": { "base": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "hovered": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "active": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "focused": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" } }, "error": { "base": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "hovered": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "active": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "focused": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" } }, "warning": { "base": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "hovered": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "active": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" }, "focused": { - "value": "#f8c570", + "value": "#f7bb57", "step": 300, "type": "color" } }, "info": { "base": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "hovered": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "active": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "focused": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -1445,22 +1445,22 @@ "type": "color" }, "ok": { - "value": "#23d464", + "value": "#20b456", "step": 500, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#f59f0c", + "value": "#de900c", "step": 500, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -1493,35 +1493,35 @@ "type": "color" }, "inserted": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "deleted": { - "value": "#f78c8c", + "value": "#f15656", "step": 400, "type": "color" }, "modified": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } }, "highlight": { "selection": { - "value": "#d0e2fd", - "step": 100, + "value": "#103063", + "step": 800, "type": "color" }, "occurrence": { - "value": "#777af4", - "step": 500, + "value": "#2b2b2b", + "step": 750, "type": "color" }, "activeOccurrence": { - "value": "#8f90f6", - "step": 400, + "value": "#393939", + "step": 700, "type": "color" }, "matchingBracket": { @@ -1530,13 +1530,13 @@ "type": "color" }, "match": { - "value": "#87d116", - "step": 500, + "value": "#0a2633", + "step": 900, "type": "color" }, "activeMatch": { - "value": "#90df17", - "step": 400, + "value": "#0e4158", + "step": 800, "type": "color" }, "related": { @@ -1560,227 +1560,227 @@ }, "syntax": { "primary": { - "value": "#f1f1f1", + "value": "#d5d5d5", "type": "color" }, "comment": { - "value": "#bdf36b", + "value": "#aaaaaa", "type": "color" }, "keyword": { - "value": "#59c3f5", + "value": "#4f8ff7", "type": "color" }, "function": { - "value": "#fadc89", + "value": "#f9da82", "type": "color" }, "type": { - "value": "#26ebd5", + "value": "#3eeeda", "type": "color" }, "variant": { - "value": "#26ebd5", + "value": "#53c1f5", "type": "color" }, "property": { - "value": "#81d2f8", + "value": "#4f8ff7", "type": "color" }, "enum": { - "value": "#59c3f5", + "value": "#ee670a", "type": "color" }, "operator": { - "value": "#59c3f5", + "value": "#ee670a", "type": "color" }, "string": { - "value": "#fab78b", + "value": "#f99d5f", "type": "color" }, "number": { - "value": "#d5d5d5", + "value": "#aeef4b", "type": "color" }, "boolean": { - "value": "#d5d5d5", + "value": "#aeef4b", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#4287f6", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "cursorColor": { - "value": "#4287f6", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "selectionColor": { - "value": "#d0e2fd", - "step": 100, + "value": "#103063", + "step": 800, "type": "color" }, "borderColor": { - "value": "#4287f6", - "step": 600, + "value": "#103063", + "step": 800, "type": "color" } }, "2": { "baseColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "cursorColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "selectionColor": { - "value": "#dbf9ac", - "step": 100, + "value": "#38530f", + "step": 800, "type": "color" }, "borderColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "cursorColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d4d5fd", - "step": 100, + "value": "#121269", + "step": 800, "type": "color" }, "borderColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "cursorColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "selectionColor": { - "value": "#fde0cd", - "step": 100, + "value": "#5d2f0e", + "step": 800, "type": "color" }, "borderColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "cursorColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "selectionColor": { - "value": "#e9d4fd", - "step": 100, + "value": "#3e1169", + "step": 800, "type": "color" }, "borderColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "cursorColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "selectionColor": { - "value": "#b4faf2", - "step": 100, + "value": "#0e4f48", + "step": 800, "type": "color" }, "borderColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd4e8", + "value": "#fbc6e1", "step": 100, "type": "color" }, "borderColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "borderColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" } @@ -1822,27 +1822,27 @@ "type": "color" }, "feature": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "ok": { - "value": "#23d464", + "value": "#20b456", "step": 500, "type": "color" }, "error": { - "value": "#f47171", + "value": "#eb2d2d", "step": 500, "type": "color" }, "warning": { - "value": "#e5af09", + "value": "#d3a20b", "step": 500, "type": "color" }, "info": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } @@ -1874,27 +1874,27 @@ "type": "color" }, "feature": { - "value": "#0ea5e8", + "value": "#1179a8", "step": 600, "type": "color" }, "ok": { - "value": "#22c55e", + "value": "#1b9447", "step": 600, "type": "color" }, "error": { - "value": "#f15252", + "value": "#c91818", "step": 600, "type": "color" }, "warning": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "info": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" } @@ -1951,105 +1951,105 @@ "type": "color" }, "hovered": { - "value": "#f1f1f1", - "step": 50, + "value": "#f8f8f8", + "step": 25, "type": "color" }, "active": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "focused": { - "value": "#f1f1f1", - "step": 50, + "value": "#eaeaea", + "step": 75, "type": "color" } }, "ok": { "base": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "hovered": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "active": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "focused": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" } }, "error": { "base": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "hovered": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "active": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "focused": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" } }, "warning": { "base": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "hovered": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "active": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "focused": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" } }, "info": { "base": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "hovered": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "active": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "focused": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" } @@ -2082,22 +2082,22 @@ "type": "color" }, "ok": { - "value": "#8ff4b2", + "value": "#84f2ab", "step": 200, "type": "color" }, "error": { - "value": "#fbbdbd", + "value": "#f9a0a0", "step": 200, "type": "color" }, "warning": { - "value": "#fadc89", + "value": "#f9da82", "step": 200, "type": "color" }, "info": { - "value": "#b4cffb", + "value": "#9ec1fa", "step": 200, "type": "color" } @@ -2120,40 +2120,40 @@ }, "line": { "active": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "highlighted": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "inserted": { - "value": "#befad2", + "value": "#b7f9ce", "step": 100, "type": "color" }, "deleted": { - "value": "#fdd4d4", + "value": "#fcc6c6", "step": 100, "type": "color" }, "modified": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" } }, "highlight": { "selection": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "occurrence": { - "value": "#e3e3e3", - "step": 100, + "value": "#f1f1f1", + "step": 50, "type": "color" }, "activeOccurrence": { @@ -2184,8 +2184,8 @@ }, "gutter": { "primary": { - "value": "#808080", - "step": 450, + "value": "#aaaaaa", + "step": 300, "type": "color" }, "active": { @@ -2201,223 +2201,223 @@ "type": "color" }, "comment": { - "value": "#bdf36b", + "value": "#555555", "type": "color" }, "keyword": { - "value": "#59c3f5", + "value": "#103063", "type": "color" }, "function": { - "value": "#fadc89", + "value": "#1b9447", "type": "color" }, "type": { - "value": "#26ebd5", + "value": "#138a7d", "type": "color" }, "variant": { - "value": "#26ebd5", + "value": "#1179a8", "type": "color" }, "property": { - "value": "#81d2f8", + "value": "#134697", "type": "color" }, "enum": { - "value": "#59c3f5", + "value": "#bb550e", "type": "color" }, "operator": { - "value": "#59c3f5", + "value": "#bb550e", "type": "color" }, "string": { - "value": "#fab78b", + "value": "#bb550e", "type": "color" }, "number": { - "value": "#d5d5d5", + "value": "#14a898", "type": "color" }, "boolean": { - "value": "#d5d5d5", + "value": "#b0740f", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#4287f6", + "value": "#135acd", "step": 600, "type": "color" }, "cursorColor": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d0e2fd", + "value": "#c5dafc", "step": 100, "type": "color" }, "borderColor": { - "value": "#6099f7", + "value": "#2472f2", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "cursorColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" }, "selectionColor": { - "value": "#dbf9ac", + "value": "#dffab5", "step": 100, "type": "color" }, "borderColor": { - "value": "#87d116", + "value": "#79ba16", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "cursorColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" }, "selectionColor": { - "value": "#d4d5fd", + "value": "#cdcdfc", "step": 100, "type": "color" }, "borderColor": { - "value": "#777af4", + "value": "#484bed", "step": 500, "type": "color" } }, "4": { "baseColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "cursorColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" }, "selectionColor": { - "value": "#fde0cd", + "value": "#fcd6bd", "step": 100, "type": "color" }, "borderColor": { - "value": "#f98a3d", + "value": "#ee670a", "step": 500, "type": "color" } }, "5": { "baseColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "cursorColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" }, "selectionColor": { - "value": "#e9d4fd", + "value": "#e4cbfc", "step": 100, "type": "color" }, "borderColor": { - "value": "#b671f8", + "value": "#993bf3", "step": 500, "type": "color" } }, "6": { "baseColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "cursorColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" }, "selectionColor": { - "value": "#b4faf2", + "value": "#b1faf2", "step": 100, "type": "color" }, "borderColor": { - "value": "#16ddc7", + "value": "#16d6c1", "step": 400, "type": "color" } }, "7": { "baseColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd4e8", + "value": "#fbc6e1", "step": 100, "type": "color" }, "borderColor": { - "value": "#f58ac0", + "value": "#ef59a3", "step": 400, "type": "color" } }, "8": { "baseColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "cursorColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" }, "selectionColor": { - "value": "#fceabc", + "value": "#fce9b7", "step": 100, "type": "color" }, "borderColor": { - "value": "#f6bc09", + "value": "#f7bf17", "step": 400, "type": "color" } diff --git a/styles/styleTree/app.ts b/styles/src/styleTree/app.ts similarity index 91% rename from styles/styleTree/app.ts rename to styles/src/styleTree/app.ts index 10439b5a0056e8f8ac6ec29e10b4094f1aae26a8..85bb8b09b83df5515862758e58dac66e524bffcc 100644 --- a/styles/styleTree/app.ts +++ b/styles/src/styleTree/app.ts @@ -21,9 +21,7 @@ export default function app(theme: Theme): Object { tabIconSpacing: 4, tabIconWidth: 13, tabSummarySpacing: 10, - emptyMessage: { - ...text(theme, "sans", "primary", { size: "lg" }), - }, + emptyMessage: text(theme, "sans", "primary", { size: "lg" }), statusBarItem: { ...text(theme, "sans", "muted"), margin: { diff --git a/styles/src/styleTree/chatPanel.ts b/styles/src/styleTree/chatPanel.ts new file mode 100644 index 0000000000000000000000000000000000000000..6bcf38ec06afabd72d7107266c10ef1704862bc7 --- /dev/null +++ b/styles/src/styleTree/chatPanel.ts @@ -0,0 +1,108 @@ +import Theme from "../themes/theme"; +import { panel } from "./app"; +import { + backgroundColor, + border, + player, + shadow, + text, + TextColor +} from "./components"; + +export default function chatPanel(theme: Theme) { + function channelSelectItem( + theme: Theme, + textColor: TextColor, + hovered: boolean + ) { + return { + name: text(theme, "sans", textColor), + padding: 4, + hash: { + ...text(theme, "sans", "muted"), + margin: { + right: 8, + }, + }, + background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, + cornerRadius: hovered ? 6 : 0, + }; + } + + const message = { + body: text(theme, "sans", "secondary"), + timestamp: text(theme, "sans", "muted", { size: "sm" }), + padding: { + bottom: 6, + }, + sender: { + ...text(theme, "sans", "primary", { weight: "bold" }), + margin: { + right: 8, + }, + }, + }; + + return { + ...panel, + channelName: text(theme, "sans", "primary", { weight: "bold" }), + channelNameHash: { + ...text(theme, "sans", "muted"), + padding: { + right: 8, + }, + }, + channelSelect: { + header: { + ...channelSelectItem(theme, "primary", false), + padding: { + bottom: 4, + left: 0, + }, + }, + item: channelSelectItem(theme, "secondary", false), + hoveredItem: channelSelectItem(theme, "secondary", true), + activeItem: channelSelectItem(theme, "primary", false), + hoveredActiveItem: channelSelectItem(theme, "primary", true), + menu: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 4, + border: border(theme, "primary"), + shadow: shadow(theme), + }, + }, + signInPrompt: text(theme, "sans", "secondary", { underline: true }), + hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), + message, + pendingMessage: { + ...message, + body: { + ...message.body, + color: theme.textColor.muted.value, + }, + sender: { + ...message.sender, + color: theme.textColor.muted.value, + }, + timestamp: { + ...message.timestamp, + color: theme.textColor.muted.value, + }, + }, + inputEditor: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + text: text(theme, "mono", "primary"), + placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), + selection: player(theme, 1).selection, + border: border(theme, "secondary"), + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + }; +} diff --git a/styles/src/styleTree/components.ts b/styles/src/styleTree/components.ts new file mode 100644 index 0000000000000000000000000000000000000000..155d36d312b753ac8ff8c95d04e90d1a603595fc --- /dev/null +++ b/styles/src/styleTree/components.ts @@ -0,0 +1,96 @@ +import chroma from "chroma-js"; +import Theme, { BackgroundColor } from "../themes/theme"; +import { fontFamilies, fontSizes, FontFamily, FontWeight, FontSize } from "../tokens"; +import { Color } from "../utils/color"; + +export type TextColor = keyof Theme["textColor"]; +export interface Text { + family: FontFamily, + color: Color, + size: FontSize, + weight?: FontWeight, + underline?: boolean, +} +export function text( + theme: Theme, + fontFamily: keyof typeof fontFamilies, + color: TextColor, + properties?: { + size?: keyof typeof fontSizes; + weight?: FontWeight; + underline?: boolean; + } +): Text { + let extraProperties = { + ...properties, + size: fontSizes[properties.size || "sm"].value, + }; + return { + family: fontFamilies[fontFamily].value, + color: theme.textColor[color].value, + ...extraProperties, + }; +} + +export interface BorderOptions { + width?: number; + top?: boolean; + bottom?: boolean; + left?: boolean; + right?: boolean; + overlay?: boolean; +} +export function border( + theme: Theme, + color: keyof Theme["borderColor"], + options?: BorderOptions +) { + return { + color: borderColor(theme, color), + width: 1, + ...options, + }; +} + +export function borderColor(theme: Theme, color: keyof Theme["borderColor"]) { + return theme.borderColor[color].value; +} + +export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { + return theme.iconColor[color].value; +} + +export interface Player { + selection: { + cursor: Color; + selection: Color; + }; +} + +export function player( + theme: Theme, + playerNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 +): Player { + return { + selection: { + cursor: theme.player[playerNumber].cursorColor.value, + selection: theme.player[playerNumber].selectionColor.value, + }, + }; +} + +export function backgroundColor( + theme: Theme, + name: keyof Theme["backgroundColor"], + state?: keyof BackgroundColor +): Color { + return theme.backgroundColor[name][state || "base"].value; +} + +export function shadow(theme: Theme) { + return { + blur: 16, + color: chroma("black").alpha(theme.shadowAlpha.value).hex(), + offset: [0, 2], + }; +} diff --git a/styles/styleTree/contactsPanel.ts b/styles/src/styleTree/contactsPanel.ts similarity index 100% rename from styles/styleTree/contactsPanel.ts rename to styles/src/styleTree/contactsPanel.ts diff --git a/styles/styleTree/editor.ts b/styles/src/styleTree/editor.ts similarity index 97% rename from styles/styleTree/editor.ts rename to styles/src/styleTree/editor.ts index 23c1e67ac6e6c1dcc75e1d638e760184bfc66e0f..33bfbf0cc623ea0ae657efe83f04744d33c51308 100644 --- a/styles/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -46,7 +46,7 @@ export default function editor(theme: Theme) { diffBackgroundDeleted: backgroundColor(theme, "error"), diffBackgroundInserted: backgroundColor(theme, "ok"), documentHighlightReadBackground: theme.editor.highlight.occurrence.value, - documentHighlightWriteBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.activeOccurrence.value, errorColor: theme.textColor.error.value, gutterBackground: backgroundColor(theme, 500), gutterPaddingFactor: 3.5, @@ -129,7 +129,7 @@ export default function editor(theme: Theme) { invalidInformationDiagnostic: diagnostic(theme, "muted"), invalidWarningDiagnostic: diagnostic(theme, "muted"), syntax: { - keyword: theme.syntax.keyword.color.value, + keyword: theme.syntax.keyword.color.value, function: theme.syntax.function.color.value, string: theme.syntax.string.color.value, type: theme.syntax.type.color.value, @@ -143,7 +143,7 @@ export default function editor(theme: Theme) { "emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" }, link_uri: { color: theme.syntax.linkUrl.color.value, underline: true }, link_text: { color: theme.syntax.linkText.color.value, italic: true }, - list_marker: theme.syntax.listMarker.color.value, + list_marker: theme.syntax.punctuation.color.value, }, }; } diff --git a/styles/src/styleTree/projectPanel.ts b/styles/src/styleTree/projectPanel.ts new file mode 100644 index 0000000000000000000000000000000000000000..c55417579ac489188d1501a22ced8fd707214b0b --- /dev/null +++ b/styles/src/styleTree/projectPanel.ts @@ -0,0 +1,37 @@ +import Theme from "../themes/theme"; +import { Color } from "../utils/color"; +import { panel } from "./app"; +import { backgroundColor, iconColor, text, TextColor } from "./components"; + +export default function projectPanel(theme: Theme) { + function entry(theme: Theme, textColor: TextColor, background?: Color) { + return { + height: 22, + background, + iconColor: iconColor(theme, "muted"), + iconSize: 8, + iconSpacing: 8, + text: text(theme, "mono", textColor, { size: "sm" }), + }; + } + + return { + ...panel, + entry: entry(theme, "secondary"), + hoveredEntry: entry( + theme, + "secondary", + backgroundColor(theme, 300, "hovered") + ), + selectedEntry: entry(theme, "primary"), + hoveredSelectedEntry: entry( + theme, + "primary", + backgroundColor(theme, 300, "hovered") + ), + padding: { + top: 6, + left: 12, + }, + }; +} diff --git a/styles/src/styleTree/search.ts b/styles/src/styleTree/search.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a3d374e5a6c4dae21bb5963e91820a392a0643e --- /dev/null +++ b/styles/src/styleTree/search.ts @@ -0,0 +1,79 @@ +import Theme from "../themes/theme"; +import { backgroundColor, border, player, text } from "./components"; + +export default function search(theme: Theme) { + const optionButton = { + ...text(theme, "mono", "secondary"), + background: backgroundColor(theme, 300), + cornerRadius: 6, + border: border(theme, "primary"), + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }; + + const editor = { + background: backgroundColor(theme, 500), + cornerRadius: 6, + minWidth: 200, + maxWidth: 500, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "primary"), + margin: { + right: 5, + }, + padding: { + top: 3, + bottom: 3, + left: 14, + right: 14, + }, + }; + + return { + matchBackground: theme.editor.highlight.match.value, + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + activeOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + editor, + hoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + invalidEditor: { + ...editor, + border: border(theme, "error"), + }, + matchIndex: { + ...text(theme, "mono", "muted"), + padding: 6, + }, + optionButton, + optionButtonGroup: { + padding: { + left: 2, + right: 2, + }, + }, + resultsStatus: { + ...text(theme, "mono", "primary"), + size: 18, + }, + }; +} diff --git a/styles/src/styleTree/selectorModal.ts b/styles/src/styleTree/selectorModal.ts new file mode 100644 index 0000000000000000000000000000000000000000..fdccae77a1c9b528418bb133fd87a5d14a6930d0 --- /dev/null +++ b/styles/src/styleTree/selectorModal.ts @@ -0,0 +1,59 @@ +import Theme from "../themes/theme"; +import { backgroundColor, border, player, shadow, text } from "./components"; + +export default function selectorModal(theme: Theme): Object { + const item = { + padding: { + bottom: 4, + left: 16, + right: 16, + top: 4, + }, + cornerRadius: 6, + text: text(theme, "sans", "secondary"), + highlightText: text(theme, "sans", "feature", { weight: "bold" }), + }; + + const activeItem = { + ...item, + background: backgroundColor(theme, 300, "active"), + text: text(theme, "sans", "primary"), + }; + + return { + background: backgroundColor(theme, 300), + cornerRadius: 6, + padding: 8, + item, + activeItem, + border: border(theme, "primary"), + empty: { + text: text(theme, "sans", "muted"), + padding: { + bottom: 4, + left: 16, + right: 16, + top: 8, + }, + }, + inputEditor: { + background: backgroundColor(theme, 500), + corner_radius: 6, + placeholderText: text(theme, "sans", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "secondary"), + padding: { + bottom: 7, + left: 16, + right: 16, + top: 7, + }, + }, + margin: { + bottom: 52, + top: 52, + }, + shadow: shadow(theme), + }; +} diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts new file mode 100644 index 0000000000000000000000000000000000000000..d21bed24aabe9fe841c1d4bba8b6ac21e08c052b --- /dev/null +++ b/styles/src/styleTree/workspace.ts @@ -0,0 +1,151 @@ +import Theme from "../themes/theme"; +import { backgroundColor, border, iconColor, text } from "./components"; + +export default function workspace(theme: Theme) { + const signInPrompt = { + ...text(theme, "sans", "secondary"), + size: 13, + underline: true, + padding: { + right: 8, + }, + }; + + const tab = { + height: 32, + background: backgroundColor(theme, 300), + iconClose: iconColor(theme, "muted"), + iconCloseActive: iconColor(theme, "active"), + iconConflict: iconColor(theme, "warning"), + iconDirty: iconColor(theme, "info"), + iconWidth: 8, + spacing: 10, + text: text(theme, "mono", "secondary", { size: "sm" }), + border: border(theme, "primary", { + left: true, + bottom: true, + overlay: true, + }), + padding: { + left: 12, + right: 12, + }, + }; + + const activeTab = { + ...tab, + background: backgroundColor(theme, 500), + text: text(theme, "mono", "active", { size: "sm" }), + border: { + ...tab.border, + bottom: false, + }, + }; + + const sidebarItem = { + height: 32, + iconColor: iconColor(theme, "secondary"), + iconSize: 18, + }; + const sidebar = { + width: 30, + background: backgroundColor(theme, 300), + border: border(theme, "primary", { right: true }), + item: sidebarItem, + activeItem: { + ...sidebarItem, + iconColor: iconColor(theme, "active"), + }, + resizeHandle: { + background: border(theme, "primary").color, + padding: { + left: 1, + }, + }, + }; + + return { + background: backgroundColor(theme, 300), + leaderBorderOpacity: 0.7, + leaderBorderWidth: 2.0, + tab, + activeTab, + leftSidebar: { + ...sidebar, + border: border(theme, "primary", { right: true }), + }, + rightSidebar: { + ...sidebar, + border: border(theme, "primary", { left: true }), + }, + paneDivider: { + color: border(theme, "primary").color, + width: 1, + }, + status_bar: { + height: 24, + itemSpacing: 8, + padding: { + left: 6, + right: 6, + }, + cursorPosition: text(theme, "sans", "muted"), + diagnosticMessage: text(theme, "sans", "muted"), + lspMessage: text(theme, "sans", "muted"), + }, + titlebar: { + avatarWidth: 18, + height: 32, + background: backgroundColor(theme, 100), + shareIconColor: iconColor(theme, "secondary"), + shareIconActiveColor: iconColor(theme, "active"), + title: text(theme, "sans", "primary"), + avatar: { + cornerRadius: 10, + border: { + color: "#00000088", + width: 1, + }, + }, + avatarRibbon: { + height: 3, + width: 12, + // TODO: The background for this ideally should be + // set with a token, not hardcoded in rust + }, + border: border(theme, "primary", { bottom: true }), + signInPrompt, + hoveredSignInPrompt: { + ...signInPrompt, + ...text(theme, "mono", "active"), + size: 13, + }, + offlineIcon: { + color: iconColor(theme, "secondary"), + width: 16, + padding: { + right: 4, + }, + }, + outdatedWarning: { + ...text(theme, "sans", "warning"), + size: 13, + }, + }, + toolbar: { + height: 34, + background: backgroundColor(theme, 500), + border: border(theme, "secondary", { bottom: true }), + itemSpacing: 8, + padding: { left: 16, right: 8, top: 4, bottom: 4 }, + }, + breadcrumbs: { + ...text(theme, "mono", "secondary"), + padding: { left: 6 }, + }, + disconnectedOverlay: { + ...text(theme, "sans", "active"), + background: "#000000aa", + }, + }; +} diff --git a/styles/themes/dark.ts b/styles/src/themes/dark.ts similarity index 74% rename from styles/themes/dark.ts rename to styles/src/themes/dark.ts index 3351d3d3fab34f33e033eb610f701555da34f4b2..c1d68232b14236eb8d17dfdf906d50b0410da25e 100644 --- a/styles/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -1,5 +1,6 @@ -import { colors, fontWeights, NumberToken } from "../tokens"; -import Theme, { Syntax } from "./theme"; +import { Color, colors, fontWeights, NumberToken } from "../tokens"; +import { withOpacity } from "../utils/color"; +import Theme, { buildPlayer, Syntax } from "./theme"; const backgroundColor = { 100: { @@ -87,57 +88,16 @@ const iconColor = { }; const player = { - 1: { - baseColor: colors.blue[500], - cursorColor: colors.blue[500], - selectionColor: colors.blue[800], - borderColor: colors.blue[800], - }, - 2: { - baseColor: colors.lime[500], - cursorColor: colors.lime[500], - selectionColor: colors.lime[800], - borderColor: colors.lime[500], - }, - 3: { - baseColor: colors.indigo[500], - cursorColor: colors.indigo[500], - selectionColor: colors.indigo[800], - borderColor: colors.indigo[500], - }, - 4: { - baseColor: colors.orange[500], - cursorColor: colors.orange[500], - selectionColor: colors.orange[800], - borderColor: colors.orange[500], - }, - 5: { - baseColor: colors.purple[500], - cursorColor: colors.purple[500], - selectionColor: colors.purple[800], - borderColor: colors.purple[500], - }, - 6: { - baseColor: colors.teal[400], - cursorColor: colors.teal[400], - selectionColor: colors.teal[800], - borderColor: colors.teal[400], - }, - 7: { - baseColor: colors.pink[400], - cursorColor: colors.pink[400], - selectionColor: colors.pink[100], - borderColor: colors.pink[400], - }, - 8: { - baseColor: colors.yellow[400], - cursorColor: colors.yellow[400], - selectionColor: colors.yellow[100], - borderColor: colors.yellow[400], - }, + 1: buildPlayer(colors.blue[500]), + 2: buildPlayer(colors.lime[500]), + 3: buildPlayer(colors.indigo[500]), + 4: buildPlayer(colors.orange[500]), + 5: buildPlayer(colors.purple[500]), + 6: buildPlayer(colors.teal[400]), + 7: buildPlayer(colors.pink[400]), + 8: buildPlayer(colors.yellow[400]), }; -// TODO: Fixup const editor = { background: backgroundColor[500].base, indent_guide: borderColor.muted, @@ -151,11 +111,11 @@ const editor = { }, highlight: { selection: player[1].selectionColor, - occurrence: colors.neutral[750], - activeOccurrence: colors.neutral[700], + occurrence: withOpacity(colors.teal[500], 0.16), + activeOccurrence: withOpacity(colors.teal[500], 0.32), matchingBracket: backgroundColor[500].active, - match: colors.sky[900], - activeMatch: colors.sky[800], + match: withOpacity(colors.sky[500], 0.16), + activeMatch: withOpacity(colors.sky[800], 0.32), related: backgroundColor[500].focused, }, gutter: { @@ -247,10 +207,6 @@ const syntax: Syntax = { weight: fontWeights.normal, // TODO: add italic }, - listMarker: { - color: colors.sky[400], - weight: fontWeights.normal, - } }; const shadowAlpha: NumberToken = { diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts new file mode 100644 index 0000000000000000000000000000000000000000..3978f89dce28a160ce96eb6173d35a5f5632db1f --- /dev/null +++ b/styles/src/themes/light.ts @@ -0,0 +1,228 @@ +import { colors, fontWeights, NumberToken } from "../tokens"; +import { withOpacity } from "../utils/color"; +import Theme, { buildPlayer, Syntax } from "./theme"; + +const backgroundColor = { + 100: { + base: colors.neutral[100], + hovered: colors.neutral[150], + active: colors.neutral[200], + focused: colors.neutral[150], + }, + 300: { + base: colors.neutral[50], + hovered: colors.neutral[100], + active: colors.neutral[150], + focused: colors.neutral[100], + }, + 500: { + base: colors.neutral[0], + hovered: colors.neutral[25], + active: colors.neutral[50], + focused: colors.neutral[75], + }, + ok: { + base: colors.green[100], + hovered: colors.green[100], + active: colors.green[100], + focused: colors.green[100], + }, + error: { + base: colors.red[100], + hovered: colors.red[100], + active: colors.red[100], + focused: colors.red[100], + }, + warning: { + base: colors.yellow[100], + hovered: colors.yellow[100], + active: colors.yellow[100], + focused: colors.yellow[100], + }, + info: { + base: colors.blue[100], + hovered: colors.blue[100], + active: colors.blue[100], + focused: colors.blue[100], + }, +}; + +const borderColor = { + primary: colors.neutral[200], + secondary: colors.neutral[100], + muted: colors.neutral[50], + focused: colors.neutral[100], + active: colors.neutral[250], + ok: colors.green[200], + error: colors.red[200], + warning: colors.yellow[200], + info: colors.blue[200], +}; + +const textColor = { + primary: colors.neutral[750], + secondary: colors.neutral[600], + muted: colors.neutral[450], + placeholder: colors.neutral[300], + active: colors.neutral[900], + feature: colors.blue[500], + ok: colors.green[500], + error: colors.red[500], + warning: colors.yellow[500], + info: colors.blue[500], +}; + +const iconColor = { + primary: colors.neutral[300], + secondary: colors.neutral[500], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[900], + feature: colors.sky[600], + ok: colors.green[600], + error: colors.red[600], + warning: colors.yellow[400], + info: colors.blue[600], +}; + +const player = { + 1: buildPlayer(colors.blue[500]), + 2: buildPlayer(colors.lime[500]), + 3: buildPlayer(colors.indigo[500]), + 4: buildPlayer(colors.orange[500]), + 5: buildPlayer(colors.purple[500]), + 6: buildPlayer(colors.teal[400]), + 7: buildPlayer(colors.pink[400]), + 8: buildPlayer(colors.yellow[400]), +}; + +// TODO: Fixup +const editor = { + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: backgroundColor[500].active, + highlighted: backgroundColor[500].active, + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: withOpacity(colors.teal[500], 0.16), + activeOccurrence: withOpacity(colors.teal[500], 0.32), + matchingBracket: colors.neutral[0], + match: withOpacity(colors.sky[500], 0.16), + activeMatch: withOpacity(colors.sky[800], 0.32), + related: colors.neutral[0], + }, + gutter: { + primary: colors.neutral[300], + active: textColor.active, + }, +}; + +const syntax: Syntax = { + primary: { + color: colors.neutral[750], + weight: fontWeights.normal, + }, + comment: { + color: colors.neutral[600], + weight: fontWeights.normal, + }, + punctuation: { + color: colors.neutral[700], + weight: fontWeights.normal, + }, + constant: { + color: colors.neutral[700], + weight: fontWeights.normal, + }, + keyword: { + color: colors.blue[800], + weight: fontWeights.normal, + }, + function: { + color: colors.green[600], + weight: fontWeights.normal, + }, + type: { + color: colors.teal[600], + weight: fontWeights.normal, + }, + variant: { + color: colors.sky[600], + weight: fontWeights.normal, + }, + property: { + color: colors.blue[700], + weight: fontWeights.normal, + }, + enum: { + color: colors.orange[600], + weight: fontWeights.normal, + }, + operator: { + color: colors.orange[600], + weight: fontWeights.normal, + }, + string: { + color: colors.orange[600], + weight: fontWeights.normal, + }, + number: { + color: colors.teal[500], + weight: fontWeights.normal, + }, + boolean: { + color: colors.amber[600], + weight: fontWeights.normal, + }, + predictive: { + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.teal[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, +}; + +const shadowAlpha: NumberToken = { + value: 0.12, + type: "number", +}; + +const theme: Theme = { + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, +}; + +export default theme; diff --git a/styles/themes/theme.ts b/styles/src/themes/theme.ts similarity index 88% rename from styles/themes/theme.ts rename to styles/src/themes/theme.ts index 7f8305c1d539d24fe50f23d650844c0670506dc1..94a508529d5184c5a77c8c3ca1d9729e091d39c0 100644 --- a/styles/themes/theme.ts +++ b/styles/src/themes/theme.ts @@ -1,4 +1,5 @@ import { ColorToken, FontWeightToken, NumberToken } from "../tokens"; +import { Color, withOpacity } from "../utils/color"; export interface SyntaxHighlightStyle { color: ColorToken; @@ -11,6 +12,19 @@ export interface Player { selectionColor: ColorToken; borderColor: ColorToken; } +export function buildPlayer( + color: ColorToken, + cursorOpacity?: number, + selectionOpacity?: number, + borderOpacity?: number +) { + return { + baseColor: color, + cursorColor: withOpacity(color, cursorOpacity || 1.0), + selectionColor: withOpacity(color, selectionOpacity || 0.1), + borderColor: withOpacity(color, borderOpacity || 0.8), + } +} export interface BackgroundColor { base: ColorToken; diff --git a/styles/tokens.ts b/styles/src/tokens.ts similarity index 100% rename from styles/tokens.ts rename to styles/src/tokens.ts diff --git a/styles/src/utils/color.ts b/styles/src/utils/color.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e1599acac234011ca5d5ee20c2f5dc6f3d97c3a --- /dev/null +++ b/styles/src/utils/color.ts @@ -0,0 +1,52 @@ +import chroma, { Scale } from "chroma-js"; +import { ColorToken } from "../tokens"; + +export type Color = string; +export type ColorRampStep = { value: Color; type: "color"; step: number }; +export type ColorRamp = { + [index: number]: ColorRampStep; +}; + +export function colorRamp( + color: Color | [Color, Color], + options?: { steps?: number; increment?: number; } +): ColorRamp { + let scale: Scale; + if (Array.isArray(color)) { + const [startColor, endColor] = color; + scale = chroma.scale([startColor, endColor]); + } else { + let hue = Math.round(chroma(color).hsl()[0]); + let startColor = chroma.hsl(hue, 0.88, 0.96); + let endColor = chroma.hsl(hue, 0.68, 0.12); + scale = chroma + .scale([startColor, color, endColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + // .correctLightness(true) + .padding([0, 0]); + } + + const ramp: ColorRamp = {}; + const steps = options?.steps || 10; + const increment = options?.increment || 100; + + scale.colors(steps, "hex").forEach((color, ix) => { + const step = ix * increment; + ramp[step] = { + value: color, + step, + type: "color", + }; + }); + + return ramp; +} + +export function withOpacity(color: ColorToken, opacity: number): ColorToken { + return { + ...color, + value: chroma(color.value).alpha(opacity).hex() + }; +} diff --git a/styles/src/utils/snakeCase.ts b/styles/src/utils/snakeCase.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d0e4470d8e6232dbac3ea4ab3190ba23da63de2 --- /dev/null +++ b/styles/src/utils/snakeCase.ts @@ -0,0 +1,35 @@ +import { snakeCase } from "case-anything"; + +// https://stackoverflow.com/questions/60269936/typescript-convert-generic-object-from-snake-to-camel-case + +// Typescript magic to convert any string from camelCase to snake_case at compile time +type SnakeCase = + S extends string ? + S extends `${infer T}${infer U}` ? + `${T extends Capitalize ? "_" : ""}${Lowercase}${SnakeCase}` : + S : + S; + +type SnakeCased = { + [Property in keyof Type as SnakeCase]: SnakeCased +} + +export default function snakeCaseTree(object: T): SnakeCased { + const snakeObject: any = {}; + for (const key in object) { + snakeObject[snakeCase(key)] = snakeCaseValue(object[key]); + } + return snakeObject; +} + +function snakeCaseValue(value: any): any { + if (typeof value === "object") { + if (Array.isArray(value)) { + return value.map(snakeCaseValue); + } else { + return snakeCaseTree(value); + } + } else { + return value; + } +} diff --git a/styles/styleTree/chatPanel.ts b/styles/styleTree/chatPanel.ts deleted file mode 100644 index 69b5f3baa0d74c03e4ff5e0a81ff4fc6616afdfc..0000000000000000000000000000000000000000 --- a/styles/styleTree/chatPanel.ts +++ /dev/null @@ -1,108 +0,0 @@ -import Theme from "../themes/theme"; -import { panel } from "./app"; -import { - backgroundColor, - border, - player, - shadow, - text, - TextColor -} from "./components"; - -export default function chatPanel(theme: Theme) { - function channelSelectItem( - theme: Theme, - textColor: TextColor, - hovered: boolean - ) { - return { - name: text(theme, "sans", textColor), - padding: 4, - hash: { - ...text(theme, "sans", "muted"), - margin: { - right: 8, - }, - }, - background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, - cornerRadius: hovered ? 6 : 0, - }; - } - - const message = { - body: text(theme, "sans", "secondary"), - timestamp: text(theme, "sans", "muted", { size: "sm" }), - padding: { - bottom: 6, - }, - sender: { - ...text(theme, "sans", "primary", { weight: "bold" }), - margin: { - right: 8, - }, - }, - }; - - return { - ...panel, - channelName: text(theme, "sans", "primary", { weight: "bold" }), - channelNameHash: { - ...text(theme, "sans", "muted"), - padding: { - right: 8, - }, - }, - channelSelect: { - header: { - ...channelSelectItem(theme, "primary", false), - padding: { - bottom: 4, - left: 0, - }, - }, - item: channelSelectItem(theme, "secondary", false), - hoveredItem: channelSelectItem(theme, "secondary", true), - activeItem: channelSelectItem(theme, "primary", false), - hoveredActiveItem: channelSelectItem(theme, "primary", true), - menu: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - padding: 4, - border: border(theme, "primary"), - shadow: shadow(theme), - }, - }, - signInPrompt: text(theme, "sans", "secondary", { underline: true }), - hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), - message, - pendingMessage: { - ...message, - body: { - ...message.body, - color: theme.textColor.muted.value, - }, - sender: { - ...message.sender, - color: theme.textColor.muted.value, - }, - timestamp: { - ...message.timestamp, - color: theme.textColor.muted.value, - }, - }, - inputEditor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - text: text(theme, "mono", "primary"), - placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), - selection: player(theme, 1).selection, - border: border(theme, "secondary"), - padding: { - bottom: 7, - left: 8, - right: 8, - top: 7, - }, - }, - }; -} diff --git a/styles/styleTree/components.ts b/styles/styleTree/components.ts deleted file mode 100644 index 205fd9b26200510d7adeb4f226ed893e8a17bbaa..0000000000000000000000000000000000000000 --- a/styles/styleTree/components.ts +++ /dev/null @@ -1,91 +0,0 @@ -import chroma from "chroma-js"; -import Theme, { BackgroundColor } from "../themes/theme"; -import { fontFamilies, fontSizes, FontWeight } from "../tokens"; -import { Color } from "../utils/color"; - -export type TextColor = keyof Theme["textColor"]; - -export function text( - theme: Theme, - fontFamily: keyof typeof fontFamilies, - color: TextColor, - properties?: { - size?: keyof typeof fontSizes; - weight?: FontWeight; - underline?: boolean; - } -) { - const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md"; - const size = fontSizes[sizeKey].value; - - return { - family: fontFamilies[fontFamily].value, - color: theme.textColor[color].value, - ...properties, - size, - }; -} - -export interface BorderOptions { - width?: number; - top?: boolean; - bottom?: boolean; - left?: boolean; - right?: boolean; - overlay?: boolean; -} - -export function border( - theme: Theme, - color: keyof Theme["borderColor"], - options?: BorderOptions -) { - return { - color: borderColor(theme, color), - width: 1, - ...options, - }; -} - -export function borderColor(theme: Theme, color: keyof Theme["borderColor"]) { - return theme.borderColor[color].value; -} - -export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { - return theme.iconColor[color].value; -} - -export interface Player { - selection: { - cursor: Color; - selection: Color; - }; -} - -export function player( - theme: Theme, - playerNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 -): Player { - return { - selection: { - cursor: theme.player[playerNumber].cursorColor.value, - selection: theme.player[playerNumber].selectionColor.value, - }, - }; -} - -export function backgroundColor( - theme: Theme, - name: keyof Theme["backgroundColor"], - state?: keyof BackgroundColor -): Color { - return theme.backgroundColor[name][state || "base"].value; -} - -export function shadow(theme: Theme) { - return { - blur: 16, - color: chroma("black").alpha(theme.shadowAlpha.value).hex(), - offset: [0, 2], - }; -} diff --git a/styles/styleTree/projectPanel.ts b/styles/styleTree/projectPanel.ts deleted file mode 100644 index e27cd94414a031f64dbc0ee5e232d2666944462a..0000000000000000000000000000000000000000 --- a/styles/styleTree/projectPanel.ts +++ /dev/null @@ -1,37 +0,0 @@ -import Theme from "../themes/theme"; -import { Color } from "../utils/color"; -import { panel } from "./app"; -import { backgroundColor, iconColor, text, TextColor } from "./components"; - -export default function projectPanel(theme: Theme) { - function entry(theme: Theme, textColor: TextColor, background?: Color) { - return { - height: 22, - background, - iconColor: iconColor(theme, "muted"), - iconSize: 8, - iconSpacing: 8, - text: text(theme, "mono", textColor, { size: "sm" }), - }; - } - - return { - ...panel, - entry: entry(theme, "secondary"), - hoveredEntry: entry( - theme, - "secondary", - backgroundColor(theme, 300, "hovered") - ), - selectedEntry: entry(theme, "primary"), - hoveredSelectedEntry: entry( - theme, - "primary", - backgroundColor(theme, 300, "hovered") - ), - padding: { - top: 6, - left: 12, - }, - }; -} diff --git a/styles/styleTree/search.ts b/styles/styleTree/search.ts deleted file mode 100644 index 42b639f57a39d355c8dbf461fb29e64ee71dec2f..0000000000000000000000000000000000000000 --- a/styles/styleTree/search.ts +++ /dev/null @@ -1,79 +0,0 @@ -import Theme from "../themes/theme"; -import { backgroundColor, border, player, text } from "./components"; - -export default function search(theme: Theme) { - const optionButton = { - ...text(theme, "mono", "secondary"), - background: backgroundColor(theme, 300), - cornerRadius: 6, - border: border(theme, "primary"), - margin: { - left: 1, - right: 1, - }, - padding: { - bottom: 1, - left: 6, - right: 6, - top: 1, - }, - }; - - const editor = { - background: backgroundColor(theme, 500), - cornerRadius: 6, - minWidth: 200, - maxWidth: 500, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "primary"), - margin: { - right: 5, - }, - padding: { - top: 3, - bottom: 3, - left: 14, - right: 14, - }, - }; - - return { - matchBackground: theme.editor.highlight.match.value, - tabIconSpacing: 4, - tabIconWidth: 14, - activeHoveredOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - activeOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - editor, - hoveredOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - invalidEditor: { - ...editor, - border: border(theme, "error"), - }, - matchIndex: { - ...text(theme, "mono", "muted"), - padding: 6, - }, - optionButton, - optionButtonGroup: { - padding: { - left: 2, - right: 2, - }, - }, - resultsStatus: { - ...text(theme, "mono", "primary"), - size: 18, - }, - }; -} diff --git a/styles/styleTree/selectorModal.ts b/styles/styleTree/selectorModal.ts deleted file mode 100644 index 47355cff116ff985ac62fd8d1665056422cfcd3c..0000000000000000000000000000000000000000 --- a/styles/styleTree/selectorModal.ts +++ /dev/null @@ -1,59 +0,0 @@ -import Theme from "../themes/theme"; -import { backgroundColor, border, player, shadow, text } from "./components"; - -export default function selectorModal(theme: Theme): Object { - const item = { - padding: { - bottom: 4, - left: 16, - right: 16, - top: 4, - }, - cornerRadius: 6, - text: text(theme, "sans", "secondary"), - highlightText: text(theme, "sans", "feature", { weight: "bold" }), - }; - - const activeItem = { - ...item, - background: backgroundColor(theme, 300, "active"), - text: text(theme, "sans", "primary"), - }; - - return { - background: backgroundColor(theme, 300), - cornerRadius: 6, - padding: 8, - item, - activeItem, - border: border(theme, "primary"), - empty: { - text: text(theme, "sans", "muted"), - padding: { - bottom: 4, - left: 16, - right: 16, - top: 8, - }, - }, - inputEditor: { - background: backgroundColor(theme, 500), - corner_radius: 6, - placeholderText: text(theme, "sans", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "secondary"), - padding: { - bottom: 7, - left: 16, - right: 16, - top: 7, - }, - }, - margin: { - bottom: 52, - top: 52, - }, - shadow: shadow(theme), - }; -} diff --git a/styles/styleTree/workspace.ts b/styles/styleTree/workspace.ts deleted file mode 100644 index 030f8edc95e758b574b2df7378acc1bbf498ad3f..0000000000000000000000000000000000000000 --- a/styles/styleTree/workspace.ts +++ /dev/null @@ -1,151 +0,0 @@ -import Theme from "../themes/theme"; -import { backgroundColor, border, iconColor, text } from "./components"; - -export default function workspace(theme: Theme) { - const signInPrompt = { - ...text(theme, "sans", "secondary"), - size: 13, - underline: true, - padding: { - right: 8, - }, - }; - - const tab = { - height: 32, - background: backgroundColor(theme, 300), - iconClose: iconColor(theme, "muted"), - iconCloseActive: iconColor(theme, "active"), - iconConflict: iconColor(theme, "warning"), - iconDirty: iconColor(theme, "info"), - iconWidth: 8, - spacing: 10, - text: text(theme, "mono", "secondary", { size: "sm" }), - border: border(theme, "primary", { - left: true, - bottom: true, - overlay: true, - }), - padding: { - left: 12, - right: 12, - }, - }; - - const activeTab = { - ...tab, - background: backgroundColor(theme, 500), - text: text(theme, "mono", "active", { size: "sm" }), - border: { - ...tab.border, - bottom: false, - }, - }; - - const sidebarItem = { - height: 32, - iconColor: iconColor(theme, "secondary"), - iconSize: 18, - }; - const sidebar = { - width: 30, - background: backgroundColor(theme, 300), - border: border(theme, "primary", { right: true }), - item: sidebarItem, - activeItem: { - ...sidebarItem, - iconColor: iconColor(theme, "active"), - }, - resizeHandle: { - background: border(theme, "primary").color, - padding: { - left: 1, - }, - }, - }; - - return { - background: backgroundColor(theme, 300), - leaderBorderOpacity: 0.7, - leaderBorderWidth: 2.0, - tab, - activeTab, - leftSidebar: { - ...sidebar, - border: border(theme, "primary", { right: true }), - }, - rightSidebar: { - ...sidebar, - border: border(theme, "primary", { left: true }), - }, - paneDivider: { - color: border(theme, "primary").color, - width: 1, - }, - status_bar: { - height: 24, - itemSpacing: 8, - padding: { - left: 6, - right: 6, - }, - cursorPosition: text(theme, "sans", "muted"), - diagnosticMessage: text(theme, "sans", "muted"), - lspMessage: text(theme, "sans", "muted"), - }, - titlebar: { - avatarWidth: 18, - height: 32, - background: backgroundColor(theme, 100), - shareIconColor: iconColor(theme, "secondary"), - shareIconActiveColor: iconColor(theme, "active"), - title: text(theme, "sans", "primary"), - avatar: { - cornerRadius: 10, - border: { - color: "#00000088", - width: 1, - }, - }, - avatarRibbon: { - height: 3, - width: 12, - // TODO: The background for this ideally should be - // set with a token, not hardcoded in rust - }, - border: border(theme, "primary", { bottom: true }), - signInPrompt, - hoveredSignInPrompt: { - ...signInPrompt, - ...text(theme, "mono", "active"), - size: 13, - }, - offlineIcon: { - color: iconColor(theme, "secondary"), - width: 16, - padding: { - right: 4, - }, - }, - outdatedWarning: { - ...text(theme, "sans", "warning"), - size: 13, - }, - }, - toolbar: { - height: 34, - background: backgroundColor(theme, 500), - border: border(theme, "secondary", { bottom: true }), - itemSpacing: 8, - padding: { left: 16, right: 8, top: 4, bottom: 4 }, - }, - breadcrumbs: { - ...text(theme, "mono", "secondary"), - padding: { left: 6 }, - }, - disconnectedOverlay: { - ...text(theme, "sans", "active"), - background: "#000000aa", - }, - }; -} diff --git a/styles/themes/light.ts b/styles/themes/light.ts deleted file mode 100644 index 649fd719a8f75bd47e4c07e8744a4863ae1f5d9f..0000000000000000000000000000000000000000 --- a/styles/themes/light.ts +++ /dev/null @@ -1,273 +0,0 @@ -import { colors, fontWeights, NumberToken } from "../tokens"; -import Theme, { Syntax } from "./theme"; - -// TODO: Replace with light values - -const backgroundColor = { - 100: { - base: colors.neutral[100], - hovered: colors.neutral[150], - active: colors.neutral[200], - focused: colors.neutral[150], - }, - 300: { - base: colors.neutral[50], - hovered: colors.neutral[100], - active: colors.neutral[150], - focused: colors.neutral[100], - }, - 500: { - base: colors.neutral[0], - hovered: colors.neutral[25], - active: colors.neutral[50], - focused: colors.neutral[75], - }, - ok: { - base: colors.green[100], - hovered: colors.green[100], - active: colors.green[100], - focused: colors.green[100], - }, - error: { - base: colors.red[100], - hovered: colors.red[100], - active: colors.red[100], - focused: colors.red[100], - }, - warning: { - base: colors.yellow[100], - hovered: colors.yellow[100], - active: colors.yellow[100], - focused: colors.yellow[100], - }, - info: { - base: colors.blue[100], - hovered: colors.blue[100], - active: colors.blue[100], - focused: colors.blue[100], - }, -}; - -const borderColor = { - primary: colors.neutral[200], - secondary: colors.neutral[100], - muted: colors.neutral[50], - focused: colors.neutral[100], - active: colors.neutral[250], - ok: colors.green[200], - error: colors.red[200], - warning: colors.yellow[200], - info: colors.blue[200], -}; - -const textColor = { - primary: colors.neutral[750], - secondary: colors.neutral[600], - muted: colors.neutral[450], - placeholder: colors.neutral[300], - active: colors.neutral[900], - feature: colors.blue[500], - ok: colors.green[500], - error: colors.red[500], - warning: colors.yellow[500], - info: colors.blue[500], -}; - -const iconColor = { - primary: colors.neutral[300], - secondary: colors.neutral[500], - muted: colors.neutral[600], - placeholder: colors.neutral[700], - active: colors.neutral[900], - feature: colors.sky[600], - ok: colors.green[600], - error: colors.red[600], - warning: colors.yellow[400], - info: colors.blue[600], -}; - -const player = { - 1: { - baseColor: colors.blue[600], - cursorColor: colors.blue[500], - selectionColor: colors.blue[100], - borderColor: colors.blue[500], - }, - 2: { - baseColor: colors.lime[500], - cursorColor: colors.lime[500], - selectionColor: colors.lime[100], - borderColor: colors.lime[500], - }, - 3: { - baseColor: colors.indigo[500], - cursorColor: colors.indigo[500], - selectionColor: colors.indigo[100], - borderColor: colors.indigo[500], - }, - 4: { - baseColor: colors.orange[500], - cursorColor: colors.orange[500], - selectionColor: colors.orange[100], - borderColor: colors.orange[500], - }, - 5: { - baseColor: colors.purple[500], - cursorColor: colors.purple[500], - selectionColor: colors.purple[100], - borderColor: colors.purple[500], - }, - 6: { - baseColor: colors.teal[400], - cursorColor: colors.teal[400], - selectionColor: colors.teal[100], - borderColor: colors.teal[400], - }, - 7: { - baseColor: colors.pink[400], - cursorColor: colors.pink[400], - selectionColor: colors.pink[100], - borderColor: colors.pink[400], - }, - 8: { - baseColor: colors.yellow[400], - cursorColor: colors.yellow[400], - selectionColor: colors.yellow[100], - borderColor: colors.yellow[400], - }, -}; - -// TODO: Fixup -const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: backgroundColor[500].active, - highlighted: backgroundColor[500].active, - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: backgroundColor[500].active, - activeOccurrence: colors.neutral[0], - matchingBracket: colors.neutral[0], - match: colors.neutral[0], - activeMatch: colors.neutral[0], - related: colors.neutral[0], - }, - gutter: { - primary: colors.neutral[300], - active: textColor.active, - }, -}; - -const syntax: Syntax = { - primary: { - color: colors.neutral[750], - weight: fontWeights.normal, - }, - comment: { - color: colors.neutral[600], - weight: fontWeights.normal, - }, - punctuation: { - color: colors.neutral[700], - weight: fontWeights.normal, - }, - constant: { - color: colors.neutral[700], - weight: fontWeights.normal, - }, - keyword: { - color: colors.blue[800], - weight: fontWeights.normal, - }, - function: { - color: colors.green[600], - weight: fontWeights.normal, - }, - type: { - color: colors.teal[600], - weight: fontWeights.normal, - }, - variant: { - color: colors.sky[600], - weight: fontWeights.normal, - }, - property: { - color: colors.blue[700], - weight: fontWeights.normal, - }, - enum: { - color: colors.orange[600], - weight: fontWeights.normal, - }, - operator: { - color: colors.orange[600], - weight: fontWeights.normal, - }, - string: { - color: colors.orange[600], - weight: fontWeights.normal, - }, - number: { - color: colors.teal[500], - weight: fontWeights.normal, - }, - boolean: { - color: colors.amber[600], - weight: fontWeights.normal, - }, - predictive: { - color: textColor.muted, - weight: fontWeights.normal, - }, - title: { - color: colors.sky[500], - weight: fontWeights.bold, - }, - emphasis: { - color: textColor.active, - weight: fontWeights.normal, - }, - emphasisStrong: { - color: textColor.active, - weight: fontWeights.bold, - }, - linkUrl: { - color: colors.teal[500], - weight: fontWeights.normal, - // TODO: add underline - }, - linkText: { - color: colors.orange[500], - weight: fontWeights.normal, - // TODO: add italic - }, - listMarker: { - color: colors.sky[400], - weight: fontWeights.normal, - }, -}; - -const shadowAlpha: NumberToken = { - value: 0.12, - type: "number", -}; - -const theme: Theme = { - name: "light", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, -}; - -export default theme; diff --git a/styles/utils/color.ts b/styles/utils/color.ts deleted file mode 100644 index e69d903a431cdef0dc9acdc3f76eb8b535d519f4..0000000000000000000000000000000000000000 --- a/styles/utils/color.ts +++ /dev/null @@ -1,44 +0,0 @@ -import chroma, { Scale } from "chroma-js"; - -export type Color = string; -export type ColorRampStep = { value: Color; type: "color"; step: number }; -export type ColorRamp = { - [index: number]: ColorRampStep; -}; - -export function colorRamp( - color: Color | [Color, Color], - options?: { steps?: number; increment?: number; } -): ColorRamp { - let scale: Scale; - if (Array.isArray(color)) { - const [startColor, endColor] = color; - scale = chroma.scale([startColor, endColor]); - } else { - let hue = Math.round(chroma(color).hsl()[0]); - let startColor = chroma.hsl(hue, 0.88, 0.96); - let endColor = chroma.hsl(hue, 0.68, 0.12); - scale = chroma - .scale([startColor, color, endColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - // .correctLightness(true) - .padding([0, 0]); - } - - const ramp: ColorRamp = {}; - const steps = options?.steps || 10; - const increment = options?.increment || 100; - - scale.colors(steps, "hex").forEach((color, ix) => { - const step = ix * increment; - ramp[step] = { - value: color, - step, - type: "color", - }; - }); - - return ramp; -} diff --git a/styles/utils/decamelizeTree.ts b/styles/utils/decamelizeTree.ts deleted file mode 100644 index d606902082e974b6cb7b0602e06cc32b0a9e1b5f..0000000000000000000000000000000000000000 --- a/styles/utils/decamelizeTree.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { snakeCase } from "case-anything"; - -export default function decamelizeTree(object: { [key: string]: any }) { - const snakeObject: { [key: string]: any } = {}; - for (const key in object) { - snakeObject[snakeCase(key)] = decamelizeValue(object[key]); - } - return snakeObject; -} - -function decamelizeValue(value: any): any { - if (typeof value === "object") { - if (Array.isArray(value)) { - return value.map(decamelizeValue); - } else { - return decamelizeTree(value); - } - } else { - return value; - } -} From 66544d54f2974663b1b443c0f3ba1f5b3586b0e0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 4 Apr 2022 16:18:28 -0600 Subject: [PATCH 063/245] Drop borrow to window state before calling beginSheetModalForWindow Co-Authored-By: Keith Simmons --- crates/gpui/src/platform/mac/window.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index 52810091556241d671a8c93ec13cedb9175c3da9..f6798e15af3c2d6688a5fb3bf6b529ed2122446a 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -361,9 +361,10 @@ impl platform::Window for Window { } }); let block = block.copy(); + let native_window = self.0.borrow().native_window; let _: () = msg_send![ alert, - beginSheetModalForWindow: self.0.borrow().native_window + beginSheetModalForWindow: native_window completionHandler: block ]; done_rx From 5ef484c9a114f7510e6d7a0482ca0fb9bd9362d4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 10:42:35 +0200 Subject: [PATCH 064/245] Update followers when navigating back and forth --- crates/server/src/rpc.rs | 23 +++++++++++++++++++++++ crates/workspace/src/pane.rs | 9 +++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 768432ef75af1958c90e580bc2fec189dc5763e8..eb12de9b727bb6ea9c6b87047ffeab23372221ea 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -4561,6 +4561,29 @@ mod tests { }) .await; + // When client A navigates back and forth, client B does so as well. + workspace_a + .update(cx_a, |workspace, cx| { + workspace::Pane::go_back(workspace, None, cx) + }) + .await; + workspace_b + .condition(cx_b, |workspace, cx| { + workspace.active_item(cx).unwrap().id() == editor_b2.id() + }) + .await; + + workspace_a + .update(cx_a, |workspace, cx| { + workspace::Pane::go_forward(workspace, None, cx) + }) + .await; + workspace_b + .condition(cx_b, |workspace, cx| { + workspace.active_item(cx).unwrap().id() == editor_b1.id() + }) + .await; + // Changes to client A's editor are reflected on client B. editor_a1.update(cx_a, |editor, cx| { editor.select_ranges([1..1, 2..2], None, cx); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 1421072b131e4ed72f05547edb1e30080f8ef2ce..66b87c310e348c15d337da7b63df1716b8707d09 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -206,10 +206,6 @@ impl Pane { } let prev_active_index = mem::replace(&mut pane.active_item_index, index); - pane.focus_active_item(cx); - pane.update_toolbar(cx); - cx.emit(Event::ActivateItem { local: true }); - cx.notify(); let mut navigated = prev_active_index != pane.active_item_index; if let Some(data) = entry.data { @@ -217,6 +213,11 @@ impl Pane { } if navigated { + pane.focus_active_item(cx); + pane.update_toolbar(cx); + pane.activate(cx); + cx.emit(Event::ActivateItem { local: true }); + cx.notify(); break None; } } From 9188f51993a1f56bdd0ebcc4e5cc1de3f4afc70d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 14:32:25 +0200 Subject: [PATCH 065/245] Add unit test to illustrate how language server renames should work --- crates/project/src/project.rs | 120 +++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 23 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index c9683f39d978de3c8d10de0f4abccebcb801b768..3dfdc313da2525aec8c9a8a2d4317e444192355e 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -4970,7 +4970,7 @@ mod tests { ) .await; - let project = Project::test(fs, cx); + let project = Project::test(fs.clone(), cx); project.update(cx, |project, _| { project.languages.add(Arc::new(rust_language)); project.languages.add(Arc::new(json_language)); @@ -5122,6 +5122,80 @@ mod tests { ) ); + // Renames are reported only to servers matching the buffer's language. + fs.rename( + Path::new("/the-root/test2.rs"), + Path::new("/the-root/test3.rs"), + Default::default(), + ) + .await + .unwrap(); + assert_eq!( + fake_rust_server + .receive_notification::() + .await + .text_document, + lsp::TextDocumentIdentifier::new( + lsp::Url::from_file_path("/the-root/test2.rs").unwrap() + ), + ); + assert_eq!( + fake_rust_server + .receive_notification::() + .await + .text_document, + lsp::TextDocumentItem { + uri: lsp::Url::from_file_path("/the-root/test3.rs").unwrap(), + version: 0, + text: rust_buffer2.read_with(cx, |buffer, _| buffer.text()), + language_id: Default::default() + }, + ); + + // When the rename changes the extension of the file, the buffer gets closed on the old + // language server and gets opened on the new one. + fs.rename( + Path::new("/the-root/test3.rs"), + Path::new("/the-root/test3.json"), + Default::default(), + ) + .await + .unwrap(); + assert_eq!( + fake_rust_server + .receive_notification::() + .await + .text_document, + lsp::TextDocumentIdentifier::new( + lsp::Url::from_file_path("/the-root/test3.json").unwrap(), + ), + ); + assert_eq!( + fake_json_server + .receive_notification::() + .await + .text_document, + lsp::TextDocumentItem { + uri: lsp::Url::from_file_path("/the-root/test3.json").unwrap(), + version: 0, + text: rust_buffer2.read_with(cx, |buffer, _| buffer.text()), + language_id: Default::default() + }, + ); + + // The renamed file's version resets after changing language server. + rust_buffer2.update(cx, |buffer, cx| buffer.edit([0..0], "// ", cx)); + assert_eq!( + fake_json_server + .receive_notification::() + .await + .text_document, + lsp::VersionedTextDocumentIdentifier::new( + lsp::Url::from_file_path("/the-root/test3.json").unwrap(), + 1 + ) + ); + // Restart language servers project.update(cx, |project, cx| { project.restart_language_servers_for_buffers( @@ -5139,48 +5213,48 @@ mod tests { let mut fake_rust_server = fake_rust_servers.next().await.unwrap(); let mut fake_json_server = fake_json_servers.next().await.unwrap(); - // Ensure both rust documents are reopened in new rust language server without worrying about order + // Ensure rust document is reopened in new rust language server + assert_eq!( + fake_rust_server + .receive_notification::() + .await + .text_document, + lsp::TextDocumentItem { + uri: lsp::Url::from_file_path("/the-root/test.rs").unwrap(), + version: 1, + text: rust_buffer.read_with(cx, |buffer, _| buffer.text()), + language_id: Default::default() + } + ); + + // Ensure json documents are reopened in new json language server assert_set_eq!( [ - fake_rust_server + fake_json_server .receive_notification::() .await .text_document, - fake_rust_server + fake_json_server .receive_notification::() .await .text_document, ], [ lsp::TextDocumentItem { - uri: lsp::Url::from_file_path("/the-root/test.rs").unwrap(), - version: 1, - text: rust_buffer.read_with(cx, |buffer, _| buffer.text()), + uri: lsp::Url::from_file_path("/the-root/package.json").unwrap(), + version: 0, + text: json_buffer.read_with(cx, |buffer, _| buffer.text()), language_id: Default::default() }, lsp::TextDocumentItem { - uri: lsp::Url::from_file_path("/the-root/test2.rs").unwrap(), + uri: lsp::Url::from_file_path("/the-root/test3.json").unwrap(), version: 1, text: rust_buffer2.read_with(cx, |buffer, _| buffer.text()), language_id: Default::default() - }, + } ] ); - // Ensure json document is reopened in new json language server - assert_eq!( - fake_json_server - .receive_notification::() - .await - .text_document, - lsp::TextDocumentItem { - uri: lsp::Url::from_file_path("/the-root/package.json").unwrap(), - version: 0, - text: json_buffer.read_with(cx, |buffer, _| buffer.text()), - language_id: Default::default() - } - ); - // Close notifications are reported only to servers matching the buffer's language. cx.update(|_| drop(json_buffer)); let close_message = lsp::DidCloseTextDocumentParams { From 5c7f2bb02906bb863a16edb4777d4d8537bb7eef Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 15:15:43 +0200 Subject: [PATCH 066/245] Close and re-open buffer in language server when it gets renamed --- crates/project/src/project.rs | 79 +++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 3dfdc313da2525aec8c9a8a2d4317e444192355e..e918f2cc70646182e606c8c8570f178382608f90 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1019,7 +1019,14 @@ impl Project { cx: &mut ModelContext, ) -> Task> { let worktree_task = self.find_or_create_local_worktree(&abs_path, true, cx); + let old_path = + File::from_dyn(buffer.read(cx).file()).and_then(|f| Some(f.as_local()?.abs_path(cx))); cx.spawn(|this, mut cx| async move { + if let Some(old_path) = old_path { + this.update(&mut cx, |this, cx| { + this.unregister_buffer_from_language_server(&buffer, old_path, cx); + }); + } let (worktree, path) = worktree_task.await?; worktree .update(&mut cx, |worktree, cx| { @@ -1091,6 +1098,23 @@ impl Project { self.assign_language_to_buffer(buffer, cx); self.register_buffer_with_language_server(buffer, cx); + cx.observe_release(buffer, |this, buffer, cx| { + if let Some(file) = File::from_dyn(buffer.file()) { + if file.is_local() { + let uri = lsp::Url::from_file_path(file.abs_path(cx)).unwrap(); + if let Some((_, server)) = this.language_server_for_buffer(buffer, cx) { + server + .notify::( + lsp::DidCloseTextDocumentParams { + text_document: lsp::TextDocumentIdentifier::new(uri.clone()), + }, + ) + .log_err(); + } + } + } + }) + .detach(); Ok(()) } @@ -1143,30 +1167,31 @@ impl Project { self.buffer_snapshots .insert(buffer_id, vec![(0, initial_snapshot)]); } - - cx.observe_release(buffer_handle, |this, buffer, cx| { - if let Some(file) = File::from_dyn(buffer.file()) { - if file.is_local() { - let uri = lsp::Url::from_file_path(file.abs_path(cx)).unwrap(); - if let Some((_, server)) = this.language_server_for_buffer(buffer, cx) { - server - .notify::( - lsp::DidCloseTextDocumentParams { - text_document: lsp::TextDocumentIdentifier::new( - uri.clone(), - ), - }, - ) - .log_err(); - } - } - } - }) - .detach(); } } } + fn unregister_buffer_from_language_server( + &mut self, + buffer: &ModelHandle, + old_path: PathBuf, + cx: &mut ModelContext, + ) { + let buffer = &buffer.read(cx); + if let Some((_, language_server)) = self.language_server_for_buffer(buffer, cx) { + language_server + .notify::( + lsp::DidCloseTextDocumentParams { + text_document: lsp::TextDocumentIdentifier::new( + lsp::Url::from_file_path(old_path).unwrap(), + ), + }, + ) + .log_err(); + } + self.buffer_snapshots.remove(&buffer.remote_id()); + } + fn on_buffer_event( &mut self, buffer: ModelHandle, @@ -3387,6 +3412,7 @@ impl Project { ) { let snapshot = worktree_handle.read(cx).snapshot(); let mut buffers_to_delete = Vec::new(); + let mut renamed_buffers = Vec::new(); for (buffer_id, buffer) in &self.opened_buffers { if let Some(buffer) = buffer.upgrade(cx) { buffer.update(cx, |buffer, cx| { @@ -3426,6 +3452,11 @@ impl Project { } }; + let old_path = old_file.abs_path(cx); + if new_file.abs_path(cx) != old_path { + renamed_buffers.push((cx.handle(), old_path)); + } + if let Some(project_id) = self.remote_id() { self.client .send(proto::UpdateBufferFile { @@ -3446,6 +3477,12 @@ impl Project { for buffer_id in buffers_to_delete { self.opened_buffers.remove(&buffer_id); } + + for (buffer, old_path) in renamed_buffers { + self.unregister_buffer_from_language_server(&buffer, old_path, cx); + self.assign_language_to_buffer(&buffer, cx); + self.register_buffer_with_language_server(&buffer, cx); + } } pub fn set_active_path(&mut self, entry: Option, cx: &mut ModelContext) { @@ -5167,7 +5204,7 @@ mod tests { .await .text_document, lsp::TextDocumentIdentifier::new( - lsp::Url::from_file_path("/the-root/test3.json").unwrap(), + lsp::Url::from_file_path("/the-root/test3.rs").unwrap(), ), ); assert_eq!( From 7e3cc67e0a11ae1893e0d4cab62b3245e5181d0a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 16:00:02 +0200 Subject: [PATCH 067/245] Don't reuse old syntax tree when resetting a buffer's language Co-Authored-By: Nathan Sobo --- Cargo.lock | 1 + crates/language/Cargo.toml | 1 + crates/language/src/buffer.rs | 1 + crates/language/src/tests.rs | 47 +++++++++++++++++++++++++++++++---- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4a7112abd41bc7ee3621f0f4d8fa88b026e852f..1952e19e58b5c8829120b5b3f5eb041ac69e4d0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2727,6 +2727,7 @@ dependencies = [ "text", "theme", "tree-sitter", + "tree-sitter-json", "tree-sitter-rust", "unindent", "util", diff --git a/crates/language/Cargo.toml b/crates/language/Cargo.toml index 518753fd753418ef144168f7102d72bca8338cd9..0518261f847fa460bbb2d054e7fc65b9019c4686 100644 --- a/crates/language/Cargo.toml +++ b/crates/language/Cargo.toml @@ -57,5 +57,6 @@ util = { path = "../util", features = ["test-support"] } ctor = "0.1" env_logger = "0.8" rand = "0.8.3" +tree-sitter-json = "0.19.0" tree-sitter-rust = "0.20.0" unindent = "0.1.7" diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index eb68b8bbddb1af10cd7538398430600d361a2e15..348ea225cdc008df5e6d9b506ca84c0327be8126 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -486,6 +486,7 @@ impl Buffer { } pub fn set_language(&mut self, language: Option>, cx: &mut ModelContext) { + *self.syntax_tree.lock() = None; self.language = language; self.reparse(cx); } diff --git a/crates/language/src/tests.rs b/crates/language/src/tests.rs index 0acd4d7d2ffc5a5d9e8db4957da1d04c7430b02c..921a2343d470d3aa624e21eb47f577302549125c 100644 --- a/crates/language/src/tests.rs +++ b/crates/language/src/tests.rs @@ -276,12 +276,32 @@ async fn test_reparse(cx: &mut gpui::TestAppContext) { "arguments: (arguments (identifier)))))))", ) ); +} - fn get_tree_sexp(buffer: &ModelHandle, cx: &gpui::TestAppContext) -> String { - buffer.read_with(cx, |buffer, _| { - buffer.syntax_tree().unwrap().root_node().to_sexp() - }) - } +#[gpui::test] +async fn test_resetting_language(cx: &mut gpui::TestAppContext) { + let buffer = cx.add_model(|cx| { + let mut buffer = Buffer::new(0, "{}", cx).with_language(Arc::new(rust_lang()), cx); + buffer.set_sync_parse_timeout(Duration::ZERO); + buffer + }); + + // Wait for the initial text to parse + buffer + .condition(&cx, |buffer, _| !buffer.is_parsing()) + .await; + assert_eq!( + get_tree_sexp(&buffer, &cx), + "(source_file (expression_statement (block)))" + ); + + buffer.update(cx, |buffer, cx| { + buffer.set_language(Some(Arc::new(json_lang())), cx) + }); + buffer + .condition(&cx, |buffer, _| !buffer.is_parsing()) + .await; + assert_eq!(get_tree_sexp(&buffer, &cx), "(document (object))"); } #[gpui::test] @@ -978,6 +998,23 @@ fn rust_lang() -> Language { .unwrap() } +fn json_lang() -> Language { + Language::new( + LanguageConfig { + name: "Json".into(), + path_suffixes: vec!["js".to_string()], + ..Default::default() + }, + Some(tree_sitter_json::language()), + ) +} + +fn get_tree_sexp(buffer: &ModelHandle, cx: &gpui::TestAppContext) -> String { + buffer.read_with(cx, |buffer, _| { + buffer.syntax_tree().unwrap().root_node().to_sexp() + }) +} + fn empty(point: Point) -> Range { point..point } From cc45658b2d738274628e410769d6b5c654b158c6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 16:01:33 +0200 Subject: [PATCH 068/245] Clear diagnostics from buffer when unregistering it from language server Co-Authored-By: Nathan Sobo --- crates/project/src/project.rs | 58 +++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index e918f2cc70646182e606c8c8570f178382608f90..b3fe42bbd3da47e128cf227957fe46aa78edb06b 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1177,19 +1177,21 @@ impl Project { old_path: PathBuf, cx: &mut ModelContext, ) { - let buffer = &buffer.read(cx); - if let Some((_, language_server)) = self.language_server_for_buffer(buffer, cx) { - language_server - .notify::( - lsp::DidCloseTextDocumentParams { - text_document: lsp::TextDocumentIdentifier::new( - lsp::Url::from_file_path(old_path).unwrap(), - ), - }, - ) - .log_err(); - } - self.buffer_snapshots.remove(&buffer.remote_id()); + buffer.update(cx, |buffer, cx| { + buffer.update_diagnostics(Default::default(), cx); + self.buffer_snapshots.remove(&buffer.remote_id()); + if let Some((_, language_server)) = self.language_server_for_buffer(buffer, cx) { + language_server + .notify::( + lsp::DidCloseTextDocumentParams { + text_document: lsp::TextDocumentIdentifier::new( + lsp::Url::from_file_path(old_path).unwrap(), + ), + }, + ) + .log_err(); + } + }); } fn on_buffer_event( @@ -5189,6 +5191,26 @@ mod tests { }, ); + rust_buffer2.update(cx, |buffer, cx| { + buffer.update_diagnostics( + DiagnosticSet::from_sorted_entries( + vec![DiagnosticEntry { + diagnostic: Default::default(), + range: Anchor::MIN..Anchor::MAX, + }], + &buffer.snapshot(), + ), + cx, + ); + assert_eq!( + buffer + .snapshot() + .diagnostics_in_range::<_, usize>(0..buffer.len(), false) + .count(), + 1 + ); + }); + // When the rename changes the extension of the file, the buffer gets closed on the old // language server and gets opened on the new one. fs.rename( @@ -5219,6 +5241,16 @@ mod tests { language_id: Default::default() }, ); + // We clear the diagnostics, since the language has changed. + rust_buffer2.read_with(cx, |buffer, _| { + assert_eq!( + buffer + .snapshot() + .diagnostics_in_range::<_, usize>(0..buffer.len(), false) + .count(), + 0 + ); + }); // The renamed file's version resets after changing language server. rust_buffer2.update(cx, |buffer, cx| buffer.edit([0..0], "// ", cx)); From 939def42e37d5f5b39f27012bb428d401f3918b3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 16:23:27 +0200 Subject: [PATCH 069/245] v0.24.1 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1952e19e58b5c8829120b5b3f5eb041ac69e4d0a..b76445011cbb70b0e0fe88c83471be58714cb65d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5982,7 +5982,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.24.0" +version = "0.24.1" dependencies = [ "anyhow", "async-compression", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 2e1ef780caf77d6e0ffd0352e60b137ee7a07a71..86011fdb46b5a556163d80437e78045b7f0d64d1 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.24.0" +version = "0.24.1" [lib] name = "zed" From cac0dddb1b4abdd449f4418af3b4fb047768c12d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 19:10:44 +0200 Subject: [PATCH 070/245] Restructure item closing to take the `Workspace` instead of the `Pane` --- crates/workspace/src/pane.rs | 194 ++++++++++++++++-------------- crates/workspace/src/workspace.rs | 7 +- crates/zed/src/zed.rs | 14 +-- 3 files changed, 113 insertions(+), 102 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 66b87c310e348c15d337da7b63df1716b8707d09..dc5c0923dfb1bb2e087ccea234b4f0e7ed422720 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1,5 +1,6 @@ use super::{ItemHandle, SplitDirection}; use crate::{toolbar::Toolbar, Item, Settings, WeakItemHandle, Workspace}; +use anyhow::Result; use collections::{HashMap, VecDeque}; use futures::StreamExt; use gpui::{ @@ -8,10 +9,10 @@ use gpui::{ geometry::{rect::RectF, vector::vec2f}, keymap::Binding, platform::{CursorStyle, NavigationDirection}, - AppContext, Entity, ModelHandle, MutableAppContext, PromptLevel, Quad, RenderContext, Task, - View, ViewContext, ViewHandle, WeakViewHandle, + AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, + ViewContext, ViewHandle, WeakViewHandle, }; -use project::{Project, ProjectEntryId, ProjectPath}; +use project::{ProjectEntryId, ProjectPath}; use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc}; use util::ResultExt; @@ -21,10 +22,16 @@ action!(ActivatePrevItem); action!(ActivateNextItem); action!(CloseActiveItem); action!(CloseInactiveItems); -action!(CloseItem, usize); +action!(CloseItem, CloseItemParams); action!(GoBack, Option>); action!(GoForward, Option>); +#[derive(Clone)] +pub struct CloseItemParams { + pub item_id: usize, + pub pane: WeakViewHandle, +} + const MAX_NAVIGATION_HISTORY_LEN: usize = 1024; pub fn init(cx: &mut MutableAppContext) { @@ -37,14 +44,11 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(|pane: &mut Pane, _: &ActivateNextItem, cx| { pane.activate_next_item(cx); }); - cx.add_action(|pane: &mut Pane, _: &CloseActiveItem, cx| { - pane.close_active_item(cx).detach(); - }); - cx.add_action(|pane: &mut Pane, _: &CloseInactiveItems, cx| { - pane.close_inactive_items(cx).detach(); - }); - cx.add_action(|pane: &mut Pane, action: &CloseItem, cx| { - pane.close_item(action.0, cx).detach(); + cx.add_async_action(Pane::close_active_item); + cx.add_async_action(Pane::close_inactive_items); + cx.add_async_action(|workspace: &mut Workspace, action: &CloseItem, cx| { + let pane = action.0.pane.upgrade(cx)?; + Some(Pane::close_item(workspace, pane, action.0.item_id, cx)) }); cx.add_action(|pane: &mut Pane, action: &Split, cx| { pane.split(action.0, cx); @@ -98,7 +102,6 @@ pub struct Pane { active_item_index: usize, nav_history: Rc>, toolbar: ViewHandle, - project: ModelHandle, } pub struct ItemNavHistory { @@ -134,13 +137,12 @@ pub struct NavigationEntry { } impl Pane { - pub fn new(project: ModelHandle, cx: &mut ViewContext) -> Self { + pub fn new(cx: &mut ViewContext) -> Self { Self { items: Vec::new(), active_item_index: 0, nav_history: Default::default(), toolbar: cx.add_view(|_| Toolbar::new()), - project, } } @@ -410,47 +412,75 @@ impl Pane { self.activate_item(index, true, cx); } - pub fn close_active_item(&mut self, cx: &mut ViewContext) -> Task<()> { - if self.items.is_empty() { - Task::ready(()) + fn close_active_item( + workspace: &mut Workspace, + _: &CloseActiveItem, + cx: &mut ViewContext, + ) -> Option>> { + let pane_handle = workspace.active_pane().clone(); + let pane = pane_handle.read(cx); + if pane.items.is_empty() { + None } else { - self.close_item(self.items[self.active_item_index].id(), cx) + let item_id_to_close = pane.items[pane.active_item_index].id(); + Some(Self::close_items( + workspace, + pane_handle, + cx, + move |item_id| item_id == item_id_to_close, + )) } } - pub fn close_inactive_items(&mut self, cx: &mut ViewContext) -> Task<()> { - if self.items.is_empty() { - Task::ready(()) + pub fn close_inactive_items( + workspace: &mut Workspace, + _: &CloseInactiveItems, + cx: &mut ViewContext, + ) -> Option>> { + let pane_handle = workspace.active_pane().clone(); + let pane = pane_handle.read(cx); + if pane.items.is_empty() { + None } else { - let active_item_id = self.items[self.active_item_index].id(); - self.close_items(cx, move |id| id != active_item_id) + let active_item_id = pane.items[pane.active_item_index].id(); + Some(Self::close_items(workspace, pane_handle, cx, move |id| { + id != active_item_id + })) } } - pub fn close_item(&mut self, view_id_to_close: usize, cx: &mut ViewContext) -> Task<()> { - self.close_items(cx, move |view_id| view_id == view_id_to_close) + pub fn close_item( + workspace: &mut Workspace, + pane: ViewHandle, + item_id_to_close: usize, + cx: &mut ViewContext, + ) -> Task> { + Self::close_items(workspace, pane, cx, move |view_id| { + view_id == item_id_to_close + }) } pub fn close_items( - &mut self, - cx: &mut ViewContext, + workspace: &mut Workspace, + pane: ViewHandle, + cx: &mut ViewContext, should_close: impl 'static + Fn(usize) -> bool, - ) -> Task<()> { + ) -> Task> { const CONFLICT_MESSAGE: &'static str = "This file has changed on disk since you started editing it. Do you want to overwrite it?"; const DIRTY_MESSAGE: &'static str = "This file contains unsaved edits. Do you want to save it?"; - let project = self.project.clone(); + let project = workspace.project().clone(); cx.spawn(|this, mut cx| async move { - while let Some(item_to_close_ix) = this.read_with(&cx, |this, _| { - this.items.iter().position(|item| should_close(item.id())) + while let Some(item_to_close_ix) = pane.read_with(&cx, |pane, _| { + pane.items.iter().position(|item| should_close(item.id())) }) { let item = - this.read_with(&cx, |this, _| this.items[item_to_close_ix].boxed_clone()); + pane.read_with(&cx, |pane, _| pane.items[item_to_close_ix].boxed_clone()); if cx.read(|cx| item.is_dirty(cx)) { if cx.read(|cx| item.can_save(cx)) { - let mut answer = this.update(&mut cx, |this, cx| { - this.activate_item(item_to_close_ix, true, cx); + let mut answer = pane.update(&mut cx, |pane, cx| { + pane.activate_item(item_to_close_ix, true, cx); cx.prompt( PromptLevel::Warning, DIRTY_MESSAGE, @@ -460,21 +490,14 @@ impl Pane { match answer.next().await { Some(0) => { - if cx - .update(|cx| item.save(project.clone(), cx)) - .await - .log_err() - .is_none() - { - break; - } + cx.update(|cx| item.save(project.clone(), cx)).await?; } Some(1) => {} _ => break, } } else if cx.read(|cx| item.can_save_as(cx)) { - let mut answer = this.update(&mut cx, |this, cx| { - this.activate_item(item_to_close_ix, true, cx); + let mut answer = pane.update(&mut cx, |pane, cx| { + pane.activate_item(item_to_close_ix, true, cx); cx.prompt( PromptLevel::Warning, DIRTY_MESSAGE, @@ -494,14 +517,8 @@ impl Pane { let mut abs_path = cx.update(|cx| cx.prompt_for_new_path(&start_abs_path)); if let Some(abs_path) = abs_path.next().await.flatten() { - if cx - .update(|cx| item.save_as(project.clone(), abs_path, cx)) - .await - .log_err() - .is_none() - { - break; - } + cx.update(|cx| item.save_as(project.clone(), abs_path, cx)) + .await?; } else { break; } @@ -511,8 +528,8 @@ impl Pane { } } } else if cx.read(|cx| item.has_conflict(cx) && item.can_save(cx)) { - let mut answer = this.update(&mut cx, |this, cx| { - this.activate_item(item_to_close_ix, true, cx); + let mut answer = pane.update(&mut cx, |pane, cx| { + pane.activate_item(item_to_close_ix, true, cx); cx.prompt( PromptLevel::Warning, CONFLICT_MESSAGE, @@ -522,50 +539,36 @@ impl Pane { match answer.next().await { Some(0) => { - if cx - .update(|cx| item.save(project.clone(), cx)) - .await - .log_err() - .is_none() - { - break; - } + cx.update(|cx| item.save(project.clone(), cx)).await?; } Some(1) => { - if cx - .update(|cx| item.reload(project.clone(), cx)) - .await - .log_err() - .is_none() - { - break; - } + cx.update(|cx| item.reload(project.clone(), cx)).await?; } _ => break, } } - this.update(&mut cx, |this, cx| { - if let Some(item_ix) = this.items.iter().position(|i| i.id() == item.id()) { - if item_ix == this.active_item_index { - if item_ix + 1 < this.items.len() { - this.activate_next_item(cx); + pane.update(&mut cx, |pane, cx| { + if let Some(item_ix) = pane.items.iter().position(|i| i.id() == item.id()) { + if item_ix == pane.active_item_index { + if item_ix + 1 < pane.items.len() { + pane.activate_next_item(cx); } else if item_ix > 0 { - this.activate_prev_item(cx); + pane.activate_prev_item(cx); } } - let item = this.items.remove(item_ix); - if this.items.is_empty() { + let item = pane.items.remove(item_ix); + if pane.items.is_empty() { item.deactivated(cx); cx.emit(Event::Remove); } - if item_ix < this.active_item_index { - this.active_item_index -= 1; + if item_ix < pane.active_item_index { + pane.active_item_index -= 1; } - let mut nav_history = this.nav_history.borrow_mut(); + let mut nav_history = pane.nav_history.borrow_mut(); if let Some(path) = item.project_path(cx) { nav_history.paths_by_item.insert(item.id(), path); } else { @@ -576,6 +579,7 @@ impl Pane { } this.update(&mut cx, |_, cx| cx.notify()); + Ok(()) }) } @@ -607,6 +611,7 @@ impl Pane { let theme = cx.global::().theme.clone(); enum Tabs {} + let pane = cx.handle(); let tabs = MouseEventHandler::new::(0, cx, |mouse_state, cx| { let mut row = Flex::row(); for (ix, item) in self.items.iter().enumerate() { @@ -698,8 +703,14 @@ impl Pane { ) .with_padding(Padding::uniform(4.)) .with_cursor_style(CursorStyle::PointingHand) - .on_click(move |cx| { - cx.dispatch_action(CloseItem(item_id)) + .on_click({ + let pane = pane.clone(); + move |cx| { + cx.dispatch_action(CloseItem(CloseItemParams { + item_id, + pane: pane.clone(), + })) + } }) .named("close-tab-icon") } else { @@ -864,7 +875,8 @@ mod tests { use crate::WorkspaceParams; use super::*; - use gpui::TestAppContext; + use gpui::{ModelHandle, TestAppContext, ViewContext}; + use project::Project; #[gpui::test] async fn test_close_items(cx: &mut TestAppContext) { @@ -908,15 +920,17 @@ mod tests { workspace.active_pane().clone() }); - let close_items = pane.update(cx, |pane, cx| { - pane.activate_item(1, true, cx); - assert_eq!(pane.active_item().unwrap().id(), item2.id()); + let close_items = workspace.update(cx, |workspace, cx| { + pane.update(cx, |pane, cx| { + pane.activate_item(1, true, cx); + assert_eq!(pane.active_item().unwrap().id(), item2.id()); + }); let item1_id = item1.id(); let item3_id = item3.id(); let item4_id = item4.id(); let item5_id = item5.id(); - pane.close_items(cx, move |id| { + Pane::close_items(workspace, pane.clone(), cx, move |id| { [item1_id, item3_id, item4_id, item5_id].contains(&id) }) }); @@ -960,7 +974,7 @@ mod tests { cx.simulate_prompt_answer(window_id, 0); cx.foreground().run_until_parked(); cx.simulate_new_path_selection(|_| Some(Default::default())); - close_items.await; + close_items.await.unwrap(); pane.read_with(cx, |pane, cx| { assert_eq!(item5.read(cx).save_count, 0); assert_eq!(item5.read(cx).save_as_count, 1); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index c447f3a5fd567c1f5f89a11f2e93edce632648b9..cd3e0e7b30e7c4427e168e401b4447c2e8b48c03 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -497,8 +497,7 @@ impl ItemHandle for ViewHandle { } if T::should_close_item_on_event(event) { - pane.update(cx, |pane, cx| pane.close_item(item.id(), cx)) - .detach(); + Pane::close_item(workspace, pane, item.id(), cx).detach_and_log_err(cx); return; } @@ -738,7 +737,7 @@ impl Workspace { }) .detach(); - let pane = cx.add_view(|cx| Pane::new(params.project.clone(), cx)); + let pane = cx.add_view(|cx| Pane::new(cx)); let pane_id = pane.id(); cx.observe(&pane, move |me, _, cx| { let active_entry = me.active_project_path(cx); @@ -1070,7 +1069,7 @@ impl Workspace { } fn add_pane(&mut self, cx: &mut ViewContext) -> ViewHandle { - let pane = cx.add_view(|cx| Pane::new(self.project.clone(), cx)); + let pane = cx.add_view(|cx| Pane::new(cx)); let pane_id = pane.id(); cx.observe(&pane, move |me, _, cx| { let active_entry = me.active_project_path(cx); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index aec0bc533e4a1842789b813c4fc060eaa334e165..b6062fd026434e2db94d83dda481c0ffd97b3ef2 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -878,11 +878,10 @@ mod tests { .update(cx, |workspace, cx| { let editor3_id = editor3.id(); drop(editor3); - workspace - .active_pane() - .update(cx, |pane, cx| pane.close_item(editor3_id, cx)) + Pane::close_item(workspace, workspace.active_pane().clone(), editor3_id, cx) }) - .await; + .await + .unwrap(); workspace .update(cx, |w, cx| Pane::go_forward(w, None, cx)) .await; @@ -896,11 +895,10 @@ mod tests { .update(cx, |workspace, cx| { let editor2_id = editor2.id(); drop(editor2); - workspace - .active_pane() - .update(cx, |pane, cx| pane.close_item(editor2_id, cx)) + Pane::close_item(workspace, workspace.active_pane().clone(), editor2_id, cx) }) - .await; + .await + .unwrap(); app_state .fs .as_fake() From d21dea6112b956317352af8bf22168f7223de15f Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 5 Apr 2022 13:34:06 -0400 Subject: [PATCH 071/245] Squashed commit of the following: commit 66d4cbae2ca6d7dd660688d7eb702ae55bf3e0ca Author: Nate Butler Date: Tue Apr 5 13:33:33 2022 -0400 WIP: Improve legibility of contactsPanel and fix errors Co-Authored-By: Keith Simmons commit 000319c583801c5ba4ed7884bbf3da2a591e3f26 Author: Nate Butler Date: Tue Apr 5 13:13:32 2022 -0400 WIP --- crates/zed/assets/themes/dark.json | 169 +++++++++++++------------- crates/zed/assets/themes/light.json | 95 ++++++++------- styles/nodemon.json | 10 +- styles/src/styleTree/components.ts | 43 +++---- styles/src/styleTree/contactsPanel.ts | 13 +- styles/src/styleTree/search.ts | 2 +- styles/src/styleTree/workspace.ts | 4 +- styles/src/themes/dark.ts | 10 +- styles/src/themes/theme.ts | 21 ++-- 9 files changed, 184 insertions(+), 183 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 1334a65727f8d099b5bc363fd0e432ef828808ba..1c277935cf21743d599feaaa7ed9e0b2709a5c5c 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -51,7 +51,7 @@ "empty": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "padding": { @@ -66,20 +66,20 @@ "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#2b2b2b", + "color": "#474747", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#103063" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#f1f1f1", - "size": 16 + "size": 14 }, "border": { - "color": "#151515", + "color": "#232323", "width": 1 }, "padding": { @@ -209,7 +209,7 @@ } }, "pane_divider": { - "color": "#070707", + "color": "#232323", "width": 1 }, "status_bar": { @@ -221,17 +221,17 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 } }, @@ -240,7 +240,7 @@ "height": 32, "background": "#2b2b2b", "share_icon_color": "#9c9c9c", - "share_icon_active_color": "#ffffff", + "share_icon_active_color": "#1096d3", "title": { "family": "Zed Sans", "color": "#f1f1f1", @@ -297,7 +297,7 @@ "height": 34, "background": "#000000", "border": { - "color": "#151515", + "color": "#232323", "width": 1, "bottom": true }, @@ -312,7 +312,7 @@ "breadcrumbs": { "family": "Zed Mono", "color": "#9c9c9c", - "size": 16, + "size": 14, "padding": { "left": 6 } @@ -331,48 +331,48 @@ "code_actions_indicator": "#9c9c9c", "diff_background_deleted": "#f15656", "diff_background_inserted": "#1b9447", - "document_highlight_read_background": "#2b2b2b", - "document_highlight_write_background": "#2b2b2b", + "document_highlight_read_background": "#14a89829", + "document_highlight_write_background": "#14a89852", "error_color": "#f15656", "gutter_background": "#000000", "gutter_padding_factor": 3.5, "highlighted_line_background": "#070707", - "line_number": "#636363", + "line_number": "#808080", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, "selection": { "cursor": "#2472f2", - "selection": "#103063" + "selection": "#2472f24d" }, "guest_selections": [ { "cursor": "#79ba16", - "selection": "#38530f" + "selection": "#79ba164d" }, { "cursor": "#484bed", - "selection": "#121269" + "selection": "#484bed4d" }, { "cursor": "#ee670a", - "selection": "#5d2f0e" + "selection": "#ee670a4d" }, { "cursor": "#993bf3", - "selection": "#3e1169" + "selection": "#993bf34d" }, { "cursor": "#16d6c1", - "selection": "#0e4f48" + "selection": "#16d6c14d" }, { "cursor": "#ef59a3", - "selection": "#fbc6e1" + "selection": "#ef59a34d" }, { "cursor": "#f7bf17", - "selection": "#fce9b7" + "selection": "#f7bf174d" } ], "autocomplete": { @@ -380,7 +380,7 @@ "corner_radius": 6, "padding": 6, "border": { - "color": "#151515", + "color": "#232323", "width": 1 }, "item": { @@ -425,14 +425,14 @@ "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#151515", + "color": "#232323", "width": 1, "bottom": true, "top": true }, "code": { "family": "Zed Mono", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "left": 10 @@ -462,7 +462,7 @@ }, "path": { "family": "Zed Mono", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "left": 12 @@ -573,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "weight": "bold" } @@ -596,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "weight": "bold" } @@ -619,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "weight": "bold" } @@ -642,12 +642,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "weight": "bold" } @@ -680,7 +680,7 @@ "color": "#ee670a", "italic": true }, - "list_marker": "#20b0f2" + "list_marker": "#c6c6c6" } }, "project_diagnostics": { @@ -690,11 +690,11 @@ "empty_message": { "family": "Zed Sans", "color": "#f1f1f1", - "size": 14 + "size": 18 }, "status_bar_item": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 10 @@ -768,7 +768,7 @@ }, "channel_name_hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "padding": { "right": 8 @@ -787,7 +787,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -804,7 +804,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -821,7 +821,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -839,7 +839,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -856,7 +856,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14, "margin": { "right": 8 @@ -903,7 +903,7 @@ }, "timestamp": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "padding": { @@ -922,12 +922,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "padding": { @@ -935,7 +935,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "weight": "bold", "size": 14, "margin": { @@ -949,19 +949,19 @@ "text": { "family": "Zed Mono", "color": "#f1f1f1", - "size": 16 + "size": 14 }, "placeholder_text": { "family": "Zed Mono", - "color": "#2b2b2b", + "color": "#474747", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#103063" + "selection": "#2472f24d" }, "border": { - "color": "#151515", + "color": "#232323", "width": 1 }, "padding": { @@ -980,7 +980,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#232323", + "tree_branch_color": "#404040", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -988,8 +988,8 @@ }, "host_username": { "family": "Zed Mono", - "color": "#636363", - "size": 16, + "color": "#f1f1f1", + "size": 14, "padding": { "left": 8 } @@ -1003,8 +1003,8 @@ }, "name": { "family": "Zed Mono", - "color": "#9c9c9c", - "size": 16, + "color": "#474747", + "size": 14, "margin": { "right": 6 } @@ -1022,15 +1022,17 @@ }, "name": { "family": "Zed Mono", - "color": "#f1f1f1", - "size": 16, + "color": "#9c9c9c", + "size": 14, "margin": { "right": 6 } }, "padding": { "left": 8 - } + }, + "background": "#1c1c1c", + "corner_radius": 6 }, "hovered_shared_project": { "guest_avatar_spacing": 4, @@ -1041,8 +1043,8 @@ }, "name": { "family": "Zed Mono", - "color": "#f1f1f1", - "size": 16, + "color": "#9c9c9c", + "size": 14, "margin": { "right": 6 } @@ -1050,7 +1052,7 @@ "padding": { "left": 8 }, - "background": "#0e0e0e", + "background": "#232323", "corner_radius": 6 }, "unshared_project": { @@ -1062,8 +1064,8 @@ }, "name": { "family": "Zed Mono", - "color": "#9c9c9c", - "size": 16, + "color": "#474747", + "size": 14, "margin": { "right": 6 } @@ -1081,8 +1083,8 @@ }, "name": { "family": "Zed Mono", - "color": "#9c9c9c", - "size": 16, + "color": "#474747", + "size": 14, "margin": { "right": 6 } @@ -1090,18 +1092,17 @@ "padding": { "left": 8 }, - "background": "#0e0e0e", "corner_radius": 6 } }, "search": { - "match_background": "#0a2633", + "match_background": "#1096d329", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", "color": "#9c9c9c", - "size": 16, + "size": 14, "background": "#2b2b2b", "corner_radius": 6, "border": { @@ -1122,7 +1123,7 @@ "active_option_button": { "family": "Zed Mono", "color": "#9c9c9c", - "size": 16, + "size": 14, "background": "#2b2b2b", "corner_radius": 6, "border": { @@ -1147,20 +1148,20 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#2b2b2b", - "size": 16 + "color": "#474747", + "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#103063" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#f1f1f1", - "size": 16 + "size": 14 }, "border": { - "color": "#070707", + "color": "#232323", "width": 1 }, "margin": { @@ -1176,7 +1177,7 @@ "hovered_option_button": { "family": "Zed Mono", "color": "#9c9c9c", - "size": 16, + "size": 14, "background": "#2b2b2b", "corner_radius": 6, "border": { @@ -1201,17 +1202,17 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#2b2b2b", - "size": 16 + "color": "#474747", + "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#103063" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#f1f1f1", - "size": 16 + "size": 14 }, "border": { "color": "#eb2d2d", @@ -1229,14 +1230,14 @@ }, "match_index": { "family": "Zed Mono", - "color": "#636363", - "size": 16, + "color": "#808080", + "size": 14, "padding": 6 }, "option_button": { "family": "Zed Mono", "color": "#9c9c9c", - "size": 16, + "size": 14, "background": "#1c1c1c", "corner_radius": 6, "border": { diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 283b3b10b32e3886fe15736e8e6d9cbb7091e3a5..7871e348530e53ea7a025ef4b0ca3e31e8ff32a9 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -71,12 +71,12 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#c5dafc" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#2b2b2b", - "size": 16 + "size": 14 }, "border": { "color": "#e3e3e3", @@ -209,7 +209,7 @@ } }, "pane_divider": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1 }, "status_bar": { @@ -240,7 +240,7 @@ "height": 32, "background": "#e3e3e3", "share_icon_color": "#717171", - "share_icon_active_color": "#000000", + "share_icon_active_color": "#1179a8", "title": { "family": "Zed Sans", "color": "#2b2b2b", @@ -312,7 +312,7 @@ "breadcrumbs": { "family": "Zed Mono", "color": "#555555", - "size": 16, + "size": 14, "padding": { "left": 6 } @@ -331,8 +331,8 @@ "code_actions_indicator": "#717171", "diff_background_deleted": "#fcc6c6", "diff_background_inserted": "#b7f9ce", - "document_highlight_read_background": "#f1f1f1", - "document_highlight_write_background": "#f1f1f1", + "document_highlight_read_background": "#14a89829", + "document_highlight_write_background": "#14a89852", "error_color": "#eb2d2d", "gutter_background": "#ffffff", "gutter_padding_factor": 3.5, @@ -343,36 +343,36 @@ "unnecessary_code_fade": 0.5, "selection": { "cursor": "#2472f2", - "selection": "#c5dafc" + "selection": "#2472f24d" }, "guest_selections": [ { "cursor": "#79ba16", - "selection": "#dffab5" + "selection": "#79ba164d" }, { "cursor": "#484bed", - "selection": "#cdcdfc" + "selection": "#484bed4d" }, { "cursor": "#ee670a", - "selection": "#fcd6bd" + "selection": "#ee670a4d" }, { "cursor": "#993bf3", - "selection": "#e4cbfc" + "selection": "#993bf34d" }, { "cursor": "#16d6c1", - "selection": "#b1faf2" + "selection": "#16d6c14d" }, { "cursor": "#ef59a3", - "selection": "#fbc6e1" + "selection": "#ef59a34d" }, { "cursor": "#f7bf17", - "selection": "#fce9b7" + "selection": "#f7bf174d" } ], "autocomplete": { @@ -680,7 +680,7 @@ "color": "#ee670a", "italic": true }, - "list_marker": "#20b0f2" + "list_marker": "#393939" } }, "project_diagnostics": { @@ -690,7 +690,7 @@ "empty_message": { "family": "Zed Sans", "color": "#2b2b2b", - "size": 14 + "size": 18 }, "status_bar_item": { "family": "Zed Sans", @@ -949,7 +949,7 @@ "text": { "family": "Zed Mono", "color": "#2b2b2b", - "size": 16 + "size": 14 }, "placeholder_text": { "family": "Zed Mono", @@ -958,7 +958,7 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#c5dafc" + "selection": "#2472f24d" }, "border": { "color": "#e3e3e3", @@ -988,8 +988,8 @@ }, "host_username": { "family": "Zed Mono", - "color": "#808080", - "size": 16, + "color": "#2b2b2b", + "size": 14, "padding": { "left": 8 } @@ -1003,8 +1003,8 @@ }, "name": { "family": "Zed Mono", - "color": "#555555", - "size": 16, + "color": "#aaaaaa", + "size": 14, "margin": { "right": 6 } @@ -1022,15 +1022,17 @@ }, "name": { "family": "Zed Mono", - "color": "#2b2b2b", - "size": 16, + "color": "#555555", + "size": 14, "margin": { "right": 6 } }, "padding": { "left": 8 - } + }, + "background": "#f1f1f1", + "corner_radius": 6 }, "hovered_shared_project": { "guest_avatar_spacing": 4, @@ -1041,8 +1043,8 @@ }, "name": { "family": "Zed Mono", - "color": "#2b2b2b", - "size": 16, + "color": "#555555", + "size": 14, "margin": { "right": 6 } @@ -1050,7 +1052,7 @@ "padding": { "left": 8 }, - "background": "#f1f1f1", + "background": "#e3e3e3", "corner_radius": 6 }, "unshared_project": { @@ -1062,8 +1064,8 @@ }, "name": { "family": "Zed Mono", - "color": "#555555", - "size": 16, + "color": "#aaaaaa", + "size": 14, "margin": { "right": 6 } @@ -1081,8 +1083,8 @@ }, "name": { "family": "Zed Mono", - "color": "#555555", - "size": 16, + "color": "#aaaaaa", + "size": 14, "margin": { "right": 6 } @@ -1090,18 +1092,17 @@ "padding": { "left": 8 }, - "background": "#f1f1f1", "corner_radius": 6 } }, "search": { - "match_background": "#ffffff", + "match_background": "#1096d329", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", "color": "#555555", - "size": 16, + "size": 14, "background": "#e3e3e3", "corner_radius": 6, "border": { @@ -1122,7 +1123,7 @@ "active_option_button": { "family": "Zed Mono", "color": "#555555", - "size": 16, + "size": 14, "background": "#e3e3e3", "corner_radius": 6, "border": { @@ -1148,19 +1149,19 @@ "placeholder_text": { "family": "Zed Mono", "color": "#aaaaaa", - "size": 16 + "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#c5dafc" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#2b2b2b", - "size": 16 + "size": 14 }, "border": { - "color": "#c6c6c6", + "color": "#e3e3e3", "width": 1 }, "margin": { @@ -1176,7 +1177,7 @@ "hovered_option_button": { "family": "Zed Mono", "color": "#555555", - "size": 16, + "size": 14, "background": "#e3e3e3", "corner_radius": 6, "border": { @@ -1202,16 +1203,16 @@ "placeholder_text": { "family": "Zed Mono", "color": "#aaaaaa", - "size": 16 + "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#c5dafc" + "selection": "#2472f24d" }, "text": { "family": "Zed Mono", "color": "#2b2b2b", - "size": 16 + "size": 14 }, "border": { "color": "#f9a0a0", @@ -1230,13 +1231,13 @@ "match_index": { "family": "Zed Mono", "color": "#808080", - "size": 16, + "size": 14, "padding": 6 }, "option_button": { "family": "Zed Mono", "color": "#555555", - "size": 16, + "size": 14, "background": "#f1f1f1", "corner_radius": 6, "border": { diff --git a/styles/nodemon.json b/styles/nodemon.json index 24022a55ad3aa2137a6fec03cdc1c97fa4e59e76..ae631a5ec4931af8173529733ab1fb6973651aad 100644 --- a/styles/nodemon.json +++ b/styles/nodemon.json @@ -1,6 +1,8 @@ { - "watch": ["./**/*"], - "ext": "ts", - "ignore": [], - "exec": "ts-node buildThemes.ts" + "watch": [ + "./**/*" + ], + "ext": "ts", + "ignore": [], + "exec": "ts-node src/buildThemes.ts" } \ No newline at end of file diff --git a/styles/src/styleTree/components.ts b/styles/src/styleTree/components.ts index 155d36d312b753ac8ff8c95d04e90d1a603595fc..08a8aa08545406c35723479ba99bc983f5199b6f 100644 --- a/styles/src/styleTree/components.ts +++ b/styles/src/styleTree/components.ts @@ -1,16 +1,9 @@ import chroma from "chroma-js"; -import Theme, { BackgroundColor } from "../themes/theme"; -import { fontFamilies, fontSizes, FontFamily, FontWeight, FontSize } from "../tokens"; +import Theme, { BackgroundColorSet } from "../themes/theme"; +import { fontFamilies, fontSizes, FontWeight } from "../tokens"; import { Color } from "../utils/color"; export type TextColor = keyof Theme["textColor"]; -export interface Text { - family: FontFamily, - color: Color, - size: FontSize, - weight?: FontWeight, - underline?: boolean, -} export function text( theme: Theme, fontFamily: keyof typeof fontFamilies, @@ -20,18 +13,20 @@ export function text( weight?: FontWeight; underline?: boolean; } -): Text { - let extraProperties = { - ...properties, - size: fontSizes[properties.size || "sm"].value, - }; +) { + let size = fontSizes[properties?.size || "sm"].value; return { family: fontFamilies[fontFamily].value, color: theme.textColor[color].value, - ...extraProperties, + ...properties, + size, }; } +export function textColor(theme: Theme, color: TextColor) { + return theme.textColor[color].value; +} +export type BorderColor = keyof Theme["borderColor"]; export interface BorderOptions { width?: number; top?: boolean; @@ -42,7 +37,7 @@ export interface BorderOptions { } export function border( theme: Theme, - color: keyof Theme["borderColor"], + color: BorderColor, options?: BorderOptions ) { return { @@ -51,25 +46,25 @@ export function border( ...options, }; } - -export function borderColor(theme: Theme, color: keyof Theme["borderColor"]) { +export function borderColor(theme: Theme, color: BorderColor) { return theme.borderColor[color].value; } -export function iconColor(theme: Theme, color: keyof Theme["iconColor"]) { +export type IconColor = keyof Theme["iconColor"]; +export function iconColor(theme: Theme, color: IconColor) { return theme.iconColor[color].value; } +export type PlayerIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; export interface Player { selection: { cursor: Color; selection: Color; }; } - export function player( theme: Theme, - playerNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 + playerNumber: PlayerIndex, ): Player { return { selection: { @@ -79,10 +74,12 @@ export function player( }; } +export type BackgroundColor = keyof Theme["backgroundColor"]; +export type BackgroundState = keyof BackgroundColorSet; export function backgroundColor( theme: Theme, - name: keyof Theme["backgroundColor"], - state?: keyof BackgroundColor + name: BackgroundColor, + state?: BackgroundState, ): Color { return theme.backgroundColor[name][state || "base"].value; } diff --git a/styles/src/styleTree/contactsPanel.ts b/styles/src/styleTree/contactsPanel.ts index 9b88a35f13692712cd61c89d4af75476d7bb49c6..6d432756472251de0cfa52a1e4176bea22af88aa 100644 --- a/styles/src/styleTree/contactsPanel.ts +++ b/styles/src/styleTree/contactsPanel.ts @@ -1,6 +1,6 @@ import Theme from "../themes/theme"; import { panel } from "./app"; -import { borderColor, text } from "./components"; +import { backgroundColor, borderColor, text } from "./components"; export default function(theme: Theme) { const project = { @@ -11,7 +11,7 @@ export default function(theme: Theme) { width: 14, }, name: { - ...text(theme, "mono", "secondary"), + ...text(theme, "mono", "placeholder", { size: "sm" }), margin: { right: 6, }, @@ -23,9 +23,11 @@ export default function(theme: Theme) { const sharedProject = { ...project, + background: backgroundColor(theme, 300), + cornerRadius: 6, name: { ...project.name, - ...text(theme, "mono", "primary"), + ...text(theme, "mono", "secondary", { size: "sm" }), }, }; @@ -39,7 +41,7 @@ export default function(theme: Theme) { width: 18, }, hostUsername: { - ...text(theme, "mono", "muted"), + ...text(theme, "mono", "primary", { size: "sm" }), padding: { left: 8, }, @@ -48,13 +50,12 @@ export default function(theme: Theme) { sharedProject, hoveredSharedProject: { ...sharedProject, - background: theme.editor.line.active.value, + background: backgroundColor(theme, 300, "hovered"), cornerRadius: 6, }, unsharedProject: project, hoveredUnsharedProject: { ...project, - background: theme.editor.line.active.value, cornerRadius: 6, }, } diff --git a/styles/src/styleTree/search.ts b/styles/src/styleTree/search.ts index 7a3d374e5a6c4dae21bb5963e91820a392a0643e..7e08569acd0f9cbd80861db0be26b0ebfe961bc9 100644 --- a/styles/src/styleTree/search.ts +++ b/styles/src/styleTree/search.ts @@ -27,7 +27,7 @@ export default function search(theme: Theme) { placeholderText: text(theme, "mono", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), - border: border(theme, "primary"), + border: border(theme, "secondary"), margin: { right: 5, }, diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index d21bed24aabe9fe841c1d4bba8b6ac21e08c052b..a65356c636830fdf8283bfdbf23cd0c1eb5a636d 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -79,7 +79,7 @@ export default function workspace(theme: Theme) { border: border(theme, "primary", { left: true }), }, paneDivider: { - color: border(theme, "primary").color, + color: border(theme, "secondary").color, width: 1, }, status_bar: { @@ -98,7 +98,7 @@ export default function workspace(theme: Theme) { height: 32, background: backgroundColor(theme, 100), shareIconColor: iconColor(theme, "secondary"), - shareIconActiveColor: iconColor(theme, "active"), + shareIconActiveColor: iconColor(theme, "feature"), title: text(theme, "sans", "primary"), avatar: { cornerRadius: 10, diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index c1d68232b14236eb8d17dfdf906d50b0410da25e..b9893430d334ab904ac4619bb4582eda5892501a 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -1,4 +1,4 @@ -import { Color, colors, fontWeights, NumberToken } from "../tokens"; +import { colors, fontWeights, NumberToken } from "../tokens"; import { withOpacity } from "../utils/color"; import Theme, { buildPlayer, Syntax } from "./theme"; @@ -49,8 +49,8 @@ const backgroundColor = { const borderColor = { primary: colors.neutral[875], - secondary: colors.neutral[825], - muted: colors.neutral[775], + secondary: colors.neutral[775], + muted: colors.neutral[675], focused: colors.neutral[500], active: colors.neutral[900], ok: colors.green[500], @@ -62,8 +62,8 @@ const borderColor = { const textColor = { primary: colors.neutral[50], secondary: colors.neutral[350], - muted: colors.neutral[550], - placeholder: colors.neutral[750], + muted: colors.neutral[450], + placeholder: colors.neutral[650], active: colors.neutral[0], //TODO: (design) define feature and it's correct value feature: colors.sky[500], diff --git a/styles/src/themes/theme.ts b/styles/src/themes/theme.ts index 94a508529d5184c5a77c8c3ca1d9729e091d39c0..d7ba990e73ea3ec0fd94198fee0b902ecd3fd9ec 100644 --- a/styles/src/themes/theme.ts +++ b/styles/src/themes/theme.ts @@ -1,5 +1,5 @@ import { ColorToken, FontWeightToken, NumberToken } from "../tokens"; -import { Color, withOpacity } from "../utils/color"; +import { withOpacity } from "../utils/color"; export interface SyntaxHighlightStyle { color: ColorToken; @@ -21,12 +21,12 @@ export function buildPlayer( return { baseColor: color, cursorColor: withOpacity(color, cursorOpacity || 1.0), - selectionColor: withOpacity(color, selectionOpacity || 0.1), + selectionColor: withOpacity(color, selectionOpacity || 0.3), borderColor: withOpacity(color, borderOpacity || 0.8), } } -export interface BackgroundColor { +export interface BackgroundColorSet { base: ColorToken; hovered: ColorToken; active: ColorToken; @@ -55,19 +55,18 @@ export interface Syntax { emphasisStrong: SyntaxHighlightStyle; linkUrl: SyntaxHighlightStyle; linkText: SyntaxHighlightStyle; - listMarker: SyntaxHighlightStyle; }; export default interface Theme { name: string; backgroundColor: { - 100: BackgroundColor; - 300: BackgroundColor; - 500: BackgroundColor; - ok: BackgroundColor; - error: BackgroundColor; - warning: BackgroundColor; - info: BackgroundColor; + 100: BackgroundColorSet; + 300: BackgroundColorSet; + 500: BackgroundColorSet; + ok: BackgroundColorSet; + error: BackgroundColorSet; + warning: BackgroundColorSet; + info: BackgroundColorSet; }; borderColor: { primary: ColorToken; From c3b947ca264717c747bc6d68695f0c6735122ffe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 19:38:27 +0200 Subject: [PATCH 072/245] Show unsaved/conflict prompt only when closing the last tab for an item Also, ensure we show the correct prompt when files have conflicts. Co-Authored-By: Nathan Sobo --- crates/workspace/src/pane.rs | 218 ++++++++++++++++++++++------------- 1 file changed, 137 insertions(+), 81 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index dc5c0923dfb1bb2e087ccea234b4f0e7ed422720..baf1c2e405650cdddfe891a773177820d50dc3f4 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -471,20 +471,31 @@ impl Pane { "This file contains unsaved edits. Do you want to save it?"; let project = workspace.project().clone(); - cx.spawn(|this, mut cx| async move { + cx.spawn(|workspace, mut cx| async move { while let Some(item_to_close_ix) = pane.read_with(&cx, |pane, _| { pane.items.iter().position(|item| should_close(item.id())) }) { let item = pane.read_with(&cx, |pane, _| pane.items[item_to_close_ix].boxed_clone()); - if cx.read(|cx| item.is_dirty(cx)) { - if cx.read(|cx| item.can_save(cx)) { + + let is_last_item_for_entry = workspace.read_with(&cx, |workspace, cx| { + let project_entry_id = item.project_entry_id(cx); + project_entry_id.is_none() + || workspace + .items(cx) + .filter(|item| item.project_entry_id(cx) == project_entry_id) + .count() + == 1 + }); + + if is_last_item_for_entry { + if cx.read(|cx| item.has_conflict(cx) && item.can_save(cx)) { let mut answer = pane.update(&mut cx, |pane, cx| { pane.activate_item(item_to_close_ix, true, cx); cx.prompt( PromptLevel::Warning, - DIRTY_MESSAGE, - &["Save", "Don't Save", "Cancel"], + CONFLICT_MESSAGE, + &["Overwrite", "Discard", "Cancel"], ) }); @@ -492,59 +503,67 @@ impl Pane { Some(0) => { cx.update(|cx| item.save(project.clone(), cx)).await?; } - Some(1) => {} + Some(1) => { + cx.update(|cx| item.reload(project.clone(), cx)).await?; + } _ => break, } - } else if cx.read(|cx| item.can_save_as(cx)) { - let mut answer = pane.update(&mut cx, |pane, cx| { - pane.activate_item(item_to_close_ix, true, cx); - cx.prompt( - PromptLevel::Warning, - DIRTY_MESSAGE, - &["Save", "Don't Save", "Cancel"], - ) - }); + } else if cx.read(|cx| item.is_dirty(cx)) { + if cx.read(|cx| item.can_save(cx)) { + let mut answer = pane.update(&mut cx, |pane, cx| { + pane.activate_item(item_to_close_ix, true, cx); + cx.prompt( + PromptLevel::Warning, + DIRTY_MESSAGE, + &["Save", "Don't Save", "Cancel"], + ) + }); - match answer.next().await { - Some(0) => { - let start_abs_path = project - .read_with(&cx, |project, cx| { - let worktree = project.visible_worktrees(cx).next()?; - Some(worktree.read(cx).as_local()?.abs_path().to_path_buf()) - }) - .unwrap_or(Path::new("").into()); - - let mut abs_path = - cx.update(|cx| cx.prompt_for_new_path(&start_abs_path)); - if let Some(abs_path) = abs_path.next().await.flatten() { - cx.update(|cx| item.save_as(project.clone(), abs_path, cx)) - .await?; - } else { - break; + match answer.next().await { + Some(0) => { + cx.update(|cx| item.save(project.clone(), cx)).await?; } + Some(1) => {} + _ => break, + } + } else if cx.read(|cx| item.can_save_as(cx)) { + let mut answer = pane.update(&mut cx, |pane, cx| { + pane.activate_item(item_to_close_ix, true, cx); + cx.prompt( + PromptLevel::Warning, + DIRTY_MESSAGE, + &["Save", "Don't Save", "Cancel"], + ) + }); + + match answer.next().await { + Some(0) => { + let start_abs_path = project + .read_with(&cx, |project, cx| { + let worktree = project.visible_worktrees(cx).next()?; + Some( + worktree + .read(cx) + .as_local()? + .abs_path() + .to_path_buf(), + ) + }) + .unwrap_or(Path::new("").into()); + + let mut abs_path = + cx.update(|cx| cx.prompt_for_new_path(&start_abs_path)); + if let Some(abs_path) = abs_path.next().await.flatten() { + cx.update(|cx| item.save_as(project.clone(), abs_path, cx)) + .await?; + } else { + break; + } + } + Some(1) => {} + _ => break, } - Some(1) => {} - _ => break, - } - } - } else if cx.read(|cx| item.has_conflict(cx) && item.can_save(cx)) { - let mut answer = pane.update(&mut cx, |pane, cx| { - pane.activate_item(item_to_close_ix, true, cx); - cx.prompt( - PromptLevel::Warning, - CONFLICT_MESSAGE, - &["Overwrite", "Discard", "Cancel"], - ) - }); - - match answer.next().await { - Some(0) => { - cx.update(|cx| item.save(project.clone(), cx)).await?; - } - Some(1) => { - cx.update(|cx| item.reload(project.clone(), cx)).await?; } - _ => break, } } @@ -578,7 +597,7 @@ impl Pane { }); } - this.update(&mut cx, |_, cx| cx.notify()); + pane.update(&mut cx, |_, cx| cx.notify()); Ok(()) }) } @@ -872,11 +891,11 @@ impl NavHistory { #[cfg(test)] mod tests { - use crate::WorkspaceParams; - use super::*; + use crate::WorkspaceParams; use gpui::{ModelHandle, TestAppContext, ViewContext}; use project::Project; + use std::sync::atomic::AtomicUsize; #[gpui::test] async fn test_close_items(cx: &mut TestAppContext) { @@ -886,7 +905,7 @@ mod tests { let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx)); let item1 = cx.add_view(window_id, |_| { let mut item = TestItem::new(); - item.has_conflict = true; + item.is_dirty = true; item }); let item2 = cx.add_view(window_id, |_| { @@ -897,15 +916,11 @@ mod tests { }); let item3 = cx.add_view(window_id, |_| { let mut item = TestItem::new(); + item.is_dirty = true; item.has_conflict = true; item }); let item4 = cx.add_view(window_id, |_| { - let mut item = TestItem::new(); - item.is_dirty = true; - item - }); - let item5 = cx.add_view(window_id, |_| { let mut item = TestItem::new(); item.is_dirty = true; item.can_save = false; @@ -916,7 +931,6 @@ mod tests { workspace.add_item(Box::new(item2.clone()), cx); workspace.add_item(Box::new(item3.clone()), cx); workspace.add_item(Box::new(item4.clone()), cx); - workspace.add_item(Box::new(item5.clone()), cx); workspace.active_pane().clone() }); @@ -929,15 +943,14 @@ mod tests { let item1_id = item1.id(); let item3_id = item3.id(); let item4_id = item4.id(); - let item5_id = item5.id(); Pane::close_items(workspace, pane.clone(), cx, move |id| { - [item1_id, item3_id, item4_id, item5_id].contains(&id) + [item1_id, item3_id, item4_id].contains(&id) }) }); cx.foreground().run_until_parked(); pane.read_with(cx, |pane, _| { - assert_eq!(pane.items.len(), 5); + assert_eq!(pane.items.len(), 4); assert_eq!(pane.active_item().unwrap().id(), item1.id()); }); @@ -947,7 +960,7 @@ mod tests { assert_eq!(item1.read(cx).save_count, 1); assert_eq!(item1.read(cx).save_as_count, 0); assert_eq!(item1.read(cx).reload_count, 0); - assert_eq!(pane.items.len(), 4); + assert_eq!(pane.items.len(), 3); assert_eq!(pane.active_item().unwrap().id(), item3.id()); }); @@ -957,18 +970,8 @@ mod tests { assert_eq!(item3.read(cx).save_count, 0); assert_eq!(item3.read(cx).save_as_count, 0); assert_eq!(item3.read(cx).reload_count, 1); - assert_eq!(pane.items.len(), 3); - assert_eq!(pane.active_item().unwrap().id(), item4.id()); - }); - - cx.simulate_prompt_answer(window_id, 0); - cx.foreground().run_until_parked(); - pane.read_with(cx, |pane, cx| { - assert_eq!(item4.read(cx).save_count, 1); - assert_eq!(item4.read(cx).save_as_count, 0); - assert_eq!(item4.read(cx).reload_count, 0); assert_eq!(pane.items.len(), 2); - assert_eq!(pane.active_item().unwrap().id(), item5.id()); + assert_eq!(pane.active_item().unwrap().id(), item4.id()); }); cx.simulate_prompt_answer(window_id, 0); @@ -976,14 +979,58 @@ mod tests { cx.simulate_new_path_selection(|_| Some(Default::default())); close_items.await.unwrap(); pane.read_with(cx, |pane, cx| { - assert_eq!(item5.read(cx).save_count, 0); - assert_eq!(item5.read(cx).save_as_count, 1); - assert_eq!(item5.read(cx).reload_count, 0); + assert_eq!(item4.read(cx).save_count, 0); + assert_eq!(item4.read(cx).save_as_count, 1); + assert_eq!(item4.read(cx).reload_count, 0); assert_eq!(pane.items.len(), 1); assert_eq!(pane.active_item().unwrap().id(), item2.id()); }); } + #[gpui::test] + async fn test_prompting_only_on_last_item_for_entry(cx: &mut TestAppContext) { + cx.foreground().forbid_parking(); + + let params = cx.update(WorkspaceParams::test); + let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx)); + let item = cx.add_view(window_id, |_| { + let mut item = TestItem::new(); + item.is_dirty = true; + item.project_entry_id = Some(ProjectEntryId::new(&AtomicUsize::new(1))); + item + }); + + let (left_pane, right_pane) = workspace.update(cx, |workspace, cx| { + workspace.add_item(Box::new(item.clone()), cx); + let left_pane = workspace.active_pane().clone(); + let right_pane = workspace.split_pane(left_pane.clone(), SplitDirection::Right, cx); + (left_pane, right_pane) + }); + + workspace + .update(cx, |workspace, cx| { + let item = right_pane.read(cx).active_item().unwrap(); + Pane::close_item(workspace, right_pane.clone(), item.id(), cx) + }) + .await + .unwrap(); + workspace.read_with(cx, |workspace, _| { + assert_eq!(workspace.panes(), [left_pane.clone()]); + }); + + let close_item = workspace.update(cx, |workspace, cx| { + let item = left_pane.read(cx).active_item().unwrap(); + Pane::close_item(workspace, left_pane.clone(), item.id(), cx) + }); + cx.foreground().run_until_parked(); + cx.simulate_prompt_answer(window_id, 0); + close_item.await.unwrap(); + left_pane.read_with(cx, |pane, _| { + assert_eq!(pane.items.len(), 0); + }); + } + + #[derive(Clone)] struct TestItem { save_count: usize, save_as_count: usize, @@ -991,6 +1038,7 @@ mod tests { is_dirty: bool, has_conflict: bool, can_save: bool, + project_entry_id: Option, } impl TestItem { @@ -1002,6 +1050,7 @@ mod tests { is_dirty: false, has_conflict: false, can_save: true, + project_entry_id: None, } } } @@ -1030,11 +1079,18 @@ mod tests { } fn project_entry_id(&self, _: &AppContext) -> Option { - None + self.project_entry_id } fn set_nav_history(&mut self, _: ItemNavHistory, _: &mut ViewContext) {} + fn clone_on_split(&self, _: &mut ViewContext) -> Option + where + Self: Sized, + { + Some(self.clone()) + } + fn is_dirty(&self, _: &AppContext) -> bool { self.is_dirty } From 3da8f7f94409354e0985443cfb618b0d6b231ad8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 11:55:29 -0600 Subject: [PATCH 073/245] Fix dispatch path in test --- crates/zed/src/zed.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index b6062fd026434e2db94d83dda481c0ffd97b3ef2..d3ce28ff5b96afb0835ffceae27a34a85b09b400 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -744,7 +744,11 @@ mod tests { let pane2_item = pane_2.read(cx).active_item().unwrap(); assert_eq!(pane2_item.project_path(cx.as_ref()), Some(file1.clone())); - cx.dispatch_action(window_id, vec![pane_2.id()], &workspace::CloseActiveItem); + cx.dispatch_action( + window_id, + vec![workspace.id(), pane_2.id()], + &workspace::CloseActiveItem, + ); }); cx.foreground().run_until_parked(); workspace.read_with(cx, |workspace, _| { From e2bf89b1e878b9fc2a097b2dfd5472b035f4d7f0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 12:08:25 -0600 Subject: [PATCH 074/245] Don't require a path in TestAppContext::dispatch_action Instead, derive it from the presenter. This makes tests easier to write and more reliable since we'll be accurately simulating the actual relationship between parent and child views. --- crates/file_finder/src/file_finder.rs | 15 ++++++--------- crates/gpui/src/app.rs | 20 +++++++++++--------- crates/zed/src/zed.rs | 12 ++++-------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 56fd255d829e5398edb71d600843de9e03f1df93..471e43a0edcb4e95011fd07a280ab6f3b835f223 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -446,7 +446,7 @@ mod tests { .unwrap(); cx.read(|cx| workspace.read(cx).worktree_scans_complete(cx)) .await; - cx.dispatch_action(window_id, vec![workspace.id()], Toggle); + cx.dispatch_action(window_id, Toggle); let finder = cx.read(|cx| { workspace @@ -457,19 +457,16 @@ mod tests { .downcast::() .unwrap() }); - let query_buffer = cx.read(|cx| finder.read(cx).query_editor.clone()); - - let chain = vec![finder.id(), query_buffer.id()]; - cx.dispatch_action(window_id, chain.clone(), Input("b".into())); - cx.dispatch_action(window_id, chain.clone(), Input("n".into())); - cx.dispatch_action(window_id, chain.clone(), Input("a".into())); + cx.dispatch_action(window_id, Input("b".into())); + cx.dispatch_action(window_id, Input("n".into())); + cx.dispatch_action(window_id, Input("a".into())); finder .condition(&cx, |finder, _| finder.matches.len() == 2) .await; let active_pane = cx.read(|cx| workspace.read(cx).active_pane().clone()); - cx.dispatch_action(window_id, vec![workspace.id(), finder.id()], SelectNext); - cx.dispatch_action(window_id, vec![workspace.id(), finder.id()], Confirm); + cx.dispatch_action(window_id, SelectNext); + cx.dispatch_action(window_id, Confirm); active_pane .condition(&cx, |pane, _| pane.active_item().is_some()) .await; diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 7f0c3ffcdeeb1c9696d94dd2279b090eb29bfcdf..76b5f3b631fc4b8ec7333a95e71d53a640f64537 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -426,15 +426,17 @@ impl TestAppContext { cx } - pub fn dispatch_action( - &self, - window_id: usize, - responder_chain: Vec, - action: A, - ) { - self.cx - .borrow_mut() - .dispatch_action_any(window_id, &responder_chain, &action); + pub fn dispatch_action(&self, window_id: usize, action: A) { + let mut cx = self.cx.borrow_mut(); + let responder_chain = cx + .presenters_and_platform_windows + .get(&window_id) + .unwrap() + .0 + .borrow() + .dispatch_path(cx.as_ref()); + + cx.dispatch_action_any(window_id, &responder_chain, &action); } pub fn dispatch_global_action(&self, action: A) { diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index d3ce28ff5b96afb0835ffceae27a34a85b09b400..843e56fd0e21f0c4cd6dc7b8c6175419eadef281 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -563,7 +563,7 @@ mod tests { let worktree = cx.read(|cx| workspace.read(cx).worktrees(cx).next().unwrap()); // Create a new untitled buffer - cx.dispatch_action(window_id, vec![workspace.id()], OpenNew(app_state.clone())); + cx.dispatch_action(window_id, OpenNew(app_state.clone())); let editor = workspace.read_with(cx, |workspace, cx| { workspace .active_item(cx) @@ -618,7 +618,7 @@ mod tests { // Open the same newly-created file in another pane item. The new editor should reuse // the same buffer. - cx.dispatch_action(window_id, vec![workspace.id()], OpenNew(app_state.clone())); + cx.dispatch_action(window_id, OpenNew(app_state.clone())); workspace .update(cx, |workspace, cx| { workspace.split_pane(workspace.active_pane().clone(), SplitDirection::Right, cx); @@ -655,7 +655,7 @@ mod tests { let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx)); // Create a new untitled buffer - cx.dispatch_action(window_id, vec![workspace.id()], OpenNew(app_state.clone())); + cx.dispatch_action(window_id, OpenNew(app_state.clone())); let editor = workspace.read_with(cx, |workspace, cx| { workspace .active_item(cx) @@ -732,11 +732,7 @@ mod tests { ); }); - cx.dispatch_action( - window_id, - vec![pane_1.id()], - pane::Split(SplitDirection::Right), - ); + cx.dispatch_action(window_id, pane::Split(SplitDirection::Right)); cx.update(|cx| { let pane_2 = workspace.read(cx).active_pane().clone(); assert_ne!(pane_1, pane_2); From 41a27e6925ae0c44a5f12284ba8a59d1831c0396 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 12:09:40 -0600 Subject: [PATCH 075/245] =?UTF-8?q?=F0=9F=92=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/gpui/src/app.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 76b5f3b631fc4b8ec7333a95e71d53a640f64537..58ed8b08872e07fe31911ba9494b841bf4233633 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -428,7 +428,7 @@ impl TestAppContext { pub fn dispatch_action(&self, window_id: usize, action: A) { let mut cx = self.cx.borrow_mut(); - let responder_chain = cx + let dispatch_path = cx .presenters_and_platform_windows .get(&window_id) .unwrap() @@ -436,7 +436,7 @@ impl TestAppContext { .borrow() .dispatch_path(cx.as_ref()); - cx.dispatch_action_any(window_id, &responder_chain, &action); + cx.dispatch_action_any(window_id, &dispatch_path, &action); } pub fn dispatch_global_action(&self, action: A) { @@ -457,9 +457,9 @@ impl TestAppContext { .unwrap() .0 .clone(); - let responder_chain = presenter.borrow().dispatch_path(cx.as_ref()); + let dispatch_path = presenter.borrow().dispatch_path(cx.as_ref()); - if !cx.dispatch_keystroke(window_id, responder_chain, &keystroke) { + if !cx.dispatch_keystroke(window_id, dispatch_path, &keystroke) { presenter.borrow_mut().dispatch_event( Event::KeyDown { keystroke, @@ -1316,10 +1316,10 @@ impl MutableAppContext { pub fn dispatch_action( &mut self, window_id: usize, - responder_chain: Vec, + dispatch_path: Vec, action: &A, ) { - self.dispatch_action_any(window_id, &responder_chain, action); + self.dispatch_action_any(window_id, &dispatch_path, action); } pub(crate) fn dispatch_action_any( @@ -1405,11 +1405,11 @@ impl MutableAppContext { pub fn dispatch_keystroke( &mut self, window_id: usize, - responder_chain: Vec, + dispatch_path: Vec, keystroke: &Keystroke, ) -> bool { let mut context_chain = Vec::new(); - for view_id in &responder_chain { + for view_id in &dispatch_path { let view = self .cx .views @@ -1422,13 +1422,12 @@ impl MutableAppContext { for (i, cx) in context_chain.iter().enumerate().rev() { match self .keystroke_matcher - .push_keystroke(keystroke.clone(), responder_chain[i], cx) + .push_keystroke(keystroke.clone(), dispatch_path[i], cx) { MatchResult::None => {} MatchResult::Pending => pending = true, MatchResult::Action(action) => { - if self.dispatch_action_any(window_id, &responder_chain[0..=i], action.as_ref()) - { + if self.dispatch_action_any(window_id, &dispatch_path[0..=i], action.as_ref()) { self.keystroke_matcher.clear_pending(); return true; } From 4f4364d5105fb895578b03840782986dec29542b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 13:02:17 -0600 Subject: [PATCH 076/245] Ensure we drop the last pane item Previously, we weren't updating the toolbar's active item when emptying out a pane. This enhances an integration test to ensure that we don't hold references to any editors or buffers once we close everything. --- crates/gpui/src/app.rs | 52 +++++++++++++++++++++++++++++++++++- crates/workspace/src/pane.rs | 1 + crates/zed/src/zed.rs | 37 +++++++++++++++++-------- 3 files changed, 78 insertions(+), 12 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 58ed8b08872e07fe31911ba9494b841bf4233633..0888e3347edc8ea59e09e8f99f6315147db6e248 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -597,6 +597,15 @@ impl TestAppContext { pub fn leak_detector(&self) -> Arc> { self.cx.borrow().leak_detector() } + + #[cfg(any(test, feature = "test-support"))] + pub fn assert_dropped(&self, handle: impl WeakHandle) { + self.cx + .borrow() + .leak_detector() + .lock() + .assert_dropped(handle.id()) + } } impl AsyncAppContext { @@ -3302,6 +3311,10 @@ pub trait Handle { Self: Sized; } +pub trait WeakHandle { + fn id(&self) -> usize; +} + #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum EntityLocation { Model(usize), @@ -3576,6 +3589,12 @@ pub struct WeakModelHandle { model_type: PhantomData, } +impl WeakHandle for WeakModelHandle { + fn id(&self) -> usize { + self.model_id + } +} + unsafe impl Send for WeakModelHandle {} unsafe impl Sync for WeakModelHandle {} @@ -4145,6 +4164,12 @@ pub struct WeakViewHandle { view_type: PhantomData, } +impl WeakHandle for WeakViewHandle { + fn id(&self) -> usize { + self.view_id + } +} + impl WeakViewHandle { fn new(window_id: usize, view_id: usize) -> Self { Self { @@ -4471,11 +4496,36 @@ impl LeakDetector { } } + pub fn assert_dropped(&mut self, entity_id: usize) { + if let Some((type_name, backtraces)) = self.handle_backtraces.get_mut(&entity_id) { + for trace in backtraces.values_mut() { + if let Some(trace) = trace { + trace.resolve(); + eprintln!("{:?}", crate::util::CwdBacktrace(trace)); + } + } + + let hint = if *LEAK_BACKTRACE { + "" + } else { + " – set LEAK_BACKTRACE=1 for more information" + }; + + panic!( + "{} handles to {} {} still exist{}", + backtraces.len(), + type_name.unwrap_or("entity"), + entity_id, + hint + ); + } + } + pub fn detect(&mut self) { let mut found_leaks = false; for (id, (type_name, backtraces)) in self.handle_backtraces.iter_mut() { eprintln!( - "leaked {} handles to {:?} {}", + "leaked {} handles to {} {}", backtraces.len(), type_name.unwrap_or("entity"), id diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index baf1c2e405650cdddfe891a773177820d50dc3f4..fb13ef2fd0e89dda0e38e00f0c39cecce0c4abd1 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -580,6 +580,7 @@ impl Pane { let item = pane.items.remove(item_ix); if pane.items.is_empty() { item.deactivated(cx); + pane.update_toolbar(cx); cx.emit(Event::Remove); } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 843e56fd0e21f0c4cd6dc7b8c6175419eadef281..188a48d86df19381323c846c738984ee2dc74940 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -725,32 +725,47 @@ mod tests { .update(cx, |w, cx| w.open_path(file1.clone(), cx)) .await .unwrap(); - cx.read(|cx| { - assert_eq!( - pane_1.read(cx).active_item().unwrap().project_path(cx), - Some(file1.clone()) - ); + + let (editor_1, buffer) = pane_1.update(cx, |pane_1, cx| { + let editor = pane_1.active_item().unwrap().downcast::().unwrap(); + assert_eq!(editor.project_path(cx), Some(file1.clone())); + let buffer = editor.update(cx, |editor, cx| { + editor.insert("dirt", cx); + editor.buffer().downgrade() + }); + (editor.downgrade(), buffer) }); cx.dispatch_action(window_id, pane::Split(SplitDirection::Right)); - cx.update(|cx| { + let editor_2 = cx.update(|cx| { let pane_2 = workspace.read(cx).active_pane().clone(); assert_ne!(pane_1, pane_2); let pane2_item = pane_2.read(cx).active_item().unwrap(); assert_eq!(pane2_item.project_path(cx.as_ref()), Some(file1.clone())); - cx.dispatch_action( - window_id, - vec![workspace.id(), pane_2.id()], - &workspace::CloseActiveItem, - ); + pane2_item.downcast::().unwrap().downgrade() }); + cx.dispatch_action(window_id, workspace::CloseActiveItem); + cx.foreground().run_until_parked(); workspace.read_with(cx, |workspace, _| { assert_eq!(workspace.panes().len(), 1); assert_eq!(workspace.active_pane(), &pane_1); }); + + cx.dispatch_action(window_id, workspace::CloseActiveItem); + cx.foreground().run_until_parked(); + cx.simulate_prompt_answer(window_id, 1); + cx.foreground().run_until_parked(); + + workspace.read_with(cx, |workspace, cx| { + assert!(workspace.active_item(cx).is_none()); + }); + + cx.assert_dropped(editor_1); + cx.assert_dropped(editor_2); + cx.assert_dropped(buffer); } #[gpui::test] From aeb0b42c7a8f77f8372e82c176f98f0ea13c8765 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 13:53:13 -0600 Subject: [PATCH 077/245] Report more information when we panic due to an allocation failure --- crates/gpui/src/platform/mac/atlas.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/atlas.rs b/crates/gpui/src/platform/mac/atlas.rs index 5e87474bf166d7eaa4260a2b07c9651292aab04b..33f6fc19db55077ee6cc03cb32c465ce8f6cad74 100644 --- a/crates/gpui/src/platform/mac/atlas.rs +++ b/crates/gpui/src/platform/mac/atlas.rs @@ -2,6 +2,7 @@ use crate::geometry::{ rect::RectI, vector::{vec2i, Vector2I}, }; +use anyhow::anyhow; use etagere::BucketedAtlasAllocator; use foreign_types::ForeignType; use metal::{Device, TextureDescriptor}; @@ -48,7 +49,12 @@ impl AtlasAllocator { .allocate(requested_size) .unwrap_or_else(|| { let mut atlas = self.new_atlas(requested_size); - let (id, origin) = atlas.allocate(requested_size).unwrap(); + let (id, origin) = atlas + .allocate(requested_size) + .ok_or_else(|| { + anyhow!("could not allocate requested size {:?}", requested_size) + }) + .unwrap(); self.atlases.push(atlas); (id, origin) }); From 35f56708f58739333a5cab0bfa45cacef6229a0e Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 5 Apr 2022 18:23:01 -0400 Subject: [PATCH 078/245] Update light theme, change player 3 color - Changed player 3 color to be less similar to player 1 --- crates/zed/assets/themes/dark.json | 6 +++--- crates/zed/assets/themes/light.json | 26 +++++++++++++------------- styles/src/themes/dark.ts | 4 ++-- styles/src/themes/light.ts | 10 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 1c277935cf21743d599feaaa7ed9e0b2709a5c5c..92351e53edf36e813da92f8cec40f7bdfd12bcc9 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -240,7 +240,7 @@ "height": 32, "background": "#2b2b2b", "share_icon_color": "#9c9c9c", - "share_icon_active_color": "#1096d3", + "share_icon_active_color": "#2472f2", "title": { "family": "Zed Sans", "color": "#f1f1f1", @@ -351,8 +351,8 @@ "selection": "#79ba164d" }, { - "cursor": "#484bed", - "selection": "#484bed4d" + "cursor": "#d430e0", + "selection": "#d430e04d" }, { "cursor": "#ee670a", diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 7871e348530e53ea7a025ef4b0ca3e31e8ff32a9..3a527fc7cd93a31a69a610693c021557a2bb5d48 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -109,7 +109,7 @@ "tab": { "height": 32, "background": "#f1f1f1", - "icon_close": "#555555", + "icon_close": "#717171", "icon_close_active": "#000000", "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", @@ -135,7 +135,7 @@ "active_tab": { "height": 32, "background": "#ffffff", - "icon_close": "#555555", + "icon_close": "#717171", "icon_close_active": "#000000", "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", @@ -168,7 +168,7 @@ }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#555555", "icon_size": 18 }, "active_item": { @@ -193,7 +193,7 @@ }, "item": { "height": 32, - "icon_color": "#717171", + "icon_color": "#555555", "icon_size": 18 }, "active_item": { @@ -239,7 +239,7 @@ "avatar_width": 18, "height": 32, "background": "#e3e3e3", - "share_icon_color": "#717171", + "share_icon_color": "#555555", "share_icon_active_color": "#1179a8", "title": { "family": "Zed Sans", @@ -281,7 +281,7 @@ } }, "offline_icon": { - "color": "#717171", + "color": "#555555", "width": 16, "padding": { "right": 4 @@ -328,7 +328,7 @@ "text_color": "#2b2b2b", "background": "#ffffff", "active_line_background": "#f1f1f1", - "code_actions_indicator": "#717171", + "code_actions_indicator": "#555555", "diff_background_deleted": "#fcc6c6", "diff_background_inserted": "#b7f9ce", "document_highlight_read_background": "#14a89829", @@ -351,8 +351,8 @@ "selection": "#79ba164d" }, { - "cursor": "#484bed", - "selection": "#484bed4d" + "cursor": "#d430e0", + "selection": "#d430e04d" }, { "cursor": "#ee670a", @@ -708,7 +708,7 @@ }, "entry": { "height": 22, - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 8, "icon_spacing": 8, "text": { @@ -720,7 +720,7 @@ "hovered_entry": { "height": 22, "background": "#e3e3e3", - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 8, "icon_spacing": 8, "text": { @@ -731,7 +731,7 @@ }, "selected_entry": { "height": 22, - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 8, "icon_spacing": 8, "text": { @@ -743,7 +743,7 @@ "hovered_selected_entry": { "height": 22, "background": "#e3e3e3", - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 8, "icon_spacing": 8, "text": { diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index b9893430d334ab904ac4619bb4582eda5892501a..97e4acaf5ead9aba0bdacf238ed4e879d54e9f6e 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -80,7 +80,7 @@ const iconColor = { placeholder: colors.neutral[700], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + feature: colors.blue[500], ok: colors.green[600], error: colors.red[500], warning: colors.amber[400], @@ -90,7 +90,7 @@ const iconColor = { const player = { 1: buildPlayer(colors.blue[500]), 2: buildPlayer(colors.lime[500]), - 3: buildPlayer(colors.indigo[500]), + 3: buildPlayer(colors.fuschia[500]), 4: buildPlayer(colors.orange[500]), 5: buildPlayer(colors.purple[500]), 6: buildPlayer(colors.teal[400]), diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index 3978f89dce28a160ce96eb6173d35a5f5632db1f..1462640171b8bb20c69f41e3df50fbd9b767de76 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -73,10 +73,10 @@ const textColor = { }; const iconColor = { - primary: colors.neutral[300], - secondary: colors.neutral[500], - muted: colors.neutral[600], - placeholder: colors.neutral[700], + primary: colors.neutral[700], + secondary: colors.neutral[600], + muted: colors.neutral[500], + placeholder: colors.neutral[300], active: colors.neutral[900], feature: colors.sky[600], ok: colors.green[600], @@ -88,7 +88,7 @@ const iconColor = { const player = { 1: buildPlayer(colors.blue[500]), 2: buildPlayer(colors.lime[500]), - 3: buildPlayer(colors.indigo[500]), + 3: buildPlayer(colors.fuschia[500]), 4: buildPlayer(colors.orange[500]), 5: buildPlayer(colors.purple[500]), 6: buildPlayer(colors.teal[400]), From 2a2c4071f46f521ce03cbb55c2086f787e73ab52 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 5 Apr 2022 18:49:17 -0400 Subject: [PATCH 079/245] Update light syntax theme and highlights, player selections --- crates/zed/assets/themes/dark.json | 24 ++-- crates/zed/assets/themes/light.json | 176 ++++++++++++++-------------- styles/src/themes/light.ts | 60 +++++----- styles/src/themes/theme.ts | 2 +- 4 files changed, 131 insertions(+), 131 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 92351e53edf36e813da92f8cec40f7bdfd12bcc9..bab53fbbe1a33e260e7ddc194c2abe335fbc0dbe 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -71,7 +71,7 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", @@ -343,36 +343,36 @@ "unnecessary_code_fade": 0.5, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "guest_selections": [ { "cursor": "#79ba16", - "selection": "#79ba164d" + "selection": "#79ba163d" }, { "cursor": "#d430e0", - "selection": "#d430e04d" + "selection": "#d430e03d" }, { "cursor": "#ee670a", - "selection": "#ee670a4d" + "selection": "#ee670a3d" }, { "cursor": "#993bf3", - "selection": "#993bf34d" + "selection": "#993bf33d" }, { "cursor": "#16d6c1", - "selection": "#16d6c14d" + "selection": "#16d6c13d" }, { "cursor": "#ef59a3", - "selection": "#ef59a34d" + "selection": "#ef59a33d" }, { "cursor": "#f7bf17", - "selection": "#f7bf174d" + "selection": "#f7bf173d" } ], "autocomplete": { @@ -958,7 +958,7 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "border": { "color": "#232323", @@ -1153,7 +1153,7 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", @@ -1207,7 +1207,7 @@ }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 3a527fc7cd93a31a69a610693c021557a2bb5d48..9b56b2a1e6e4c4d46c9c6dc898a9f1803f62e5c1 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -13,12 +13,12 @@ "corner_radius": 6, "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#2472f2", + "color": "#484bed", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#2472f2", + "color": "#484bed", "weight": "bold", "size": 14 }, @@ -51,7 +51,7 @@ "empty": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "padding": { @@ -66,12 +66,12 @@ "corner_radius": 6, "placeholder_text": { "family": "Zed Sans", - "color": "#aaaaaa", + "color": "#808080", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", @@ -117,7 +117,7 @@ "spacing": 10, "text": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14 }, "border": { @@ -221,17 +221,17 @@ }, "cursor_position": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "diagnostic_message": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "lsp_message": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 } }, @@ -240,7 +240,7 @@ "height": 32, "background": "#e3e3e3", "share_icon_color": "#555555", - "share_icon_active_color": "#1179a8", + "share_icon_active_color": "#484bed", "title": { "family": "Zed Sans", "color": "#2b2b2b", @@ -264,7 +264,7 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 13, "underline": true, "padding": { @@ -311,7 +311,7 @@ }, "breadcrumbs": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "padding": { "left": 6 @@ -325,14 +325,14 @@ } }, "editor": { - "text_color": "#2b2b2b", + "text_color": "#1c1c1c", "background": "#ffffff", "active_line_background": "#f1f1f1", "code_actions_indicator": "#555555", "diff_background_deleted": "#fcc6c6", "diff_background_inserted": "#b7f9ce", - "document_highlight_read_background": "#14a89829", - "document_highlight_write_background": "#14a89852", + "document_highlight_read_background": "#de900c0f", + "document_highlight_write_background": "#de900c42", "error_color": "#eb2d2d", "gutter_background": "#ffffff", "gutter_padding_factor": 3.5, @@ -343,36 +343,36 @@ "unnecessary_code_fade": 0.5, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "guest_selections": [ { - "cursor": "#79ba16", - "selection": "#79ba164d" + "cursor": "#12d796", + "selection": "#12d7963d" }, { - "cursor": "#d430e0", - "selection": "#d430e04d" + "cursor": "#de57e8", + "selection": "#de57e83d" }, { - "cursor": "#ee670a", - "selection": "#ee670a4d" + "cursor": "#f9812e", + "selection": "#f9812e3d" }, { - "cursor": "#993bf3", - "selection": "#993bf34d" + "cursor": "#b066f8", + "selection": "#b066f83d" }, { "cursor": "#16d6c1", - "selection": "#16d6c14d" + "selection": "#16d6c13d" }, { "cursor": "#ef59a3", - "selection": "#ef59a34d" + "selection": "#ef59a33d" }, { "cursor": "#f7bf17", - "selection": "#f7bf174d" + "selection": "#f7bf173d" } ], "autocomplete": { @@ -406,7 +406,7 @@ "left": -14 }, "match_highlight": { - "color": "#103063", + "color": "#1819a1", "weight": "normal" }, "selected_item": { @@ -432,7 +432,7 @@ }, "code": { "family": "Zed Mono", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "left": 10 @@ -447,7 +447,7 @@ }, "text": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 14 } } @@ -462,7 +462,7 @@ }, "path": { "family": "Zed Mono", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "left": 12 @@ -573,12 +573,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "weight": "bold" } @@ -596,12 +596,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "weight": "bold" } @@ -619,12 +619,12 @@ "message": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "weight": "bold" } @@ -642,45 +642,45 @@ "message": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "highlight_text": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "weight": "bold" } } }, "syntax": { - "keyword": "#103063", - "function": "#1b9447", - "string": "#bb550e", - "type": "#138a7d", - "number": "#14a898", - "comment": "#555555", - "property": "#134697", - "variant": "#1179a8", - "constant": "#393939", + "keyword": "#1819a1", + "function": "#f9812e", + "string": "#eb2d2d", + "type": "#de900c", + "number": "#484bed", + "comment": "#717171", + "property": "#118a62", + "variant": "#1096d3", + "constant": "#1c1c1c", "title": { "color": "#1096d3", "weight": "bold" }, - "emphasis": "#2472f2", + "emphasis": "#484bed", "emphasis_strong": { - "color": "#2472f2", + "color": "#484bed", "weight": "bold" }, "link_uri": { - "color": "#14a898", + "color": "#79ba16", "underline": true }, "link_text": { - "color": "#ee670a", + "color": "#eb2d2d", "italic": true }, - "list_marker": "#393939" + "list_marker": "#555555" } }, "project_diagnostics": { @@ -694,7 +694,7 @@ }, "status_bar_item": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 10 @@ -713,7 +713,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14 } }, @@ -725,7 +725,7 @@ "icon_spacing": 8, "text": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14 } }, @@ -768,7 +768,7 @@ }, "channel_name_hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "padding": { "right": 8 @@ -787,7 +787,7 @@ }, "hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -798,13 +798,13 @@ "item": { "name": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -815,13 +815,13 @@ "hovered_item": { "name": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 14 }, "padding": 4, "hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -839,7 +839,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -856,7 +856,7 @@ "padding": 4, "hash": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14, "margin": { "right": 8 @@ -885,7 +885,7 @@ }, "sign_in_prompt": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "underline": true, "size": 14 }, @@ -898,12 +898,12 @@ "message": { "body": { "family": "Zed Sans", - "color": "#555555", + "color": "#474747", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "padding": { @@ -922,12 +922,12 @@ "pending_message": { "body": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "timestamp": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "size": 14 }, "padding": { @@ -935,7 +935,7 @@ }, "sender": { "family": "Zed Sans", - "color": "#808080", + "color": "#636363", "weight": "bold", "size": 14, "margin": { @@ -953,12 +953,12 @@ }, "placeholder_text": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "border": { "color": "#e3e3e3", @@ -1003,7 +1003,7 @@ }, "name": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14, "margin": { "right": 6 @@ -1022,7 +1022,7 @@ }, "name": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "margin": { "right": 6 @@ -1043,7 +1043,7 @@ }, "name": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "margin": { "right": 6 @@ -1064,7 +1064,7 @@ }, "name": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14, "margin": { "right": 6 @@ -1083,7 +1083,7 @@ }, "name": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14, "margin": { "right": 6 @@ -1096,12 +1096,12 @@ } }, "search": { - "match_background": "#1096d329", + "match_background": "#993bf31f", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "background": "#e3e3e3", "corner_radius": 6, @@ -1122,7 +1122,7 @@ }, "active_option_button": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "background": "#e3e3e3", "corner_radius": 6, @@ -1148,12 +1148,12 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", @@ -1176,7 +1176,7 @@ }, "hovered_option_button": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "background": "#e3e3e3", "corner_radius": 6, @@ -1202,12 +1202,12 @@ "max_width": 500, "placeholder_text": { "family": "Zed Mono", - "color": "#aaaaaa", + "color": "#808080", "size": 14 }, "selection": { "cursor": "#2472f2", - "selection": "#2472f24d" + "selection": "#2472f23d" }, "text": { "family": "Zed Mono", @@ -1230,13 +1230,13 @@ }, "match_index": { "family": "Zed Mono", - "color": "#808080", + "color": "#636363", "size": 14, "padding": 6 }, "option_button": { "family": "Zed Mono", - "color": "#555555", + "color": "#474747", "size": 14, "background": "#f1f1f1", "corner_radius": 6, diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index 1462640171b8bb20c69f41e3df50fbd9b767de76..e16bf5ee044c0bab2eaa06d2b34de07c18af56c0 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -61,11 +61,11 @@ const borderColor = { const textColor = { primary: colors.neutral[750], - secondary: colors.neutral[600], - muted: colors.neutral[450], - placeholder: colors.neutral[300], + secondary: colors.neutral[650], + muted: colors.neutral[550], + placeholder: colors.neutral[450], active: colors.neutral[900], - feature: colors.blue[500], + feature: colors.indigo[500], ok: colors.green[500], error: colors.red[500], warning: colors.yellow[500], @@ -78,7 +78,7 @@ const iconColor = { muted: colors.neutral[500], placeholder: colors.neutral[300], active: colors.neutral[900], - feature: colors.sky[600], + feature: colors.indigo[500], ok: colors.green[600], error: colors.red[600], warning: colors.yellow[400], @@ -87,10 +87,10 @@ const iconColor = { const player = { 1: buildPlayer(colors.blue[500]), - 2: buildPlayer(colors.lime[500]), - 3: buildPlayer(colors.fuschia[500]), - 4: buildPlayer(colors.orange[500]), - 5: buildPlayer(colors.purple[500]), + 2: buildPlayer(colors.emerald[400]), + 3: buildPlayer(colors.fuschia[400]), + 4: buildPlayer(colors.orange[400]), + 5: buildPlayer(colors.purple[400]), 6: buildPlayer(colors.teal[400]), 7: buildPlayer(colors.pink[400]), 8: buildPlayer(colors.yellow[400]), @@ -110,11 +110,11 @@ const editor = { }, highlight: { selection: player[1].selectionColor, - occurrence: withOpacity(colors.teal[500], 0.16), - activeOccurrence: withOpacity(colors.teal[500], 0.32), + occurrence: withOpacity(colors.amber[500], 0.06), + activeOccurrence: withOpacity(colors.amber[500], 0.26), matchingBracket: colors.neutral[0], - match: withOpacity(colors.sky[500], 0.16), - activeMatch: withOpacity(colors.sky[800], 0.32), + match: withOpacity(colors.purple[500], 0.12), + activeMatch: withOpacity(colors.purple[400], 0.36), related: colors.neutral[0], }, gutter: { @@ -125,63 +125,63 @@ const editor = { const syntax: Syntax = { primary: { - color: colors.neutral[750], + color: colors.neutral[800], weight: fontWeights.normal, }, comment: { - color: colors.neutral[600], + color: colors.neutral[500], weight: fontWeights.normal, }, punctuation: { - color: colors.neutral[700], + color: colors.neutral[600], weight: fontWeights.normal, }, constant: { - color: colors.neutral[700], + color: colors.neutral[800], weight: fontWeights.normal, }, keyword: { - color: colors.blue[800], + color: colors.indigo[700], weight: fontWeights.normal, }, function: { - color: colors.green[600], + color: colors.orange[400], weight: fontWeights.normal, }, type: { - color: colors.teal[600], + color: colors.amber[500], weight: fontWeights.normal, }, variant: { - color: colors.sky[600], + color: colors.sky[500], weight: fontWeights.normal, }, property: { - color: colors.blue[700], + color: colors.emerald[600], weight: fontWeights.normal, }, enum: { - color: colors.orange[600], + color: colors.red[500], weight: fontWeights.normal, }, operator: { - color: colors.orange[600], + color: colors.red[500], weight: fontWeights.normal, }, string: { - color: colors.orange[600], + color: colors.red[500], weight: fontWeights.normal, }, number: { - color: colors.teal[500], + color: colors.indigo[500], weight: fontWeights.normal, }, boolean: { - color: colors.amber[600], + color: colors.red[500], weight: fontWeights.normal, }, predictive: { - color: textColor.muted, + color: textColor.placeholder, weight: fontWeights.normal, }, title: { @@ -197,12 +197,12 @@ const syntax: Syntax = { weight: fontWeights.bold, }, linkUrl: { - color: colors.teal[500], + color: colors.lime[500], weight: fontWeights.normal, // TODO: add underline }, linkText: { - color: colors.orange[500], + color: colors.red[500], weight: fontWeights.normal, // TODO: add italic }, diff --git a/styles/src/themes/theme.ts b/styles/src/themes/theme.ts index d7ba990e73ea3ec0fd94198fee0b902ecd3fd9ec..64c6391dabf5225a0eac9cb088b8f99b02d1b660 100644 --- a/styles/src/themes/theme.ts +++ b/styles/src/themes/theme.ts @@ -21,7 +21,7 @@ export function buildPlayer( return { baseColor: color, cursorColor: withOpacity(color, cursorOpacity || 1.0), - selectionColor: withOpacity(color, selectionOpacity || 0.3), + selectionColor: withOpacity(color, selectionOpacity || 0.24), borderColor: withOpacity(color, borderOpacity || 0.8), } } From 025d857be80e74cd1fb39eb3baaa01c6de3ae272 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 18:40:25 -0600 Subject: [PATCH 080/245] Make UniformListState an Rc> instead of an Arc> We don't need to support multiple threads. --- crates/gpui/src/elements/uniform_list.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index 4fbb9ca420c27520b5032fd659d6eaac3ab77019..7bd3e28a2e384def39f4ddcd523ab5aa8be3683c 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -8,11 +8,10 @@ use crate::{ ElementBox, }; use json::ToJson; -use parking_lot::Mutex; -use std::{cmp, ops::Range, sync::Arc}; +use std::{cell::RefCell, cmp, ops::Range, rc::Rc}; #[derive(Clone, Default)] -pub struct UniformListState(Arc>); +pub struct UniformListState(Rc>); #[derive(Debug)] pub enum ScrollTarget { @@ -22,11 +21,11 @@ pub enum ScrollTarget { impl UniformListState { pub fn scroll_to(&self, scroll_to: ScrollTarget) { - self.0.lock().scroll_to = Some(scroll_to); + self.0.borrow_mut().scroll_to = Some(scroll_to); } pub fn scroll_top(&self) -> f32 { - self.0.lock().scroll_top + self.0.borrow().scroll_top } } @@ -96,7 +95,7 @@ where delta *= 20.; } - let mut state = self.state.0.lock(); + let mut state = self.state.0.borrow_mut(); state.scroll_top = (state.scroll_top - delta.y()).max(0.0).min(scroll_max); cx.notify(); @@ -104,7 +103,7 @@ where } fn autoscroll(&mut self, scroll_max: f32, list_height: f32, item_height: f32) { - let mut state = self.state.0.lock(); + let mut state = self.state.0.borrow_mut(); if let Some(scroll_to) = state.scroll_to.take() { let item_ix; @@ -141,7 +140,7 @@ where } fn scroll_top(&self) -> f32 { - self.state.0.lock().scroll_top + self.state.0.borrow().scroll_top } } From ab3bbe1e171a032f8113c290d7473610af988e12 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 19:58:15 -0600 Subject: [PATCH 081/245] Make the tabs scrollable when they overflow This adds the ability to make a Flex element scrollable by passing a type tag and instance id, which we use to store the scroll position in an ElementStateHandle. Still need to allow the element to auto-scroll. --- crates/gpui/src/elements/flex.rs | 75 ++++++++++++++++++++++++++++++-- crates/workspace/src/pane.rs | 2 +- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 2ec307bbc3dc55cca92ddab70b6a2434170878fa..6afe80ce06551dbeaa6f91cb06294917433d5b16 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -2,8 +2,8 @@ use std::{any::Any, f32::INFINITY}; use crate::{ json::{self, ToJson, Value}, - Axis, DebugContext, Element, ElementBox, Event, EventContext, LayoutContext, PaintContext, - SizeConstraint, Vector2FExt, + Axis, DebugContext, Element, ElementBox, ElementStateContext, ElementStateHandle, Event, + EventContext, LayoutContext, PaintContext, SizeConstraint, Vector2FExt, }; use pathfinder_geometry::{ rect::RectF, @@ -11,9 +11,15 @@ use pathfinder_geometry::{ }; use serde_json::json; +#[derive(Default)] +struct ScrollState { + scroll_position: f32, +} + pub struct Flex { axis: Axis, children: Vec, + scroll_state: Option>, } impl Flex { @@ -21,6 +27,7 @@ impl Flex { Self { axis, children: Default::default(), + scroll_state: None, } } @@ -32,6 +39,15 @@ impl Flex { Self::new(Axis::Vertical) } + pub fn scrollable(mut self, element_id: usize, cx: &mut C) -> Self + where + Tag: 'static, + C: ElementStateContext, + { + self.scroll_state = Some(cx.element_state::(element_id)); + self + } + fn layout_flex_children( &mut self, layout_expanded: bool, @@ -167,6 +183,13 @@ impl Element for Flex { size.set_y(constraint.max.y()); } + if let Some(scroll_state) = self.scroll_state.as_ref() { + scroll_state.update(cx, |scroll_state, _| { + scroll_state.scroll_position = + scroll_state.scroll_position.min(-remaining_space).max(0.); + }); + } + (size, remaining_space) } @@ -181,7 +204,16 @@ impl Element for Flex { if overflowing { cx.scene.push_layer(Some(bounds)); } + let mut child_origin = bounds.origin(); + if let Some(scroll_state) = self.scroll_state.as_ref() { + let scroll_position = scroll_state.read(cx).scroll_position; + match self.axis { + Axis::Horizontal => child_origin.set_x(child_origin.x() - scroll_position), + Axis::Vertical => child_origin.set_y(child_origin.y() - scroll_position), + } + } + for child in &mut self.children { if *remaining_space > 0. { if let Some(metadata) = child.metadata::() { @@ -208,8 +240,8 @@ impl Element for Flex { fn dispatch_event( &mut self, event: &Event, - _: RectF, - _: &mut Self::LayoutState, + bounds: RectF, + remaining_space: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, ) -> bool { @@ -217,6 +249,41 @@ impl Element for Flex { for child in &mut self.children { handled = child.dispatch_event(event, cx) || handled; } + if !handled { + if let &Event::ScrollWheel { + position, + delta, + precise, + } = event + { + if *remaining_space < 0. && bounds.contains_point(position) { + if let Some(scroll_state) = self.scroll_state.as_ref() { + scroll_state.update(cx, |scroll_state, cx| { + dbg!(precise, delta); + + let mut delta = match self.axis { + Axis::Horizontal => { + if delta.x() != 0. { + delta.x() + } else { + delta.y() + } + } + Axis::Vertical => delta.y(), + }; + if !precise { + delta *= 20.; + } + + scroll_state.scroll_position -= delta; + + handled = true; + cx.notify(); + }); + } + } + } + } handled } diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index fb13ef2fd0e89dda0e38e00f0c39cecce0c4abd1..76093883c4d63f3d1d93ec6323b572ea0aef2f49 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -633,7 +633,7 @@ impl Pane { enum Tabs {} let pane = cx.handle(); let tabs = MouseEventHandler::new::(0, cx, |mouse_state, cx| { - let mut row = Flex::row(); + let mut row = Flex::row().scrollable::(1, cx); for (ix, item) in self.items.iter().enumerate() { let is_active = ix == self.active_item_index; From eb995883681b47d9828ce401afdef2962db3a481 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 5 Apr 2022 20:02:45 -0600 Subject: [PATCH 082/245] Remove stray dbg! expressions --- crates/editor/src/display_map.rs | 5 +---- crates/gpui/src/elements/flex.rs | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 2bea851ec2fa92605aa32b9f2a2c584a649e7305..babcf5d0ff38bf43ac55d6184049d8bc00b5c870 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -1152,10 +1152,7 @@ pub mod tests { *markers[0].column_mut() += 1; } - assert_eq!( - unmarked_snapshot.clip_point(dbg!(markers[0]), bias), - markers[1] - ) + assert_eq!(unmarked_snapshot.clip_point(markers[0], bias), markers[1]) } }; } diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 6afe80ce06551dbeaa6f91cb06294917433d5b16..ff98d2948b4ec538f784d92fdc34d1e3dca0bd94 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -259,8 +259,6 @@ impl Element for Flex { if *remaining_space < 0. && bounds.contains_point(position) { if let Some(scroll_state) = self.scroll_state.as_ref() { scroll_state.update(cx, |scroll_state, cx| { - dbg!(precise, delta); - let mut delta = match self.axis { Axis::Horizontal => { if delta.x() != 0. { From e201826d00574fe5791b5a66b86b829cb62fa57c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Apr 2022 01:46:10 -0400 Subject: [PATCH 083/245] Update Light & Dark themes --- crates/zed/assets/themes/dark.json | 27 ++--- crates/zed/assets/themes/light.json | 141 +++++++++++++------------- styles/src/styleTree/editor.ts | 7 +- styles/src/styleTree/selectorModal.ts | 2 +- styles/src/styleTree/workspace.ts | 2 +- styles/src/themes/dark.ts | 18 ++-- styles/src/themes/light.ts | 42 ++++---- 7 files changed, 119 insertions(+), 120 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index bab53fbbe1a33e260e7ddc194c2abe335fbc0dbe..56cef126935c71bce58e96c463a8e6be642e22c0 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -51,7 +51,7 @@ "empty": { "text": { "family": "Zed Sans", - "color": "#808080", + "color": "#474747", "size": 14 }, "padding": { @@ -272,7 +272,7 @@ } }, "hovered_sign_in_prompt": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#ffffff", "size": 13, "underline": true, @@ -327,17 +327,17 @@ "editor": { "text_color": "#d5d5d5", "background": "#000000", - "active_line_background": "#0e0e0e", - "code_actions_indicator": "#9c9c9c", + "active_line_background": "#ffffff12", + "code_actions_indicator": "#555555", "diff_background_deleted": "#f15656", "diff_background_inserted": "#1b9447", - "document_highlight_read_background": "#14a89829", - "document_highlight_write_background": "#14a89852", + "document_highlight_read_background": "#ffffff1f", + "document_highlight_write_background": "#ffffff29", "error_color": "#f15656", "gutter_background": "#000000", "gutter_padding_factor": 3.5, - "highlighted_line_background": "#070707", - "line_number": "#808080", + "highlighted_line_background": "#ffffff1f", + "line_number": "#474747", "line_number_active": "#ffffff", "rename_fade": 0.6, "unnecessary_code_fade": 0.5, @@ -400,14 +400,15 @@ "right": 6, "top": 2 }, - "background": "#070707" + "background": "#ffffff14" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#4f8ff7", - "weight": "normal" + "family": "Zed Mono", + "color": "#1096d3", + "size": 14 }, "selected_item": { "corner_radius": 6, @@ -417,7 +418,7 @@ "right": 6, "top": 2 }, - "background": "#0e0e0e" + "background": "#ffffff1f" } }, "diagnostic_header": { @@ -453,7 +454,7 @@ } }, "diagnostic_path_header": { - "background": "#0e0e0e", + "background": "#ffffff12", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index 9b56b2a1e6e4c4d46c9c6dc898a9f1803f62e5c1..d601ecbcccdf6a43d964845314e75fc703617101 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -1,6 +1,6 @@ { "selector": { - "background": "#f1f1f1", + "background": "#f8f8f8", "corner_radius": 6, "padding": 8, "item": { @@ -42,16 +42,16 @@ "weight": "bold", "size": 14 }, - "background": "#d5d5d5" + "background": "#dcdcdc" }, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "empty": { "text": { "family": "Zed Sans", - "color": "#636363", + "color": "#808080", "size": 14 }, "padding": { @@ -79,7 +79,7 @@ "size": 14 }, "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1 }, "padding": { @@ -103,13 +103,13 @@ } }, "workspace": { - "background": "#f1f1f1", + "background": "#f8f8f8", "leader_border_opacity": 0.7, "leader_border_width": 2, "tab": { "height": 32, - "background": "#f1f1f1", - "icon_close": "#717171", + "background": "#f8f8f8", + "icon_close": "#9c9c9c", "icon_close_active": "#000000", "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", @@ -121,7 +121,7 @@ "size": 14 }, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "left": true, "bottom": true, @@ -135,7 +135,7 @@ "active_tab": { "height": 32, "background": "#ffffff", - "icon_close": "#717171", + "icon_close": "#9c9c9c", "icon_close_active": "#000000", "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", @@ -147,7 +147,7 @@ "size": 14 }, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "left": true, "bottom": false, @@ -160,15 +160,15 @@ }, "left_sidebar": { "width": 30, - "background": "#f1f1f1", + "background": "#f8f8f8", "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "right": true }, "item": { "height": 32, - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { @@ -177,7 +177,7 @@ "icon_size": 18 }, "resize_handle": { - "background": "#c6c6c6", + "background": "#d5d5d5", "padding": { "left": 1 } @@ -185,15 +185,15 @@ }, "right_sidebar": { "width": 30, - "background": "#f1f1f1", + "background": "#f8f8f8", "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "left": true }, "item": { "height": 32, - "icon_color": "#555555", + "icon_color": "#717171", "icon_size": 18 }, "active_item": { @@ -202,14 +202,14 @@ "icon_size": 18 }, "resize_handle": { - "background": "#c6c6c6", + "background": "#d5d5d5", "padding": { "left": 1 } } }, "pane_divider": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1 }, "status_bar": { @@ -238,8 +238,8 @@ "titlebar": { "avatar_width": 18, "height": 32, - "background": "#e3e3e3", - "share_icon_color": "#555555", + "background": "#eaeaea", + "share_icon_color": "#717171", "share_icon_active_color": "#484bed", "title": { "family": "Zed Sans", @@ -258,7 +258,7 @@ "width": 12 }, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "bottom": true }, @@ -272,7 +272,7 @@ } }, "hovered_sign_in_prompt": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#000000", "size": 13, "underline": true, @@ -281,7 +281,7 @@ } }, "offline_icon": { - "color": "#555555", + "color": "#717171", "width": 16, "padding": { "right": 4 @@ -297,7 +297,7 @@ "height": 34, "background": "#ffffff", "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1, "bottom": true }, @@ -327,16 +327,16 @@ "editor": { "text_color": "#1c1c1c", "background": "#ffffff", - "active_line_background": "#f1f1f1", - "code_actions_indicator": "#555555", + "active_line_background": "#0000000f", + "code_actions_indicator": "#9c9c9c", "diff_background_deleted": "#fcc6c6", "diff_background_inserted": "#b7f9ce", - "document_highlight_read_background": "#de900c0f", - "document_highlight_write_background": "#de900c42", + "document_highlight_read_background": "#0000000f", + "document_highlight_write_background": "#00000029", "error_color": "#eb2d2d", "gutter_background": "#ffffff", "gutter_padding_factor": 3.5, - "highlighted_line_background": "#f1f1f1", + "highlighted_line_background": "#0000001f", "line_number": "#aaaaaa", "line_number_active": "#000000", "rename_fade": 0.6, @@ -380,7 +380,7 @@ "corner_radius": 6, "padding": 6, "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1 }, "item": { @@ -400,14 +400,15 @@ "right": 6, "top": 2 }, - "background": "#f8f8f8" + "background": "#00000008" }, "margin": { "left": -14 }, "match_highlight": { - "color": "#1819a1", - "weight": "normal" + "family": "Zed Mono", + "color": "#484bed", + "size": 14 }, "selected_item": { "corner_radius": 6, @@ -417,15 +418,15 @@ "right": 6, "top": 2 }, - "background": "#f1f1f1" + "background": "#0000000f" } }, "diagnostic_header": { - "background": "#f1f1f1", + "background": "#f8f8f8", "icon_width_factor": 1.5, "text_scale_factor": 0.857, "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1, "bottom": true, "top": true @@ -453,7 +454,7 @@ } }, "diagnostic_path_header": { - "background": "#f1f1f1", + "background": "#0000000f", "text_scale_factor": 0.857, "filename": { "family": "Zed Mono", @@ -473,7 +474,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -496,7 +497,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -519,7 +520,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -542,7 +543,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -565,7 +566,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -588,7 +589,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -611,7 +612,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -634,7 +635,7 @@ "text_scale_factor": 0.857, "header": { "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1, "top": true } @@ -708,7 +709,7 @@ }, "entry": { "height": 22, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 8, "icon_spacing": 8, "text": { @@ -719,8 +720,8 @@ }, "hovered_entry": { "height": 22, - "background": "#e3e3e3", - "icon_color": "#717171", + "background": "#eaeaea", + "icon_color": "#9c9c9c", "icon_size": 8, "icon_spacing": 8, "text": { @@ -731,7 +732,7 @@ }, "selected_entry": { "height": 22, - "icon_color": "#717171", + "icon_color": "#9c9c9c", "icon_size": 8, "icon_spacing": 8, "text": { @@ -742,8 +743,8 @@ }, "hovered_selected_entry": { "height": 22, - "background": "#e3e3e3", - "icon_color": "#717171", + "background": "#eaeaea", + "icon_color": "#9c9c9c", "icon_size": 8, "icon_spacing": 8, "text": { @@ -827,7 +828,7 @@ "right": 8 } }, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6 }, "active_item": { @@ -862,7 +863,7 @@ "right": 8 } }, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6 }, "menu": { @@ -870,7 +871,7 @@ "corner_radius": 6, "padding": 4, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "shadow": { @@ -961,7 +962,7 @@ "selection": "#2472f23d" }, "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1 }, "padding": { @@ -980,7 +981,7 @@ "right": 12 }, "host_row_height": 28, - "tree_branch_color": "#f1f1f1", + "tree_branch_color": "#e3e3e3", "tree_branch_width": 1, "host_avatar": { "corner_radius": 10, @@ -1031,7 +1032,7 @@ "padding": { "left": 8 }, - "background": "#f1f1f1", + "background": "#f8f8f8", "corner_radius": 6 }, "hovered_shared_project": { @@ -1052,7 +1053,7 @@ "padding": { "left": 8 }, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6 }, "unshared_project": { @@ -1096,17 +1097,17 @@ } }, "search": { - "match_background": "#993bf31f", + "match_background": "#eb2d2d33", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", "color": "#474747", "size": 14, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "margin": { @@ -1124,10 +1125,10 @@ "family": "Zed Mono", "color": "#474747", "size": 14, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "margin": { @@ -1161,7 +1162,7 @@ "size": 14 }, "border": { - "color": "#e3e3e3", + "color": "#d5d5d5", "width": 1 }, "margin": { @@ -1178,10 +1179,10 @@ "family": "Zed Mono", "color": "#474747", "size": 14, - "background": "#e3e3e3", + "background": "#eaeaea", "corner_radius": 6, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "margin": { @@ -1238,10 +1239,10 @@ "family": "Zed Mono", "color": "#474747", "size": 14, - "background": "#f1f1f1", + "background": "#f8f8f8", "corner_radius": 6, "border": { - "color": "#c6c6c6", + "color": "#d5d5d5", "width": 1 }, "margin": { diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index 33bfbf0cc623ea0ae657efe83f04744d33c51308..9fb96e09b71a613c3e5c0791865f2562b655162c 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -42,7 +42,7 @@ export default function editor(theme: Theme) { textColor: theme.syntax.primary.color.value, background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active.value, - codeActionsIndicator: iconColor(theme, "secondary"), + codeActionsIndicator: iconColor(theme, "muted"), diffBackgroundDeleted: backgroundColor(theme, "error"), diffBackgroundInserted: backgroundColor(theme, "ok"), documentHighlightReadBackground: theme.editor.highlight.occurrence.value, @@ -78,10 +78,7 @@ export default function editor(theme: Theme) { margin: { left: -14, }, - matchHighlight: { - color: theme.syntax.keyword.color.value, - weight: theme.syntax.keyword.weight.value, - }, + matchHighlight: text(theme, "mono", "feature"), selectedItem: { ...autocompleteItem, background: backgroundColor(theme, 500, "active"), diff --git a/styles/src/styleTree/selectorModal.ts b/styles/src/styleTree/selectorModal.ts index fdccae77a1c9b528418bb133fd87a5d14a6930d0..3e1925a179d5c9e0367f993a5433b9549ccc5af3 100644 --- a/styles/src/styleTree/selectorModal.ts +++ b/styles/src/styleTree/selectorModal.ts @@ -28,7 +28,7 @@ export default function selectorModal(theme: Theme): Object { activeItem, border: border(theme, "primary"), empty: { - text: text(theme, "sans", "muted"), + text: text(theme, "sans", "placeholder"), padding: { bottom: 4, left: 16, diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index a65356c636830fdf8283bfdbf23cd0c1eb5a636d..3a585458c3dd42c999924711d12479b5877f81ca 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -117,7 +117,7 @@ export default function workspace(theme: Theme) { signInPrompt, hoveredSignInPrompt: { ...signInPrompt, - ...text(theme, "mono", "active"), + ...text(theme, "sans", "active"), size: 13, }, offlineIcon: { diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 97e4acaf5ead9aba0bdacf238ed4e879d54e9f6e..7c7f7bf97e44f83c9f80094bbb254dcf70d14ad7 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -6,19 +6,19 @@ const backgroundColor = { 100: { base: colors.neutral[750], hovered: colors.neutral[725], - active: colors.neutral[700], + active: colors.neutral[800], focused: colors.neutral[675], }, 300: { base: colors.neutral[800], hovered: colors.neutral[775], active: colors.neutral[750], - focused: colors.neutral[725], + focused: colors.neutral[775], }, 500: { base: colors.neutral[900], - hovered: colors.neutral[875], - active: colors.neutral[850], + hovered: withOpacity(colors.neutral[0], 0.08), + active: withOpacity(colors.neutral[0], 0.12), focused: colors.neutral[825], }, ok: { @@ -103,23 +103,23 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: backgroundColor[500].active, - highlighted: backgroundColor[500].hovered, + active: withOpacity(colors.neutral[0], 0.07), + highlighted: withOpacity(colors.neutral[0], 0.12), inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, }, highlight: { selection: player[1].selectionColor, - occurrence: withOpacity(colors.teal[500], 0.16), - activeOccurrence: withOpacity(colors.teal[500], 0.32), + occurrence: withOpacity(colors.neutral[0], 0.12), + activeOccurrence: withOpacity(colors.neutral[0], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side matchingBracket: backgroundColor[500].active, match: withOpacity(colors.sky[500], 0.16), activeMatch: withOpacity(colors.sky[800], 0.32), related: backgroundColor[500].focused, }, gutter: { - primary: textColor.muted, + primary: textColor.placeholder, active: textColor.active, }, }; diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index e16bf5ee044c0bab2eaa06d2b34de07c18af56c0..2fded3ed9074b259c7aebe350beb9722f75353cc 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -4,22 +4,22 @@ import Theme, { buildPlayer, Syntax } from "./theme"; const backgroundColor = { 100: { - base: colors.neutral[100], - hovered: colors.neutral[150], - active: colors.neutral[200], - focused: colors.neutral[150], - }, - 300: { - base: colors.neutral[50], + base: colors.neutral[75], hovered: colors.neutral[100], active: colors.neutral[150], focused: colors.neutral[100], }, + 300: { + base: colors.neutral[25], + hovered: colors.neutral[75], + active: colors.neutral[125], + focused: colors.neutral[75], + }, 500: { base: colors.neutral[0], - hovered: colors.neutral[25], - active: colors.neutral[50], - focused: colors.neutral[75], + hovered: withOpacity(colors.neutral[900], 0.03), + active: withOpacity(colors.neutral[900], 0.06), + focused: colors.neutral[50], }, ok: { base: colors.green[100], @@ -48,9 +48,9 @@ const backgroundColor = { }; const borderColor = { - primary: colors.neutral[200], - secondary: colors.neutral[100], - muted: colors.neutral[50], + primary: colors.neutral[150], + secondary: colors.neutral[150], + muted: colors.neutral[100], focused: colors.neutral[100], active: colors.neutral[250], ok: colors.green[200], @@ -74,8 +74,8 @@ const textColor = { const iconColor = { primary: colors.neutral[700], - secondary: colors.neutral[600], - muted: colors.neutral[500], + secondary: colors.neutral[500], + muted: colors.neutral[350], placeholder: colors.neutral[300], active: colors.neutral[900], feature: colors.indigo[500], @@ -102,19 +102,19 @@ const editor = { indent_guide: borderColor.muted, indent_guide_active: borderColor.secondary, line: { - active: backgroundColor[500].active, - highlighted: backgroundColor[500].active, + active: withOpacity(colors.neutral[900], 0.06), + highlighted: withOpacity(colors.neutral[900], 0.12), inserted: backgroundColor.ok.active, deleted: backgroundColor.error.active, modified: backgroundColor.info.active, }, highlight: { selection: player[1].selectionColor, - occurrence: withOpacity(colors.amber[500], 0.06), - activeOccurrence: withOpacity(colors.amber[500], 0.26), + occurrence: withOpacity(colors.neutral[900], 0.06), + activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side matchingBracket: colors.neutral[0], - match: withOpacity(colors.purple[500], 0.12), - activeMatch: withOpacity(colors.purple[400], 0.36), + match: withOpacity(colors.red[500], 0.2), + activeMatch: withOpacity(colors.indigo[400], 0.36), related: colors.neutral[0], }, gutter: { From 1453954ef4398535f017530ce52a30d7aea0ac34 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 6 Apr 2022 09:08:44 +0200 Subject: [PATCH 084/245] Autoscroll to active tab when activating a new item --- crates/gpui/src/elements/flex.rs | 29 +++++++++++++++++++++++++++-- crates/workspace/src/pane.rs | 12 ++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index ff98d2948b4ec538f784d92fdc34d1e3dca0bd94..f7d60e409bd3581bcb1c4bd85e2106650be3641f 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -13,6 +13,7 @@ use serde_json::json; #[derive(Default)] struct ScrollState { + scroll_to: Option, scroll_position: f32, } @@ -39,12 +40,19 @@ impl Flex { Self::new(Axis::Vertical) } - pub fn scrollable(mut self, element_id: usize, cx: &mut C) -> Self + pub fn scrollable( + mut self, + element_id: usize, + scroll_to: Option, + cx: &mut C, + ) -> Self where Tag: 'static, C: ElementStateContext, { - self.scroll_state = Some(cx.element_state::(element_id)); + let scroll_state = cx.element_state::(element_id); + scroll_state.update(cx, |scroll_state, _| scroll_state.scroll_to = scroll_to); + self.scroll_state = Some(scroll_state); self } @@ -185,6 +193,23 @@ impl Element for Flex { if let Some(scroll_state) = self.scroll_state.as_ref() { scroll_state.update(cx, |scroll_state, _| { + if let Some(scroll_to) = scroll_state.scroll_to.take() { + let visible_start = scroll_state.scroll_position; + let visible_end = visible_start + size.along(self.axis); + if let Some(child) = self.children.get(scroll_to) { + let child_start: f32 = self.children[..scroll_to] + .iter() + .map(|c| c.size().along(self.axis)) + .sum(); + let child_end = child_start + child.size().along(self.axis); + if child_start < visible_start { + scroll_state.scroll_position = child_start; + } else if child_end > visible_end { + scroll_state.scroll_position = child_end - size.along(self.axis); + } + } + } + scroll_state.scroll_position = scroll_state.scroll_position.min(-remaining_space).max(0.); }); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 76093883c4d63f3d1d93ec6323b572ea0aef2f49..5d7f373b2f09421a1a2ce0779cf4c07fe115f080 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -100,6 +100,7 @@ pub enum Event { pub struct Pane { items: Vec>, active_item_index: usize, + autoscroll: bool, nav_history: Rc>, toolbar: ViewHandle, } @@ -141,6 +142,7 @@ impl Pane { Self { items: Vec::new(), active_item_index: 0, + autoscroll: false, nav_history: Default::default(), toolbar: cx.add_view(|_| Toolbar::new()), } @@ -388,6 +390,7 @@ impl Pane { self.focus_active_item(cx); self.activate(cx); } + self.autoscroll = true; cx.notify(); } } @@ -627,13 +630,18 @@ impl Pane { }); } - fn render_tabs(&self, cx: &mut RenderContext) -> ElementBox { + fn render_tabs(&mut self, cx: &mut RenderContext) -> ElementBox { let theme = cx.global::().theme.clone(); enum Tabs {} let pane = cx.handle(); let tabs = MouseEventHandler::new::(0, cx, |mouse_state, cx| { - let mut row = Flex::row().scrollable::(1, cx); + let autoscroll = if mem::take(&mut self.autoscroll) { + Some(self.active_item_index) + } else { + None + }; + let mut row = Flex::row().scrollable::(1, autoscroll, cx); for (ix, item) in self.items.iter().enumerate() { let is_active = ix == self.active_item_index; From d7342e28750b2e80faaf496c2d2ba97c0b2ff7f5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 6 Apr 2022 09:31:54 +0200 Subject: [PATCH 085/245] Use `Pane::activate_item` when navigating to remove duplicated logic --- crates/workspace/src/pane.rs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 5d7f373b2f09421a1a2ce0779cf4c07fe115f080..031b06fe277f265ee6fc00e474520570e5e775a6 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -201,27 +201,19 @@ impl Pane { .upgrade(cx) .and_then(|v| pane.index_for_item(v.as_ref())) { - if let Some(item) = pane.active_item() { - pane.nav_history.borrow_mut().set_mode(mode); - item.deactivated(cx); - pane.nav_history - .borrow_mut() - .set_mode(NavigationMode::Normal); - } - - let prev_active_index = mem::replace(&mut pane.active_item_index, index); + let prev_active_item_index = pane.active_item_index; + pane.nav_history.borrow_mut().set_mode(mode); + pane.activate_item(index, true, cx); + pane.nav_history + .borrow_mut() + .set_mode(NavigationMode::Normal); - let mut navigated = prev_active_index != pane.active_item_index; + let mut navigated = prev_active_item_index != pane.active_item_index; if let Some(data) = entry.data { navigated |= pane.active_item()?.navigate(data, cx); } if navigated { - pane.focus_active_item(cx); - pane.update_toolbar(cx); - pane.activate(cx); - cx.emit(Event::ActivateItem { local: true }); - cx.notify(); break None; } } @@ -377,10 +369,12 @@ impl Pane { } pub fn activate_item(&mut self, index: usize, local: bool, cx: &mut ViewContext) { + use NavigationMode::{GoingBack, GoingForward}; if index < self.items.len() { let prev_active_item_ix = mem::replace(&mut self.active_item_index, index); - if prev_active_item_ix != self.active_item_index - && prev_active_item_ix < self.items.len() + if matches!(self.nav_history.borrow().mode, GoingBack | GoingForward) + || (prev_active_item_ix != self.active_item_index + && prev_active_item_ix < self.items.len()) { self.items[prev_active_item_ix].deactivated(cx); cx.emit(Event::ActivateItem { local }); From f29b8c795e9256e25d8ecdc6ada36c4c07e4df31 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Apr 2022 11:00:25 -0400 Subject: [PATCH 086/245] Remove `message.txt` --- message.txt | 1672 --------------------------------------------------- 1 file changed, 1672 deletions(-) delete mode 100644 message.txt diff --git a/message.txt b/message.txt deleted file mode 100644 index f086360d37f8ee060cb030b5f2026d7a81f4864c..0000000000000000000000000000000000000000 --- a/message.txt +++ /dev/null @@ -1,1672 +0,0 @@ -{ - "core": { - "color": { - "neutral": { - "0": { - "value": "#FFFFFF", - "type": "color" - }, - "50": { - "value": "#F8F8F8", - "type": "color" - }, - "100": { - "value": "#F0F0F0", - "type": "color" - }, - "150": { - "value": "#E1E1E1", - "type": "color" - }, - "200": { - "value": "#D2D2D2", - "type": "color" - }, - "250": { - "value": "#C3C3C3", - "type": "color" - }, - "300": { - "value": "#B4B4B4", - "type": "color" - }, - "350": { - "value": "#A5A5A5", - "type": "color" - }, - "400": { - "value": "#969696", - "type": "color" - }, - "450": { - "value": "#878787", - "type": "color" - }, - "500": { - "value": "#787878", - "type": "color" - }, - "550": { - "value": "#696969", - "type": "color" - }, - "600": { - "value": "#5A5A5A", - "type": "color" - }, - "650": { - "value": "#4B4B4B", - "type": "color" - }, - "700": { - "value": "#3C3C3C", - "type": "color" - }, - "750": { - "value": "#262626", - "type": "color" - }, - "800": { - "value": "#1E1E1E", - "type": "color" - }, - "850": { - "value": "#0F0F0F", - "type": "color" - }, - "900": { - "value": "#000000", - "type": "color" - } - }, - "steel": { - "0": { - "value": "#F8FAFC", - "type": "color" - }, - "100": { - "value": "#F1F5F9", - "type": "color" - }, - "200": { - "value": "#E2E8F0", - "type": "color" - }, - "300": { - "value": "#CBD5E1", - "type": "color" - }, - "400": { - "value": "#94A3BA", - "type": "color" - }, - "500": { - "value": "#64748B", - "type": "color" - }, - "600": { - "value": "#475569", - "type": "color" - }, - "700": { - "value": "#334155", - "type": "color" - }, - "800": { - "value": "#1E293B", - "type": "color" - }, - "900": { - "value": "#0F172A", - "type": "color" - } - }, - "gray": { - "0": { - "value": "#FAFAFA", - "type": "color" - }, - "100": { - "value": "#F4F4F5", - "type": "color" - }, - "200": { - "value": "#E4E4E7", - "type": "color" - }, - "300": { - "value": "#D4D4D8", - "type": "color" - }, - "400": { - "value": "#A1A1AA", - "type": "color" - }, - "500": { - "value": "#71717A", - "type": "color" - }, - "600": { - "value": "#52525B", - "type": "color" - }, - "700": { - "value": "#3F3F46", - "type": "color" - }, - "800": { - "value": "#27272A", - "type": "color" - }, - "900": { - "value": "#18181B", - "type": "color" - } - }, - "rose": { - "0": { - "value": "#FFF1F2", - "type": "color" - }, - "100": { - "value": "#FFE4E6", - "type": "color" - }, - "200": { - "value": "#FECDD3", - "type": "color" - }, - "300": { - "value": "#FDA4AF", - "type": "color" - }, - "400": { - "value": "#FB7185", - "type": "color" - }, - "500": { - "value": "#F43F5E", - "type": "color" - }, - "600": { - "value": "#E11D48", - "type": "color" - }, - "700": { - "value": "#BE123C", - "type": "color" - }, - "800": { - "value": "#9F1239", - "type": "color" - }, - "900": { - "value": "#881337", - "type": "color" - } - }, - "red": { - "0": { - "value": "#FEF2F2", - "type": "color" - }, - "100": { - "value": "#FEE2E2", - "type": "color" - }, - "200": { - "value": "#FECACA", - "type": "color" - }, - "300": { - "value": "#FCA5A5", - "type": "color" - }, - "400": { - "value": "#F87171", - "type": "color" - }, - "500": { - "value": "#EF4444", - "type": "color" - }, - "600": { - "value": "#DC2626", - "type": "color" - }, - "700": { - "value": "#B91C1C", - "type": "color" - }, - "800": { - "value": "#991B1B", - "type": "color" - }, - "900": { - "value": "#7F1D1D", - "type": "color" - } - }, - "orange": { - "0": { - "value": "#FFF7ED", - "type": "color" - }, - "100": { - "value": "#FFEDD5", - "type": "color" - }, - "200": { - "value": "#FED7AA", - "type": "color" - }, - "300": { - "value": "#FDBA74", - "type": "color" - }, - "400": { - "value": "#FB923C", - "type": "color" - }, - "500": { - "value": "#F97316", - "type": "color" - }, - "600": { - "value": "#EA580C", - "type": "color" - }, - "700": { - "value": "#C2410C", - "type": "color" - }, - "800": { - "value": "#9A3412", - "type": "color" - }, - "900": { - "value": "#7C2D12", - "type": "color" - } - }, - "amber": { - "0": { - "value": "#FFFBEB", - "type": "color" - }, - "100": { - "value": "#FEF3C7", - "type": "color" - }, - "200": { - "value": "#FDE68A", - "type": "color" - }, - "300": { - "value": "#FCD34D", - "type": "color" - }, - "400": { - "value": "#FBBF24", - "type": "color" - }, - "500": { - "value": "#F59E0B", - "type": "color" - }, - "600": { - "value": "#D97706", - "type": "color" - }, - "700": { - "value": "#B45309", - "type": "color" - }, - "800": { - "value": "#92400E", - "type": "color" - }, - "900": { - "value": "#78350F", - "type": "color" - } - }, - "yellow": { - "0": { - "value": "#FEFCE8", - "type": "color" - }, - "100": { - "value": "#FEF9C3", - "type": "color" - }, - "200": { - "value": "#FEF08A", - "type": "color" - }, - "300": { - "value": "#FDE047", - "type": "color" - }, - "400": { - "value": "#FACC15", - "type": "color" - }, - "500": { - "value": "#EAB308", - "type": "color" - }, - "600": { - "value": "#CA8A04", - "type": "color" - }, - "700": { - "value": "#A16207", - "type": "color" - }, - "800": { - "value": "#854D0E", - "type": "color" - }, - "900": { - "value": "#713F12", - "type": "color" - } - }, - "lime": { - "0": { - "value": "#F7FEE7", - "type": "color" - }, - "100": { - "value": "#ECFCCB", - "type": "color" - }, - "200": { - "value": "#D9F99D", - "type": "color" - }, - "300": { - "value": "#BEF264", - "type": "color" - }, - "400": { - "value": "#A3E635", - "type": "color" - }, - "500": { - "value": "#84CC16", - "type": "color" - }, - "600": { - "value": "#65A30D", - "type": "color" - }, - "700": { - "value": "#4D7C0F", - "type": "color" - }, - "800": { - "value": "#3F6212", - "type": "color" - }, - "900": { - "value": "#365314", - "type": "color" - } - }, - "green": { - "0": { - "value": "#F0FDF4", - "type": "color" - }, - "100": { - "value": "#DCFCE7", - "type": "color" - }, - "200": { - "value": "#BBF7D0", - "type": "color" - }, - "300": { - "value": "#86EFAC", - "type": "color" - }, - "400": { - "value": "#4ADE80", - "type": "color" - }, - "500": { - "value": "#22C55E", - "type": "color" - }, - "600": { - "value": "#16A34A", - "type": "color" - }, - "700": { - "value": "#15803D", - "type": "color" - }, - "800": { - "value": "#166534", - "type": "color" - }, - "900": { - "value": "#14532D", - "type": "color" - } - }, - "emerald": { - "0": { - "value": "#ECFDF5", - "type": "color" - }, - "100": { - "value": "#D1FAE5", - "type": "color" - }, - "200": { - "value": "#A7F3D0", - "type": "color" - }, - "300": { - "value": "#6EE7B7", - "type": "color" - }, - "400": { - "value": "#34D399", - "type": "color" - }, - "500": { - "value": "#10B981", - "type": "color" - }, - "600": { - "value": "#059669", - "type": "color" - }, - "700": { - "value": "#047857", - "type": "color" - }, - "800": { - "value": "#065F46", - "type": "color" - }, - "900": { - "value": "#064E3B", - "type": "color" - } - }, - "teal": { - "0": { - "value": "#F0FDFA", - "type": "color" - }, - "100": { - "value": "#CCFBF1", - "type": "color" - }, - "200": { - "value": "#99F6E4", - "type": "color" - }, - "300": { - "value": "#5EEAD4", - "type": "color" - }, - "400": { - "value": "#2DD4BF", - "type": "color" - }, - "500": { - "value": "#14B8A6", - "type": "color" - }, - "600": { - "value": "#0D9488", - "type": "color" - }, - "700": { - "value": "#0F766E", - "type": "color" - }, - "800": { - "value": "#115E59", - "type": "color" - }, - "900": { - "value": "#134E4A", - "type": "color" - } - }, - "cyan": { - "0": { - "value": "#ECFEFF", - "type": "color" - }, - "100": { - "value": "#CFFAFE", - "type": "color" - }, - "200": { - "value": "#A5F3FC", - "type": "color" - }, - "300": { - "value": "#67E8F9", - "type": "color" - }, - "400": { - "value": "#22D3EE", - "type": "color" - }, - "500": { - "value": "#06BBD4", - "type": "color" - }, - "600": { - "value": "#0891B2", - "type": "color" - }, - "700": { - "value": "#0E7490", - "type": "color" - }, - "800": { - "value": "#155E75", - "type": "color" - }, - "900": { - "value": "#164E63", - "type": "color" - } - }, - "sky": { - "0": { - "value": "#F0F9FF", - "type": "color" - }, - "100": { - "value": "#E0F2FE", - "type": "color" - }, - "200": { - "value": "#BAE6FD", - "type": "color" - }, - "300": { - "value": "#7DD3FC", - "type": "color" - }, - "400": { - "value": "#38BDF8", - "type": "color" - }, - "500": { - "value": "#0EA5E9", - "type": "color" - }, - "600": { - "value": "#0284C7", - "type": "color" - }, - "700": { - "value": "#0369A1", - "type": "color" - }, - "800": { - "value": "#075985", - "type": "color" - }, - "900": { - "value": "#0C4A6E", - "type": "color" - } - }, - "blue": { - "0": { - "value": "#EFF6FF", - "type": "color" - }, - "100": { - "value": "#DBEAFE", - "type": "color" - }, - "200": { - "value": "#BFDBFE", - "type": "color" - }, - "300": { - "value": "#93C5FD", - "type": "color" - }, - "400": { - "value": "#60A5FA", - "type": "color" - }, - "500": { - "value": "#3B82F6", - "type": "color" - }, - "600": { - "value": "#2563EB", - "type": "color" - }, - "700": { - "value": "#1D4ED8", - "type": "color" - }, - "800": { - "value": "#1E40A4", - "type": "color" - }, - "900": { - "value": "#1E3A8A", - "type": "color" - } - }, - "indigo": { - "0": { - "value": "#EEF2FF", - "type": "color" - }, - "100": { - "value": "#E0E7FF", - "type": "color" - }, - "200": { - "value": "#C7D2FE", - "type": "color" - }, - "300": { - "value": "#A5B4FC", - "type": "color" - }, - "400": { - "value": "#818CF8", - "type": "color" - }, - "500": { - "value": "#6366F1", - "type": "color" - }, - "600": { - "value": "#4F46E5", - "type": "color" - }, - "700": { - "value": "#4338CA", - "type": "color" - }, - "800": { - "value": "#3730A3", - "type": "color" - }, - "900": { - "value": "#312E81", - "type": "color" - } - }, - "violet": { - "0": { - "value": "#F5F3FF", - "type": "color" - }, - "100": { - "value": "#EDE9FE", - "type": "color" - }, - "200": { - "value": "#DDD6FE", - "type": "color" - }, - "300": { - "value": "#C4B5FD", - "type": "color" - }, - "400": { - "value": "#A78BFA", - "type": "color" - }, - "500": { - "value": "#8B5CF6", - "type": "color" - }, - "600": { - "value": "#7C3AED", - "type": "color" - }, - "700": { - "value": "#6D28D9", - "type": "color" - }, - "800": { - "value": "#5B21B6", - "type": "color" - }, - "900": { - "value": "#4C1D95", - "type": "color" - } - }, - "purple": { - "0": { - "value": "#FAF5FF", - "type": "color" - }, - "100": { - "value": "#F3E8FF", - "type": "color" - }, - "200": { - "value": "#E9D5FF", - "type": "color" - }, - "300": { - "value": "#D8B4FE", - "type": "color" - }, - "400": { - "value": "#C084FC", - "type": "color" - }, - "500": { - "value": "#A855F7", - "type": "color" - }, - "600": { - "value": "#9333EA", - "type": "color" - }, - "700": { - "value": "#7E22CE", - "type": "color" - }, - "800": { - "value": "#6B21A8", - "type": "color" - }, - "900": { - "value": "#581C87", - "type": "color" - } - }, - "fuschia": { - "0": { - "value": "#FDF4FF", - "type": "color" - }, - "100": { - "value": "#FAE8FF", - "type": "color" - }, - "200": { - "value": "#F5D0FE", - "type": "color" - }, - "300": { - "value": "#F0ABFC", - "type": "color" - }, - "400": { - "value": "#E879F9", - "type": "color" - }, - "500": { - "value": "#D946E4", - "type": "color" - }, - "600": { - "value": "#C026D3", - "type": "color" - }, - "700": { - "value": "#A21CAF", - "type": "color" - }, - "800": { - "value": "#86198F", - "type": "color" - }, - "900": { - "value": "#701A75", - "type": "color" - } - }, - "pink": { - "0": { - "value": "#FDF2F8", - "type": "color" - }, - "100": { - "value": "#FCE7F3", - "type": "color" - }, - "200": { - "value": "#FBCFE8", - "type": "color" - }, - "300": { - "value": "#F988D4", - "type": "color" - }, - "400": { - "value": "#F472B6", - "type": "color" - }, - "500": { - "value": "#EC4899", - "type": "color" - }, - "600": { - "value": "#DB2777", - "type": "color" - }, - "700": { - "value": "#BE185D", - "type": "color" - }, - "800": { - "value": "#9D174D", - "type": "color" - }, - "900": { - "value": "#831843", - "type": "color" - } - } - }, - "font-weight": { - "normal": { - "100": { - "value": "Thin", - "type": "fontWeights" - }, - "200": { - "value": "Light", - "type": "fontWeights" - }, - "400": { - "value": "Regular", - "type": "fontWeights" - }, - "500": { - "value": "Semibold", - "type": "fontWeights" - }, - "600": { - "value": "Bold", - "type": "fontWeights" - }, - "800": { - "value": "Heavy", - "type": "fontWeights" - } - }, - "normal-bold": { - "100": { - "value": "Thin", - "type": "fontWeights" - }, - "200": { - "value": "Light", - "type": "fontWeights" - }, - "400": { - "value": "Regular", - "type": "fontWeights" - }, - "500": { - "value": "Semibold", - "type": "fontWeights" - }, - "600": { - "value": "Bold", - "type": "fontWeights" - }, - "800": { - "value": "Heavy", - "type": "fontWeights" - } - }, - "italic": { - "100": { - "value": "Thin Italic", - "type": "fontWeights" - }, - "200": { - "value": "Light", - "type": "fontWeights" - }, - "400": { - "value": "Regular", - "type": "fontWeights" - }, - "500": { - "value": "Semibold", - "type": "fontWeights" - }, - "600": { - "value": "Bold", - "type": "fontWeights" - }, - "800": { - "value": "Heavy", - "type": "fontWeights" - } - }, - "italic-bold": { - "100": { - "value": "Thin Italic", - "type": "fontWeights" - }, - "200": { - "value": "Light", - "type": "fontWeights" - }, - "400": { - "value": "Regular", - "type": "fontWeights" - }, - "500": { - "value": "Semibold", - "type": "fontWeights" - }, - "600": { - "value": "Bold", - "type": "fontWeights" - }, - "800": { - "value": "Heavy", - "type": "fontWeights" - } - } - }, - "font-family": { - "zed-mono": { - "value": "Zed Mono", - "type": "fontFamilies" - }, - "zed-sans": { - "value": "Zed Sans", - "type": "fontFamilies" - } - }, - "font-size": { - "3xs": { - "value": "8", - "type": "fontSizes" - }, - "2xs": { - "value": "10", - "type": "fontSizes" - }, - "xs": { - "value": "12", - "type": "fontSizes" - }, - "sm": { - "value": "14", - "type": "fontSizes" - }, - "base": { - "value": "16", - "type": "fontSizes" - }, - "lg": { - "value": "18", - "type": "fontSizes" - }, - "xl": { - "value": "20", - "type": "fontSizes" - } - }, - "leading": { - "xs": { - "value": "16", - "type": "lineHeights" - }, - "sm": { - "value": "20", - "type": "lineHeights" - }, - "base": { - "value": "24", - "type": "lineHeights" - }, - "lg": { - "value": "26", - "type": "lineHeights" - }, - "xl": { - "value": "28", - "type": "lineHeights" - }, - "2xl": { - "value": "30", - "type": "lineHeights" - } - }, - "text-decoration": { - "none": { - "value": "none", - "type": "textDecoration" - } - }, - "ui-text": { - "normal": { - "base": { - "value": { - "fontFamily": "{font-family.zed-sans}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.sm}", - "fontSize": "{font-size.sm}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography", - "bold": { - "value": { - "fontFamily": "$text.family.zed-sans", - "fontWeight": "$text.weight.bold", - "lineHeight": "$text.leading.base", - "fontSize": "$text.size.xs", - "letterSpacing": "$text.tracking.default", - "paragraphSpacing": "$text.paragraphSpacing.0", - "textCase": "$text.case.default", - "decoration": "$text.decoration.none", - "textDecoration": "$text.decoration.none" - }, - "type": "typography" - } - }, - "sm": { - "value": { - "fontFamily": "{font-family.zed-sans}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.xs}", - "fontSize": "{font-size.xs}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography", - "bold": { - "value": { - "fontFamily": "$text.family.zed-sans", - "fontWeight": "$text.weight.bold", - "lineHeight": "$text.leading.base", - "fontSize": "$text.size.xs", - "letterSpacing": "$text.tracking.default", - "paragraphSpacing": "$text.paragraphSpacing.0", - "textCase": "$text.case.default", - "decoration": "$text.decoration.none", - "textDecoration": "$text.decoration.none" - }, - "type": "typography" - } - } - }, - "bold": { - "base": { - "value": { - "fontFamily": "{font-family.zed-sans}", - "fontWeight": "$font-weight.normal.600", - "lineHeight": "{leading.base}", - "fontSize": "{font-size.sm}", - "letterSpacing": "{letter-spacing.sm}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography" - }, - "sm": { - "value": { - "fontFamily": "{font-family.zed-sans}", - "fontWeight": "$font-weight.normal.600", - "lineHeight": "{leading.xs}", - "fontSize": "{font-size.xs}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography" - } - } - }, - "buffer-text": { - "normal": { - "xs": { - "value": { - "fontFamily": "{font-family.zed-mono}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.xs}", - "fontSize": "{font-size.xs}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography" - }, - "sm": { - "value": { - "fontFamily": "{font-family.zed-mono}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.sm}", - "fontSize": "{font-size.sm}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "{text-decoration.none}" - }, - "type": "typography" - }, - "base": { - "value": { - "fontFamily": "{font-family.zed-mono}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.lg}", - "fontSize": "{font-size.base}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "$text.decoration.default" - }, - "type": "typography" - }, - "lg": { - "value": { - "fontFamily": "{font-family.zed-mono}", - "fontWeight": "$font-weight.normal.400", - "lineHeight": "{leading.lg}", - "fontSize": "{font-size.lg}", - "letterSpacing": "{letter-spacing.base}", - "paragraphSpacing": "{paragraph-spacing.default}", - "textCase": "{text-case.default}", - "decoration": "{text-decoration.none}", - "textDecoration": "$text.decoration.default" - }, - "type": "typography" - } - } - }, - "letter-spacing": { - "tight": { - "value": "-0.05", - "type": "letterSpacing" - }, - "base": { - "value": "0%", - "type": "letterSpacing" - }, - "wide": { - "value": "0.05", - "type": "letterSpacing" - } - }, - "paragraph-spacing": { - "default": { - "value": "0", - "type": "paragraphSpacing" - } - }, - "text-case": { - "default": { - "value": "none", - "type": "textCase" - }, - "lowercase": { - "value": "lowercase", - "type": "textCase" - }, - "uppercase": { - "value": "uppercase", - "type": "textCase" - } - }, - "space": { - "s-0": { - "value": "0", - "type": "spacing" - }, - "s-4": { - "value": "{var.base}", - "type": "spacing" - }, - "s-8": { - "value": "{var.base} * 2", - "type": "spacing" - }, - "s-12": { - "value": "{var.base} * 3", - "type": "spacing" - }, - "s-16": { - "value": "{var.base} * 4", - "type": "spacing" - } - }, - "internal": { - "mac-os": { - "red": { - "value": "#FF5E57", - "type": "color" - }, - "yellow": { - "value": "#FFBB2E", - "type": "color" - }, - "green": { - "value": "#38C149", - "type": "color" - } - } - }, - "border-radius": { - "xs": { - "value": "2", - "type": "borderRadius" - }, - "sm": { - "value": "4", - "type": "borderRadius" - }, - "base": { - "value": "6", - "type": "borderRadius" - }, - "lg": { - "value": "8", - "type": "borderRadius" - }, - "xl": { - "value": "10", - "type": "borderRadius" - } - }, - "border-width": { - "base": { - "value": "1", - "type": "borderWidth" - } - }, - "elevation": { - "300": { - "value": { - "x": "0", - "y": "4", - "blur": "12", - "spread": "0", - "color": "rgba({color.neutral.900}, {shadow.base})", - "type": "dropShadow" - }, - "type": "boxShadow" - } - }, - "var": { - "base": { - "value": "4", - "type": "other" - } - } - }, - "dark": { - "text-color": { - "primary": { - "value": "{color.neutral.150}", - "type": "color" - }, - "secondary": { - "value": "{color.neutral.350}", - "type": "color" - }, - "muted": { - "value": "{color.neutral.550}", - "type": "color" - }, - "minimal": { - "value": "{color.neutral.750}", - "type": "color" - }, - "active": { - "value": "{color.neutral.0}", - "type": "color" - }, - "disabled": { - "value": "{color.neutral.650}", - "type": "color" - }, - "positive": { - "value": "{color.green.600}", - "type": "color" - }, - "negative": { - "value": "{color.red.400}", - "type": "color" - }, - "warning": { - "value": "{color.amber.300}", - "type": "color" - }, - "info": { - "value": "{color.blue.500}", - "type": "color" - } - }, - "icon-color": { - "primary": { - "value": "{text.secondary}", - "type": "color" - }, - "secondary": { - "value": "{text.muted}", - "type": "color" - }, - "active": { - "value": "{text.active}", - "type": "color" - }, - "disabled": { - "value": "{text.disabled}", - "type": "color" - }, - "positive": { - "value": "{color.green.600}", - "type": "color" - }, - "negative": { - "value": "{color.red.400}", - "type": "color" - }, - "warning": { - "value": "{color.amber.300}", - "type": "color" - }, - "info": { - "value": "{color.blue.500}", - "type": "color" - } - }, - "icon-size": { - "default": { - "value": "16", - "type": "size" - } - }, - "background-color": { - "100": { - "value": "{color.neutral.750}", - "type": "color", - "description": "The app background. Used for title-bar, other daylight." - }, - "300": { - "value": "{color.neutral.800}", - "type": "color", - "description": "The primary surface layer. Used for tabs, panels, pop-overs, etc." - }, - "500": { - "value": "{color.neutral.900}", - "type": "color", - "description": "Used for the buffer background and active buffer tabs." - }, - "active": { - "value": "rgba({icon.active}}, 0.1)", - "type": "color" - }, - "focused": { - "value": "// wip", - "type": "color" - }, - "disabled": { - "value": "// wip", - "type": "color" - }, - "positive": { - "value": "{color.green.600}", - "type": "color" - }, - "negative": { - "value": "{color.red.400}", - "type": "color" - }, - "warning": { - "value": "{color.amber.300}", - "type": "color" - }, - "info": { - "value": "{color.blue.500}", - "type": "color" - } - }, - "border-color": { - "default": { - "value": "{color.neutral.850}", - "type": "color" - }, - "secondary": { - "value": "{color.neutral.700}", - "type": "color" - }, - "minimal": { - "value": "{color.neutral.750}", - "type": "color" - }, - "active": { - "value": "{color.neutral.500}", - "type": "color" - }, - "focused": { - "value": "{color.neutral.100}", - "type": "color" - } - }, - "editor": { - "background-color": { - "value": "{surface.500}", - "type": "color" - }, - "indent-guide": { - "value": "{icon.disabled}", - "type": "color" - }, - "indent-guide-active": { - "value": "{icon.secondary}", - "type": "color" - }, - "highlight": { - "active-line": { - "value": "rgba({color.neutral.0}, 0.08)", - "type": "color" - }, - "selection": { - "value": "{player.selection.one}", - "type": "color" - }, - "folded-line": { - "value": "rgba({surface.500}, 0.03)", - "type": "color" - }, - "occurrence": { - "value": "rgba({text.active}, 0.15)", - "type": "color" - }, - "matching-bracket": { - "value": "rgba({color.indigo.500}, 0.8)", - "type": "color" - }, - "match": { - "value": "rgba({color.blue.500},0.5)", - "type": "color" - }, - "active-match": { - "value": "rgba({color.blue.500},0.8)", - "type": "color" - } - }, - "gutter": { - "primary": { - "value": "{text.muted}", - "type": "color" - }, - "active": { - "value": "{text.active}", - "type": "color" - } - }, - "syntax": { - "primary": { - "value": "{text.primary}", - "type": "color" - }, - "comment": { - "value": "{color.lime.200}", - "type": "color" - }, - "punctuation": { - "value": "{text.secondary}", - "type": "color" - }, - "constant": { - "value": "{syntax.primary}", - "type": "color" - }, - "keyword": { - "value": "{color.sky.400}", - "type": "color" - }, - "function": { - "value": "{color.yellow.200}", - "type": "color" - }, - "type": { - "value": "{color.teal.300}", - "type": "color" - }, - "variant": { - "value": "{syntax.type}", - "type": "color" - }, - "property": { - "value": "{color.sky.300}", - "type": "color" - }, - "enum": { - "value": "{syntax.operator}", - "type": "color" - }, - "operator": { - "value": "{syntax.keyword}", - "type": "color" - }, - "string": { - "value": "{color.orange.300}", - "type": "color" - }, - "number": { - "value": "{syntax.primary}", - "type": "color" - }, - "boolean": { - "value": "{syntax.number}", - "type": "color" - }, - "predictive": { - "value": "{text.muted}", - "type": "color" - } - } - }, - "player": { - "color": { - "1": { - "value": "{color.blue.600}", - "type": "color" - }, - "2": { - "value": "{color.indigo.500}", - "type": "color" - }, - "3": { - "value": "{color.green.500}", - "type": "color" - }, - "4": { - "value": "{color.orange.500}", - "type": "color" - }, - "5": { - "value": "{color.purple.500}", - "type": "color" - }, - "6": { - "value": "{color.teal.400}", - "type": "color" - }, - "7": { - "value": "{color.pink.400}", - "type": "color" - }, - "8": { - "value": "{color.yellow.400}", - "type": "color" - } - }, - "selection": { - "1": { - "value": "rgba({color.blue.600},0.1)", - "type": "color" - }, - "2": { - "value": "rgba({color.indigo.500}, 0.1)", - "type": "color" - }, - "3": { - "value": "rgba({color.green.500}, 0.1)", - "type": "color" - }, - "4": { - "value": "rgba({color.orange.500}, 0.15)", - "type": "color" - }, - "5": { - "value": "rgba({color.purple.500}, 0.1)", - "type": "color" - }, - "6": { - "value": "rgba({color.teal.400}, 0.1)", - "type": "color" - }, - "7": { - "value": "rgba({color.pink.400}, 0.1)", - "type": "color" - }, - "8": { - "value": "rgba({color.yellow.400}, 0.15)", - "type": "color" - } - } - }, - "shadow": { - "base": { - "value": "0.36", - "type": "opacity" - } - } - } -} \ No newline at end of file From 36fede75225fb85d740832ed015e21ca495aefd9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 6 Apr 2022 09:26:43 -0600 Subject: [PATCH 087/245] =?UTF-8?q?=F0=9F=92=84=20token-building=20script?= =?UTF-8?q?=20and=20output=20destinations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just some organization here. --- styles/dist/{figma => }/core.json | 0 styles/{src/figma => dist}/dark.json | 130 +- styles/{src/figma => dist}/light.json | 238 ++-- styles/{src/figma => dist}/tokens.json | 368 +++--- styles/package-lock.json | 472 ++----- styles/package.json | 3 +- styles/src/buildThemes.ts | 2 +- .../{buildFigmaTokens.ts => buildTokens.ts} | 36 +- styles/src/figma/core.json | 1155 ----------------- 9 files changed, 491 insertions(+), 1913 deletions(-) rename styles/dist/{figma => }/core.json (100%) rename styles/{src/figma => dist}/dark.json (87%) rename styles/{src/figma => dist}/light.json (80%) rename styles/{src/figma => dist}/tokens.json (92%) rename styles/src/{buildFigmaTokens.ts => buildTokens.ts} (68%) delete mode 100644 styles/src/figma/core.json diff --git a/styles/dist/figma/core.json b/styles/dist/core.json similarity index 100% rename from styles/dist/figma/core.json rename to styles/dist/core.json diff --git a/styles/src/figma/dark.json b/styles/dist/dark.json similarity index 87% rename from styles/src/figma/dark.json rename to styles/dist/dark.json index 28c27bfc23c2b520360f74634c6bd453643f58aa..760790a3cb6bceb1ca87c85c1ce51d532d9c4116 100644 --- a/styles/src/figma/dark.json +++ b/styles/dist/dark.json @@ -14,13 +14,13 @@ "type": "color" }, "muted": { - "value": "#636363", - "step": 550, + "value": "#808080", + "step": 450, "type": "color" }, "placeholder": { - "value": "#2b2b2b", - "step": 750, + "value": "#474747", + "step": 650, "type": "color" }, "active": { @@ -81,7 +81,7 @@ "type": "color" }, "feature": { - "value": "#1096d3", + "value": "#2472f2", "step": 500, "type": "color" }, @@ -119,8 +119,8 @@ "type": "color" }, "active": { - "value": "#393939", - "step": 700, + "value": "#1c1c1c", + "step": 800, "type": "color" }, "focused": { @@ -146,8 +146,8 @@ "type": "color" }, "focused": { - "value": "#323232", - "step": 725, + "value": "#232323", + "step": 775, "type": "color" } }, @@ -158,13 +158,13 @@ "type": "color" }, "hovered": { - "value": "#070707", - "step": 875, + "value": "#ffffff14", + "step": 0, "type": "color" }, "active": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "focused": { @@ -269,13 +269,13 @@ "type": "color" }, "secondary": { - "value": "#151515", - "step": 825, + "value": "#232323", + "step": 775, "type": "color" }, "muted": { - "value": "#232323", - "step": 775, + "value": "#404040", + "step": 675, "type": "color" }, "focused": { @@ -316,24 +316,24 @@ "type": "color" }, "indent_guide": { - "value": "#232323", - "step": 775, + "value": "#404040", + "step": 675, "type": "color" }, "indent_guide_active": { - "value": "#151515", - "step": 825, + "value": "#232323", + "step": 775, "type": "color" }, "line": { "active": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff12", + "step": 0, "type": "color" }, "highlighted": { - "value": "#070707", - "step": 875, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "inserted": { @@ -354,32 +354,32 @@ }, "highlight": { "selection": { - "value": "#103063", - "step": 800, + "value": "#2472f23d", + "step": 500, "type": "color" }, "occurrence": { - "value": "#2b2b2b", - "step": 750, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "activeOccurrence": { - "value": "#393939", - "step": 700, + "value": "#ffffff29", + "step": 0, "type": "color" }, "matchingBracket": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "match": { - "value": "#0a2633", - "step": 900, + "value": "#1096d329", + "step": 500, "type": "color" }, "activeMatch": { - "value": "#0e4158", + "value": "#0e415852", "step": 800, "type": "color" }, @@ -391,8 +391,8 @@ }, "gutter": { "primary": { - "value": "#636363", - "step": 550, + "value": "#474747", + "step": 650, "type": "color" }, "active": { @@ -465,13 +465,13 @@ "type": "color" }, "selectionColor": { - "value": "#103063", - "step": 800, + "value": "#2472f23d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#103063", - "step": 800, + "value": "#2472f2cc", + "step": 500, "type": "color" } }, @@ -487,34 +487,34 @@ "type": "color" }, "selectionColor": { - "value": "#38530f", - "step": 800, + "value": "#79ba163d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#79ba16", + "value": "#79ba16cc", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#484bed", + "value": "#d430e0", "step": 500, "type": "color" }, "cursorColor": { - "value": "#484bed", + "value": "#d430e0", "step": 500, "type": "color" }, "selectionColor": { - "value": "#121269", - "step": 800, + "value": "#d430e03d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#484bed", + "value": "#d430e0cc", "step": 500, "type": "color" } @@ -531,12 +531,12 @@ "type": "color" }, "selectionColor": { - "value": "#5d2f0e", - "step": 800, + "value": "#ee670a3d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#ee670a", + "value": "#ee670acc", "step": 500, "type": "color" } @@ -553,12 +553,12 @@ "type": "color" }, "selectionColor": { - "value": "#3e1169", - "step": 800, + "value": "#993bf33d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#993bf3", + "value": "#993bf3cc", "step": 500, "type": "color" } @@ -575,12 +575,12 @@ "type": "color" }, "selectionColor": { - "value": "#0e4f48", - "step": 800, + "value": "#16d6c13d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#16d6c1", + "value": "#16d6c1cc", "step": 400, "type": "color" } @@ -597,12 +597,12 @@ "type": "color" }, "selectionColor": { - "value": "#fbc6e1", - "step": 100, + "value": "#ef59a33d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ef59a3", + "value": "#ef59a3cc", "step": 400, "type": "color" } @@ -619,12 +619,12 @@ "type": "color" }, "selectionColor": { - "value": "#fce9b7", - "step": 100, + "value": "#f7bf173d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#f7bf17", + "value": "#f7bf17cc", "step": 400, "type": "color" } diff --git a/styles/src/figma/light.json b/styles/dist/light.json similarity index 80% rename from styles/src/figma/light.json rename to styles/dist/light.json index f4ed9e74013880772816eac62e9d934eb607c6c6..90fba12ac762cdaa47e7b77b6360f5df8a9319e7 100644 --- a/styles/src/figma/light.json +++ b/styles/dist/light.json @@ -9,18 +9,18 @@ "type": "color" }, "secondary": { - "value": "#555555", - "step": 600, + "value": "#474747", + "step": 650, "type": "color" }, "muted": { - "value": "#808080", - "step": 450, + "value": "#636363", + "step": 550, "type": "color" }, "placeholder": { - "value": "#aaaaaa", - "step": 300, + "value": "#808080", + "step": 450, "type": "color" }, "active": { @@ -29,7 +29,7 @@ "type": "color" }, "feature": { - "value": "#2472f2", + "value": "#484bed", "step": 500, "type": "color" }, @@ -56,8 +56,8 @@ }, "icon": { "primary": { - "value": "#aaaaaa", - "step": 300, + "value": "#393939", + "step": 700, "type": "color" }, "secondary": { @@ -66,13 +66,13 @@ "type": "color" }, "muted": { - "value": "#555555", - "step": 600, + "value": "#9c9c9c", + "step": 350, "type": "color" }, "placeholder": { - "value": "#393939", - "step": 700, + "value": "#aaaaaa", + "step": 300, "type": "color" }, "active": { @@ -81,8 +81,8 @@ "type": "color" }, "feature": { - "value": "#1179a8", - "step": 600, + "value": "#484bed", + "step": 500, "type": "color" }, "ok": { @@ -109,45 +109,45 @@ "background": { "100": { "base": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" }, "hovered": { - "value": "#d5d5d5", - "step": 150, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "active": { - "value": "#c6c6c6", - "step": 200, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "focused": { - "value": "#d5d5d5", - "step": 150, + "value": "#e3e3e3", + "step": 100, "type": "color" } }, "300": { "base": { - "value": "#f1f1f1", - "step": 50, + "value": "#f8f8f8", + "step": 25, "type": "color" }, "hovered": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" }, "active": { - "value": "#d5d5d5", - "step": 150, + "value": "#dcdcdc", + "step": 125, "type": "color" }, "focused": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" } }, @@ -158,18 +158,18 @@ "type": "color" }, "hovered": { - "value": "#f8f8f8", - "step": 25, + "value": "#00000008", + "step": 900, "type": "color" }, "active": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "focused": { - "value": "#eaeaea", - "step": 75, + "value": "#f1f1f1", + "step": 50, "type": "color" } }, @@ -264,18 +264,18 @@ }, "border": { "primary": { - "value": "#c6c6c6", - "step": 200, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "secondary": { - "value": "#e3e3e3", - "step": 100, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "muted": { - "value": "#f1f1f1", - "step": 50, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "focused": { @@ -316,24 +316,24 @@ "type": "color" }, "indent_guide": { - "value": "#f1f1f1", - "step": 50, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "indent_guide_active": { - "value": "#e3e3e3", - "step": 100, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "line": { "active": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "highlighted": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000001f", + "step": 900, "type": "color" }, "inserted": { @@ -354,18 +354,18 @@ }, "highlight": { "selection": { - "value": "#c5dafc", - "step": 100, + "value": "#2472f23d", + "step": 500, "type": "color" }, "occurrence": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "activeOccurrence": { - "value": "#ffffff", - "step": 0, + "value": "#00000029", + "step": 900, "type": "color" }, "matchingBracket": { @@ -374,13 +374,13 @@ "type": "color" }, "match": { - "value": "#ffffff", - "step": 0, + "value": "#eb2d2d33", + "step": 500, "type": "color" }, "activeMatch": { - "value": "#ffffff", - "step": 0, + "value": "#7274f35c", + "step": 400, "type": "color" }, "related": { @@ -404,59 +404,59 @@ }, "syntax": { "primary": { - "value": "#2b2b2b", + "value": "#1c1c1c", "type": "color" }, "comment": { - "value": "#555555", + "value": "#717171", "type": "color" }, "keyword": { - "value": "#103063", + "value": "#1819a1", "type": "color" }, "function": { - "value": "#1b9447", + "value": "#f9812e", "type": "color" }, "type": { - "value": "#138a7d", + "value": "#de900c", "type": "color" }, "variant": { - "value": "#1179a8", + "value": "#1096d3", "type": "color" }, "property": { - "value": "#134697", + "value": "#118a62", "type": "color" }, "enum": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "operator": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "string": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "number": { - "value": "#14a898", + "value": "#484bed", "type": "color" }, "boolean": { - "value": "#b0740f", + "value": "#eb2d2d", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#135acd", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "cursorColor": { @@ -465,101 +465,101 @@ "type": "color" }, "selectionColor": { - "value": "#c5dafc", - "step": 100, + "value": "#2472f23d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#2472f2", + "value": "#2472f2cc", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#dffab5", - "step": 100, + "value": "#12d7963d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796cc", + "step": 400, "type": "color" } }, "3": { "baseColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#cdcdfc", - "step": 100, + "value": "#de57e83d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8cc", + "step": 400, "type": "color" } }, "4": { "baseColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812e", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812e", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd6bd", - "step": 100, + "value": "#f9812e3d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812ecc", + "step": 400, "type": "color" } }, "5": { "baseColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#e4cbfc", - "step": 100, + "value": "#b066f83d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8cc", + "step": 400, "type": "color" } }, @@ -575,12 +575,12 @@ "type": "color" }, "selectionColor": { - "value": "#b1faf2", - "step": 100, + "value": "#16d6c13d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#16d6c1", + "value": "#16d6c1cc", "step": 400, "type": "color" } @@ -597,12 +597,12 @@ "type": "color" }, "selectionColor": { - "value": "#fbc6e1", - "step": 100, + "value": "#ef59a33d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ef59a3", + "value": "#ef59a3cc", "step": 400, "type": "color" } @@ -619,12 +619,12 @@ "type": "color" }, "selectionColor": { - "value": "#fce9b7", - "step": 100, + "value": "#f7bf173d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#f7bf17", + "value": "#f7bf17cc", "step": 400, "type": "color" } diff --git a/styles/src/figma/tokens.json b/styles/dist/tokens.json similarity index 92% rename from styles/src/figma/tokens.json rename to styles/dist/tokens.json index 79f3737ef6dea28f3e7cb823f1f2a42f129ee571..29d9daeec3c2cd007a6b1eb6ae9d8173057cbd15 100644 --- a/styles/src/figma/tokens.json +++ b/styles/dist/tokens.json @@ -1170,13 +1170,13 @@ "type": "color" }, "muted": { - "value": "#636363", - "step": 550, + "value": "#808080", + "step": 450, "type": "color" }, "placeholder": { - "value": "#2b2b2b", - "step": 750, + "value": "#474747", + "step": 650, "type": "color" }, "active": { @@ -1237,7 +1237,7 @@ "type": "color" }, "feature": { - "value": "#1096d3", + "value": "#2472f2", "step": 500, "type": "color" }, @@ -1275,8 +1275,8 @@ "type": "color" }, "active": { - "value": "#393939", - "step": 700, + "value": "#1c1c1c", + "step": 800, "type": "color" }, "focused": { @@ -1302,8 +1302,8 @@ "type": "color" }, "focused": { - "value": "#323232", - "step": 725, + "value": "#232323", + "step": 775, "type": "color" } }, @@ -1314,13 +1314,13 @@ "type": "color" }, "hovered": { - "value": "#070707", - "step": 875, + "value": "#ffffff14", + "step": 0, "type": "color" }, "active": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "focused": { @@ -1425,13 +1425,13 @@ "type": "color" }, "secondary": { - "value": "#151515", - "step": 825, + "value": "#232323", + "step": 775, "type": "color" }, "muted": { - "value": "#232323", - "step": 775, + "value": "#404040", + "step": 675, "type": "color" }, "focused": { @@ -1472,24 +1472,24 @@ "type": "color" }, "indent_guide": { - "value": "#232323", - "step": 775, + "value": "#404040", + "step": 675, "type": "color" }, "indent_guide_active": { - "value": "#151515", - "step": 825, + "value": "#232323", + "step": 775, "type": "color" }, "line": { "active": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff12", + "step": 0, "type": "color" }, "highlighted": { - "value": "#070707", - "step": 875, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "inserted": { @@ -1510,32 +1510,32 @@ }, "highlight": { "selection": { - "value": "#103063", - "step": 800, + "value": "#2472f23d", + "step": 500, "type": "color" }, "occurrence": { - "value": "#2b2b2b", - "step": 750, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "activeOccurrence": { - "value": "#393939", - "step": 700, + "value": "#ffffff29", + "step": 0, "type": "color" }, "matchingBracket": { - "value": "#0e0e0e", - "step": 850, + "value": "#ffffff1f", + "step": 0, "type": "color" }, "match": { - "value": "#0a2633", - "step": 900, + "value": "#1096d329", + "step": 500, "type": "color" }, "activeMatch": { - "value": "#0e4158", + "value": "#0e415852", "step": 800, "type": "color" }, @@ -1547,8 +1547,8 @@ }, "gutter": { "primary": { - "value": "#636363", - "step": 550, + "value": "#474747", + "step": 650, "type": "color" }, "active": { @@ -1621,13 +1621,13 @@ "type": "color" }, "selectionColor": { - "value": "#103063", - "step": 800, + "value": "#2472f23d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#103063", - "step": 800, + "value": "#2472f2cc", + "step": 500, "type": "color" } }, @@ -1643,34 +1643,34 @@ "type": "color" }, "selectionColor": { - "value": "#38530f", - "step": 800, + "value": "#79ba163d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#79ba16", + "value": "#79ba16cc", "step": 500, "type": "color" } }, "3": { "baseColor": { - "value": "#484bed", + "value": "#d430e0", "step": 500, "type": "color" }, "cursorColor": { - "value": "#484bed", + "value": "#d430e0", "step": 500, "type": "color" }, "selectionColor": { - "value": "#121269", - "step": 800, + "value": "#d430e03d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#484bed", + "value": "#d430e0cc", "step": 500, "type": "color" } @@ -1687,12 +1687,12 @@ "type": "color" }, "selectionColor": { - "value": "#5d2f0e", - "step": 800, + "value": "#ee670a3d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#ee670a", + "value": "#ee670acc", "step": 500, "type": "color" } @@ -1709,12 +1709,12 @@ "type": "color" }, "selectionColor": { - "value": "#3e1169", - "step": 800, + "value": "#993bf33d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#993bf3", + "value": "#993bf3cc", "step": 500, "type": "color" } @@ -1731,12 +1731,12 @@ "type": "color" }, "selectionColor": { - "value": "#0e4f48", - "step": 800, + "value": "#16d6c13d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#16d6c1", + "value": "#16d6c1cc", "step": 400, "type": "color" } @@ -1753,12 +1753,12 @@ "type": "color" }, "selectionColor": { - "value": "#fbc6e1", - "step": 100, + "value": "#ef59a33d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ef59a3", + "value": "#ef59a3cc", "step": 400, "type": "color" } @@ -1775,12 +1775,12 @@ "type": "color" }, "selectionColor": { - "value": "#fce9b7", - "step": 100, + "value": "#f7bf173d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#f7bf17", + "value": "#f7bf17cc", "step": 400, "type": "color" } @@ -1802,18 +1802,18 @@ "type": "color" }, "secondary": { - "value": "#555555", - "step": 600, + "value": "#474747", + "step": 650, "type": "color" }, "muted": { - "value": "#808080", - "step": 450, + "value": "#636363", + "step": 550, "type": "color" }, "placeholder": { - "value": "#aaaaaa", - "step": 300, + "value": "#808080", + "step": 450, "type": "color" }, "active": { @@ -1822,7 +1822,7 @@ "type": "color" }, "feature": { - "value": "#2472f2", + "value": "#484bed", "step": 500, "type": "color" }, @@ -1849,8 +1849,8 @@ }, "icon": { "primary": { - "value": "#aaaaaa", - "step": 300, + "value": "#393939", + "step": 700, "type": "color" }, "secondary": { @@ -1859,13 +1859,13 @@ "type": "color" }, "muted": { - "value": "#555555", - "step": 600, + "value": "#9c9c9c", + "step": 350, "type": "color" }, "placeholder": { - "value": "#393939", - "step": 700, + "value": "#aaaaaa", + "step": 300, "type": "color" }, "active": { @@ -1874,8 +1874,8 @@ "type": "color" }, "feature": { - "value": "#1179a8", - "step": 600, + "value": "#484bed", + "step": 500, "type": "color" }, "ok": { @@ -1902,45 +1902,45 @@ "background": { "100": { "base": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" }, "hovered": { - "value": "#d5d5d5", - "step": 150, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "active": { - "value": "#c6c6c6", - "step": 200, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "focused": { - "value": "#d5d5d5", - "step": 150, + "value": "#e3e3e3", + "step": 100, "type": "color" } }, "300": { "base": { - "value": "#f1f1f1", - "step": 50, + "value": "#f8f8f8", + "step": 25, "type": "color" }, "hovered": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" }, "active": { - "value": "#d5d5d5", - "step": 150, + "value": "#dcdcdc", + "step": 125, "type": "color" }, "focused": { - "value": "#e3e3e3", - "step": 100, + "value": "#eaeaea", + "step": 75, "type": "color" } }, @@ -1951,18 +1951,18 @@ "type": "color" }, "hovered": { - "value": "#f8f8f8", - "step": 25, + "value": "#00000008", + "step": 900, "type": "color" }, "active": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "focused": { - "value": "#eaeaea", - "step": 75, + "value": "#f1f1f1", + "step": 50, "type": "color" } }, @@ -2057,18 +2057,18 @@ }, "border": { "primary": { - "value": "#c6c6c6", - "step": 200, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "secondary": { - "value": "#e3e3e3", - "step": 100, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "muted": { - "value": "#f1f1f1", - "step": 50, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "focused": { @@ -2109,24 +2109,24 @@ "type": "color" }, "indent_guide": { - "value": "#f1f1f1", - "step": 50, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "indent_guide_active": { - "value": "#e3e3e3", - "step": 100, + "value": "#d5d5d5", + "step": 150, "type": "color" }, "line": { "active": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "highlighted": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000001f", + "step": 900, "type": "color" }, "inserted": { @@ -2147,18 +2147,18 @@ }, "highlight": { "selection": { - "value": "#c5dafc", - "step": 100, + "value": "#2472f23d", + "step": 500, "type": "color" }, "occurrence": { - "value": "#f1f1f1", - "step": 50, + "value": "#0000000f", + "step": 900, "type": "color" }, "activeOccurrence": { - "value": "#ffffff", - "step": 0, + "value": "#00000029", + "step": 900, "type": "color" }, "matchingBracket": { @@ -2167,13 +2167,13 @@ "type": "color" }, "match": { - "value": "#ffffff", - "step": 0, + "value": "#eb2d2d33", + "step": 500, "type": "color" }, "activeMatch": { - "value": "#ffffff", - "step": 0, + "value": "#7274f35c", + "step": 400, "type": "color" }, "related": { @@ -2197,59 +2197,59 @@ }, "syntax": { "primary": { - "value": "#2b2b2b", + "value": "#1c1c1c", "type": "color" }, "comment": { - "value": "#555555", + "value": "#717171", "type": "color" }, "keyword": { - "value": "#103063", + "value": "#1819a1", "type": "color" }, "function": { - "value": "#1b9447", + "value": "#f9812e", "type": "color" }, "type": { - "value": "#138a7d", + "value": "#de900c", "type": "color" }, "variant": { - "value": "#1179a8", + "value": "#1096d3", "type": "color" }, "property": { - "value": "#134697", + "value": "#118a62", "type": "color" }, "enum": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "operator": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "string": { - "value": "#bb550e", + "value": "#eb2d2d", "type": "color" }, "number": { - "value": "#14a898", + "value": "#484bed", "type": "color" }, "boolean": { - "value": "#b0740f", + "value": "#eb2d2d", "type": "color" } }, "player": { "1": { "baseColor": { - "value": "#135acd", - "step": 600, + "value": "#2472f2", + "step": 500, "type": "color" }, "cursorColor": { @@ -2258,101 +2258,101 @@ "type": "color" }, "selectionColor": { - "value": "#c5dafc", - "step": 100, + "value": "#2472f23d", + "step": 500, "type": "color" }, "borderColor": { - "value": "#2472f2", + "value": "#2472f2cc", "step": 500, "type": "color" } }, "2": { "baseColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#dffab5", - "step": 100, + "value": "#12d7963d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#79ba16", - "step": 500, + "value": "#12d796cc", + "step": 400, "type": "color" } }, "3": { "baseColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#cdcdfc", - "step": 100, + "value": "#de57e83d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#484bed", - "step": 500, + "value": "#de57e8cc", + "step": 400, "type": "color" } }, "4": { "baseColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812e", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812e", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#fcd6bd", - "step": 100, + "value": "#f9812e3d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ee670a", - "step": 500, + "value": "#f9812ecc", + "step": 400, "type": "color" } }, "5": { "baseColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8", + "step": 400, "type": "color" }, "cursorColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8", + "step": 400, "type": "color" }, "selectionColor": { - "value": "#e4cbfc", - "step": 100, + "value": "#b066f83d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#993bf3", - "step": 500, + "value": "#b066f8cc", + "step": 400, "type": "color" } }, @@ -2368,12 +2368,12 @@ "type": "color" }, "selectionColor": { - "value": "#b1faf2", - "step": 100, + "value": "#16d6c13d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#16d6c1", + "value": "#16d6c1cc", "step": 400, "type": "color" } @@ -2390,12 +2390,12 @@ "type": "color" }, "selectionColor": { - "value": "#fbc6e1", - "step": 100, + "value": "#ef59a33d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#ef59a3", + "value": "#ef59a3cc", "step": 400, "type": "color" } @@ -2412,12 +2412,12 @@ "type": "color" }, "selectionColor": { - "value": "#fce9b7", - "step": 100, + "value": "#f7bf173d", + "step": 400, "type": "color" }, "borderColor": { - "value": "#f7bf17", + "value": "#f7bf17cc", "step": 400, "type": "color" } diff --git a/styles/package-lock.json b/styles/package-lock.json index ade0a53052268990346f470de96522408fea5fd5..63bf3d5a574fb810605841c940ef2b0db445dab4 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -12,9 +12,7 @@ "@types/chroma-js": "^2.1.3", "@types/node": "^17.0.23", "case-anything": "^2.1.10", - "chroma-js": "^2.4.2" - }, - "devDependencies": { + "chroma-js": "^2.4.2", "nodemon": "^2.0.15", "ts-node": "^10.7.0" } @@ -23,7 +21,6 @@ "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, "engines": { "node": ">= 12" } @@ -32,7 +29,6 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, "dependencies": { "@cspotcode/source-map-consumer": "0.8.0" }, @@ -44,7 +40,6 @@ "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, "engines": { "node": ">=6" } @@ -53,7 +48,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, "dependencies": { "defer-to-connect": "^1.0.1" }, @@ -64,26 +58,22 @@ "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" }, "node_modules/@tsconfig/node12": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" }, "node_modules/@tsconfig/node14": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" }, "node_modules/@tsconfig/node16": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" }, "node_modules/@types/chroma-js": { "version": "2.1.3", @@ -98,14 +88,12 @@ "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "node_modules/acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -117,7 +105,6 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -126,7 +113,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, "dependencies": { "string-width": "^4.1.0" } @@ -135,7 +121,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "engines": { "node": ">=8" } @@ -144,7 +129,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -159,7 +143,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -171,20 +154,17 @@ "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, "engines": { "node": ">=8" } @@ -193,7 +173,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", @@ -215,7 +194,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -225,7 +203,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -237,7 +214,6 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, "dependencies": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", @@ -255,7 +231,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, "dependencies": { "pump": "^3.0.0" }, @@ -270,7 +245,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true, "engines": { "node": ">=8" } @@ -279,7 +253,6 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, "engines": { "node": ">=10" }, @@ -302,7 +275,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -318,7 +290,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -327,7 +298,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -339,7 +309,6 @@ "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, "funding": [ { "type": "individual", @@ -370,14 +339,12 @@ "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" }, "node_modules/cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true, "engines": { "node": ">=6" }, @@ -389,7 +356,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, "dependencies": { "mimic-response": "^1.0.0" } @@ -398,7 +364,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -409,20 +374,17 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "node_modules/configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, "dependencies": { "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", @@ -438,14 +400,12 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true, "engines": { "node": ">=8" } @@ -454,7 +414,6 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, "dependencies": { "ms": "^2.1.1" } @@ -463,7 +422,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, "dependencies": { "mimic-response": "^1.0.0" }, @@ -475,7 +433,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, "engines": { "node": ">=4.0.0" } @@ -483,14 +440,12 @@ "node_modules/defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, "engines": { "node": ">=0.3.1" } @@ -499,7 +454,6 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, "dependencies": { "is-obj": "^2.0.0" }, @@ -510,20 +464,17 @@ "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "dependencies": { "once": "^1.4.0" } @@ -532,7 +483,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true, "engines": { "node": ">=8" } @@ -541,7 +491,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -553,7 +502,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -567,7 +515,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, "dependencies": { "pump": "^3.0.0" }, @@ -579,7 +526,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -591,7 +537,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, "dependencies": { "ini": "2.0.0" }, @@ -606,7 +551,6 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, "dependencies": { "@sindresorhus/is": "^0.14.0", "@szmarczak/http-timer": "^1.1.2", @@ -627,14 +571,12 @@ "node_modules/graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, "engines": { "node": ">=4" } @@ -643,7 +585,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true, "engines": { "node": ">=8" } @@ -651,20 +592,17 @@ "node_modules/http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", - "dev": true + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=" }, "node_modules/import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true, "engines": { "node": ">=4" } @@ -673,7 +611,6 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true, "engines": { "node": ">=0.8.19" } @@ -682,7 +619,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, "engines": { "node": ">=10" } @@ -691,7 +627,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -703,7 +638,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, "dependencies": { "ci-info": "^2.0.0" }, @@ -715,7 +649,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -724,7 +657,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -733,7 +665,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -745,7 +676,6 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, "dependencies": { "global-dirs": "^3.0.0", "is-path-inside": "^3.0.2" @@ -761,7 +691,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true, "engines": { "node": ">=10" }, @@ -773,7 +702,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, "engines": { "node": ">=0.12.0" } @@ -782,7 +710,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, "engines": { "node": ">=8" } @@ -791,7 +718,6 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -799,26 +725,22 @@ "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "node_modules/is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, "dependencies": { "json-buffer": "3.0.0" } @@ -827,7 +749,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, "dependencies": { "package-json": "^6.3.0" }, @@ -839,7 +760,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -848,7 +768,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -860,7 +779,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, "dependencies": { "semver": "^6.0.0" }, @@ -875,7 +793,6 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, "bin": { "semver": "bin/semver.js" } @@ -883,14 +800,12 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, "node_modules/mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true, "engines": { "node": ">=4" } @@ -899,7 +814,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -910,20 +824,17 @@ "node_modules/minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/nodemon": { "version": "2.0.15", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", - "dev": true, "hasInstallScript": true, "dependencies": { "chokidar": "^3.5.2", @@ -952,7 +863,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "dev": true, "dependencies": { "abbrev": "1" }, @@ -967,7 +877,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -976,7 +885,6 @@ "version": "4.5.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true, "engines": { "node": ">=8" } @@ -985,7 +893,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "dependencies": { "wrappy": "1" } @@ -994,7 +901,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, "engines": { "node": ">=6" } @@ -1003,7 +909,6 @@ "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, "dependencies": { "got": "^9.6.0", "registry-auth-token": "^4.0.0", @@ -1018,7 +923,6 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, "bin": { "semver": "bin/semver.js" } @@ -1027,7 +931,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, "engines": { "node": ">=8.6" }, @@ -1039,7 +942,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, "engines": { "node": ">=4" } @@ -1047,14 +949,12 @@ "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -1064,7 +964,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, "dependencies": { "escape-goat": "^2.0.0" }, @@ -1076,7 +975,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -1090,14 +988,12 @@ "node_modules/rc/node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -1109,7 +1005,6 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, "dependencies": { "rc": "^1.2.8" }, @@ -1121,7 +1016,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, "dependencies": { "rc": "^1.2.8" }, @@ -1133,7 +1027,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, "dependencies": { "lowercase-keys": "^1.0.0" } @@ -1142,7 +1035,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, "bin": { "semver": "bin/semver" } @@ -1151,7 +1043,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, "dependencies": { "semver": "^6.3.0" }, @@ -1163,7 +1054,6 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, "bin": { "semver": "bin/semver.js" } @@ -1171,14 +1061,12 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -1192,7 +1080,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -1204,7 +1091,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -1213,7 +1099,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -1225,7 +1110,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, "engines": { "node": ">=6" } @@ -1234,7 +1118,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -1246,7 +1129,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, "dependencies": { "nopt": "~1.0.10" }, @@ -1258,7 +1140,6 @@ "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", @@ -1301,7 +1182,6 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, "engines": { "node": ">=10" }, @@ -1313,7 +1193,6 @@ "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, "dependencies": { "is-typedarray": "^1.0.0" } @@ -1322,7 +1201,6 @@ "version": "4.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "dev": true, "peer": true, "bin": { "tsc": "bin/tsc", @@ -1335,14 +1213,12 @@ "node_modules/undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" }, "node_modules/unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, "dependencies": { "crypto-random-string": "^2.0.0" }, @@ -1354,7 +1230,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, "dependencies": { "boxen": "^5.0.0", "chalk": "^4.1.0", @@ -1382,7 +1257,6 @@ "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -1397,7 +1271,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, "dependencies": { "prepend-http": "^2.0.0" }, @@ -1408,14 +1281,12 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" }, "node_modules/widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, "dependencies": { "string-width": "^4.0.0" }, @@ -1427,7 +1298,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -1443,14 +1313,12 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", @@ -1462,7 +1330,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, "engines": { "node": ">=8" } @@ -1470,14 +1337,12 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, "engines": { "node": ">=6" } @@ -1487,14 +1352,12 @@ "@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" }, "@cspotcode/source-map-support": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, "requires": { "@cspotcode/source-map-consumer": "0.8.0" } @@ -1502,14 +1365,12 @@ "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" }, "@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, "requires": { "defer-to-connect": "^1.0.1" } @@ -1517,26 +1378,22 @@ "@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" }, "@tsconfig/node12": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" }, "@tsconfig/node14": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" }, "@tsconfig/node16": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" }, "@types/chroma-js": { "version": "2.1.3", @@ -1551,26 +1408,22 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "acorn": { "version": "8.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" }, "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" }, "ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, "requires": { "string-width": "^4.1.0" } @@ -1578,14 +1431,12 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -1594,7 +1445,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, "requires": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -1603,26 +1453,22 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, "boxen": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, "requires": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", @@ -1638,7 +1484,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1648,7 +1493,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -1657,7 +1501,6 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, "requires": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", @@ -1672,7 +1515,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, "requires": { "pump": "^3.0.0" } @@ -1680,16 +1522,14 @@ "lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" } } }, "camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==" }, "case-anything": { "version": "2.1.10", @@ -1700,7 +1540,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1709,14 +1548,12 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -1727,7 +1564,6 @@ "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, "requires": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -1747,20 +1583,17 @@ "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" }, "cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==" }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, "requires": { "mimic-response": "^1.0.0" } @@ -1769,7 +1602,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "requires": { "color-name": "~1.1.4" } @@ -1777,20 +1609,17 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, "requires": { "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", @@ -1803,20 +1632,17 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, "crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==" }, "debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -1825,7 +1651,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, "requires": { "mimic-response": "^1.0.0" } @@ -1833,26 +1658,22 @@ "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, "defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, "requires": { "is-obj": "^2.0.0" } @@ -1860,20 +1681,17 @@ "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -1881,14 +1699,12 @@ "escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==" }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -1897,14 +1713,12 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "optional": true }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, "requires": { "pump": "^3.0.0" } @@ -1913,7 +1727,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -1922,7 +1735,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, "requires": { "ini": "2.0.0" } @@ -1931,7 +1743,6 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, "requires": { "@sindresorhus/is": "^0.14.0", "@szmarczak/http-timer": "^1.1.2", @@ -1949,56 +1760,47 @@ "graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", - "dev": true + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==" }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", - "dev": true + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=" }, "import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=" }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, "ini": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==" }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, "requires": { "binary-extensions": "^2.0.0" } @@ -2007,7 +1809,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, "requires": { "ci-info": "^2.0.0" } @@ -2015,20 +1816,17 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -2037,7 +1835,6 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, "requires": { "global-dirs": "^3.0.0", "is-path-inside": "^3.0.2" @@ -2046,50 +1843,42 @@ "is-npm": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==" }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, "is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" }, "is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, "requires": { "json-buffer": "3.0.0" } @@ -2098,7 +1887,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, "requires": { "package-json": "^6.3.0" } @@ -2106,14 +1894,12 @@ "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "requires": { "yallist": "^4.0.0" } @@ -2122,7 +1908,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, "requires": { "semver": "^6.0.0" }, @@ -2130,28 +1915,24 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2159,20 +1940,17 @@ "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "nodemon": { "version": "2.0.15", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz", "integrity": "sha512-gdHMNx47Gw7b3kWxJV64NI+Q5nfl0y5DgDbiVtShiwa7Z0IZ07Ll4RLFo6AjrhzMtoEZn5PDE3/c2AbVsiCkpA==", - "dev": true, "requires": { "chokidar": "^3.5.2", "debug": "^3.2.7", @@ -2190,7 +1968,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "dev": true, "requires": { "abbrev": "1" } @@ -2198,20 +1975,17 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, "normalize-url": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -2219,14 +1993,12 @@ "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" }, "package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, "requires": { "got": "^9.6.0", "registry-auth-token": "^4.0.0", @@ -2237,34 +2009,29 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, "pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -2274,7 +2041,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, "requires": { "escape-goat": "^2.0.0" } @@ -2283,7 +2049,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, "requires": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -2294,8 +2059,7 @@ "ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" } } }, @@ -2303,7 +2067,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, "requires": { "picomatch": "^2.2.1" } @@ -2312,7 +2075,6 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, "requires": { "rc": "^1.2.8" } @@ -2321,7 +2083,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, "requires": { "rc": "^1.2.8" } @@ -2330,7 +2091,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, "requires": { "lowercase-keys": "^1.0.0" } @@ -2338,14 +2098,12 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" }, "semver-diff": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, "requires": { "semver": "^6.3.0" }, @@ -2353,22 +2111,19 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2379,7 +2134,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "requires": { "ansi-regex": "^5.0.1" } @@ -2387,14 +2141,12 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -2402,14 +2154,12 @@ "to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "requires": { "is-number": "^7.0.0" } @@ -2418,7 +2168,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, "requires": { "nopt": "~1.0.10" } @@ -2427,7 +2176,6 @@ "version": "10.7.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, "requires": { "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", @@ -2447,14 +2195,12 @@ "type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, "requires": { "is-typedarray": "^1.0.0" } @@ -2463,20 +2209,17 @@ "version": "4.6.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "dev": true, "peer": true }, "undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" }, "unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, "requires": { "crypto-random-string": "^2.0.0" } @@ -2485,7 +2228,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, "requires": { "boxen": "^5.0.0", "chalk": "^4.1.0", @@ -2507,7 +2249,6 @@ "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, "requires": { "lru-cache": "^6.0.0" } @@ -2518,7 +2259,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, "requires": { "prepend-http": "^2.0.0" } @@ -2526,14 +2266,12 @@ "v8-compile-cache-lib": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==" }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, "requires": { "string-width": "^4.0.0" } @@ -2542,7 +2280,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -2552,14 +2289,12 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, "requires": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", @@ -2570,20 +2305,17 @@ "xdg-basedir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==" }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" } } } diff --git a/styles/package.json b/styles/package.json index e11cb6108499c2ca4c4383caad9551f3ab98f581..727300e2cce7c5a2db01696a968cf32ba7f0f41b 100644 --- a/styles/package.json +++ b/styles/package.json @@ -4,8 +4,9 @@ "description": "", "main": "index.js", "scripts": { + "build": "npm run build-themes && npm run build-tokens", "build-themes": "ts-node ./src/buildThemes.ts", - "build-figma": "ts-node ./src/buildFigmaTokens.ts", + "build-tokens": "ts-node ./src/buildTokens.ts", "watch": "nodemon" }, "author": "", diff --git a/styles/src/buildThemes.ts b/styles/src/buildThemes.ts index 8772b5fee2926739d6f6bb809ef3b7b3fc67fe7f..42770c1c89194749e4619b75a1aa4886dad549b7 100644 --- a/styles/src/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -13,5 +13,5 @@ for (let theme of themes) { `${__dirname}/../../crates/zed/assets/themes/${theme.name}.json` ); fs.writeFileSync(outPath, styleTreeJSON); - console.log(`Generated ${outPath}`); + console.log(`- ${outPath} created`); } diff --git a/styles/src/buildFigmaTokens.ts b/styles/src/buildTokens.ts similarity index 68% rename from styles/src/buildFigmaTokens.ts rename to styles/src/buildTokens.ts index 70704088a43f8cdf583f4995b56ad43e1c852fb4..4cad6827a2876498b230fb6676adf2055e00715c 100644 --- a/styles/src/buildFigmaTokens.ts +++ b/styles/src/buildTokens.ts @@ -83,28 +83,28 @@ const coreTokens = { size: fontSizes, }; -const combinedTokens: any = { - core: coreTokens, -} +const combinedTokens: any = {}; + +const distPath = path.resolve(`${__dirname}/../dist`); -// Create core.json -const corePath = path.resolve(`${__dirname}/../dist/figma/core.json`); -const coreJSON = JSON.stringify(coreTokens, null, 2); -fs.writeFileSync(corePath, coreJSON); -console.log(`- Core: core.json created`); +// Add core tokens to the combined tokens and write `core.json`. +// We write `core.json` as a separate file for the design team's convenience, but it isn't consumed by Figma Tokens directly. +const corePath = path.join(distPath, "core.json"); +fs.writeFileSync(corePath, JSON.stringify(coreTokens, null, 2)); +console.log(`- ${corePath} created`); +combinedTokens.core = coreTokens; -// Create {theme}.json +// Add each theme to the combined tokens and write ${theme}.json. +// We write `${theme}.json` as a separate file for the design team's convenience, but it isn't consumed by Figma Tokens directly. let themes = [dark, light]; -const themePath = path.resolve(`${__dirname}/figma`); themes.forEach((theme) => { - const tokenJSON = JSON.stringify(themeTokens(theme), null, 2); - fs.writeFileSync(`${themePath}/${theme.name}.json`, tokenJSON); - console.log(`- Theme: ${theme.name}.json created`); + const themePath = `${distPath}/${theme.name}.json` + fs.writeFileSync(themePath, JSON.stringify(themeTokens(theme), null, 2)); + console.log(`- ${themePath} created`); combinedTokens[theme.name] = themeTokens(theme); }); -// Create combined tokens.json -const combinedPath = path.resolve(`${__dirname}/figma/tokens.json`); -const combinedJSON = JSON.stringify(combinedTokens, null, 2); -fs.writeFileSync(combinedPath, combinedJSON); -console.log(`- Combined: tokens.json created`); \ No newline at end of file +// Write combined tokens to `tokens.json`. This file is consumed by the Figma Tokens plugin to keep our designs consistent with the app. +const combinedPath = path.resolve(`${distPath}/tokens.json`); +fs.writeFileSync(combinedPath, JSON.stringify(combinedTokens, null, 2)); +console.log(`- ${combinedPath} created`); diff --git a/styles/src/figma/core.json b/styles/src/figma/core.json deleted file mode 100644 index b3e13f1c7a9f4e048bf7065278ebc1527c4a11cc..0000000000000000000000000000000000000000 --- a/styles/src/figma/core.json +++ /dev/null @@ -1,1155 +0,0 @@ -{ - "color": { - "neutral": { - "0": { - "value": "#ffffff", - "step": 0, - "type": "color" - }, - "25": { - "value": "#f8f8f8", - "step": 25, - "type": "color" - }, - "50": { - "value": "#f1f1f1", - "step": 50, - "type": "color" - }, - "75": { - "value": "#eaeaea", - "step": 75, - "type": "color" - }, - "100": { - "value": "#e3e3e3", - "step": 100, - "type": "color" - }, - "125": { - "value": "#dcdcdc", - "step": 125, - "type": "color" - }, - "150": { - "value": "#d5d5d5", - "step": 150, - "type": "color" - }, - "175": { - "value": "#cdcdcd", - "step": 175, - "type": "color" - }, - "200": { - "value": "#c6c6c6", - "step": 200, - "type": "color" - }, - "225": { - "value": "#bfbfbf", - "step": 225, - "type": "color" - }, - "250": { - "value": "#b8b8b8", - "step": 250, - "type": "color" - }, - "275": { - "value": "#b1b1b1", - "step": 275, - "type": "color" - }, - "300": { - "value": "#aaaaaa", - "step": 300, - "type": "color" - }, - "325": { - "value": "#a3a3a3", - "step": 325, - "type": "color" - }, - "350": { - "value": "#9c9c9c", - "step": 350, - "type": "color" - }, - "375": { - "value": "#959595", - "step": 375, - "type": "color" - }, - "400": { - "value": "#8e8e8e", - "step": 400, - "type": "color" - }, - "425": { - "value": "#878787", - "step": 425, - "type": "color" - }, - "450": { - "value": "#808080", - "step": 450, - "type": "color" - }, - "475": { - "value": "#787878", - "step": 475, - "type": "color" - }, - "500": { - "value": "#717171", - "step": 500, - "type": "color" - }, - "525": { - "value": "#6a6a6a", - "step": 525, - "type": "color" - }, - "550": { - "value": "#636363", - "step": 550, - "type": "color" - }, - "575": { - "value": "#5c5c5c", - "step": 575, - "type": "color" - }, - "600": { - "value": "#555555", - "step": 600, - "type": "color" - }, - "625": { - "value": "#4e4e4e", - "step": 625, - "type": "color" - }, - "650": { - "value": "#474747", - "step": 650, - "type": "color" - }, - "675": { - "value": "#404040", - "step": 675, - "type": "color" - }, - "700": { - "value": "#393939", - "step": 700, - "type": "color" - }, - "725": { - "value": "#323232", - "step": 725, - "type": "color" - }, - "750": { - "value": "#2b2b2b", - "step": 750, - "type": "color" - }, - "775": { - "value": "#232323", - "step": 775, - "type": "color" - }, - "800": { - "value": "#1c1c1c", - "step": 800, - "type": "color" - }, - "825": { - "value": "#151515", - "step": 825, - "type": "color" - }, - "850": { - "value": "#0e0e0e", - "step": 850, - "type": "color" - }, - "875": { - "value": "#070707", - "step": 875, - "type": "color" - }, - "900": { - "value": "#000000", - "step": 900, - "type": "color" - } - }, - "rose": { - "0": { - "value": "#feecef", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fdd5db", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fbbdc8", - "step": 200, - "type": "color" - }, - "300": { - "value": "#faa4b3", - "step": 300, - "type": "color" - }, - "400": { - "value": "#f98a9d", - "step": 400, - "type": "color" - }, - "500": { - "value": "#f76e86", - "step": 500, - "type": "color" - }, - "600": { - "value": "#f54c69", - "step": 600, - "type": "color" - }, - "700": { - "value": "#ec2548", - "step": 700, - "type": "color" - }, - "800": { - "value": "#d21939", - "step": 800, - "type": "color" - }, - "900": { - "value": "#b41a35", - "step": 900, - "type": "color" - } - }, - "red": { - "0": { - "value": "#feecec", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fdd4d4", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fbbdbd", - "step": 200, - "type": "color" - }, - "300": { - "value": "#f9a5a5", - "step": 300, - "type": "color" - }, - "400": { - "value": "#f78c8c", - "step": 400, - "type": "color" - }, - "500": { - "value": "#f47171", - "step": 500, - "type": "color" - }, - "600": { - "value": "#f15252", - "step": 600, - "type": "color" - }, - "700": { - "value": "#e82c2c", - "step": 700, - "type": "color" - }, - "800": { - "value": "#d11c1c", - "step": 800, - "type": "color" - }, - "900": { - "value": "#b21c1c", - "step": 900, - "type": "color" - } - }, - "orange": { - "0": { - "value": "#fef3ec", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fde0cd", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fbccac", - "step": 200, - "type": "color" - }, - "300": { - "value": "#fab78b", - "step": 300, - "type": "color" - }, - "400": { - "value": "#faa266", - "step": 400, - "type": "color" - }, - "500": { - "value": "#f98a3d", - "step": 500, - "type": "color" - }, - "600": { - "value": "#f77113", - "step": 600, - "type": "color" - }, - "700": { - "value": "#e0650f", - "step": 700, - "type": "color" - }, - "800": { - "value": "#c65d14", - "step": 800, - "type": "color" - }, - "900": { - "value": "#ac5517", - "step": 900, - "type": "color" - } - }, - "amber": { - "0": { - "value": "#fef7ec", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fce7c4", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fad69d", - "step": 200, - "type": "color" - }, - "300": { - "value": "#f8c570", - "step": 300, - "type": "color" - }, - "400": { - "value": "#f7b241", - "step": 400, - "type": "color" - }, - "500": { - "value": "#f59f0c", - "step": 500, - "type": "color" - }, - "600": { - "value": "#e1930e", - "step": 600, - "type": "color" - }, - "700": { - "value": "#cd8812", - "step": 700, - "type": "color" - }, - "800": { - "value": "#ba7d15", - "step": 800, - "type": "color" - }, - "900": { - "value": "#a77218", - "step": 900, - "type": "color" - } - }, - "yellow": { - "0": { - "value": "#fef9ec", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fceabc", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fadc89", - "step": 200, - "type": "color" - }, - "300": { - "value": "#f8cc4e", - "step": 300, - "type": "color" - }, - "400": { - "value": "#f6bc09", - "step": 400, - "type": "color" - }, - "500": { - "value": "#e5af09", - "step": 500, - "type": "color" - }, - "600": { - "value": "#d4a30d", - "step": 600, - "type": "color" - }, - "700": { - "value": "#c49811", - "step": 700, - "type": "color" - }, - "800": { - "value": "#b48d14", - "step": 800, - "type": "color" - }, - "900": { - "value": "#a48117", - "step": 900, - "type": "color" - } - }, - "lime": { - "0": { - "value": "#f7feec", - "step": 0, - "type": "color" - }, - "100": { - "value": "#dbf9ac", - "step": 100, - "type": "color" - }, - "200": { - "value": "#bdf36b", - "step": 200, - "type": "color" - }, - "300": { - "value": "#9feb2b", - "step": 300, - "type": "color" - }, - "400": { - "value": "#90df17", - "step": 400, - "type": "color" - }, - "500": { - "value": "#87d116", - "step": 500, - "type": "color" - }, - "600": { - "value": "#7fc417", - "step": 600, - "type": "color" - }, - "700": { - "value": "#78b618", - "step": 700, - "type": "color" - }, - "800": { - "value": "#70aa19", - "step": 800, - "type": "color" - }, - "900": { - "value": "#699c1a", - "step": 900, - "type": "color" - } - }, - "green": { - "0": { - "value": "#ecfef2", - "step": 0, - "type": "color" - }, - "100": { - "value": "#befad2", - "step": 100, - "type": "color" - }, - "200": { - "value": "#8ff4b2", - "step": 200, - "type": "color" - }, - "300": { - "value": "#60ec92", - "step": 300, - "type": "color" - }, - "400": { - "value": "#34e173", - "step": 400, - "type": "color" - }, - "500": { - "value": "#23d464", - "step": 500, - "type": "color" - }, - "600": { - "value": "#22c55e", - "step": 600, - "type": "color" - }, - "700": { - "value": "#20b658", - "step": 700, - "type": "color" - }, - "800": { - "value": "#1ea851", - "step": 800, - "type": "color" - }, - "900": { - "value": "#1d9b4b", - "step": 900, - "type": "color" - } - }, - "emerald": { - "0": { - "value": "#ecfef8", - "step": 0, - "type": "color" - }, - "100": { - "value": "#b3fbe3", - "step": 100, - "type": "color" - }, - "200": { - "value": "#72f6ca", - "step": 200, - "type": "color" - }, - "300": { - "value": "#1feda9", - "step": 300, - "type": "color" - }, - "400": { - "value": "#12e09b", - "step": 400, - "type": "color" - }, - "500": { - "value": "#11d091", - "step": 500, - "type": "color" - }, - "600": { - "value": "#11c287", - "step": 600, - "type": "color" - }, - "700": { - "value": "#11b37e", - "step": 700, - "type": "color" - }, - "800": { - "value": "#15a575", - "step": 800, - "type": "color" - }, - "900": { - "value": "#18976c", - "step": 900, - "type": "color" - } - }, - "teal": { - "0": { - "value": "#ecfefc", - "step": 0, - "type": "color" - }, - "100": { - "value": "#b4faf2", - "step": 100, - "type": "color" - }, - "200": { - "value": "#73f4e6", - "step": 200, - "type": "color" - }, - "300": { - "value": "#26ebd5", - "step": 300, - "type": "color" - }, - "400": { - "value": "#16ddc7", - "step": 400, - "type": "color" - }, - "500": { - "value": "#15cfba", - "step": 500, - "type": "color" - }, - "600": { - "value": "#15c1ae", - "step": 600, - "type": "color" - }, - "700": { - "value": "#15b2a1", - "step": 700, - "type": "color" - }, - "800": { - "value": "#17a495", - "step": 800, - "type": "color" - }, - "900": { - "value": "#199788", - "step": 900, - "type": "color" - } - }, - "cyan": { - "0": { - "value": "#ecfcfe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#bcf5fc", - "step": 100, - "type": "color" - }, - "200": { - "value": "#86edfa", - "step": 200, - "type": "color" - }, - "300": { - "value": "#41e3f8", - "step": 300, - "type": "color" - }, - "400": { - "value": "#07d5f1", - "step": 400, - "type": "color" - }, - "500": { - "value": "#07c7e1", - "step": 500, - "type": "color" - }, - "600": { - "value": "#07b8d0", - "step": 600, - "type": "color" - }, - "700": { - "value": "#0daabf", - "step": 700, - "type": "color" - }, - "800": { - "value": "#119bae", - "step": 800, - "type": "color" - }, - "900": { - "value": "#168e9e", - "step": 900, - "type": "color" - } - }, - "sky": { - "0": { - "value": "#ecf8fe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#caecfc", - "step": 100, - "type": "color" - }, - "200": { - "value": "#a6defa", - "step": 200, - "type": "color" - }, - "300": { - "value": "#81d2f8", - "step": 300, - "type": "color" - }, - "400": { - "value": "#59c3f5", - "step": 400, - "type": "color" - }, - "500": { - "value": "#2db4f3", - "step": 500, - "type": "color" - }, - "600": { - "value": "#0ea5e8", - "step": 600, - "type": "color" - }, - "700": { - "value": "#1296d1", - "step": 700, - "type": "color" - }, - "800": { - "value": "#1686ba", - "step": 800, - "type": "color" - }, - "900": { - "value": "#1878a4", - "step": 900, - "type": "color" - } - }, - "blue": { - "0": { - "value": "#ecf3fe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#d0e2fd", - "step": 100, - "type": "color" - }, - "200": { - "value": "#b4cffb", - "step": 200, - "type": "color" - }, - "300": { - "value": "#99befa", - "step": 300, - "type": "color" - }, - "400": { - "value": "#7cacf9", - "step": 400, - "type": "color" - }, - "500": { - "value": "#6099f7", - "step": 500, - "type": "color" - }, - "600": { - "value": "#4287f6", - "step": 600, - "type": "color" - }, - "700": { - "value": "#2774f0", - "step": 700, - "type": "color" - }, - "800": { - "value": "#1762db", - "step": 800, - "type": "color" - }, - "900": { - "value": "#1a55b4", - "step": 900, - "type": "color" - } - }, - "indigo": { - "0": { - "value": "#ececfe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#d4d5fd", - "step": 100, - "type": "color" - }, - "200": { - "value": "#bebefb", - "step": 200, - "type": "color" - }, - "300": { - "value": "#a7a8f9", - "step": 300, - "type": "color" - }, - "400": { - "value": "#8f90f6", - "step": 400, - "type": "color" - }, - "500": { - "value": "#777af4", - "step": 500, - "type": "color" - }, - "600": { - "value": "#5f62f0", - "step": 600, - "type": "color" - }, - "700": { - "value": "#464aeb", - "step": 700, - "type": "color" - }, - "800": { - "value": "#292de4", - "step": 800, - "type": "color" - }, - "900": { - "value": "#1d20bb", - "step": 900, - "type": "color" - } - }, - "violet": { - "0": { - "value": "#f1ecfe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#e0d5fd", - "step": 100, - "type": "color" - }, - "200": { - "value": "#cfbcfb", - "step": 200, - "type": "color" - }, - "300": { - "value": "#bda4fa", - "step": 300, - "type": "color" - }, - "400": { - "value": "#ad8cf9", - "step": 400, - "type": "color" - }, - "500": { - "value": "#9b73f7", - "step": 500, - "type": "color" - }, - "600": { - "value": "#8959f6", - "step": 600, - "type": "color" - }, - "700": { - "value": "#7540f0", - "step": 700, - "type": "color" - }, - "800": { - "value": "#5e22e7", - "step": 800, - "type": "color" - }, - "900": { - "value": "#4c1bbc", - "step": 900, - "type": "color" - } - }, - "purple": { - "0": { - "value": "#f5ecfe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#e9d4fd", - "step": 100, - "type": "color" - }, - "200": { - "value": "#dcbcfc", - "step": 200, - "type": "color" - }, - "300": { - "value": "#d0a4fa", - "step": 300, - "type": "color" - }, - "400": { - "value": "#c38bf9", - "step": 400, - "type": "color" - }, - "500": { - "value": "#b671f8", - "step": 500, - "type": "color" - }, - "600": { - "value": "#a856f7", - "step": 600, - "type": "color" - }, - "700": { - "value": "#9739f1", - "step": 700, - "type": "color" - }, - "800": { - "value": "#831ae6", - "step": 800, - "type": "color" - }, - "900": { - "value": "#6d1bbb", - "step": 900, - "type": "color" - } - }, - "fuschia": { - "0": { - "value": "#fdecfe", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fad4fc", - "step": 100, - "type": "color" - }, - "200": { - "value": "#f6bbfa", - "step": 200, - "type": "color" - }, - "300": { - "value": "#f1a2f7", - "step": 300, - "type": "color" - }, - "400": { - "value": "#ec8af3", - "step": 400, - "type": "color" - }, - "500": { - "value": "#e56fee", - "step": 500, - "type": "color" - }, - "600": { - "value": "#dd51e7", - "step": 600, - "type": "color" - }, - "700": { - "value": "#d32edf", - "step": 700, - "type": "color" - }, - "800": { - "value": "#bc21c8", - "step": 800, - "type": "color" - }, - "900": { - "value": "#a41ead", - "step": 900, - "type": "color" - } - }, - "pink": { - "0": { - "value": "#feecf5", - "step": 0, - "type": "color" - }, - "100": { - "value": "#fcd4e8", - "step": 100, - "type": "color" - }, - "200": { - "value": "#fbbcdb", - "step": 200, - "type": "color" - }, - "300": { - "value": "#f8a5ce", - "step": 300, - "type": "color" - }, - "400": { - "value": "#f58ac0", - "step": 400, - "type": "color" - }, - "500": { - "value": "#f26fb0", - "step": 500, - "type": "color" - }, - "600": { - "value": "#ee519e", - "step": 600, - "type": "color" - }, - "700": { - "value": "#e52e89", - "step": 700, - "type": "color" - }, - "800": { - "value": "#ce1e76", - "step": 800, - "type": "color" - }, - "900": { - "value": "#b21d67", - "step": 900, - "type": "color" - } - } - }, - "text": { - "family": { - "sans": { - "value": "Zed Sans", - "type": "fontFamily" - }, - "mono": { - "value": "Zed Mono", - "type": "fontFamily" - } - }, - "weight": { - "thin": { - "value": "thin", - "type": "fontWeight" - }, - "extra_light": { - "value": "extra_light", - "type": "fontWeight" - }, - "light": { - "value": "light", - "type": "fontWeight" - }, - "normal": { - "value": "normal", - "type": "fontWeight" - }, - "medium": { - "value": "medium", - "type": "fontWeight" - }, - "semibold": { - "value": "semibold", - "type": "fontWeight" - }, - "bold": { - "value": "bold", - "type": "fontWeight" - }, - "extra_bold": { - "value": "extra_bold", - "type": "fontWeight" - }, - "black": { - "value": "black", - "type": "fontWeight" - } - } - }, - "size": { - "3xs": { - "value": 8, - "type": "fontSize" - }, - "2xs": { - "value": 10, - "type": "fontSize" - }, - "xs": { - "value": 12, - "type": "fontSize" - }, - "sm": { - "value": 14, - "type": "fontSize" - }, - "md": { - "value": 16, - "type": "fontSize" - }, - "lg": { - "value": 18, - "type": "fontSize" - }, - "xl": { - "value": 20, - "type": "fontSize" - } - } -} \ No newline at end of file From c289cdcac816c9b803fbdf458b0b2b92751ae38f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 6 Apr 2022 09:28:56 -0600 Subject: [PATCH 088/245] =?UTF-8?q?=F0=9F=92=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/nodemon.json | 2 +- styles/src/styleTree/contactsPanel.ts | 2 +- styles/tsconfig.json | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/styles/nodemon.json b/styles/nodemon.json index ae631a5ec4931af8173529733ab1fb6973651aad..47facd6322c80a79b87fe9320e4a71cc0bf275f9 100644 --- a/styles/nodemon.json +++ b/styles/nodemon.json @@ -5,4 +5,4 @@ "ext": "ts", "ignore": [], "exec": "ts-node src/buildThemes.ts" -} \ No newline at end of file +} diff --git a/styles/src/styleTree/contactsPanel.ts b/styles/src/styleTree/contactsPanel.ts index 6d432756472251de0cfa52a1e4176bea22af88aa..0939018126f87486a1f5f3197be12452ef17fa9b 100644 --- a/styles/src/styleTree/contactsPanel.ts +++ b/styles/src/styleTree/contactsPanel.ts @@ -59,4 +59,4 @@ export default function(theme: Theme) { cornerRadius: 6, }, } -} \ No newline at end of file +} diff --git a/styles/tsconfig.json b/styles/tsconfig.json index 3dfbcc715ef17318d9267709bb8f25a8b91ecac0..fa3e3062c95377568dce90b6e83eaba11faebf2d 100644 --- a/styles/tsconfig.json +++ b/styles/tsconfig.json @@ -1,12 +1,14 @@ { "compilerOptions": { - "target": "es2015", - "module": "commonjs", - "esModuleInterop": true, - "noImplicitAny": true, - "removeComments": true, - "preserveConstEnums": true, - "sourceMap": true + "target": "es2015", + "module": "commonjs", + "esModuleInterop": true, + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": true }, - "exclude": ["node_modules"] - } \ No newline at end of file + "exclude": [ + "node_modules" + ] +} From ca64b081fe1bfdd5857ce35b7d3bd11d688af934 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 6 Apr 2022 09:33:47 -0600 Subject: [PATCH 089/245] Don't assume there are always matches in outline view --- crates/outline/src/outline.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index c33cb60b3e36456c9557536ed77ea166bb5dd668..2b7d157d99d8c297ceef05bd3c47773b5db00939 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -276,8 +276,8 @@ impl OutlineView { (ix, depth, distance_to_closest_endpoint) }) .max_by_key(|(_, depth, distance)| (*depth, Reverse(*distance))) - .unwrap() - .0; + .map(|(ix, _, _)| ix) + .unwrap_or(0); navigate_to_selected_index = false; } else { self.matches = smol::block_on(self.outline.search(&query, cx.background().clone())); From d3cfd1c97407a10189b1bc80514620e1095738ed Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Apr 2022 12:14:05 -0400 Subject: [PATCH 090/245] Use standard text sizes for signInPrompt --- styles/src/styleTree/workspace.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 3a585458c3dd42c999924711d12479b5877f81ca..9e35052abf33f7a638de41bd80d7456db3f1eda3 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -3,8 +3,7 @@ import { backgroundColor, border, iconColor, text } from "./components"; export default function workspace(theme: Theme) { const signInPrompt = { - ...text(theme, "sans", "secondary"), - size: 13, + ...text(theme, "sans", "secondary", { size: "xs" }), underline: true, padding: { right: 8, @@ -117,8 +116,7 @@ export default function workspace(theme: Theme) { signInPrompt, hoveredSignInPrompt: { ...signInPrompt, - ...text(theme, "sans", "active"), - size: 13, + ...text(theme, "sans", "active", { size: "xs" }), }, offlineIcon: { color: iconColor(theme, "secondary"), From e584e892f4b1f88e604cfd94966efe2a0ffcd603 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Apr 2022 12:25:02 -0400 Subject: [PATCH 091/245] Update light theme --- styles/src/themes/light.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index 2fded3ed9074b259c7aebe350beb9722f75353cc..434760b30440eed17135d3944b79ddea49304f72 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -65,7 +65,7 @@ const textColor = { muted: colors.neutral[550], placeholder: colors.neutral[450], active: colors.neutral[900], - feature: colors.indigo[500], + feature: colors.indigo[600], ok: colors.green[500], error: colors.red[500], warning: colors.yellow[500], @@ -96,7 +96,6 @@ const player = { 8: buildPlayer(colors.yellow[400]), }; -// TODO: Fixup const editor = { background: backgroundColor[500].base, indent_guide: borderColor.muted, @@ -111,10 +110,10 @@ const editor = { highlight: { selection: player[1].selectionColor, occurrence: withOpacity(colors.neutral[900], 0.06), - activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side + activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not hooked up to occurences on the rust side matchingBracket: colors.neutral[0], match: withOpacity(colors.red[500], 0.2), - activeMatch: withOpacity(colors.indigo[400], 0.36), + activeMatch: withOpacity(colors.indigo[400], 0.36), // TODO: This is not hooked up to occurences on the rust side related: colors.neutral[0], }, gutter: { @@ -145,19 +144,19 @@ const syntax: Syntax = { weight: fontWeights.normal, }, function: { - color: colors.orange[400], + color: colors.orange[600], weight: fontWeights.normal, }, type: { - color: colors.amber[500], + color: colors.yellow[600], weight: fontWeights.normal, }, variant: { - color: colors.sky[500], + color: colors.rose[700], weight: fontWeights.normal, }, property: { - color: colors.emerald[600], + color: colors.emerald[700], weight: fontWeights.normal, }, enum: { From b1eda1ac39fad5a1eeab3ec7649bbe411f1d1c32 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 6 Apr 2022 12:25:15 -0400 Subject: [PATCH 092/245] Add border to top of status bar --- crates/zed/assets/themes/dark.json | 10 ++++++++-- crates/zed/assets/themes/light.json | 28 +++++++++++++++++----------- styles/src/styleTree/workspace.ts | 3 ++- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/crates/zed/assets/themes/dark.json b/crates/zed/assets/themes/dark.json index 56cef126935c71bce58e96c463a8e6be642e22c0..ccd6ef82e0c477cd6f7d34dbe3ac67ab807c9187 100644 --- a/crates/zed/assets/themes/dark.json +++ b/crates/zed/assets/themes/dark.json @@ -219,6 +219,12 @@ "left": 6, "right": 6 }, + "border": { + "color": "#070707", + "width": 1, + "top": true, + "overlay": true + }, "cursor_position": { "family": "Zed Sans", "color": "#808080", @@ -265,7 +271,7 @@ "sign_in_prompt": { "family": "Zed Sans", "color": "#9c9c9c", - "size": 13, + "size": 12, "underline": true, "padding": { "right": 8 @@ -274,7 +280,7 @@ "hovered_sign_in_prompt": { "family": "Zed Sans", "color": "#ffffff", - "size": 13, + "size": 12, "underline": true, "padding": { "right": 8 diff --git a/crates/zed/assets/themes/light.json b/crates/zed/assets/themes/light.json index d601ecbcccdf6a43d964845314e75fc703617101..7d963a883970858aee73fb84d377b86de3587cf5 100644 --- a/crates/zed/assets/themes/light.json +++ b/crates/zed/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#484bed", + "color": "#1b1edc", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#484bed", + "color": "#1b1edc", "weight": "bold", "size": 14 }, @@ -219,6 +219,12 @@ "left": 6, "right": 6 }, + "border": { + "color": "#d5d5d5", + "width": 1, + "top": true, + "overlay": true + }, "cursor_position": { "family": "Zed Sans", "color": "#636363", @@ -265,7 +271,7 @@ "sign_in_prompt": { "family": "Zed Sans", "color": "#474747", - "size": 13, + "size": 12, "underline": true, "padding": { "right": 8 @@ -274,7 +280,7 @@ "hovered_sign_in_prompt": { "family": "Zed Sans", "color": "#000000", - "size": 13, + "size": 12, "underline": true, "padding": { "right": 8 @@ -407,7 +413,7 @@ }, "match_highlight": { "family": "Zed Mono", - "color": "#484bed", + "color": "#1b1edc", "size": 14 }, "selected_item": { @@ -656,21 +662,21 @@ }, "syntax": { "keyword": "#1819a1", - "function": "#f9812e", + "function": "#bb550e", "string": "#eb2d2d", - "type": "#de900c", + "type": "#a8820e", "number": "#484bed", "comment": "#717171", - "property": "#118a62", - "variant": "#1096d3", + "property": "#106c4e", + "variant": "#97142a", "constant": "#1c1c1c", "title": { "color": "#1096d3", "weight": "bold" }, - "emphasis": "#484bed", + "emphasis": "#1b1edc", "emphasis_strong": { - "color": "#484bed", + "color": "#1b1edc", "weight": "bold" }, "link_uri": { diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 9e35052abf33f7a638de41bd80d7456db3f1eda3..42cd5b20d5cddc43d978390226c28cb6d4e82a0f 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -1,5 +1,5 @@ import Theme from "../themes/theme"; -import { backgroundColor, border, iconColor, text } from "./components"; +import { backgroundColor, border, borderColor, iconColor, text } from "./components"; export default function workspace(theme: Theme) { const signInPrompt = { @@ -88,6 +88,7 @@ export default function workspace(theme: Theme) { left: 6, right: 6, }, + border: border(theme, "primary", { top: true, overlay: true }), cursorPosition: text(theme, "sans", "muted"), diagnosticMessage: text(theme, "sans", "muted"), lspMessage: text(theme, "sans", "muted"), From 0214bec7f483f46e0de3707f925936336d48ed64 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 6 Apr 2022 10:59:03 -0600 Subject: [PATCH 093/245] Don't dispatch events to flex children outside of parent flex's bounds --- crates/gpui/src/elements/flex.rs | 6 ++++++ crates/gpui/src/platform/event.rs | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index f7d60e409bd3581bcb1c4bd85e2106650be3641f..1ae9c591c89c1b5de838b18612696e4a9e6990cb 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -270,6 +270,12 @@ impl Element for Flex { _: &mut Self::PaintState, cx: &mut EventContext, ) -> bool { + if let Some(position) = event.position() { + if !bounds.contains_point(position) { + return false; + } + } + let mut handled = false; for child in &mut self.children { handled = child.dispatch_event(event, cx) || handled; diff --git a/crates/gpui/src/platform/event.rs b/crates/gpui/src/platform/event.rs index 72e1c24d6b2d157825b115bb8a3c9122fe72a97d..fe353fed4c9be36df5b74aa474be07d5123f3ad1 100644 --- a/crates/gpui/src/platform/event.rs +++ b/crates/gpui/src/platform/event.rs @@ -61,3 +61,20 @@ pub enum Event { left_mouse_down: bool, }, } + +impl Event { + pub fn position(&self) -> Option { + match self { + Event::KeyDown { .. } => None, + Event::ScrollWheel { position, .. } + | Event::LeftMouseDown { position, .. } + | Event::LeftMouseUp { position } + | Event::LeftMouseDragged { position } + | Event::RightMouseDown { position, .. } + | Event::RightMouseUp { position } + | Event::NavigateMouseDown { position, .. } + | Event::NavigateMouseUp { position, .. } + | Event::MouseMoved { position, .. } => Some(*position), + } + } +} From 664f17f92b035789f713d5ab38ce9d11319c3c8c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 5 Apr 2022 11:14:06 -0700 Subject: [PATCH 094/245] Avoid maintaining indent size as state on buffers Indent size is still hard-coded, but it's now controlled by the editor and not the buffer. Co-authored-by: Keith Simmons --- crates/editor/src/editor.rs | 3 +- crates/editor/src/multi_buffer.rs | 8 ++-- crates/language/src/buffer.rs | 67 +++++++++++++++---------------- crates/language/src/tests.rs | 18 ++++++--- 4 files changed, 51 insertions(+), 45 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 486840c3d2e950fd28e71782ec359a1def7f42e1..0a019e1701aa6b4a8cb82e29f431eeb5145486c0 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -63,6 +63,7 @@ const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500); const MAX_LINE_LEN: usize = 1024; const MIN_NAVIGATION_HISTORY_ROW_DELTA: i64 = 10; const MAX_SELECTION_HISTORY_LEN: usize = 1024; +const INDENT_SIZE: u32 = 4; action!(Cancel); action!(Backspace); @@ -2946,7 +2947,7 @@ impl Editor { { let indent_column = buffer.indent_column_for_line(line_buffer_range.start.row); if old_head.column <= indent_column && old_head.column > 0 { - let indent = buffer.indent_size(); + let indent = INDENT_SIZE; new_head = cmp::min( new_head, Point::new(old_head.row, ((old_head.column - 1) / indent) * indent), diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index c07df895c995eda51d44da0221a30bf5118b5e39..f1e39688be5f363458e4217bd860c71cf0c8ecf9 100644 --- a/crates/editor/src/multi_buffer.rs +++ b/crates/editor/src/multi_buffer.rs @@ -287,6 +287,8 @@ impl MultiBuffer { S: ToOffset, T: Into, { + let indent_size = crate::INDENT_SIZE; + if self.buffers.borrow().is_empty() { return; } @@ -298,7 +300,7 @@ impl MultiBuffer { .map(|range| range.start.to_offset(&snapshot)..range.end.to_offset(&snapshot)); return buffer.update(cx, |buffer, cx| { if autoindent { - buffer.edit_with_autoindent(ranges, new_text, cx); + buffer.edit_with_autoindent(ranges, new_text, indent_size, cx); } else { buffer.edit(ranges, new_text, cx); } @@ -394,8 +396,8 @@ impl MultiBuffer { } if autoindent { - buffer.edit_with_autoindent(deletions, "", cx); - buffer.edit_with_autoindent(insertions, new_text.clone(), cx); + buffer.edit_with_autoindent(deletions, "", indent_size, cx); + buffer.edit_with_autoindent(insertions, new_text.clone(), indent_size, cx); } else { buffer.edit(deletions, "", cx); buffer.edit(insertions, new_text.clone(), cx); diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 348ea225cdc008df5e6d9b506ca84c0327be8126..95aa27b6d27999bbec09b86151a0cf6dfe046995 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -66,7 +66,6 @@ pub struct Buffer { file_update_count: usize, completion_triggers: Vec, deferred_ops: OperationQueue, - indent_size: u32, } pub struct BufferSnapshot { @@ -80,7 +79,6 @@ pub struct BufferSnapshot { selections_update_count: usize, language: Option>, parse_count: usize, - indent_size: u32, } #[derive(Clone, Debug)] @@ -214,6 +212,7 @@ struct AutoindentRequest { before_edit: BufferSnapshot, edited: Vec, inserted: Option>>, + indent_size: u32, } #[derive(Debug)] @@ -427,8 +426,6 @@ impl Buffer { file_update_count: 0, completion_triggers: Default::default(), deferred_ops: OperationQueue::new(), - // TODO: make this configurable - indent_size: 4, } } @@ -444,7 +441,6 @@ impl Buffer { language: self.language.clone(), parse_count: self.parse_count, selections_update_count: self.selections_update_count, - indent_size: self.indent_size, } } @@ -786,7 +782,7 @@ impl Buffer { .indent_column_for_line(suggestion.basis_row) }); let delta = if suggestion.indent { - snapshot.indent_size + request.indent_size } else { 0 }; @@ -809,7 +805,7 @@ impl Buffer { .flatten(); for (new_row, suggestion) in new_edited_row_range.zip(suggestions) { let delta = if suggestion.indent { - snapshot.indent_size + request.indent_size } else { 0 }; @@ -845,7 +841,7 @@ impl Buffer { .flatten(); for (row, suggestion) in inserted_row_range.zip(suggestions) { let delta = if suggestion.indent { - snapshot.indent_size + request.indent_size } else { 0 }; @@ -1055,7 +1051,7 @@ impl Buffer { where T: Into, { - self.edit_internal([0..self.len()], text, false, cx) + self.edit_internal([0..self.len()], text, None, cx) } pub fn edit( @@ -1069,13 +1065,14 @@ impl Buffer { S: ToOffset, T: Into, { - self.edit_internal(ranges_iter, new_text, false, cx) + self.edit_internal(ranges_iter, new_text, None, cx) } pub fn edit_with_autoindent( &mut self, ranges_iter: I, new_text: T, + indent_size: u32, cx: &mut ModelContext, ) -> Option where @@ -1083,14 +1080,14 @@ impl Buffer { S: ToOffset, T: Into, { - self.edit_internal(ranges_iter, new_text, true, cx) + self.edit_internal(ranges_iter, new_text, Some(indent_size), cx) } pub fn edit_internal( &mut self, ranges_iter: I, new_text: T, - autoindent: bool, + autoindent_size: Option, cx: &mut ModelContext, ) -> Option where @@ -1122,23 +1119,27 @@ impl Buffer { self.start_transaction(); self.pending_autoindent.take(); - let autoindent_request = if autoindent && self.language.is_some() { - let before_edit = self.snapshot(); - let edited = ranges - .iter() - .filter_map(|range| { - let start = range.start.to_point(self); - if new_text.starts_with('\n') && start.column == self.line_len(start.row) { - None - } else { - Some(self.anchor_before(range.start)) - } - }) - .collect(); - Some((before_edit, edited)) - } else { - None - }; + let autoindent_request = + self.language + .as_ref() + .and_then(|_| autoindent_size) + .map(|autoindent_size| { + let before_edit = self.snapshot(); + let edited = ranges + .iter() + .filter_map(|range| { + let start = range.start.to_point(self); + if new_text.starts_with('\n') + && start.column == self.line_len(start.row) + { + None + } else { + Some(self.anchor_before(range.start)) + } + }) + .collect(); + (before_edit, edited, autoindent_size) + }); let first_newline_ix = new_text.find('\n'); let new_text_len = new_text.len(); @@ -1146,7 +1147,7 @@ impl Buffer { let edit = self.text.edit(ranges.iter().cloned(), new_text); let edit_id = edit.local_timestamp(); - if let Some((before_edit, edited)) = autoindent_request { + if let Some((before_edit, edited, size)) = autoindent_request { let mut inserted = None; if let Some(first_newline_ix) = first_newline_ix { let mut delta = 0isize; @@ -1169,6 +1170,7 @@ impl Buffer { before_edit, edited, inserted, + indent_size: size, })); } @@ -1925,10 +1927,6 @@ impl BufferSnapshot { pub fn file_update_count(&self) -> usize { self.file_update_count } - - pub fn indent_size(&self) -> u32 { - self.indent_size - } } impl Clone for BufferSnapshot { @@ -1944,7 +1942,6 @@ impl Clone for BufferSnapshot { file_update_count: self.file_update_count, language: self.language.clone(), parse_count: self.parse_count, - indent_size: self.indent_size, } } } diff --git a/crates/language/src/tests.rs b/crates/language/src/tests.rs index 921a2343d470d3aa624e21eb47f577302549125c..af2d8ee911338ae12aff702d0ae22c9d23c1db49 100644 --- a/crates/language/src/tests.rs +++ b/crates/language/src/tests.rs @@ -576,13 +576,13 @@ fn test_edit_with_autoindent(cx: &mut MutableAppContext) { let text = "fn a() {}"; let mut buffer = Buffer::new(0, text, cx).with_language(Arc::new(rust_lang()), cx); - buffer.edit_with_autoindent([8..8], "\n\n", cx); + buffer.edit_with_autoindent([8..8], "\n\n", 4, cx); assert_eq!(buffer.text(), "fn a() {\n \n}"); - buffer.edit_with_autoindent([Point::new(1, 4)..Point::new(1, 4)], "b()\n", cx); + buffer.edit_with_autoindent([Point::new(1, 4)..Point::new(1, 4)], "b()\n", 4, cx); assert_eq!(buffer.text(), "fn a() {\n b()\n \n}"); - buffer.edit_with_autoindent([Point::new(2, 4)..Point::new(2, 4)], ".c", cx); + buffer.edit_with_autoindent([Point::new(2, 4)..Point::new(2, 4)], ".c", 4, cx); assert_eq!(buffer.text(), "fn a() {\n b()\n .c\n}"); buffer @@ -604,7 +604,12 @@ fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut Muta // Lines 2 and 3 don't match the indentation suggestion. When editing these lines, // their indentation is not adjusted. - buffer.edit_with_autoindent([empty(Point::new(1, 1)), empty(Point::new(2, 1))], "()", cx); + buffer.edit_with_autoindent( + [empty(Point::new(1, 1)), empty(Point::new(2, 1))], + "()", + 4, + cx, + ); assert_eq!( buffer.text(), " @@ -621,6 +626,7 @@ fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut Muta buffer.edit_with_autoindent( [empty(Point::new(1, 1)), empty(Point::new(2, 1))], "\n.f\n.g", + 4, cx, ); assert_eq!( @@ -651,7 +657,7 @@ fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut MutableAppConte let mut buffer = Buffer::new(0, text, cx).with_language(Arc::new(rust_lang()), cx); - buffer.edit_with_autoindent([5..5], "\nb", cx); + buffer.edit_with_autoindent([5..5], "\nb", 4, cx); assert_eq!( buffer.text(), " @@ -663,7 +669,7 @@ fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut MutableAppConte // The indentation suggestion changed because `@end` node (a close paren) // is now at the beginning of the line. - buffer.edit_with_autoindent([Point::new(1, 4)..Point::new(1, 5)], "", cx); + buffer.edit_with_autoindent([Point::new(1, 4)..Point::new(1, 5)], "", 4, cx); assert_eq!( buffer.text(), " From 866ffdd4aeaed84bfd3f6aa21afbea674c86bc0f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 5 Apr 2022 17:10:17 -0700 Subject: [PATCH 095/245] Move Settings to its own crate Co-authored-by: Keith Simmons --- Cargo.lock | 32 +- crates/breadcrumbs/Cargo.toml | 1 + crates/breadcrumbs/src/breadcrumbs.rs | 3 +- crates/chat_panel/Cargo.toml | 1 + crates/chat_panel/src/chat_panel.rs | 2 +- crates/contacts_panel/Cargo.toml | 1 + crates/contacts_panel/src/contacts_panel.rs | 3 +- crates/diagnostics/Cargo.toml | 1 + crates/diagnostics/src/diagnostics.rs | 3 +- crates/diagnostics/src/items.rs | 3 +- crates/editor/Cargo.toml | 2 + crates/editor/src/display_map.rs | 3 + crates/editor/src/editor.rs | 9 +- crates/editor/src/element.rs | 2 +- crates/editor/src/items.rs | 5 +- crates/file_finder/Cargo.toml | 1 + crates/file_finder/src/file_finder.rs | 3 +- crates/go_to_line/Cargo.toml | 1 + crates/go_to_line/src/go_to_line.rs | 3 +- crates/outline/Cargo.toml | 1 + crates/outline/src/outline.rs | 3 +- crates/project_panel/Cargo.toml | 1 + crates/project_panel/src/project_panel.rs | 3 +- crates/project_symbols/Cargo.toml | 1 + crates/project_symbols/src/project_symbols.rs | 3 +- crates/search/Cargo.toml | 1 + crates/search/src/buffer_search.rs | 3 +- crates/search/src/project_search.rs | 5 +- crates/server/Cargo.toml | 1 + crates/server/src/rpc.rs | 3 +- crates/settings/Cargo.toml | 22 ++ crates/settings/src/settings.rs | 171 +++++++++ crates/theme_selector/Cargo.toml | 1 + crates/theme_selector/src/theme_selector.rs | 3 +- crates/vim/Cargo.toml | 4 +- crates/vim/src/vim.rs | 3 +- crates/workspace/Cargo.toml | 3 +- crates/workspace/src/lsp_status.rs | 3 +- crates/workspace/src/pane.rs | 5 +- crates/workspace/src/settings.rs | 325 ------------------ crates/workspace/src/status_bar.rs | 3 +- crates/workspace/src/toolbar.rs | 3 +- crates/workspace/src/workspace.rs | 3 +- crates/zed/Cargo.toml | 2 + crates/zed/src/main.rs | 16 +- crates/zed/src/settings_file.rs | 157 +++++++++ crates/zed/src/test.rs | 2 +- crates/zed/src/zed.rs | 4 +- 48 files changed, 465 insertions(+), 369 deletions(-) create mode 100644 crates/settings/Cargo.toml create mode 100644 crates/settings/src/settings.rs delete mode 100644 crates/workspace/src/settings.rs create mode 100644 crates/zed/src/settings_file.rs diff --git a/Cargo.lock b/Cargo.lock index b76445011cbb70b0e0fe88c83471be58714cb65d..d380fa4306560cf0aa9014e544d4e76f54ca98f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,6 +729,7 @@ dependencies = [ "language", "project", "search", + "settings", "theme", "workspace", ] @@ -881,6 +882,7 @@ dependencies = [ "editor", "gpui", "postage", + "settings", "theme", "time 0.3.7", "util", @@ -1131,6 +1133,7 @@ dependencies = [ "client", "gpui", "postage", + "settings", "theme", "workspace", ] @@ -1480,6 +1483,7 @@ dependencies = [ "postage", "project", "serde_json", + "settings", "theme", "unindent", "util", @@ -1646,6 +1650,7 @@ dependencies = [ "rand 0.8.3", "rpc", "serde", + "settings", "smallvec", "smol", "snippet", @@ -1806,6 +1811,7 @@ dependencies = [ "postage", "project", "serde_json", + "settings", "theme", "util", "workspace", @@ -2206,6 +2212,7 @@ dependencies = [ "editor", "gpui", "postage", + "settings", "text", "workspace", ] @@ -3255,6 +3262,7 @@ dependencies = [ "language", "ordered-float", "postage", + "settings", "smol", "text", "workspace", @@ -3643,6 +3651,7 @@ dependencies = [ "postage", "project", "serde_json", + "settings", "theme", "util", "workspace", @@ -3659,6 +3668,7 @@ dependencies = [ "ordered-float", "postage", "project", + "settings", "smol", "text", "util", @@ -4258,6 +4268,7 @@ dependencies = [ "postage", "project", "serde_json", + "settings", "theme", "unindent", "util", @@ -4406,6 +4417,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "settings" +version = "0.1.0" +dependencies = [ + "anyhow", + "gpui", + "schemars", + "serde", + "serde_json", + "serde_path_to_error", + "theme", + "toml", + "util", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -5142,6 +5168,7 @@ dependencies = [ "log", "parking_lot", "postage", + "settings", "smol", "theme", "workspace", @@ -5719,6 +5746,7 @@ dependencies = [ "language", "log", "project", + "settings", "util", "workspace", ] @@ -5948,9 +5976,9 @@ dependencies = [ "parking_lot", "postage", "project", - "schemars", "serde", "serde_json", + "settings", "smallvec", "theme", "util", @@ -6034,6 +6062,7 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", + "settings", "simplelog", "smallvec", "smol", @@ -6099,6 +6128,7 @@ dependencies = [ "scrypt", "serde", "serde_json", + "settings", "sha-1 0.9.6", "sqlx 0.5.5", "surf", diff --git a/crates/breadcrumbs/Cargo.toml b/crates/breadcrumbs/Cargo.toml index 7dbafdb3be560805d18df4fe47a4c0b7c605b95a..88fd614a893e0badaa5800a9c9eef6d75b4da374 100644 --- a/crates/breadcrumbs/Cargo.toml +++ b/crates/breadcrumbs/Cargo.toml @@ -14,6 +14,7 @@ gpui = { path = "../gpui" } language = { path = "../language" } project = { path = "../project" } search = { path = "../search" } +settings = { path = "../settings" } theme = { path = "../theme" } workspace = { path = "../workspace" } diff --git a/crates/breadcrumbs/src/breadcrumbs.rs b/crates/breadcrumbs/src/breadcrumbs.rs index 59c8b08b685270576967492f3f0c87d659a5799b..b2bba37e38fb591e20561b5edb34912e9c4c5c18 100644 --- a/crates/breadcrumbs/src/breadcrumbs.rs +++ b/crates/breadcrumbs/src/breadcrumbs.rs @@ -6,8 +6,9 @@ use gpui::{ use language::{Buffer, OutlineItem}; use project::Project; use search::ProjectSearchView; +use settings::Settings; use theme::SyntaxTheme; -use workspace::{ItemHandle, Settings, ToolbarItemLocation, ToolbarItemView}; +use workspace::{ItemHandle, ToolbarItemLocation, ToolbarItemView}; pub enum Event { UpdateLocation, diff --git a/crates/chat_panel/Cargo.toml b/crates/chat_panel/Cargo.toml index a64ecc8b7b8d2b8bfc474c42d830f1feec017021..95426517d7f7cd4f216ef806aeab151dba2bf68d 100644 --- a/crates/chat_panel/Cargo.toml +++ b/crates/chat_panel/Cargo.toml @@ -11,6 +11,7 @@ doctest = false client = { path = "../client" } editor = { path = "../editor" } gpui = { path = "../gpui" } +settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } diff --git a/crates/chat_panel/src/chat_panel.rs b/crates/chat_panel/src/chat_panel.rs index a7c912389479460c618d0570ee17ef9c4d6abedc..9d575768a6385e106f484fde00a5a68d54d6be0f 100644 --- a/crates/chat_panel/src/chat_panel.rs +++ b/crates/chat_panel/src/chat_panel.rs @@ -13,10 +13,10 @@ use gpui::{ ViewContext, ViewHandle, }; use postage::prelude::Stream; +use settings::{Settings, SoftWrap}; use std::sync::Arc; use time::{OffsetDateTime, UtcOffset}; use util::{ResultExt, TryFutureExt}; -use workspace::{settings::SoftWrap, Settings}; const MESSAGE_LOADING_THRESHOLD: usize = 50; diff --git a/crates/contacts_panel/Cargo.toml b/crates/contacts_panel/Cargo.toml index 43bd2548a8d0cd5c835ca645f787c56e16efa733..6a4dbf653dbb1751ca1a41303cf2fec08fb6f09e 100644 --- a/crates/contacts_panel/Cargo.toml +++ b/crates/contacts_panel/Cargo.toml @@ -10,6 +10,7 @@ doctest = false [dependencies] client = { path = "../client" } gpui = { path = "../gpui" } +settings = { path = "../settings" } theme = { path = "../theme" } workspace = { path = "../workspace" } postage = { version = "0.4.1", features = ["futures-traits"] } diff --git a/crates/contacts_panel/src/contacts_panel.rs b/crates/contacts_panel/src/contacts_panel.rs index 06c6b8f1bb648b7978f7896f7fcf48fffd256412..deb6f8e4a32919270342d420e8006da510d79fc4 100644 --- a/crates/contacts_panel/src/contacts_panel.rs +++ b/crates/contacts_panel/src/contacts_panel.rs @@ -8,7 +8,8 @@ use gpui::{ Element, ElementBox, Entity, LayoutContext, ModelHandle, RenderContext, Subscription, View, ViewContext, }; -use workspace::{AppState, JoinProject, JoinProjectParams, Settings}; +use workspace::{AppState, JoinProject, JoinProjectParams}; +use settings::Settings; pub struct ContactsPanel { contacts: ListState, diff --git a/crates/diagnostics/Cargo.toml b/crates/diagnostics/Cargo.toml index 4cf45041e9049a39c8d55ddf813562ad506b79fc..4f59ffc68c64cb313360056a09ca176117769eaa 100644 --- a/crates/diagnostics/Cargo.toml +++ b/crates/diagnostics/Cargo.toml @@ -14,6 +14,7 @@ editor = { path = "../editor" } language = { path = "../language" } gpui = { path = "../gpui" } project = { path = "../project" } +settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index da50e99f1e5175d04900c4d0a4839479e1dd82c7..1d317278a6ab90bb47c5d53b6235d555a13fb1ea 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -25,7 +25,8 @@ use std::{ sync::Arc, }; use util::TryFutureExt; -use workspace::{ItemHandle as _, ItemNavHistory, Settings, Workspace}; +use workspace::{ItemHandle as _, ItemNavHistory, Workspace}; +use settings::Settings; action!(Deploy); diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index 690c5100ecf9ec3a8edf89414a2ef545f868201a..41826017cdd1a0742265d5884a22e72d8af0f6fa 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -3,7 +3,8 @@ use gpui::{ elements::*, platform::CursorStyle, Entity, ModelHandle, RenderContext, View, ViewContext, }; use project::Project; -use workspace::{Settings, StatusItemView}; +use workspace::{StatusItemView}; +use settings::Settings; pub struct DiagnosticSummary { summary: project::DiagnosticSummary, diff --git a/crates/editor/Cargo.toml b/crates/editor/Cargo.toml index 77e169b91b2e03648402687722b29ea045c7822b..4664d9c52e674fa0786bdd1de501d20cecf99ee9 100644 --- a/crates/editor/Cargo.toml +++ b/crates/editor/Cargo.toml @@ -28,6 +28,7 @@ language = { path = "../language" } lsp = { path = "../lsp" } project = { path = "../project" } rpc = { path = "../rpc" } +settings = { path = "../settings" } snippet = { path = "../snippet" } sum_tree = { path = "../sum_tree" } theme = { path = "../theme" } @@ -54,6 +55,7 @@ lsp = { path = "../lsp", features = ["test-support"] } gpui = { path = "../gpui", features = ["test-support"] } util = { path = "../util", features = ["test-support"] } project = { path = "../project", features = ["test-support"] } +settings = { path = "../settings", features = ["test-support"] } workspace = { path = "../workspace", features = ["test-support"] } ctor = "0.1" env_logger = "0.8" diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 2bea851ec2fa92605aa32b9f2a2c584a649e7305..27db9a8de51ae343002ed445dd24c5c43ee7199a 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -46,6 +46,7 @@ impl Entity for DisplayMap { impl DisplayMap { pub fn new( buffer: ModelHandle, + // TODO - remove. read tab_size from settings inside tab_size: usize, font_id: FontId, font_size: f32, @@ -76,6 +77,8 @@ impl DisplayMap { let buffer_snapshot = self.buffer.read(cx).snapshot(cx); let edits = self.buffer_subscription.consume().into_inner(); let (folds_snapshot, edits) = self.fold_map.read(buffer_snapshot, edits); + + // TODO: Pull tabsize out of cx and pass it to sync let (tabs_snapshot, edits) = self.tab_map.sync(folds_snapshot.clone(), edits); let (wraps_snapshot, edits) = self .wrap_map diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0a019e1701aa6b4a8cb82e29f431eeb5145486c0..46d71ebeae2e00d43e9fc0cf70690b03f907b7d1 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -41,6 +41,7 @@ pub use multi_buffer::{ use ordered_float::OrderedFloat; use project::{Project, ProjectTransaction}; use serde::{Deserialize, Serialize}; +use settings::Settings; use smallvec::SmallVec; use smol::Timer; use snippet::Snippet; @@ -57,7 +58,7 @@ pub use sum_tree::Bias; use text::rope::TextDimension; use theme::DiagnosticStyle; use util::{post_inc, ResultExt, TryFutureExt}; -use workspace::{settings, ItemNavHistory, Settings, Workspace}; +use workspace::{ItemNavHistory, Workspace}; const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500); const MAX_LINE_LEN: usize = 1024; @@ -5669,16 +5670,16 @@ impl Editor { } pub fn soft_wrap_mode(&self, cx: &AppContext) -> SoftWrap { - let language = self.language(cx); + let language = self.language(cx).map(|language| language.name()); let settings = cx.global::(); let mode = self .soft_wrap_mode_override - .unwrap_or_else(|| settings.soft_wrap(language)); + .unwrap_or_else(|| settings.soft_wrap(language.as_deref())); match mode { settings::SoftWrap::None => SoftWrap::None, settings::SoftWrap::EditorWidth => SoftWrap::EditorWidth, settings::SoftWrap::PreferredLineLength => { - SoftWrap::Column(settings.preferred_line_length(language)) + SoftWrap::Column(settings.preferred_line_length(language.as_deref())) } } } diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 18f780dacc1ad68d28814a92241163f3fcf27748..0ffe3feb6d43cb1ffd0b6eea1c5812f61f41d85c 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1494,8 +1494,8 @@ mod tests { display_map::{BlockDisposition, BlockProperties}, Editor, MultiBuffer, }; + use settings::Settings; use util::test::sample_text; - use workspace::Settings; #[gpui::test] fn test_layout_line_numbers(cx: &mut gpui::MutableAppContext) { diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 67d5aee7731d9e23934849a8ee638de034bc82f6..9a102dd5ce66661f6b1b4c5e37d2ecafa98393b1 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -8,12 +8,11 @@ use gpui::{ use language::{Bias, Buffer, Diagnostic, File as _, SelectionGoal}; use project::{File, Project, ProjectEntryId, ProjectPath}; use rpc::proto::{self, update_view}; +use settings::Settings; use std::{fmt::Write, path::PathBuf, time::Duration}; use text::{Point, Selection}; use util::TryFutureExt; -use workspace::{ - FollowableItem, Item, ItemHandle, ItemNavHistory, ProjectItem, Settings, StatusItemView, -}; +use workspace::{FollowableItem, Item, ItemHandle, ItemNavHistory, ProjectItem, StatusItemView}; pub const FORMAT_TIMEOUT: Duration = Duration::from_secs(2); diff --git a/crates/file_finder/Cargo.toml b/crates/file_finder/Cargo.toml index b946ea48fbbf58a7196f56949ececfe23fa1fd75..47dd9b15bc07423c9cb4a86ef493f41ba7bf4c9b 100644 --- a/crates/file_finder/Cargo.toml +++ b/crates/file_finder/Cargo.toml @@ -12,6 +12,7 @@ editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } project = { path = "../project" } +settings = { path = "../settings" } util = { path = "../util" } theme = { path = "../theme" } workspace = { path = "../workspace" } diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 471e43a0edcb4e95011fd07a280ab6f3b835f223..7dfe9a54deabce916e496b77a9e46fa2dede6840 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -19,8 +19,9 @@ use std::{ use util::post_inc; use workspace::{ menu::{Confirm, SelectNext, SelectPrev}, - Settings, Workspace, + Workspace, }; +use settings::Settings; pub struct FileFinder { handle: WeakViewHandle, diff --git a/crates/go_to_line/Cargo.toml b/crates/go_to_line/Cargo.toml index eaad41e0802ef0caecbc807a373eea8131ff6ec8..76744274c7ed704d3af71498fe1aa1869ab8823e 100644 --- a/crates/go_to_line/Cargo.toml +++ b/crates/go_to_line/Cargo.toml @@ -11,5 +11,6 @@ doctest = false text = { path = "../text" } editor = { path = "../editor" } gpui = { path = "../gpui" } +settings = { path = "../settings" } workspace = { path = "../workspace" } postage = { version = "0.4", features = ["futures-traits"] } diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 109d33097d69cf5f4d251451aa634887774145de..19b43d572148b8f0c13534bd4ae11fb784cdbe88 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -3,8 +3,9 @@ use gpui::{ action, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; +use settings::Settings; use text::{Bias, Point}; -use workspace::{Settings, Workspace}; +use workspace::Workspace; action!(Toggle); action!(Confirm); diff --git a/crates/outline/Cargo.toml b/crates/outline/Cargo.toml index e5ed300dc75e68ff5f9e09f9822078b3fa65e854..fc9444a14c705b9fdd6aeb5a1bb1b8b0f6e6c851 100644 --- a/crates/outline/Cargo.toml +++ b/crates/outline/Cargo.toml @@ -12,6 +12,7 @@ editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } language = { path = "../language" } +settings = { path = "../settings" } text = { path = "../text" } workspace = { path = "../workspace" } ordered-float = "2.1.1" diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index c33cb60b3e36456c9557536ed77ea166bb5dd668..14b57f2d132314d189d0fa3c94d840c27e49c007 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -13,10 +13,11 @@ use gpui::{ }; use language::Outline; use ordered_float::OrderedFloat; +use settings::Settings; use std::cmp::{self, Reverse}; use workspace::{ menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}, - Settings, Workspace, + Workspace, }; action!(Toggle); diff --git a/crates/project_panel/Cargo.toml b/crates/project_panel/Cargo.toml index 2e501780365fbb0ce3d942c9dd3fce71dccc4493..81e975cc73ded8026c597e88e202c57a6c86ec55 100644 --- a/crates/project_panel/Cargo.toml +++ b/crates/project_panel/Cargo.toml @@ -10,6 +10,7 @@ doctest = false [dependencies] gpui = { path = "../gpui" } project = { path = "../project" } +settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 0dd6b08bacc68bf888e9348636ec0b66669a509c..6ae81fcb5e608fc6709ce1e7e38d3c8369955be9 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -10,6 +10,7 @@ use gpui::{ ViewHandle, WeakViewHandle, }; use project::{Project, ProjectEntryId, ProjectPath, Worktree, WorktreeId}; +use settings::Settings; use std::{ collections::{hash_map, HashMap}, ffi::OsStr, @@ -17,7 +18,7 @@ use std::{ }; use workspace::{ menu::{SelectNext, SelectPrev}, - Settings, Workspace, + Workspace, }; pub struct ProjectPanel { diff --git a/crates/project_symbols/Cargo.toml b/crates/project_symbols/Cargo.toml index cdaedf109c3b3501a58dd14c6460e5e3519193ce..de22c0eda027a4a3ec1e0a6c0f0bc4024fb58747 100644 --- a/crates/project_symbols/Cargo.toml +++ b/crates/project_symbols/Cargo.toml @@ -13,6 +13,7 @@ fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } project = { path = "../project" } text = { path = "../text" } +settings = { path = "../settings" } workspace = { path = "../workspace" } util = { path = "../util" } anyhow = "1.0.38" diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 74e7d90d689f8fadfd06763feaa366ffeab3f61a..f707aa30f71dd1e354a2fc079caaa2ac489d3774 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -11,6 +11,7 @@ use gpui::{ }; use ordered_float::OrderedFloat; use project::{Project, Symbol}; +use settings::Settings; use std::{ borrow::Cow, cmp::{self, Reverse}, @@ -18,7 +19,7 @@ use std::{ use util::ResultExt; use workspace::{ menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}, - Settings, Workspace, + Workspace, }; action!(Toggle); diff --git a/crates/search/Cargo.toml b/crates/search/Cargo.toml index 5553e3b9a281eb2e0a5c811155436d94d092e60c..77961de01f3efdee86603d01b99c259509d04c9e 100644 --- a/crates/search/Cargo.toml +++ b/crates/search/Cargo.toml @@ -13,6 +13,7 @@ editor = { path = "../editor" } gpui = { path = "../gpui" } language = { path = "../language" } project = { path = "../project" } +settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index b5f8eedf8023828baba389b14d385b0e5184c273..5dc93245b97739e35ca1bf5ef5b216d6432aed99 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -9,7 +9,8 @@ use gpui::{ use language::OffsetRangeExt; use project::search::SearchQuery; use std::ops::Range; -use workspace::{ItemHandle, Pane, Settings, ToolbarItemLocation, ToolbarItemView}; +use workspace::{ItemHandle, Pane, ToolbarItemLocation, ToolbarItemView}; +use settings::Settings; action!(Deploy, bool); action!(Dismiss); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 745f23154fd98a77b3f20e79f1f4d513f235ebc5..9009dfee79493b493868b6ba930fe0186709b99e 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -10,15 +10,14 @@ use gpui::{ ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle, }; use project::{search::SearchQuery, Project}; +use settings::Settings; use std::{ any::{Any, TypeId}, ops::Range, path::PathBuf, }; use util::ResultExt as _; -use workspace::{ - Item, ItemNavHistory, Pane, Settings, ToolbarItemLocation, ToolbarItemView, Workspace, -}; +use workspace::{Item, ItemNavHistory, Pane, ToolbarItemLocation, ToolbarItemView, Workspace}; action!(Deploy); action!(Search); diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index c39fb2f10b22cebaa4053c64609d14e21fba0416..6e27fa16c523cf0908f10fff8cdf772c54269b84 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -14,6 +14,7 @@ required-features = ["seed-support"] [dependencies] collections = { path = "../collections" } +settings = { path = "../settings" } rpc = { path = "../rpc" } anyhow = "1.0.40" async-io = "1.3" diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index eb12de9b727bb6ea9c6b87047ffeab23372221ea..51c7807660708ea47209a5d133d2f7128e33b4f7 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1104,6 +1104,7 @@ mod tests { use rand::prelude::*; use rpc::PeerId; use serde_json::json; + use settings::Settings; use sqlx::types::time::OffsetDateTime; use std::{ cell::Cell, @@ -1117,7 +1118,7 @@ mod tests { }, time::Duration, }; - use workspace::{Item, Settings, SplitDirection, Workspace, WorkspaceParams}; + use workspace::{Item, SplitDirection, Workspace, WorkspaceParams}; #[cfg(test)] #[ctor::ctor] diff --git a/crates/settings/Cargo.toml b/crates/settings/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..baaf787bee4dc43530d8185864bcf5ea732e0722 --- /dev/null +++ b/crates/settings/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "settings" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/settings.rs" +doctest = false + +[features] +test-support = [] + +[dependencies] +gpui = { path = "../gpui" } +theme = { path = "../theme" } +util = { path = "../util" } +anyhow = "1.0.38" +schemars = "0.8" +serde = { version = "1", features = ["derive", "rc"] } +serde_json = { version = "1.0.64", features = ["preserve_order"] } +serde_path_to_error = "0.1.4" +toml = "0.5" diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs new file mode 100644 index 0000000000000000000000000000000000000000..467456b2fc2d15a7daa6f394bc843ffa177c9e22 --- /dev/null +++ b/crates/settings/src/settings.rs @@ -0,0 +1,171 @@ +use anyhow::Result; +use gpui::font_cache::{FamilyId, FontCache}; +use schemars::{schema_for, JsonSchema}; +use serde::Deserialize; +use std::{collections::HashMap, sync::Arc}; +use theme::{Theme, ThemeRegistry}; +use util::ResultExt as _; + +#[derive(Clone)] +pub struct Settings { + pub buffer_font_family: FamilyId, + pub buffer_font_size: f32, + pub vim_mode: bool, + pub tab_size: usize, + pub soft_wrap: SoftWrap, + pub preferred_line_length: u32, + pub language_overrides: HashMap, LanguageOverride>, + pub theme: Arc, +} + +#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] +pub struct LanguageOverride { + pub tab_size: Option, + pub soft_wrap: Option, + pub preferred_line_length: Option, +} + +#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum SoftWrap { + None, + EditorWidth, + PreferredLineLength, +} + +#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] +pub struct SettingsFileContent { + #[serde(default)] + pub buffer_font_family: Option, + #[serde(default)] + pub buffer_font_size: Option, + #[serde(default)] + pub vim_mode: Option, + #[serde(flatten)] + pub editor: LanguageOverride, + #[serde(default)] + pub language_overrides: HashMap, LanguageOverride>, + #[serde(default)] + pub theme: Option, +} + +impl Settings { + pub fn new( + buffer_font_family: &str, + font_cache: &FontCache, + theme: Arc, + ) -> Result { + Ok(Self { + buffer_font_family: font_cache.load_family(&[buffer_font_family])?, + buffer_font_size: 15., + vim_mode: false, + tab_size: 4, + soft_wrap: SoftWrap::None, + preferred_line_length: 80, + language_overrides: Default::default(), + theme, + }) + } + + pub fn file_json_schema() -> serde_json::Value { + serde_json::to_value(schema_for!(SettingsFileContent)).unwrap() + } + + pub fn with_overrides( + mut self, + language_name: impl Into>, + overrides: LanguageOverride, + ) -> Self { + self.language_overrides + .insert(language_name.into(), overrides); + self + } + + pub fn tab_size(&self, language: Option<&str>) -> usize { + language + .and_then(|language| self.language_overrides.get(language)) + .and_then(|settings| settings.tab_size) + .unwrap_or(self.tab_size) + } + + pub fn soft_wrap(&self, language: Option<&str>) -> SoftWrap { + language + .and_then(|language| self.language_overrides.get(language)) + .and_then(|settings| settings.soft_wrap) + .unwrap_or(self.soft_wrap) + } + + pub fn preferred_line_length(&self, language: Option<&str>) -> u32 { + language + .and_then(|language| self.language_overrides.get(language)) + .and_then(|settings| settings.preferred_line_length) + .unwrap_or(self.preferred_line_length) + } + + #[cfg(any(test, feature = "test-support"))] + pub fn test(cx: &gpui::AppContext) -> Settings { + Settings { + buffer_font_family: cx.font_cache().load_family(&["Monaco"]).unwrap(), + buffer_font_size: 14., + vim_mode: false, + tab_size: 4, + soft_wrap: SoftWrap::None, + preferred_line_length: 80, + language_overrides: Default::default(), + theme: gpui::fonts::with_font_cache(cx.font_cache().clone(), || Default::default()), + } + } + + pub fn merge( + &mut self, + data: &SettingsFileContent, + theme_registry: &ThemeRegistry, + font_cache: &FontCache, + ) { + if let Some(value) = &data.buffer_font_family { + if let Some(id) = font_cache.load_family(&[value]).log_err() { + self.buffer_font_family = id; + } + } + if let Some(value) = &data.theme { + if let Some(theme) = theme_registry.get(value).log_err() { + self.theme = theme; + } + } + + merge(&mut self.buffer_font_size, data.buffer_font_size); + merge(&mut self.vim_mode, data.vim_mode); + merge(&mut self.soft_wrap, data.editor.soft_wrap); + merge(&mut self.tab_size, data.editor.tab_size); + merge( + &mut self.preferred_line_length, + data.editor.preferred_line_length, + ); + + for (language_name, settings) in &data.language_overrides { + let target = self + .language_overrides + .entry(language_name.clone()) + .or_default(); + + merge_option(&mut target.tab_size, settings.tab_size); + merge_option(&mut target.soft_wrap, settings.soft_wrap); + merge_option( + &mut target.preferred_line_length, + settings.preferred_line_length, + ); + } + } +} + +fn merge(target: &mut T, value: Option) { + if let Some(value) = value { + *target = value; + } +} + +fn merge_option(target: &mut Option, value: Option) { + if value.is_some() { + *target = value; + } +} diff --git a/crates/theme_selector/Cargo.toml b/crates/theme_selector/Cargo.toml index ff3d50454f8997b1eeb86283d926bedb1b26b9ba..585d10d563c9919deb8a878576a14c9b09f35e72 100644 --- a/crates/theme_selector/Cargo.toml +++ b/crates/theme_selector/Cargo.toml @@ -12,6 +12,7 @@ editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } theme = { path = "../theme" } +settings = { path = "../settings" } workspace = { path = "../workspace" } log = "0.4" parking_lot = "0.11.1" diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index d61cac1c4428ae1e481f8548fa207f976f96e783..5bcbd62e09578c1210d32a4be10b435c8f695a04 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -9,9 +9,10 @@ use gpui::{ }; use std::{cmp, sync::Arc}; use theme::{Theme, ThemeRegistry}; +use settings::Settings; use workspace::{ menu::{Confirm, SelectNext, SelectPrev}, - Settings, Workspace, + Workspace, }; pub struct ThemeSelector { diff --git a/crates/vim/Cargo.toml b/crates/vim/Cargo.toml index 28ee7de8729f5fc5a8ba4bba2032ffa9d38ee99e..4ffa6a4363c5e08e17899db49d20a46a568dcca9 100644 --- a/crates/vim/Cargo.toml +++ b/crates/vim/Cargo.toml @@ -12,6 +12,7 @@ collections = { path = "../collections" } editor = { path = "../editor" } gpui = { path = "../gpui" } language = { path = "../language" } +settings = { path = "../settings" } workspace = { path = "../workspace" } log = "0.4" @@ -19,7 +20,8 @@ log = "0.4" indoc = "1.0.4" editor = { path = "../editor", features = ["test-support"] } gpui = { path = "../gpui", features = ["test-support"] } -project = { path = "../project", features = ["test-support"] } language = { path = "../language", features = ["test-support"] } +project = { path = "../project", features = ["test-support"] } util = { path = "../util", features = ["test-support"] } +settings = { path = "../settings" } workspace = { path = "../workspace", features = ["test-support"] } \ No newline at end of file diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 609843d9696c215037cb9bef05cde9bc5c28ac14..16ee1612d58a8e0720f92821af6a8621f0ec9ec0 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -10,7 +10,8 @@ use editor::{CursorShape, Editor}; use gpui::{action, MutableAppContext, ViewContext, WeakViewHandle}; use mode::Mode; -use workspace::{self, Settings, Workspace}; +use settings::Settings; +use workspace::{self, Workspace}; action!(SwitchMode, Mode); diff --git a/crates/workspace/Cargo.toml b/crates/workspace/Cargo.toml index 7ef0bd85439b74c9739814a2480584b3496918b9..75d1b1b8f2667ab111278d2efa6979c66e7d50bd 100644 --- a/crates/workspace/Cargo.toml +++ b/crates/workspace/Cargo.toml @@ -17,6 +17,7 @@ collections = { path = "../collections" } gpui = { path = "../gpui" } language = { path = "../language" } project = { path = "../project" } +settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } anyhow = "1.0.38" @@ -24,7 +25,6 @@ futures = "0.3" log = "0.4" parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } -schemars = "0.8" serde = { version = "1", features = ["derive", "rc"] } serde_json = { version = "1", features = ["preserve_order"] } smallvec = { version = "1.6", features = ["union"] } @@ -33,3 +33,4 @@ smallvec = { version = "1.6", features = ["union"] } client = { path = "../client", features = ["test-support"] } gpui = { path = "../gpui", features = ["test-support"] } project = { path = "../project", features = ["test-support"] } +settings = { path = "../settings", features = ["test-support"] } \ No newline at end of file diff --git a/crates/workspace/src/lsp_status.rs b/crates/workspace/src/lsp_status.rs index a12f81857f1d1b2ed4d44aa01c6283da67f2c8c2..cf920b108d1e6d1a8828642b70b10bbda45d4847 100644 --- a/crates/workspace/src/lsp_status.rs +++ b/crates/workspace/src/lsp_status.rs @@ -1,4 +1,4 @@ -use crate::{ItemHandle, Settings, StatusItemView}; +use crate::{ItemHandle, StatusItemView}; use futures::StreamExt; use gpui::AppContext; use gpui::{ @@ -7,6 +7,7 @@ use gpui::{ }; use language::{LanguageRegistry, LanguageServerBinaryStatus}; use project::{LanguageServerProgress, Project}; +use settings::Settings; use smallvec::SmallVec; use std::cmp::Reverse; use std::fmt::Write; diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index fb13ef2fd0e89dda0e38e00f0c39cecce0c4abd1..d3fa9dbfbf75d2ef26cf6384ff1cce11b8ff6614 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1,5 +1,5 @@ use super::{ItemHandle, SplitDirection}; -use crate::{toolbar::Toolbar, Item, Settings, WeakItemHandle, Workspace}; +use crate::{toolbar::Toolbar, Item, WeakItemHandle, Workspace}; use anyhow::Result; use collections::{HashMap, VecDeque}; use futures::StreamExt; @@ -12,7 +12,8 @@ use gpui::{ AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; -use project::{ProjectEntryId, ProjectPath}; +use project::{Project, ProjectEntryId, ProjectPath}; +use settings::Settings; use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc}; use util::ResultExt; diff --git a/crates/workspace/src/settings.rs b/crates/workspace/src/settings.rs deleted file mode 100644 index 5ccf8056e674b98953a340645677606bae80cfaf..0000000000000000000000000000000000000000 --- a/crates/workspace/src/settings.rs +++ /dev/null @@ -1,325 +0,0 @@ -use anyhow::Result; -use futures::{stream, SinkExt, StreamExt as _}; -use gpui::{ - executor, - font_cache::{FamilyId, FontCache}, -}; -use language::Language; -use postage::{prelude::Stream, watch}; -use project::Fs; -use schemars::{schema_for, JsonSchema}; -use serde::Deserialize; -use std::{collections::HashMap, path::Path, sync::Arc, time::Duration}; -use theme::{Theme, ThemeRegistry}; -use util::ResultExt; - -#[derive(Clone)] -pub struct Settings { - pub buffer_font_family: FamilyId, - pub buffer_font_size: f32, - pub vim_mode: bool, - pub tab_size: usize, - pub soft_wrap: SoftWrap, - pub preferred_line_length: u32, - pub language_overrides: HashMap, LanguageOverride>, - pub theme: Arc, -} - -#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] -pub struct LanguageOverride { - pub tab_size: Option, - pub soft_wrap: Option, - pub preferred_line_length: Option, -} - -#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum SoftWrap { - None, - EditorWidth, - PreferredLineLength, -} - -#[derive(Clone)] -pub struct SettingsFile(watch::Receiver); - -#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] -struct SettingsFileContent { - #[serde(default)] - buffer_font_family: Option, - #[serde(default)] - buffer_font_size: Option, - #[serde(default)] - vim_mode: Option, - #[serde(flatten)] - editor: LanguageOverride, - #[serde(default)] - language_overrides: HashMap, LanguageOverride>, - #[serde(default)] - theme: Option, -} - -impl SettingsFile { - pub async fn new( - fs: Arc, - executor: &executor::Background, - path: impl Into>, - ) -> Self { - let path = path.into(); - let settings = Self::load(fs.clone(), &path).await.unwrap_or_default(); - let mut events = fs.watch(&path, Duration::from_millis(500)).await; - let (mut tx, rx) = watch::channel_with(settings); - executor - .spawn(async move { - while events.next().await.is_some() { - if let Some(settings) = Self::load(fs.clone(), &path).await { - if tx.send(settings).await.is_err() { - break; - } - } - } - }) - .detach(); - Self(rx) - } - - async fn load(fs: Arc, path: &Path) -> Option { - if fs.is_file(&path).await { - fs.load(&path) - .await - .log_err() - .and_then(|data| serde_json::from_str(&data).log_err()) - } else { - Some(SettingsFileContent::default()) - } - } -} - -impl Settings { - pub fn file_json_schema() -> serde_json::Value { - serde_json::to_value(schema_for!(SettingsFileContent)).unwrap() - } - - pub fn from_files( - defaults: Self, - sources: Vec, - theme_registry: Arc, - font_cache: Arc, - ) -> impl futures::stream::Stream { - stream::select_all(sources.iter().enumerate().map(|(i, source)| { - let mut rx = source.0.clone(); - // Consume the initial item from all of the constituent file watches but one. - // This way, the stream will yield exactly one item for the files' initial - // state, and won't return any more items until the files change. - if i > 0 { - rx.try_recv().ok(); - } - rx - })) - .map(move |_| { - let mut settings = defaults.clone(); - for source in &sources { - settings.merge(&*source.0.borrow(), &theme_registry, &font_cache); - } - settings - }) - } - - pub fn new( - buffer_font_family: &str, - font_cache: &FontCache, - theme: Arc, - ) -> Result { - Ok(Self { - buffer_font_family: font_cache.load_family(&[buffer_font_family])?, - buffer_font_size: 15., - vim_mode: false, - tab_size: 4, - soft_wrap: SoftWrap::None, - preferred_line_length: 80, - language_overrides: Default::default(), - theme, - }) - } - - pub fn with_overrides( - mut self, - language_name: impl Into>, - overrides: LanguageOverride, - ) -> Self { - self.language_overrides - .insert(language_name.into(), overrides); - self - } - - pub fn tab_size(&self, language: Option<&Arc>) -> usize { - language - .and_then(|language| self.language_overrides.get(language.name().as_ref())) - .and_then(|settings| settings.tab_size) - .unwrap_or(self.tab_size) - } - - pub fn soft_wrap(&self, language: Option<&Arc>) -> SoftWrap { - language - .and_then(|language| self.language_overrides.get(language.name().as_ref())) - .and_then(|settings| settings.soft_wrap) - .unwrap_or(self.soft_wrap) - } - - pub fn preferred_line_length(&self, language: Option<&Arc>) -> u32 { - language - .and_then(|language| self.language_overrides.get(language.name().as_ref())) - .and_then(|settings| settings.preferred_line_length) - .unwrap_or(self.preferred_line_length) - } - - #[cfg(any(test, feature = "test-support"))] - pub fn test(cx: &gpui::AppContext) -> Settings { - Settings { - buffer_font_family: cx.font_cache().load_family(&["Monaco"]).unwrap(), - buffer_font_size: 14., - vim_mode: false, - tab_size: 4, - soft_wrap: SoftWrap::None, - preferred_line_length: 80, - language_overrides: Default::default(), - theme: gpui::fonts::with_font_cache(cx.font_cache().clone(), || Default::default()), - } - } - - fn merge( - &mut self, - data: &SettingsFileContent, - theme_registry: &ThemeRegistry, - font_cache: &FontCache, - ) { - if let Some(value) = &data.buffer_font_family { - if let Some(id) = font_cache.load_family(&[value]).log_err() { - self.buffer_font_family = id; - } - } - if let Some(value) = &data.theme { - if let Some(theme) = theme_registry.get(value).log_err() { - self.theme = theme; - } - } - - merge(&mut self.buffer_font_size, data.buffer_font_size); - merge(&mut self.vim_mode, data.vim_mode); - merge(&mut self.soft_wrap, data.editor.soft_wrap); - merge(&mut self.tab_size, data.editor.tab_size); - merge( - &mut self.preferred_line_length, - data.editor.preferred_line_length, - ); - - for (language_name, settings) in &data.language_overrides { - let target = self - .language_overrides - .entry(language_name.clone()) - .or_default(); - - merge_option(&mut target.tab_size, settings.tab_size); - merge_option(&mut target.soft_wrap, settings.soft_wrap); - merge_option( - &mut target.preferred_line_length, - settings.preferred_line_length, - ); - } - } -} - -fn merge(target: &mut T, value: Option) { - if let Some(value) = value { - *target = value; - } -} - -fn merge_option(target: &mut Option, value: Option) { - if value.is_some() { - *target = value; - } -} - -#[cfg(test)] -mod tests { - use super::*; - use project::FakeFs; - - #[gpui::test] - async fn test_settings_from_files(cx: &mut gpui::TestAppContext) { - let executor = cx.background(); - let fs = FakeFs::new(executor.clone()); - - fs.save( - "/settings1.json".as_ref(), - &r#" - { - "buffer_font_size": 24, - "soft_wrap": "editor_width", - "language_overrides": { - "Markdown": { - "preferred_line_length": 100, - "soft_wrap": "preferred_line_length" - } - } - } - "# - .into(), - ) - .await - .unwrap(); - - let source1 = SettingsFile::new(fs.clone(), &executor, "/settings1.json".as_ref()).await; - let source2 = SettingsFile::new(fs.clone(), &executor, "/settings2.json".as_ref()).await; - let source3 = SettingsFile::new(fs.clone(), &executor, "/settings3.json".as_ref()).await; - - let mut settings_rx = Settings::from_files( - cx.read(Settings::test), - vec![source1, source2, source3], - ThemeRegistry::new((), cx.font_cache()), - cx.font_cache(), - ); - - let settings = settings_rx.next().await.unwrap(); - let md_settings = settings.language_overrides.get("Markdown").unwrap(); - assert_eq!(settings.soft_wrap, SoftWrap::EditorWidth); - assert_eq!(settings.buffer_font_size, 24.0); - assert_eq!(settings.tab_size, 4); - assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength)); - assert_eq!(md_settings.preferred_line_length, Some(100)); - - fs.save( - "/settings2.json".as_ref(), - &r#" - { - "tab_size": 2, - "soft_wrap": "none", - "language_overrides": { - "Markdown": { - "preferred_line_length": 120 - } - } - } - "# - .into(), - ) - .await - .unwrap(); - - let settings = settings_rx.next().await.unwrap(); - let md_settings = settings.language_overrides.get("Markdown").unwrap(); - assert_eq!(settings.soft_wrap, SoftWrap::None); - assert_eq!(settings.buffer_font_size, 24.0); - assert_eq!(settings.tab_size, 2); - assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength)); - assert_eq!(md_settings.preferred_line_length, Some(120)); - - fs.remove_file("/settings2.json".as_ref(), Default::default()) - .await - .unwrap(); - - let settings = settings_rx.next().await.unwrap(); - assert_eq!(settings.tab_size, 4); - } -} diff --git a/crates/workspace/src/status_bar.rs b/crates/workspace/src/status_bar.rs index a91dd645a067465ab13a9e304ece9d55448285d0..c9a2c819e2ca59f6d7f6c47453ae6a5dfc8eb6f2 100644 --- a/crates/workspace/src/status_bar.rs +++ b/crates/workspace/src/status_bar.rs @@ -1,4 +1,5 @@ -use crate::{ItemHandle, Pane, Settings}; +use crate::{ItemHandle, Pane}; +use settings::Settings; use gpui::{ elements::*, AnyViewHandle, ElementBox, Entity, MutableAppContext, RenderContext, Subscription, View, ViewContext, ViewHandle, diff --git a/crates/workspace/src/toolbar.rs b/crates/workspace/src/toolbar.rs index 8212b2508282daf6eb4c0088263089bd7c5f71af..e9b20bf3a04e5876a7a6e202f06b3b78c8727a68 100644 --- a/crates/workspace/src/toolbar.rs +++ b/crates/workspace/src/toolbar.rs @@ -1,8 +1,9 @@ -use crate::{ItemHandle, Settings}; +use crate::ItemHandle; use gpui::{ elements::*, AnyViewHandle, AppContext, ElementBox, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; +use settings::Settings; pub trait ToolbarItemView: View { fn set_active_pane_item( diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index cd3e0e7b30e7c4427e168e401b4447c2e8b48c03..7ee7d5cf44ae7e84d04cfd2293ed2f1ffa8e2c7c 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2,7 +2,6 @@ pub mod lsp_status; pub mod menu; pub mod pane; pub mod pane_group; -pub mod settings; pub mod sidebar; mod status_bar; mod toolbar; @@ -31,7 +30,7 @@ pub use pane::*; pub use pane_group::*; use postage::prelude::Stream; use project::{fs, Fs, Project, ProjectEntryId, ProjectPath, Worktree}; -pub use settings::Settings; +use settings::Settings; use sidebar::{Side, Sidebar, SidebarItemId, ToggleSidebarItem, ToggleSidebarItemFocus}; use status_bar::StatusBar; pub use status_bar::StatusItemView; diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 86011fdb46b5a556163d80437e78045b7f0d64d1..25f45b9cc03333f247ade91f23febc5893d0b3b7 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -51,6 +51,7 @@ project = { path = "../project" } project_panel = { path = "../project_panel" } project_symbols = { path = "../project_symbols" } rpc = { path = "../rpc" } +settings = { path = "../settings" } sum_tree = { path = "../sum_tree" } text = { path = "../text" } theme = { path = "../theme" } @@ -111,6 +112,7 @@ lsp = { path = "../lsp", features = ["test-support"] } project = { path = "../project", features = ["test-support"] } rpc = { path = "../rpc", features = ["test-support"] } client = { path = "../client", features = ["test-support"] } +settings = { path = "../settings", features = ["test-support"] } util = { path = "../util", features = ["test-support"] } workspace = { path = "../workspace", features = ["test-support"] } env_logger = "0.8" diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 49efc9ade2af2749cca42cc20362a1c174dea833..a13cbe86f9fda295155688fe5de324a6d1082fb8 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -9,17 +9,19 @@ use gpui::{App, AssetSource, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; +use settings::{self, Settings}; use smol::process::Command; use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; -use workspace::{ - self, - settings::{self, SettingsFile}, - AppState, OpenNew, OpenParams, OpenPaths, Settings, -}; +use workspace::{self, AppState, OpenNew, OpenParams, OpenPaths}; use zed::{ - self, assets::Assets, build_window_options, build_workspace, fs::RealFs, languages, menus, + self, + assets::Assets, + build_window_options, build_workspace, + fs::RealFs, + languages, menus, + settings_file::{settings_from_files, SettingsFile}, }; fn main() { @@ -97,7 +99,7 @@ fn main() { .detach_and_log_err(cx); let settings_file = cx.background().block(settings_file).unwrap(); - let mut settings_rx = Settings::from_files( + let mut settings_rx = settings_from_files( default_settings, vec![settings_file], themes.clone(), diff --git a/crates/zed/src/settings_file.rs b/crates/zed/src/settings_file.rs new file mode 100644 index 0000000000000000000000000000000000000000..46a3d41eb14c1cf2ede1a951de494014e0977fa1 --- /dev/null +++ b/crates/zed/src/settings_file.rs @@ -0,0 +1,157 @@ +use futures::{stream, StreamExt}; +use gpui::{executor, FontCache}; +use postage::sink::Sink as _; +use postage::{prelude::Stream, watch}; +use project::Fs; +use settings::{Settings, SettingsFileContent}; +use std::{path::Path, sync::Arc, time::Duration}; +use theme::ThemeRegistry; +use util::ResultExt; + +#[derive(Clone)] +pub struct SettingsFile(watch::Receiver); + +impl SettingsFile { + pub async fn new( + fs: Arc, + executor: &executor::Background, + path: impl Into>, + ) -> Self { + let path = path.into(); + let settings = Self::load(fs.clone(), &path).await.unwrap_or_default(); + let mut events = fs.watch(&path, Duration::from_millis(500)).await; + let (mut tx, rx) = watch::channel_with(settings); + executor + .spawn(async move { + while events.next().await.is_some() { + if let Some(settings) = Self::load(fs.clone(), &path).await { + if tx.send(settings).await.is_err() { + break; + } + } + } + }) + .detach(); + Self(rx) + } + + async fn load(fs: Arc, path: &Path) -> Option { + if fs.is_file(&path).await { + fs.load(&path) + .await + .log_err() + .and_then(|data| serde_json::from_str(&data).log_err()) + } else { + Some(SettingsFileContent::default()) + } + } +} + +pub fn settings_from_files( + defaults: Settings, + sources: Vec, + theme_registry: Arc, + font_cache: Arc, +) -> impl futures::stream::Stream { + stream::select_all(sources.iter().enumerate().map(|(i, source)| { + let mut rx = source.0.clone(); + // Consume the initial item from all of the constituent file watches but one. + // This way, the stream will yield exactly one item for the files' initial + // state, and won't return any more items until the files change. + if i > 0 { + rx.try_recv().ok(); + } + rx + })) + .map(move |_| { + let mut settings = defaults.clone(); + for source in &sources { + settings.merge(&*source.0.borrow(), &theme_registry, &font_cache); + } + settings + }) +} + +#[cfg(test)] +mod tests { + use super::*; + use project::FakeFs; + use settings::SoftWrap; + + #[gpui::test] + async fn test_settings_from_files(cx: &mut gpui::TestAppContext) { + let executor = cx.background(); + let fs = FakeFs::new(executor.clone()); + + fs.save( + "/settings1.json".as_ref(), + &r#" + { + "buffer_font_size": 24, + "soft_wrap": "editor_width", + "language_overrides": { + "Markdown": { + "preferred_line_length": 100, + "soft_wrap": "preferred_line_length" + } + } + } + "# + .into(), + ) + .await + .unwrap(); + + let source1 = SettingsFile::new(fs.clone(), &executor, "/settings1.json".as_ref()).await; + let source2 = SettingsFile::new(fs.clone(), &executor, "/settings2.json".as_ref()).await; + let source3 = SettingsFile::new(fs.clone(), &executor, "/settings3.json".as_ref()).await; + + let mut settings_rx = settings_from_files( + cx.read(Settings::test), + vec![source1, source2, source3], + ThemeRegistry::new((), cx.font_cache()), + cx.font_cache(), + ); + + let settings = settings_rx.next().await.unwrap(); + let md_settings = settings.language_overrides.get("Markdown").unwrap(); + assert_eq!(settings.soft_wrap, SoftWrap::EditorWidth); + assert_eq!(settings.buffer_font_size, 24.0); + assert_eq!(settings.tab_size, 4); + assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength)); + assert_eq!(md_settings.preferred_line_length, Some(100)); + + fs.save( + "/settings2.json".as_ref(), + &r#" + { + "tab_size": 2, + "soft_wrap": "none", + "language_overrides": { + "Markdown": { + "preferred_line_length": 120 + } + } + } + "# + .into(), + ) + .await + .unwrap(); + + let settings = settings_rx.next().await.unwrap(); + let md_settings = settings.language_overrides.get("Markdown").unwrap(); + assert_eq!(settings.soft_wrap, SoftWrap::None); + assert_eq!(settings.buffer_font_size, 24.0); + assert_eq!(settings.tab_size, 2); + assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength)); + assert_eq!(md_settings.preferred_line_length, Some(120)); + + fs.remove_file("/settings2.json".as_ref(), Default::default()) + .await + .unwrap(); + + let settings = settings_rx.next().await.unwrap(); + assert_eq!(settings.tab_size, 4); + } +} diff --git a/crates/zed/src/test.rs b/crates/zed/src/test.rs index 5b3bb41c1523bf910a523766f6af2c9a631d264d..363c852c352e9455aa838440c62cfbefd3545efa 100644 --- a/crates/zed/src/test.rs +++ b/crates/zed/src/test.rs @@ -3,9 +3,9 @@ use client::{test::FakeHttpClient, ChannelList, Client, UserStore}; use gpui::MutableAppContext; use language::LanguageRegistry; use project::fs::FakeFs; +use settings::Settings; use std::sync::Arc; use theme::ThemeRegistry; -use workspace::Settings; #[cfg(test)] #[ctor::ctor] diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 1f84c31203223e623a30e307be70c19fd0e72c09..d15e2ce475bdcce8772fbb383581bc68d5acfdc0 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -1,6 +1,7 @@ pub mod assets; pub mod languages; pub mod menus; +pub mod settings_file; #[cfg(any(test, feature = "test-support"))] pub mod test; @@ -23,9 +24,10 @@ use project::Project; pub use project::{self, fs}; use project_panel::ProjectPanel; use search::{BufferSearchBar, ProjectSearchBar}; +use settings::Settings; use std::{path::PathBuf, sync::Arc}; pub use workspace; -use workspace::{AppState, Settings, Workspace, WorkspaceParams}; +use workspace::{AppState, Workspace, WorkspaceParams}; action!(About); action!(Quit); From 1812480cbb1cf66ca27688cb5dd9e2648abc0c74 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 6 Apr 2022 10:20:57 -0700 Subject: [PATCH 096/245] Tab size is pulled properly from settings instead of hardcoded --- Cargo.lock | 1 + crates/editor/src/display_map.rs | 93 ++++++++++++---------- crates/editor/src/display_map/block_map.rs | 10 ++- crates/editor/src/display_map/tab_map.rs | 27 ++++--- crates/editor/src/display_map/wrap_map.rs | 5 +- crates/editor/src/editor.rs | 18 ++--- crates/editor/src/movement.rs | 11 ++- crates/editor/src/test.rs | 3 +- crates/file_finder/src/file_finder.rs | 2 +- crates/gpui/src/app.rs | 15 ++-- crates/project/Cargo.toml | 1 + crates/project/src/project.rs | 7 +- crates/search/src/buffer_search.rs | 2 +- crates/settings/src/settings.rs | 6 +- crates/zed/src/main.rs | 14 ++++ 15 files changed, 128 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d380fa4306560cf0aa9014e544d4e76f54ca98f8..605ddf6c2605ba14bb65dac5d4ae1fa9b548b99d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3632,6 +3632,7 @@ dependencies = [ "rpc", "serde", "serde_json", + "settings", "sha2 0.10.2", "similar", "smol", diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 27db9a8de51ae343002ed445dd24c5c43ee7199a..6bf495c91facd29c6ba1c25e2d5dfda8dd5a2bef 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -12,6 +12,7 @@ use gpui::{ Entity, ModelContext, ModelHandle, }; use language::{Point, Subscription as BufferSubscription}; +use settings::Settings; use std::{any::TypeId, fmt::Debug, ops::Range, sync::Arc}; use sum_tree::{Bias, TreeMap}; use tab_map::TabMap; @@ -46,8 +47,6 @@ impl Entity for DisplayMap { impl DisplayMap { pub fn new( buffer: ModelHandle, - // TODO - remove. read tab_size from settings inside - tab_size: usize, font_id: FontId, font_size: f32, wrap_width: Option, @@ -56,6 +55,8 @@ impl DisplayMap { cx: &mut ModelContext, ) -> Self { let buffer_subscription = buffer.update(cx, |buffer, _| buffer.subscribe()); + + let tab_size = Self::tab_size(&buffer, cx); let (fold_map, snapshot) = FoldMap::new(buffer.read(cx).snapshot(cx)); let (tab_map, snapshot) = TabMap::new(snapshot, tab_size); let (wrap_map, snapshot) = WrapMap::new(snapshot, font_id, font_size, wrap_width, cx); @@ -78,8 +79,8 @@ impl DisplayMap { let edits = self.buffer_subscription.consume().into_inner(); let (folds_snapshot, edits) = self.fold_map.read(buffer_snapshot, edits); - // TODO: Pull tabsize out of cx and pass it to sync - let (tabs_snapshot, edits) = self.tab_map.sync(folds_snapshot.clone(), edits); + let tab_size = Self::tab_size(&self.buffer, cx); + let (tabs_snapshot, edits) = self.tab_map.sync(folds_snapshot.clone(), edits, tab_size); let (wraps_snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(tabs_snapshot.clone(), edits, cx)); @@ -103,14 +104,15 @@ impl DisplayMap { ) { let snapshot = self.buffer.read(cx).snapshot(cx); let edits = self.buffer_subscription.consume().into_inner(); + let tab_size = Self::tab_size(&self.buffer, cx); let (mut fold_map, snapshot, edits) = self.fold_map.write(snapshot, edits); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); self.block_map.read(snapshot, edits); let (snapshot, edits) = fold_map.fold(ranges); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); @@ -125,14 +127,15 @@ impl DisplayMap { ) { let snapshot = self.buffer.read(cx).snapshot(cx); let edits = self.buffer_subscription.consume().into_inner(); + let tab_size = Self::tab_size(&self.buffer, cx); let (mut fold_map, snapshot, edits) = self.fold_map.write(snapshot, edits); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); self.block_map.read(snapshot, edits); let (snapshot, edits) = fold_map.unfold(ranges, inclusive); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); @@ -146,8 +149,9 @@ impl DisplayMap { ) -> Vec { let snapshot = self.buffer.read(cx).snapshot(cx); let edits = self.buffer_subscription.consume().into_inner(); + let tab_size = Self::tab_size(&self.buffer, cx); let (snapshot, edits) = self.fold_map.read(snapshot, edits); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); @@ -162,8 +166,9 @@ impl DisplayMap { pub fn remove_blocks(&mut self, ids: HashSet, cx: &mut ModelContext) { let snapshot = self.buffer.read(cx).snapshot(cx); let edits = self.buffer_subscription.consume().into_inner(); + let tab_size = Self::tab_size(&self.buffer, cx); let (snapshot, edits) = self.fold_map.read(snapshot, edits); - let (snapshot, edits) = self.tab_map.sync(snapshot, edits); + let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size); let (snapshot, edits) = self .wrap_map .update(cx, |map, cx| map.sync(snapshot, edits, cx)); @@ -198,6 +203,11 @@ impl DisplayMap { .update(cx, |map, cx| map.set_wrap_width(width, cx)) } + fn tab_size(buffer: &ModelHandle, cx: &mut ModelContext) -> u32 { + let language_name = buffer.read(cx).language(cx).map(|language| language.name()); + cx.global::().tab_size(language_name.as_deref()) + } + #[cfg(test)] pub fn is_rewrapping(&self, cx: &gpui::AppContext) -> bool { self.wrap_map.read(cx).is_rewrapping() @@ -539,6 +549,8 @@ pub mod tests { log::info!("tab size: {}", tab_size); log::info!("wrap width: {:?}", wrap_width); + cx.update(|cx| cx.set_global(Settings::test(cx))); + let buffer = cx.update(|cx| { if rng.gen() { let len = rng.gen_range(0..10); @@ -552,7 +564,6 @@ pub mod tests { let map = cx.add_model(|cx| { DisplayMap::new( buffer.clone(), - tab_size, font_id, font_size, wrap_width, @@ -762,27 +773,18 @@ pub mod tests { let font_cache = cx.font_cache(); - let tab_size = 4; let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); let font_size = 12.0; let wrap_width = Some(64.); + cx.set_global(Settings::test(cx)); let text = "one two three four five\nsix seven eight"; let buffer = MultiBuffer::build_simple(text, cx); let map = cx.add_model(|cx| { - DisplayMap::new( - buffer.clone(), - tab_size, - font_id, - font_size, - wrap_width, - 1, - 1, - cx, - ) + DisplayMap::new(buffer.clone(), font_id, font_size, wrap_width, 1, 1, cx) }); let snapshot = map.update(cx, |map, cx| map.snapshot(cx)); @@ -850,18 +852,17 @@ pub mod tests { #[gpui::test] fn test_text_chunks(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let text = sample_text(6, 6, 'a'); let buffer = MultiBuffer::build_simple(&text, cx); - let tab_size = 4; let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) .unwrap(); let font_size = 14.0; - let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) - }); + let map = + cx.add_model(|cx| DisplayMap::new(buffer.clone(), font_id, font_size, None, 1, 1, cx)); buffer.update(cx, |buffer, cx| { buffer.edit( vec![ @@ -926,12 +927,17 @@ pub mod tests { .unwrap(), ); language.set_theme(&theme); + cx.update(|cx| { + cx.set_global(Settings { + tab_size: 2, + ..Settings::test(cx) + }) + }); let buffer = cx.add_model(|cx| Buffer::new(0, text, cx).with_language(language, cx)); buffer.condition(&cx, |buf, _| !buf.is_parsing()).await; let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx)); - let tab_size = 2; let font_cache = cx.font_cache(); let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); let font_id = font_cache @@ -939,8 +945,7 @@ pub mod tests { .unwrap(); let font_size = 14.0; - let map = cx - .add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); + let map = cx.add_model(|cx| DisplayMap::new(buffer, font_id, font_size, None, 1, 1, cx)); assert_eq!( cx.update(|cx| syntax_chunks(0..5, &map, &theme, cx)), vec![ @@ -1014,22 +1019,22 @@ pub mod tests { ); language.set_theme(&theme); + cx.update(|cx| cx.set_global(Settings::test(cx))); + let buffer = cx.add_model(|cx| Buffer::new(0, text, cx).with_language(language, cx)); buffer.condition(&cx, |buf, _| !buf.is_parsing()).await; let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx)); let font_cache = cx.font_cache(); - let tab_size = 4; let family_id = font_cache.load_family(&["Courier"]).unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); let font_size = 16.0; - let map = cx.add_model(|cx| { - DisplayMap::new(buffer, tab_size, font_id, font_size, Some(40.0), 1, 1, cx) - }); + let map = + cx.add_model(|cx| DisplayMap::new(buffer, font_id, font_size, Some(40.0), 1, 1, cx)); assert_eq!( cx.update(|cx| syntax_chunks(0..5, &map, &theme, cx)), [ @@ -1061,6 +1066,7 @@ pub mod tests { async fn test_chunks_with_text_highlights(cx: &mut gpui::TestAppContext) { cx.foreground().set_block_on_ticks(usize::MAX..=usize::MAX); + cx.update(|cx| cx.set_global(Settings::test(cx))); let theme = SyntaxTheme::new(vec![ ("operator".to_string(), Color::red().into()), ("string".to_string(), Color::green().into()), @@ -1093,14 +1099,12 @@ pub mod tests { let buffer_snapshot = buffer.read_with(cx, |buffer, cx| buffer.snapshot(cx)); let font_cache = cx.font_cache(); - let tab_size = 4; let family_id = font_cache.load_family(&["Courier"]).unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); let font_size = 16.0; - let map = cx - .add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); + let map = cx.add_model(|cx| DisplayMap::new(buffer, font_id, font_size, None, 1, 1, cx)); enum MyType {} @@ -1139,6 +1143,7 @@ pub mod tests { #[gpui::test] fn test_clip_point(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(text: &str, shift_right: bool, bias: Bias, cx: &mut gpui::MutableAppContext) { let (unmarked_snapshot, mut markers) = marked_display_snapshot(text, cx); @@ -1190,6 +1195,8 @@ pub mod tests { #[gpui::test] fn test_clip_at_line_ends(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); + fn assert(text: &str, cx: &mut gpui::MutableAppContext) { let (mut unmarked_snapshot, markers) = marked_display_snapshot(text, cx); unmarked_snapshot.clip_at_line_ends = true; @@ -1207,9 +1214,9 @@ pub mod tests { #[gpui::test] fn test_tabs_with_multibyte_chars(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let text = "✅\t\tα\nβ\t\n🏀β\t\tγ"; let buffer = MultiBuffer::build_simple(text, cx); - let tab_size = 4; let font_cache = cx.font_cache(); let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); let font_id = font_cache @@ -1217,9 +1224,8 @@ pub mod tests { .unwrap(); let font_size = 14.0; - let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) - }); + let map = + cx.add_model(|cx| DisplayMap::new(buffer.clone(), font_id, font_size, None, 1, 1, cx)); let map = map.update(cx, |map, cx| map.snapshot(cx)); assert_eq!(map.text(), "✅ α\nβ \n🏀β γ"); assert_eq!( @@ -1267,17 +1273,16 @@ pub mod tests { #[gpui::test] fn test_max_point(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaa\n\t\tbbb", cx); - let tab_size = 4; let font_cache = cx.font_cache(); let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); let font_size = 14.0; - let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) - }); + let map = + cx.add_model(|cx| DisplayMap::new(buffer.clone(), font_id, font_size, None, 1, 1, cx)); assert_eq!( map.update(cx, |map, cx| map.snapshot(cx)).max_point(), DisplayPoint::new(1, 11) diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 9d1b7a75886b234bbcf54d92a31df9898b568469..d749b607eb5730fbb17b2def2696aaac6b6817f8 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -1157,7 +1157,7 @@ mod tests { let (folds_snapshot, fold_edits) = fold_map.read(buffer_snapshot, subscription.consume().into_inner()); - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits, 4); let (wraps_snapshot, wrap_edits) = wrap_map.update(cx, |wrap_map, cx| { wrap_map.sync(tabs_snapshot, tab_edits, cx) }); @@ -1296,7 +1296,8 @@ mod tests { let (folds_snapshot, fold_edits) = fold_map.read(buffer_snapshot.clone(), vec![]); - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = + tab_map.sync(folds_snapshot, fold_edits, tab_size); let (wraps_snapshot, wrap_edits) = wrap_map.update(cx, |wrap_map, cx| { wrap_map.sync(tabs_snapshot, tab_edits, cx) }); @@ -1318,7 +1319,8 @@ mod tests { let (folds_snapshot, fold_edits) = fold_map.read(buffer_snapshot.clone(), vec![]); - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = + tab_map.sync(folds_snapshot, fold_edits, tab_size); let (wraps_snapshot, wrap_edits) = wrap_map.update(cx, |wrap_map, cx| { wrap_map.sync(tabs_snapshot, tab_edits, cx) }); @@ -1338,7 +1340,7 @@ mod tests { } let (folds_snapshot, fold_edits) = fold_map.read(buffer_snapshot.clone(), buffer_edits); - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits, tab_size); let (wraps_snapshot, wrap_edits) = wrap_map.update(cx, |wrap_map, cx| { wrap_map.sync(tabs_snapshot, tab_edits, cx) }); diff --git a/crates/editor/src/display_map/tab_map.rs b/crates/editor/src/display_map/tab_map.rs index de76a6f2619c37eaa47d232c9889e3f1580fb6d0..77ec73d8bf8b3cb8d2e116b401155634efcdc62f 100644 --- a/crates/editor/src/display_map/tab_map.rs +++ b/crates/editor/src/display_map/tab_map.rs @@ -12,7 +12,7 @@ use text::Point; pub struct TabMap(Mutex); impl TabMap { - pub fn new(input: FoldSnapshot, tab_size: usize) -> (Self, TabSnapshot) { + pub fn new(input: FoldSnapshot, tab_size: u32) -> (Self, TabSnapshot) { let snapshot = TabSnapshot { fold_snapshot: input, tab_size, @@ -24,12 +24,13 @@ impl TabMap { &self, fold_snapshot: FoldSnapshot, mut fold_edits: Vec, + tab_size: u32, ) -> (TabSnapshot, Vec) { let mut old_snapshot = self.0.lock(); let max_offset = old_snapshot.fold_snapshot.len(); let new_snapshot = TabSnapshot { fold_snapshot, - tab_size: old_snapshot.tab_size, + tab_size, }; let mut tab_edits = Vec::with_capacity(fold_edits.len()); @@ -87,7 +88,7 @@ impl TabMap { #[derive(Clone)] pub struct TabSnapshot { pub fold_snapshot: FoldSnapshot, - pub tab_size: usize, + pub tab_size: u32, } impl TabSnapshot { @@ -234,7 +235,7 @@ impl TabSnapshot { .to_buffer_point(&self.fold_snapshot) } - fn expand_tabs(chars: impl Iterator, column: usize, tab_size: usize) -> usize { + fn expand_tabs(chars: impl Iterator, column: usize, tab_size: u32) -> usize { let mut expanded_chars = 0; let mut expanded_bytes = 0; let mut collapsed_bytes = 0; @@ -243,7 +244,7 @@ impl TabSnapshot { break; } if c == '\t' { - let tab_len = tab_size - expanded_chars % tab_size; + let tab_len = tab_size as usize - expanded_chars % tab_size as usize; expanded_bytes += tab_len; expanded_chars += tab_len; } else { @@ -259,7 +260,7 @@ impl TabSnapshot { mut chars: impl Iterator, column: usize, bias: Bias, - tab_size: usize, + tab_size: u32, ) -> (usize, usize, usize) { let mut expanded_bytes = 0; let mut expanded_chars = 0; @@ -270,7 +271,7 @@ impl TabSnapshot { } if c == '\t' { - let tab_len = tab_size - (expanded_chars % tab_size); + let tab_len = tab_size as usize - (expanded_chars % tab_size as usize); expanded_chars += tab_len; expanded_bytes += tab_len; if expanded_bytes > column { @@ -383,7 +384,7 @@ pub struct TabChunks<'a> { column: usize, output_position: Point, max_output_position: Point, - tab_size: usize, + tab_size: u32, skip_leading_tab: bool, } @@ -415,16 +416,16 @@ impl<'a> Iterator for TabChunks<'a> { }); } else { self.chunk.text = &self.chunk.text[1..]; - let mut len = self.tab_size - self.column % self.tab_size; + let mut len = self.tab_size - self.column as u32 % self.tab_size; let next_output_position = cmp::min( - self.output_position + Point::new(0, len as u32), + self.output_position + Point::new(0, len), self.max_output_position, ); - len = (next_output_position.column - self.output_position.column) as usize; - self.column += len; + len = next_output_position.column - self.output_position.column; + self.column += len as usize; self.output_position = next_output_position; return Some(Chunk { - text: &SPACES[0..len], + text: &SPACES[0..len as usize], ..self.chunk }); } diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 2fab37fb30997ce867994b922f89add56e47d5d9..790cc8017b064bce5403a3900249e69c5bf8be23 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -1104,7 +1104,8 @@ mod tests { } 20..=39 => { for (folds_snapshot, fold_edits) in fold_map.randomly_mutate(&mut rng) { - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = + tab_map.sync(folds_snapshot, fold_edits, tab_size); let (mut snapshot, wrap_edits) = wrap_map.update(cx, |map, cx| map.sync(tabs_snapshot, tab_edits, cx)); snapshot.check_invariants(); @@ -1129,7 +1130,7 @@ mod tests { "Unwrapped text (unexpanded tabs): {:?}", folds_snapshot.text() ); - let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits); + let (tabs_snapshot, tab_edits) = tab_map.sync(folds_snapshot, fold_edits, tab_size); log::info!("Unwrapped text (expanded tabs): {:?}", tabs_snapshot.text()); let unwrapped_text = tabs_snapshot.text(); diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 46d71ebeae2e00d43e9fc0cf70690b03f907b7d1..d52e456b959bfccae5eb6dd4f7e9dd15a1689681 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1010,7 +1010,6 @@ impl Editor { let style = build_style(&*settings, get_field_editor_theme, None, cx); DisplayMap::new( buffer.clone(), - settings.tab_size, style.text.font_id, style.text.font_size, None, @@ -3006,13 +3005,14 @@ impl Editor { ) .flat_map(str::chars) .count(); - let chars_to_next_tab_stop = tab_size - (char_column % tab_size); + let chars_to_next_tab_stop = + tab_size - (char_column as u32 % tab_size); buffer.edit( [selection.start..selection.start], - " ".repeat(chars_to_next_tab_stop), + " ".repeat(chars_to_next_tab_stop as usize), cx, ); - selection.start.column += chars_to_next_tab_stop as u32; + selection.start.column += chars_to_next_tab_stop; selection.end = selection.start; } }); @@ -3055,12 +3055,12 @@ impl Editor { } for row in start_row..end_row { - let indent_column = buffer.read(cx).indent_column_for_line(row) as usize; + let indent_column = buffer.read(cx).indent_column_for_line(row); let columns_to_next_tab_stop = tab_size - (indent_column % tab_size); let row_start = Point::new(row, 0); buffer.edit( [row_start..row_start], - " ".repeat(columns_to_next_tab_stop), + " ".repeat(columns_to_next_tab_stop as usize), cx, ); @@ -3101,11 +3101,11 @@ impl Editor { } for row in rows { - let column = buffer.indent_column_for_line(row) as usize; + let column = buffer.indent_column_for_line(row); if column > 0 { - let mut deletion_len = (column % tab_size) as u32; + let mut deletion_len = column % tab_size; if deletion_len == 0 { - deletion_len = tab_size as u32; + deletion_len = tab_size; } deletion_ranges.push(Point::new(row, 0)..Point::new(row, deletion_len)); last_outdent = Some(row); diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index cf2d772b16627bce0ca40409649856157e19405f..d5f0f480fb93e0f55f668cf2610d8260f994e544 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -268,9 +268,11 @@ mod tests { use super::*; use crate::{test::marked_display_snapshot, Buffer, DisplayMap, MultiBuffer}; use language::Point; + use settings::Settings; #[gpui::test] fn test_previous_word_start(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) { let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); assert_eq!( @@ -297,6 +299,7 @@ mod tests { #[gpui::test] fn test_previous_subword_start(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) { let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); assert_eq!( @@ -330,6 +333,7 @@ mod tests { #[gpui::test] fn test_find_preceding_boundary(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert( marked_text: &str, cx: &mut gpui::MutableAppContext, @@ -361,6 +365,7 @@ mod tests { #[gpui::test] fn test_next_word_end(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) { let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); assert_eq!( @@ -384,6 +389,7 @@ mod tests { #[gpui::test] fn test_next_subword_end(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) { let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); assert_eq!( @@ -416,6 +422,7 @@ mod tests { #[gpui::test] fn test_find_boundary(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert( marked_text: &str, cx: &mut gpui::MutableAppContext, @@ -447,6 +454,7 @@ mod tests { #[gpui::test] fn test_surrounding_word(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) { let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); assert_eq!( @@ -467,6 +475,7 @@ mod tests { #[gpui::test] fn test_move_up_and_down_with_excerpts(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); let font_id = cx .font_cache() @@ -487,7 +496,7 @@ mod tests { multibuffer }); let display_map = - cx.add_model(|cx| DisplayMap::new(multibuffer, 2, font_id, 14.0, None, 2, 2, cx)); + cx.add_model(|cx| DisplayMap::new(multibuffer, font_id, 14.0, None, 2, 2, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); assert_eq!(snapshot.text(), "\n\nabc\ndefg\n\n\nhijkl\nmn"); diff --git a/crates/editor/src/test.rs b/crates/editor/src/test.rs index e80547c9dddcd0827d2fa527b20a84d0c6c9df55..7de488a7c70ea1d3cc93e20fd79dbeab80141835 100644 --- a/crates/editor/src/test.rs +++ b/crates/editor/src/test.rs @@ -20,7 +20,6 @@ pub fn marked_display_snapshot( ) -> (DisplaySnapshot, Vec) { let (unmarked_text, markers) = marked_text(text); - let tab_size = 4; let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); let font_id = cx .font_cache() @@ -30,7 +29,7 @@ pub fn marked_display_snapshot( let buffer = MultiBuffer::build_simple(&unmarked_text, cx); let display_map = - cx.add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); + cx.add_model(|cx| DisplayMap::new(buffer, font_id, font_size, None, 1, 1, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); let markers = markers .into_iter() diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 7dfe9a54deabce916e496b77a9e46fa2dede6840..7c4bfbd93d52adf844b81ca1c774abc5b857ca2c 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -8,6 +8,7 @@ use gpui::{ ViewContext, ViewHandle, WeakViewHandle, }; use project::{Project, ProjectPath, WorktreeId}; +use settings::Settings; use std::{ cmp, path::Path, @@ -21,7 +22,6 @@ use workspace::{ menu::{Confirm, SelectNext, SelectPrev}, Workspace, }; -use settings::Settings; pub struct FileFinder { handle: WeakViewHandle, diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 0888e3347edc8ea59e09e8f99f6315147db6e248..6eb5a8f6165cd2e5053701474018c7365e18072a 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1019,7 +1019,10 @@ impl MutableAppContext { .insert(TypeId::of::(), handler) .is_some() { - panic!("registered multiple global handlers for the same action type"); + panic!( + "registered multiple global handlers for {}", + type_name::() + ); } } @@ -2355,11 +2358,11 @@ impl AppContext { } pub fn global(&self) -> &T { - self.globals - .get(&TypeId::of::()) - .expect("no app state has been added for this type") - .downcast_ref() - .unwrap() + if let Some(global) = self.globals.get(&TypeId::of::()) { + global.downcast_ref().unwrap() + } else { + panic!("no global has been added for {}", type_name::()); + } } } diff --git a/crates/project/Cargo.toml b/crates/project/Cargo.toml index 89f6999efa17c0d3bbae9b50d7115d1d4fd7ce99..8fda3aa0f32e9580c7a82a9ece6c3d3653a8a851 100644 --- a/crates/project/Cargo.toml +++ b/crates/project/Cargo.toml @@ -25,6 +25,7 @@ gpui = { path = "../gpui" } language = { path = "../language" } lsp = { path = "../lsp" } rpc = { path = "../rpc" } +settings = { path = "../settings" } sum_tree = { path = "../sum_tree" } util = { path = "../util" } aho-corasick = "0.7" diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index b3fe42bbd3da47e128cf227957fe46aa78edb06b..d9a905223595facd945adb0567900cbf939c945b 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -28,6 +28,7 @@ use parking_lot::Mutex; use postage::watch; use rand::prelude::*; use search::SearchQuery; +use settings::Settings; use sha2::{Digest, Sha256}; use similar::{ChangeTag, TextDiff}; use std::{ @@ -2173,6 +2174,10 @@ impl Project { lsp::Url::from_file_path(&buffer_abs_path).unwrap(), ); let capabilities = &language_server.capabilities(); + let tab_size = cx.update(|cx| { + let language_name = buffer.read(cx).language().map(|language| language.name()); + cx.global::().tab_size(language_name.as_deref()) + }); let lsp_edits = if capabilities .document_formatting_provider .as_ref() @@ -2182,7 +2187,7 @@ impl Project { .request::(lsp::DocumentFormattingParams { text_document, options: lsp::FormattingOptions { - tab_size: 4, + tab_size, insert_spaces: true, insert_final_newline: Some(true), ..Default::default() diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 5dc93245b97739e35ca1bf5ef5b216d6432aed99..c87a3a2391218ef54e894163999773cfde885bff 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -8,9 +8,9 @@ use gpui::{ }; use language::OffsetRangeExt; use project::search::SearchQuery; +use settings::Settings; use std::ops::Range; use workspace::{ItemHandle, Pane, ToolbarItemLocation, ToolbarItemView}; -use settings::Settings; action!(Deploy, bool); action!(Dismiss); diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 467456b2fc2d15a7daa6f394bc843ffa177c9e22..c897586017bf40b7fb2963fa0c389fb5ca7c0c9f 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -11,7 +11,7 @@ pub struct Settings { pub buffer_font_family: FamilyId, pub buffer_font_size: f32, pub vim_mode: bool, - pub tab_size: usize, + pub tab_size: u32, pub soft_wrap: SoftWrap, pub preferred_line_length: u32, pub language_overrides: HashMap, LanguageOverride>, @@ -20,7 +20,7 @@ pub struct Settings { #[derive(Clone, Debug, Default, Deserialize, JsonSchema)] pub struct LanguageOverride { - pub tab_size: Option, + pub tab_size: Option, pub soft_wrap: Option, pub preferred_line_length: Option, } @@ -81,7 +81,7 @@ impl Settings { self } - pub fn tab_size(&self, language: Option<&str>) -> usize { + pub fn tab_size(&self, language: Option<&str>) -> u32 { language .and_then(|language| self.language_overrides.get(language)) .and_then(|settings| settings.tab_size) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index a13cbe86f9fda295155688fe5de324a6d1082fb8..653788187b72e9cde958cc499e4da1c54464a4ab 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -48,6 +48,20 @@ fn main() { soft_wrap: Some(settings::SoftWrap::PreferredLineLength), ..Default::default() }, + ) + .with_overrides( + "Rust", + settings::LanguageOverride { + tab_size: Some(4), + ..Default::default() + }, + ) + .with_overrides( + "TypeScript", + settings::LanguageOverride { + tab_size: Some(2), + ..Default::default() + }, ); let settings_file = load_settings_file(&app, fs.clone()); From 36f4d8f9e4ea6aff145608a528a6721e8e8bf2dc Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 6 Apr 2022 10:35:29 -0700 Subject: [PATCH 097/245] Fix typescript indent size --- styles/src/buildThemes.ts | 14 +- styles/src/buildTokens.ts | 148 +++++----- styles/src/styleTree/app.ts | 54 ++-- styles/src/styleTree/chatPanel.ts | 194 ++++++------- styles/src/styleTree/components.ts | 106 +++---- styles/src/styleTree/contactsPanel.ts | 108 +++---- styles/src/styleTree/editor.ts | 272 +++++++++--------- styles/src/styleTree/projectPanel.ts | 56 ++-- styles/src/styleTree/search.ts | 144 +++++----- styles/src/styleTree/selectorModal.ts | 104 +++---- styles/src/styleTree/workspace.ts | 280 +++++++++--------- styles/src/themes/dark.ts | 394 +++++++++++++------------- styles/src/themes/light.ts | 390 ++++++++++++------------- styles/src/themes/theme.ts | 240 ++++++++-------- styles/src/tokens.ts | 2 +- styles/src/utils/color.ts | 70 ++--- styles/src/utils/snakeCase.ts | 36 +-- 17 files changed, 1306 insertions(+), 1306 deletions(-) diff --git a/styles/src/buildThemes.ts b/styles/src/buildThemes.ts index 42770c1c89194749e4619b75a1aa4886dad549b7..ccbaf82c7ff1f8ed9470ad1945c607de5bf9db43 100644 --- a/styles/src/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -7,11 +7,11 @@ import snakeCase from "./utils/snakeCase"; const themes = [dark, light]; for (let theme of themes) { - let styleTree = snakeCase(app(theme)); - let styleTreeJSON = JSON.stringify(styleTree, null, 2); - let outPath = path.resolve( - `${__dirname}/../../crates/zed/assets/themes/${theme.name}.json` - ); - fs.writeFileSync(outPath, styleTreeJSON); - console.log(`- ${outPath} created`); + let styleTree = snakeCase(app(theme)); + let styleTreeJSON = JSON.stringify(styleTree, null, 2); + let outPath = path.resolve( + `${__dirname}/../../crates/zed/assets/themes/${theme.name}.json` + ); + fs.writeFileSync(outPath, styleTreeJSON); + console.log(`- ${outPath} created`); } diff --git a/styles/src/buildTokens.ts b/styles/src/buildTokens.ts index 4cad6827a2876498b230fb6676adf2055e00715c..ceedd27b2176d2d3003163d7f949cb1ec2741819 100644 --- a/styles/src/buildTokens.ts +++ b/styles/src/buildTokens.ts @@ -7,80 +7,80 @@ import { colors, fontFamilies, fontSizes, fontWeights } from "./tokens"; // Organize theme tokens function themeTokens(theme: Theme) { - return { - meta: { - themeName: theme.name, - }, - text: theme.textColor, - icon: theme.iconColor, - background: theme.backgroundColor, - border: theme.borderColor, - editor: theme.editor, - syntax: { - primary: { - value: theme.syntax.primary.color.value, - type: "color", - }, - comment: { - value: theme.syntax.comment.color.value, - type: "color", - }, - keyword: { - value: theme.syntax.keyword.color.value, - type: "color", - }, - function: { - value: theme.syntax.function.color.value, - type: "color", - }, - type: { - value: theme.syntax.type.color.value, - type: "color", - }, - variant: { - value: theme.syntax.variant.color.value, - type: "color", - }, - property: { - value: theme.syntax.property.color.value, - type: "color", - }, - enum: { - value: theme.syntax.enum.color.value, - type: "color", - }, - operator: { - value: theme.syntax.operator.color.value, - type: "color", - }, - string: { - value: theme.syntax.string.color.value, - type: "color", - }, - number: { - value: theme.syntax.number.color.value, - type: "color", - }, - boolean: { - value: theme.syntax.boolean.color.value, - type: "color", - }, - }, - player: theme.player, - shadowAlpha: theme.shadowAlpha, - }; + return { + meta: { + themeName: theme.name, + }, + text: theme.textColor, + icon: theme.iconColor, + background: theme.backgroundColor, + border: theme.borderColor, + editor: theme.editor, + syntax: { + primary: { + value: theme.syntax.primary.color.value, + type: "color", + }, + comment: { + value: theme.syntax.comment.color.value, + type: "color", + }, + keyword: { + value: theme.syntax.keyword.color.value, + type: "color", + }, + function: { + value: theme.syntax.function.color.value, + type: "color", + }, + type: { + value: theme.syntax.type.color.value, + type: "color", + }, + variant: { + value: theme.syntax.variant.color.value, + type: "color", + }, + property: { + value: theme.syntax.property.color.value, + type: "color", + }, + enum: { + value: theme.syntax.enum.color.value, + type: "color", + }, + operator: { + value: theme.syntax.operator.color.value, + type: "color", + }, + string: { + value: theme.syntax.string.color.value, + type: "color", + }, + number: { + value: theme.syntax.number.color.value, + type: "color", + }, + boolean: { + value: theme.syntax.boolean.color.value, + type: "color", + }, + }, + player: theme.player, + shadowAlpha: theme.shadowAlpha, + }; } // Organize core tokens const coreTokens = { - color: { - ...colors, - }, - text: { - family: fontFamilies, - weight: fontWeights, - }, - size: fontSizes, + color: { + ...colors, + }, + text: { + family: fontFamilies, + weight: fontWeights, + }, + size: fontSizes, }; const combinedTokens: any = {}; @@ -98,10 +98,10 @@ combinedTokens.core = coreTokens; // We write `${theme}.json` as a separate file for the design team's convenience, but it isn't consumed by Figma Tokens directly. let themes = [dark, light]; themes.forEach((theme) => { - const themePath = `${distPath}/${theme.name}.json` - fs.writeFileSync(themePath, JSON.stringify(themeTokens(theme), null, 2)); - console.log(`- ${themePath} created`); - combinedTokens[theme.name] = themeTokens(theme); + const themePath = `${distPath}/${theme.name}.json` + fs.writeFileSync(themePath, JSON.stringify(themeTokens(theme), null, 2)); + console.log(`- ${themePath} created`); + combinedTokens[theme.name] = themeTokens(theme); }); // Write combined tokens to `tokens.json`. This file is consumed by the Figma Tokens plugin to keep our designs consistent with the app. diff --git a/styles/src/styleTree/app.ts b/styles/src/styleTree/app.ts index 85bb8b09b83df5515862758e58dac66e524bffcc..03e527d03dec98755e84b789ad016a7aa67a3306 100644 --- a/styles/src/styleTree/app.ts +++ b/styles/src/styleTree/app.ts @@ -9,35 +9,35 @@ import selectorModal from "./selectorModal"; import workspace from "./workspace"; export const panel = { - padding: { top: 12, left: 12, bottom: 12, right: 12 }, + padding: { top: 12, left: 12, bottom: 12, right: 12 }, }; export default function app(theme: Theme): Object { - return { - selector: selectorModal(theme), - workspace: workspace(theme), - editor: editor(theme), - projectDiagnostics: { - tabIconSpacing: 4, - tabIconWidth: 13, - tabSummarySpacing: 10, - emptyMessage: text(theme, "sans", "primary", { size: "lg" }), - statusBarItem: { - ...text(theme, "sans", "muted"), - margin: { - right: 10, - }, - }, + return { + selector: selectorModal(theme), + workspace: workspace(theme), + editor: editor(theme), + projectDiagnostics: { + tabIconSpacing: 4, + tabIconWidth: 13, + tabSummarySpacing: 10, + emptyMessage: text(theme, "sans", "primary", { size: "lg" }), + statusBarItem: { + ...text(theme, "sans", "muted"), + margin: { + right: 10, }, - projectPanel: projectPanel(theme), - chatPanel: chatPanel(theme), - contactsPanel: contactsPanel(theme), - search: search(theme), - breadcrumbs: { - ...text(theme, "sans", "primary"), - padding: { - left: 6, - }, - } - }; + }, + }, + projectPanel: projectPanel(theme), + chatPanel: chatPanel(theme), + contactsPanel: contactsPanel(theme), + search: search(theme), + breadcrumbs: { + ...text(theme, "sans", "primary"), + padding: { + left: 6, + }, + } + }; } diff --git a/styles/src/styleTree/chatPanel.ts b/styles/src/styleTree/chatPanel.ts index 6bcf38ec06afabd72d7107266c10ef1704862bc7..69b5f3baa0d74c03e4ff5e0a81ff4fc6616afdfc 100644 --- a/styles/src/styleTree/chatPanel.ts +++ b/styles/src/styleTree/chatPanel.ts @@ -1,108 +1,108 @@ import Theme from "../themes/theme"; import { panel } from "./app"; import { - backgroundColor, - border, - player, - shadow, - text, - TextColor + backgroundColor, + border, + player, + shadow, + text, + TextColor } from "./components"; export default function chatPanel(theme: Theme) { - function channelSelectItem( - theme: Theme, - textColor: TextColor, - hovered: boolean - ) { - return { - name: text(theme, "sans", textColor), - padding: 4, - hash: { - ...text(theme, "sans", "muted"), - margin: { - right: 8, - }, - }, - background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, - cornerRadius: hovered ? 6 : 0, - }; - } - - const message = { - body: text(theme, "sans", "secondary"), - timestamp: text(theme, "sans", "muted", { size: "sm" }), - padding: { - bottom: 6, - }, - sender: { - ...text(theme, "sans", "primary", { weight: "bold" }), - margin: { - right: 8, - }, + function channelSelectItem( + theme: Theme, + textColor: TextColor, + hovered: boolean + ) { + return { + name: text(theme, "sans", textColor), + padding: 4, + hash: { + ...text(theme, "sans", "muted"), + margin: { + right: 8, }, + }, + background: hovered ? backgroundColor(theme, 300, "hovered") : undefined, + cornerRadius: hovered ? 6 : 0, }; + } - return { - ...panel, - channelName: text(theme, "sans", "primary", { weight: "bold" }), - channelNameHash: { - ...text(theme, "sans", "muted"), - padding: { - right: 8, - }, - }, - channelSelect: { - header: { - ...channelSelectItem(theme, "primary", false), - padding: { - bottom: 4, - left: 0, - }, - }, - item: channelSelectItem(theme, "secondary", false), - hoveredItem: channelSelectItem(theme, "secondary", true), - activeItem: channelSelectItem(theme, "primary", false), - hoveredActiveItem: channelSelectItem(theme, "primary", true), - menu: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - padding: 4, - border: border(theme, "primary"), - shadow: shadow(theme), - }, - }, - signInPrompt: text(theme, "sans", "secondary", { underline: true }), - hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), - message, - pendingMessage: { - ...message, - body: { - ...message.body, - color: theme.textColor.muted.value, - }, - sender: { - ...message.sender, - color: theme.textColor.muted.value, - }, - timestamp: { - ...message.timestamp, - color: theme.textColor.muted.value, - }, - }, - inputEditor: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - text: text(theme, "mono", "primary"), - placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), - selection: player(theme, 1).selection, - border: border(theme, "secondary"), - padding: { - bottom: 7, - left: 8, - right: 8, - top: 7, - }, + const message = { + body: text(theme, "sans", "secondary"), + timestamp: text(theme, "sans", "muted", { size: "sm" }), + padding: { + bottom: 6, + }, + sender: { + ...text(theme, "sans", "primary", { weight: "bold" }), + margin: { + right: 8, + }, + }, + }; + + return { + ...panel, + channelName: text(theme, "sans", "primary", { weight: "bold" }), + channelNameHash: { + ...text(theme, "sans", "muted"), + padding: { + right: 8, + }, + }, + channelSelect: { + header: { + ...channelSelectItem(theme, "primary", false), + padding: { + bottom: 4, + left: 0, }, - }; + }, + item: channelSelectItem(theme, "secondary", false), + hoveredItem: channelSelectItem(theme, "secondary", true), + activeItem: channelSelectItem(theme, "primary", false), + hoveredActiveItem: channelSelectItem(theme, "primary", true), + menu: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 4, + border: border(theme, "primary"), + shadow: shadow(theme), + }, + }, + signInPrompt: text(theme, "sans", "secondary", { underline: true }), + hoveredSignInPrompt: text(theme, "sans", "primary", { underline: true }), + message, + pendingMessage: { + ...message, + body: { + ...message.body, + color: theme.textColor.muted.value, + }, + sender: { + ...message.sender, + color: theme.textColor.muted.value, + }, + timestamp: { + ...message.timestamp, + color: theme.textColor.muted.value, + }, + }, + inputEditor: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + text: text(theme, "mono", "primary"), + placeholderText: text(theme, "mono", "placeholder", { size: "sm" }), + selection: player(theme, 1).selection, + border: border(theme, "secondary"), + padding: { + bottom: 7, + left: 8, + right: 8, + top: 7, + }, + }, + }; } diff --git a/styles/src/styleTree/components.ts b/styles/src/styleTree/components.ts index 08a8aa08545406c35723479ba99bc983f5199b6f..d0412af02e6b7e3a11ef9aae978d846c4e6da551 100644 --- a/styles/src/styleTree/components.ts +++ b/styles/src/styleTree/components.ts @@ -5,89 +5,89 @@ import { Color } from "../utils/color"; export type TextColor = keyof Theme["textColor"]; export function text( - theme: Theme, - fontFamily: keyof typeof fontFamilies, - color: TextColor, - properties?: { - size?: keyof typeof fontSizes; - weight?: FontWeight; - underline?: boolean; - } + theme: Theme, + fontFamily: keyof typeof fontFamilies, + color: TextColor, + properties?: { + size?: keyof typeof fontSizes; + weight?: FontWeight; + underline?: boolean; + } ) { - let size = fontSizes[properties?.size || "sm"].value; - return { - family: fontFamilies[fontFamily].value, - color: theme.textColor[color].value, - ...properties, - size, - }; + let size = fontSizes[properties?.size || "sm"].value; + return { + family: fontFamilies[fontFamily].value, + color: theme.textColor[color].value, + ...properties, + size, + }; } export function textColor(theme: Theme, color: TextColor) { - return theme.textColor[color].value; + return theme.textColor[color].value; } export type BorderColor = keyof Theme["borderColor"]; export interface BorderOptions { - width?: number; - top?: boolean; - bottom?: boolean; - left?: boolean; - right?: boolean; - overlay?: boolean; + width?: number; + top?: boolean; + bottom?: boolean; + left?: boolean; + right?: boolean; + overlay?: boolean; } export function border( - theme: Theme, - color: BorderColor, - options?: BorderOptions + theme: Theme, + color: BorderColor, + options?: BorderOptions ) { - return { - color: borderColor(theme, color), - width: 1, - ...options, - }; + return { + color: borderColor(theme, color), + width: 1, + ...options, + }; } export function borderColor(theme: Theme, color: BorderColor) { - return theme.borderColor[color].value; + return theme.borderColor[color].value; } export type IconColor = keyof Theme["iconColor"]; export function iconColor(theme: Theme, color: IconColor) { - return theme.iconColor[color].value; + return theme.iconColor[color].value; } export type PlayerIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; export interface Player { - selection: { - cursor: Color; - selection: Color; - }; + selection: { + cursor: Color; + selection: Color; + }; } export function player( - theme: Theme, - playerNumber: PlayerIndex, + theme: Theme, + playerNumber: PlayerIndex, ): Player { - return { - selection: { - cursor: theme.player[playerNumber].cursorColor.value, - selection: theme.player[playerNumber].selectionColor.value, - }, - }; + return { + selection: { + cursor: theme.player[playerNumber].cursorColor.value, + selection: theme.player[playerNumber].selectionColor.value, + }, + }; } export type BackgroundColor = keyof Theme["backgroundColor"]; export type BackgroundState = keyof BackgroundColorSet; export function backgroundColor( - theme: Theme, - name: BackgroundColor, - state?: BackgroundState, + theme: Theme, + name: BackgroundColor, + state?: BackgroundState, ): Color { - return theme.backgroundColor[name][state || "base"].value; + return theme.backgroundColor[name][state || "base"].value; } export function shadow(theme: Theme) { - return { - blur: 16, - color: chroma("black").alpha(theme.shadowAlpha.value).hex(), - offset: [0, 2], - }; + return { + blur: 16, + color: chroma("black").alpha(theme.shadowAlpha.value).hex(), + offset: [0, 2], + }; } diff --git a/styles/src/styleTree/contactsPanel.ts b/styles/src/styleTree/contactsPanel.ts index 0939018126f87486a1f5f3197be12452ef17fa9b..e22a09e25f5db3c3ab5fb027b563d834913a3180 100644 --- a/styles/src/styleTree/contactsPanel.ts +++ b/styles/src/styleTree/contactsPanel.ts @@ -3,60 +3,60 @@ import { panel } from "./app"; import { backgroundColor, borderColor, text } from "./components"; export default function(theme: Theme) { - const project = { - guestAvatarSpacing: 4, - height: 24, - guestAvatar: { - cornerRadius: 8, - width: 14, - }, - name: { - ...text(theme, "mono", "placeholder", { size: "sm" }), - margin: { - right: 6, - }, - }, - padding: { - left: 8, - }, - }; + const project = { + guestAvatarSpacing: 4, + height: 24, + guestAvatar: { + cornerRadius: 8, + width: 14, + }, + name: { + ...text(theme, "mono", "placeholder", { size: "sm" }), + margin: { + right: 6, + }, + }, + padding: { + left: 8, + }, + }; - const sharedProject = { - ...project, - background: backgroundColor(theme, 300), - cornerRadius: 6, - name: { - ...project.name, - ...text(theme, "mono", "secondary", { size: "sm" }), - }, - }; + const sharedProject = { + ...project, + background: backgroundColor(theme, 300), + cornerRadius: 6, + name: { + ...project.name, + ...text(theme, "mono", "secondary", { size: "sm" }), + }, + }; - return { - ...panel, - hostRowHeight: 28, - treeBranchColor: borderColor(theme, "muted"), - treeBranchWidth: 1, - hostAvatar: { - cornerRadius: 10, - width: 18, - }, - hostUsername: { - ...text(theme, "mono", "primary", { size: "sm" }), - padding: { - left: 8, - }, - }, - project, - sharedProject, - hoveredSharedProject: { - ...sharedProject, - background: backgroundColor(theme, 300, "hovered"), - cornerRadius: 6, - }, - unsharedProject: project, - hoveredUnsharedProject: { - ...project, - cornerRadius: 6, - }, - } + return { + ...panel, + hostRowHeight: 28, + treeBranchColor: borderColor(theme, "muted"), + treeBranchWidth: 1, + hostAvatar: { + cornerRadius: 10, + width: 18, + }, + hostUsername: { + ...text(theme, "mono", "primary", { size: "sm" }), + padding: { + left: 8, + }, + }, + project, + sharedProject, + hoveredSharedProject: { + ...sharedProject, + background: backgroundColor(theme, 300, "hovered"), + cornerRadius: 6, + }, + unsharedProject: project, + hoveredUnsharedProject: { + ...project, + cornerRadius: 6, + }, + } } diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index 9fb96e09b71a613c3e5c0791865f2562b655162c..261f0cfbbec96832a1b294c04e3bfc0cc8db6787 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -1,146 +1,146 @@ import Theme from "../themes/theme"; import { - backgroundColor, - border, - iconColor, - player, - text, - TextColor + backgroundColor, + border, + iconColor, + player, + text, + TextColor } from "./components"; export default function editor(theme: Theme) { - const autocompleteItem = { - cornerRadius: 6, - padding: { - bottom: 2, - left: 6, - right: 6, - top: 2, - }, - }; - - function diagnostic(theme: Theme, color: TextColor) { - return { - textScaleFactor: 0.857, - header: { - border: border(theme, "primary", { - top: true, - }), - }, - message: { - text: text(theme, "sans", color, { size: "sm" }), - highlightText: text(theme, "sans", color, { - size: "sm", - weight: "bold", - }), - }, - }; - } + const autocompleteItem = { + cornerRadius: 6, + padding: { + bottom: 2, + left: 6, + right: 6, + top: 2, + }, + }; + function diagnostic(theme: Theme, color: TextColor) { return { - // textColor: theme.syntax.primary.color, - textColor: theme.syntax.primary.color.value, - background: backgroundColor(theme, 500), - activeLineBackground: theme.editor.line.active.value, - codeActionsIndicator: iconColor(theme, "muted"), - diffBackgroundDeleted: backgroundColor(theme, "error"), - diffBackgroundInserted: backgroundColor(theme, "ok"), - documentHighlightReadBackground: theme.editor.highlight.occurrence.value, - documentHighlightWriteBackground: theme.editor.highlight.activeOccurrence.value, - errorColor: theme.textColor.error.value, - gutterBackground: backgroundColor(theme, 500), - gutterPaddingFactor: 3.5, - highlightedLineBackground: theme.editor.line.highlighted.value, - lineNumber: theme.editor.gutter.primary.value, - lineNumberActive: theme.editor.gutter.active.value, - renameFade: 0.6, - unnecessaryCodeFade: 0.5, - selection: player(theme, 1).selection, - guestSelections: [ - player(theme, 2).selection, - player(theme, 3).selection, - player(theme, 4).selection, - player(theme, 5).selection, - player(theme, 6).selection, - player(theme, 7).selection, - player(theme, 8).selection, - ], - autocomplete: { - background: backgroundColor(theme, 500), - cornerRadius: 6, - padding: 6, - border: border(theme, "secondary"), - item: autocompleteItem, - hoveredItem: { - ...autocompleteItem, - background: backgroundColor(theme, 500, "hovered"), - }, - margin: { - left: -14, - }, - matchHighlight: text(theme, "mono", "feature"), - selectedItem: { - ...autocompleteItem, - background: backgroundColor(theme, 500, "active"), - }, - }, - diagnosticHeader: { - background: backgroundColor(theme, 300), - iconWidthFactor: 1.5, - textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. - border: border(theme, "secondary", { - bottom: true, - top: true, - }), - code: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 10, - }, - }, - message: { - highlightText: text(theme, "sans", "primary", { - size: "sm", - weight: "bold", - }), - text: text(theme, "sans", "secondary", { size: "sm" }), - }, - }, - diagnosticPathHeader: { - background: theme.editor.line.active.value, - textScaleFactor: 0.857, - filename: text(theme, "mono", "primary", { size: "sm" }), - path: { - ...text(theme, "mono", "muted", { size: "sm" }), - margin: { - left: 12, - }, - }, + textScaleFactor: 0.857, + header: { + border: border(theme, "primary", { + top: true, + }), + }, + message: { + text: text(theme, "sans", color, { size: "sm" }), + highlightText: text(theme, "sans", color, { + size: "sm", + weight: "bold", + }), + }, + }; + } + + return { + // textColor: theme.syntax.primary.color, + textColor: theme.syntax.primary.color.value, + background: backgroundColor(theme, 500), + activeLineBackground: theme.editor.line.active.value, + codeActionsIndicator: iconColor(theme, "muted"), + diffBackgroundDeleted: backgroundColor(theme, "error"), + diffBackgroundInserted: backgroundColor(theme, "ok"), + documentHighlightReadBackground: theme.editor.highlight.occurrence.value, + documentHighlightWriteBackground: theme.editor.highlight.activeOccurrence.value, + errorColor: theme.textColor.error.value, + gutterBackground: backgroundColor(theme, 500), + gutterPaddingFactor: 3.5, + highlightedLineBackground: theme.editor.line.highlighted.value, + lineNumber: theme.editor.gutter.primary.value, + lineNumberActive: theme.editor.gutter.active.value, + renameFade: 0.6, + unnecessaryCodeFade: 0.5, + selection: player(theme, 1).selection, + guestSelections: [ + player(theme, 2).selection, + player(theme, 3).selection, + player(theme, 4).selection, + player(theme, 5).selection, + player(theme, 6).selection, + player(theme, 7).selection, + player(theme, 8).selection, + ], + autocomplete: { + background: backgroundColor(theme, 500), + cornerRadius: 6, + padding: 6, + border: border(theme, "secondary"), + item: autocompleteItem, + hoveredItem: { + ...autocompleteItem, + background: backgroundColor(theme, 500, "hovered"), + }, + margin: { + left: -14, + }, + matchHighlight: text(theme, "mono", "feature"), + selectedItem: { + ...autocompleteItem, + background: backgroundColor(theme, 500, "active"), + }, + }, + diagnosticHeader: { + background: backgroundColor(theme, 300), + iconWidthFactor: 1.5, + textScaleFactor: 0.857, // NateQ: Will we need dynamic sizing for text? If so let's create tokens for these. + border: border(theme, "secondary", { + bottom: true, + top: true, + }), + code: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 10, }, - errorDiagnostic: diagnostic(theme, "error"), - warningDiagnostic: diagnostic(theme, "warning"), - informationDiagnostic: diagnostic(theme, "info"), - hintDiagnostic: diagnostic(theme, "info"), - invalidErrorDiagnostic: diagnostic(theme, "muted"), - invalidHintDiagnostic: diagnostic(theme, "muted"), - invalidInformationDiagnostic: diagnostic(theme, "muted"), - invalidWarningDiagnostic: diagnostic(theme, "muted"), - syntax: { - keyword: theme.syntax.keyword.color.value, - function: theme.syntax.function.color.value, - string: theme.syntax.string.color.value, - type: theme.syntax.type.color.value, - number: theme.syntax.number.color.value, - comment: theme.syntax.comment.color.value, - property: theme.syntax.property.color.value, - variant: theme.syntax.variant.color.value, - constant: theme.syntax.constant.color.value, - title: { color: theme.syntax.title.color.value, weight: "bold" }, - emphasis: theme.textColor.feature.value, - "emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" }, - link_uri: { color: theme.syntax.linkUrl.color.value, underline: true }, - link_text: { color: theme.syntax.linkText.color.value, italic: true }, - list_marker: theme.syntax.punctuation.color.value, + }, + message: { + highlightText: text(theme, "sans", "primary", { + size: "sm", + weight: "bold", + }), + text: text(theme, "sans", "secondary", { size: "sm" }), + }, + }, + diagnosticPathHeader: { + background: theme.editor.line.active.value, + textScaleFactor: 0.857, + filename: text(theme, "mono", "primary", { size: "sm" }), + path: { + ...text(theme, "mono", "muted", { size: "sm" }), + margin: { + left: 12, }, - }; + }, + }, + errorDiagnostic: diagnostic(theme, "error"), + warningDiagnostic: diagnostic(theme, "warning"), + informationDiagnostic: diagnostic(theme, "info"), + hintDiagnostic: diagnostic(theme, "info"), + invalidErrorDiagnostic: diagnostic(theme, "muted"), + invalidHintDiagnostic: diagnostic(theme, "muted"), + invalidInformationDiagnostic: diagnostic(theme, "muted"), + invalidWarningDiagnostic: diagnostic(theme, "muted"), + syntax: { + keyword: theme.syntax.keyword.color.value, + function: theme.syntax.function.color.value, + string: theme.syntax.string.color.value, + type: theme.syntax.type.color.value, + number: theme.syntax.number.color.value, + comment: theme.syntax.comment.color.value, + property: theme.syntax.property.color.value, + variant: theme.syntax.variant.color.value, + constant: theme.syntax.constant.color.value, + title: { color: theme.syntax.title.color.value, weight: "bold" }, + emphasis: theme.textColor.feature.value, + "emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" }, + link_uri: { color: theme.syntax.linkUrl.color.value, underline: true }, + link_text: { color: theme.syntax.linkText.color.value, italic: true }, + list_marker: theme.syntax.punctuation.color.value, + }, + }; } diff --git a/styles/src/styleTree/projectPanel.ts b/styles/src/styleTree/projectPanel.ts index c55417579ac489188d1501a22ced8fd707214b0b..de9b1d88f3b7aa56a9cdeee06678d035a84b316d 100644 --- a/styles/src/styleTree/projectPanel.ts +++ b/styles/src/styleTree/projectPanel.ts @@ -4,34 +4,34 @@ import { panel } from "./app"; import { backgroundColor, iconColor, text, TextColor } from "./components"; export default function projectPanel(theme: Theme) { - function entry(theme: Theme, textColor: TextColor, background?: Color) { - return { - height: 22, - background, - iconColor: iconColor(theme, "muted"), - iconSize: 8, - iconSpacing: 8, - text: text(theme, "mono", textColor, { size: "sm" }), - }; - } - + function entry(theme: Theme, textColor: TextColor, background?: Color) { return { - ...panel, - entry: entry(theme, "secondary"), - hoveredEntry: entry( - theme, - "secondary", - backgroundColor(theme, 300, "hovered") - ), - selectedEntry: entry(theme, "primary"), - hoveredSelectedEntry: entry( - theme, - "primary", - backgroundColor(theme, 300, "hovered") - ), - padding: { - top: 6, - left: 12, - }, + height: 22, + background, + iconColor: iconColor(theme, "muted"), + iconSize: 8, + iconSpacing: 8, + text: text(theme, "mono", textColor, { size: "sm" }), }; + } + + return { + ...panel, + entry: entry(theme, "secondary"), + hoveredEntry: entry( + theme, + "secondary", + backgroundColor(theme, 300, "hovered") + ), + selectedEntry: entry(theme, "primary"), + hoveredSelectedEntry: entry( + theme, + "primary", + backgroundColor(theme, 300, "hovered") + ), + padding: { + top: 6, + left: 12, + }, + }; } diff --git a/styles/src/styleTree/search.ts b/styles/src/styleTree/search.ts index 7e08569acd0f9cbd80861db0be26b0ebfe961bc9..19046f49c4b70dcc8bac018d225bdbc110a03678 100644 --- a/styles/src/styleTree/search.ts +++ b/styles/src/styleTree/search.ts @@ -2,78 +2,78 @@ import Theme from "../themes/theme"; import { backgroundColor, border, player, text } from "./components"; export default function search(theme: Theme) { - const optionButton = { - ...text(theme, "mono", "secondary"), - background: backgroundColor(theme, 300), - cornerRadius: 6, - border: border(theme, "primary"), - margin: { - left: 1, - right: 1, - }, - padding: { - bottom: 1, - left: 6, - right: 6, - top: 1, - }, - }; + const optionButton = { + ...text(theme, "mono", "secondary"), + background: backgroundColor(theme, 300), + cornerRadius: 6, + border: border(theme, "primary"), + margin: { + left: 1, + right: 1, + }, + padding: { + bottom: 1, + left: 6, + right: 6, + top: 1, + }, + }; - const editor = { - background: backgroundColor(theme, 500), - cornerRadius: 6, - minWidth: 200, - maxWidth: 500, - placeholderText: text(theme, "mono", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "secondary"), - margin: { - right: 5, - }, - padding: { - top: 3, - bottom: 3, - left: 14, - right: 14, - }, - }; + const editor = { + background: backgroundColor(theme, 500), + cornerRadius: 6, + minWidth: 200, + maxWidth: 500, + placeholderText: text(theme, "mono", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "secondary"), + margin: { + right: 5, + }, + padding: { + top: 3, + bottom: 3, + left: 14, + right: 14, + }, + }; - return { - matchBackground: theme.editor.highlight.match.value, - tabIconSpacing: 4, - tabIconWidth: 14, - activeHoveredOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - activeOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - editor, - hoveredOptionButton: { - ...optionButton, - background: backgroundColor(theme, 100), - }, - invalidEditor: { - ...editor, - border: border(theme, "error"), - }, - matchIndex: { - ...text(theme, "mono", "muted"), - padding: 6, - }, - optionButton, - optionButtonGroup: { - padding: { - left: 2, - right: 2, - }, - }, - resultsStatus: { - ...text(theme, "mono", "primary"), - size: 18, - }, - }; + return { + matchBackground: theme.editor.highlight.match.value, + tabIconSpacing: 4, + tabIconWidth: 14, + activeHoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + activeOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + editor, + hoveredOptionButton: { + ...optionButton, + background: backgroundColor(theme, 100), + }, + invalidEditor: { + ...editor, + border: border(theme, "error"), + }, + matchIndex: { + ...text(theme, "mono", "muted"), + padding: 6, + }, + optionButton, + optionButtonGroup: { + padding: { + left: 2, + right: 2, + }, + }, + resultsStatus: { + ...text(theme, "mono", "primary"), + size: 18, + }, + }; } diff --git a/styles/src/styleTree/selectorModal.ts b/styles/src/styleTree/selectorModal.ts index 3e1925a179d5c9e0367f993a5433b9549ccc5af3..90570cc09374290dd842296e96f97ce0127be05d 100644 --- a/styles/src/styleTree/selectorModal.ts +++ b/styles/src/styleTree/selectorModal.ts @@ -2,58 +2,58 @@ import Theme from "../themes/theme"; import { backgroundColor, border, player, shadow, text } from "./components"; export default function selectorModal(theme: Theme): Object { - const item = { - padding: { - bottom: 4, - left: 16, - right: 16, - top: 4, - }, - cornerRadius: 6, - text: text(theme, "sans", "secondary"), - highlightText: text(theme, "sans", "feature", { weight: "bold" }), - }; + const item = { + padding: { + bottom: 4, + left: 16, + right: 16, + top: 4, + }, + cornerRadius: 6, + text: text(theme, "sans", "secondary"), + highlightText: text(theme, "sans", "feature", { weight: "bold" }), + }; - const activeItem = { - ...item, - background: backgroundColor(theme, 300, "active"), - text: text(theme, "sans", "primary"), - }; + const activeItem = { + ...item, + background: backgroundColor(theme, 300, "active"), + text: text(theme, "sans", "primary"), + }; - return { - background: backgroundColor(theme, 300), - cornerRadius: 6, - padding: 8, - item, - activeItem, - border: border(theme, "primary"), - empty: { - text: text(theme, "sans", "placeholder"), - padding: { - bottom: 4, - left: 16, - right: 16, - top: 8, - }, - }, - inputEditor: { - background: backgroundColor(theme, 500), - corner_radius: 6, - placeholderText: text(theme, "sans", "placeholder"), - selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), - border: border(theme, "secondary"), - padding: { - bottom: 7, - left: 16, - right: 16, - top: 7, - }, - }, - margin: { - bottom: 52, - top: 52, - }, - shadow: shadow(theme), - }; + return { + background: backgroundColor(theme, 300), + cornerRadius: 6, + padding: 8, + item, + activeItem, + border: border(theme, "primary"), + empty: { + text: text(theme, "sans", "placeholder"), + padding: { + bottom: 4, + left: 16, + right: 16, + top: 8, + }, + }, + inputEditor: { + background: backgroundColor(theme, 500), + corner_radius: 6, + placeholderText: text(theme, "sans", "placeholder"), + selection: player(theme, 1).selection, + text: text(theme, "mono", "primary"), + border: border(theme, "secondary"), + padding: { + bottom: 7, + left: 16, + right: 16, + top: 7, + }, + }, + margin: { + bottom: 52, + top: 52, + }, + shadow: shadow(theme), + }; } diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 42cd5b20d5cddc43d978390226c28cb6d4e82a0f..f9f1ff283e14417751f2a137914edc91b61c0105 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -1,150 +1,150 @@ import Theme from "../themes/theme"; -import { backgroundColor, border, borderColor, iconColor, text } from "./components"; +import { backgroundColor, border, iconColor, text } from "./components"; export default function workspace(theme: Theme) { - const signInPrompt = { - ...text(theme, "sans", "secondary", { size: "xs" }), - underline: true, - padding: { - right: 8, - }, - }; + const signInPrompt = { + ...text(theme, "sans", "secondary", { size: "xs" }), + underline: true, + padding: { + right: 8, + }, + }; - const tab = { - height: 32, - background: backgroundColor(theme, 300), - iconClose: iconColor(theme, "muted"), - iconCloseActive: iconColor(theme, "active"), - iconConflict: iconColor(theme, "warning"), - iconDirty: iconColor(theme, "info"), - iconWidth: 8, - spacing: 10, - text: text(theme, "mono", "secondary", { size: "sm" }), - border: border(theme, "primary", { - left: true, - bottom: true, - overlay: true, - }), - padding: { - left: 12, - right: 12, - }, - }; + const tab = { + height: 32, + background: backgroundColor(theme, 300), + iconClose: iconColor(theme, "muted"), + iconCloseActive: iconColor(theme, "active"), + iconConflict: iconColor(theme, "warning"), + iconDirty: iconColor(theme, "info"), + iconWidth: 8, + spacing: 10, + text: text(theme, "mono", "secondary", { size: "sm" }), + border: border(theme, "primary", { + left: true, + bottom: true, + overlay: true, + }), + padding: { + left: 12, + right: 12, + }, + }; - const activeTab = { - ...tab, - background: backgroundColor(theme, 500), - text: text(theme, "mono", "active", { size: "sm" }), - border: { - ...tab.border, - bottom: false, - }, - }; + const activeTab = { + ...tab, + background: backgroundColor(theme, 500), + text: text(theme, "mono", "active", { size: "sm" }), + border: { + ...tab.border, + bottom: false, + }, + }; - const sidebarItem = { - height: 32, - iconColor: iconColor(theme, "secondary"), - iconSize: 18, - }; - const sidebar = { - width: 30, - background: backgroundColor(theme, 300), - border: border(theme, "primary", { right: true }), - item: sidebarItem, - activeItem: { - ...sidebarItem, - iconColor: iconColor(theme, "active"), - }, - resizeHandle: { - background: border(theme, "primary").color, - padding: { - left: 1, - }, - }, - }; + const sidebarItem = { + height: 32, + iconColor: iconColor(theme, "secondary"), + iconSize: 18, + }; + const sidebar = { + width: 30, + background: backgroundColor(theme, 300), + border: border(theme, "primary", { right: true }), + item: sidebarItem, + activeItem: { + ...sidebarItem, + iconColor: iconColor(theme, "active"), + }, + resizeHandle: { + background: border(theme, "primary").color, + padding: { + left: 1, + }, + }, + }; - return { - background: backgroundColor(theme, 300), - leaderBorderOpacity: 0.7, - leaderBorderWidth: 2.0, - tab, - activeTab, - leftSidebar: { - ...sidebar, - border: border(theme, "primary", { right: true }), - }, - rightSidebar: { - ...sidebar, - border: border(theme, "primary", { left: true }), - }, - paneDivider: { - color: border(theme, "secondary").color, - width: 1, - }, - status_bar: { - height: 24, - itemSpacing: 8, - padding: { - left: 6, - right: 6, - }, - border: border(theme, "primary", { top: true, overlay: true }), - cursorPosition: text(theme, "sans", "muted"), - diagnosticMessage: text(theme, "sans", "muted"), - lspMessage: text(theme, "sans", "muted"), - }, - titlebar: { - avatarWidth: 18, - height: 32, - background: backgroundColor(theme, 100), - shareIconColor: iconColor(theme, "secondary"), - shareIconActiveColor: iconColor(theme, "feature"), - title: text(theme, "sans", "primary"), - avatar: { - cornerRadius: 10, - border: { - color: "#00000088", - width: 1, - }, - }, - avatarRibbon: { - height: 3, - width: 12, - // TODO: The background for this ideally should be - // set with a token, not hardcoded in rust - }, - border: border(theme, "primary", { bottom: true }), - signInPrompt, - hoveredSignInPrompt: { - ...signInPrompt, - ...text(theme, "sans", "active", { size: "xs" }), - }, - offlineIcon: { - color: iconColor(theme, "secondary"), - width: 16, - padding: { - right: 4, - }, - }, - outdatedWarning: { - ...text(theme, "sans", "warning"), - size: 13, - }, - }, - toolbar: { - height: 34, - background: backgroundColor(theme, 500), - border: border(theme, "secondary", { bottom: true }), - itemSpacing: 8, - padding: { left: 16, right: 8, top: 4, bottom: 4 }, - }, - breadcrumbs: { - ...text(theme, "mono", "secondary"), - padding: { left: 6 }, + return { + background: backgroundColor(theme, 300), + leaderBorderOpacity: 0.7, + leaderBorderWidth: 2.0, + tab, + activeTab, + leftSidebar: { + ...sidebar, + border: border(theme, "primary", { right: true }), + }, + rightSidebar: { + ...sidebar, + border: border(theme, "primary", { left: true }), + }, + paneDivider: { + color: border(theme, "secondary").color, + width: 1, + }, + status_bar: { + height: 24, + itemSpacing: 8, + padding: { + left: 6, + right: 6, + }, + border: border(theme, "primary", { top: true, overlay: true }), + cursorPosition: text(theme, "sans", "muted"), + diagnosticMessage: text(theme, "sans", "muted"), + lspMessage: text(theme, "sans", "muted"), + }, + titlebar: { + avatarWidth: 18, + height: 32, + background: backgroundColor(theme, 100), + shareIconColor: iconColor(theme, "secondary"), + shareIconActiveColor: iconColor(theme, "feature"), + title: text(theme, "sans", "primary"), + avatar: { + cornerRadius: 10, + border: { + color: "#00000088", + width: 1, }, - disconnectedOverlay: { - ...text(theme, "sans", "active"), - background: "#000000aa", + }, + avatarRibbon: { + height: 3, + width: 12, + // TODO: The background for this ideally should be + // set with a token, not hardcoded in rust + }, + border: border(theme, "primary", { bottom: true }), + signInPrompt, + hoveredSignInPrompt: { + ...signInPrompt, + ...text(theme, "sans", "active", { size: "xs" }), + }, + offlineIcon: { + color: iconColor(theme, "secondary"), + width: 16, + padding: { + right: 4, }, - }; + }, + outdatedWarning: { + ...text(theme, "sans", "warning"), + size: 13, + }, + }, + toolbar: { + height: 34, + background: backgroundColor(theme, 500), + border: border(theme, "secondary", { bottom: true }), + itemSpacing: 8, + padding: { left: 16, right: 8, top: 4, bottom: 4 }, + }, + breadcrumbs: { + ...text(theme, "mono", "secondary"), + padding: { left: 6 }, + }, + disconnectedOverlay: { + ...text(theme, "sans", "active"), + background: "#000000aa", + }, + }; } diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 7c7f7bf97e44f83c9f80094bbb254dcf70d14ad7..09a8a07c6758ec7804bdc4d9d624e4f3bcc6aa63 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -3,227 +3,227 @@ import { withOpacity } from "../utils/color"; import Theme, { buildPlayer, Syntax } from "./theme"; const backgroundColor = { - 100: { - base: colors.neutral[750], - hovered: colors.neutral[725], - active: colors.neutral[800], - focused: colors.neutral[675], - }, - 300: { - base: colors.neutral[800], - hovered: colors.neutral[775], - active: colors.neutral[750], - focused: colors.neutral[775], - }, - 500: { - base: colors.neutral[900], - hovered: withOpacity(colors.neutral[0], 0.08), - active: withOpacity(colors.neutral[0], 0.12), - focused: colors.neutral[825], - }, - ok: { - base: colors.green[600], - hovered: colors.green[600], - active: colors.green[600], - focused: colors.green[600], - }, - error: { - base: colors.red[400], - hovered: colors.red[400], - active: colors.red[400], - focused: colors.red[400], - }, - warning: { - base: colors.amber[300], - hovered: colors.amber[300], - active: colors.amber[300], - focused: colors.amber[300], - }, - info: { - base: colors.blue[500], - hovered: colors.blue[500], - active: colors.blue[500], - focused: colors.blue[500], - }, + 100: { + base: colors.neutral[750], + hovered: colors.neutral[725], + active: colors.neutral[800], + focused: colors.neutral[675], + }, + 300: { + base: colors.neutral[800], + hovered: colors.neutral[775], + active: colors.neutral[750], + focused: colors.neutral[775], + }, + 500: { + base: colors.neutral[900], + hovered: withOpacity(colors.neutral[0], 0.08), + active: withOpacity(colors.neutral[0], 0.12), + focused: colors.neutral[825], + }, + ok: { + base: colors.green[600], + hovered: colors.green[600], + active: colors.green[600], + focused: colors.green[600], + }, + error: { + base: colors.red[400], + hovered: colors.red[400], + active: colors.red[400], + focused: colors.red[400], + }, + warning: { + base: colors.amber[300], + hovered: colors.amber[300], + active: colors.amber[300], + focused: colors.amber[300], + }, + info: { + base: colors.blue[500], + hovered: colors.blue[500], + active: colors.blue[500], + focused: colors.blue[500], + }, }; const borderColor = { - primary: colors.neutral[875], - secondary: colors.neutral[775], - muted: colors.neutral[675], - focused: colors.neutral[500], - active: colors.neutral[900], - ok: colors.green[500], - error: colors.red[500], - warning: colors.amber[500], - info: colors.blue[500], + primary: colors.neutral[875], + secondary: colors.neutral[775], + muted: colors.neutral[675], + focused: colors.neutral[500], + active: colors.neutral[900], + ok: colors.green[500], + error: colors.red[500], + warning: colors.amber[500], + info: colors.blue[500], }; const textColor = { - primary: colors.neutral[50], - secondary: colors.neutral[350], - muted: colors.neutral[450], - placeholder: colors.neutral[650], - active: colors.neutral[0], - //TODO: (design) define feature and it's correct value - feature: colors.sky[500], - ok: colors.green[600], - error: colors.red[400], - warning: colors.amber[300], - info: colors.blue[500], + primary: colors.neutral[50], + secondary: colors.neutral[350], + muted: colors.neutral[450], + placeholder: colors.neutral[650], + active: colors.neutral[0], + //TODO: (design) define feature and it's correct value + feature: colors.sky[500], + ok: colors.green[600], + error: colors.red[400], + warning: colors.amber[300], + info: colors.blue[500], }; const iconColor = { - primary: colors.neutral[200], - secondary: colors.neutral[350], - muted: colors.neutral[600], - placeholder: colors.neutral[700], - active: colors.neutral[0], - //TODO: (design) define feature and it's correct value - feature: colors.blue[500], - ok: colors.green[600], - error: colors.red[500], - warning: colors.amber[400], - info: colors.blue[600], + primary: colors.neutral[200], + secondary: colors.neutral[350], + muted: colors.neutral[600], + placeholder: colors.neutral[700], + active: colors.neutral[0], + //TODO: (design) define feature and it's correct value + feature: colors.blue[500], + ok: colors.green[600], + error: colors.red[500], + warning: colors.amber[400], + info: colors.blue[600], }; const player = { - 1: buildPlayer(colors.blue[500]), - 2: buildPlayer(colors.lime[500]), - 3: buildPlayer(colors.fuschia[500]), - 4: buildPlayer(colors.orange[500]), - 5: buildPlayer(colors.purple[500]), - 6: buildPlayer(colors.teal[400]), - 7: buildPlayer(colors.pink[400]), - 8: buildPlayer(colors.yellow[400]), + 1: buildPlayer(colors.blue[500]), + 2: buildPlayer(colors.lime[500]), + 3: buildPlayer(colors.fuschia[500]), + 4: buildPlayer(colors.orange[500]), + 5: buildPlayer(colors.purple[500]), + 6: buildPlayer(colors.teal[400]), + 7: buildPlayer(colors.pink[400]), + 8: buildPlayer(colors.yellow[400]), }; const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: withOpacity(colors.neutral[0], 0.07), - highlighted: withOpacity(colors.neutral[0], 0.12), - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: withOpacity(colors.neutral[0], 0.12), - activeOccurrence: withOpacity(colors.neutral[0], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side - matchingBracket: backgroundColor[500].active, - match: withOpacity(colors.sky[500], 0.16), - activeMatch: withOpacity(colors.sky[800], 0.32), - related: backgroundColor[500].focused, - }, - gutter: { - primary: textColor.placeholder, - active: textColor.active, - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: withOpacity(colors.neutral[0], 0.07), + highlighted: withOpacity(colors.neutral[0], 0.12), + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: withOpacity(colors.neutral[0], 0.12), + activeOccurrence: withOpacity(colors.neutral[0], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side + matchingBracket: backgroundColor[500].active, + match: withOpacity(colors.sky[500], 0.16), + activeMatch: withOpacity(colors.sky[800], 0.32), + related: backgroundColor[500].focused, + }, + gutter: { + primary: textColor.placeholder, + active: textColor.active, + }, }; const syntax: Syntax = { - primary: { - color: colors.neutral[150], - weight: fontWeights.normal, - }, - comment: { - color: colors.neutral[300], - weight: fontWeights.normal, - }, - punctuation: { - color: colors.neutral[200], - weight: fontWeights.normal, - }, - constant: { - color: colors.neutral[150], - weight: fontWeights.normal, - }, - keyword: { - color: colors.blue[400], - weight: fontWeights.normal, - }, - function: { - color: colors.yellow[200], - weight: fontWeights.normal, - }, - type: { - color: colors.teal[300], - weight: fontWeights.normal, - }, - variant: { - color: colors.sky[300], - weight: fontWeights.normal, - }, - property: { - color: colors.blue[400], - weight: fontWeights.normal, - }, - enum: { - color: colors.orange[500], - weight: fontWeights.normal, - }, - operator: { - color: colors.orange[500], - weight: fontWeights.normal, - }, - string: { - color: colors.orange[300], - weight: fontWeights.normal, - }, - number: { - color: colors.lime[300], - weight: fontWeights.normal, - }, - boolean: { - color: colors.lime[300], - weight: fontWeights.normal, - }, - predictive: { - color: textColor.muted, - weight: fontWeights.normal, - }, - title: { - color: colors.amber[500], - weight: fontWeights.bold, - }, - emphasis: { - color: textColor.active, - weight: fontWeights.normal, - }, - emphasisStrong: { - color: textColor.active, - weight: fontWeights.bold, - }, - linkUrl: { - color: colors.lime[500], - weight: fontWeights.normal, - // TODO: add underline - }, - linkText: { - color: colors.orange[500], - weight: fontWeights.normal, - // TODO: add italic - }, + primary: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + comment: { + color: colors.neutral[300], + weight: fontWeights.normal, + }, + punctuation: { + color: colors.neutral[200], + weight: fontWeights.normal, + }, + constant: { + color: colors.neutral[150], + weight: fontWeights.normal, + }, + keyword: { + color: colors.blue[400], + weight: fontWeights.normal, + }, + function: { + color: colors.yellow[200], + weight: fontWeights.normal, + }, + type: { + color: colors.teal[300], + weight: fontWeights.normal, + }, + variant: { + color: colors.sky[300], + weight: fontWeights.normal, + }, + property: { + color: colors.blue[400], + weight: fontWeights.normal, + }, + enum: { + color: colors.orange[500], + weight: fontWeights.normal, + }, + operator: { + color: colors.orange[500], + weight: fontWeights.normal, + }, + string: { + color: colors.orange[300], + weight: fontWeights.normal, + }, + number: { + color: colors.lime[300], + weight: fontWeights.normal, + }, + boolean: { + color: colors.lime[300], + weight: fontWeights.normal, + }, + predictive: { + color: textColor.muted, + weight: fontWeights.normal, + }, + title: { + color: colors.amber[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.orange[500], + weight: fontWeights.normal, + // TODO: add italic + }, }; const shadowAlpha: NumberToken = { - value: 0.32, - type: "number", + value: 0.32, + type: "number", }; const theme: Theme = { - name: "dark", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "dark", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index 434760b30440eed17135d3944b79ddea49304f72..74caa4987d6af5e3b26c88ca20b6dbc7bc88b627 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -3,225 +3,225 @@ import { withOpacity } from "../utils/color"; import Theme, { buildPlayer, Syntax } from "./theme"; const backgroundColor = { - 100: { - base: colors.neutral[75], - hovered: colors.neutral[100], - active: colors.neutral[150], - focused: colors.neutral[100], - }, - 300: { - base: colors.neutral[25], - hovered: colors.neutral[75], - active: colors.neutral[125], - focused: colors.neutral[75], - }, - 500: { - base: colors.neutral[0], - hovered: withOpacity(colors.neutral[900], 0.03), - active: withOpacity(colors.neutral[900], 0.06), - focused: colors.neutral[50], - }, - ok: { - base: colors.green[100], - hovered: colors.green[100], - active: colors.green[100], - focused: colors.green[100], - }, - error: { - base: colors.red[100], - hovered: colors.red[100], - active: colors.red[100], - focused: colors.red[100], - }, - warning: { - base: colors.yellow[100], - hovered: colors.yellow[100], - active: colors.yellow[100], - focused: colors.yellow[100], - }, - info: { - base: colors.blue[100], - hovered: colors.blue[100], - active: colors.blue[100], - focused: colors.blue[100], - }, + 100: { + base: colors.neutral[75], + hovered: colors.neutral[100], + active: colors.neutral[150], + focused: colors.neutral[100], + }, + 300: { + base: colors.neutral[25], + hovered: colors.neutral[75], + active: colors.neutral[125], + focused: colors.neutral[75], + }, + 500: { + base: colors.neutral[0], + hovered: withOpacity(colors.neutral[900], 0.03), + active: withOpacity(colors.neutral[900], 0.06), + focused: colors.neutral[50], + }, + ok: { + base: colors.green[100], + hovered: colors.green[100], + active: colors.green[100], + focused: colors.green[100], + }, + error: { + base: colors.red[100], + hovered: colors.red[100], + active: colors.red[100], + focused: colors.red[100], + }, + warning: { + base: colors.yellow[100], + hovered: colors.yellow[100], + active: colors.yellow[100], + focused: colors.yellow[100], + }, + info: { + base: colors.blue[100], + hovered: colors.blue[100], + active: colors.blue[100], + focused: colors.blue[100], + }, }; const borderColor = { - primary: colors.neutral[150], - secondary: colors.neutral[150], - muted: colors.neutral[100], - focused: colors.neutral[100], - active: colors.neutral[250], - ok: colors.green[200], - error: colors.red[200], - warning: colors.yellow[200], - info: colors.blue[200], + primary: colors.neutral[150], + secondary: colors.neutral[150], + muted: colors.neutral[100], + focused: colors.neutral[100], + active: colors.neutral[250], + ok: colors.green[200], + error: colors.red[200], + warning: colors.yellow[200], + info: colors.blue[200], }; const textColor = { - primary: colors.neutral[750], - secondary: colors.neutral[650], - muted: colors.neutral[550], - placeholder: colors.neutral[450], - active: colors.neutral[900], - feature: colors.indigo[600], - ok: colors.green[500], - error: colors.red[500], - warning: colors.yellow[500], - info: colors.blue[500], + primary: colors.neutral[750], + secondary: colors.neutral[650], + muted: colors.neutral[550], + placeholder: colors.neutral[450], + active: colors.neutral[900], + feature: colors.indigo[600], + ok: colors.green[500], + error: colors.red[500], + warning: colors.yellow[500], + info: colors.blue[500], }; const iconColor = { - primary: colors.neutral[700], - secondary: colors.neutral[500], - muted: colors.neutral[350], - placeholder: colors.neutral[300], - active: colors.neutral[900], - feature: colors.indigo[500], - ok: colors.green[600], - error: colors.red[600], - warning: colors.yellow[400], - info: colors.blue[600], + primary: colors.neutral[700], + secondary: colors.neutral[500], + muted: colors.neutral[350], + placeholder: colors.neutral[300], + active: colors.neutral[900], + feature: colors.indigo[500], + ok: colors.green[600], + error: colors.red[600], + warning: colors.yellow[400], + info: colors.blue[600], }; const player = { - 1: buildPlayer(colors.blue[500]), - 2: buildPlayer(colors.emerald[400]), - 3: buildPlayer(colors.fuschia[400]), - 4: buildPlayer(colors.orange[400]), - 5: buildPlayer(colors.purple[400]), - 6: buildPlayer(colors.teal[400]), - 7: buildPlayer(colors.pink[400]), - 8: buildPlayer(colors.yellow[400]), + 1: buildPlayer(colors.blue[500]), + 2: buildPlayer(colors.emerald[400]), + 3: buildPlayer(colors.fuschia[400]), + 4: buildPlayer(colors.orange[400]), + 5: buildPlayer(colors.purple[400]), + 6: buildPlayer(colors.teal[400]), + 7: buildPlayer(colors.pink[400]), + 8: buildPlayer(colors.yellow[400]), }; const editor = { - background: backgroundColor[500].base, - indent_guide: borderColor.muted, - indent_guide_active: borderColor.secondary, - line: { - active: withOpacity(colors.neutral[900], 0.06), - highlighted: withOpacity(colors.neutral[900], 0.12), - inserted: backgroundColor.ok.active, - deleted: backgroundColor.error.active, - modified: backgroundColor.info.active, - }, - highlight: { - selection: player[1].selectionColor, - occurrence: withOpacity(colors.neutral[900], 0.06), - activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not hooked up to occurences on the rust side - matchingBracket: colors.neutral[0], - match: withOpacity(colors.red[500], 0.2), - activeMatch: withOpacity(colors.indigo[400], 0.36), // TODO: This is not hooked up to occurences on the rust side - related: colors.neutral[0], - }, - gutter: { - primary: colors.neutral[300], - active: textColor.active, - }, + background: backgroundColor[500].base, + indent_guide: borderColor.muted, + indent_guide_active: borderColor.secondary, + line: { + active: withOpacity(colors.neutral[900], 0.06), + highlighted: withOpacity(colors.neutral[900], 0.12), + inserted: backgroundColor.ok.active, + deleted: backgroundColor.error.active, + modified: backgroundColor.info.active, + }, + highlight: { + selection: player[1].selectionColor, + occurrence: withOpacity(colors.neutral[900], 0.06), + activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not hooked up to occurences on the rust side + matchingBracket: colors.neutral[0], + match: withOpacity(colors.red[500], 0.2), + activeMatch: withOpacity(colors.indigo[400], 0.36), // TODO: This is not hooked up to occurences on the rust side + related: colors.neutral[0], + }, + gutter: { + primary: colors.neutral[300], + active: textColor.active, + }, }; const syntax: Syntax = { - primary: { - color: colors.neutral[800], - weight: fontWeights.normal, - }, - comment: { - color: colors.neutral[500], - weight: fontWeights.normal, - }, - punctuation: { - color: colors.neutral[600], - weight: fontWeights.normal, - }, - constant: { - color: colors.neutral[800], - weight: fontWeights.normal, - }, - keyword: { - color: colors.indigo[700], - weight: fontWeights.normal, - }, - function: { - color: colors.orange[600], - weight: fontWeights.normal, - }, - type: { - color: colors.yellow[600], - weight: fontWeights.normal, - }, - variant: { - color: colors.rose[700], - weight: fontWeights.normal, - }, - property: { - color: colors.emerald[700], - weight: fontWeights.normal, - }, - enum: { - color: colors.red[500], - weight: fontWeights.normal, - }, - operator: { - color: colors.red[500], - weight: fontWeights.normal, - }, - string: { - color: colors.red[500], - weight: fontWeights.normal, - }, - number: { - color: colors.indigo[500], - weight: fontWeights.normal, - }, - boolean: { - color: colors.red[500], - weight: fontWeights.normal, - }, - predictive: { - color: textColor.placeholder, - weight: fontWeights.normal, - }, - title: { - color: colors.sky[500], - weight: fontWeights.bold, - }, - emphasis: { - color: textColor.active, - weight: fontWeights.normal, - }, - emphasisStrong: { - color: textColor.active, - weight: fontWeights.bold, - }, - linkUrl: { - color: colors.lime[500], - weight: fontWeights.normal, - // TODO: add underline - }, - linkText: { - color: colors.red[500], - weight: fontWeights.normal, - // TODO: add italic - }, + primary: { + color: colors.neutral[800], + weight: fontWeights.normal, + }, + comment: { + color: colors.neutral[500], + weight: fontWeights.normal, + }, + punctuation: { + color: colors.neutral[600], + weight: fontWeights.normal, + }, + constant: { + color: colors.neutral[800], + weight: fontWeights.normal, + }, + keyword: { + color: colors.indigo[700], + weight: fontWeights.normal, + }, + function: { + color: colors.orange[600], + weight: fontWeights.normal, + }, + type: { + color: colors.yellow[600], + weight: fontWeights.normal, + }, + variant: { + color: colors.rose[700], + weight: fontWeights.normal, + }, + property: { + color: colors.emerald[700], + weight: fontWeights.normal, + }, + enum: { + color: colors.red[500], + weight: fontWeights.normal, + }, + operator: { + color: colors.red[500], + weight: fontWeights.normal, + }, + string: { + color: colors.red[500], + weight: fontWeights.normal, + }, + number: { + color: colors.indigo[500], + weight: fontWeights.normal, + }, + boolean: { + color: colors.red[500], + weight: fontWeights.normal, + }, + predictive: { + color: textColor.placeholder, + weight: fontWeights.normal, + }, + title: { + color: colors.sky[500], + weight: fontWeights.bold, + }, + emphasis: { + color: textColor.active, + weight: fontWeights.normal, + }, + emphasisStrong: { + color: textColor.active, + weight: fontWeights.bold, + }, + linkUrl: { + color: colors.lime[500], + weight: fontWeights.normal, + // TODO: add underline + }, + linkText: { + color: colors.red[500], + weight: fontWeights.normal, + // TODO: add italic + }, }; const shadowAlpha: NumberToken = { - value: 0.12, - type: "number", + value: 0.12, + type: "number", }; const theme: Theme = { - name: "light", - backgroundColor, - borderColor, - textColor, - iconColor, - editor, - syntax, - player, - shadowAlpha, + name: "light", + backgroundColor, + borderColor, + textColor, + iconColor, + editor, + syntax, + player, + shadowAlpha, }; export default theme; diff --git a/styles/src/themes/theme.ts b/styles/src/themes/theme.ts index 64c6391dabf5225a0eac9cb088b8f99b02d1b660..945b22ca4ae11d9d08d86507ed2443c47aed1851 100644 --- a/styles/src/themes/theme.ts +++ b/styles/src/themes/theme.ts @@ -2,144 +2,144 @@ import { ColorToken, FontWeightToken, NumberToken } from "../tokens"; import { withOpacity } from "../utils/color"; export interface SyntaxHighlightStyle { - color: ColorToken; - weight: FontWeightToken; + color: ColorToken; + weight: FontWeightToken; } export interface Player { - baseColor: ColorToken; - cursorColor: ColorToken; - selectionColor: ColorToken; - borderColor: ColorToken; + baseColor: ColorToken; + cursorColor: ColorToken; + selectionColor: ColorToken; + borderColor: ColorToken; } export function buildPlayer( - color: ColorToken, - cursorOpacity?: number, - selectionOpacity?: number, - borderOpacity?: number + color: ColorToken, + cursorOpacity?: number, + selectionOpacity?: number, + borderOpacity?: number ) { - return { - baseColor: color, - cursorColor: withOpacity(color, cursorOpacity || 1.0), - selectionColor: withOpacity(color, selectionOpacity || 0.24), - borderColor: withOpacity(color, borderOpacity || 0.8), - } + return { + baseColor: color, + cursorColor: withOpacity(color, cursorOpacity || 1.0), + selectionColor: withOpacity(color, selectionOpacity || 0.24), + borderColor: withOpacity(color, borderOpacity || 0.8), + } } export interface BackgroundColorSet { - base: ColorToken; - hovered: ColorToken; - active: ColorToken; - focused: ColorToken; + base: ColorToken; + hovered: ColorToken; + active: ColorToken; + focused: ColorToken; } export interface Syntax { - primary: SyntaxHighlightStyle; - comment: SyntaxHighlightStyle; - punctuation: SyntaxHighlightStyle; - constant: SyntaxHighlightStyle; - keyword: SyntaxHighlightStyle; - function: SyntaxHighlightStyle; - type: SyntaxHighlightStyle; - variant: SyntaxHighlightStyle; - property: SyntaxHighlightStyle; - enum: SyntaxHighlightStyle; - operator: SyntaxHighlightStyle; - string: SyntaxHighlightStyle; - number: SyntaxHighlightStyle; - boolean: SyntaxHighlightStyle; - predictive: SyntaxHighlightStyle; - // TODO: Either move the following or rename - title: SyntaxHighlightStyle; - emphasis: SyntaxHighlightStyle; - emphasisStrong: SyntaxHighlightStyle; - linkUrl: SyntaxHighlightStyle; - linkText: SyntaxHighlightStyle; + primary: SyntaxHighlightStyle; + comment: SyntaxHighlightStyle; + punctuation: SyntaxHighlightStyle; + constant: SyntaxHighlightStyle; + keyword: SyntaxHighlightStyle; + function: SyntaxHighlightStyle; + type: SyntaxHighlightStyle; + variant: SyntaxHighlightStyle; + property: SyntaxHighlightStyle; + enum: SyntaxHighlightStyle; + operator: SyntaxHighlightStyle; + string: SyntaxHighlightStyle; + number: SyntaxHighlightStyle; + boolean: SyntaxHighlightStyle; + predictive: SyntaxHighlightStyle; + // TODO: Either move the following or rename + title: SyntaxHighlightStyle; + emphasis: SyntaxHighlightStyle; + emphasisStrong: SyntaxHighlightStyle; + linkUrl: SyntaxHighlightStyle; + linkText: SyntaxHighlightStyle; }; export default interface Theme { - name: string; - backgroundColor: { - 100: BackgroundColorSet; - 300: BackgroundColorSet; - 500: BackgroundColorSet; - ok: BackgroundColorSet; - error: BackgroundColorSet; - warning: BackgroundColorSet; - info: BackgroundColorSet; - }; - borderColor: { - primary: ColorToken; - secondary: ColorToken; - muted: ColorToken; - focused: ColorToken; - active: ColorToken; - ok: ColorToken; - error: ColorToken; - warning: ColorToken; - info: ColorToken; - }; - textColor: { - primary: ColorToken; - secondary: ColorToken; - muted: ColorToken; - placeholder: ColorToken; - active: ColorToken; - feature: ColorToken; - ok: ColorToken; - error: ColorToken; - warning: ColorToken; - info: ColorToken; + name: string; + backgroundColor: { + 100: BackgroundColorSet; + 300: BackgroundColorSet; + 500: BackgroundColorSet; + ok: BackgroundColorSet; + error: BackgroundColorSet; + warning: BackgroundColorSet; + info: BackgroundColorSet; + }; + borderColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + focused: ColorToken; + active: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + textColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + iconColor: { + primary: ColorToken; + secondary: ColorToken; + muted: ColorToken; + placeholder: ColorToken; + active: ColorToken; + feature: ColorToken; + ok: ColorToken; + error: ColorToken; + warning: ColorToken; + info: ColorToken; + }; + editor: { + background: ColorToken; + indent_guide: ColorToken; + indent_guide_active: ColorToken; + line: { + active: ColorToken; + highlighted: ColorToken; + inserted: ColorToken; + deleted: ColorToken; + modified: ColorToken; }; - iconColor: { - primary: ColorToken; - secondary: ColorToken; - muted: ColorToken; - placeholder: ColorToken; - active: ColorToken; - feature: ColorToken; - ok: ColorToken; - error: ColorToken; - warning: ColorToken; - info: ColorToken; + highlight: { + selection: ColorToken; + occurrence: ColorToken; + activeOccurrence: ColorToken; + matchingBracket: ColorToken; + match: ColorToken; + activeMatch: ColorToken; + related: ColorToken; }; - editor: { - background: ColorToken; - indent_guide: ColorToken; - indent_guide_active: ColorToken; - line: { - active: ColorToken; - highlighted: ColorToken; - inserted: ColorToken; - deleted: ColorToken; - modified: ColorToken; - }; - highlight: { - selection: ColorToken; - occurrence: ColorToken; - activeOccurrence: ColorToken; - matchingBracket: ColorToken; - match: ColorToken; - activeMatch: ColorToken; - related: ColorToken; - }; - gutter: { - primary: ColorToken; - active: ColorToken; - }; + gutter: { + primary: ColorToken; + active: ColorToken; }; + }; - syntax: Syntax, + syntax: Syntax, - player: { - 1: Player; - 2: Player; - 3: Player; - 4: Player; - 5: Player; - 6: Player; - 7: Player; - 8: Player; - }; - shadowAlpha: NumberToken; + player: { + 1: Player; + 2: Player; + 3: Player; + 4: Player; + 5: Player; + 6: Player; + 7: Player; + 8: Player; + }; + shadowAlpha: NumberToken; } diff --git a/styles/src/tokens.ts b/styles/src/tokens.ts index aa865ae6943603cda17dbac9f3a4a786cdc45367..5e412ae042aedda1ca9ac11c47aebddbd8ab9d71 100644 --- a/styles/src/tokens.ts +++ b/styles/src/tokens.ts @@ -36,7 +36,7 @@ export const fontSizes = { xl: fontSize(20), }; -export type FontWeight = +export type FontWeight = | "thin" | "extra_light" | "light" diff --git a/styles/src/utils/color.ts b/styles/src/utils/color.ts index 9e1599acac234011ca5d5ee20c2f5dc6f3d97c3a..196c3d4e2ee1c143f8d883a3612d3078d738029e 100644 --- a/styles/src/utils/color.ts +++ b/styles/src/utils/color.ts @@ -4,49 +4,49 @@ import { ColorToken } from "../tokens"; export type Color = string; export type ColorRampStep = { value: Color; type: "color"; step: number }; export type ColorRamp = { - [index: number]: ColorRampStep; + [index: number]: ColorRampStep; }; export function colorRamp( - color: Color | [Color, Color], - options?: { steps?: number; increment?: number; } + color: Color | [Color, Color], + options?: { steps?: number; increment?: number; } ): ColorRamp { - let scale: Scale; - if (Array.isArray(color)) { - const [startColor, endColor] = color; - scale = chroma.scale([startColor, endColor]); - } else { - let hue = Math.round(chroma(color).hsl()[0]); - let startColor = chroma.hsl(hue, 0.88, 0.96); - let endColor = chroma.hsl(hue, 0.68, 0.12); - scale = chroma - .scale([startColor, color, endColor]) - .domain([0, 0.5, 1]) - .mode("hsl") - .gamma(1) - // .correctLightness(true) - .padding([0, 0]); - } + let scale: Scale; + if (Array.isArray(color)) { + const [startColor, endColor] = color; + scale = chroma.scale([startColor, endColor]); + } else { + let hue = Math.round(chroma(color).hsl()[0]); + let startColor = chroma.hsl(hue, 0.88, 0.96); + let endColor = chroma.hsl(hue, 0.68, 0.12); + scale = chroma + .scale([startColor, color, endColor]) + .domain([0, 0.5, 1]) + .mode("hsl") + .gamma(1) + // .correctLightness(true) + .padding([0, 0]); + } - const ramp: ColorRamp = {}; - const steps = options?.steps || 10; - const increment = options?.increment || 100; + const ramp: ColorRamp = {}; + const steps = options?.steps || 10; + const increment = options?.increment || 100; - scale.colors(steps, "hex").forEach((color, ix) => { - const step = ix * increment; - ramp[step] = { - value: color, - step, - type: "color", - }; - }); + scale.colors(steps, "hex").forEach((color, ix) => { + const step = ix * increment; + ramp[step] = { + value: color, + step, + type: "color", + }; + }); - return ramp; + return ramp; } export function withOpacity(color: ColorToken, opacity: number): ColorToken { - return { - ...color, - value: chroma(color.value).alpha(opacity).hex() - }; + return { + ...color, + value: chroma(color.value).alpha(opacity).hex() + }; } diff --git a/styles/src/utils/snakeCase.ts b/styles/src/utils/snakeCase.ts index 7d0e4470d8e6232dbac3ea4ab3190ba23da63de2..890017f1c6cee0e169b7afb663d46b3720fbb15e 100644 --- a/styles/src/utils/snakeCase.ts +++ b/styles/src/utils/snakeCase.ts @@ -4,32 +4,32 @@ import { snakeCase } from "case-anything"; // Typescript magic to convert any string from camelCase to snake_case at compile time type SnakeCase = - S extends string ? - S extends `${infer T}${infer U}` ? - `${T extends Capitalize ? "_" : ""}${Lowercase}${SnakeCase}` : - S : - S; + S extends string ? + S extends `${infer T}${infer U}` ? + `${T extends Capitalize ? "_" : ""}${Lowercase}${SnakeCase}` : + S : + S; type SnakeCased = { - [Property in keyof Type as SnakeCase]: SnakeCased + [Property in keyof Type as SnakeCase]: SnakeCased } export default function snakeCaseTree(object: T): SnakeCased { - const snakeObject: any = {}; - for (const key in object) { - snakeObject[snakeCase(key)] = snakeCaseValue(object[key]); - } - return snakeObject; + const snakeObject: any = {}; + for (const key in object) { + snakeObject[snakeCase(key)] = snakeCaseValue(object[key]); + } + return snakeObject; } function snakeCaseValue(value: any): any { - if (typeof value === "object") { - if (Array.isArray(value)) { - return value.map(snakeCaseValue); - } else { - return snakeCaseTree(value); - } + if (typeof value === "object") { + if (Array.isArray(value)) { + return value.map(snakeCaseValue); } else { - return value; + return snakeCaseTree(value); } + } else { + return value; + } } From 67b15ee0373c126579778f249f543947321a8865 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 6 Apr 2022 14:41:51 -0700 Subject: [PATCH 098/245] Use language specific tabsize in editor commands Co-authored-by: Max Brunsfeld --- Cargo.lock | 1 + crates/editor/Cargo.toml | 1 + crates/editor/src/display_map.rs | 7 +- crates/editor/src/display_map/block_map.rs | 7 + crates/editor/src/display_map/fold_map.rs | 5 + crates/editor/src/display_map/wrap_map.rs | 2 + crates/editor/src/editor.rs | 418 +++++++++++++++------ crates/editor/src/multi_buffer.rs | 44 ++- crates/editor/src/test.rs | 22 +- crates/workspace/src/pane.rs | 2 +- crates/zed/src/zed.rs | 8 +- 11 files changed, 389 insertions(+), 128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 605ddf6c2605ba14bb65dac5d4ae1fa9b548b99d..ec9c58b1a9b50e5c95b8c43dcae99bd7a25b8dca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1638,6 +1638,7 @@ dependencies = [ "futures", "fuzzy", "gpui", + "indoc", "itertools", "language", "lazy_static", diff --git a/crates/editor/Cargo.toml b/crates/editor/Cargo.toml index 4664d9c52e674fa0786bdd1de501d20cecf99ee9..076fecbfcbb58385e859b97b793b3bb0a41e8302 100644 --- a/crates/editor/Cargo.toml +++ b/crates/editor/Cargo.toml @@ -37,6 +37,7 @@ workspace = { path = "../workspace" } aho-corasick = "0.7" anyhow = "1.0" futures = "0.3" +indoc = "1.0.4" itertools = "0.10" lazy_static = "1.4" log = "0.4" diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 6bf495c91facd29c6ba1c25e2d5dfda8dd5a2bef..d4e8dc6cf70d9ae7a0462bd55ced5a77f18f795f 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -204,7 +204,12 @@ impl DisplayMap { } fn tab_size(buffer: &ModelHandle, cx: &mut ModelContext) -> u32 { - let language_name = buffer.read(cx).language(cx).map(|language| language.name()); + let language_name = buffer + .read(cx) + .as_singleton() + .and_then(|buffer| buffer.read(cx).language()) + .map(|language| language.name()); + cx.global::().tab_size(language_name.as_deref()) } diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index d749b607eb5730fbb17b2def2696aaac6b6817f8..b7f1836cdc2cb7b6808c6eb969f63a624f6f5921 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -969,6 +969,7 @@ mod tests { use crate::multi_buffer::MultiBuffer; use gpui::{elements::Empty, Element}; use rand::prelude::*; + use settings::Settings; use std::env; use text::RandomCharIter; @@ -988,6 +989,8 @@ mod tests { #[gpui::test] fn test_basic_blocks(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); + let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); let font_id = cx .font_cache() @@ -1167,6 +1170,8 @@ mod tests { #[gpui::test] fn test_blocks_on_wrapped_lines(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); + let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); let font_id = cx .font_cache() @@ -1209,6 +1214,8 @@ mod tests { #[gpui::test(iterations = 100)] fn test_random_blocks(cx: &mut gpui::MutableAppContext, mut rng: StdRng) { + cx.set_global(Settings::test(cx)); + let operations = env::var("OPERATIONS") .map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .unwrap_or(10); diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rs index 2c09244a7df38492b10ad4837f5443e3e8f7c457..3c020dceb78e0bdfb3600aaee63720c89976ef8e 100644 --- a/crates/editor/src/display_map/fold_map.rs +++ b/crates/editor/src/display_map/fold_map.rs @@ -1210,6 +1210,7 @@ mod tests { use super::*; use crate::{MultiBuffer, ToPoint}; use rand::prelude::*; + use settings::Settings; use std::{cmp::Reverse, env, mem, sync::Arc}; use sum_tree::TreeMap; use text::RandomCharIter; @@ -1218,6 +1219,7 @@ mod tests { #[gpui::test] fn test_basic_folds(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(5, 6, 'a'), cx); let subscription = buffer.update(cx, |buffer, _| buffer.subscribe()); let buffer_snapshot = buffer.read(cx).snapshot(cx); @@ -1291,6 +1293,7 @@ mod tests { #[gpui::test] fn test_adjacent_folds(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abcdefghijkl", cx); let subscription = buffer.update(cx, |buffer, _| buffer.subscribe()); let buffer_snapshot = buffer.read(cx).snapshot(cx); @@ -1354,6 +1357,7 @@ mod tests { #[gpui::test] fn test_merging_folds_via_edit(cx: &mut gpui::MutableAppContext) { + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(5, 6, 'a'), cx); let subscription = buffer.update(cx, |buffer, _| buffer.subscribe()); let buffer_snapshot = buffer.read(cx).snapshot(cx); @@ -1404,6 +1408,7 @@ mod tests { #[gpui::test(iterations = 100)] fn test_random_folds(cx: &mut gpui::MutableAppContext, mut rng: StdRng) { + cx.set_global(Settings::test(cx)); let operations = env::var("OPERATIONS") .map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .unwrap_or(10); diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 790cc8017b064bce5403a3900249e69c5bf8be23..00e9b63b1ad66625942c62daf21c4b04c372bb9f 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -1014,12 +1014,14 @@ mod tests { use gpui::test::observe; use language::RandomCharIter; use rand::prelude::*; + use settings::Settings; use smol::stream::StreamExt; use std::{cmp, env}; use text::Rope; #[gpui::test(iterations = 100)] async fn test_random_wraps(cx: &mut gpui::TestAppContext, mut rng: StdRng) { + cx.update(|cx| cx.set_global(Settings::test(cx))); cx.foreground().set_block_on_ticks(0..=50); cx.foreground().forbid_parking(); let operations = env::var("OPERATIONS") diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d52e456b959bfccae5eb6dd4f7e9dd15a1689681..7ceb3465f816e9356c2f70352c8938c71676b787 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -64,7 +64,6 @@ const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500); const MAX_LINE_LEN: usize = 1024; const MIN_NAVIGATION_HISTORY_ROW_DELTA: i64 = 10; const MAX_SELECTION_HISTORY_LEN: usize = 1024; -const INDENT_SIZE: u32 = 4; action!(Cancel); action!(Backspace); @@ -1131,8 +1130,12 @@ impl Editor { } } - pub fn language<'a>(&self, cx: &'a AppContext) -> Option<&'a Arc> { - self.buffer.read(cx).language(cx) + pub fn language_at<'a, T: ToOffset>( + &self, + point: T, + cx: &'a AppContext, + ) -> Option<&'a Arc> { + self.buffer.read(cx).language_at(point, cx) } fn style(&self, cx: &AppContext) -> EditorStyle { @@ -2946,8 +2949,9 @@ impl Editor { .buffer_line_for_row(old_head.row) { let indent_column = buffer.indent_column_for_line(line_buffer_range.start.row); + let language_name = buffer.language().map(|language| language.name()); + let indent = cx.global::().tab_size(language_name.as_deref()); if old_head.column <= indent_column && old_head.column > 0 { - let indent = INDENT_SIZE; new_head = cmp::min( new_head, Point::new(old_head.row, ((old_head.column - 1) / indent) * indent), @@ -2992,12 +2996,15 @@ impl Editor { return; } - let tab_size = cx.global::().tab_size; let mut selections = self.local_selections::(cx); if selections.iter().all(|s| s.is_empty()) { self.transact(cx, |this, cx| { this.buffer.update(cx, |buffer, cx| { for selection in &mut selections { + let language_name = + buffer.language_at(selection.start, cx).map(|l| l.name()); + let tab_size = + cx.global::().tab_size(language_name.as_deref()); let char_column = buffer .read(cx) .text_for_range( @@ -3026,12 +3033,14 @@ impl Editor { } pub fn indent(&mut self, _: &Indent, cx: &mut ViewContext) { - let tab_size = cx.global::().tab_size; let mut selections = self.local_selections::(cx); self.transact(cx, |this, cx| { let mut last_indent = None; this.buffer.update(cx, |buffer, cx| { + let snapshot = buffer.snapshot(cx); for selection in &mut selections { + let language_name = buffer.language_at(selection.start, cx).map(|l| l.name()); + let tab_size = cx.global::().tab_size(language_name.as_deref()); let mut start_row = selection.start.row; let mut end_row = selection.end.row + 1; @@ -3055,7 +3064,7 @@ impl Editor { } for row in start_row..end_row { - let indent_column = buffer.read(cx).indent_column_for_line(row); + let indent_column = snapshot.indent_column_for_line(row); let columns_to_next_tab_stop = tab_size - (indent_column % tab_size); let row_start = Point::new(row, 0); buffer.edit( @@ -3082,14 +3091,16 @@ impl Editor { } pub fn outdent(&mut self, _: &Outdent, cx: &mut ViewContext) { - let tab_size = cx.global::().tab_size; let selections = self.local_selections::(cx); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let mut deletion_ranges = Vec::new(); let mut last_outdent = None; { - let buffer = self.buffer.read(cx).read(cx); + let buffer = self.buffer.read(cx); + let snapshot = buffer.snapshot(cx); for selection in &selections { + let language_name = buffer.language_at(selection.start, cx).map(|l| l.name()); + let tab_size = cx.global::().tab_size(language_name.as_deref()); let mut rows = selection.spanned_rows(false, &display_map); // Avoid re-outdenting a row that has already been outdented by a @@ -3101,7 +3112,7 @@ impl Editor { } for row in rows { - let column = buffer.indent_column_for_line(row); + let column = snapshot.indent_column_for_line(row); if column > 0 { let mut deletion_len = column % tab_size; if deletion_len == 0 { @@ -4245,24 +4256,26 @@ impl Editor { } pub fn toggle_comments(&mut self, _: &ToggleComments, cx: &mut ViewContext) { - // Get the line comment prefix. Split its trailing whitespace into a separate string, - // as that portion won't be used for detecting if a line is a comment. - let full_comment_prefix = - if let Some(prefix) = self.language(cx).and_then(|l| l.line_comment_prefix()) { - prefix.to_string() - } else { - return; - }; - let comment_prefix = full_comment_prefix.trim_end_matches(' '); - let comment_prefix_whitespace = &full_comment_prefix[comment_prefix.len()..]; - self.transact(cx, |this, cx| { let mut selections = this.local_selections::(cx); let mut all_selection_lines_are_comments = true; let mut edit_ranges = Vec::new(); let mut last_toggled_row = None; this.buffer.update(cx, |buffer, cx| { + // TODO: Handle selections that cross excerpts for selection in &mut selections { + // Get the line comment prefix. Split its trailing whitespace into a separate string, + // as that portion won't be used for detecting if a line is a comment. + let full_comment_prefix = if let Some(prefix) = buffer + .language_at(selection.start, cx) + .and_then(|l| l.line_comment_prefix()) + { + prefix.to_string() + } else { + return; + }; + let comment_prefix = full_comment_prefix.trim_end_matches(' '); + let comment_prefix_whitespace = &full_comment_prefix[comment_prefix.len()..]; edit_ranges.clear(); let snapshot = buffer.snapshot(cx); @@ -5670,16 +5683,22 @@ impl Editor { } pub fn soft_wrap_mode(&self, cx: &AppContext) -> SoftWrap { - let language = self.language(cx).map(|language| language.name()); + let language_name = self + .buffer + .read(cx) + .as_singleton() + .and_then(|singleton_buffer| singleton_buffer.read(cx).language()) + .map(|l| l.name()); + let settings = cx.global::(); let mode = self .soft_wrap_mode_override - .unwrap_or_else(|| settings.soft_wrap(language.as_deref())); + .unwrap_or_else(|| settings.soft_wrap(language_name.as_deref())); match mode { settings::SoftWrap::None => SoftWrap::None, settings::SoftWrap::EditorWidth => SoftWrap::EditorWidth, settings::SoftWrap::PreferredLineLength => { - SoftWrap::Column(settings.preferred_line_length(language.as_deref())) + SoftWrap::Column(settings.preferred_line_length(language_name.as_deref())) } } } @@ -6463,14 +6482,18 @@ pub fn styled_runs_for_code_label<'a>( #[cfg(test)] mod tests { + use crate::test::{assert_text_with_selections, select_ranges}; + use super::*; use gpui::{ geometry::rect::RectF, platform::{WindowBounds, WindowOptions}, }; + use indoc::indoc; use language::{FakeLspAdapter, LanguageConfig}; use lsp::FakeLanguageServer; use project::FakeFs; + use settings::LanguageOverride; use smol::stream::StreamExt; use std::{cell::RefCell, rc::Rc, time::Instant}; use text::Point; @@ -6480,7 +6503,7 @@ mod tests { #[gpui::test] fn test_edit_events(cx: &mut MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = cx.add_model(|cx| language::Buffer::new(0, "123456", cx)); let events = Rc::new(RefCell::new(Vec::new())); @@ -6588,7 +6611,7 @@ mod tests { #[gpui::test] fn test_undo_redo_with_selection_restoration(cx: &mut MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let mut now = Instant::now(); let buffer = cx.add_model(|cx| language::Buffer::new(0, "123456", cx)); let group_interval = buffer.read(cx).transaction_group_interval(); @@ -6657,7 +6680,7 @@ mod tests { #[gpui::test] fn test_selection_with_mouse(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaaaaa\nbbbbbb\ncccccc\nddddddd\n", cx); let (_, editor) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -6722,7 +6745,7 @@ mod tests { #[gpui::test] fn test_canceling_pending_selection(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaaaaa\nbbbbbb\ncccccc\ndddddd\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -6754,7 +6777,7 @@ mod tests { #[gpui::test] fn test_navigation_history(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); use workspace::Item; let nav_history = Rc::new(RefCell::new(workspace::NavHistory::default())); let buffer = MultiBuffer::build_simple(&sample_text(30, 5, 'a'), cx); @@ -6814,7 +6837,7 @@ mod tests { #[gpui::test] fn test_cancel(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaaaaa\nbbbbbb\ncccccc\ndddddd\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -6854,7 +6877,7 @@ mod tests { #[gpui::test] fn test_fold(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple( &" impl Foo { @@ -6939,7 +6962,7 @@ mod tests { #[gpui::test] fn test_move_cursor(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(6, 6, 'a'), cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); @@ -7013,7 +7036,7 @@ mod tests { #[gpui::test] fn test_move_cursor_multibyte(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("ⓐⓑⓒⓓⓔ\nabcde\nαβγδε\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); @@ -7114,7 +7137,7 @@ mod tests { #[gpui::test] fn test_move_cursor_different_line_lengths(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("ⓐⓑⓒⓓⓔ\nabcd\nαβγ\nabcd\nⓐⓑⓒⓓⓔ\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); view.update(cx, |view, cx| { @@ -7159,7 +7182,7 @@ mod tests { #[gpui::test] fn test_beginning_end_of_line(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\n def", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7300,7 +7323,7 @@ mod tests { #[gpui::test] fn test_prev_next_word_boundary(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("use std::str::{foo, bar}\n\n {baz.qux()}", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7405,7 +7428,7 @@ mod tests { #[gpui::test] fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("use one::{\n two::three::four::five\n};", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -7458,7 +7481,7 @@ mod tests { #[gpui::test] fn test_delete_to_word_boundary(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("one two three four", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); @@ -7495,7 +7518,7 @@ mod tests { #[gpui::test] fn test_newline(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaaa\n bbbb\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); @@ -7516,7 +7539,7 @@ mod tests { #[gpui::test] fn test_newline_with_old_selections(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple( " a @@ -7601,7 +7624,7 @@ mod tests { #[gpui::test] fn test_insert_with_old_selections(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("a( X ), b( Y ), c( Z )", cx); let (_, editor) = cx.add_window(Default::default(), |cx| { let mut editor = build_editor(buffer.clone(), cx); @@ -7628,81 +7651,226 @@ mod tests { #[gpui::test] fn test_indent_outdent(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); - let buffer = MultiBuffer::build_simple(" one two\nthree\n four", cx); + cx.set_global(Settings::test(cx)); + let buffer = MultiBuffer::build_simple( + indoc! {" + one two + three + four"}, + cx, + ); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); view.update(cx, |view, cx| { // two selections on the same line - view.select_display_ranges( - &[ - DisplayPoint::new(0, 2)..DisplayPoint::new(0, 5), - DisplayPoint::new(0, 6)..DisplayPoint::new(0, 9), - ], + select_ranges( + view, + indoc! {" + [one] [two] + three + four"}, cx, ); // indent from mid-tabstop to full tabstop view.tab(&Tab(Direction::Next), cx); - assert_eq!(view.text(cx), " one two\nthree\n four"); - assert_eq!( - view.selected_display_ranges(cx), - &[ - DisplayPoint::new(0, 4)..DisplayPoint::new(0, 7), - DisplayPoint::new(0, 8)..DisplayPoint::new(0, 11), - ] + assert_text_with_selections( + view, + indoc! {" + [one] [two] + three + four"}, + cx, ); // outdent from 1 tabstop to 0 tabstops view.tab(&Tab(Direction::Prev), cx); - assert_eq!(view.text(cx), "one two\nthree\n four"); - assert_eq!( - view.selected_display_ranges(cx), - &[ - DisplayPoint::new(0, 0)..DisplayPoint::new(0, 3), - DisplayPoint::new(0, 4)..DisplayPoint::new(0, 7), - ] + assert_text_with_selections( + view, + indoc! {" + [one] [two] + three + four"}, + cx, ); // select across line ending - view.select_display_ranges(&[DisplayPoint::new(1, 1)..DisplayPoint::new(2, 0)], cx); + select_ranges( + view, + indoc! {" + one two + t[hree + ] four"}, + cx, + ); // indent and outdent affect only the preceding line view.tab(&Tab(Direction::Next), cx); - assert_eq!(view.text(cx), "one two\n three\n four"); - assert_eq!( - view.selected_display_ranges(cx), - &[DisplayPoint::new(1, 5)..DisplayPoint::new(2, 0)] + assert_text_with_selections( + view, + indoc! {" + one two + t[hree + ] four"}, + cx, ); view.tab(&Tab(Direction::Prev), cx); - assert_eq!(view.text(cx), "one two\nthree\n four"); - assert_eq!( - view.selected_display_ranges(cx), - &[DisplayPoint::new(1, 1)..DisplayPoint::new(2, 0)] + assert_text_with_selections( + view, + indoc! {" + one two + t[hree + ] four"}, + cx, ); // Ensure that indenting/outdenting works when the cursor is at column 0. - view.select_display_ranges(&[DisplayPoint::new(1, 0)..DisplayPoint::new(1, 0)], cx); + select_ranges( + view, + indoc! {" + one two + []three + four"}, + cx, + ); view.tab(&Tab(Direction::Next), cx); - assert_eq!(view.text(cx), "one two\n three\n four"); - assert_eq!( - view.selected_display_ranges(cx), - &[DisplayPoint::new(1, 4)..DisplayPoint::new(1, 4)] + assert_text_with_selections( + view, + indoc! {" + one two + []three + four"}, + cx, ); - view.select_display_ranges(&[DisplayPoint::new(1, 0)..DisplayPoint::new(1, 0)], cx); + select_ranges( + view, + indoc! {" + one two + [] three + four"}, + cx, + ); view.tab(&Tab(Direction::Prev), cx); - assert_eq!(view.text(cx), "one two\nthree\n four"); + assert_text_with_selections( + view, + indoc! {" + one two + []three + four"}, + cx, + ); + }); + } + + #[gpui::test] + fn test_indent_outdent_with_excerpts(cx: &mut gpui::MutableAppContext) { + cx.set_global( + Settings::test(cx) + .with_overrides( + "TOML", + LanguageOverride { + tab_size: Some(2), + ..Default::default() + }, + ) + .with_overrides( + "Rust", + LanguageOverride { + tab_size: Some(4), + ..Default::default() + }, + ), + ); + let toml_language = Arc::new(Language::new( + LanguageConfig { + name: "TOML".into(), + ..Default::default() + }, + None, + )); + let rust_language = Arc::new(Language::new( + LanguageConfig { + name: "Rust".into(), + ..Default::default() + }, + None, + )); + + let toml_buffer = cx + .add_model(|cx| Buffer::new(0, "a = 1\nb = 2\n", cx).with_language(toml_language, cx)); + let rust_buffer = cx.add_model(|cx| { + Buffer::new(0, "const c: usize = 3;\n", cx).with_language(rust_language, cx) + }); + let multibuffer = cx.add_model(|cx| { + let mut multibuffer = MultiBuffer::new(0); + multibuffer.push_excerpts( + toml_buffer.clone(), + [Point::new(0, 0)..Point::new(2, 0)], + cx, + ); + multibuffer.push_excerpts( + rust_buffer.clone(), + [Point::new(0, 0)..Point::new(1, 0)], + cx, + ); + multibuffer + }); + + cx.add_window(Default::default(), |cx| { + let mut editor = build_editor(multibuffer, cx); + assert_eq!( - view.selected_display_ranges(cx), - &[DisplayPoint::new(1, 0)..DisplayPoint::new(1, 0)] + editor.text(cx), + indoc! {" + a = 1 + b = 2 + + const c: usize = 3; + "} ); + + select_ranges( + &mut editor, + indoc! {" + [a] = 1 + b = 2 + + [const c:] usize = 3; + "}, + cx, + ); + + editor.tab(&Tab(Direction::Next), cx); + assert_text_with_selections( + &mut editor, + indoc! {" + [a] = 1 + b = 2 + + [const c:] usize = 3; + "}, + cx, + ); + editor.tab(&Tab(Direction::Prev), cx); + assert_text_with_selections( + &mut editor, + indoc! {" + [a] = 1 + b = 2 + + [const c:] usize = 3; + "}, + cx, + ); + + editor }); } #[gpui::test] fn test_backspace(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let (_, view) = cx.add_window(Default::default(), |cx| { build_editor(MultiBuffer::build_simple("", cx), cx) }); @@ -7747,7 +7915,7 @@ mod tests { #[gpui::test] fn test_delete(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("one two three\nfour five six\nseven eight nine\nten\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); @@ -7775,7 +7943,7 @@ mod tests { #[gpui::test] fn test_delete_line(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\ndef\nghi\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7798,7 +7966,7 @@ mod tests { ); }); - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\ndef\nghi\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7814,7 +7982,7 @@ mod tests { #[gpui::test] fn test_duplicate_line(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\ndef\nghi\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7864,7 +8032,7 @@ mod tests { #[gpui::test] fn test_move_line_up_down(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(10, 5, 'a'), cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -7960,7 +8128,7 @@ mod tests { #[gpui::test] fn test_move_line_up_down_with_blocks(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(10, 5, 'a'), cx); let snapshot = buffer.read(cx).snapshot(cx); let (_, editor) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -7981,7 +8149,7 @@ mod tests { #[gpui::test] fn test_clipboard(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("one✅ two three four five six ", cx); let view = cx .add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)) @@ -8110,7 +8278,7 @@ mod tests { #[gpui::test] fn test_select_all(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\nde\nfgh", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -8124,7 +8292,7 @@ mod tests { #[gpui::test] fn test_select_line(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(6, 5, 'a'), cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -8169,7 +8337,7 @@ mod tests { #[gpui::test] fn test_split_selection_into_lines(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple(&sample_text(9, 5, 'a'), cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); view.update(cx, |view, cx| { @@ -8235,7 +8403,7 @@ mod tests { #[gpui::test] fn test_add_selection_above_below(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("abc\ndefghi\n\njk\nlmno\n", cx); let (_, view) = cx.add_window(Default::default(), |cx| build_editor(buffer, cx)); @@ -8419,7 +8587,7 @@ mod tests { #[gpui::test] fn test_select_next(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let (text, ranges) = marked_text_ranges("[abc]\n[abc] [abc]\ndefabc\n[abc]"); let buffer = MultiBuffer::build_simple(&text, cx); @@ -8449,7 +8617,7 @@ mod tests { #[gpui::test] async fn test_select_larger_smaller_syntax_node(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let language = Arc::new(Language::new( LanguageConfig::default(), Some(tree_sitter_rust::language()), @@ -8590,7 +8758,7 @@ mod tests { #[gpui::test] async fn test_autoindent_selections(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let language = Arc::new( Language::new( LanguageConfig { @@ -8647,7 +8815,7 @@ mod tests { #[gpui::test] async fn test_autoclose_pairs(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let language = Arc::new(Language::new( LanguageConfig { brackets: vec![ @@ -8794,7 +8962,7 @@ mod tests { #[gpui::test] async fn test_snippets(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let text = " a. b @@ -8902,7 +9070,7 @@ mod tests { #[gpui::test] async fn test_format_during_save(cx: &mut gpui::TestAppContext) { cx.foreground().forbid_parking(); - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let mut language = Language::new( LanguageConfig { @@ -8954,6 +9122,7 @@ mod tests { params.text_document.uri, lsp::Url::from_file_path("/file.rs").unwrap() ); + assert_eq!(params.options.tab_size, 4); Ok(Some(vec![lsp::TextEdit::new( lsp::Range::new(lsp::Position::new(0, 3), lsp::Position::new(1, 0)), ", ".to_string(), @@ -8990,11 +9159,39 @@ mod tests { "one\ntwo\nthree\n" ); assert!(!cx.read(|cx| editor.is_dirty(cx))); + + // Set rust language override and assert overriden tabsize is sent to language server + cx.update(|cx| { + cx.update_global::(|settings, _| { + settings.language_overrides.insert( + "Rust".into(), + LanguageOverride { + tab_size: Some(8), + ..Default::default() + }, + ); + }) + }); + + let save = cx.update(|cx| editor.save(project.clone(), cx)); + fake_server + .handle_request::(move |params, _| async move { + assert_eq!( + params.text_document.uri, + lsp::Url::from_file_path("/file.rs").unwrap() + ); + assert_eq!(params.options.tab_size, 8); + Ok(Some(vec![])) + }) + .next() + .await; + cx.foreground().start_waiting(); + save.await.unwrap(); } #[gpui::test] async fn test_completion(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let mut language = Language::new( LanguageConfig { @@ -9235,7 +9432,7 @@ mod tests { #[gpui::test] async fn test_toggle_comment(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let language = Arc::new(Language::new( LanguageConfig { line_comment: Some("// ".to_string()), @@ -9315,7 +9512,7 @@ mod tests { #[gpui::test] fn test_editing_disjoint_excerpts(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx)); let multibuffer = cx.add_model(|cx| { let mut multibuffer = MultiBuffer::new(0); @@ -9358,7 +9555,7 @@ mod tests { #[gpui::test] fn test_editing_overlapping_excerpts(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx)); let multibuffer = cx.add_model(|cx| { let mut multibuffer = MultiBuffer::new(0); @@ -9413,7 +9610,7 @@ mod tests { #[gpui::test] fn test_refresh_selections(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx)); let mut excerpt1_id = None; let multibuffer = cx.add_model(|cx| { @@ -9491,7 +9688,7 @@ mod tests { #[gpui::test] fn test_refresh_selections_while_selecting_with_mouse(cx: &mut gpui::MutableAppContext) { - populate_settings(cx); + cx.set_global(Settings::test(cx)); let buffer = cx.add_model(|cx| Buffer::new(0, sample_text(3, 4, 'a'), cx)); let mut excerpt1_id = None; let multibuffer = cx.add_model(|cx| { @@ -9545,7 +9742,7 @@ mod tests { #[gpui::test] async fn test_extra_newline_insertion(cx: &mut gpui::TestAppContext) { - cx.update(populate_settings); + cx.update(|cx| cx.set_global(Settings::test(cx))); let language = Arc::new(Language::new( LanguageConfig { brackets: vec![ @@ -9613,7 +9810,8 @@ mod tests { #[gpui::test] fn test_highlighted_ranges(cx: &mut gpui::MutableAppContext) { let buffer = MultiBuffer::build_simple(&sample_text(16, 8, 'a'), cx); - populate_settings(cx); + + cx.set_global(Settings::test(cx)); let (_, editor) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); editor.update(cx, |editor, cx| { @@ -9692,7 +9890,8 @@ mod tests { #[gpui::test] fn test_following(cx: &mut gpui::MutableAppContext) { let buffer = MultiBuffer::build_simple(&sample_text(16, 8, 'a'), cx); - populate_settings(cx); + + cx.set_global(Settings::test(cx)); let (_, leader) = cx.add_window(Default::default(), |cx| build_editor(buffer.clone(), cx)); let (_, follower) = cx.add_window( @@ -9859,11 +10058,6 @@ mod tests { Editor::new(EditorMode::Full, buffer, None, None, cx) } - fn populate_settings(cx: &mut gpui::MutableAppContext) { - let settings = Settings::test(cx); - cx.set_global(settings); - } - fn assert_selection_ranges( marked_text: &str, selection_marker_pairs: Vec<(char, char)>, diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index f1e39688be5f363458e4217bd860c71cf0c8ecf9..cf88473435edca75d02042c7ee5ead2da96e1326 100644 --- a/crates/editor/src/multi_buffer.rs +++ b/crates/editor/src/multi_buffer.rs @@ -11,6 +11,7 @@ use language::{ Language, OffsetRangeExt, Outline, OutlineItem, Selection, ToOffset as _, ToPoint as _, ToPointUtf16 as _, TransactionId, }; +use settings::Settings; use std::{ cell::{Ref, RefCell}, cmp, fmt, io, @@ -287,8 +288,6 @@ impl MultiBuffer { S: ToOffset, T: Into, { - let indent_size = crate::INDENT_SIZE; - if self.buffers.borrow().is_empty() { return; } @@ -299,6 +298,8 @@ impl MultiBuffer { .into_iter() .map(|range| range.start.to_offset(&snapshot)..range.end.to_offset(&snapshot)); return buffer.update(cx, |buffer, cx| { + let language_name = buffer.language().map(|language| language.name()); + let indent_size = cx.global::().tab_size(language_name.as_deref()); if autoindent { buffer.edit_with_autoindent(ranges, new_text, indent_size, cx); } else { @@ -394,6 +395,8 @@ impl MultiBuffer { ); } } + let language_name = buffer.language().map(|l| l.name()); + let indent_size = cx.global::().tab_size(language_name.as_deref()); if autoindent { buffer.edit_with_autoindent(deletions, "", indent_size, cx); @@ -863,6 +866,29 @@ impl MultiBuffer { }) } + // If point is at the end of the buffer, the last excerpt is returned + pub fn point_to_buffer_offset<'a, T: ToOffset>( + &'a self, + point: T, + cx: &AppContext, + ) -> Option<(ModelHandle, usize)> { + let snapshot = self.read(cx); + let offset = point.to_offset(&snapshot); + let mut cursor = snapshot.excerpts.cursor::(); + cursor.seek(&offset, Bias::Right, &()); + if cursor.item().is_none() { + cursor.prev(&()); + } + + cursor.item().map(|excerpt| { + let excerpt_start = excerpt.range.start.to_offset(&excerpt.buffer); + let buffer_point = excerpt_start + offset - *cursor.start(); + let buffer = self.buffers.borrow()[&excerpt.buffer_id].buffer.clone(); + + (buffer, buffer_point) + }) + } + pub fn range_to_buffer_ranges<'a, T: ToOffset>( &'a self, range: Range, @@ -1059,12 +1085,13 @@ impl MultiBuffer { .unwrap_or(false) } - pub fn language<'a>(&self, cx: &'a AppContext) -> Option<&'a Arc> { - self.buffers - .borrow() - .values() - .next() - .and_then(|state| state.buffer.read(cx).language()) + pub fn language_at<'a, T: ToOffset>( + &self, + point: T, + cx: &'a AppContext, + ) -> Option<&'a Arc> { + self.point_to_buffer_offset(point, cx) + .and_then(|(buffer, _)| buffer.read(cx).language()) } pub fn file<'a>(&self, cx: &'a AppContext) -> Option<&'a dyn File> { @@ -3762,6 +3789,7 @@ mod tests { #[gpui::test] fn test_history(cx: &mut MutableAppContext) { + cx.set_global(Settings::test(cx)); let buffer_1 = cx.add_model(|cx| Buffer::new(0, "1234", cx)); let buffer_2 = cx.add_model(|cx| Buffer::new(0, "5678", cx)); let multibuffer = cx.add_model(|_| MultiBuffer::new(0)); diff --git a/crates/editor/src/test.rs b/crates/editor/src/test.rs index 7de488a7c70ea1d3cc93e20fd79dbeab80141835..eb23d7e15fd572ae515b5506879ba8118cc09c77 100644 --- a/crates/editor/src/test.rs +++ b/crates/editor/src/test.rs @@ -1,8 +1,9 @@ -use util::test::marked_text; +use gpui::ViewContext; +use util::test::{marked_text, marked_text_ranges}; use crate::{ display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, - DisplayPoint, MultiBuffer, + DisplayPoint, Editor, MultiBuffer, }; #[cfg(test)] @@ -38,3 +39,20 @@ pub fn marked_display_snapshot( (snapshot, markers) } + +pub fn select_ranges(editor: &mut Editor, marked_text: &str, cx: &mut ViewContext) { + let (umarked_text, text_ranges) = marked_text_ranges(marked_text); + assert_eq!(editor.text(cx), umarked_text); + editor.select_ranges(text_ranges, None, cx); +} + +pub fn assert_text_with_selections( + editor: &mut Editor, + marked_text: &str, + cx: &mut ViewContext, +) { + let (unmarked_text, text_ranges) = marked_text_ranges(marked_text); + + assert_eq!(editor.text(cx), unmarked_text); + assert_eq!(editor.selected_ranges(cx), text_ranges); +} diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index d3fa9dbfbf75d2ef26cf6384ff1cce11b8ff6614..3f018206b04752135635fb827c2f9896d24662cc 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -12,7 +12,7 @@ use gpui::{ AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; -use project::{Project, ProjectEntryId, ProjectPath}; +use project::{ProjectEntryId, ProjectPath}; use settings::Settings; use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc}; use util::ResultExt; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index d15e2ce475bdcce8772fbb383581bc68d5acfdc0..86a059e6fde51125be49713311e654e78e934cc3 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -578,7 +578,7 @@ mod tests { assert!(!editor.is_dirty(cx)); assert_eq!(editor.title(cx), "untitled"); assert!(Arc::ptr_eq( - editor.language(cx).unwrap(), + editor.language_at(0, cx).unwrap(), &languages::PLAIN_TEXT )); editor.handle_input(&editor::Input("hi".into()), cx); @@ -602,7 +602,7 @@ mod tests { editor.read_with(cx, |editor, cx| { assert!(!editor.is_dirty(cx)); assert_eq!(editor.title(cx), "the-new-name.rs"); - assert_eq!(editor.language(cx).unwrap().name().as_ref(), "Rust"); + assert_eq!(editor.language_at(0, cx).unwrap().name().as_ref(), "Rust"); }); // Edit the file and save it again. This time, there is no filename prompt. @@ -668,7 +668,7 @@ mod tests { editor.update(cx, |editor, cx| { assert!(Arc::ptr_eq( - editor.language(cx).unwrap(), + editor.language_at(0, cx).unwrap(), &languages::PLAIN_TEXT )); editor.handle_input(&editor::Input("hi".into()), cx); @@ -682,7 +682,7 @@ mod tests { // The buffer is not dirty anymore and the language is assigned based on the path. editor.read_with(cx, |editor, cx| { assert!(!editor.is_dirty(cx)); - assert_eq!(editor.language(cx).unwrap().name().as_ref(), "Rust") + assert_eq!(editor.language_at(0, cx).unwrap().name().as_ref(), "Rust") }); } From ea63df05191a1205c9d7d9cee0c6b31dd5a9608c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 6 Apr 2022 15:46:11 -0700 Subject: [PATCH 099/245] Don't activate the next pane when opening excerpts --- crates/editor/src/editor.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 7ceb3465f816e9356c2f70352c8938c71676b787..030fcb5d8307e0f726e21b4eece9a9c38e2bbddc 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5956,8 +5956,6 @@ impl Editor { // and activating a new item causes the pane to call a method on us reentrantly, // which panics if we're on the stack. cx.defer(move |workspace, cx| { - workspace.activate_next_pane(cx); - for (buffer, ranges) in new_selections_by_buffer.into_iter() { let editor = workspace.open_project_item::(buffer, cx); editor.update(cx, |editor, cx| { From 8f38ac82703f80952fc8b6618d2bb3a2d3c42cda Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 6 Apr 2022 16:35:58 -0700 Subject: [PATCH 100/245] Tweak structure of Project::on_lsp_progress so it can be auto-formatted Previously, rustfmt seems to have given up on formatting this method. --- crates/project/src/project.rs | 139 ++++++++++++++++------------------ 1 file changed, 65 insertions(+), 74 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index d9a905223595facd945adb0567900cbf939c945b..697748f729d41439b0b3bb46afadf252b63e3981 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1633,93 +1633,84 @@ impl Project { return; } }; - - match progress.value { - lsp::ProgressParamsValue::WorkDone(progress) => match progress { - lsp::WorkDoneProgress::Begin(_) => { - let language_server_status = - if let Some(status) = self.language_server_statuses.get_mut(&server_id) { - status - } else { - return; - }; - - if Some(token.as_str()) == disk_based_diagnostics_progress_token { - language_server_status.pending_diagnostic_updates += 1; - if language_server_status.pending_diagnostic_updates == 1 { - self.disk_based_diagnostics_started(cx); - self.broadcast_language_server_update( - server_id, - proto::update_language_server::Variant::DiskBasedDiagnosticsUpdating( - proto::LspDiskBasedDiagnosticsUpdating {}, - ), - ); - } - } else { - self.on_lsp_work_start(server_id, token.clone(), cx); + let progress = match progress.value { + lsp::ProgressParamsValue::WorkDone(value) => value, + }; + let language_server_status = + if let Some(status) = self.language_server_statuses.get_mut(&server_id) { + status + } else { + return; + }; + match progress { + lsp::WorkDoneProgress::Begin(_) => { + if Some(token.as_str()) == disk_based_diagnostics_progress_token { + language_server_status.pending_diagnostic_updates += 1; + if language_server_status.pending_diagnostic_updates == 1 { + self.disk_based_diagnostics_started(cx); self.broadcast_language_server_update( server_id, - proto::update_language_server::Variant::WorkStart( - proto::LspWorkStart { token }, + proto::update_language_server::Variant::DiskBasedDiagnosticsUpdating( + proto::LspDiskBasedDiagnosticsUpdating {}, ), ); } + } else { + self.on_lsp_work_start(server_id, token.clone(), cx); + self.broadcast_language_server_update( + server_id, + proto::update_language_server::Variant::WorkStart(proto::LspWorkStart { + token, + }), + ); } - lsp::WorkDoneProgress::Report(report) => { - if Some(token.as_str()) != disk_based_diagnostics_progress_token { - self.on_lsp_work_progress( - server_id, - token.clone(), - LanguageServerProgress { - message: report.message.clone(), - percentage: report.percentage.map(|p| p as usize), - last_update_at: Instant::now(), + } + lsp::WorkDoneProgress::Report(report) => { + if Some(token.as_str()) != disk_based_diagnostics_progress_token { + self.on_lsp_work_progress( + server_id, + token.clone(), + LanguageServerProgress { + message: report.message.clone(), + percentage: report.percentage.map(|p| p as usize), + last_update_at: Instant::now(), + }, + cx, + ); + self.broadcast_language_server_update( + server_id, + proto::update_language_server::Variant::WorkProgress( + proto::LspWorkProgress { + token, + message: report.message, + percentage: report.percentage.map(|p| p as u32), }, - cx, - ); - self.broadcast_language_server_update( - server_id, - proto::update_language_server::Variant::WorkProgress( - proto::LspWorkProgress { - token, - message: report.message, - percentage: report.percentage.map(|p| p as u32), - }, - ), - ); - } + ), + ); } - lsp::WorkDoneProgress::End(_) => { - if Some(token.as_str()) == disk_based_diagnostics_progress_token { - let language_server_status = if let Some(status) = - self.language_server_statuses.get_mut(&server_id) - { - status - } else { - return; - }; - - language_server_status.pending_diagnostic_updates -= 1; - if language_server_status.pending_diagnostic_updates == 0 { - self.disk_based_diagnostics_finished(cx); - self.broadcast_language_server_update( - server_id, - proto::update_language_server::Variant::DiskBasedDiagnosticsUpdated( - proto::LspDiskBasedDiagnosticsUpdated {}, - ), - ); - } - } else { - self.on_lsp_work_end(server_id, token.clone(), cx); + } + lsp::WorkDoneProgress::End(_) => { + if Some(token.as_str()) == disk_based_diagnostics_progress_token { + language_server_status.pending_diagnostic_updates -= 1; + if language_server_status.pending_diagnostic_updates == 0 { + self.disk_based_diagnostics_finished(cx); self.broadcast_language_server_update( server_id, - proto::update_language_server::Variant::WorkEnd(proto::LspWorkEnd { - token, - }), + proto::update_language_server::Variant::DiskBasedDiagnosticsUpdated( + proto::LspDiskBasedDiagnosticsUpdated {}, + ), ); } + } else { + self.on_lsp_work_end(server_id, token.clone(), cx); + self.broadcast_language_server_update( + server_id, + proto::update_language_server::Variant::WorkEnd(proto::LspWorkEnd { + token, + }), + ); } - }, + } } } From ec837fa6d78e622cbc1b3421dfaf9def772b9ecf Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 6 Apr 2022 17:12:36 -0700 Subject: [PATCH 101/245] Update breadcrumbs when multibuffers' excerpts change --- crates/diagnostics/src/diagnostics.rs | 2 +- crates/editor/src/multi_buffer.rs | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 1d317278a6ab90bb47c5d53b6235d555a13fb1ea..55a41a4468b9737bf83ce6e107d13917f34bd237 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -16,6 +16,7 @@ use language::{ Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, SelectionGoal, }; use project::{DiagnosticSummary, Project, ProjectPath}; +use settings::Settings; use std::{ any::{Any, TypeId}, cmp::Ordering, @@ -26,7 +27,6 @@ use std::{ }; use util::TryFutureExt; use workspace::{ItemHandle as _, ItemNavHistory, Workspace}; -use settings::Settings; action!(Deploy); diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index cf88473435edca75d02042c7ee5ead2da96e1326..ae061196bd75da5516f732d379254cc5e4cb2901 100644 --- a/crates/editor/src/multi_buffer.rs +++ b/crates/editor/src/multi_buffer.rs @@ -788,7 +788,7 @@ impl MultiBuffer { old: edit_start..edit_start, new: edit_start..edit_end, }]); - + cx.emit(Event::Edited); cx.notify(); ids } @@ -802,10 +802,12 @@ impl MultiBuffer { snapshot.trailing_excerpt_update_count += 1; snapshot.is_dirty = false; snapshot.has_conflict = false; + self.subscriptions.publish_mut([Edit { old: 0..prev_len, new: 0..0, }]); + cx.emit(Event::Edited); cx.notify(); } @@ -993,6 +995,7 @@ impl MultiBuffer { } self.subscriptions.publish_mut(edits); + cx.emit(Event::Edited); cx.notify(); } @@ -2928,7 +2931,7 @@ mod tests { use gpui::MutableAppContext; use language::{Buffer, Rope}; use rand::prelude::*; - use std::env; + use std::{env, rc::Rc}; use text::{Point, RandomCharIter}; use util::test::sample_text; @@ -2985,6 +2988,15 @@ mod tests { let buffer_2 = cx.add_model(|cx| Buffer::new(0, sample_text(6, 6, 'g'), cx)); let multibuffer = cx.add_model(|_| MultiBuffer::new(0)); + let events = Rc::new(RefCell::new(Vec::::new())); + multibuffer.update(cx, |_, cx| { + let events = events.clone(); + cx.subscribe(&multibuffer, move |_, _, event, _| { + events.borrow_mut().push(event.clone()) + }) + .detach(); + }); + let subscription = multibuffer.update(cx, |multibuffer, cx| { let subscription = multibuffer.subscribe(); multibuffer.push_excerpts(buffer_1.clone(), [Point::new(1, 2)..Point::new(2, 5)], cx); @@ -3009,6 +3021,12 @@ mod tests { subscription }); + // Adding excerpts emits an edited event. + assert_eq!( + events.borrow().as_slice(), + &[Event::Edited, Event::Edited, Event::Edited] + ); + let snapshot = multibuffer.read(cx).snapshot(cx); assert_eq!( snapshot.text(), From b354af7bdac44cce7b972027dc89a4a1a69a9735 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 6 Apr 2022 22:02:04 -0700 Subject: [PATCH 102/245] Use an unbounded channel in gpui test helper methods The bounded channel could fill up when many events were emitted in one effect cycle. --- crates/gpui/src/app.rs | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 6eb5a8f6165cd2e5053701474018c7365e18072a..dcdd325eae78b9f8e96baa68e4d7f1c3904dac12 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -3392,12 +3392,10 @@ impl ModelHandle { #[cfg(any(test, feature = "test-support"))] pub fn next_notification(&self, cx: &TestAppContext) -> impl Future { - use postage::prelude::{Sink as _, Stream as _}; - - let (mut tx, mut rx) = postage::mpsc::channel(1); + let (tx, mut rx) = futures::channel::mpsc::unbounded(); let mut cx = cx.cx.borrow_mut(); let subscription = cx.observe(self, move |_, _| { - tx.try_send(()).ok(); + tx.unbounded_send(()).ok(); }); let duration = if std::env::var("CI").is_ok() { @@ -3407,7 +3405,7 @@ impl ModelHandle { }; async move { - let notification = crate::util::timeout(duration, rx.recv()) + let notification = crate::util::timeout(duration, rx.next()) .await .expect("next notification timed out"); drop(subscription); @@ -3420,12 +3418,10 @@ impl ModelHandle { where T::Event: Clone, { - use postage::prelude::{Sink as _, Stream as _}; - - let (mut tx, mut rx) = postage::mpsc::channel(1); + let (tx, mut rx) = futures::channel::mpsc::unbounded(); let mut cx = cx.cx.borrow_mut(); let subscription = cx.subscribe(self, move |_, event, _| { - tx.blocking_send(event.clone()).ok(); + tx.unbounded_send(event.clone()).ok(); }); let duration = if std::env::var("CI").is_ok() { @@ -3434,8 +3430,9 @@ impl ModelHandle { Duration::from_secs(1) }; + cx.foreground.start_waiting(); async move { - let event = crate::util::timeout(duration, rx.recv()) + let event = crate::util::timeout(duration, rx.next()) .await .expect("next event timed out"); drop(subscription); @@ -3449,22 +3446,20 @@ impl ModelHandle { cx: &TestAppContext, mut predicate: impl FnMut(&T, &AppContext) -> bool, ) -> impl Future { - use postage::prelude::{Sink as _, Stream as _}; - - let (tx, mut rx) = postage::mpsc::channel(1024); + let (tx, mut rx) = futures::channel::mpsc::unbounded(); let mut cx = cx.cx.borrow_mut(); let subscriptions = ( cx.observe(self, { - let mut tx = tx.clone(); + let tx = tx.clone(); move |_, _| { - tx.blocking_send(()).ok(); + tx.unbounded_send(()).ok(); } }), cx.subscribe(self, { - let mut tx = tx.clone(); + let tx = tx.clone(); move |_, _, _| { - tx.blocking_send(()).ok(); + tx.unbounded_send(()).ok(); } }), ); @@ -3495,7 +3490,7 @@ impl ModelHandle { } cx.borrow().foreground().start_waiting(); - rx.recv() + rx.next() .await .expect("model dropped with pending condition"); cx.borrow().foreground().finish_waiting(); From f73de202d09358b26563628397c68353a8c51471 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 6 Apr 2022 22:02:27 -0700 Subject: [PATCH 103/245] Fix diagnostic updates after restarting an LSP w/ a pending diagnostic job --- crates/diagnostics/src/items.rs | 2 +- crates/project/src/project.rs | 99 ++++++++++++++++++++++++++++++--- 2 files changed, 92 insertions(+), 9 deletions(-) diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index 41826017cdd1a0742265d5884a22e72d8af0f6fa..0f00b6dd7e9db2d022453d328300e00a481c2009 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -3,8 +3,8 @@ use gpui::{ elements::*, platform::CursorStyle, Entity, ModelHandle, RenderContext, View, ViewContext, }; use project::Project; -use workspace::{StatusItemView}; use settings::Settings; +use workspace::StatusItemView; pub struct DiagnosticSummary { summary: project::DiagnosticSummary, diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 697748f729d41439b0b3bb46afadf252b63e3981..3b2259d53515585c069b577c0c37354978998269 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -74,7 +74,6 @@ pub struct Project { client_state: ProjectClientState, collaborators: HashMap, subscriptions: Vec, - language_servers_with_diagnostics_running: isize, opened_buffer: (Rc>>, watch::Receiver<()>), shared_buffers: HashMap>, loading_buffers: HashMap< @@ -330,7 +329,6 @@ impl Project { user_store, fs, next_entry_id: Default::default(), - language_servers_with_diagnostics_running: 0, language_servers: Default::default(), started_language_servers: Default::default(), language_server_statuses: Default::default(), @@ -404,7 +402,6 @@ impl Project { .log_err() }), }, - language_servers_with_diagnostics_running: 0, language_servers: Default::default(), started_language_servers: Default::default(), language_server_settings: Default::default(), @@ -3496,7 +3493,9 @@ impl Project { } pub fn is_running_disk_based_diagnostics(&self) -> bool { - self.language_servers_with_diagnostics_running > 0 + self.language_server_statuses + .values() + .any(|status| status.pending_diagnostic_updates > 0) } pub fn diagnostic_summary(&self, cx: &AppContext) -> DiagnosticSummary { @@ -3524,16 +3523,26 @@ impl Project { } pub fn disk_based_diagnostics_started(&mut self, cx: &mut ModelContext) { - self.language_servers_with_diagnostics_running += 1; - if self.language_servers_with_diagnostics_running == 1 { + if self + .language_server_statuses + .values() + .map(|status| status.pending_diagnostic_updates) + .sum::() + == 1 + { cx.emit(Event::DiskBasedDiagnosticsStarted); } } pub fn disk_based_diagnostics_finished(&mut self, cx: &mut ModelContext) { cx.emit(Event::DiskBasedDiagnosticsUpdated); - self.language_servers_with_diagnostics_running -= 1; - if self.language_servers_with_diagnostics_running == 0 { + if self + .language_server_statuses + .values() + .map(|status| status.pending_diagnostic_updates) + .sum::() + == 0 + { cx.emit(Event::DiskBasedDiagnosticsFinished); } } @@ -5453,6 +5462,80 @@ mod tests { }); } + #[gpui::test] + async fn test_restarting_server_with_diagnostics_running(cx: &mut gpui::TestAppContext) { + cx.foreground().forbid_parking(); + + let progress_token = "the-progress-token"; + let mut language = Language::new( + LanguageConfig { + path_suffixes: vec!["rs".to_string()], + ..Default::default() + }, + None, + ); + let mut fake_servers = language.set_fake_lsp_adapter(FakeLspAdapter { + disk_based_diagnostics_sources: &["disk"], + disk_based_diagnostics_progress_token: Some(progress_token), + ..Default::default() + }); + + let fs = FakeFs::new(cx.background()); + fs.insert_tree("/dir", json!({ "a.rs": "" })).await; + + let project = Project::test(fs, cx); + project.update(cx, |project, _| project.languages.add(Arc::new(language))); + + let worktree_id = project + .update(cx, |project, cx| { + project.find_or_create_local_worktree("/dir", true, cx) + }) + .await + .unwrap() + .0 + .read_with(cx, |tree, _| tree.id()); + + let buffer = project + .update(cx, |project, cx| { + project.open_buffer((worktree_id, "a.rs"), cx) + }) + .await + .unwrap(); + + // Simulate diagnostics starting to update. + let mut fake_server = fake_servers.next().await.unwrap(); + fake_server.start_progress(progress_token).await; + + // Restart the server before the diagnostics finish updating. + project.update(cx, |project, cx| { + project.restart_language_servers_for_buffers([buffer], cx); + }); + let mut events = subscribe(&project, cx); + + // Simulate the newly started server sending more diagnostics. + let mut fake_server = fake_servers.next().await.unwrap(); + fake_server.start_progress(progress_token).await; + assert_eq!( + events.next().await.unwrap(), + Event::DiskBasedDiagnosticsStarted + ); + + // All diagnostics are considered done, despite the old server's diagnostic + // task never completing. + fake_server.end_progress(progress_token).await; + assert_eq!( + events.next().await.unwrap(), + Event::DiskBasedDiagnosticsUpdated + ); + assert_eq!( + events.next().await.unwrap(), + Event::DiskBasedDiagnosticsFinished + ); + project.read_with(cx, |project, _| { + assert!(!project.is_running_disk_based_diagnostics()); + }); + } + #[gpui::test] async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) { cx.foreground().forbid_parking(); From 73f2fd6b09fac05a7c20f0e30b8b03a92041648d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 7 Apr 2022 15:10:09 +0200 Subject: [PATCH 104/245] Pass visible bounds to `Element::dispatch_event` --- crates/editor/src/element.rs | 1 + crates/gpui/examples/text.rs | 1 + crates/gpui/src/elements.rs | 10 +++++++++- crates/gpui/src/elements/align.rs | 3 ++- crates/gpui/src/elements/canvas.rs | 1 + crates/gpui/src/elements/constrained_box.rs | 1 + crates/gpui/src/elements/container.rs | 1 + crates/gpui/src/elements/empty.rs | 1 + crates/gpui/src/elements/event_handler.rs | 2 ++ crates/gpui/src/elements/expanded.rs | 1 + crates/gpui/src/elements/flex.rs | 2 ++ crates/gpui/src/elements/hook.rs | 1 + crates/gpui/src/elements/image.rs | 1 + crates/gpui/src/elements/label.rs | 1 + crates/gpui/src/elements/list.rs | 2 ++ crates/gpui/src/elements/mouse_event_handler.rs | 1 + crates/gpui/src/elements/overlay.rs | 1 + crates/gpui/src/elements/stack.rs | 1 + crates/gpui/src/elements/svg.rs | 1 + crates/gpui/src/elements/text.rs | 1 + crates/gpui/src/elements/uniform_list.rs | 1 + crates/gpui/src/presenter.rs | 1 + crates/workspace/src/workspace.rs | 5 +++-- 23 files changed, 37 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 0ffe3feb6d43cb1ffd0b6eea1c5812f61f41d85c..640ba80ac226c22ecf1bc85e614be48ffb813040 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1147,6 +1147,7 @@ impl Element for EditorElement { &mut self, event: &Event, _: RectF, + _: RectF, layout: &mut LayoutState, paint: &mut PaintState, cx: &mut EventContext, diff --git a/crates/gpui/examples/text.rs b/crates/gpui/examples/text.rs index cc849a5e62fc943b02b1cf07828fff182f44a717..74e2c2c2eaa94bbd49508dae5e0de38f478599c0 100644 --- a/crates/gpui/examples/text.rs +++ b/crates/gpui/examples/text.rs @@ -104,6 +104,7 @@ impl gpui::Element for TextElement { &mut self, _: &gpui::Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut gpui::EventContext, diff --git a/crates/gpui/src/elements.rs b/crates/gpui/src/elements.rs index 79112863b51489ce88827940934fe22e60391b65..55c7bf22fe460979f70ff943cf75fc368148d86b 100644 --- a/crates/gpui/src/elements.rs +++ b/crates/gpui/src/elements.rs @@ -74,6 +74,7 @@ pub trait Element { &mut self, event: &Event, bounds: RectF, + visible_bounds: RectF, layout: &mut Self::LayoutState, paint: &mut Self::PaintState, cx: &mut EventContext, @@ -169,6 +170,7 @@ pub enum Lifecycle { element: T, constraint: SizeConstraint, bounds: RectF, + visible_bounds: RectF, layout: T::LayoutState, paint: T::PaintState, }, @@ -222,6 +224,7 @@ impl AnyElement for Lifecycle { element, constraint, bounds, + visible_bounds, layout, paint, } @@ -242,6 +245,7 @@ impl AnyElement for Lifecycle { element, constraint, bounds, + visible_bounds, layout, paint, } @@ -254,12 +258,13 @@ impl AnyElement for Lifecycle { if let Lifecycle::PostPaint { element, bounds, + visible_bounds, layout, paint, .. } = self { - element.dispatch_event(event, *bounds, layout, paint, cx) + element.dispatch_event(event, *bounds, *visible_bounds, layout, paint, cx) } else { panic!("invalid element lifecycle state"); } @@ -288,6 +293,7 @@ impl AnyElement for Lifecycle { element, constraint, bounds, + visible_bounds, layout, paint, } => { @@ -299,6 +305,8 @@ impl AnyElement for Lifecycle { new_map.insert("type".into(), typ); } new_map.insert("constraint".into(), constraint.to_json()); + new_map.insert("bounds".into(), bounds.to_json()); + new_map.insert("visible_bounds".into(), visible_bounds.to_json()); new_map.append(map); json::Value::Object(new_map) } else { diff --git a/crates/gpui/src/elements/align.rs b/crates/gpui/src/elements/align.rs index ce99437f3ba51ffc1d79a30a6b9c7812fb8fe904..5388f7647e503d65233d551c7cf1b9fd76ff40ae 100644 --- a/crates/gpui/src/elements/align.rs +++ b/crates/gpui/src/elements/align.rs @@ -85,7 +85,8 @@ impl Element for Align { fn dispatch_event( &mut self, event: &Event, - _: pathfinder_geometry::rect::RectF, + _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/canvas.rs b/crates/gpui/src/elements/canvas.rs index d6220fd45f481a97e427ea1092512be3a1f0481d..2e10c59049f6c945829c2311a1f9765d0492c1ef 100644 --- a/crates/gpui/src/elements/canvas.rs +++ b/crates/gpui/src/elements/canvas.rs @@ -59,6 +59,7 @@ where &mut self, _: &crate::Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut crate::EventContext, diff --git a/crates/gpui/src/elements/constrained_box.rs b/crates/gpui/src/elements/constrained_box.rs index c712d71a9b7bac276568202108d0b2236ebcb60c..f12ed6900abc03a50d435fbb5eba859ec02c0e89 100644 --- a/crates/gpui/src/elements/constrained_box.rs +++ b/crates/gpui/src/elements/constrained_box.rs @@ -81,6 +81,7 @@ impl Element for ConstrainedBox { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/container.rs b/crates/gpui/src/elements/container.rs index 73a4349ba025681a232ae0986532db0faa00ed6a..711ab1f6a6265c4b4b96310f1c812eb7e98661df 100644 --- a/crates/gpui/src/elements/container.rs +++ b/crates/gpui/src/elements/container.rs @@ -247,6 +247,7 @@ impl Element for Container { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/empty.rs b/crates/gpui/src/elements/empty.rs index d6041bd9587f0c5694f374e7a152285876f85b5a..90b21231639665aec813967e9595d2673437d777 100644 --- a/crates/gpui/src/elements/empty.rs +++ b/crates/gpui/src/elements/empty.rs @@ -52,6 +52,7 @@ impl Element for Empty { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut EventContext, diff --git a/crates/gpui/src/elements/event_handler.rs b/crates/gpui/src/elements/event_handler.rs index 469bebee1a43f8c7b5b0c542e3e337173d9f0f63..572edf38864bfea242b54d43859baa13b8c4b672 100644 --- a/crates/gpui/src/elements/event_handler.rs +++ b/crates/gpui/src/elements/event_handler.rs @@ -85,6 +85,8 @@ impl Element for EventHandler { &mut self, event: &Event, bounds: RectF, + _: RectF, + visible_bounds: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/expanded.rs b/crates/gpui/src/elements/expanded.rs index cbeef598da649cd397625c482ab3cfb80a68cb9c..6f69d8a92a8bfa2aa647a1cb162de5b74353c72d 100644 --- a/crates/gpui/src/elements/expanded.rs +++ b/crates/gpui/src/elements/expanded.rs @@ -66,6 +66,7 @@ impl Element for Expanded { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 1ae9c591c89c1b5de838b18612696e4a9e6990cb..8c451ea8f707a93cdc7676ccd3c3498ad061a078 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -266,6 +266,7 @@ impl Element for Flex { &mut self, event: &Event, bounds: RectF, + _: RectF, remaining_space: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, @@ -391,6 +392,7 @@ impl Element for FlexItem { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/hook.rs b/crates/gpui/src/elements/hook.rs index 994d5fe281ca1dae5984dd8456ffa32ce5be97a1..e947c3bac7da2a9138298048c3f314f1af0b4ed7 100644 --- a/crates/gpui/src/elements/hook.rs +++ b/crates/gpui/src/elements/hook.rs @@ -57,6 +57,7 @@ impl Element for Hook { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/image.rs b/crates/gpui/src/elements/image.rs index 5d36828d0cd57c1605dd6c7db9246268bb868078..6b55b567b4b4395170c9033d398e0fd91010a960 100644 --- a/crates/gpui/src/elements/image.rs +++ b/crates/gpui/src/elements/image.rs @@ -81,6 +81,7 @@ impl Element for Image { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut EventContext, diff --git a/crates/gpui/src/elements/label.rs b/crates/gpui/src/elements/label.rs index 7aa46f119991010b4dd7cd9a7eee698795ff2c57..e6ae9cbd51330fbd6c411ffebdb9c5deea9b7082 100644 --- a/crates/gpui/src/elements/label.rs +++ b/crates/gpui/src/elements/label.rs @@ -166,6 +166,7 @@ impl Element for Label { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut EventContext, diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs index 624ec4ba7177ed03e7459ef55970f946e22cfe5d..77d37bc3bf3b2dc7e879fc3ddcec8ae64bff283d 100644 --- a/crates/gpui/src/elements/list.rs +++ b/crates/gpui/src/elements/list.rs @@ -253,6 +253,7 @@ impl Element for List { &mut self, event: &Event, bounds: RectF, + _: RectF, scroll_top: &mut ListOffset, _: &mut (), cx: &mut EventContext, @@ -872,6 +873,7 @@ mod tests { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut (), _: &mut (), _: &mut EventContext, diff --git a/crates/gpui/src/elements/mouse_event_handler.rs b/crates/gpui/src/elements/mouse_event_handler.rs index a9cfd3334e87ee8a722372e3f5217331fdc2af3d..d7fb9f01131b863b7c809170084ab48fbe0b8643 100644 --- a/crates/gpui/src/elements/mouse_event_handler.rs +++ b/crates/gpui/src/elements/mouse_event_handler.rs @@ -100,6 +100,7 @@ impl Element for MouseEventHandler { &mut self, event: &Event, bounds: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/overlay.rs b/crates/gpui/src/elements/overlay.rs index 79ab71c07d7cd4da4ae25991881887ed13ec2473..0cac2ed86302c8e7c88ca58fa811ee116b8deff0 100644 --- a/crates/gpui/src/elements/overlay.rs +++ b/crates/gpui/src/elements/overlay.rs @@ -44,6 +44,7 @@ impl Element for Overlay { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/stack.rs b/crates/gpui/src/elements/stack.rs index dd36b9c4b5aebcbebd8c98253084861202d02378..4531734085487dcc1d0e9e6d5cc28154133ba2a3 100644 --- a/crates/gpui/src/elements/stack.rs +++ b/crates/gpui/src/elements/stack.rs @@ -51,6 +51,7 @@ impl Element for Stack { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/elements/svg.rs b/crates/gpui/src/elements/svg.rs index 3e93d3adae3cd721a2c6e4ff501bbda0bf6b5f86..d473e1f0fb01f90dd565e9768ac6da05c4af929d 100644 --- a/crates/gpui/src/elements/svg.rs +++ b/crates/gpui/src/elements/svg.rs @@ -76,6 +76,7 @@ impl Element for Svg { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut EventContext, diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rs index 5caa60c0d7b568e455b5b033301bdd84e1f4704b..a0c3f6ba9fdf09a4d2cde52d7267e64350aff10e 100644 --- a/crates/gpui/src/elements/text.rs +++ b/crates/gpui/src/elements/text.rs @@ -172,6 +172,7 @@ impl Element for Text { &mut self, _: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut EventContext, diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index 7bd3e28a2e384def39f4ddcd523ab5aa8be3683c..526a9aea404ff8cafc2202daf4377cd8aa72c86f 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -281,6 +281,7 @@ where &mut self, event: &Event, bounds: RectF, + _: RectF, layout: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index b4e419107a32dc14ddd80c9bbf5ba2365ec29aa8..8546bed00f2c24da2e22e648feea18164d76fa99 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -535,6 +535,7 @@ impl Element for ChildView { &mut self, event: &Event, _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 7ee7d5cf44ae7e84d04cfd2293ed2f1ffa8e2c7c..b49b6f601f3a9848d4a284286e3eae60077d1138 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -16,7 +16,7 @@ use gpui::{ action, color::Color, elements::*, - geometry::{vector::vec2f, PathBuilder}, + geometry::{rect::RectF, vector::vec2f, PathBuilder}, json::{self, to_string_pretty, ToJson}, keymap::Binding, platform::{CursorStyle, WindowOptions}, @@ -2068,7 +2068,8 @@ impl Element for AvatarRibbon { fn dispatch_event( &mut self, _: &gpui::Event, - _: gpui::geometry::rect::RectF, + _: RectF, + _: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, _: &mut gpui::EventContext, From b3969090352d9882f44fd00dcbe8da30a63ed32f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 7 Apr 2022 15:11:10 +0200 Subject: [PATCH 105/245] Calculate hitbox based on visible bounds in `{Mouse}EventHandler` This is in contrast to not dispatching the event altogether in `Flex` when the event is not contained in the flex element bounds. That approach was problematic because it didn't give an opportunity to `MouseEventHandler`s to handle mouse move events when they didn't intersect with the element bounds, causing elements to never clear their hover state, cursor style, etc. --- crates/gpui/src/elements/event_handler.rs | 9 ++++----- crates/gpui/src/elements/flex.rs | 6 ------ crates/gpui/src/elements/mouse_event_handler.rs | 6 +++--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/gpui/src/elements/event_handler.rs b/crates/gpui/src/elements/event_handler.rs index 572edf38864bfea242b54d43859baa13b8c4b672..340d892d228b94099b894248999a02a28d471795 100644 --- a/crates/gpui/src/elements/event_handler.rs +++ b/crates/gpui/src/elements/event_handler.rs @@ -84,7 +84,6 @@ impl Element for EventHandler { fn dispatch_event( &mut self, event: &Event, - bounds: RectF, _: RectF, visible_bounds: RectF, _: &mut Self::LayoutState, @@ -92,7 +91,7 @@ impl Element for EventHandler { cx: &mut EventContext, ) -> bool { if let Some(capture) = self.capture.as_mut() { - if capture(event, bounds, cx) { + if capture(event, visible_bounds, cx) { return true; } } @@ -103,7 +102,7 @@ impl Element for EventHandler { match event { Event::LeftMouseDown { position, .. } => { if let Some(callback) = self.mouse_down.as_mut() { - if bounds.contains_point(*position) { + if visible_bounds.contains_point(*position) { return callback(cx); } } @@ -111,7 +110,7 @@ impl Element for EventHandler { } Event::RightMouseDown { position, .. } => { if let Some(callback) = self.right_mouse_down.as_mut() { - if bounds.contains_point(*position) { + if visible_bounds.contains_point(*position) { return callback(cx); } } @@ -123,7 +122,7 @@ impl Element for EventHandler { .. } => { if let Some(callback) = self.navigate_mouse_down.as_mut() { - if bounds.contains_point(*position) { + if visible_bounds.contains_point(*position) { return callback(*direction, cx); } } diff --git a/crates/gpui/src/elements/flex.rs b/crates/gpui/src/elements/flex.rs index 8c451ea8f707a93cdc7676ccd3c3498ad061a078..4f930dfb46679cacc7d627374cf7ed0dd3dc1cd6 100644 --- a/crates/gpui/src/elements/flex.rs +++ b/crates/gpui/src/elements/flex.rs @@ -271,12 +271,6 @@ impl Element for Flex { _: &mut Self::PaintState, cx: &mut EventContext, ) -> bool { - if let Some(position) = event.position() { - if !bounds.contains_point(position) { - return false; - } - } - let mut handled = false; for child in &mut self.children { handled = child.dispatch_event(event, cx) || handled; diff --git a/crates/gpui/src/elements/mouse_event_handler.rs b/crates/gpui/src/elements/mouse_event_handler.rs index d7fb9f01131b863b7c809170084ab48fbe0b8643..1d1e934d03be92d80ea48924372fc088198a2631 100644 --- a/crates/gpui/src/elements/mouse_event_handler.rs +++ b/crates/gpui/src/elements/mouse_event_handler.rs @@ -99,8 +99,8 @@ impl Element for MouseEventHandler { fn dispatch_event( &mut self, event: &Event, - bounds: RectF, _: RectF, + visible_bounds: RectF, _: &mut Self::LayoutState, _: &mut Self::PaintState, cx: &mut EventContext, @@ -113,8 +113,8 @@ impl Element for MouseEventHandler { let handled_in_child = self.child.dispatch_event(event, cx); let hit_bounds = RectF::from_points( - bounds.origin() - vec2f(self.padding.left, self.padding.top), - bounds.lower_right() + vec2f(self.padding.right, self.padding.bottom), + visible_bounds.origin() - vec2f(self.padding.left, self.padding.top), + visible_bounds.lower_right() + vec2f(self.padding.right, self.padding.bottom), ) .round_out(); From 80d55fd3d82e26e78382d1575af5f679200c3010 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 7 Apr 2022 08:30:42 -0600 Subject: [PATCH 106/245] Don't starve UI thread when rapidly receiving LSP messages Co-Authored-By: Antonio Scandurra --- crates/lsp/src/lsp.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index f5fc98640d7400160b104ec6654d0260c3ffd25c..c0b21eeedaa0b12b30a7adae8b274bd4f3bb6e09 100644 --- a/crates/lsp/src/lsp.rs +++ b/crates/lsp/src/lsp.rs @@ -201,6 +201,9 @@ impl LanguageServer { std::str::from_utf8(&buffer)? )); } + + // Don't starve the main thread when receiving lots of messages at once. + smol::future::yield_now().await; } } .log_err() From 717f53e3d28b8e48ac2e0888b2fc478e42f54336 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 7 Apr 2022 09:29:47 -0600 Subject: [PATCH 107/245] WIP --- crates/server/Cargo.toml | 2 +- crates/server/src/rpc.rs | 73 ++++++++++++++++++++++++++++------------ 2 files changed, 52 insertions(+), 23 deletions(-) diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 6e27fa16c523cf0908f10fff8cdf772c54269b84..f6d10517bd44e2ab642ca77801f8a6912e677302 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -14,7 +14,6 @@ required-features = ["seed-support"] [dependencies] collections = { path = "../collections" } -settings = { path = "../settings" } rpc = { path = "../rpc" } anyhow = "1.0.40" async-io = "1.3" @@ -65,6 +64,7 @@ editor = { path = "../editor", features = ["test-support"] } language = { path = "../language", features = ["test-support"] } lsp = { path = "../lsp", features = ["test-support"] } project = { path = "../project", features = ["test-support"] } +settings = { path = "../settings", features = ["test-support"] } workspace = { path = "../workspace", features = ["test-support"] } ctor = "0.1" env_logger = "0.8" diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 51c7807660708ea47209a5d133d2f7128e33b4f7..61a1e7cc65704768a15fe3aa7da597250c2c96d7 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1080,7 +1080,7 @@ mod tests { use ::rpc::Peer; use client::{ self, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Credentials, - EstablishConnectionError, UserStore, + EstablishConnectionError, UserStore, RECEIVE_TIMEOUT, }; use collections::BTreeMap; use editor::{ @@ -4983,6 +4983,7 @@ mod tests { let operations = Rc::new(Cell::new(0)); let mut server = TestServer::start(cx.foreground(), cx.background()).await; let mut clients = Vec::new(); + let mut user_ids = Vec::new(); let files = Arc::new(Mutex::new(Vec::new())); let mut next_entity_id = 100000; @@ -5150,13 +5151,14 @@ mod tests { }); host_language_registry.add(Arc::new(language)); + user_ids.push(host.current_user_id(&host_cx)); clients.push(cx.foreground().spawn(host.simulate_host( host_project, files, operations.clone(), max_operations, rng.clone(), - host_cx, + &mut host_cx, ))); while operations.get() < max_operations { @@ -5191,6 +5193,7 @@ mod tests { ) .await .unwrap(); + user_ids.push(guest.current_user_id(&guest_cx)); clients.push(cx.foreground().spawn(guest.simulate_guest( guest_id, guest_project, @@ -5201,6 +5204,30 @@ mod tests { ))); log::info!("Guest {} added", guest_id); + } else if rng.lock().gen_bool(0.05) { + server.disconnect_client(user_ids[0]); + cx.foreground().advance_clock(RECEIVE_TIMEOUT); + let mut clients = futures::future::join_all(clients).await; + cx.foreground().run_until_parked(); + + let store = server.store.read(); + let (host, host_cx) = clients.remove(0); + host.project + .as_ref() + .unwrap() + .read_with(&host_cx, |project, _| assert!(!project.is_shared())); + for (guest, guest_cx) in clients { + assert!(store + .contacts_for_user(guest.current_user_id(&guest_cx)) + .is_empty()); + guest + .project + .as_ref() + .unwrap() + .read_with(&guest_cx, |project, _| assert!(project.is_read_only())); + } + + return; } } @@ -5471,6 +5498,14 @@ mod tests { } } + impl Deref for TestServer { + type Target = Server; + + fn deref(&self) -> &Self::Target { + &self.server + } + } + impl Drop for TestServer { fn drop(&mut self) { self.peer.reset(); @@ -5584,15 +5619,15 @@ mod tests { } async fn simulate_host( - mut self, + &mut self, project: ModelHandle, files: Arc>>, operations: Rc>, max_operations: usize, rng: Arc>, - mut cx: TestAppContext, - ) -> (Self, TestAppContext) { - let fs = project.read_with(&cx, |project, _| project.fs().clone()); + cx: &mut TestAppContext, + ) -> anyhow::Result<()> { + let fs = project.read_with(cx, |project, _| project.fs().clone()); while operations.get() < max_operations { operations.set(operations.get() + 1); @@ -5609,29 +5644,25 @@ mod tests { } log::info!("Host: find/create local worktree {:?}", path); - let find_or_create_worktree = project.update(&mut cx, |project, cx| { + let find_or_create_worktree = project.update(cx, |project, cx| { project.find_or_create_local_worktree(path, true, cx) }); - let find_or_create_worktree = async move { - find_or_create_worktree.await.unwrap(); - }; if rng.lock().gen() { cx.background().spawn(find_or_create_worktree).detach(); } else { - find_or_create_worktree.await; + find_or_create_worktree.await?; } } 10..=80 if !files.lock().is_empty() => { let buffer = if self.buffers.is_empty() || rng.lock().gen() { let file = files.lock().choose(&mut *rng.lock()).unwrap().clone(); let (worktree, path) = project - .update(&mut cx, |project, cx| { + .update(cx, |project, cx| { project.find_or_create_local_worktree(file.clone(), true, cx) }) - .await - .unwrap(); + .await?; let project_path = - worktree.read_with(&cx, |worktree, _| (worktree.id(), path)); + worktree.read_with(cx, |worktree, _| (worktree.id(), path)); log::info!( "Host: opening path {:?}, worktree {}, relative_path {:?}", file, @@ -5639,9 +5670,7 @@ mod tests { project_path.1 ); let buffer = project - .update(&mut cx, |project, cx| { - project.open_buffer(project_path, cx) - }) + .update(cx, |project, cx| project.open_buffer(project_path, cx)) .await .unwrap(); self.buffers.insert(buffer.clone()); @@ -5664,7 +5693,7 @@ mod tests { drop(buffer); }); } else { - buffer.update(&mut cx, |buffer, cx| { + buffer.update(cx, |buffer, cx| { log::info!( "Host: updating buffer {:?} ({})", buffer.file().unwrap().full_path(cx), @@ -5701,10 +5730,10 @@ mod tests { cx.background().simulate_random_delay().await; } - log::info!("Host done"); - self.project = Some(project); - (self, cx) + + log::info!("Host done"); + Ok(()) } pub async fn simulate_guest( From 206b0f0f8cc128aec19653e289cab7babe77ab24 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 7 Apr 2022 12:03:43 -0700 Subject: [PATCH 108/245] 0.25.0 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec9c58b1a9b50e5c95b8c43dcae99bd7a25b8dca..e4b99c656691def6257363a1dfe14c2f9bbc7cd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6012,7 +6012,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.24.1" +version = "0.25.0" dependencies = [ "anyhow", "async-compression", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 25f45b9cc03333f247ade91f23febc5893d0b3b7..f87046b05ebc5479d6282efd30028500f7a49c53 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.24.1" +version = "0.25.0" [lib] name = "zed" From 035cd37aa86917c43bc73a0d584751dbf9be865e Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 7 Apr 2022 16:00:51 -0700 Subject: [PATCH 109/245] Add explicit types for LanguageOverrides and Themes to SettingsFileContent in order to improve completions in zed settings file --- crates/settings/src/settings.rs | 71 +++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 8 deletions(-) diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index c897586017bf40b7fb2963fa0c389fb5ca7c0c9f..3dcb55b2fe0899095a77b61f99a846582d1051f6 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -1,8 +1,11 @@ use anyhow::Result; use gpui::font_cache::{FamilyId, FontCache}; -use schemars::{schema_for, JsonSchema}; +use schemars::{ + gen::{SchemaGenerator, SchemaSettings}, + JsonSchema, +}; use serde::Deserialize; -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, fmt::Display, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; @@ -33,6 +36,53 @@ pub enum SoftWrap { PreferredLineLength, } +#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)] +pub enum ThemeNames { + Dark, + Light, +} + +impl Display for ThemeNames { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ThemeNames::Dark => write!(f, "Dark"), + ThemeNames::Light => write!(f, "Light"), + } + } +} + +#[derive(Clone, Debug, Deserialize, Default, JsonSchema)] +pub struct LanguageOverrides { + C: Option, + JSON: Option, + Markdown: Option, + PlainText: Option, + Rust: Option, + TSX: Option, + TypeScript: Option, +} + +impl IntoIterator for LanguageOverrides { + type Item = (String, LanguageOverride); + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + vec![ + ("C", self.C), + ("JSON", self.JSON), + ("Markdown", self.Markdown), + ("PlainText", self.PlainText), + ("Rust", self.Rust), + ("TSX", self.TSX), + ("TypeScript", self.TypeScript), + ] + .into_iter() + .filter_map(|(name, language_override)| language_override.map(|lo| (name.to_owned(), lo))) + .collect::>() + .into_iter() + } +} + #[derive(Clone, Debug, Default, Deserialize, JsonSchema)] pub struct SettingsFileContent { #[serde(default)] @@ -44,9 +94,9 @@ pub struct SettingsFileContent { #[serde(flatten)] pub editor: LanguageOverride, #[serde(default)] - pub language_overrides: HashMap, LanguageOverride>, + pub language_overrides: LanguageOverrides, #[serde(default)] - pub theme: Option, + pub theme: Option, } impl Settings { @@ -68,7 +118,12 @@ impl Settings { } pub fn file_json_schema() -> serde_json::Value { - serde_json::to_value(schema_for!(SettingsFileContent)).unwrap() + let settings = SchemaSettings::draft07().with(|settings| { + settings.option_nullable = true; + settings.option_add_null_type = false; + }); + let generator = SchemaGenerator::new(settings); + serde_json::to_value(generator.into_root_schema_for::()).unwrap() } pub fn with_overrides( @@ -128,7 +183,7 @@ impl Settings { } } if let Some(value) = &data.theme { - if let Some(theme) = theme_registry.get(value).log_err() { + if let Some(theme) = theme_registry.get(&value.to_string()).log_err() { self.theme = theme; } } @@ -142,10 +197,10 @@ impl Settings { data.editor.preferred_line_length, ); - for (language_name, settings) in &data.language_overrides { + for (language_name, settings) in data.language_overrides.clone().into_iter() { let target = self .language_overrides - .entry(language_name.clone()) + .entry(language_name.into()) .or_default(); merge_option(&mut target.tab_size, settings.tab_size); From 5242a3a6dcf1faf93dbcfc85406a15a906f017e2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 7 Apr 2022 16:20:49 -0700 Subject: [PATCH 110/245] Restructure action macro to assign a namespace to every action Also, allow arbitrary types to be used as Actions via the impl_actions macro Co-authored-by: Nathan Sobo Co-authored-by: Keith Simmons --- crates/chat_panel/src/chat_panel.rs | 5 +- crates/client/src/client.rs | 4 +- crates/diagnostics/src/diagnostics.rs | 4 +- crates/editor/src/editor.rs | 203 +++++++++++------- crates/file_finder/src/file_finder.rs | 10 +- crates/go_to_line/src/go_to_line.rs | 5 +- crates/gpui/src/app.rs | 112 ++-------- crates/gpui/src/app/action.rs | 56 +++++ crates/gpui/src/keymap.rs | 16 +- crates/gpui/src/platform.rs | 4 +- crates/gpui/src/platform/mac/platform.rs | 8 +- crates/gpui/src/platform/test.rs | 4 +- crates/gpui/src/presenter.rs | 4 +- crates/gpui/src/views/select.rs | 11 +- crates/journal/src/journal.rs | 4 +- crates/outline/src/outline.rs | 4 +- crates/project_panel/src/project_panel.rs | 15 +- crates/project_symbols/src/project_symbols.rs | 4 +- crates/search/src/buffer_search.rs | 14 +- crates/search/src/project_search.rs | 7 +- crates/search/src/search.rs | 11 +- crates/server/src/rpc.rs | 26 ++- crates/theme_selector/src/theme_selector.rs | 13 +- crates/vim/src/insert.rs | 7 +- crates/vim/src/normal.rs | 47 ++-- crates/vim/src/normal/g_prefix.rs | 7 +- crates/vim/src/vim.rs | 7 +- crates/workspace/src/lsp_status.rs | 8 +- crates/workspace/src/menu.rs | 11 +- crates/workspace/src/pane.rs | 38 +++- crates/workspace/src/sidebar.rs | 11 +- crates/workspace/src/workspace.rs | 47 ++-- crates/zed/src/zed.rs | 13 +- 33 files changed, 433 insertions(+), 307 deletions(-) create mode 100644 crates/gpui/src/app/action.rs diff --git a/crates/chat_panel/src/chat_panel.rs b/crates/chat_panel/src/chat_panel.rs index 9d575768a6385e106f484fde00a5a68d54d6be0f..3e432f98c1a8c1a4b30a01bd78c16efd3cf3a5ba 100644 --- a/crates/chat_panel/src/chat_panel.rs +++ b/crates/chat_panel/src/chat_panel.rs @@ -4,7 +4,7 @@ use client::{ }; use editor::Editor; use gpui::{ - action, + actions, elements::*, keymap::Binding, platform::CursorStyle, @@ -33,8 +33,7 @@ pub struct ChatPanel { pub enum Event {} -action!(Send); -action!(LoadMoreMessages); +actions!(chat_panel, [Send, LoadMoreMessages]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(ChatPanel::send); diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 1bae6cd49e5eb9f5e24b86f6165b7a647c6a30e8..2a563914c923511e9228d4b0aa56295905285b35 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -13,7 +13,7 @@ use async_tungstenite::tungstenite::{ }; use futures::{future::LocalBoxFuture, FutureExt, StreamExt}; use gpui::{ - action, AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AnyWeakViewHandle, AsyncAppContext, + actions, AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AnyWeakViewHandle, AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext, Task, View, ViewContext, ViewHandle, }; use http::HttpClient; @@ -50,7 +50,7 @@ lazy_static! { .and_then(|s| if s.is_empty() { None } else { Some(s) }); } -action!(Authenticate); +actions!(client, [Authenticate]); pub fn init(rpc: Arc, cx: &mut MutableAppContext) { cx.add_global_action(move |_: &Authenticate, cx| { diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 55a41a4468b9737bf83ce6e107d13917f34bd237..ba5a518673c66e18ff45fb961ecb14bc601b4b32 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -8,7 +8,7 @@ use editor::{ highlight_diagnostic_message, Editor, ExcerptId, MultiBuffer, ToOffset, }; use gpui::{ - action, elements::*, fonts::TextStyle, keymap::Binding, AnyViewHandle, AppContext, Entity, + actions, elements::*, fonts::TextStyle, keymap::Binding, AnyViewHandle, AppContext, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; @@ -28,7 +28,7 @@ use std::{ use util::TryFutureExt; use workspace::{ItemHandle as _, ItemNavHistory, Workspace}; -action!(Deploy); +actions!(diagnostics, [Deploy]); const CONTEXT_LINE_COUNT: u32 = 1; diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 030fcb5d8307e0f726e21b4eece9a9c38e2bbddc..e201f5f3664405c35d0396ace1d2cf6c30f6ac38 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -16,12 +16,13 @@ use display_map::*; pub use element::*; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - action, + actions, color::Color, elements::*, executor, fonts::{self, HighlightStyle, TextStyle}, geometry::vector::{vec2f, Vector2F}, + impl_actions, keymap::Binding, platform::CursorStyle, text_layout, AppContext, AsyncAppContext, ClipboardItem, Element, ElementBox, Entity, @@ -65,84 +66,128 @@ const MAX_LINE_LEN: usize = 1024; const MIN_NAVIGATION_HISTORY_ROW_DELTA: i64 = 10; const MAX_SELECTION_HISTORY_LEN: usize = 1024; -action!(Cancel); -action!(Backspace); -action!(Delete); -action!(Input, String); -action!(Newline); -action!(Tab, Direction); -action!(Indent); -action!(Outdent); -action!(DeleteLine); -action!(DeleteToPreviousWordStart); -action!(DeleteToPreviousSubwordStart); -action!(DeleteToNextWordEnd); -action!(DeleteToNextSubwordEnd); -action!(DeleteToBeginningOfLine); -action!(DeleteToEndOfLine); -action!(CutToEndOfLine); -action!(DuplicateLine); -action!(MoveLineUp); -action!(MoveLineDown); -action!(Cut); -action!(Copy); -action!(Paste); -action!(Undo); -action!(Redo); -action!(MoveUp); -action!(MoveDown); -action!(MoveLeft); -action!(MoveRight); -action!(MoveToPreviousWordStart); -action!(MoveToPreviousSubwordStart); -action!(MoveToNextWordEnd); -action!(MoveToNextSubwordEnd); -action!(MoveToBeginningOfLine); -action!(MoveToEndOfLine); -action!(MoveToBeginning); -action!(MoveToEnd); -action!(SelectUp); -action!(SelectDown); -action!(SelectLeft); -action!(SelectRight); -action!(SelectToPreviousWordStart); -action!(SelectToPreviousSubwordStart); -action!(SelectToNextWordEnd); -action!(SelectToNextSubwordEnd); -action!(SelectToBeginningOfLine, bool); -action!(SelectToEndOfLine, bool); -action!(SelectToBeginning); -action!(SelectToEnd); -action!(SelectAll); -action!(SelectLine); -action!(SplitSelectionIntoLines); -action!(AddSelectionAbove); -action!(AddSelectionBelow); -action!(SelectNext, bool); -action!(ToggleComments); -action!(SelectLargerSyntaxNode); -action!(SelectSmallerSyntaxNode); -action!(MoveToEnclosingBracket); -action!(UndoSelection); -action!(RedoSelection); -action!(GoToDiagnostic, Direction); -action!(GoToDefinition); -action!(FindAllReferences); -action!(Rename); -action!(ConfirmRename); -action!(PageUp); -action!(PageDown); -action!(Fold); -action!(UnfoldLines); -action!(FoldSelectedRanges); -action!(Scroll, Vector2F); -action!(Select, SelectPhase); -action!(ShowCompletions); -action!(ToggleCodeActions, bool); -action!(ConfirmCompletion, Option); -action!(ConfirmCodeAction, Option); -action!(OpenExcerpts); -action!(RestartLanguageServer); +#[derive(Clone)] +pub struct SelectNext(pub bool); + +#[derive(Clone)] +pub struct GoToDiagnostic(pub Direction); + +#[derive(Clone)] +pub struct Scroll(pub Vector2F); + +#[derive(Clone)] +pub struct Select(pub SelectPhase); + +#[derive(Clone)] +pub struct Input(pub String); + +#[derive(Clone)] +pub struct Tab(pub Direction); + +#[derive(Clone)] +pub struct SelectToBeginningOfLine(pub bool); + +#[derive(Clone)] +pub struct SelectToEndOfLine(pub bool); + +#[derive(Clone)] +pub struct ToggleCodeActions(pub bool); + +#[derive(Clone)] +pub struct ConfirmCompletion(pub Option); + +#[derive(Clone)] +pub struct ConfirmCodeAction(pub Option); + +impl_actions!( + editor, + [ + SelectNext, + GoToDiagnostic, + Scroll, + Select, + Input, + Tab, + SelectToBeginningOfLine, + SelectToEndOfLine, + ToggleCodeActions, + ConfirmCompletion, + ConfirmCodeAction, + ] +); + +actions!( + editor, + [ + Cancel, + Backspace, + Delete, + Newline, + Indent, + Outdent, + DeleteLine, + DeleteToPreviousWordStart, + DeleteToPreviousSubwordStart, + DeleteToNextWordEnd, + DeleteToNextSubwordEnd, + DeleteToBeginningOfLine, + DeleteToEndOfLine, + CutToEndOfLine, + DuplicateLine, + MoveLineUp, + MoveLineDown, + Cut, + Copy, + Paste, + Undo, + Redo, + MoveUp, + MoveDown, + MoveLeft, + MoveRight, + MoveToPreviousWordStart, + MoveToPreviousSubwordStart, + MoveToNextWordEnd, + MoveToNextSubwordEnd, + MoveToBeginningOfLine, + MoveToEndOfLine, + MoveToBeginning, + MoveToEnd, + SelectUp, + SelectDown, + SelectLeft, + SelectRight, + SelectToPreviousWordStart, + SelectToPreviousSubwordStart, + SelectToNextWordEnd, + SelectToNextSubwordEnd, + SelectToBeginning, + SelectToEnd, + SelectAll, + SelectLine, + SplitSelectionIntoLines, + AddSelectionAbove, + AddSelectionBelow, + ToggleComments, + SelectLargerSyntaxNode, + SelectSmallerSyntaxNode, + MoveToEnclosingBracket, + UndoSelection, + RedoSelection, + GoToDefinition, + FindAllReferences, + Rename, + ConfirmRename, + PageUp, + PageDown, + Fold, + UnfoldLines, + FoldSelectedRanges, + ShowCompletions, + OpenExcerpts, + RestartLanguageServer, + ] +); enum DocumentHighlightRead {} enum DocumentHighlightWrite {} diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 7c4bfbd93d52adf844b81ca1c774abc5b857ca2c..af9fd910b57402d7dfead84574623cc50a31dc61 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -1,8 +1,9 @@ use editor::Editor; use fuzzy::PathMatch; use gpui::{ - action, + actions, elements::*, + impl_actions, keymap::{self, Binding}, AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, @@ -37,8 +38,11 @@ pub struct FileFinder { list_state: UniformListState, } -action!(Toggle); -action!(Select, ProjectPath); +#[derive(Clone)] +pub struct Select(pub ProjectPath); + +impl_actions!(file_finder, [Select]); +actions!(file_finder, [Toggle]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(FileFinder::toggle); diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 19b43d572148b8f0c13534bd4ae11fb784cdbe88..9995736550dab5a6598cd54249f52e96c85581b8 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -1,14 +1,13 @@ use editor::{display_map::ToDisplayPoint, Autoscroll, DisplayPoint, Editor}; use gpui::{ - action, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity, + actions, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; use settings::Settings; use text::{Bias, Point}; use workspace::Workspace; -action!(Toggle); -action!(Confirm); +actions!(go_to_line, [Toggle, Confirm]); pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index dcdd325eae78b9f8e96baa68e4d7f1c3904dac12..3fc56527917a37a85110506c70d202e14a4a9a16 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1,3 +1,5 @@ +pub mod action; + use crate::{ elements::ElementBox, executor::{self, Task}, @@ -7,6 +9,7 @@ use crate::{ util::post_inc, AssetCache, AssetSource, ClipboardItem, FontCache, PathPromptOptions, TextLayoutCache, }; +pub use action::*; use anyhow::{anyhow, Result}; use collections::btree_map; use keymap::MatchResult; @@ -142,89 +145,6 @@ pub trait ElementStateContext: DerefMut { } } -pub trait Action: 'static + AnyAction { - type Argument: 'static + Clone; -} - -pub trait AnyAction { - fn id(&self) -> TypeId; - fn name(&self) -> &'static str; - fn as_any(&self) -> &dyn Any; - fn boxed_clone(&self) -> Box; - fn boxed_clone_as_any(&self) -> Box; -} - -#[macro_export] -macro_rules! action { - ($name:ident, $arg:ty) => { - #[derive(Clone)] - pub struct $name(pub $arg); - - impl $crate::Action for $name { - type Argument = $arg; - } - - impl $crate::AnyAction for $name { - fn id(&self) -> std::any::TypeId { - std::any::TypeId::of::<$name>() - } - - fn name(&self) -> &'static str { - stringify!($name) - } - - fn as_any(&self) -> &dyn std::any::Any { - self - } - - fn boxed_clone(&self) -> Box { - Box::new(self.clone()) - } - - fn boxed_clone_as_any(&self) -> Box { - Box::new(self.clone()) - } - } - - impl From<$arg> for $name { - fn from(arg: $arg) -> Self { - Self(arg) - } - } - }; - - ($name:ident) => { - #[derive(Clone, Debug, Eq, PartialEq)] - pub struct $name; - - impl $crate::Action for $name { - type Argument = (); - } - - impl $crate::AnyAction for $name { - fn id(&self) -> std::any::TypeId { - std::any::TypeId::of::<$name>() - } - - fn name(&self) -> &'static str { - stringify!($name) - } - - fn as_any(&self) -> &dyn std::any::Any { - self - } - - fn boxed_clone(&self) -> Box { - Box::new(self.clone()) - } - - fn boxed_clone_as_any(&self) -> Box { - Box::new(self.clone()) - } - } - }; -} - pub struct Menu<'a> { pub name: &'a str, pub items: Vec>, @@ -234,7 +154,7 @@ pub enum MenuItem<'a> { Action { name: &'a str, keystroke: Option<&'a str>, - action: Box, + action: Box, }, Separator, } @@ -787,8 +707,8 @@ impl ReadViewWith for TestAppContext { } type ActionCallback = - dyn FnMut(&mut dyn AnyView, &dyn AnyAction, &mut MutableAppContext, usize, usize); -type GlobalActionCallback = dyn FnMut(&dyn AnyAction, &mut MutableAppContext); + dyn FnMut(&mut dyn AnyView, &dyn Action, &mut MutableAppContext, usize, usize); +type GlobalActionCallback = dyn FnMut(&dyn Action, &mut MutableAppContext); type SubscriptionCallback = Box bool>; type GlobalSubscriptionCallback = Box; @@ -963,7 +883,7 @@ impl MutableAppContext { { let handler = Box::new( move |view: &mut dyn AnyView, - action: &dyn AnyAction, + action: &dyn Action, cx: &mut MutableAppContext, window_id: usize, view_id: usize| { @@ -1009,7 +929,7 @@ impl MutableAppContext { A: Action, F: 'static + FnMut(&A, &mut MutableAppContext), { - let handler = Box::new(move |action: &dyn AnyAction, cx: &mut MutableAppContext| { + let handler = Box::new(move |action: &dyn Action, cx: &mut MutableAppContext| { let action = action.as_any().downcast_ref().unwrap(); handler(action, cx); }); @@ -1338,7 +1258,7 @@ impl MutableAppContext { &mut self, window_id: usize, path: &[usize], - action: &dyn AnyAction, + action: &dyn Action, ) -> bool { self.update(|this| { this.halt_action_dispatch = false; @@ -1398,7 +1318,7 @@ impl MutableAppContext { self.dispatch_global_action_any(&action); } - fn dispatch_global_action_any(&mut self, action: &dyn AnyAction) -> bool { + fn dispatch_global_action_any(&mut self, action: &dyn Action) -> bool { self.update(|this| { if let Some((name, mut handler)) = this.global_actions.remove_entry(&action.id()) { handler(action, this); @@ -4655,7 +4575,7 @@ impl RefCounts { #[cfg(test)] mod tests { use super::*; - use crate::elements::*; + use crate::{elements::*, impl_actions}; use smol::future::poll_once; use std::{ cell::Cell, @@ -5801,7 +5721,10 @@ mod tests { } } - action!(Action, &'static str); + #[derive(Clone)] + pub struct Action(pub &'static str); + + impl_actions!(test, [Action]); let actions = Rc::new(RefCell::new(Vec::new())); @@ -5909,7 +5832,10 @@ mod tests { #[crate::test(self)] fn test_dispatch_keystroke(cx: &mut MutableAppContext) { - action!(Action, &'static str); + #[derive(Clone)] + pub struct Action(pub &'static str); + + impl_actions!(test, [Action]); struct View { id: usize, diff --git a/crates/gpui/src/app/action.rs b/crates/gpui/src/app/action.rs new file mode 100644 index 0000000000000000000000000000000000000000..79606feee7dd7b6306750b7b71ec7ec655916ed8 --- /dev/null +++ b/crates/gpui/src/app/action.rs @@ -0,0 +1,56 @@ +use std::any::{Any, TypeId}; + +pub trait Action: 'static { + fn id(&self) -> TypeId; + fn namespace(&self) -> &'static str; + fn name(&self) -> &'static str; + fn as_any(&self) -> &dyn Any; + fn boxed_clone(&self) -> Box; + fn boxed_clone_as_any(&self) -> Box; +} + +#[macro_export] +macro_rules! impl_actions { + ($namespace:path, [ $($name:ident),* $(,)? ]) => { + $( + impl $crate::action::Action for $name { + fn id(&self) -> std::any::TypeId { + std::any::TypeId::of::<$name>() + } + + fn namespace(&self) -> &'static str { + stringify!($namespace) + } + + fn name(&self) -> &'static str { + stringify!($name) + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } + + fn boxed_clone(&self) -> Box { + Box::new(self.clone()) + } + + fn boxed_clone_as_any(&self) -> Box { + Box::new(self.clone()) + } + } + )* + }; +} + +#[macro_export] +macro_rules! actions { + ($namespace:path, [ $($name:ident),* $(,)? ]) => { + + $( + #[derive(Clone, Debug, Default, PartialEq, Eq)] + pub struct $name; + )* + + $crate::impl_actions!($namespace, [ $($name),* ]); + }; +} diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 37223d77d1e74cbf1694e643b7c7dfcb6177713c..f286265964046b10ace59a74ce4915ad3ee2fec7 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -1,3 +1,4 @@ +use crate::Action; use anyhow::anyhow; use std::{ any::Any, @@ -6,8 +7,6 @@ use std::{ }; use tree_sitter::{Language, Node, Parser}; -use crate::{Action, AnyAction}; - extern "C" { fn tree_sitter_context_predicate() -> Language; } @@ -28,7 +27,7 @@ pub struct Keymap(Vec); pub struct Binding { keystrokes: Vec, - action: Box, + action: Box, context: Option, } @@ -73,7 +72,7 @@ where pub enum MatchResult { None, Pending, - Action(Box), + Action(Box), } impl Debug for MatchResult { @@ -329,7 +328,7 @@ impl ContextPredicate { #[cfg(test)] mod tests { - use crate::action; + use crate::{actions, impl_actions}; use super::*; @@ -420,9 +419,10 @@ mod tests { #[test] fn test_matcher() -> anyhow::Result<()> { - action!(A, &'static str); - action!(B); - action!(Ab); + #[derive(Clone)] + pub struct A(pub &'static str); + impl_actions!(test, [A]); + actions!(test, [B, Ab]); impl PartialEq for A { fn eq(&self, other: &Self) -> bool { diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 66bd44b26f239d1c2faff0538d9e400350e02f30..6afdfb4637ad7778e6fc086a2588a56df310cd76 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -15,7 +15,7 @@ use crate::{ vector::Vector2F, }, text_layout::{LineLayout, RunStyle}, - AnyAction, ClipboardItem, Menu, Scene, + Action, ClipboardItem, Menu, Scene, }; use anyhow::Result; use async_task::Runnable; @@ -66,7 +66,7 @@ pub(crate) trait ForegroundPlatform { fn on_open_files(&self, callback: Box)>); fn run(&self, on_finish_launching: Box ()>); - fn on_menu_command(&self, callback: Box); + fn on_menu_command(&self, callback: Box); fn set_menus(&self, menus: Vec); fn prompt_for_paths( &self, diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index 0b612c978cde8b84cd8377a5bcc836519fbe3ca7..d8969e795753e5ff0d67feab2e47cd6d79360736 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -3,7 +3,7 @@ use crate::{ executor, keymap::Keystroke, platform::{self, CursorStyle}, - AnyAction, ClipboardItem, Event, Menu, MenuItem, + Action, ClipboardItem, Event, Menu, MenuItem, }; use anyhow::{anyhow, Result}; use block::ConcreteBlock; @@ -107,10 +107,10 @@ pub struct MacForegroundPlatformState { resign_active: Option>, quit: Option>, event: Option bool>>, - menu_command: Option>, + menu_command: Option>, open_files: Option)>>, finish_launching: Option ()>>, - menu_actions: Vec>, + menu_actions: Vec>, } impl MacForegroundPlatform { @@ -235,7 +235,7 @@ impl platform::ForegroundPlatform for MacForegroundPlatform { } } - fn on_menu_command(&self, callback: Box) { + fn on_menu_command(&self, callback: Box) { self.0.borrow_mut().menu_command = Some(callback); } diff --git a/crates/gpui/src/platform/test.rs b/crates/gpui/src/platform/test.rs index 706439a955d6e96cd3d01c8bfb44a634786780df..a18f52a4f60e5c89c3ea797e0aa626f814d23c84 100644 --- a/crates/gpui/src/platform/test.rs +++ b/crates/gpui/src/platform/test.rs @@ -1,7 +1,7 @@ use super::{CursorStyle, WindowBounds}; use crate::{ geometry::vector::{vec2f, Vector2F}, - AnyAction, ClipboardItem, + Action, ClipboardItem, }; use anyhow::{anyhow, Result}; use parking_lot::Mutex; @@ -72,7 +72,7 @@ impl super::ForegroundPlatform for ForegroundPlatform { unimplemented!() } - fn on_menu_command(&self, _: Box) {} + fn on_menu_command(&self, _: Box) {} fn set_menus(&self, _: Vec) {} diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index 8546bed00f2c24da2e22e648feea18164d76fa99..ee840bd1e717e9d4c33a085302e89a47cd3193dd 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -6,7 +6,7 @@ use crate::{ json::{self, ToJson}, platform::Event, text_layout::TextLayoutCache, - Action, AnyAction, AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AssetCache, ElementBox, + Action, AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AssetCache, ElementBox, ElementStateContext, Entity, FontSystem, ModelHandle, ReadModel, ReadView, Scene, UpgradeModelHandle, UpgradeViewHandle, View, ViewHandle, WeakModelHandle, WeakViewHandle, }; @@ -223,7 +223,7 @@ impl Presenter { pub struct DispatchDirective { pub path: Vec, - pub action: Box, + pub action: Box, } pub struct LayoutContext<'a> { diff --git a/crates/gpui/src/views/select.rs b/crates/gpui/src/views/select.rs index 944f45f0d4fa7fe9c2f27e0e658133a30192370a..14b098c472f0e8c677594353c60b78428a49dd55 100644 --- a/crates/gpui/src/views/select.rs +++ b/crates/gpui/src/views/select.rs @@ -1,6 +1,6 @@ use crate::{ - action, elements::*, AppContext, Entity, MutableAppContext, RenderContext, View, ViewContext, - WeakViewHandle, + actions, elements::*, impl_actions, AppContext, Entity, MutableAppContext, RenderContext, View, + ViewContext, WeakViewHandle, }; pub struct Select { @@ -25,8 +25,11 @@ pub enum ItemType { Unselected, } -action!(ToggleSelect); -action!(SelectItem, usize); +#[derive(Clone)] +pub struct SelectItem(pub usize); + +actions!(select, [ToggleSelect]); +impl_actions!(select, [SelectItem]); pub enum Event {} diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 460423f6dc7107e56563c442081c0942e6446108..de9945d10e9cc2fefbffad04b1c9a15fd5dd2767 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -1,11 +1,11 @@ use chrono::{Datelike, Local, Timelike}; use editor::{Autoscroll, Editor}; -use gpui::{action, keymap::Binding, MutableAppContext}; +use gpui::{actions, keymap::Binding, MutableAppContext}; use std::{fs::OpenOptions, sync::Arc}; use util::TryFutureExt as _; use workspace::AppState; -action!(NewJournalEntry); +actions!(journal, [NewJournalEntry]); pub fn init(app_state: Arc, cx: &mut MutableAppContext) { cx.add_bindings(vec![Binding::new("ctrl-alt-cmd-j", NewJournalEntry, None)]); diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index af22b87ee6ccf1a7b23bf66be1144c984af42cf5..5386657ef20c2567aeae4dfadc874a2635791695 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -4,7 +4,7 @@ use editor::{ }; use fuzzy::StringMatch; use gpui::{ - action, + actions, elements::*, geometry::vector::Vector2F, keymap::{self, Binding}, @@ -20,7 +20,7 @@ use workspace::{ Workspace, }; -action!(Toggle); +actions!(outline, [Toggle]); pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 6ae81fcb5e608fc6709ce1e7e38d3c8369955be9..3534fa186f40ea1c8a3c8e10f9f1e59a154f1fad 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1,9 +1,10 @@ use gpui::{ - action, + actions, elements::{ Align, ConstrainedBox, Empty, Flex, Label, MouseEventHandler, ParentElement, ScrollTarget, Svg, UniformList, UniformListState, }, + impl_actions, keymap::{self, Binding}, platform::CursorStyle, AppContext, Element, ElementBox, Entity, ModelHandle, MutableAppContext, View, ViewContext, @@ -46,10 +47,14 @@ struct EntryDetails { is_selected: bool, } -action!(ExpandSelectedEntry); -action!(CollapseSelectedEntry); -action!(ToggleExpanded, ProjectEntryId); -action!(Open, ProjectEntryId); +#[derive(Clone)] +pub struct ToggleExpanded(pub ProjectEntryId); + +#[derive(Clone)] +pub struct Open(pub ProjectEntryId); + +actions!(project_panel, [ExpandSelectedEntry, CollapseSelectedEntry]); +impl_actions!(project_panel, [Open, ToggleExpanded]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(ProjectPanel::expand_selected_entry); diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index f707aa30f71dd1e354a2fc079caaa2ac489d3774..689f579b81c0f14cda0281dc4635648c899f478b 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -3,7 +3,7 @@ use editor::{ }; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - action, + actions, elements::*, keymap::{self, Binding}, AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, @@ -22,7 +22,7 @@ use workspace::{ Workspace, }; -action!(Toggle); +actions!(project_symbols, [Toggle]); pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index c87a3a2391218ef54e894163999773cfde885bff..ffaf8e368de992392abea173960da31914f8c1a1 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -2,7 +2,7 @@ use crate::{active_match_index, match_index_for_direction, Direction, SearchOpti use collections::HashMap; use editor::{display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, Editor}; use gpui::{ - action, elements::*, keymap::Binding, platform::CursorStyle, AppContext, Entity, + actions, elements::*, impl_actions, keymap::Binding, platform::CursorStyle, AppContext, Entity, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; @@ -12,10 +12,14 @@ use settings::Settings; use std::ops::Range; use workspace::{ItemHandle, Pane, ToolbarItemLocation, ToolbarItemView}; -action!(Deploy, bool); -action!(Dismiss); -action!(FocusEditor); -action!(ToggleSearchOption, SearchOption); +#[derive(Clone)] +pub struct Deploy(pub bool); + +#[derive(Clone)] +pub struct ToggleSearchOption(pub SearchOption); + +actions!(buffer_search, [Dismiss, FocusEditor]); +impl_actions!(buffer_search, [Deploy, ToggleSearchOption]); pub enum Event { UpdateLocation, diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 9009dfee79493b493868b6ba930fe0186709b99e..f96e3c84d1979b99e414f1b028dcd927f3ae4102 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -5,7 +5,7 @@ use crate::{ use collections::HashMap; use editor::{Anchor, Autoscroll, Editor, MultiBuffer, SelectAll}; use gpui::{ - action, elements::*, keymap::Binding, platform::CursorStyle, AppContext, ElementBox, Entity, + actions, elements::*, keymap::Binding, platform::CursorStyle, AppContext, ElementBox, Entity, ModelContext, ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle, }; @@ -19,10 +19,7 @@ use std::{ use util::ResultExt as _; use workspace::{Item, ItemNavHistory, Pane, ToolbarItemLocation, ToolbarItemView, Workspace}; -action!(Deploy); -action!(Search); -action!(SearchInNew); -action!(ToggleFocus); +actions!(project_search, [Deploy, Search, SearchInNew, ToggleFocus]); const MAX_TAB_TITLE_LEN: usize = 24; diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index 38d3a5fce8b2416442a07ec0ec68efb31e95797b..83e5a259d21630d99a6b72e432b1fbc8d1f12f33 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -1,6 +1,6 @@ pub use buffer_search::BufferSearchBar; use editor::{Anchor, MultiBufferSnapshot}; -use gpui::{action, MutableAppContext}; +use gpui::{impl_actions, MutableAppContext}; pub use project_search::{ProjectSearchBar, ProjectSearchView}; use std::{ cmp::{self, Ordering}, @@ -15,8 +15,13 @@ pub fn init(cx: &mut MutableAppContext) { project_search::init(cx); } -action!(ToggleSearchOption, SearchOption); -action!(SelectMatch, Direction); +#[derive(Clone)] +pub struct ToggleSearchOption(pub SearchOption); + +#[derive(Clone)] +pub struct SelectMatch(pub Direction); + +impl_actions!(search, [ToggleSearchOption, SelectMatch]); #[derive(Clone, Copy)] pub enum SearchOption { diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 51c7807660708ea47209a5d133d2f7128e33b4f7..a8cb86393519edcf5a2fc0cb4b4bb8f516c43866 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1118,7 +1118,7 @@ mod tests { }, time::Duration, }; - use workspace::{Item, SplitDirection, Workspace, WorkspaceParams}; + use workspace::{Item, SplitDirection, ToggleFollow, Workspace, WorkspaceParams}; #[cfg(test)] #[ctor::ctor] @@ -4527,7 +4527,9 @@ mod tests { editor_a2.update(cx_a, |editor, cx| editor.select_ranges([2..3], None, cx)); workspace_b .update(cx_b, |workspace, cx| { - workspace.toggle_follow(&client_a_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(client_a_id), cx) + .unwrap() }) .await .unwrap(); @@ -4627,7 +4629,9 @@ mod tests { // Client A starts following client B. workspace_a .update(cx_a, |workspace, cx| { - workspace.toggle_follow(&client_b_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(client_b_id), cx) + .unwrap() }) .await .unwrap(); @@ -4856,7 +4860,9 @@ mod tests { }); workspace_b .update(cx_b, |workspace, cx| { - workspace.toggle_follow(&leader_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(leader_id), cx) + .unwrap() }) .await .unwrap(); @@ -4881,7 +4887,9 @@ mod tests { workspace_b .update(cx_b, |workspace, cx| { - workspace.toggle_follow(&leader_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(leader_id), cx) + .unwrap() }) .await .unwrap(); @@ -4899,7 +4907,9 @@ mod tests { workspace_b .update(cx_b, |workspace, cx| { - workspace.toggle_follow(&leader_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(leader_id), cx) + .unwrap() }) .await .unwrap(); @@ -4919,7 +4929,9 @@ mod tests { workspace_b .update(cx_b, |workspace, cx| { - workspace.toggle_follow(&leader_id.into(), cx).unwrap() + workspace + .toggle_follow(&ToggleFollow(leader_id), cx) + .unwrap() }) .await .unwrap(); diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 5bcbd62e09578c1210d32a4be10b435c8f695a04..b69552d02b9b834a54d093e417bde763cbd1038d 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,15 +1,15 @@ use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ - action, elements::*, + impl_actions, keymap::{self, Binding}, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; +use settings::Settings; use std::{cmp, sync::Arc}; use theme::{Theme, ThemeRegistry}; -use settings::Settings; use workspace::{ menu::{Confirm, SelectNext, SelectPrev}, Workspace, @@ -25,8 +25,13 @@ pub struct ThemeSelector { selection_completed: bool, } -action!(Toggle, Arc); -action!(Reload, Arc); +#[derive(Clone)] +pub struct Toggle(pub Arc); + +#[derive(Clone)] +pub struct Reload(pub Arc); + +impl_actions!(theme_selector, [Toggle, Reload]); pub fn init(themes: Arc, cx: &mut MutableAppContext) { cx.add_action(ThemeSelector::confirm); diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 9c1e36a90ef5c05c8aa4960a74572ee81a6fa34f..749ae7c5d31cdbb1998e1faff491f9bd285b462f 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -1,11 +1,10 @@ +use crate::{mode::Mode, SwitchMode, VimState}; use editor::Bias; -use gpui::{action, keymap::Binding, MutableAppContext, ViewContext}; +use gpui::{actions, keymap::Binding, MutableAppContext, ViewContext}; use language::SelectionGoal; use workspace::Workspace; -use crate::{mode::Mode, SwitchMode, VimState}; - -action!(NormalBefore); +actions!(vim, [NormalBefore]); pub fn init(cx: &mut MutableAppContext) { let context = Some("Editor && vim_mode == insert"); diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 5bf1a3c417b30fc97258dc2a44d4ee426c13af93..ce5305e8bf5a2ff5097cf58c09d309e6ed9eb00d 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -1,23 +1,42 @@ mod g_prefix; +use crate::{mode::NormalState, Mode, SwitchMode, VimState}; use editor::{char_kind, movement, Bias}; -use gpui::{action, keymap::Binding, MutableAppContext, ViewContext}; +use gpui::{actions, impl_actions, keymap::Binding, MutableAppContext, ViewContext}; use language::SelectionGoal; use workspace::Workspace; -use crate::{mode::NormalState, Mode, SwitchMode, VimState}; - -action!(GPrefix); -action!(MoveLeft); -action!(MoveDown); -action!(MoveUp); -action!(MoveRight); -action!(MoveToStartOfLine); -action!(MoveToEndOfLine); -action!(MoveToEnd); -action!(MoveToNextWordStart, bool); -action!(MoveToNextWordEnd, bool); -action!(MoveToPreviousWordStart, bool); +#[derive(Clone)] +struct MoveToNextWordStart(pub bool); + +#[derive(Clone)] +struct MoveToNextWordEnd(pub bool); + +#[derive(Clone)] +struct MoveToPreviousWordStart(pub bool); + +impl_actions!( + vim, + [ + MoveToNextWordStart, + MoveToNextWordEnd, + MoveToPreviousWordStart, + ] +); + +actions!( + vim, + [ + GPrefix, + MoveLeft, + MoveDown, + MoveUp, + MoveRight, + MoveToStartOfLine, + MoveToEndOfLine, + MoveToEnd, + ] +); pub fn init(cx: &mut MutableAppContext) { let context = Some("Editor && vim_mode == normal"); diff --git a/crates/vim/src/normal/g_prefix.rs b/crates/vim/src/normal/g_prefix.rs index 5b710892459ae62497e7f9ad49ca623eba407303..79c48a686ee73c484734e29791777804e332f375 100644 --- a/crates/vim/src/normal/g_prefix.rs +++ b/crates/vim/src/normal/g_prefix.rs @@ -1,9 +1,8 @@ -use gpui::{action, keymap::Binding, MutableAppContext, ViewContext}; -use workspace::Workspace; - use crate::{mode::Mode, SwitchMode, VimState}; +use gpui::{actions, keymap::Binding, MutableAppContext, ViewContext}; +use workspace::Workspace; -action!(MoveToStart); +actions!(vim, [MoveToStart]); pub fn init(cx: &mut MutableAppContext) { let context = Some("Editor && vim_mode == normal && vim_submode == g"); diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 16ee1612d58a8e0720f92821af6a8621f0ec9ec0..2d76831076f36c78bab6b51e4205095a646e9bde 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -7,13 +7,16 @@ mod vim_test_context; use collections::HashMap; use editor::{CursorShape, Editor}; -use gpui::{action, MutableAppContext, ViewContext, WeakViewHandle}; +use gpui::{impl_actions, MutableAppContext, ViewContext, WeakViewHandle}; use mode::Mode; use settings::Settings; use workspace::{self, Workspace}; -action!(SwitchMode, Mode); +#[derive(Clone)] +pub struct SwitchMode(pub Mode); + +impl_actions!(vim, [SwitchMode]); pub fn init(cx: &mut MutableAppContext) { editor_events::init(cx); diff --git a/crates/workspace/src/lsp_status.rs b/crates/workspace/src/lsp_status.rs index cf920b108d1e6d1a8828642b70b10bbda45d4847..1accbcad3ce4a2790f2f6cd607317c109988da08 100644 --- a/crates/workspace/src/lsp_status.rs +++ b/crates/workspace/src/lsp_status.rs @@ -1,9 +1,9 @@ use crate::{ItemHandle, StatusItemView}; use futures::StreamExt; -use gpui::AppContext; +use gpui::{actions, AppContext}; use gpui::{ - action, elements::*, platform::CursorStyle, Entity, ModelHandle, MutableAppContext, - RenderContext, View, ViewContext, + elements::*, platform::CursorStyle, Entity, ModelHandle, MutableAppContext, RenderContext, + View, ViewContext, }; use language::{LanguageRegistry, LanguageServerBinaryStatus}; use project::{LanguageServerProgress, Project}; @@ -13,7 +13,7 @@ use std::cmp::Reverse; use std::fmt::Write; use std::sync::Arc; -action!(DismissErrorMessage); +actions!(lsp_status, [DismissErrorMessage]); pub struct LspStatus { checking_for_update: Vec, diff --git a/crates/workspace/src/menu.rs b/crates/workspace/src/menu.rs index e4ce82276a5fd1d9fc74eb4573be3309f6cee872..e2412db7412bd4f19961c5474a3a46305c25684d 100644 --- a/crates/workspace/src/menu.rs +++ b/crates/workspace/src/menu.rs @@ -1,10 +1,9 @@ -use gpui::{action, keymap::Binding, MutableAppContext}; +use gpui::{actions, keymap::Binding, MutableAppContext}; -action!(Confirm); -action!(SelectPrev); -action!(SelectNext); -action!(SelectFirst); -action!(SelectLast); +actions!( + menu, + [Confirm, SelectPrev, SelectNext, SelectFirst, SelectLast,] +); pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 7f41624f6cc24d49fcf9ce584095bc2d15562bd2..6459e46fcad9335f67cbc21c846ea0bda6106aca 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -4,9 +4,10 @@ use anyhow::Result; use collections::{HashMap, VecDeque}; use futures::StreamExt; use gpui::{ - action, + actions, elements::*, geometry::{rect::RectF, vector::vec2f}, + impl_actions, keymap::Binding, platform::{CursorStyle, NavigationDirection}, AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, @@ -17,15 +18,32 @@ use settings::Settings; use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc}; use util::ResultExt; -action!(Split, SplitDirection); -action!(ActivateItem, usize); -action!(ActivatePrevItem); -action!(ActivateNextItem); -action!(CloseActiveItem); -action!(CloseInactiveItems); -action!(CloseItem, CloseItemParams); -action!(GoBack, Option>); -action!(GoForward, Option>); +actions!( + pane, + [ + ActivatePrevItem, + ActivateNextItem, + CloseActiveItem, + CloseInactiveItems, + ] +); + +#[derive(Clone)] +pub struct Split(pub SplitDirection); + +#[derive(Clone)] +pub struct CloseItem(pub CloseItemParams); + +#[derive(Clone)] +pub struct ActivateItem(pub usize); + +#[derive(Clone)] +pub struct GoBack(pub Option>); + +#[derive(Clone)] +pub struct GoForward(pub Option>); + +impl_actions!(pane, [Split, CloseItem, ActivateItem, GoBack, GoForward,]); #[derive(Clone)] pub struct CloseItemParams { diff --git a/crates/workspace/src/sidebar.rs b/crates/workspace/src/sidebar.rs index 7a7ad4e272cb0789287c643b048eec4f5192089a..49852d16f22a70a28140857085b6e1bd9832991f 100644 --- a/crates/workspace/src/sidebar.rs +++ b/crates/workspace/src/sidebar.rs @@ -1,5 +1,5 @@ use super::Workspace; -use gpui::{action, elements::*, platform::CursorStyle, AnyViewHandle, RenderContext}; +use gpui::{elements::*, impl_actions, platform::CursorStyle, AnyViewHandle, RenderContext}; use std::{cell::RefCell, rc::Rc}; use theme::Theme; @@ -21,8 +21,13 @@ struct Item { view: AnyViewHandle, } -action!(ToggleSidebarItem, SidebarItemId); -action!(ToggleSidebarItemFocus, SidebarItemId); +#[derive(Clone)] +pub struct ToggleSidebarItem(pub SidebarItemId); + +#[derive(Clone)] +pub struct ToggleSidebarItemFocus(pub SidebarItemId); + +impl_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]); #[derive(Clone)] pub struct SidebarItemId { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index b49b6f601f3a9848d4a284286e3eae60077d1138..a320dca23ce8250b787f2e4b9eec7e0adaaa4c6f 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -13,10 +13,11 @@ use client::{ use clock::ReplicaId; use collections::{hash_map, HashMap, HashSet}; use gpui::{ - action, + actions, color::Color, elements::*, geometry::{rect::RectF, vector::vec2f, PathBuilder}, + impl_actions, json::{self, to_string_pretty, ToJson}, keymap::Binding, platform::{CursorStyle, WindowOptions}, @@ -69,18 +70,38 @@ type FollowableItemBuilders = HashMap< ), >; -action!(Open, Arc); -action!(OpenNew, Arc); -action!(OpenPaths, OpenParams); -action!(ToggleShare); -action!(ToggleFollow, PeerId); -action!(FollowNextCollaborator); -action!(Unfollow); -action!(JoinProject, JoinProjectParams); -action!(Save); -action!(DebugElements); -action!(ActivatePreviousPane); -action!(ActivateNextPane); +actions!( + workspace, + [ + ToggleShare, + Unfollow, + Save, + DebugElements, + ActivatePreviousPane, + ActivateNextPane, + FollowNextCollaborator, + ] +); + +#[derive(Clone)] +pub struct Open(pub Arc); + +#[derive(Clone)] +pub struct OpenNew(pub Arc); + +#[derive(Clone)] +pub struct OpenPaths(pub OpenParams); + +#[derive(Clone)] +pub struct ToggleFollow(pub PeerId); + +#[derive(Clone)] +pub struct JoinProject(pub JoinProjectParams); + +impl_actions!( + workspace, + [Open, OpenNew, OpenPaths, ToggleFollow, JoinProject] +); pub fn init(client: &Arc, cx: &mut MutableAppContext) { pane::init(cx); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 86a059e6fde51125be49713311e654e78e934cc3..6fca5247fcc3c4623f106a3e899214404fdb1cfa 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -12,8 +12,9 @@ pub use contacts_panel; use contacts_panel::ContactsPanel; pub use editor; use gpui::{ - action, + actions, geometry::vector::vec2f, + impl_actions, keymap::Binding, platform::{WindowBounds, WindowOptions}, ModelHandle, ViewContext, @@ -29,10 +30,12 @@ use std::{path::PathBuf, sync::Arc}; pub use workspace; use workspace::{AppState, Workspace, WorkspaceParams}; -action!(About); -action!(Quit); -action!(OpenSettings); -action!(AdjustBufferFontSize, f32); +actions!(zed, [About, Quit, OpenSettings]); + +#[derive(Clone)] +pub struct AdjustBufferFontSize(pub f32); + +impl_actions!(zed, [AdjustBufferFontSize]); const MIN_FONT_SIZE: f32 = 6.0; From c801a524923d3228cfdccf82b1f396a7c1579f10 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 7 Apr 2022 16:44:37 -0700 Subject: [PATCH 111/245] Convert some actions to use named fields Co-authored-by: Nathan Sobo Co-authored-by: Keith Simmons --- crates/editor/src/editor.rs | 89 +++++++++++++++++++++++++------ crates/workspace/src/workspace.rs | 19 +++---- crates/zed/src/main.rs | 4 +- 3 files changed, 82 insertions(+), 30 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e201f5f3664405c35d0396ace1d2cf6c30f6ac38..e10fe9c17cb1c64453e2ba8782136ef14f4d7778 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -85,10 +85,14 @@ pub struct Input(pub String); pub struct Tab(pub Direction); #[derive(Clone)] -pub struct SelectToBeginningOfLine(pub bool); +pub struct SelectToBeginningOfLine { + stop_at_soft_wraps: bool, +} #[derive(Clone)] -pub struct SelectToEndOfLine(pub bool); +pub struct SelectToEndOfLine { + stop_at_soft_wraps: bool, +} #[derive(Clone)] pub struct ToggleCodeActions(pub bool); @@ -301,7 +305,9 @@ pub fn init(cx: &mut MutableAppContext) { Binding::new("alt-shift-F", SelectToNextWordEnd, Some("Editor")), Binding::new( "cmd-shift-left", - SelectToBeginningOfLine(true), + SelectToBeginningOfLine { + stop_at_soft_wraps: true, + }, Some("Editor"), ), Binding::new( @@ -312,11 +318,25 @@ pub fn init(cx: &mut MutableAppContext) { Binding::new("ctrl-alt-shift-F", SelectToNextSubwordEnd, Some("Editor")), Binding::new( "ctrl-shift-A", - SelectToBeginningOfLine(true), + SelectToBeginningOfLine { + stop_at_soft_wraps: true, + }, + Some("Editor"), + ), + Binding::new( + "cmd-shift-right", + SelectToEndOfLine { + stop_at_soft_wraps: true, + }, + Some("Editor"), + ), + Binding::new( + "ctrl-shift-E", + SelectToEndOfLine { + stop_at_soft_wraps: true, + }, Some("Editor"), ), - Binding::new("cmd-shift-right", SelectToEndOfLine(true), Some("Editor")), - Binding::new("ctrl-shift-E", SelectToEndOfLine(true), Some("Editor")), Binding::new("cmd-shift-up", SelectToBeginning, Some("Editor")), Binding::new("cmd-shift-down", SelectToEnd, Some("Editor")), Binding::new("cmd-a", SelectAll, Some("Editor")), @@ -3905,12 +3925,12 @@ impl Editor { pub fn select_to_beginning_of_line( &mut self, - SelectToBeginningOfLine(stop_at_soft_boundaries): &SelectToBeginningOfLine, + action: &SelectToBeginningOfLine, cx: &mut ViewContext, ) { self.move_selection_heads(cx, |map, head, _| { ( - movement::line_beginning(map, head, *stop_at_soft_boundaries), + movement::line_beginning(map, head, action.stop_at_soft_wraps), SelectionGoal::None, ) }); @@ -3922,7 +3942,12 @@ impl Editor { cx: &mut ViewContext, ) { self.transact(cx, |this, cx| { - this.select_to_beginning_of_line(&SelectToBeginningOfLine(false), cx); + this.select_to_beginning_of_line( + &SelectToBeginningOfLine { + stop_at_soft_wraps: false, + }, + cx, + ); this.backspace(&Backspace, cx); }); } @@ -3935,12 +3960,12 @@ impl Editor { pub fn select_to_end_of_line( &mut self, - SelectToEndOfLine(stop_at_soft_boundaries): &SelectToEndOfLine, + action: &SelectToEndOfLine, cx: &mut ViewContext, ) { self.move_selection_heads(cx, |map, head, _| { ( - movement::line_end(map, head, *stop_at_soft_boundaries), + movement::line_end(map, head, action.stop_at_soft_wraps), SelectionGoal::None, ) }); @@ -3948,14 +3973,24 @@ impl Editor { pub fn delete_to_end_of_line(&mut self, _: &DeleteToEndOfLine, cx: &mut ViewContext) { self.transact(cx, |this, cx| { - this.select_to_end_of_line(&SelectToEndOfLine(false), cx); + this.select_to_end_of_line( + &SelectToEndOfLine { + stop_at_soft_wraps: false, + }, + cx, + ); this.delete(&Delete, cx); }); } pub fn cut_to_end_of_line(&mut self, _: &CutToEndOfLine, cx: &mut ViewContext) { self.transact(cx, |this, cx| { - this.select_to_end_of_line(&SelectToEndOfLine(false), cx); + this.select_to_end_of_line( + &SelectToEndOfLine { + stop_at_soft_wraps: false, + }, + cx, + ); this.cut(&Cut, cx); }); } @@ -7296,7 +7331,12 @@ mod tests { view.update(cx, |view, cx| { view.move_left(&MoveLeft, cx); - view.select_to_beginning_of_line(&SelectToBeginningOfLine(true), cx); + view.select_to_beginning_of_line( + &SelectToBeginningOfLine { + stop_at_soft_wraps: true, + }, + cx, + ); assert_eq!( view.selected_display_ranges(cx), &[ @@ -7307,7 +7347,12 @@ mod tests { }); view.update(cx, |view, cx| { - view.select_to_beginning_of_line(&SelectToBeginningOfLine(true), cx); + view.select_to_beginning_of_line( + &SelectToBeginningOfLine { + stop_at_soft_wraps: true, + }, + cx, + ); assert_eq!( view.selected_display_ranges(cx), &[ @@ -7318,7 +7363,12 @@ mod tests { }); view.update(cx, |view, cx| { - view.select_to_beginning_of_line(&SelectToBeginningOfLine(true), cx); + view.select_to_beginning_of_line( + &SelectToBeginningOfLine { + stop_at_soft_wraps: true, + }, + cx, + ); assert_eq!( view.selected_display_ranges(cx), &[ @@ -7329,7 +7379,12 @@ mod tests { }); view.update(cx, |view, cx| { - view.select_to_end_of_line(&SelectToEndOfLine(true), cx); + view.select_to_end_of_line( + &SelectToEndOfLine { + stop_at_soft_wraps: true, + }, + cx, + ); assert_eq!( view.selected_display_ranges(cx), &[ diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index a320dca23ce8250b787f2e4b9eec7e0adaaa4c6f..6b6761b1f705c20672dc333dfa05d0499b34b9c7 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -90,7 +90,10 @@ pub struct Open(pub Arc); pub struct OpenNew(pub Arc); #[derive(Clone)] -pub struct OpenPaths(pub OpenParams); +pub struct OpenPaths { + pub paths: Vec, + pub app_state: Arc, +} #[derive(Clone)] pub struct ToggleFollow(pub PeerId); @@ -109,7 +112,7 @@ pub fn init(client: &Arc, cx: &mut MutableAppContext) { cx.add_global_action(open); cx.add_global_action(move |action: &OpenPaths, cx: &mut MutableAppContext| { - open_paths(&action.0.paths, &action.0.app_state, cx).detach(); + open_paths(&action.paths, &action.app_state, cx).detach(); }); cx.add_global_action(move |action: &OpenNew, cx: &mut MutableAppContext| { open_new(&action.0, cx) @@ -211,12 +214,6 @@ pub struct AppState { ) -> Workspace, } -#[derive(Clone)] -pub struct OpenParams { - pub paths: Vec, - pub app_state: Arc, -} - #[derive(Clone)] pub struct JoinProjectParams { pub project_id: u64, @@ -2113,9 +2110,9 @@ impl Element for AvatarRibbon { } } -impl std::fmt::Debug for OpenParams { +impl std::fmt::Debug for OpenPaths { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("OpenParams") + f.debug_struct("OpenPaths") .field("paths", &self.paths) .finish() } @@ -2130,7 +2127,7 @@ fn open(action: &Open, cx: &mut MutableAppContext) { }); cx.spawn(|mut cx| async move { if let Some(paths) = paths.recv().await.flatten() { - cx.update(|cx| cx.dispatch_global_action(OpenPaths(OpenParams { paths, app_state }))); + cx.update(|cx| cx.dispatch_global_action(OpenPaths { paths, app_state })); } }) .detach(); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 653788187b72e9cde958cc499e4da1c54464a4ab..8633005899f5e5e0d1405748b56dad4ecc790cdf 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -14,7 +14,7 @@ use smol::process::Command; use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; -use workspace::{self, AppState, OpenNew, OpenParams, OpenPaths}; +use workspace::{self, AppState, OpenNew, OpenPaths}; use zed::{ self, assets::Assets, @@ -158,7 +158,7 @@ fn main() { if paths.is_empty() { cx.dispatch_global_action(OpenNew(app_state.clone())); } else { - cx.dispatch_global_action(OpenPaths(OpenParams { paths, app_state })); + cx.dispatch_global_action(OpenPaths { paths, app_state }); } }); } From 3e40b5beada237320a379c8e07c1ad9ece165c49 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 7 Apr 2022 18:15:02 -0700 Subject: [PATCH 112/245] dynamically inject theme names and language properties into schema --- crates/language/src/language.rs | 8 ++ crates/settings/src/settings.rs | 138 ++++++++++++++++++++------------ crates/zed/src/zed.rs | 5 +- 3 files changed, 97 insertions(+), 54 deletions(-) diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index 322fd19b9e8de659202ff2773907932109917bdc..37377b6eef79d628a646396088ae5f8aea832f63 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -234,6 +234,14 @@ impl LanguageRegistry { .cloned() } + pub fn language_names(&self) -> Vec { + self.languages + .read() + .iter() + .map(|language| language.name().to_string()) + .collect() + } + pub fn select_language(&self, path: impl AsRef) -> Option> { let path = path.as_ref(); let filename = path.file_name().and_then(|name| name.to_str()); diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 3dcb55b2fe0899095a77b61f99a846582d1051f6..98733e6920c56284da82ec645311d3d8be07a487 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -2,10 +2,14 @@ use anyhow::Result; use gpui::font_cache::{FamilyId, FontCache}; use schemars::{ gen::{SchemaGenerator, SchemaSettings}, + schema::{ + InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec, SubschemaValidation, + }, JsonSchema, }; use serde::Deserialize; -use std::{collections::HashMap, fmt::Display, sync::Arc}; +use serde_json::Value; +use std::{collections::HashMap, fmt::Display, os::unix::fs::chroot, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; @@ -36,53 +40,6 @@ pub enum SoftWrap { PreferredLineLength, } -#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)] -pub enum ThemeNames { - Dark, - Light, -} - -impl Display for ThemeNames { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ThemeNames::Dark => write!(f, "Dark"), - ThemeNames::Light => write!(f, "Light"), - } - } -} - -#[derive(Clone, Debug, Deserialize, Default, JsonSchema)] -pub struct LanguageOverrides { - C: Option, - JSON: Option, - Markdown: Option, - PlainText: Option, - Rust: Option, - TSX: Option, - TypeScript: Option, -} - -impl IntoIterator for LanguageOverrides { - type Item = (String, LanguageOverride); - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - vec![ - ("C", self.C), - ("JSON", self.JSON), - ("Markdown", self.Markdown), - ("PlainText", self.PlainText), - ("Rust", self.Rust), - ("TSX", self.TSX), - ("TypeScript", self.TypeScript), - ] - .into_iter() - .filter_map(|(name, language_override)| language_override.map(|lo| (name.to_owned(), lo))) - .collect::>() - .into_iter() - } -} - #[derive(Clone, Debug, Default, Deserialize, JsonSchema)] pub struct SettingsFileContent { #[serde(default)] @@ -94,9 +51,9 @@ pub struct SettingsFileContent { #[serde(flatten)] pub editor: LanguageOverride, #[serde(default)] - pub language_overrides: LanguageOverrides, + pub language_overrides: HashMap, LanguageOverride>, #[serde(default)] - pub theme: Option, + pub theme: Option, } impl Settings { @@ -117,13 +74,88 @@ impl Settings { }) } - pub fn file_json_schema() -> serde_json::Value { + pub fn file_json_schema( + theme_names: Vec, + language_names: Vec, + ) -> serde_json::Value { let settings = SchemaSettings::draft07().with(|settings| { - settings.option_nullable = true; settings.option_add_null_type = false; }); let generator = SchemaGenerator::new(settings); - serde_json::to_value(generator.into_root_schema_for::()).unwrap() + let mut root_schema = generator.into_root_schema_for::(); + + // Construct theme names reference type + let theme_names = theme_names + .into_iter() + .map(|name| Value::String(name)) + .collect(); + let theme_names_schema = Schema::Object(SchemaObject { + instance_type: Some(SingleOrVec::Single(Box::new(InstanceType::String))), + enum_values: Some(theme_names), + ..Default::default() + }); + root_schema + .definitions + .insert("ThemeName".to_owned(), theme_names_schema); + + // Construct language overrides reference type + let language_override_schema_reference = Schema::Object(SchemaObject { + reference: Some("#/definitions/LanguageOverride".to_owned()), + ..Default::default() + }); + let language_overrides_properties = language_names + .into_iter() + .map(|name| { + ( + name, + Schema::Object(SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + all_of: Some(vec![language_override_schema_reference.clone()]), + ..Default::default() + })), + ..Default::default() + }), + ) + }) + .collect(); + let language_overrides_schema = Schema::Object(SchemaObject { + instance_type: Some(SingleOrVec::Single(Box::new(InstanceType::Object))), + object: Some(Box::new(ObjectValidation { + properties: language_overrides_properties, + ..Default::default() + })), + ..Default::default() + }); + root_schema + .definitions + .insert("LanguageOverrides".to_owned(), language_overrides_schema); + + // Modify theme property to use new theme reference type + let settings_file_schema = root_schema.schema.object.as_mut().unwrap(); + let language_overrides_schema_reference = Schema::Object(SchemaObject { + reference: Some("#/definitions/ThemeName".to_owned()), + ..Default::default() + }); + settings_file_schema.properties.insert( + "theme".to_owned(), + Schema::Object(SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + all_of: Some(vec![language_overrides_schema_reference]), + ..Default::default() + })), + ..Default::default() + }), + ); + + // Modify language_overrides property to use LanguageOverrides reference + settings_file_schema.properties.insert( + "language_overrides".to_owned(), + Schema::Object(SchemaObject { + reference: Some("#/definitions/LanguageOverrides".to_owned()), + ..Default::default() + }), + ); + serde_json::to_value(root_schema).unwrap() } pub fn with_overrides( diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 86a059e6fde51125be49713311e654e78e934cc3..976f78437cd5617f8401d974ce9d1a6979a2c7eb 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -137,13 +137,16 @@ pub fn build_workspace( let mut workspace = Workspace::new(&workspace_params, cx); let project = workspace.project().clone(); + let theme_names = app_state.themes.list().collect(); + let language_names = app_state.languages.language_names(); + project.update(cx, |project, _| { project.set_language_server_settings(serde_json::json!({ "json": { "schemas": [ { "fileMatch": "**/.zed/settings.json", - "schema": Settings::file_json_schema(), + "schema": Settings::file_json_schema(theme_names, language_names), } ] } From fae9048a2a95f12625b7dabb28f8e3f941b16f0f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 11:27:53 +0200 Subject: [PATCH 113/245] Remove non-determinism from `Peer` caused by using std's `HashMap` --- Cargo.lock | 1 + crates/rpc/Cargo.toml | 10 ++++++---- crates/rpc/src/peer.rs | 8 +++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec9c58b1a9b50e5c95b8c43dcae99bd7a25b8dca..7cbba16a00336f331d61aa1bfd90f3274c12f954 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4007,6 +4007,7 @@ dependencies = [ "async-tungstenite", "base64 0.13.0", "clock", + "collections", "futures", "gpui", "log", diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index e773b3f0bada6d8adb65d925622fc09f69db42da..9a2cb165c77bb0c977b76075f7a2962c14935cfb 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -9,9 +9,13 @@ path = "src/rpc.rs" doctest = false [features] -test-support = ["gpui/test-support"] +test-support = ["collections/test-support", "gpui/test-support"] [dependencies] +clock = { path = "../clock" } +collections = { path = "../collections" } +gpui = { path = "../gpui", optional = true } +util = { path = "../util" } anyhow = "1.0" async-lock = "2.4" async-tungstenite = "0.16" @@ -26,14 +30,12 @@ rsa = "0.4" serde = { version = "1", features = ["derive"] } smol-timeout = "0.6" zstd = "0.9" -clock = { path = "../clock" } -gpui = { path = "../gpui", optional = true } -util = { path = "../util" } [build-dependencies] prost-build = "0.8" [dev-dependencies] +collections = { path = "../collections", features = ["test-support"] } gpui = { path = "../gpui", features = ["test-support"] } smol = "1.2.5" tempdir = "0.3.7" diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 726453bea86968c0215e2d70c31884b02f066275..3677f0feac3273a637e0bcdce14de0dbaf19918d 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -1,6 +1,9 @@ -use super::proto::{self, AnyTypedEnvelope, EnvelopedMessage, MessageStream, RequestMessage}; -use super::Connection; +use super::{ + proto::{self, AnyTypedEnvelope, EnvelopedMessage, MessageStream, RequestMessage}, + Connection, +}; use anyhow::{anyhow, Context, Result}; +use collections::HashMap; use futures::{channel::oneshot, stream::BoxStream, FutureExt as _, StreamExt}; use parking_lot::{Mutex, RwLock}; use postage::{ @@ -10,7 +13,6 @@ use postage::{ use smol_timeout::TimeoutExt as _; use std::sync::atomic::Ordering::SeqCst; use std::{ - collections::HashMap, fmt, future::Future, marker::PhantomData, From da976012a91c631dda735a3463f12de1e380a427 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 11:29:00 +0200 Subject: [PATCH 114/245] Allow `simulate_guest` and `simulate_host` to fail when host disconnects --- crates/server/src/rpc.rs | 727 ++++++++++++++++++++++----------------- 1 file changed, 405 insertions(+), 322 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 61a1e7cc65704768a15fe3aa7da597250c2c96d7..912d5763220287078e4312bd7afcda6b33388b0e 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1118,6 +1118,7 @@ mod tests { }, time::Duration, }; + use util::TryFutureExt; use workspace::{Item, SplitDirection, Workspace, WorkspaceParams}; #[cfg(test)] @@ -5151,6 +5152,7 @@ mod tests { }); host_language_registry.add(Arc::new(language)); + let host_disconnected = Rc::new(AtomicBool::new(false)); user_ids.push(host.current_user_id(&host_cx)); clients.push(cx.foreground().spawn(host.simulate_host( host_project, @@ -5158,7 +5160,7 @@ mod tests { operations.clone(), max_operations, rng.clone(), - &mut host_cx, + host_cx, ))); while operations.get() < max_operations { @@ -5200,24 +5202,28 @@ mod tests { operations.clone(), max_operations, rng.clone(), + host_disconnected.clone(), guest_cx, ))); log::info!("Guest {} added", guest_id); } else if rng.lock().gen_bool(0.05) { + host_disconnected.store(true, SeqCst); + server.forbid_connections(); server.disconnect_client(user_ids[0]); cx.foreground().advance_clock(RECEIVE_TIMEOUT); let mut clients = futures::future::join_all(clients).await; cx.foreground().run_until_parked(); - let store = server.store.read(); - let (host, host_cx) = clients.remove(0); + let (host, mut host_cx) = clients.remove(0); host.project .as_ref() .unwrap() .read_with(&host_cx, |project, _| assert!(!project.is_shared())); - for (guest, guest_cx) in clients { - assert!(store + for (guest, mut guest_cx) in clients { + assert!(server + .store + .read() .contacts_for_user(guest.current_user_id(&guest_cx)) .is_empty()); guest @@ -5225,7 +5231,9 @@ mod tests { .as_ref() .unwrap() .read_with(&guest_cx, |project, _| assert!(project.is_read_only())); + guest_cx.update(|_| drop(guest)); } + host_cx.update(|_| drop(host)); return; } @@ -5619,121 +5627,148 @@ mod tests { } async fn simulate_host( - &mut self, + mut self, project: ModelHandle, files: Arc>>, operations: Rc>, max_operations: usize, rng: Arc>, - cx: &mut TestAppContext, - ) -> anyhow::Result<()> { - let fs = project.read_with(cx, |project, _| project.fs().clone()); - while operations.get() < max_operations { - operations.set(operations.get() + 1); + mut cx: TestAppContext, + ) -> (Self, TestAppContext) { + async fn simulate_host_internal( + client: &mut TestClient, + project: ModelHandle, + files: Arc>>, + operations: Rc>, + max_operations: usize, + rng: Arc>, + cx: &mut TestAppContext, + ) -> anyhow::Result<()> { + let fs = project.read_with(cx, |project, _| project.fs().clone()); + while operations.get() < max_operations { + operations.set(operations.get() + 1); - let distribution = rng.lock().gen_range::(0..100); - match distribution { - 0..=20 if !files.lock().is_empty() => { - let path = files.lock().choose(&mut *rng.lock()).unwrap().clone(); - let mut path = path.as_path(); - while let Some(parent_path) = path.parent() { - path = parent_path; - if rng.lock().gen() { - break; + let distribution = rng.lock().gen_range::(0..100); + match distribution { + 0..=20 if !files.lock().is_empty() => { + let path = files.lock().choose(&mut *rng.lock()).unwrap().clone(); + let mut path = path.as_path(); + while let Some(parent_path) = path.parent() { + path = parent_path; + if rng.lock().gen() { + break; + } } - } - log::info!("Host: find/create local worktree {:?}", path); - let find_or_create_worktree = project.update(cx, |project, cx| { - project.find_or_create_local_worktree(path, true, cx) - }); - if rng.lock().gen() { - cx.background().spawn(find_or_create_worktree).detach(); - } else { - find_or_create_worktree.await?; - } - } - 10..=80 if !files.lock().is_empty() => { - let buffer = if self.buffers.is_empty() || rng.lock().gen() { - let file = files.lock().choose(&mut *rng.lock()).unwrap().clone(); - let (worktree, path) = project - .update(cx, |project, cx| { - project.find_or_create_local_worktree(file.clone(), true, cx) - }) - .await?; - let project_path = - worktree.read_with(cx, |worktree, _| (worktree.id(), path)); - log::info!( - "Host: opening path {:?}, worktree {}, relative_path {:?}", - file, - project_path.0, - project_path.1 - ); - let buffer = project - .update(cx, |project, cx| project.open_buffer(project_path, cx)) - .await - .unwrap(); - self.buffers.insert(buffer.clone()); - buffer - } else { - self.buffers - .iter() - .choose(&mut *rng.lock()) - .unwrap() - .clone() - }; - - if rng.lock().gen_bool(0.1) { - cx.update(|cx| { - log::info!( - "Host: dropping buffer {:?}", - buffer.read(cx).file().unwrap().full_path(cx) - ); - self.buffers.remove(&buffer); - drop(buffer); + log::info!("Host: find/create local worktree {:?}", path); + let find_or_create_worktree = project.update(cx, |project, cx| { + project.find_or_create_local_worktree(path, true, cx) }); - } else { - buffer.update(cx, |buffer, cx| { + if rng.lock().gen() { + cx.background().spawn(find_or_create_worktree).detach(); + } else { + find_or_create_worktree.await?; + } + } + 10..=80 if !files.lock().is_empty() => { + let buffer = if client.buffers.is_empty() || rng.lock().gen() { + let file = files.lock().choose(&mut *rng.lock()).unwrap().clone(); + let (worktree, path) = project + .update(cx, |project, cx| { + project.find_or_create_local_worktree( + file.clone(), + true, + cx, + ) + }) + .await?; + let project_path = + worktree.read_with(cx, |worktree, _| (worktree.id(), path)); log::info!( - "Host: updating buffer {:?} ({})", - buffer.file().unwrap().full_path(cx), - buffer.remote_id() + "Host: opening path {:?}, worktree {}, relative_path {:?}", + file, + project_path.0, + project_path.1 ); - buffer.randomly_edit(&mut *rng.lock(), 5, cx) - }); - } - } - _ => loop { - let path_component_count = rng.lock().gen_range::(1..=5); - let mut path = PathBuf::new(); - path.push("/"); - for _ in 0..path_component_count { - let letter = rng.lock().gen_range(b'a'..=b'z'); - path.push(std::str::from_utf8(&[letter]).unwrap()); + let buffer = project + .update(cx, |project, cx| project.open_buffer(project_path, cx)) + .await + .unwrap(); + client.buffers.insert(buffer.clone()); + buffer + } else { + client + .buffers + .iter() + .choose(&mut *rng.lock()) + .unwrap() + .clone() + }; + + if rng.lock().gen_bool(0.1) { + cx.update(|cx| { + log::info!( + "Host: dropping buffer {:?}", + buffer.read(cx).file().unwrap().full_path(cx) + ); + client.buffers.remove(&buffer); + drop(buffer); + }); + } else { + buffer.update(cx, |buffer, cx| { + log::info!( + "Host: updating buffer {:?} ({})", + buffer.file().unwrap().full_path(cx), + buffer.remote_id() + ); + buffer.randomly_edit(&mut *rng.lock(), 5, cx) + }); + } } - path.set_extension("rs"); - let parent_path = path.parent().unwrap(); + _ => loop { + let path_component_count = rng.lock().gen_range::(1..=5); + let mut path = PathBuf::new(); + path.push("/"); + for _ in 0..path_component_count { + let letter = rng.lock().gen_range(b'a'..=b'z'); + path.push(std::str::from_utf8(&[letter]).unwrap()); + } + path.set_extension("rs"); + let parent_path = path.parent().unwrap(); - log::info!("Host: creating file {:?}", path,); + log::info!("Host: creating file {:?}", path,); - if fs.create_dir(&parent_path).await.is_ok() - && fs.create_file(&path, Default::default()).await.is_ok() - { - files.lock().push(path); - break; - } else { - log::info!("Host: cannot create file"); - } - }, + if fs.create_dir(&parent_path).await.is_ok() + && fs.create_file(&path, Default::default()).await.is_ok() + { + files.lock().push(path); + break; + } else { + log::info!("Host: cannot create file"); + } + }, + } + + cx.background().simulate_random_delay().await; } - cx.background().simulate_random_delay().await; + Ok(()) } - self.project = Some(project); - + simulate_host_internal( + &mut self, + project.clone(), + files, + operations, + max_operations, + rng, + &mut cx, + ) + .log_err() + .await; log::info!("Host done"); - Ok(()) + self.project = Some(project); + (self, cx) } pub async fn simulate_guest( @@ -5743,244 +5778,292 @@ mod tests { operations: Rc>, max_operations: usize, rng: Arc>, + host_disconnected: Rc, mut cx: TestAppContext, ) -> (Self, TestAppContext) { - while operations.get() < max_operations { - let buffer = if self.buffers.is_empty() || rng.lock().gen() { - let worktree = if let Some(worktree) = project.read_with(&cx, |project, cx| { - project - .worktrees(&cx) - .filter(|worktree| { - let worktree = worktree.read(cx); - worktree.is_visible() - && worktree.entries(false).any(|e| e.is_file()) + async fn simulate_guest_internal( + client: &mut TestClient, + guest_id: usize, + project: ModelHandle, + operations: Rc>, + max_operations: usize, + rng: Arc>, + cx: &mut TestAppContext, + ) -> anyhow::Result<()> { + while operations.get() < max_operations { + let buffer = if client.buffers.is_empty() || rng.lock().gen() { + let worktree = if let Some(worktree) = + project.read_with(cx, |project, cx| { + project + .worktrees(&cx) + .filter(|worktree| { + let worktree = worktree.read(cx); + worktree.is_visible() + && worktree.entries(false).any(|e| e.is_file()) + }) + .choose(&mut *rng.lock()) + }) { + worktree + } else { + cx.background().simulate_random_delay().await; + continue; + }; + + operations.set(operations.get() + 1); + let (worktree_root_name, project_path) = + worktree.read_with(cx, |worktree, _| { + let entry = worktree + .entries(false) + .filter(|e| e.is_file()) + .choose(&mut *rng.lock()) + .unwrap(); + ( + worktree.root_name().to_string(), + (worktree.id(), entry.path.clone()), + ) + }); + log::info!( + "Guest {}: opening path {:?} in worktree {} ({})", + guest_id, + project_path.1, + project_path.0, + worktree_root_name, + ); + let buffer = project + .update(cx, |project, cx| { + project.open_buffer(project_path.clone(), cx) }) - .choose(&mut *rng.lock()) - }) { - worktree + .await?; + log::info!( + "Guest {}: opened path {:?} in worktree {} ({}) with buffer id {}", + guest_id, + project_path.1, + project_path.0, + worktree_root_name, + buffer.read_with(cx, |buffer, _| buffer.remote_id()) + ); + client.buffers.insert(buffer.clone()); + buffer } else { - cx.background().simulate_random_delay().await; - continue; - }; - - operations.set(operations.get() + 1); - let (worktree_root_name, project_path) = - worktree.read_with(&cx, |worktree, _| { - let entry = worktree - .entries(false) - .filter(|e| e.is_file()) - .choose(&mut *rng.lock()) - .unwrap(); - ( - worktree.root_name().to_string(), - (worktree.id(), entry.path.clone()), - ) - }); - log::info!( - "Guest {}: opening path {:?} in worktree {} ({})", - guest_id, - project_path.1, - project_path.0, - worktree_root_name, - ); - let buffer = project - .update(&mut cx, |project, cx| { - project.open_buffer(project_path.clone(), cx) - }) - .await - .unwrap(); - log::info!( - "Guest {}: opened path {:?} in worktree {} ({}) with buffer id {}", - guest_id, - project_path.1, - project_path.0, - worktree_root_name, - buffer.read_with(&cx, |buffer, _| buffer.remote_id()) - ); - self.buffers.insert(buffer.clone()); - buffer - } else { - operations.set(operations.get() + 1); + operations.set(operations.get() + 1); - self.buffers - .iter() - .choose(&mut *rng.lock()) - .unwrap() - .clone() - }; + client + .buffers + .iter() + .choose(&mut *rng.lock()) + .unwrap() + .clone() + }; - let choice = rng.lock().gen_range(0..100); - match choice { - 0..=9 => { - cx.update(|cx| { - log::info!( - "Guest {}: dropping buffer {:?}", - guest_id, - buffer.read(cx).file().unwrap().full_path(cx) - ); - self.buffers.remove(&buffer); - drop(buffer); - }); - } - 10..=19 => { - let completions = project.update(&mut cx, |project, cx| { - log::info!( - "Guest {}: requesting completions for buffer {} ({:?})", - guest_id, - buffer.read(cx).remote_id(), - buffer.read(cx).file().unwrap().full_path(cx) - ); - let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); - project.completions(&buffer, offset, cx) - }); - let completions = cx.background().spawn(async move { - completions.await.expect("completions request failed"); - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching completions request", guest_id); - completions.detach(); - } else { - completions.await; + let choice = rng.lock().gen_range(0..100); + match choice { + 0..=9 => { + cx.update(|cx| { + log::info!( + "Guest {}: dropping buffer {:?}", + guest_id, + buffer.read(cx).file().unwrap().full_path(cx) + ); + client.buffers.remove(&buffer); + drop(buffer); + }); } - } - 20..=29 => { - let code_actions = project.update(&mut cx, |project, cx| { - log::info!( - "Guest {}: requesting code actions for buffer {} ({:?})", - guest_id, - buffer.read(cx).remote_id(), - buffer.read(cx).file().unwrap().full_path(cx) - ); - let range = buffer.read(cx).random_byte_range(0, &mut *rng.lock()); - project.code_actions(&buffer, range, cx) - }); - let code_actions = cx.background().spawn(async move { - code_actions.await.expect("code actions request failed"); - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching code actions request", guest_id); - code_actions.detach(); - } else { - code_actions.await; + 10..=19 => { + let completions = project.update(cx, |project, cx| { + log::info!( + "Guest {}: requesting completions for buffer {} ({:?})", + guest_id, + buffer.read(cx).remote_id(), + buffer.read(cx).file().unwrap().full_path(cx) + ); + let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); + project.completions(&buffer, offset, cx) + }); + let completions = cx.background().spawn(async move { + completions + .await + .map_err(|err| anyhow!("completions request failed: {:?}", err)) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching completions request", guest_id); + cx.update(|cx| completions.detach_and_log_err(cx)); + } else { + completions.await?; + } } - } - 30..=39 if buffer.read_with(&cx, |buffer, _| buffer.is_dirty()) => { - let (requested_version, save) = buffer.update(&mut cx, |buffer, cx| { - log::info!( - "Guest {}: saving buffer {} ({:?})", - guest_id, - buffer.remote_id(), - buffer.file().unwrap().full_path(cx) - ); - (buffer.version(), buffer.save(cx)) - }); - let save = cx.background().spawn(async move { - let (saved_version, _) = save.await.expect("save request failed"); - assert!(saved_version.observed_all(&requested_version)); - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching save request", guest_id); - save.detach(); - } else { - save.await; + 20..=29 => { + let code_actions = project.update(cx, |project, cx| { + log::info!( + "Guest {}: requesting code actions for buffer {} ({:?})", + guest_id, + buffer.read(cx).remote_id(), + buffer.read(cx).file().unwrap().full_path(cx) + ); + let range = buffer.read(cx).random_byte_range(0, &mut *rng.lock()); + project.code_actions(&buffer, range, cx) + }); + let code_actions = cx.background().spawn(async move { + code_actions.await.map_err(|err| { + anyhow!("code actions request failed: {:?}", err) + }) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching code actions request", guest_id); + cx.update(|cx| code_actions.detach_and_log_err(cx)); + } else { + code_actions.await?; + } } - } - 40..=44 => { - let prepare_rename = project.update(&mut cx, |project, cx| { - log::info!( - "Guest {}: preparing rename for buffer {} ({:?})", - guest_id, - buffer.read(cx).remote_id(), - buffer.read(cx).file().unwrap().full_path(cx) - ); - let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); - project.prepare_rename(buffer, offset, cx) - }); - let prepare_rename = cx.background().spawn(async move { - prepare_rename.await.expect("prepare rename request failed"); - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching prepare rename request", guest_id); - prepare_rename.detach(); - } else { - prepare_rename.await; + 30..=39 if buffer.read_with(cx, |buffer, _| buffer.is_dirty()) => { + let (requested_version, save) = buffer.update(cx, |buffer, cx| { + log::info!( + "Guest {}: saving buffer {} ({:?})", + guest_id, + buffer.remote_id(), + buffer.file().unwrap().full_path(cx) + ); + (buffer.version(), buffer.save(cx)) + }); + let save = cx.background().spawn(async move { + let (saved_version, _) = save + .await + .map_err(|err| anyhow!("save request failed: {:?}", err))?; + assert!(saved_version.observed_all(&requested_version)); + Ok::<_, anyhow::Error>(()) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching save request", guest_id); + cx.update(|cx| save.detach_and_log_err(cx)); + } else { + save.await?; + } } - } - 45..=49 => { - let definitions = project.update(&mut cx, |project, cx| { - log::info!( - "Guest {}: requesting definitions for buffer {} ({:?})", - guest_id, - buffer.read(cx).remote_id(), - buffer.read(cx).file().unwrap().full_path(cx) - ); - let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); - project.definition(&buffer, offset, cx) - }); - let definitions = cx.background().spawn(async move { - definitions.await.expect("definitions request failed") - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching definitions request", guest_id); - definitions.detach(); - } else { - self.buffers - .extend(definitions.await.into_iter().map(|loc| loc.buffer)); + 40..=44 => { + let prepare_rename = project.update(cx, |project, cx| { + log::info!( + "Guest {}: preparing rename for buffer {} ({:?})", + guest_id, + buffer.read(cx).remote_id(), + buffer.read(cx).file().unwrap().full_path(cx) + ); + let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); + project.prepare_rename(buffer, offset, cx) + }); + let prepare_rename = cx.background().spawn(async move { + prepare_rename.await.map_err(|err| { + anyhow!("prepare rename request failed: {:?}", err) + }) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching prepare rename request", guest_id); + cx.update(|cx| prepare_rename.detach_and_log_err(cx)); + } else { + prepare_rename.await?; + } } - } - 50..=54 => { - let highlights = project.update(&mut cx, |project, cx| { - log::info!( - "Guest {}: requesting highlights for buffer {} ({:?})", - guest_id, - buffer.read(cx).remote_id(), - buffer.read(cx).file().unwrap().full_path(cx) - ); - let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); - project.document_highlights(&buffer, offset, cx) - }); - let highlights = cx.background().spawn(async move { - highlights.await.expect("highlights request failed"); - }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching highlights request", guest_id); - highlights.detach(); - } else { - highlights.await; + 45..=49 => { + let definitions = project.update(cx, |project, cx| { + log::info!( + "Guest {}: requesting definitions for buffer {} ({:?})", + guest_id, + buffer.read(cx).remote_id(), + buffer.read(cx).file().unwrap().full_path(cx) + ); + let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); + project.definition(&buffer, offset, cx) + }); + let definitions = cx.background().spawn(async move { + definitions + .await + .map_err(|err| anyhow!("definitions request failed: {:?}", err)) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching definitions request", guest_id); + cx.update(|cx| definitions.detach_and_log_err(cx)); + } else { + client + .buffers + .extend(definitions.await?.into_iter().map(|loc| loc.buffer)); + } } - } - 55..=59 => { - let search = project.update(&mut cx, |project, cx| { - let query = rng.lock().gen_range('a'..='z'); - log::info!("Guest {}: project-wide search {:?}", guest_id, query); - project.search(SearchQuery::text(query, false, false), cx) - }); - let search = cx - .background() - .spawn(async move { search.await.expect("search request failed") }); - if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching search request", guest_id); - search.detach(); - } else { - self.buffers.extend(search.await.into_keys()); + 50..=54 => { + let highlights = project.update(cx, |project, cx| { + log::info!( + "Guest {}: requesting highlights for buffer {} ({:?})", + guest_id, + buffer.read(cx).remote_id(), + buffer.read(cx).file().unwrap().full_path(cx) + ); + let offset = rng.lock().gen_range(0..=buffer.read(cx).len()); + project.document_highlights(&buffer, offset, cx) + }); + let highlights = cx.background().spawn(async move { + highlights + .await + .map_err(|err| anyhow!("highlights request failed: {:?}", err)) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching highlights request", guest_id); + cx.update(|cx| highlights.detach_and_log_err(cx)); + } else { + highlights.await?; + } + } + 55..=59 => { + let search = project.update(cx, |project, cx| { + let query = rng.lock().gen_range('a'..='z'); + log::info!("Guest {}: project-wide search {:?}", guest_id, query); + project.search(SearchQuery::text(query, false, false), cx) + }); + let search = cx.background().spawn(async move { + search + .await + .map_err(|err| anyhow!("search request failed: {:?}", err)) + }); + if rng.lock().gen_bool(0.3) { + log::info!("Guest {}: detaching search request", guest_id); + cx.update(|cx| search.detach_and_log_err(cx)); + } else { + client.buffers.extend(search.await?.into_keys()); + } + } + _ => { + buffer.update(cx, |buffer, cx| { + log::info!( + "Guest {}: updating buffer {} ({:?})", + guest_id, + buffer.remote_id(), + buffer.file().unwrap().full_path(cx) + ); + buffer.randomly_edit(&mut *rng.lock(), 5, cx) + }); } } - _ => { - buffer.update(&mut cx, |buffer, cx| { - log::info!( - "Guest {}: updating buffer {} ({:?})", - guest_id, - buffer.remote_id(), - buffer.file().unwrap().full_path(cx) - ); - buffer.randomly_edit(&mut *rng.lock(), 5, cx) - }); - } + cx.background().simulate_random_delay().await; } - cx.background().simulate_random_delay().await; + Ok(()) } - log::info!("Guest {} done", guest_id); + match simulate_guest_internal( + &mut self, + guest_id, + project.clone(), + operations, + max_operations, + rng, + &mut cx, + ) + .await + { + Ok(()) => log::info!("guest {} done", guest_id), + Err(err) => { + if host_disconnected.load(SeqCst) { + log::error!("guest {} simulation error - {:?}", guest_id, err); + } else { + panic!("guest {} simulation error - {:?}", guest_id, err); + } + } + } self.project = Some(project); (self, cx) From 3daaef02ca5e81999481cecfdb733e7c5b57946a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 12:03:09 +0200 Subject: [PATCH 115/245] Replace `postage::oneshot` with `futures::channel::oneshot` This fixes an error in the randomized test that would cause the future returned from `Worktree::share` to never finish due to a bug in `postage` that causes its waker to not be notified upon drop. --- crates/project/src/worktree.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index beacc5a8630346aa7e3e99fe029484e3b48774f2..ac0c4bf8ff90426f5d72035622dd7fd3e5e0aefb 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -11,7 +11,10 @@ use client::{proto, Client, TypedEnvelope}; use clock::ReplicaId; use collections::HashMap; use futures::{ - channel::mpsc::{self, UnboundedSender}, + channel::{ + mpsc::{self, UnboundedSender}, + oneshot, + }, Stream, StreamExt, }; use fuzzy::CharBag; @@ -26,7 +29,6 @@ use language::{ use lazy_static::lazy_static; use parking_lot::Mutex; use postage::{ - oneshot, prelude::{Sink as _, Stream as _}, watch, }; @@ -727,11 +729,11 @@ impl LocalWorktree { pub fn share(&mut self, project_id: u64, cx: &mut ModelContext) -> Task> { let register = self.register(project_id, cx); - let (mut share_tx, mut share_rx) = oneshot::channel(); + let (share_tx, share_rx) = oneshot::channel(); let (snapshots_to_send_tx, snapshots_to_send_rx) = smol::channel::unbounded::(); if self.share.is_some() { - let _ = share_tx.try_send(Ok(())); + let _ = share_tx.send(Ok(())); } else { let rpc = self.client.clone(); let worktree_id = cx.model_id() as u64; @@ -756,15 +758,15 @@ impl LocalWorktree { }) .await { - let _ = share_tx.try_send(Err(error)); + let _ = share_tx.send(Err(error)); return Err(anyhow!("failed to send initial update worktree")); } else { - let _ = share_tx.try_send(Ok(())); + let _ = share_tx.send(Ok(())); snapshot } } Err(error) => { - let _ = share_tx.try_send(Err(error.into())); + let _ = share_tx.send(Err(error.into())); return Err(anyhow!("failed to send initial update worktree")); } }; @@ -804,9 +806,8 @@ impl LocalWorktree { }); } share_rx - .next() .await - .unwrap_or_else(|| Err(anyhow!("share ended"))) + .unwrap_or_else(|_| Err(anyhow!("share ended"))) }) } From 663beab1b9276991ef7c1ea70ba5a1ffc511b695 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 12:10:45 +0200 Subject: [PATCH 116/245] Avoid panicking when receiving a request for a dropped buffer --- crates/project/src/project.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 3b2259d53515585c069b577c0c37354978998269..ef0531c36a71168abfc469cc41a9e778593bb77e 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -3850,7 +3850,7 @@ impl Project { let buffer = this .opened_buffers .get(&buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?; Ok::<_, anyhow::Error>((project_id, buffer)) })?; @@ -3882,7 +3882,7 @@ impl Project { buffers.insert( this.opened_buffers .get(buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?, ); } @@ -3911,7 +3911,7 @@ impl Project { buffers.insert( this.opened_buffers .get(buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?, ); } @@ -3942,7 +3942,7 @@ impl Project { let buffer = this.read_with(&cx, |this, cx| { this.opened_buffers .get(&envelope.payload.buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id)) })?; buffer @@ -3972,7 +3972,7 @@ impl Project { let buffer = this .opened_buffers .get(&envelope.payload.buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?; let language = buffer.read(cx).language(); let completion = language::proto::deserialize_completion( @@ -4014,7 +4014,7 @@ impl Project { let buffer = this.update(&mut cx, |this, cx| { this.opened_buffers .get(&envelope.payload.buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id)) })?; buffer @@ -4055,7 +4055,7 @@ impl Project { let buffer = this .opened_buffers .get(&envelope.payload.buffer_id) - .map(|buffer| buffer.upgrade(cx).unwrap()) + .and_then(|buffer| buffer.upgrade(cx)) .ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?; Ok::<_, anyhow::Error>(this.apply_code_action(buffer, action, false, cx)) })?; From c9942632254e52fef39821868c1cd00460bdd785 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 14:14:45 +0200 Subject: [PATCH 117/245] Don't insert an empty vector in `Project::buffer_snapshots` Other code paths rely on at least a version always being there, so we should enforce that invariant everywhere. --- crates/project/src/project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index ef0531c36a71168abfc469cc41a9e778593bb77e..409e49e9fbc73429fdf84f0ff09b849d385e8d2b 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1216,7 +1216,7 @@ impl Project { let file = File::from_dyn(buffer.file())?; let abs_path = file.as_local()?.abs_path(cx); let uri = lsp::Url::from_file_path(abs_path).unwrap(); - let buffer_snapshots = self.buffer_snapshots.entry(buffer.remote_id()).or_default(); + let buffer_snapshots = self.buffer_snapshots.get_mut(&buffer.remote_id())?; let (version, prev_snapshot) = buffer_snapshots.last()?; let next_snapshot = buffer.text_snapshot(); let next_version = version + 1; From 222cd098388512c4e654b32062074e09c5d61d45 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 14:41:30 +0200 Subject: [PATCH 118/245] Allow host to reconnect to the server in randomized test --- crates/server/src/rpc.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 912d5763220287078e4312bd7afcda6b33388b0e..866627ef4885e63b93b870cac71fdede844cb100 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -5209,7 +5209,6 @@ mod tests { log::info!("Guest {} added", guest_id); } else if rng.lock().gen_bool(0.05) { host_disconnected.store(true, SeqCst); - server.forbid_connections(); server.disconnect_client(user_ids[0]); cx.foreground().advance_clock(RECEIVE_TIMEOUT); let mut clients = futures::future::join_all(clients).await; @@ -5221,11 +5220,14 @@ mod tests { .unwrap() .read_with(&host_cx, |project, _| assert!(!project.is_shared())); for (guest, mut guest_cx) in clients { - assert!(server + let contacts = server .store .read() - .contacts_for_user(guest.current_user_id(&guest_cx)) - .is_empty()); + .contacts_for_user(guest.current_user_id(&guest_cx)); + assert!(!contacts + .iter() + .flat_map(|contact| &contact.projects) + .any(|project| project.id == host_project_id)); guest .project .as_ref() From 32fd4eb3ac4796cdb1aae45647459c0d78b0105f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 14:41:56 +0200 Subject: [PATCH 119/245] Insert project id in connection's project during project registration ...in contrast to doing so during worktree registration. This fixes a randomized test failure which would panic because store invariants would be violated. This would happen when a peer disconnected before it had a chance to register a worktree because, when removing all the state associated with that peer upon disconnection, we would notice the registered project without however finding it in the peer's connection state. --- crates/server/src/rpc/store.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/server/src/rpc/store.rs b/crates/server/src/rpc/store.rs index 6f5252fecf9e82a14c80a76fe75c4e33cdee65c2..6c330c9c8bae3e3558280ea940fc180207ce5c70 100644 --- a/crates/server/src/rpc/store.rs +++ b/crates/server/src/rpc/store.rs @@ -244,6 +244,9 @@ impl Store { language_servers: Default::default(), }, ); + if let Some(connection) = self.connections.get_mut(&host_connection_id) { + connection.projects.insert(project_id); + } self.next_project_id += 1; project_id } @@ -266,9 +269,7 @@ impl Store { .or_default() .insert(project_id); } - if let Some(connection) = self.connections.get_mut(&project.host_connection_id) { - connection.projects.insert(project_id); - } + project.worktrees.insert(worktree_id, worktree); if let Ok(share) = project.share_mut() { share.worktrees.insert(worktree_id, Default::default()); From 24cb44fb00953171e68a5a78ccf88e0489212505 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 16:04:03 +0200 Subject: [PATCH 120/245] Remove `postage` from `rpc` Co-Authored-By: Nathan Sobo --- Cargo.lock | 1 - crates/client/src/test.rs | 6 +----- crates/rpc/Cargo.toml | 1 - crates/rpc/src/conn.rs | 36 ++++++++++++++++++------------------ crates/rpc/src/peer.rs | 34 +++++++++++++++++----------------- crates/server/src/rpc.rs | 13 ++++++++----- 6 files changed, 44 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cbba16a00336f331d61aa1bfd90f3274c12f954..b8d834c1d4ffeedcbc1124962f9982c0eadb0289 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4012,7 +4012,6 @@ dependencies = [ "gpui", "log", "parking_lot", - "postage", "prost", "prost-build", "rand 0.8.3", diff --git a/crates/client/src/test.rs b/crates/client/src/test.rs index 35a8e85922b153ce3d997ac8901dd70992adfe9d..5417f2b51d6a04c9f915d7a8204dd9723c89e5d9 100644 --- a/crates/client/src/test.rs +++ b/crates/client/src/test.rs @@ -6,7 +6,6 @@ use anyhow::{anyhow, Result}; use futures::{future::BoxFuture, stream::BoxStream, Future, StreamExt}; use gpui::{executor, ModelHandle, TestAppContext}; use parking_lot::Mutex; -use postage::barrier; use rpc::{proto, ConnectionId, Peer, Receipt, TypedEnvelope}; use std::{fmt, rc::Rc, sync::Arc}; @@ -23,7 +22,6 @@ struct FakeServerState { connection_id: Option, forbid_connections: bool, auth_count: usize, - connection_killer: Option, access_token: usize, } @@ -76,15 +74,13 @@ impl FakeServer { Err(EstablishConnectionError::Unauthorized)? } - let (client_conn, server_conn, kill) = - Connection::in_memory(cx.background()); + let (client_conn, server_conn, _) = Connection::in_memory(cx.background()); let (connection_id, io, incoming) = peer.add_test_connection(server_conn, cx.background()).await; cx.background().spawn(io).detach(); let mut state = state.lock(); state.connection_id = Some(connection_id); state.incoming = Some(incoming); - state.connection_killer = Some(kill); Ok(client_conn) }) } diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index 9a2cb165c77bb0c977b76075f7a2962c14935cfb..1425f408c6f2ec809f8db6e9c09a11cd1977c290 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -23,7 +23,6 @@ base64 = "0.13" futures = "0.3" log = "0.4" parking_lot = "0.11.1" -postage = { version = "0.4.1", features = ["futures-traits"] } prost = "0.8" rand = "0.8" rsa = "0.4" diff --git a/crates/rpc/src/conn.rs b/crates/rpc/src/conn.rs index a97797fc9d2e8af13e7b674dab6856eeda2fb88b..53ba00a3c0e16257783a706b80f7bb832d69a4dc 100644 --- a/crates/rpc/src/conn.rs +++ b/crates/rpc/src/conn.rs @@ -35,21 +35,24 @@ impl Connection { #[cfg(any(test, feature = "test-support"))] pub fn in_memory( executor: std::sync::Arc, - ) -> (Self, Self, postage::barrier::Sender) { - use postage::prelude::Stream; + ) -> (Self, Self, std::sync::Arc) { + use std::sync::{ + atomic::{AtomicBool, Ordering::SeqCst}, + Arc, + }; - let (kill_tx, kill_rx) = postage::barrier::channel(); - let (a_tx, a_rx) = channel(kill_rx.clone(), executor.clone()); - let (b_tx, b_rx) = channel(kill_rx, executor); + let killed = Arc::new(AtomicBool::new(false)); + let (a_tx, a_rx) = channel(killed.clone(), executor.clone()); + let (b_tx, b_rx) = channel(killed.clone(), executor); return ( Self { tx: a_tx, rx: b_rx }, Self { tx: b_tx, rx: a_rx }, - kill_tx, + killed, ); fn channel( - kill_rx: postage::barrier::Receiver, - executor: std::sync::Arc, + killed: Arc, + executor: Arc, ) -> ( Box>, Box< @@ -57,20 +60,17 @@ impl Connection { >, ) { use futures::channel::mpsc; - use std::{ - io::{Error, ErrorKind}, - sync::Arc, - }; + use std::io::{Error, ErrorKind}; let (tx, rx) = mpsc::unbounded::(); let tx = tx .sink_map_err(|e| WebSocketError::from(Error::new(ErrorKind::Other, e))) .with({ - let kill_rx = kill_rx.clone(); + let killed = killed.clone(); let executor = Arc::downgrade(&executor); move |msg| { - let mut kill_rx = kill_rx.clone(); + let killed = killed.clone(); let executor = executor.clone(); Box::pin(async move { if let Some(executor) = executor.upgrade() { @@ -78,7 +78,7 @@ impl Connection { } // Writes to a half-open TCP connection will error. - if kill_rx.try_recv().is_ok() { + if killed.load(SeqCst) { std::io::Result::Err( Error::new(ErrorKind::Other, "connection lost").into(), )?; @@ -90,10 +90,10 @@ impl Connection { }); let rx = rx.then({ - let kill_rx = kill_rx.clone(); + let killed = killed.clone(); let executor = Arc::downgrade(&executor); move |msg| { - let mut kill_rx = kill_rx.clone(); + let killed = killed.clone(); let executor = executor.clone(); Box::pin(async move { if let Some(executor) = executor.upgrade() { @@ -101,7 +101,7 @@ impl Connection { } // Reads from a half-open TCP connection will hang. - if kill_rx.try_recv().is_ok() { + if killed.load(SeqCst) { futures::future::pending::<()>().await; } diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 3677f0feac3273a637e0bcdce14de0dbaf19918d..5efee616e1f70f72d26c2e0278d76cdb756cf098 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -4,13 +4,13 @@ use super::{ }; use anyhow::{anyhow, Context, Result}; use collections::HashMap; -use futures::{channel::oneshot, stream::BoxStream, FutureExt as _, StreamExt}; -use parking_lot::{Mutex, RwLock}; -use postage::{ - barrier, mpsc, - prelude::{Sink as _, Stream as _}, +use futures::{ + channel::{mpsc, oneshot}, + stream::BoxStream, + FutureExt, SinkExt, StreamExt, }; -use smol_timeout::TimeoutExt as _; +use parking_lot::{Mutex, RwLock}; +use smol_timeout::TimeoutExt; use std::sync::atomic::Ordering::SeqCst; use std::{ fmt, @@ -90,10 +90,10 @@ pub struct Peer { #[derive(Clone)] pub struct ConnectionState { - outgoing_tx: futures::channel::mpsc::UnboundedSender, + outgoing_tx: mpsc::UnboundedSender, next_message_id: Arc, response_channels: - Arc>>>>, + Arc)>>>>>, } const KEEPALIVE_INTERVAL: Duration = Duration::from_secs(1); @@ -127,7 +127,7 @@ impl Peer { // bounded channel so that other peers will receive backpressure if they send // messages faster than this peer can process them. let (mut incoming_tx, incoming_rx) = mpsc::channel(64); - let (outgoing_tx, mut outgoing_rx) = futures::channel::mpsc::unbounded(); + let (outgoing_tx, mut outgoing_rx) = mpsc::unbounded(); let connection_id = ConnectionId(self.next_connection_id.fetch_add(1, SeqCst)); let connection_state = ConnectionState { @@ -208,14 +208,14 @@ impl Peer { if let Some(responding_to) = incoming.responding_to { let channel = response_channels.lock().as_mut()?.remove(&responding_to); if let Some(tx) = channel { - let mut requester_resumed = barrier::channel(); + let requester_resumed = oneshot::channel(); if let Err(error) = tx.send((incoming, requester_resumed.0)) { log::debug!( "received RPC but request future was dropped {:?}", error.0 ); } - requester_resumed.1.recv().await; + let _ = requester_resumed.1.await; } else { log::warn!("received RPC response to unknown request {}", responding_to); } @@ -721,26 +721,26 @@ mod tests { .add_test_connection(client_conn, cx.background()) .await; - let (mut io_ended_tx, mut io_ended_rx) = postage::barrier::channel(); + let (io_ended_tx, io_ended_rx) = oneshot::channel(); executor .spawn(async move { io_handler.await.ok(); - io_ended_tx.send(()).await.unwrap(); + io_ended_tx.send(()).unwrap(); }) .detach(); - let (mut messages_ended_tx, mut messages_ended_rx) = postage::barrier::channel(); + let (messages_ended_tx, messages_ended_rx) = oneshot::channel(); executor .spawn(async move { incoming.next().await; - messages_ended_tx.send(()).await.unwrap(); + messages_ended_tx.send(()).unwrap(); }) .detach(); client.disconnect(connection_id); - io_ended_rx.recv().await; - messages_ended_rx.recv().await; + let _ = io_ended_rx.await; + let _ = messages_ended_rx.await; assert!(server_conn .send(WebSocketMessage::Binary(vec![])) .await diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 866627ef4885e63b93b870cac71fdede844cb100..e2d64b1abfcd0b1033496dc1f1997b39b3eb742e 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1094,7 +1094,6 @@ mod tests { }; use lsp::{self, FakeLanguageServer}; use parking_lot::Mutex; - use postage::barrier; use project::{ fs::{FakeFs, Fs as _}, search::SearchQuery, @@ -5350,7 +5349,7 @@ mod tests { server: Arc, foreground: Rc, notifications: mpsc::UnboundedReceiver<()>, - connection_killers: Arc>>, + connection_killers: Arc>>>, forbid_connections: Arc, _test_db: TestDb, } @@ -5418,9 +5417,9 @@ mod tests { "server is forbidding connections" ))) } else { - let (client_conn, server_conn, kill_conn) = + let (client_conn, server_conn, killed) = Connection::in_memory(cx.background()); - connection_killers.lock().insert(user_id, kill_conn); + connection_killers.lock().insert(user_id, killed); cx.background() .spawn(server.handle_connection( server_conn, @@ -5462,7 +5461,11 @@ mod tests { } fn disconnect_client(&self, user_id: UserId) { - self.connection_killers.lock().remove(&user_id); + self.connection_killers + .lock() + .remove(&user_id) + .unwrap() + .store(true, SeqCst); } fn forbid_connections(&self) { From 0b1fda3e13d55a9471a6bd9b279d6b88cc47443f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 16:14:54 +0200 Subject: [PATCH 121/245] Remove `postage` from `zed-server` Co-Authored-By: Nathan Sobo --- Cargo.lock | 1 - crates/server/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8d834c1d4ffeedcbc1124962f9982c0eadb0289..69038125470792039530b24052c6469d75a7e225 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6122,7 +6122,6 @@ dependencies = [ "oauth2", "oauth2-surf", "parking_lot", - "postage", "project", "rand 0.8.3", "rpc", diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index f6d10517bd44e2ab642ca77801f8a6912e677302..fe1a63f5f1aabb287b8a081744c9236612d44ff3 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -33,7 +33,6 @@ lipsum = { version = "0.8", optional = true } oauth2 = { version = "4.0.0", default_features = false } oauth2-surf = "0.1.1" parking_lot = "0.11.1" -postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8" rust-embed = { version = "6.3", features = ["include-exclude"] } scrypt = "0.7" From 53a7f9c43e5be422475bd9a5f5fa42093a66a13b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Apr 2022 16:21:39 +0200 Subject: [PATCH 122/245] Introduce a timeout when processing incoming messages We have an hypothesis that the server gets stuck while processing an incoming message, either because the buffer fills up or because a handler never completes. This should mitigate that and, once we add logging, give us some clue as to what is causing it exactly. Co-Authored-By: Nathan Sobo --- crates/rpc/src/peer.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 5efee616e1f70f72d26c2e0278d76cdb756cf098..76fd6aac185fa0d941c02285b377f4c93d8693ad 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -175,8 +175,10 @@ impl Peer { let incoming = incoming.context("received invalid RPC message")?; receive_timeout.set(create_timer(RECEIVE_TIMEOUT).fuse()); if let proto::Message::Envelope(incoming) = incoming { - if incoming_tx.send(incoming).await.is_err() { - return Ok(()); + match incoming_tx.send(incoming).timeout(RECEIVE_TIMEOUT).await { + Some(Ok(_)) => {}, + Some(Err(_)) => return Ok(()), + None => Err(anyhow!("timed out processing incoming message"))?, } } break; From 7e5a3f9f6b8f457235a44be0eb2589bc71947ff5 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 8 Apr 2022 10:06:51 -0600 Subject: [PATCH 123/245] Introduce structured logging We're enabling the log crate feature everywhere, but only using it on the server for now. Co-Authored-By: Antonio Scandurra --- Cargo.lock | 76 +++++++++++++++++---- crates/client/Cargo.toml | 2 +- crates/editor/Cargo.toml | 2 +- crates/gpui/Cargo.toml | 4 +- crates/journal/Cargo.toml | 2 +- crates/language/Cargo.toml | 2 +- crates/lsp/Cargo.toml | 2 +- crates/project/Cargo.toml | 2 +- crates/rpc/Cargo.toml | 2 +- crates/search/Cargo.toml | 2 +- crates/server/Cargo.toml | 2 + crates/server/src/home.rs | 9 +-- crates/server/src/main.rs | 8 ++- crates/server/src/rpc.rs | 10 +-- crates/sum_tree/Cargo.toml | 2 +- crates/text/Cargo.toml | 2 +- crates/theme_selector/Cargo.toml | 2 +- crates/theme_selector/src/theme_selector.rs | 2 +- crates/util/Cargo.toml | 2 +- crates/vim/Cargo.toml | 2 +- crates/workspace/Cargo.toml | 2 +- crates/zed/Cargo.toml | 2 +- 22 files changed, 98 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4b99c656691def6257363a1dfe14c2f9bbc7cd8..8a026ee11bc527b5c2a067cbd60fce84a5b73544 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -614,7 +614,7 @@ dependencies = [ "cexpr", "clang-sys", "clap 2.33.3", - "env_logger", + "env_logger 0.8.3", "lazy_static", "lazycell", "log", @@ -1634,7 +1634,7 @@ dependencies = [ "clock", "collections", "ctor", - "env_logger", + "env_logger 0.8.3", "futures", "fuzzy", "gpui", @@ -1702,6 +1702,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "log", +] + [[package]] name = "env_logger" version = "0.8.3" @@ -1724,6 +1733,15 @@ dependencies = [ "serde", ] +[[package]] +name = "erased-serde" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad132dd8d0d0b546348d7d86cb3191aad14b34e5f979781fc005c80d4ac67ffd" +dependencies = [ + "serde", +] + [[package]] name = "etagere" version = "0.2.4" @@ -1806,7 +1824,7 @@ version = "0.1.0" dependencies = [ "ctor", "editor", - "env_logger", + "env_logger 0.8.3", "fuzzy", "gpui", "postage", @@ -2235,7 +2253,7 @@ dependencies = [ "core-text", "ctor", "dhat", - "env_logger", + "env_logger 0.8.3", "etagere", "font-kit", "foreign-types", @@ -2652,6 +2670,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json_env_logger" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2ec540ea0448b187d3a8b4a9f13e75527d06ef76b3a2baa1cd982aecb62ce2" +dependencies = [ + "env_logger 0.7.1", + "kv-log-macro", + "log", + "serde_json", +] + [[package]] name = "jwt-simple" version = "0.10.1" @@ -2715,7 +2745,7 @@ dependencies = [ "clock", "collections", "ctor", - "env_logger", + "env_logger 0.8.3", "futures", "fuzzy", "gpui", @@ -2834,11 +2864,12 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ "cfg-if 1.0.0", + "serde", "value-bag", ] @@ -2871,7 +2902,7 @@ dependencies = [ "async-pipe", "collections", "ctor", - "env_logger", + "env_logger 0.8.3", "futures", "gpui", "log", @@ -4342,6 +4373,15 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_fmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2963a69a2b3918c1dc75a45a18bd3fcd1120e31d3f59deb1b2f9b5d5ffb8baa4" +dependencies = [ + "serde", +] + [[package]] name = "serde_json" version = "1.0.64" @@ -4986,7 +5026,7 @@ version = "0.1.0" dependencies = [ "arrayvec 0.7.1", "ctor", - "env_logger", + "env_logger 0.8.3", "log", "rand 0.8.3", ] @@ -5018,6 +5058,9 @@ name = "sval" version = "1.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" +dependencies = [ + "serde", +] [[package]] name = "svg_fmt" @@ -5116,7 +5159,7 @@ dependencies = [ "clock", "collections", "ctor", - "env_logger", + "env_logger 0.8.3", "gpui", "lazy_static", "log", @@ -5704,11 +5747,14 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "value-bag" -version = "1.0.0-alpha.7" +version = "1.0.0-alpha.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" +checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" dependencies = [ "ctor", + "erased-serde", + "serde", + "serde_fmt", "sval", "version_check", ] @@ -6030,7 +6076,7 @@ dependencies = [ "dirs 3.0.1", "easy-parallel", "editor", - "env_logger", + "env_logger 0.8.3", "file_finder", "fsevent", "futures", @@ -6108,16 +6154,18 @@ dependencies = [ "ctor", "editor", "either", - "env_logger", + "env_logger 0.8.3", "envy", "futures", "gpui", "handlebars", "http-auth-basic", + "json_env_logger", "jwt-simple", "language", "lazy_static", "lipsum", + "log", "lsp", "oauth2", "oauth2-surf", diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index c60b82f1f8e9dfd762d24d802962b3d7bec103a7..211dc7a04b4c67e87e1d009ea7d35019fe597f74 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -21,7 +21,7 @@ async-tungstenite = { version = "0.16", features = ["async-tls"] } futures = "0.3" image = "0.23" lazy_static = "1.4.0" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8.3" diff --git a/crates/editor/Cargo.toml b/crates/editor/Cargo.toml index 076fecbfcbb58385e859b97b793b3bb0a41e8302..a1c1409d06558f47b593c8265516a3e4038b71ae 100644 --- a/crates/editor/Cargo.toml +++ b/crates/editor/Cargo.toml @@ -40,7 +40,7 @@ futures = "0.3" indoc = "1.0.4" itertools = "0.10" lazy_static = "1.4" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } ordered-float = "2.1.1" parking_lot = "0.11" postage = { version = "0.4", features = ["futures-traits"] } diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 9973ac6549c6d77e81cc2e5cc48db7612f4cff6d..442a2b5b2f312cc63da62851b8a0faa52b25e8a4 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -25,7 +25,7 @@ etagere = "0.2" futures = "0.3" image = "0.23" lazy_static = "1.4.0" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } num_cpus = "1.13" ordered-float = "2.1.1" parking = "2.0.0" @@ -67,6 +67,6 @@ core-graphics = "0.22.2" core-text = "19.2" font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "8eaf7a918eafa28b0a37dc759e2e0e7683fa24f1" } foreign-types = "0.3" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } metal = "0.21.0" objc = "0.2" diff --git a/crates/journal/Cargo.toml b/crates/journal/Cargo.toml index 8ccd9dc27f081cc87495a3a828e4f17a345daef9..94dcf8e407411a266ea9ab3752ffa8d66ad8097b 100644 --- a/crates/journal/Cargo.toml +++ b/crates/journal/Cargo.toml @@ -14,4 +14,4 @@ util = { path = "../util" } workspace = { path = "../workspace" } chrono = "0.4" dirs = "4.0" -log = "0.4" \ No newline at end of file +log = { version = "0.4.16", features = ["kv_unstable_serde"] } diff --git a/crates/language/Cargo.toml b/crates/language/Cargo.toml index 0518261f847fa460bbb2d054e7fc65b9019c4686..275581f807dafa30f8a95421fc7d8990aff3511c 100644 --- a/crates/language/Cargo.toml +++ b/crates/language/Cargo.toml @@ -35,7 +35,7 @@ async-broadcast = "0.3.4" async-trait = "0.1" futures = "0.3" lazy_static = "1.4" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } rand = { version = "0.8.3", optional = true } diff --git a/crates/lsp/Cargo.toml b/crates/lsp/Cargo.toml index 199da8c24edc6ca1041b312a03f4e76d3e6b3b1b..c749261bf5a6eb9cbe092f2301cc6bca7a75a329 100644 --- a/crates/lsp/Cargo.toml +++ b/crates/lsp/Cargo.toml @@ -17,7 +17,7 @@ util = { path = "../util" } anyhow = "1.0" async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553", optional = true } futures = "0.3" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } lsp-types = "0.91" parking_lot = "0.11" postage = { version = "0.4.1", features = ["futures-traits"] } diff --git a/crates/project/Cargo.toml b/crates/project/Cargo.toml index 8fda3aa0f32e9580c7a82a9ece6c3d3653a8a851..728dae312852480908315becf79e6c7ded7b9e99 100644 --- a/crates/project/Cargo.toml +++ b/crates/project/Cargo.toml @@ -35,7 +35,7 @@ futures = "0.3" ignore = "0.4" lazy_static = "1.4.0" libc = "0.2" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8.3" diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index e773b3f0bada6d8adb65d925622fc09f69db42da..62fe9e5bda17962237ab5f7fcbc8e3240da7563c 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -17,7 +17,7 @@ async-lock = "2.4" async-tungstenite = "0.16" base64 = "0.13" futures = "0.3" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } prost = "0.8" diff --git a/crates/search/Cargo.toml b/crates/search/Cargo.toml index 77961de01f3efdee86603d01b99c259509d04c9e..295526939a2904aed209c4e4f397ebb4d9038030 100644 --- a/crates/search/Cargo.toml +++ b/crates/search/Cargo.toml @@ -18,7 +18,7 @@ theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } anyhow = "1.0" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } postage = { version = "0.4.1", features = ["futures-traits"] } [dev-dependencies] diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 6e27fa16c523cf0908f10fff8cdf772c54269b84..6c43b467acb3f93632bbf0ca0bd8e18813cb5cd2 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -29,8 +29,10 @@ envy = "0.4.2" futures = "0.3" handlebars = "3.5" http-auth-basic = "0.1.3" +json_env_logger = "0.1" jwt-simple = "0.10.0" lipsum = { version = "0.8", optional = true } +log = { version = "0.4.16", features = ["kv_unstable_serde"] } oauth2 = { version = "4.0.0", default_features = false } oauth2-surf = "0.1.1" parking_lot = "0.11.1" diff --git a/crates/server/src/home.rs b/crates/server/src/home.rs index 69bee449a8bc9aa56f699842950feaffc944733f..bddeadc35203e5f258cc7de70fad699d649d27c9 100644 --- a/crates/server/src/home.rs +++ b/crates/server/src/home.rs @@ -1,7 +1,8 @@ use crate::{AppState, Request, RequestExt as _}; -use serde::Deserialize; +use log::as_serde; +use serde::{Deserialize, Serialize}; use std::sync::Arc; -use tide::{http::mime, log, Server}; +use tide::{http::mime, Server}; pub fn add_routes(app: &mut Server>) { app.at("/").get(get_home); @@ -18,7 +19,7 @@ async fn get_home(mut request: Request) -> tide::Result { } async fn post_signup(mut request: Request) -> tide::Result { - #[derive(Debug, Deserialize)] + #[derive(Debug, Deserialize, Serialize)] struct Form { github_login: String, email_address: String, @@ -38,7 +39,7 @@ async fn post_signup(mut request: Request) -> tide::Result { .map(str::to_string) .unwrap_or(form.github_login); - log::info!("Signup submitted: {:?}", form); + log::info!(form = as_serde!(form); "signup submitted"); // Save signup in the database request diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index 47c8c82190bfbab775b981ebdfa39875a83f764f..97de59f36bdc51c734e516ac80ac16d4384d29ca 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -27,7 +27,7 @@ use rust_embed::RustEmbed; use serde::{Deserialize, Serialize}; use std::sync::Arc; use surf::http::cookies::SameSite; -use tide::{log, sessions::SessionMiddleware}; +use tide::sessions::SessionMiddleware; use tide_compress::CompressMiddleware; type Request = tide::Request>; @@ -138,7 +138,11 @@ struct LayoutData { #[async_std::main] async fn main() -> tide::Result<()> { - log::start(); + if std::env::var("LOG_JSON").is_ok() { + json_env_logger::init(); + } else { + tide::log::start(); + } if let Err(error) = env::load_dotenv() { log::error!( diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 51c7807660708ea47209a5d133d2f7128e33b4f7..ace7080c8112139d97b5bc9bbf9f635808edfb7d 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -11,6 +11,7 @@ use async_std::task; use async_tungstenite::{tungstenite::protocol::Role, WebSocketStream}; use collections::{HashMap, HashSet}; use futures::{channel::mpsc, future::BoxFuture, FutureExt, SinkExt, StreamExt}; +use log::{as_debug, as_display}; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use rpc::{ proto::{self, AnyTypedEnvelope, EntityMessage, EnvelopedMessage, RequestMessage}, @@ -25,7 +26,6 @@ use std::{ }; use store::{Store, Worktree}; use surf::StatusCode; -use tide::log; use tide::{ http::headers::{HeaderName, CONNECTION, UPGRADE}, Request, Response, @@ -218,16 +218,16 @@ impl Server { if let Some(message) = message { let start_time = Instant::now(); let type_name = message.payload_type_name(); - log::info!("rpc message received. connection:{}, type:{}", connection_id, type_name); + log::info!(connection_id = connection_id.0, type_name = type_name; "rpc message received"); if let Some(handler) = this.handlers.get(&message.payload_type_id()) { let notifications = this.notifications.clone(); let is_background = message.is_background(); let handle_message = (handler)(this.clone(), message); let handle_message = async move { if let Err(err) = handle_message.await { - log::error!("rpc message error. connection:{}, type:{}, error:{:?}", connection_id, type_name, err); + log::error!(connection_id = connection_id.0, type = type_name, error = as_display!(err); "rpc message error"); } else { - log::info!("rpc message handled. connection:{}, type:{}, duration:{:?}", connection_id, type_name, start_time.elapsed()); + log::info!(connection_id = connection_id.0, type = type_name, duration = as_debug!(start_time.elapsed()); "rpc message handled"); } if let Some(mut notifications) = notifications { let _ = notifications.send(()).await; @@ -242,7 +242,7 @@ impl Server { log::warn!("unhandled message: {}", type_name); } } else { - log::info!("rpc connection closed {:?}", addr); + log::info!(address = as_debug!(addr); "rpc connection closed"); break; } } diff --git a/crates/sum_tree/Cargo.toml b/crates/sum_tree/Cargo.toml index f43cdd43d45ea4d9df206da9c6315dc5ac034827..b430f2e6b06703b591cf767b405e3b0272061779 100644 --- a/crates/sum_tree/Cargo.toml +++ b/crates/sum_tree/Cargo.toml @@ -9,7 +9,7 @@ doctest = false [dependencies] arrayvec = "0.7.1" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } [dev-dependencies] ctor = "0.1" diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index f6a887eb27fb8ced9a6628c80bfdc7ecff9b8780..a7209a750765587f7b48cc6ebf178abbb55f87b6 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -17,7 +17,7 @@ sum_tree = { path = "../sum_tree" } anyhow = "1.0.38" arrayvec = "0.7.1" lazy_static = "1.4" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11" postage = { version = "0.4.1", features = ["futures-traits"] } rand = { version = "0.8.3", optional = true } diff --git a/crates/theme_selector/Cargo.toml b/crates/theme_selector/Cargo.toml index 585d10d563c9919deb8a878576a14c9b09f35e72..9993287c8580b65870e20736c51ea66ca87f90c6 100644 --- a/crates/theme_selector/Cargo.toml +++ b/crates/theme_selector/Cargo.toml @@ -14,7 +14,7 @@ gpui = { path = "../gpui" } theme = { path = "../theme" } settings = { path = "../settings" } workspace = { path = "../workspace" } -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } smol = "1.2.5" diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 5bcbd62e09578c1210d32a4be10b435c8f695a04..74ff49e7104632c02380c068a9993202a868d5a4 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -7,9 +7,9 @@ use gpui::{ AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; +use settings::Settings; use std::{cmp, sync::Arc}; use theme::{Theme, ThemeRegistry}; -use settings::Settings; use workspace::{ menu::{Confirm, SelectNext, SelectPrev}, Workspace, diff --git a/crates/util/Cargo.toml b/crates/util/Cargo.toml index 9d39fb04e2f9b5c8192d9792d30decd614030511..cfc68e0b1676bf44a834d3a5817d781b81309f82 100644 --- a/crates/util/Cargo.toml +++ b/crates/util/Cargo.toml @@ -12,7 +12,7 @@ test-support = ["rand", "serde_json", "tempdir"] [dependencies] anyhow = "1.0.38" futures = "0.3" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } rand = { version = "0.8", optional = true } surf = "2.2" tempdir = { version = "0.3.7", optional = true } diff --git a/crates/vim/Cargo.toml b/crates/vim/Cargo.toml index 4ffa6a4363c5e08e17899db49d20a46a568dcca9..6386141ffc2d53c44700f16220c87609282deabb 100644 --- a/crates/vim/Cargo.toml +++ b/crates/vim/Cargo.toml @@ -14,7 +14,7 @@ gpui = { path = "../gpui" } language = { path = "../language" } settings = { path = "../settings" } workspace = { path = "../workspace" } -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } [dev-dependencies] indoc = "1.0.4" diff --git a/crates/workspace/Cargo.toml b/crates/workspace/Cargo.toml index 75d1b1b8f2667ab111278d2efa6979c66e7d50bd..a2a6c74bac78e7edffffbf1cbdeb6fd8b199789f 100644 --- a/crates/workspace/Cargo.toml +++ b/crates/workspace/Cargo.toml @@ -22,7 +22,7 @@ theme = { path = "../theme" } util = { path = "../util" } anyhow = "1.0.38" futures = "0.3" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } serde = { version = "1", features = ["derive", "rc"] } diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index f87046b05ebc5479d6282efd30028500f7a49c53..1a5a214f035ce1b8738f743573ed0e02170df314 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -75,7 +75,7 @@ image = "0.23" indexmap = "1.6.2" lazy_static = "1.4.0" libc = "0.2" -log = "0.4" +log = { version = "0.4.16", features = ["kv_unstable_serde"] } log-panics = { version = "2.0", features = ["with-backtrace"] } num_cpus = "1.13.0" parking_lot = "0.11.1" From b507e218319f7283797dd1a32d48e450790e83b8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 8 Apr 2022 10:08:52 -0600 Subject: [PATCH 124/245] Enable JSON logging at the trace log level in K8s Co-Authored-By: Antonio Scandurra --- crates/server/k8s/manifest.template.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/server/k8s/manifest.template.yml b/crates/server/k8s/manifest.template.yml index e1c33d4e49872f5cbba627373506ed9d899efce4..cb6b7107575591afcc80a11cf39302055716519a 100644 --- a/crates/server/k8s/manifest.template.yml +++ b/crates/server/k8s/manifest.template.yml @@ -81,6 +81,10 @@ spec: secretKeyRef: name: api key: token + - name: LOG_JSON + value: "1" + - name: RUST_LOG + value: "trace" securityContext: capabilities: # FIXME - Switch to the more restrictive `PERFMON` capability. From fd4b81c8fc07f57ebb8aea6c47292d5f91af45b1 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 8 Apr 2022 15:32:56 -0700 Subject: [PATCH 125/245] Allow actions to be deserialized from JSON Introduce separate macro for implementing 'internal' actions which are not intended to be loaded from keymaps. --- Cargo.lock | 3 + crates/editor/src/editor.rs | 241 +++++++++++--------- crates/file_finder/src/file_finder.rs | 4 +- crates/gpui/src/app.rs | 147 ++++++++---- crates/gpui/src/app/action.rs | 111 ++++++--- crates/gpui/src/gpui.rs | 3 + crates/gpui/src/keymap.rs | 64 +++--- crates/gpui/src/views/select.rs | 4 +- crates/project_panel/src/project_panel.rs | 4 +- crates/search/Cargo.toml | 1 + crates/search/src/buffer_search.rs | 112 +++++---- crates/search/src/project_search.rs | 37 +-- crates/search/src/search.rs | 8 +- crates/server/Cargo.toml | 1 + crates/server/src/rpc.rs | 2 + crates/theme_selector/src/theme_selector.rs | 30 ++- crates/vim/Cargo.toml | 1 + crates/vim/src/mode.rs | 5 +- crates/vim/src/normal.rs | 7 +- crates/vim/src/vim.rs | 3 +- crates/workspace/src/pane.rs | 29 ++- crates/workspace/src/pane_group.rs | 4 +- crates/workspace/src/sidebar.rs | 6 +- crates/workspace/src/workspace.rs | 13 +- crates/zed/src/main.rs | 2 +- crates/zed/src/zed.rs | 42 ++-- 26 files changed, 554 insertions(+), 330 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e5c046ab9d1b47389a945c7193462d27a425f84..d32a21d20158b2273f675779ea7670abd916f1f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4269,6 +4269,7 @@ dependencies = [ "log", "postage", "project", + "serde", "serde_json", "settings", "theme", @@ -5748,6 +5749,7 @@ dependencies = [ "language", "log", "project", + "serde", "settings", "util", "workspace", @@ -6133,6 +6135,7 @@ dependencies = [ "sha-1 0.9.6", "sqlx 0.5.5", "surf", + "theme", "tide", "tide-compress", "time 0.2.27", diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e10fe9c17cb1c64453e2ba8782136ef14f4d7778..4d3265f8fa3ad73cc84c837c759920178e63b610 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -22,7 +22,7 @@ use gpui::{ executor, fonts::{self, HighlightStyle, TextStyle}, geometry::vector::{vec2f, Vector2F}, - impl_actions, + impl_actions, impl_internal_actions, keymap::Binding, platform::CursorStyle, text_layout, AppContext, AsyncAppContext, ClipboardItem, Element, ElementBox, Entity, @@ -66,8 +66,11 @@ const MAX_LINE_LEN: usize = 1024; const MIN_NAVIGATION_HISTORY_ROW_DELTA: i64 = 10; const MAX_SELECTION_HISTORY_LEN: usize = 1024; -#[derive(Clone)] -pub struct SelectNext(pub bool); +#[derive(Clone, Deserialize)] +pub struct SelectNext { + #[serde(default)] + pub replace_newest: bool, +} #[derive(Clone)] pub struct GoToDiagnostic(pub Direction); @@ -81,44 +84,26 @@ pub struct Select(pub SelectPhase); #[derive(Clone)] pub struct Input(pub String); -#[derive(Clone)] -pub struct Tab(pub Direction); - -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct SelectToBeginningOfLine { + #[serde(default)] stop_at_soft_wraps: bool, } -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct SelectToEndOfLine { + #[serde(default)] stop_at_soft_wraps: bool, } -#[derive(Clone)] -pub struct ToggleCodeActions(pub bool); +#[derive(Clone, Deserialize)] +pub struct ToggleCodeActions(#[serde(default)] pub bool); -#[derive(Clone)] -pub struct ConfirmCompletion(pub Option); +#[derive(Clone, Deserialize)] +pub struct ConfirmCompletion(#[serde(default)] pub Option); -#[derive(Clone)] -pub struct ConfirmCodeAction(pub Option); - -impl_actions!( - editor, - [ - SelectNext, - GoToDiagnostic, - Scroll, - Select, - Input, - Tab, - SelectToBeginningOfLine, - SelectToEndOfLine, - ToggleCodeActions, - ConfirmCompletion, - ConfirmCodeAction, - ] -); +#[derive(Clone, Deserialize)] +pub struct ConfirmCodeAction(#[serde(default)] pub Option); actions!( editor, @@ -127,6 +112,8 @@ actions!( Backspace, Delete, Newline, + GoToNextDiagnostic, + GoToPrevDiagnostic, Indent, Outdent, DeleteLine, @@ -172,6 +159,8 @@ actions!( SplitSelectionIntoLines, AddSelectionAbove, AddSelectionBelow, + Tab, + TabPrev, ToggleComments, SelectLargerSyntaxNode, SelectSmallerSyntaxNode, @@ -193,6 +182,20 @@ actions!( ] ); +impl_actions!( + editor, + [ + SelectNext, + SelectToBeginningOfLine, + SelectToEndOfLine, + ToggleCodeActions, + ConfirmCompletion, + ConfirmCodeAction, + ] +); + +impl_internal_actions!(editor, [Scroll, Select, Input]); + enum DocumentHighlightRead {} enum DocumentHighlightWrite {} @@ -226,8 +229,8 @@ pub fn init(cx: &mut MutableAppContext) { Some("Editor && showing_code_actions"), ), Binding::new("enter", ConfirmRename, Some("Editor && renaming")), - Binding::new("tab", Tab(Direction::Next), Some("Editor")), - Binding::new("shift-tab", Tab(Direction::Prev), Some("Editor")), + Binding::new("tab", Tab, Some("Editor")), + Binding::new("shift-tab", TabPrev, Some("Editor")), Binding::new( "tab", ConfirmCompletion(None), @@ -346,8 +349,20 @@ pub fn init(cx: &mut MutableAppContext) { Binding::new("cmd-ctrl-p", AddSelectionAbove, Some("Editor")), Binding::new("cmd-alt-down", AddSelectionBelow, Some("Editor")), Binding::new("cmd-ctrl-n", AddSelectionBelow, Some("Editor")), - Binding::new("cmd-d", SelectNext(false), Some("Editor")), - Binding::new("cmd-k cmd-d", SelectNext(true), Some("Editor")), + Binding::new( + "cmd-d", + SelectNext { + replace_newest: false, + }, + Some("Editor"), + ), + Binding::new( + "cmd-k cmd-d", + SelectNext { + replace_newest: true, + }, + Some("Editor"), + ), Binding::new("cmd-/", ToggleComments, Some("Editor")), Binding::new("alt-up", SelectLargerSyntaxNode, Some("Editor")), Binding::new("ctrl-w", SelectLargerSyntaxNode, Some("Editor")), @@ -355,8 +370,8 @@ pub fn init(cx: &mut MutableAppContext) { Binding::new("ctrl-shift-W", SelectSmallerSyntaxNode, Some("Editor")), Binding::new("cmd-u", UndoSelection, Some("Editor")), Binding::new("cmd-shift-U", RedoSelection, Some("Editor")), - Binding::new("f8", GoToDiagnostic(Direction::Next), Some("Editor")), - Binding::new("shift-f8", GoToDiagnostic(Direction::Prev), Some("Editor")), + Binding::new("f8", GoToNextDiagnostic, Some("Editor")), + Binding::new("shift-f8", GoToPrevDiagnostic, Some("Editor")), Binding::new("f2", Rename, Some("Editor")), Binding::new("f12", GoToDefinition, Some("Editor")), Binding::new("alt-shift-f12", FindAllReferences, Some("Editor")), @@ -435,7 +450,8 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(Editor::move_to_enclosing_bracket); cx.add_action(Editor::undo_selection); cx.add_action(Editor::redo_selection); - cx.add_action(Editor::go_to_diagnostic); + cx.add_action(Editor::go_to_next_diagnostic); + cx.add_action(Editor::go_to_prev_diagnostic); cx.add_action(Editor::go_to_definition); cx.add_action(Editor::page_up); cx.add_action(Editor::page_down); @@ -2940,8 +2956,8 @@ impl Editor { self.move_to_snippet_tabstop(Bias::Right, cx) } - pub fn move_to_prev_snippet_tabstop(&mut self, cx: &mut ViewContext) { - self.move_to_snippet_tabstop(Bias::Left, cx); + pub fn move_to_prev_snippet_tabstop(&mut self, cx: &mut ViewContext) -> bool { + self.move_to_snippet_tabstop(Bias::Left, cx) } pub fn move_to_snippet_tabstop(&mut self, bias: Bias, cx: &mut ViewContext) -> bool { @@ -3046,54 +3062,46 @@ impl Editor { }); } - pub fn tab(&mut self, &Tab(direction): &Tab, cx: &mut ViewContext) { - match direction { - Direction::Prev => { - if !self.snippet_stack.is_empty() { - self.move_to_prev_snippet_tabstop(cx); - return; - } + pub fn tab_prev(&mut self, _: &TabPrev, cx: &mut ViewContext) { + if self.move_to_prev_snippet_tabstop(cx) { + return; + } - self.outdent(&Outdent, cx); - } - Direction::Next => { - if self.move_to_next_snippet_tabstop(cx) { - return; - } + self.outdent(&Outdent, cx); + } - let mut selections = self.local_selections::(cx); - if selections.iter().all(|s| s.is_empty()) { - self.transact(cx, |this, cx| { - this.buffer.update(cx, |buffer, cx| { - for selection in &mut selections { - let language_name = - buffer.language_at(selection.start, cx).map(|l| l.name()); - let tab_size = - cx.global::().tab_size(language_name.as_deref()); - let char_column = buffer - .read(cx) - .text_for_range( - Point::new(selection.start.row, 0)..selection.start, - ) - .flat_map(str::chars) - .count(); - let chars_to_next_tab_stop = - tab_size - (char_column as u32 % tab_size); - buffer.edit( - [selection.start..selection.start], - " ".repeat(chars_to_next_tab_stop as usize), - cx, - ); - selection.start.column += chars_to_next_tab_stop; - selection.end = selection.start; - } - }); - this.update_selections(selections, Some(Autoscroll::Fit), cx); - }); - } else { - self.indent(&Indent, cx); - } - } + pub fn tab(&mut self, _: &Tab, cx: &mut ViewContext) { + if self.move_to_next_snippet_tabstop(cx) { + return; + } + + let mut selections = self.local_selections::(cx); + if selections.iter().all(|s| s.is_empty()) { + self.transact(cx, |this, cx| { + this.buffer.update(cx, |buffer, cx| { + for selection in &mut selections { + let language_name = + buffer.language_at(selection.start, cx).map(|l| l.name()); + let tab_size = cx.global::().tab_size(language_name.as_deref()); + let char_column = buffer + .read(cx) + .text_for_range(Point::new(selection.start.row, 0)..selection.start) + .flat_map(str::chars) + .count(); + let chars_to_next_tab_stop = tab_size - (char_column as u32 % tab_size); + buffer.edit( + [selection.start..selection.start], + " ".repeat(chars_to_next_tab_stop as usize), + cx, + ); + selection.start.column += chars_to_next_tab_stop; + selection.end = selection.start; + } + }); + this.update_selections(selections, Some(Autoscroll::Fit), cx); + }); + } else { + self.indent(&Indent, cx); } } @@ -4237,7 +4245,6 @@ impl Editor { pub fn select_next(&mut self, action: &SelectNext, cx: &mut ViewContext) { self.push_to_selection_history(); - let replace_newest = action.0; let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let buffer = &display_map.buffer_snapshot; let mut selections = self.local_selections::(cx); @@ -4276,7 +4283,7 @@ impl Editor { } if let Some(next_selected_range) = next_selected_range { - if replace_newest { + if action.replace_newest { if let Some(newest_id) = selections.iter().max_by_key(|s| s.id).map(|s| s.id) { @@ -4547,11 +4554,15 @@ impl Editor { self.selection_history.mode = SelectionHistoryMode::Normal; } - pub fn go_to_diagnostic( - &mut self, - &GoToDiagnostic(direction): &GoToDiagnostic, - cx: &mut ViewContext, - ) { + fn go_to_next_diagnostic(&mut self, _: &GoToNextDiagnostic, cx: &mut ViewContext) { + self.go_to_diagnostic(Direction::Next, cx) + } + + fn go_to_prev_diagnostic(&mut self, _: &GoToNextDiagnostic, cx: &mut ViewContext) { + self.go_to_diagnostic(Direction::Prev, cx) + } + + pub fn go_to_diagnostic(&mut self, direction: Direction, cx: &mut ViewContext) { let buffer = self.buffer.read(cx).snapshot(cx); let selection = self.newest_selection_with_snapshot::(&buffer); let mut active_primary_range = self.active_diagnostics.as_ref().map(|active_diagnostics| { @@ -7771,7 +7782,7 @@ mod tests { ); // indent from mid-tabstop to full tabstop - view.tab(&Tab(Direction::Next), cx); + view.tab(&Tab, cx); assert_text_with_selections( view, indoc! {" @@ -7782,7 +7793,7 @@ mod tests { ); // outdent from 1 tabstop to 0 tabstops - view.tab(&Tab(Direction::Prev), cx); + view.tab_prev(&TabPrev, cx); assert_text_with_selections( view, indoc! {" @@ -7803,7 +7814,7 @@ mod tests { ); // indent and outdent affect only the preceding line - view.tab(&Tab(Direction::Next), cx); + view.tab(&Tab, cx); assert_text_with_selections( view, indoc! {" @@ -7812,7 +7823,7 @@ mod tests { ] four"}, cx, ); - view.tab(&Tab(Direction::Prev), cx); + view.tab_prev(&TabPrev, cx); assert_text_with_selections( view, indoc! {" @@ -7831,7 +7842,7 @@ mod tests { four"}, cx, ); - view.tab(&Tab(Direction::Next), cx); + view.tab(&Tab, cx); assert_text_with_selections( view, indoc! {" @@ -7849,7 +7860,7 @@ mod tests { four"}, cx, ); - view.tab(&Tab(Direction::Prev), cx); + view.tab_prev(&TabPrev, cx); assert_text_with_selections( view, indoc! {" @@ -7939,7 +7950,7 @@ mod tests { cx, ); - editor.tab(&Tab(Direction::Next), cx); + editor.tab(&Tab, cx); assert_text_with_selections( &mut editor, indoc! {" @@ -7950,7 +7961,7 @@ mod tests { "}, cx, ); - editor.tab(&Tab(Direction::Prev), cx); + editor.tab_prev(&TabPrev, cx); assert_text_with_selections( &mut editor, indoc! {" @@ -8693,10 +8704,20 @@ mod tests { view.update(cx, |view, cx| { view.select_ranges([ranges[1].start + 1..ranges[1].start + 1], None, cx); - view.select_next(&SelectNext(false), cx); + view.select_next( + &SelectNext { + replace_newest: false, + }, + cx, + ); assert_eq!(view.selected_ranges(cx), &ranges[1..2]); - view.select_next(&SelectNext(false), cx); + view.select_next( + &SelectNext { + replace_newest: false, + }, + cx, + ); assert_eq!(view.selected_ranges(cx), &ranges[1..3]); view.undo_selection(&UndoSelection, cx); @@ -8705,10 +8726,20 @@ mod tests { view.redo_selection(&RedoSelection, cx); assert_eq!(view.selected_ranges(cx), &ranges[1..3]); - view.select_next(&SelectNext(false), cx); + view.select_next( + &SelectNext { + replace_newest: false, + }, + cx, + ); assert_eq!(view.selected_ranges(cx), &ranges[1..4]); - view.select_next(&SelectNext(false), cx); + view.select_next( + &SelectNext { + replace_newest: false, + }, + cx, + ); assert_eq!(view.selected_ranges(cx), &ranges[0..4]); }); } diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index af9fd910b57402d7dfead84574623cc50a31dc61..659dde7c5b40b4befdf15ee0ce3bc3dca5b1731a 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -3,7 +3,7 @@ use fuzzy::PathMatch; use gpui::{ actions, elements::*, - impl_actions, + impl_internal_actions, keymap::{self, Binding}, AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, @@ -41,8 +41,8 @@ pub struct FileFinder { #[derive(Clone)] pub struct Select(pub ProjectPath); -impl_actions!(file_finder, [Select]); actions!(file_finder, [Toggle]); +impl_internal_actions!(file_finder, [Select]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(FileFinder::toggle); diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 3fc56527917a37a85110506c70d202e14a4a9a16..f7417f666349b9bad33acd6b2109fba9a36fe1f7 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -715,12 +715,14 @@ type GlobalSubscriptionCallback = Box bool>; type GlobalObservationCallback = Box; type ReleaseObservationCallback = Box; +type DeserializeActionCallback = fn(json: &str) -> anyhow::Result>; pub struct MutableAppContext { weak_self: Option>>, foreground_platform: Rc, assets: Arc, cx: AppContext, + action_deserializers: HashMap<&'static str, DeserializeActionCallback>, capture_actions: HashMap>>>, actions: HashMap>>>, global_actions: HashMap>, @@ -773,6 +775,7 @@ impl MutableAppContext { font_cache, platform, }, + action_deserializers: HashMap::new(), capture_actions: HashMap::new(), actions: HashMap::new(), global_actions: HashMap::new(), @@ -857,6 +860,18 @@ impl MutableAppContext { .and_then(|(presenter, _)| presenter.borrow().debug_elements(self)) } + pub fn deserialize_action( + &self, + name: &str, + argument: Option<&str>, + ) -> Result> { + let callback = self + .action_deserializers + .get(name) + .ok_or_else(|| anyhow!("unknown action {}", name))?; + callback(argument.unwrap_or("{}")) + } + pub fn add_action(&mut self, handler: F) where A: Action, @@ -899,6 +914,10 @@ impl MutableAppContext { }, ); + self.action_deserializers + .entry(A::qualified_name()) + .or_insert(A::from_json_str); + let actions = if capture { &mut self.capture_actions } else { @@ -934,6 +953,10 @@ impl MutableAppContext { handler(action, cx); }); + self.action_deserializers + .entry(A::qualified_name()) + .or_insert(A::from_json_str); + if self .global_actions .insert(TypeId::of::(), handler) @@ -4575,7 +4598,8 @@ impl RefCounts { #[cfg(test)] mod tests { use super::*; - use crate::{elements::*, impl_actions}; + use crate::{actions, elements::*, impl_actions}; + use serde::Deserialize; use smol::future::poll_once; use std::{ cell::Cell, @@ -5683,6 +5707,42 @@ mod tests { ); } + #[crate::test(self)] + fn test_deserialize_actions(cx: &mut MutableAppContext) { + #[derive(Clone, Debug, Deserialize, PartialEq, Eq)] + pub struct ComplexAction { + arg: String, + count: usize, + } + + actions!(test::something, [SimpleAction]); + impl_actions!(test::something, [ComplexAction]); + + cx.add_global_action(move |_: &SimpleAction, _: &mut MutableAppContext| {}); + cx.add_global_action(move |_: &ComplexAction, _: &mut MutableAppContext| {}); + + let action1 = cx + .deserialize_action( + "test::something::ComplexAction", + Some(r#"{"arg": "a", "count": 5}"#), + ) + .unwrap(); + let action2 = cx + .deserialize_action("test::something::SimpleAction", None) + .unwrap(); + assert_eq!( + action1.as_any().downcast_ref::().unwrap(), + &ComplexAction { + arg: "a".to_string(), + count: 5, + } + ); + assert_eq!( + action2.as_any().downcast_ref::().unwrap(), + &SimpleAction + ); + } + #[crate::test(self)] fn test_dispatch_action(cx: &mut MutableAppContext) { struct ViewA { @@ -5721,32 +5781,32 @@ mod tests { } } - #[derive(Clone)] - pub struct Action(pub &'static str); + #[derive(Clone, Deserialize)] + pub struct Action(pub String); impl_actions!(test, [Action]); let actions = Rc::new(RefCell::new(Vec::new())); - { + cx.add_global_action({ let actions = actions.clone(); - cx.add_global_action(move |_: &Action, _: &mut MutableAppContext| { + move |_: &Action, _: &mut MutableAppContext| { actions.borrow_mut().push("global".to_string()); - }); - } + } + }); - { + cx.add_action({ let actions = actions.clone(); - cx.add_action(move |view: &mut ViewA, action: &Action, cx| { + move |view: &mut ViewA, action: &Action, cx| { assert_eq!(action.0, "bar"); cx.propagate_action(); actions.borrow_mut().push(format!("{} a", view.id)); - }); - } + } + }); - { + cx.add_action({ let actions = actions.clone(); - cx.add_action(move |view: &mut ViewA, _: &Action, cx| { + move |view: &mut ViewA, _: &Action, cx| { if view.id != 1 { cx.add_view(|cx| { cx.propagate_action(); // Still works on a nested ViewContext @@ -5754,32 +5814,32 @@ mod tests { }); } actions.borrow_mut().push(format!("{} b", view.id)); - }); - } + } + }); - { + cx.add_action({ let actions = actions.clone(); - cx.add_action(move |view: &mut ViewB, _: &Action, cx| { + move |view: &mut ViewB, _: &Action, cx| { cx.propagate_action(); actions.borrow_mut().push(format!("{} c", view.id)); - }); - } + } + }); - { + cx.add_action({ let actions = actions.clone(); - cx.add_action(move |view: &mut ViewB, _: &Action, cx| { + move |view: &mut ViewB, _: &Action, cx| { cx.propagate_action(); actions.borrow_mut().push(format!("{} d", view.id)); - }); - } + } + }); - { + cx.capture_action({ let actions = actions.clone(); - cx.capture_action(move |view: &mut ViewA, _: &Action, cx| { + move |view: &mut ViewA, _: &Action, cx| { cx.propagate_action(); actions.borrow_mut().push(format!("{} capture", view.id)); - }); - } + } + }); let (window_id, view_1) = cx.add_window(Default::default(), |_| ViewA { id: 1 }); let view_2 = cx.add_view(window_id, |_| ViewB { id: 2 }); @@ -5789,7 +5849,7 @@ mod tests { cx.dispatch_action( window_id, vec![view_1.id(), view_2.id(), view_3.id(), view_4.id()], - &Action("bar"), + &Action("bar".to_string()), ); assert_eq!( @@ -5812,7 +5872,7 @@ mod tests { cx.dispatch_action( window_id, vec![view_2.id(), view_3.id(), view_4.id()], - &Action("bar"), + &Action("bar".to_string()), ); assert_eq!( @@ -5832,8 +5892,8 @@ mod tests { #[crate::test(self)] fn test_dispatch_keystroke(cx: &mut MutableAppContext) { - #[derive(Clone)] - pub struct Action(pub &'static str); + #[derive(Clone, Deserialize)] + pub struct Action(String); impl_actions!(test, [Action]); @@ -5887,16 +5947,20 @@ mod tests { // "a" and "b" in its context, but not "c". cx.add_bindings(vec![keymap::Binding::new( "a", - Action("a"), + Action("a".to_string()), Some("a && b && !c"), )]); - cx.add_bindings(vec![keymap::Binding::new("b", Action("b"), None)]); + cx.add_bindings(vec![keymap::Binding::new( + "b", + Action("b".to_string()), + None, + )]); let actions = Rc::new(RefCell::new(Vec::new())); - { + cx.add_action({ let actions = actions.clone(); - cx.add_action(move |view: &mut View, action: &Action, cx| { + move |view: &mut View, action: &Action, cx| { if action.0 == "a" { actions.borrow_mut().push(format!("{} a", view.id)); } else { @@ -5905,14 +5969,15 @@ mod tests { .push(format!("{} {}", view.id, action.0)); cx.propagate_action(); } - }); - } - { + } + }); + + cx.add_global_action({ let actions = actions.clone(); - cx.add_global_action(move |action: &Action, _| { + move |action: &Action, _| { actions.borrow_mut().push(format!("global {}", action.0)); - }); - } + } + }); cx.dispatch_keystroke( window_id, diff --git a/crates/gpui/src/app/action.rs b/crates/gpui/src/app/action.rs index 79606feee7dd7b6306750b7b71ec7ec655916ed8..fc5bd616eef5581f739f452ffb53a2843f18245b 100644 --- a/crates/gpui/src/app/action.rs +++ b/crates/gpui/src/app/action.rs @@ -2,55 +2,108 @@ use std::any::{Any, TypeId}; pub trait Action: 'static { fn id(&self) -> TypeId; - fn namespace(&self) -> &'static str; fn name(&self) -> &'static str; fn as_any(&self) -> &dyn Any; fn boxed_clone(&self) -> Box; - fn boxed_clone_as_any(&self) -> Box; + + fn qualified_name() -> &'static str + where + Self: Sized; + fn from_json_str(json: &str) -> anyhow::Result> + where + Self: Sized; } +/// Define a set of unit struct types that all implement the `Action` trait. +/// +/// The first argument is a namespace that will be associated with each of +/// the given action types, to ensure that they have globally unique +/// qualified names for use in keymap files. #[macro_export] -macro_rules! impl_actions { +macro_rules! actions { ($namespace:path, [ $($name:ident),* $(,)? ]) => { $( - impl $crate::action::Action for $name { - fn id(&self) -> std::any::TypeId { - std::any::TypeId::of::<$name>() - } - - fn namespace(&self) -> &'static str { - stringify!($namespace) - } - - fn name(&self) -> &'static str { - stringify!($name) - } - - fn as_any(&self) -> &dyn std::any::Any { - self - } - - fn boxed_clone(&self) -> Box { - Box::new(self.clone()) + #[derive(Clone, Debug, Default, PartialEq, Eq)] + pub struct $name; + $crate::__impl_action! { + $namespace, + $name, + fn from_json_str(_: &str) -> $crate::anyhow::Result> { + Ok(Box::new(Self)) } + } + )* + }; +} - fn boxed_clone_as_any(&self) -> Box { - Box::new(self.clone()) +/// Implement the `Action` trait for a set of existing types. +/// +/// The first argument is a namespace that will be associated with each of +/// the given action types, to ensure that they have globally unique +/// qualified names for use in keymap files. +#[macro_export] +macro_rules! impl_actions { + ($namespace:path, [ $($name:ident),* $(,)? ]) => { + $( + $crate::__impl_action! { + $namespace, + $name, + fn from_json_str(json: &str) -> $crate::anyhow::Result> { + Ok(Box::new($crate::serde_json::from_str::(json)?)) } } )* }; } +/// Implement the `Action` trait for a set of existing types that are +/// not intended to be constructed via a keymap file, but only dispatched +/// internally. #[macro_export] -macro_rules! actions { +macro_rules! impl_internal_actions { ($namespace:path, [ $($name:ident),* $(,)? ]) => { - $( - #[derive(Clone, Debug, Default, PartialEq, Eq)] - pub struct $name; + $crate::__impl_action! { + $namespace, + $name, + fn from_json_str(_: &str) -> $crate::anyhow::Result> { + Err($crate::anyhow::anyhow!("internal action")) + } + } )* + }; +} + +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_action { + ($namespace:path, $name:ident, $from_json_fn:item) => { + impl $crate::action::Action for $name { + fn name(&self) -> &'static str { + stringify!($name) + } + + fn qualified_name() -> &'static str { + concat!( + stringify!($namespace), + "::", + stringify!($name), + ) + } + + fn id(&self) -> std::any::TypeId { + std::any::TypeId::of::<$name>() + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } + + fn boxed_clone(&self) -> Box { + Box::new(self.clone()) + } - $crate::impl_actions!($namespace, [ $($name),* ]); + $from_json_fn + } }; } diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 9803a2aa2f70c23660953653b9c3c32ff4ad850f..e58bbec1c60f485ae5a24986de99841f00d2a705 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -33,3 +33,6 @@ pub use platform::{Event, NavigationDirection, PathPromptOptions, Platform, Prom pub use presenter::{ Axis, DebugContext, EventContext, LayoutContext, PaintContext, SizeConstraint, Vector2FExt, }; + +pub use anyhow; +pub use serde_json; diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index f286265964046b10ace59a74ce4915ad3ee2fec7..a94abb8252c46616cd733084839b317701d16a43 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -328,6 +328,8 @@ impl ContextPredicate { #[cfg(test)] mod tests { + use serde::Deserialize; + use crate::{actions, impl_actions}; use super::*; @@ -419,30 +421,18 @@ mod tests { #[test] fn test_matcher() -> anyhow::Result<()> { - #[derive(Clone)] - pub struct A(pub &'static str); + #[derive(Clone, Deserialize, PartialEq, Eq, Debug)] + pub struct A(pub String); impl_actions!(test, [A]); actions!(test, [B, Ab]); - impl PartialEq for A { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } - } - impl Eq for A {} - impl Debug for A { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "A({:?})", &self.0) - } - } - #[derive(Clone, Debug, Eq, PartialEq)] struct ActionArg { a: &'static str, } let keymap = Keymap(vec![ - Binding::new("a", A("x"), Some("a")), + Binding::new("a", A("x".to_string()), Some("a")), Binding::new("b", B, Some("a")), Binding::new("a b", Ab, Some("a || b")), ]); @@ -456,40 +446,54 @@ mod tests { let mut matcher = Matcher::new(keymap); // Basic match - assert_eq!(matcher.test_keystroke("a", 1, &ctx_a), Some(A("x"))); + assert_eq!( + downcast(&matcher.test_keystroke("a", 1, &ctx_a)), + Some(&A("x".to_string())) + ); // Multi-keystroke match - assert_eq!(matcher.test_keystroke::("a", 1, &ctx_b), None); - assert_eq!(matcher.test_keystroke("b", 1, &ctx_b), Some(Ab)); + assert!(matcher.test_keystroke("a", 1, &ctx_b).is_none()); + assert_eq!(downcast(&matcher.test_keystroke("b", 1, &ctx_b)), Some(&Ab)); // Failed matches don't interfere with matching subsequent keys - assert_eq!(matcher.test_keystroke::("x", 1, &ctx_a), None); - assert_eq!(matcher.test_keystroke("a", 1, &ctx_a), Some(A("x"))); + assert!(matcher.test_keystroke("x", 1, &ctx_a).is_none()); + assert_eq!( + downcast(&matcher.test_keystroke("a", 1, &ctx_a)), + Some(&A("x".to_string())) + ); // Pending keystrokes are cleared when the context changes - assert_eq!(matcher.test_keystroke::("a", 1, &ctx_b), None); - assert_eq!(matcher.test_keystroke("b", 1, &ctx_a), Some(B)); + assert!(&matcher.test_keystroke("a", 1, &ctx_b).is_none()); + assert_eq!(downcast(&matcher.test_keystroke("b", 1, &ctx_a)), Some(&B)); let mut ctx_c = Context::default(); ctx_c.set.insert("c".into()); // Pending keystrokes are maintained per-view - assert_eq!(matcher.test_keystroke::("a", 1, &ctx_b), None); - assert_eq!(matcher.test_keystroke::("a", 2, &ctx_c), None); - assert_eq!(matcher.test_keystroke("b", 1, &ctx_b), Some(Ab)); + assert!(matcher.test_keystroke("a", 1, &ctx_b).is_none()); + assert!(matcher.test_keystroke("a", 2, &ctx_c).is_none()); + assert_eq!(downcast(&matcher.test_keystroke("b", 1, &ctx_b)), Some(&Ab)); Ok(()) } + fn downcast<'a, A: Action>(action: &'a Option>) -> Option<&'a A> { + action + .as_ref() + .and_then(|action| action.as_any().downcast_ref()) + } + impl Matcher { - fn test_keystroke(&mut self, keystroke: &str, view_id: usize, cx: &Context) -> Option - where - A: Action + Debug + Eq, - { + fn test_keystroke( + &mut self, + keystroke: &str, + view_id: usize, + cx: &Context, + ) -> Option> { if let MatchResult::Action(action) = self.push_keystroke(Keystroke::parse(keystroke).unwrap(), view_id, cx) { - Some(*action.boxed_clone_as_any().downcast().unwrap()) + Some(action.boxed_clone()) } else { None } diff --git a/crates/gpui/src/views/select.rs b/crates/gpui/src/views/select.rs index 14b098c472f0e8c677594353c60b78428a49dd55..10cd0cd5a2934912665917e85237d2bb67b28575 100644 --- a/crates/gpui/src/views/select.rs +++ b/crates/gpui/src/views/select.rs @@ -1,3 +1,5 @@ +use serde::Deserialize; + use crate::{ actions, elements::*, impl_actions, AppContext, Entity, MutableAppContext, RenderContext, View, ViewContext, WeakViewHandle, @@ -25,7 +27,7 @@ pub enum ItemType { Unselected, } -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct SelectItem(pub usize); actions!(select, [ToggleSelect]); diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 3534fa186f40ea1c8a3c8e10f9f1e59a154f1fad..a14e03d27dfff794efa16847f8c54cc969822487 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -4,7 +4,7 @@ use gpui::{ Align, ConstrainedBox, Empty, Flex, Label, MouseEventHandler, ParentElement, ScrollTarget, Svg, UniformList, UniformListState, }, - impl_actions, + impl_internal_actions, keymap::{self, Binding}, platform::CursorStyle, AppContext, Element, ElementBox, Entity, ModelHandle, MutableAppContext, View, ViewContext, @@ -54,7 +54,7 @@ pub struct ToggleExpanded(pub ProjectEntryId); pub struct Open(pub ProjectEntryId); actions!(project_panel, [ExpandSelectedEntry, CollapseSelectedEntry]); -impl_actions!(project_panel, [Open, ToggleExpanded]); +impl_internal_actions!(project_panel, [Open, ToggleExpanded]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(ProjectPanel::expand_selected_entry); diff --git a/crates/search/Cargo.toml b/crates/search/Cargo.toml index 77961de01f3efdee86603d01b99c259509d04c9e..967b50c270304a77c1e6627d5aa49136934c1ee5 100644 --- a/crates/search/Cargo.toml +++ b/crates/search/Cargo.toml @@ -20,6 +20,7 @@ workspace = { path = "../workspace" } anyhow = "1.0" log = "0.4" postage = { version = "0.4.1", features = ["futures-traits"] } +serde = { version = "1", features = ["derive"] } [dev-dependencies] editor = { path = "../editor", features = ["test-support"] } diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index ffaf8e368de992392abea173960da31914f8c1a1..71e9a90970a9a9288b68edad76ec873ff39723aa 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -1,25 +1,32 @@ -use crate::{active_match_index, match_index_for_direction, Direction, SearchOption, SelectMatch}; +use crate::{ + active_match_index, match_index_for_direction, Direction, SearchOption, SelectNextMatch, + SelectPrevMatch, +}; use collections::HashMap; use editor::{display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, Editor}; use gpui::{ - actions, elements::*, impl_actions, keymap::Binding, platform::CursorStyle, AppContext, Entity, - MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, ViewHandle, - WeakViewHandle, + actions, elements::*, impl_actions, impl_internal_actions, keymap::Binding, + platform::CursorStyle, AppContext, Entity, MutableAppContext, RenderContext, Subscription, + Task, View, ViewContext, ViewHandle, WeakViewHandle, }; use language::OffsetRangeExt; use project::search::SearchQuery; +use serde::Deserialize; use settings::Settings; use std::ops::Range; use workspace::{ItemHandle, Pane, ToolbarItemLocation, ToolbarItemView}; -#[derive(Clone)] -pub struct Deploy(pub bool); +#[derive(Clone, Deserialize)] +pub struct Deploy { + pub focus: bool, +} #[derive(Clone)] pub struct ToggleSearchOption(pub SearchOption); actions!(buffer_search, [Dismiss, FocusEditor]); -impl_actions!(buffer_search, [Deploy, ToggleSearchOption]); +impl_actions!(buffer_search, [Deploy]); +impl_internal_actions!(buffer_search, [ToggleSearchOption]); pub enum Event { UpdateLocation, @@ -27,29 +34,31 @@ pub enum Event { pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ - Binding::new("cmd-f", Deploy(true), Some("Editor && mode == full")), - Binding::new("cmd-e", Deploy(false), Some("Editor && mode == full")), - Binding::new("escape", Dismiss, Some("BufferSearchBar")), - Binding::new("cmd-f", FocusEditor, Some("BufferSearchBar")), Binding::new( - "enter", - SelectMatch(Direction::Next), - Some("BufferSearchBar"), + "cmd-f", + Deploy { focus: true }, + Some("Editor && mode == full"), ), Binding::new( - "shift-enter", - SelectMatch(Direction::Prev), - Some("BufferSearchBar"), + "cmd-e", + Deploy { focus: false }, + Some("Editor && mode == full"), ), - Binding::new("cmd-g", SelectMatch(Direction::Next), Some("Pane")), - Binding::new("cmd-shift-G", SelectMatch(Direction::Prev), Some("Pane")), + Binding::new("escape", Dismiss, Some("BufferSearchBar")), + Binding::new("cmd-f", FocusEditor, Some("BufferSearchBar")), + Binding::new("enter", SelectNextMatch, Some("BufferSearchBar")), + Binding::new("shift-enter", SelectPrevMatch, Some("BufferSearchBar")), + Binding::new("cmd-g", SelectNextMatch, Some("Pane")), + Binding::new("cmd-shift-G", SelectPrevMatch, Some("Pane")), ]); cx.add_action(BufferSearchBar::deploy); cx.add_action(BufferSearchBar::dismiss); cx.add_action(BufferSearchBar::focus_editor); cx.add_action(BufferSearchBar::toggle_search_option); - cx.add_action(BufferSearchBar::select_match); - cx.add_action(BufferSearchBar::select_match_on_pane); + cx.add_action(BufferSearchBar::select_next_match); + cx.add_action(BufferSearchBar::select_prev_match); + cx.add_action(BufferSearchBar::select_next_match_on_pane); + cx.add_action(BufferSearchBar::select_prev_match_on_pane); } pub struct BufferSearchBar { @@ -325,14 +334,17 @@ impl BufferSearchBar { .with_style(style.container) .boxed() }) - .on_click(move |cx| cx.dispatch_action(SelectMatch(direction))) + .on_click(move |cx| match direction { + Direction::Prev => cx.dispatch_action(SelectPrevMatch), + Direction::Next => cx.dispatch_action(SelectNextMatch), + }) .with_cursor_style(CursorStyle::PointingHand) .boxed() } - fn deploy(pane: &mut Pane, Deploy(focus): &Deploy, cx: &mut ViewContext) { + fn deploy(pane: &mut Pane, action: &Deploy, cx: &mut ViewContext) { if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::() { - if search_bar.update(cx, |search_bar, cx| search_bar.show(*focus, cx)) { + if search_bar.update(cx, |search_bar, cx| search_bar.show(action.focus, cx)) { return; } } @@ -368,7 +380,15 @@ impl BufferSearchBar { cx.notify(); } - fn select_match(&mut self, &SelectMatch(direction): &SelectMatch, cx: &mut ViewContext) { + fn select_next_match(&mut self, _: &SelectNextMatch, cx: &mut ViewContext) { + self.select_match(Direction::Next, cx); + } + + fn select_prev_match(&mut self, _: &SelectPrevMatch, cx: &mut ViewContext) { + self.select_match(Direction::Prev, cx); + } + + fn select_match(&mut self, direction: Direction, cx: &mut ViewContext) { if let Some(index) = self.active_match_index { if let Some(editor) = self.active_editor.as_ref() { editor.update(cx, |editor, cx| { @@ -389,9 +409,23 @@ impl BufferSearchBar { } } - fn select_match_on_pane(pane: &mut Pane, action: &SelectMatch, cx: &mut ViewContext) { + fn select_next_match_on_pane( + pane: &mut Pane, + action: &SelectNextMatch, + cx: &mut ViewContext, + ) { + if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::() { + search_bar.update(cx, |bar, cx| bar.select_next_match(action, cx)); + } + } + + fn select_prev_match_on_pane( + pane: &mut Pane, + action: &SelectPrevMatch, + cx: &mut ViewContext, + ) { if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::() { - search_bar.update(cx, |search_bar, cx| search_bar.select_match(action, cx)); + search_bar.update(cx, |bar, cx| bar.select_prev_match(action, cx)); } } @@ -699,7 +733,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(0)); - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43)] @@ -710,7 +744,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 11)..DisplayPoint::new(3, 13)] @@ -721,7 +755,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 56)..DisplayPoint::new(3, 58)] @@ -732,7 +766,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43)] @@ -743,7 +777,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 56)..DisplayPoint::new(3, 58)] @@ -754,7 +788,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 11)..DisplayPoint::new(3, 13)] @@ -765,7 +799,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43)] @@ -782,7 +816,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(1)); - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43)] @@ -799,7 +833,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(1)); - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 11)..DisplayPoint::new(3, 13)] @@ -816,7 +850,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(2)); - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 56)..DisplayPoint::new(3, 58)] @@ -833,7 +867,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(2)); - search_bar.select_match(&SelectMatch(Direction::Next), cx); + search_bar.select_next_match(&SelectNextMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(0, 41)..DisplayPoint::new(0, 43)] @@ -850,7 +884,7 @@ mod tests { }); search_bar.update(cx, |search_bar, cx| { assert_eq!(search_bar.active_match_index, Some(0)); - search_bar.select_match(&SelectMatch(Direction::Prev), cx); + search_bar.select_prev_match(&SelectPrevMatch, cx); assert_eq!( editor.update(cx, |editor, cx| editor.selected_display_ranges(cx)), [DisplayPoint::new(3, 56)..DisplayPoint::new(3, 58)] diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index f96e3c84d1979b99e414f1b028dcd927f3ae4102..39ff1a09ea312412b1b6d5e0dad6c4fe2776b803 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1,6 +1,6 @@ use crate::{ - active_match_index, match_index_for_direction, Direction, SearchOption, SelectMatch, - ToggleSearchOption, + active_match_index, match_index_for_direction, Direction, SearchOption, SelectNextMatch, + SelectPrevMatch, ToggleSearchOption, }; use collections::HashMap; use editor::{Anchor, Autoscroll, Editor, MultiBuffer, SelectAll}; @@ -34,14 +34,15 @@ pub fn init(cx: &mut MutableAppContext) { Binding::new("cmd-shift-F", Deploy, Some("Workspace")), Binding::new("enter", Search, Some("ProjectSearchBar")), Binding::new("cmd-enter", SearchInNew, Some("ProjectSearchBar")), - Binding::new("cmd-g", SelectMatch(Direction::Next), Some("Pane")), - Binding::new("cmd-shift-G", SelectMatch(Direction::Prev), Some("Pane")), + Binding::new("cmd-g", SelectNextMatch, Some("Pane")), + Binding::new("cmd-shift-G", SelectPrevMatch, Some("Pane")), ]); cx.add_action(ProjectSearchView::deploy); cx.add_action(ProjectSearchBar::search); cx.add_action(ProjectSearchBar::search_in_new); cx.add_action(ProjectSearchBar::toggle_search_option); - cx.add_action(ProjectSearchBar::select_match); + cx.add_action(ProjectSearchBar::select_next_match); + cx.add_action(ProjectSearchBar::select_prev_match); cx.add_action(ProjectSearchBar::toggle_focus); cx.capture_action(ProjectSearchBar::tab); } @@ -545,18 +546,23 @@ impl ProjectSearchBar { } } - fn select_match( - pane: &mut Pane, - &SelectMatch(direction): &SelectMatch, - cx: &mut ViewContext, - ) { + fn select_next_match(pane: &mut Pane, _: &SelectNextMatch, cx: &mut ViewContext) { if let Some(search_view) = pane .active_item() .and_then(|item| item.downcast::()) { - search_view.update(cx, |search_view, cx| { - search_view.select_match(direction, cx); - }); + search_view.update(cx, |view, cx| view.select_match(Direction::Next, cx)); + } else { + cx.propagate_action(); + } + } + + fn select_prev_match(pane: &mut Pane, _: &SelectPrevMatch, cx: &mut ViewContext) { + if let Some(search_view) = pane + .active_item() + .and_then(|item| item.downcast::()) + { + search_view.update(cx, |view, cx| view.select_match(Direction::Prev, cx)); } else { cx.propagate_action(); } @@ -635,7 +641,10 @@ impl ProjectSearchBar { .with_style(style.container) .boxed() }) - .on_click(move |cx| cx.dispatch_action(SelectMatch(direction))) + .on_click(move |cx| match direction { + Direction::Prev => cx.dispatch_action(SelectPrevMatch), + Direction::Next => cx.dispatch_action(SelectNextMatch), + }) .with_cursor_style(CursorStyle::PointingHand) .boxed() } diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index 83e5a259d21630d99a6b72e432b1fbc8d1f12f33..48cf24b1f340f700b9e42b76952eff6e84463a76 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -1,6 +1,6 @@ pub use buffer_search::BufferSearchBar; use editor::{Anchor, MultiBufferSnapshot}; -use gpui::{impl_actions, MutableAppContext}; +use gpui::{actions, impl_internal_actions, MutableAppContext}; pub use project_search::{ProjectSearchBar, ProjectSearchView}; use std::{ cmp::{self, Ordering}, @@ -18,10 +18,8 @@ pub fn init(cx: &mut MutableAppContext) { #[derive(Clone)] pub struct ToggleSearchOption(pub SearchOption); -#[derive(Clone)] -pub struct SelectMatch(pub Direction); - -impl_actions!(search, [ToggleSearchOption, SelectMatch]); +actions!(search, [SelectNextMatch, SelectPrevMatch]); +impl_internal_actions!(search, [ToggleSearchOption]); #[derive(Clone, Copy)] pub enum SearchOption { diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index fe1a63f5f1aabb287b8a081744c9236612d44ff3..8aafcd6a30c38598fa942ab48387d17f671e5004 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -64,6 +64,7 @@ language = { path = "../language", features = ["test-support"] } lsp = { path = "../lsp", features = ["test-support"] } project = { path = "../project", features = ["test-support"] } settings = { path = "../settings", features = ["test-support"] } +theme = { path = "../theme" } workspace = { path = "../workspace", features = ["test-support"] } ctor = "0.1" env_logger = "0.8" diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index efa19653ae64748988bdf3c923159daa9f0535c4..5ebe36e8242bb5e2fe735e4701fd85f962b4c4da 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1117,6 +1117,7 @@ mod tests { }, time::Duration, }; + use theme::ThemeRegistry; use util::TryFutureExt; use workspace::{Item, SplitDirection, ToggleFollow, Workspace, WorkspaceParams}; @@ -5633,6 +5634,7 @@ mod tests { project: project.clone(), user_store: self.user_store.clone(), languages: self.language_registry.clone(), + themes: ThemeRegistry::new((), cx.font_cache().clone()), channel_list: cx.add_model(|cx| { ChannelList::new(self.user_store.clone(), self.client.clone(), cx) }), diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index b69552d02b9b834a54d093e417bde763cbd1038d..733df65b82a779a4d8b29f2c9ebc99d02268bb60 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,8 +1,8 @@ use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ + actions, elements::*, - impl_actions, keymap::{self, Binding}, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, @@ -25,15 +25,9 @@ pub struct ThemeSelector { selection_completed: bool, } -#[derive(Clone)] -pub struct Toggle(pub Arc); +actions!(theme_selector, [Toggle, Reload]); -#[derive(Clone)] -pub struct Reload(pub Arc); - -impl_actions!(theme_selector, [Toggle, Reload]); - -pub fn init(themes: Arc, cx: &mut MutableAppContext) { +pub fn init(cx: &mut MutableAppContext) { cx.add_action(ThemeSelector::confirm); cx.add_action(ThemeSelector::select_prev); cx.add_action(ThemeSelector::select_next); @@ -41,9 +35,9 @@ pub fn init(themes: Arc, cx: &mut MutableAppContext) { cx.add_action(ThemeSelector::reload); cx.add_bindings(vec![ - Binding::new("cmd-k cmd-t", Toggle(themes.clone()), None), - Binding::new("cmd-k t", Reload(themes.clone()), None), - Binding::new("escape", Toggle(themes.clone()), Some("ThemeSelector")), + Binding::new("cmd-k cmd-t", Toggle, None), + Binding::new("cmd-k t", Reload, None), + Binding::new("escape", Toggle, Some("ThemeSelector")), ]); } @@ -79,18 +73,20 @@ impl ThemeSelector { this } - fn toggle(workspace: &mut Workspace, action: &Toggle, cx: &mut ViewContext) { + fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { + let themes = workspace.themes(); workspace.toggle_modal(cx, |cx, _| { - let selector = cx.add_view(|cx| Self::new(action.0.clone(), cx)); + let selector = cx.add_view(|cx| Self::new(themes, cx)); cx.subscribe(&selector, Self::on_event).detach(); selector }); } - fn reload(_: &mut Workspace, action: &Reload, cx: &mut ViewContext) { + fn reload(workspace: &mut Workspace, _: &Reload, cx: &mut ViewContext) { let current_theme_name = cx.global::().theme.name.clone(); - action.0.clear(); - match action.0.get(¤t_theme_name) { + let themes = workspace.themes(); + themes.clear(); + match themes.get(¤t_theme_name) { Ok(theme) => { Self::set_theme(theme, cx); log::info!("reloaded theme {}", current_theme_name); diff --git a/crates/vim/Cargo.toml b/crates/vim/Cargo.toml index 4ffa6a4363c5e08e17899db49d20a46a568dcca9..f1413d7c517eb95a84ec7c8aed77b88223b4a674 100644 --- a/crates/vim/Cargo.toml +++ b/crates/vim/Cargo.toml @@ -12,6 +12,7 @@ collections = { path = "../collections" } editor = { path = "../editor" } gpui = { path = "../gpui" } language = { path = "../language" } +serde = { version = "1", features = ["derive"] } settings = { path = "../settings" } workspace = { path = "../workspace" } log = "0.4" diff --git a/crates/vim/src/mode.rs b/crates/vim/src/mode.rs index f00c14e2e84dbfa0c37ab939fafbb6cade81d511..ccebf0ad68ed7cad0f8d0c4828a5610fe8dbfd0f 100644 --- a/crates/vim/src/mode.rs +++ b/crates/vim/src/mode.rs @@ -1,7 +1,8 @@ use editor::CursorShape; use gpui::keymap::Context; +use serde::Deserialize; -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)] pub enum Mode { Normal(NormalState), Insert, @@ -44,7 +45,7 @@ impl Default for Mode { } } -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)] pub enum NormalState { None, GPrefix, diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index ce5305e8bf5a2ff5097cf58c09d309e6ed9eb00d..0a49d2c8fd9a0be6b6c0f68be14faae04a4596be 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -4,15 +4,16 @@ use crate::{mode::NormalState, Mode, SwitchMode, VimState}; use editor::{char_kind, movement, Bias}; use gpui::{actions, impl_actions, keymap::Binding, MutableAppContext, ViewContext}; use language::SelectionGoal; +use serde::Deserialize; use workspace::Workspace; -#[derive(Clone)] +#[derive(Clone, Deserialize)] struct MoveToNextWordStart(pub bool); -#[derive(Clone)] +#[derive(Clone, Deserialize)] struct MoveToNextWordEnd(pub bool); -#[derive(Clone)] +#[derive(Clone, Deserialize)] struct MoveToPreviousWordStart(pub bool); impl_actions!( diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 2d76831076f36c78bab6b51e4205095a646e9bde..adcf2fb130a61a137c9226b809daccdec60b381e 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -8,12 +8,13 @@ mod vim_test_context; use collections::HashMap; use editor::{CursorShape, Editor}; use gpui::{impl_actions, MutableAppContext, ViewContext, WeakViewHandle}; +use serde::Deserialize; use mode::Mode; use settings::Settings; use workspace::{self, Workspace}; -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct SwitchMode(pub Mode); impl_actions!(vim, [SwitchMode]); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 6459e46fcad9335f67cbc21c846ea0bda6106aca..a60e2ff9db038f0f8fc74a752c966957ec5abe95 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -7,13 +7,14 @@ use gpui::{ actions, elements::*, geometry::{rect::RectF, vector::vec2f}, - impl_actions, + impl_actions, impl_internal_actions, keymap::Binding, platform::{CursorStyle, NavigationDirection}, AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; use project::{ProjectEntryId, ProjectPath}; +use serde::Deserialize; use settings::Settings; use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc}; use util::ResultExt; @@ -28,13 +29,16 @@ actions!( ] ); -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct Split(pub SplitDirection); #[derive(Clone)] -pub struct CloseItem(pub CloseItemParams); +pub struct CloseItem { + pub item_id: usize, + pub pane: WeakViewHandle, +} -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct ActivateItem(pub usize); #[derive(Clone)] @@ -43,13 +47,8 @@ pub struct GoBack(pub Option>); #[derive(Clone)] pub struct GoForward(pub Option>); -impl_actions!(pane, [Split, CloseItem, ActivateItem, GoBack, GoForward,]); - -#[derive(Clone)] -pub struct CloseItemParams { - pub item_id: usize, - pub pane: WeakViewHandle, -} +impl_actions!(pane, [Split]); +impl_internal_actions!(pane, [CloseItem, ActivateItem, GoBack, GoForward]); const MAX_NAVIGATION_HISTORY_LEN: usize = 1024; @@ -66,8 +65,8 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_async_action(Pane::close_active_item); cx.add_async_action(Pane::close_inactive_items); cx.add_async_action(|workspace: &mut Workspace, action: &CloseItem, cx| { - let pane = action.0.pane.upgrade(cx)?; - Some(Pane::close_item(workspace, pane, action.0.item_id, cx)) + let pane = action.pane.upgrade(cx)?; + Some(Pane::close_item(workspace, pane, action.item_id, cx)) }); cx.add_action(|pane: &mut Pane, action: &Split, cx| { pane.split(action.0, cx); @@ -747,10 +746,10 @@ impl Pane { .on_click({ let pane = pane.clone(); move |cx| { - cx.dispatch_action(CloseItem(CloseItemParams { + cx.dispatch_action(CloseItem { item_id, pane: pane.clone(), - })) + }) } }) .named("close-tab-icon") diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rs index 258d64414864c2c217b36f9fccdcb82b58cb1fd8..d5661ba2c9342fe92066b91503fc422ed48bbf96 100644 --- a/crates/workspace/src/pane_group.rs +++ b/crates/workspace/src/pane_group.rs @@ -4,6 +4,7 @@ use client::PeerId; use collections::HashMap; use gpui::{elements::*, Axis, Border, ViewHandle}; use project::Collaborator; +use serde::Deserialize; use theme::Theme; #[derive(Clone, Debug, Eq, PartialEq)] @@ -254,7 +255,8 @@ impl PaneAxis { } } -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum SplitDirection { Up, Down, diff --git a/crates/workspace/src/sidebar.rs b/crates/workspace/src/sidebar.rs index 49852d16f22a70a28140857085b6e1bd9832991f..78b1d4a6ea1224c59a4e127d27823ac87330a603 100644 --- a/crates/workspace/src/sidebar.rs +++ b/crates/workspace/src/sidebar.rs @@ -1,5 +1,7 @@ use super::Workspace; -use gpui::{elements::*, impl_actions, platform::CursorStyle, AnyViewHandle, RenderContext}; +use gpui::{ + elements::*, impl_internal_actions, platform::CursorStyle, AnyViewHandle, RenderContext, +}; use std::{cell::RefCell, rc::Rc}; use theme::Theme; @@ -27,7 +29,7 @@ pub struct ToggleSidebarItem(pub SidebarItemId); #[derive(Clone)] pub struct ToggleSidebarItemFocus(pub SidebarItemId); -impl_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]); +impl_internal_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]); #[derive(Clone)] pub struct SidebarItemId { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 6b6761b1f705c20672dc333dfa05d0499b34b9c7..475913d9dbbf6ad51bfdcf7baa86ddf0bbe10dfd 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -17,7 +17,7 @@ use gpui::{ color::Color, elements::*, geometry::{rect::RectF, vector::vec2f, PathBuilder}, - impl_actions, + impl_internal_actions, json::{self, to_string_pretty, ToJson}, keymap::Binding, platform::{CursorStyle, WindowOptions}, @@ -101,7 +101,7 @@ pub struct ToggleFollow(pub PeerId); #[derive(Clone)] pub struct JoinProject(pub JoinProjectParams); -impl_actions!( +impl_internal_actions!( workspace, [Open, OpenNew, OpenPaths, ToggleFollow, JoinProject] ); @@ -630,6 +630,7 @@ pub struct WorkspaceParams { pub client: Arc, pub fs: Arc, pub languages: Arc, + pub themes: Arc, pub user_store: ModelHandle, pub channel_list: ModelHandle, } @@ -659,6 +660,7 @@ impl WorkspaceParams { channel_list: cx .add_model(|cx| ChannelList::new(user_store.clone(), client.clone(), cx)), client, + themes: ThemeRegistry::new((), cx.font_cache().clone()), fs, languages, user_store, @@ -677,6 +679,7 @@ impl WorkspaceParams { ), client: app_state.client.clone(), fs: app_state.fs.clone(), + themes: app_state.themes.clone(), languages: app_state.languages.clone(), user_store: app_state.user_store.clone(), channel_list: app_state.channel_list.clone(), @@ -694,6 +697,7 @@ pub struct Workspace { user_store: ModelHandle, remote_entity_subscription: Option, fs: Arc, + themes: Arc, modal: Option, center: PaneGroup, left_sidebar: Sidebar, @@ -802,6 +806,7 @@ impl Workspace { remote_entity_subscription: None, user_store: params.user_store.clone(), fs: params.fs.clone(), + themes: params.themes.clone(), left_sidebar: Sidebar::new(Side::Left), right_sidebar: Sidebar::new(Side::Right), project: params.project.clone(), @@ -834,6 +839,10 @@ impl Workspace { &self.project } + pub fn themes(&self) -> Arc { + self.themes.clone() + } + pub fn worktrees<'a>( &self, cx: &'a AppContext, diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 8633005899f5e5e0d1405748b56dad4ecc790cdf..abdf68e6ab367a204e641e9fd5abdc3354e074be 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -146,7 +146,7 @@ fn main() { }); journal::init(app_state.clone(), cx); zed::init(&app_state, cx); - theme_selector::init(app_state.themes.clone(), cx); + theme_selector::init(cx); cx.set_menus(menus::menus(&app_state.clone())); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 6fca5247fcc3c4623f106a3e899214404fdb1cfa..6465c9b2531b11c603219de46cddb8534ae5a476 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -14,7 +14,6 @@ pub use editor; use gpui::{ actions, geometry::vector::vec2f, - impl_actions, keymap::Binding, platform::{WindowBounds, WindowOptions}, ModelHandle, ViewContext, @@ -30,12 +29,16 @@ use std::{path::PathBuf, sync::Arc}; pub use workspace; use workspace::{AppState, Workspace, WorkspaceParams}; -actions!(zed, [About, Quit, OpenSettings]); - -#[derive(Clone)] -pub struct AdjustBufferFontSize(pub f32); - -impl_actions!(zed, [AdjustBufferFontSize]); +actions!( + zed, + [ + About, + Quit, + OpenSettings, + IncreaseBufferFontSize, + DecreaseBufferFontSize + ] +); const MIN_FONT_SIZE: f32 = 6.0; @@ -48,16 +51,18 @@ lazy_static! { pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { cx.add_global_action(quit); - cx.add_global_action({ - move |action: &AdjustBufferFontSize, cx| { - cx.update_global::(|settings, cx| { - settings.buffer_font_size = - (settings.buffer_font_size + action.0).max(MIN_FONT_SIZE); - cx.refresh_windows(); - }); - } + cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| { + cx.update_global::(|settings, cx| { + settings.buffer_font_size = (settings.buffer_font_size + 1.0).max(MIN_FONT_SIZE); + cx.refresh_windows(); + }); + }); + cx.add_global_action(move |_: &DecreaseBufferFontSize, cx| { + cx.update_global::(|settings, cx| { + settings.buffer_font_size = (settings.buffer_font_size - 1.0).max(MIN_FONT_SIZE); + cx.refresh_windows(); + }); }); - cx.add_action({ let app_state = app_state.clone(); move |_: &mut Workspace, _: &OpenSettings, cx: &mut ViewContext| { @@ -100,8 +105,8 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); cx.add_bindings(vec![ - Binding::new("cmd-=", AdjustBufferFontSize(1.), None), - Binding::new("cmd--", AdjustBufferFontSize(-1.), None), + Binding::new("cmd-=", IncreaseBufferFontSize, None), + Binding::new("cmd--", DecreaseBufferFontSize, None), Binding::new("cmd-,", OpenSettings, None), ]) } @@ -134,6 +139,7 @@ pub fn build_workspace( client: app_state.client.clone(), fs: app_state.fs.clone(), languages: app_state.languages.clone(), + themes: app_state.themes.clone(), user_store: app_state.user_store.clone(), channel_list: app_state.channel_list.clone(), }; From 56fcffb6345157b6ebd2be73cf3fa2cbc2888f3b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 9 Apr 2022 07:55:23 -0600 Subject: [PATCH 126/245] Remove unused imports --- crates/settings/src/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 98733e6920c56284da82ec645311d3d8be07a487..622d73e663f3015efb5a731d754b102b8f6f4abe 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -9,7 +9,7 @@ use schemars::{ }; use serde::Deserialize; use serde_json::Value; -use std::{collections::HashMap, fmt::Display, os::unix::fs::chroot, sync::Arc}; +use std::{collections::HashMap, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; From ab8204368c291b690c87c0e2ef377145e51d1e77 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 9 Apr 2022 08:30:42 -0600 Subject: [PATCH 127/245] Rename zed-server to collab Over time, I think we may end up having multiple services, so it seems like a good opportunity to name this one more specifically while the cost is low. It just seems like naming it "zed" and "zed-server" leaves it a bit open ended. --- .gitignore | 4 +- Cargo.lock | 106 +++++++++--------- Dockerfile | 14 +-- Dockerfile.migrator | 2 +- Procfile | 2 +- README.md | 2 +- crates/{server => collab}/.env.template.toml | 0 crates/{server => collab}/Cargo.toml | 6 +- crates/{server => collab}/Procfile | 2 +- crates/{server => collab}/README.md | 0 crates/{server => collab}/basic.conf | 0 crates/{server => collab}/favicon.ico | Bin .../k8s/environments/production.sh | 0 .../k8s/environments/staging.sh | 0 .../k8s/manifest.template.yml | 0 .../k8s/migrate.template.yml | 0 .../20210527024318_initial_schema.sql | 0 .../20210607190313_create_access_tokens.sql | 0 .../20210805175147_create_chat_tables.sql | 0 ...16123647_add_nonce_to_channel_messages.sql | 0 ...0210920192001_add_interests_to_signups.sql | 0 crates/{server => collab}/src/admin.rs | 0 crates/{server => collab}/src/api.rs | 0 crates/{server => collab}/src/assets.rs | 0 crates/{server => collab}/src/auth.rs | 0 crates/{server => collab}/src/bin/dotenv.rs | 0 crates/{server => collab}/src/bin/seed.rs | 0 crates/{server => collab}/src/careers.rs | 0 crates/{server => collab}/src/community.rs | 0 crates/{server => collab}/src/db.rs | 0 crates/{server => collab}/src/env.rs | 0 crates/{server => collab}/src/errors.rs | 0 crates/{server => collab}/src/expiring.rs | 0 crates/{server => collab}/src/github.rs | 0 crates/{server => collab}/src/home.rs | 0 crates/{server => collab}/src/main.rs | 0 crates/{server => collab}/src/releases.rs | 0 crates/{server => collab}/src/rpc.rs | 0 crates/{server => collab}/src/rpc/store.rs | 0 crates/{server => collab}/src/team.rs | 0 .../static/browserconfig.xml | 0 .../static/fonts/VisbyCF-Bold.eot | Bin .../static/fonts/VisbyCF-Bold.woff | Bin .../static/fonts/VisbyCF-Bold.woff2 | Bin .../static/fonts/VisbyCF-BoldOblique.eot | Bin .../static/fonts/VisbyCF-BoldOblique.woff | Bin .../static/fonts/VisbyCF-BoldOblique.woff2 | Bin .../static/fonts/VisbyCF-DemiBold.eot | Bin .../static/fonts/VisbyCF-DemiBold.woff | Bin .../static/fonts/VisbyCF-DemiBold.woff2 | Bin .../static/fonts/VisbyCF-DemiBoldOblique.eot | Bin .../static/fonts/VisbyCF-DemiBoldOblique.woff | Bin .../fonts/VisbyCF-DemiBoldOblique.woff2 | Bin .../static/fonts/VisbyCF-ExtraBold.eot | Bin .../static/fonts/VisbyCF-ExtraBold.woff | Bin .../static/fonts/VisbyCF-ExtraBold.woff2 | Bin .../static/fonts/VisbyCF-ExtraBoldOblique.eot | Bin .../fonts/VisbyCF-ExtraBoldOblique.woff | Bin .../fonts/VisbyCF-ExtraBoldOblique.woff2 | Bin .../static/fonts/VisbyCF-Heavy.eot | Bin .../static/fonts/VisbyCF-Heavy.woff | Bin .../static/fonts/VisbyCF-Heavy.woff2 | Bin .../static/fonts/VisbyCF-HeavyOblique.eot | Bin .../static/fonts/VisbyCF-HeavyOblique.woff | Bin .../static/fonts/VisbyCF-HeavyOblique.woff2 | Bin .../static/fonts/VisbyCF-Light.eot | Bin .../static/fonts/VisbyCF-Light.woff | Bin .../static/fonts/VisbyCF-Light.woff2 | Bin .../static/fonts/VisbyCF-LightOblique.eot | Bin .../static/fonts/VisbyCF-LightOblique.woff | Bin .../static/fonts/VisbyCF-LightOblique.woff2 | Bin .../static/fonts/VisbyCF-Medium.eot | Bin .../static/fonts/VisbyCF-Medium.woff | Bin .../static/fonts/VisbyCF-Medium.woff2 | Bin .../static/fonts/VisbyCF-MediumOblique.eot | Bin .../static/fonts/VisbyCF-MediumOblique.woff | Bin .../static/fonts/VisbyCF-MediumOblique.woff2 | Bin .../static/fonts/VisbyCF-Regular.eot | Bin .../static/fonts/VisbyCF-Regular.woff | Bin .../static/fonts/VisbyCF-Regular.woff2 | Bin .../static/fonts/VisbyCF-RegularOblique.eot | Bin .../static/fonts/VisbyCF-RegularOblique.woff | Bin .../static/fonts/VisbyCF-RegularOblique.woff2 | Bin .../static/fonts/VisbyCF-Thin.eot | Bin .../static/fonts/VisbyCF-Thin.woff | Bin .../static/fonts/VisbyCF-Thin.woff2 | Bin .../static/fonts/VisbyCF-ThinOblique.eot | Bin .../static/fonts/VisbyCF-ThinOblique.woff | Bin .../static/fonts/VisbyCF-ThinOblique.woff2 | Bin .../static/images/android-chrome-192x192.png | Bin .../static/images/android-chrome-512x512.png | Bin .../static/images/apple-touch-icon.png | Bin .../static/images/favicon-16x16.png | Bin .../static/images/favicon-32x32.png | Bin .../static/images/favicon.png | Bin .../static/images/favicon.svg | 0 .../static/images/mstile-144x144.png | Bin .../static/images/mstile-150x150.png | Bin .../static/images/mstile-310x150.png | Bin .../static/images/mstile-310x310.png | Bin .../static/images/mstile-70x70.png | Bin .../static/images/safari-pinned-tab.svg | 0 .../static/images/zed-og-image.png | Bin .../static/images/zed-twitter-image.png | Bin crates/{server => collab}/static/prism.js | 0 crates/{server => collab}/static/prose.css | 0 .../{server => collab}/static/prose.css.map | 0 crates/{server => collab}/static/prose.scss | 0 .../static/site.webmanifest | 0 crates/{server => collab}/static/svg/hero.svg | 0 crates/{server => collab}/styles.css | 0 crates/{server => collab}/templates/admin.hbs | 0 .../{server => collab}/templates/careers.hbs | 0 .../templates/community.hbs | 0 crates/{server => collab}/templates/docs.hbs | 0 crates/{server => collab}/templates/error.hbs | 0 crates/{server => collab}/templates/home.hbs | 0 .../templates/partials/layout.hbs | 0 .../{server => collab}/templates/releases.hbs | 0 .../{server => collab}/templates/signup.hbs | 0 crates/{server => collab}/templates/team.hbs | 0 crates/server/.env.toml | 42 ------- script/deploy | 2 +- script/seed-db | 2 +- 124 files changed, 71 insertions(+), 113 deletions(-) rename crates/{server => collab}/.env.template.toml (100%) rename crates/{server => collab}/Cargo.toml (96%) rename crates/{server => collab}/Procfile (56%) rename crates/{server => collab}/README.md (100%) rename crates/{server => collab}/basic.conf (100%) rename crates/{server => collab}/favicon.ico (100%) rename crates/{server => collab}/k8s/environments/production.sh (100%) rename crates/{server => collab}/k8s/environments/staging.sh (100%) rename crates/{server => collab}/k8s/manifest.template.yml (100%) rename crates/{server => collab}/k8s/migrate.template.yml (100%) rename crates/{server => collab}/migrations/20210527024318_initial_schema.sql (100%) rename crates/{server => collab}/migrations/20210607190313_create_access_tokens.sql (100%) rename crates/{server => collab}/migrations/20210805175147_create_chat_tables.sql (100%) rename crates/{server => collab}/migrations/20210916123647_add_nonce_to_channel_messages.sql (100%) rename crates/{server => collab}/migrations/20210920192001_add_interests_to_signups.sql (100%) rename crates/{server => collab}/src/admin.rs (100%) rename crates/{server => collab}/src/api.rs (100%) rename crates/{server => collab}/src/assets.rs (100%) rename crates/{server => collab}/src/auth.rs (100%) rename crates/{server => collab}/src/bin/dotenv.rs (100%) rename crates/{server => collab}/src/bin/seed.rs (100%) rename crates/{server => collab}/src/careers.rs (100%) rename crates/{server => collab}/src/community.rs (100%) rename crates/{server => collab}/src/db.rs (100%) rename crates/{server => collab}/src/env.rs (100%) rename crates/{server => collab}/src/errors.rs (100%) rename crates/{server => collab}/src/expiring.rs (100%) rename crates/{server => collab}/src/github.rs (100%) rename crates/{server => collab}/src/home.rs (100%) rename crates/{server => collab}/src/main.rs (100%) rename crates/{server => collab}/src/releases.rs (100%) rename crates/{server => collab}/src/rpc.rs (100%) rename crates/{server => collab}/src/rpc/store.rs (100%) rename crates/{server => collab}/src/team.rs (100%) rename crates/{server => collab}/static/browserconfig.xml (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Bold.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Bold.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Bold.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-BoldOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-BoldOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-BoldOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBold.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBold.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBold.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBoldOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBoldOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-DemiBoldOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBold.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBold.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBold.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBoldOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBoldOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ExtraBoldOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Heavy.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Heavy.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Heavy.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-HeavyOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-HeavyOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-HeavyOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Light.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Light.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Light.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-LightOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-LightOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-LightOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Medium.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Medium.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Medium.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-MediumOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-MediumOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-MediumOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Regular.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Regular.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Regular.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-RegularOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-RegularOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-RegularOblique.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Thin.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Thin.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-Thin.woff2 (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ThinOblique.eot (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ThinOblique.woff (100%) rename crates/{server => collab}/static/fonts/VisbyCF-ThinOblique.woff2 (100%) rename crates/{server => collab}/static/images/android-chrome-192x192.png (100%) rename crates/{server => collab}/static/images/android-chrome-512x512.png (100%) rename crates/{server => collab}/static/images/apple-touch-icon.png (100%) rename crates/{server => collab}/static/images/favicon-16x16.png (100%) rename crates/{server => collab}/static/images/favicon-32x32.png (100%) rename crates/{server => collab}/static/images/favicon.png (100%) rename crates/{server => collab}/static/images/favicon.svg (100%) rename crates/{server => collab}/static/images/mstile-144x144.png (100%) rename crates/{server => collab}/static/images/mstile-150x150.png (100%) rename crates/{server => collab}/static/images/mstile-310x150.png (100%) rename crates/{server => collab}/static/images/mstile-310x310.png (100%) rename crates/{server => collab}/static/images/mstile-70x70.png (100%) rename crates/{server => collab}/static/images/safari-pinned-tab.svg (100%) rename crates/{server => collab}/static/images/zed-og-image.png (100%) rename crates/{server => collab}/static/images/zed-twitter-image.png (100%) rename crates/{server => collab}/static/prism.js (100%) rename crates/{server => collab}/static/prose.css (100%) rename crates/{server => collab}/static/prose.css.map (100%) rename crates/{server => collab}/static/prose.scss (100%) rename crates/{server => collab}/static/site.webmanifest (100%) rename crates/{server => collab}/static/svg/hero.svg (100%) rename crates/{server => collab}/styles.css (100%) rename crates/{server => collab}/templates/admin.hbs (100%) rename crates/{server => collab}/templates/careers.hbs (100%) rename crates/{server => collab}/templates/community.hbs (100%) rename crates/{server => collab}/templates/docs.hbs (100%) rename crates/{server => collab}/templates/error.hbs (100%) rename crates/{server => collab}/templates/home.hbs (100%) rename crates/{server => collab}/templates/partials/layout.hbs (100%) rename crates/{server => collab}/templates/releases.hbs (100%) rename crates/{server => collab}/templates/signup.hbs (100%) rename crates/{server => collab}/templates/team.hbs (100%) delete mode 100644 crates/server/.env.toml diff --git a/.gitignore b/.gitignore index 140053fc2c507f788748b43136b1eaa5c52680da..a733bb3bb7ae5989e360381895664529dbef861d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ .DS_Store /script/node_modules /styles/node_modules -/crates/server/.env.toml -/crates/server/static/styles.css +/crates/collab/.env.toml +/crates/collab/static/styles.css /vendor/bin diff --git a/Cargo.lock b/Cargo.lock index 92aaa62c6eb128fc45862c606e750f8297c604e8..7e74f4c964228026f8b5db6ea79a992b666dc08b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1067,6 +1067,59 @@ dependencies = [ "objc", ] +[[package]] +name = "collab" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-io", + "async-sqlx-session", + "async-std", + "async-trait", + "async-tungstenite", + "base64 0.13.0", + "clap 3.0.0-beta.2", + "client", + "collections", + "comrak", + "ctor", + "editor", + "either", + "env_logger 0.8.3", + "envy", + "futures", + "gpui", + "handlebars", + "http-auth-basic", + "json_env_logger", + "jwt-simple", + "language", + "lazy_static", + "lipsum", + "log", + "lsp", + "oauth2", + "oauth2-surf", + "parking_lot", + "project", + "rand 0.8.3", + "rpc", + "rust-embed", + "scrypt", + "serde", + "serde_json", + "settings", + "sha-1 0.9.6", + "sqlx 0.5.5", + "surf", + "tide", + "tide-compress", + "time 0.2.27", + "toml", + "util", + "workspace", +] + [[package]] name = "collections" version = "0.1.0" @@ -6136,59 +6189,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "zed-server" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-io", - "async-sqlx-session", - "async-std", - "async-trait", - "async-tungstenite", - "base64 0.13.0", - "clap 3.0.0-beta.2", - "client", - "collections", - "comrak", - "ctor", - "editor", - "either", - "env_logger 0.8.3", - "envy", - "futures", - "gpui", - "handlebars", - "http-auth-basic", - "json_env_logger", - "jwt-simple", - "language", - "lazy_static", - "lipsum", - "log", - "lsp", - "oauth2", - "oauth2-surf", - "parking_lot", - "project", - "rand 0.8.3", - "rpc", - "rust-embed", - "scrypt", - "serde", - "serde_json", - "settings", - "sha-1 0.9.6", - "sqlx 0.5.5", - "surf", - "tide", - "tide-compress", - "time 0.2.27", - "toml", - "util", - "workspace", -] - [[package]] name = "zeroize" version = "1.3.0" diff --git a/Dockerfile b/Dockerfile index af4365649f83b7bfdc881a7496e5051a2a941b97..544d9eae86f56b3afe08e653126fafb3c305ae83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,20 +14,20 @@ RUN --mount=type=cache,target=./script/node_modules \ RUN --mount=type=cache,target=./script/node_modules \ script/build-css --release -# Compile server +# Compile collab server RUN --mount=type=cache,target=./script/node_modules \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=./target \ - cargo build --release --package zed-server --bin zed-server + cargo build --release --package collab --bin collab -# Copy server binary out of cached directory +# Copy collab server binary out of cached directory RUN --mount=type=cache,target=./target \ - cp /app/target/release/zed-server /app/zed-server + cp /app/target/release/collab /app/collab -# Copy server binary to the runtime image +# Copy collab server binary to the runtime image FROM debian:bullseye-slim as runtime RUN apt-get update; \ apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates WORKDIR app -COPY --from=builder /app/zed-server /app -ENTRYPOINT ["/app/zed-server"] +COPY --from=builder /app/collab /app +ENTRYPOINT ["/app/collab"] diff --git a/Dockerfile.migrator b/Dockerfile.migrator index 1b7a0adf3a898cfb460a5e623e3b07be8529962e..72e4e41d275580ed5472ee579b730f46c042a621 100644 --- a/Dockerfile.migrator +++ b/Dockerfile.migrator @@ -11,5 +11,5 @@ RUN apt-get update; \ apt-get install -y --no-install-recommends libssl1.1 WORKDIR app COPY --from=builder /app/bin/sqlx /app -COPY ./server/migrations /app/migrations +COPY ./collab/migrations /app/migrations ENTRYPOINT ["/app/sqlx", "migrate", "run"] diff --git a/Procfile b/Procfile index 08bff5acc2723aea8bc50fcb0071fe56126c512a..a64b411ef3224a8b6bbf4596bff109b125462bf4 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: cd ../zed.dev && PORT=3000 npx next dev -collab: cd crates/server && cargo run +collab: cd crates/collab && cargo run diff --git a/README.md b/README.md index c380115100ef99fffb65987f637715b65d1a2427..1bac43b694c04f8965c4694da5e7b0dd7d80c2c3 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ script/sqlx migrate run script/seed-db ``` -Run `zed.dev` and the collaboration server. +Run the web frontend and the collaboration server. ``` brew install foreman diff --git a/crates/server/.env.template.toml b/crates/collab/.env.template.toml similarity index 100% rename from crates/server/.env.template.toml rename to crates/collab/.env.template.toml diff --git a/crates/server/Cargo.toml b/crates/collab/Cargo.toml similarity index 96% rename from crates/server/Cargo.toml rename to crates/collab/Cargo.toml index e0834b76c5ecb1c518e918a70af78824685e6f42..96df2ae4eccd45851f1da40ff42ea838ef5c2a56 100644 --- a/crates/server/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -1,12 +1,12 @@ [package] authors = ["Nathan Sobo "] -default-run = "zed-server" +default-run = "collab" edition = "2021" -name = "zed-server" +name = "collab" version = "0.1.0" [[bin]] -name = "zed-server" +name = "collab" [[bin]] name = "seed" diff --git a/crates/server/Procfile b/crates/collab/Procfile similarity index 56% rename from crates/server/Procfile rename to crates/collab/Procfile index 74cb9a094b3ed89dcc70c67294553ac571866b8f..ef8914fcc07362cf129c74de1b756e66ec426e8d 100644 --- a/crates/server/Procfile +++ b/crates/collab/Procfile @@ -1,2 +1,2 @@ -web: ./target/release/zed-server +collab: ./target/release/collab release: ./target/release/sqlx migrate run diff --git a/crates/server/README.md b/crates/collab/README.md similarity index 100% rename from crates/server/README.md rename to crates/collab/README.md diff --git a/crates/server/basic.conf b/crates/collab/basic.conf similarity index 100% rename from crates/server/basic.conf rename to crates/collab/basic.conf diff --git a/crates/server/favicon.ico b/crates/collab/favicon.ico similarity index 100% rename from crates/server/favicon.ico rename to crates/collab/favicon.ico diff --git a/crates/server/k8s/environments/production.sh b/crates/collab/k8s/environments/production.sh similarity index 100% rename from crates/server/k8s/environments/production.sh rename to crates/collab/k8s/environments/production.sh diff --git a/crates/server/k8s/environments/staging.sh b/crates/collab/k8s/environments/staging.sh similarity index 100% rename from crates/server/k8s/environments/staging.sh rename to crates/collab/k8s/environments/staging.sh diff --git a/crates/server/k8s/manifest.template.yml b/crates/collab/k8s/manifest.template.yml similarity index 100% rename from crates/server/k8s/manifest.template.yml rename to crates/collab/k8s/manifest.template.yml diff --git a/crates/server/k8s/migrate.template.yml b/crates/collab/k8s/migrate.template.yml similarity index 100% rename from crates/server/k8s/migrate.template.yml rename to crates/collab/k8s/migrate.template.yml diff --git a/crates/server/migrations/20210527024318_initial_schema.sql b/crates/collab/migrations/20210527024318_initial_schema.sql similarity index 100% rename from crates/server/migrations/20210527024318_initial_schema.sql rename to crates/collab/migrations/20210527024318_initial_schema.sql diff --git a/crates/server/migrations/20210607190313_create_access_tokens.sql b/crates/collab/migrations/20210607190313_create_access_tokens.sql similarity index 100% rename from crates/server/migrations/20210607190313_create_access_tokens.sql rename to crates/collab/migrations/20210607190313_create_access_tokens.sql diff --git a/crates/server/migrations/20210805175147_create_chat_tables.sql b/crates/collab/migrations/20210805175147_create_chat_tables.sql similarity index 100% rename from crates/server/migrations/20210805175147_create_chat_tables.sql rename to crates/collab/migrations/20210805175147_create_chat_tables.sql diff --git a/crates/server/migrations/20210916123647_add_nonce_to_channel_messages.sql b/crates/collab/migrations/20210916123647_add_nonce_to_channel_messages.sql similarity index 100% rename from crates/server/migrations/20210916123647_add_nonce_to_channel_messages.sql rename to crates/collab/migrations/20210916123647_add_nonce_to_channel_messages.sql diff --git a/crates/server/migrations/20210920192001_add_interests_to_signups.sql b/crates/collab/migrations/20210920192001_add_interests_to_signups.sql similarity index 100% rename from crates/server/migrations/20210920192001_add_interests_to_signups.sql rename to crates/collab/migrations/20210920192001_add_interests_to_signups.sql diff --git a/crates/server/src/admin.rs b/crates/collab/src/admin.rs similarity index 100% rename from crates/server/src/admin.rs rename to crates/collab/src/admin.rs diff --git a/crates/server/src/api.rs b/crates/collab/src/api.rs similarity index 100% rename from crates/server/src/api.rs rename to crates/collab/src/api.rs diff --git a/crates/server/src/assets.rs b/crates/collab/src/assets.rs similarity index 100% rename from crates/server/src/assets.rs rename to crates/collab/src/assets.rs diff --git a/crates/server/src/auth.rs b/crates/collab/src/auth.rs similarity index 100% rename from crates/server/src/auth.rs rename to crates/collab/src/auth.rs diff --git a/crates/server/src/bin/dotenv.rs b/crates/collab/src/bin/dotenv.rs similarity index 100% rename from crates/server/src/bin/dotenv.rs rename to crates/collab/src/bin/dotenv.rs diff --git a/crates/server/src/bin/seed.rs b/crates/collab/src/bin/seed.rs similarity index 100% rename from crates/server/src/bin/seed.rs rename to crates/collab/src/bin/seed.rs diff --git a/crates/server/src/careers.rs b/crates/collab/src/careers.rs similarity index 100% rename from crates/server/src/careers.rs rename to crates/collab/src/careers.rs diff --git a/crates/server/src/community.rs b/crates/collab/src/community.rs similarity index 100% rename from crates/server/src/community.rs rename to crates/collab/src/community.rs diff --git a/crates/server/src/db.rs b/crates/collab/src/db.rs similarity index 100% rename from crates/server/src/db.rs rename to crates/collab/src/db.rs diff --git a/crates/server/src/env.rs b/crates/collab/src/env.rs similarity index 100% rename from crates/server/src/env.rs rename to crates/collab/src/env.rs diff --git a/crates/server/src/errors.rs b/crates/collab/src/errors.rs similarity index 100% rename from crates/server/src/errors.rs rename to crates/collab/src/errors.rs diff --git a/crates/server/src/expiring.rs b/crates/collab/src/expiring.rs similarity index 100% rename from crates/server/src/expiring.rs rename to crates/collab/src/expiring.rs diff --git a/crates/server/src/github.rs b/crates/collab/src/github.rs similarity index 100% rename from crates/server/src/github.rs rename to crates/collab/src/github.rs diff --git a/crates/server/src/home.rs b/crates/collab/src/home.rs similarity index 100% rename from crates/server/src/home.rs rename to crates/collab/src/home.rs diff --git a/crates/server/src/main.rs b/crates/collab/src/main.rs similarity index 100% rename from crates/server/src/main.rs rename to crates/collab/src/main.rs diff --git a/crates/server/src/releases.rs b/crates/collab/src/releases.rs similarity index 100% rename from crates/server/src/releases.rs rename to crates/collab/src/releases.rs diff --git a/crates/server/src/rpc.rs b/crates/collab/src/rpc.rs similarity index 100% rename from crates/server/src/rpc.rs rename to crates/collab/src/rpc.rs diff --git a/crates/server/src/rpc/store.rs b/crates/collab/src/rpc/store.rs similarity index 100% rename from crates/server/src/rpc/store.rs rename to crates/collab/src/rpc/store.rs diff --git a/crates/server/src/team.rs b/crates/collab/src/team.rs similarity index 100% rename from crates/server/src/team.rs rename to crates/collab/src/team.rs diff --git a/crates/server/static/browserconfig.xml b/crates/collab/static/browserconfig.xml similarity index 100% rename from crates/server/static/browserconfig.xml rename to crates/collab/static/browserconfig.xml diff --git a/crates/server/static/fonts/VisbyCF-Bold.eot b/crates/collab/static/fonts/VisbyCF-Bold.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Bold.eot rename to crates/collab/static/fonts/VisbyCF-Bold.eot diff --git a/crates/server/static/fonts/VisbyCF-Bold.woff b/crates/collab/static/fonts/VisbyCF-Bold.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Bold.woff rename to crates/collab/static/fonts/VisbyCF-Bold.woff diff --git a/crates/server/static/fonts/VisbyCF-Bold.woff2 b/crates/collab/static/fonts/VisbyCF-Bold.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Bold.woff2 rename to crates/collab/static/fonts/VisbyCF-Bold.woff2 diff --git a/crates/server/static/fonts/VisbyCF-BoldOblique.eot b/crates/collab/static/fonts/VisbyCF-BoldOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-BoldOblique.eot rename to crates/collab/static/fonts/VisbyCF-BoldOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-BoldOblique.woff b/crates/collab/static/fonts/VisbyCF-BoldOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-BoldOblique.woff rename to crates/collab/static/fonts/VisbyCF-BoldOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-BoldOblique.woff2 b/crates/collab/static/fonts/VisbyCF-BoldOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-BoldOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-BoldOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-DemiBold.eot b/crates/collab/static/fonts/VisbyCF-DemiBold.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBold.eot rename to crates/collab/static/fonts/VisbyCF-DemiBold.eot diff --git a/crates/server/static/fonts/VisbyCF-DemiBold.woff b/crates/collab/static/fonts/VisbyCF-DemiBold.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBold.woff rename to crates/collab/static/fonts/VisbyCF-DemiBold.woff diff --git a/crates/server/static/fonts/VisbyCF-DemiBold.woff2 b/crates/collab/static/fonts/VisbyCF-DemiBold.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBold.woff2 rename to crates/collab/static/fonts/VisbyCF-DemiBold.woff2 diff --git a/crates/server/static/fonts/VisbyCF-DemiBoldOblique.eot b/crates/collab/static/fonts/VisbyCF-DemiBoldOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBoldOblique.eot rename to crates/collab/static/fonts/VisbyCF-DemiBoldOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-DemiBoldOblique.woff b/crates/collab/static/fonts/VisbyCF-DemiBoldOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBoldOblique.woff rename to crates/collab/static/fonts/VisbyCF-DemiBoldOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-DemiBoldOblique.woff2 b/crates/collab/static/fonts/VisbyCF-DemiBoldOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-DemiBoldOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-DemiBoldOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-ExtraBold.eot b/crates/collab/static/fonts/VisbyCF-ExtraBold.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBold.eot rename to crates/collab/static/fonts/VisbyCF-ExtraBold.eot diff --git a/crates/server/static/fonts/VisbyCF-ExtraBold.woff b/crates/collab/static/fonts/VisbyCF-ExtraBold.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBold.woff rename to crates/collab/static/fonts/VisbyCF-ExtraBold.woff diff --git a/crates/server/static/fonts/VisbyCF-ExtraBold.woff2 b/crates/collab/static/fonts/VisbyCF-ExtraBold.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBold.woff2 rename to crates/collab/static/fonts/VisbyCF-ExtraBold.woff2 diff --git a/crates/server/static/fonts/VisbyCF-ExtraBoldOblique.eot b/crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBoldOblique.eot rename to crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-ExtraBoldOblique.woff b/crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBoldOblique.woff rename to crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-ExtraBoldOblique.woff2 b/crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-ExtraBoldOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-ExtraBoldOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-Heavy.eot b/crates/collab/static/fonts/VisbyCF-Heavy.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Heavy.eot rename to crates/collab/static/fonts/VisbyCF-Heavy.eot diff --git a/crates/server/static/fonts/VisbyCF-Heavy.woff b/crates/collab/static/fonts/VisbyCF-Heavy.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Heavy.woff rename to crates/collab/static/fonts/VisbyCF-Heavy.woff diff --git a/crates/server/static/fonts/VisbyCF-Heavy.woff2 b/crates/collab/static/fonts/VisbyCF-Heavy.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Heavy.woff2 rename to crates/collab/static/fonts/VisbyCF-Heavy.woff2 diff --git a/crates/server/static/fonts/VisbyCF-HeavyOblique.eot b/crates/collab/static/fonts/VisbyCF-HeavyOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-HeavyOblique.eot rename to crates/collab/static/fonts/VisbyCF-HeavyOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-HeavyOblique.woff b/crates/collab/static/fonts/VisbyCF-HeavyOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-HeavyOblique.woff rename to crates/collab/static/fonts/VisbyCF-HeavyOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-HeavyOblique.woff2 b/crates/collab/static/fonts/VisbyCF-HeavyOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-HeavyOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-HeavyOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-Light.eot b/crates/collab/static/fonts/VisbyCF-Light.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Light.eot rename to crates/collab/static/fonts/VisbyCF-Light.eot diff --git a/crates/server/static/fonts/VisbyCF-Light.woff b/crates/collab/static/fonts/VisbyCF-Light.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Light.woff rename to crates/collab/static/fonts/VisbyCF-Light.woff diff --git a/crates/server/static/fonts/VisbyCF-Light.woff2 b/crates/collab/static/fonts/VisbyCF-Light.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Light.woff2 rename to crates/collab/static/fonts/VisbyCF-Light.woff2 diff --git a/crates/server/static/fonts/VisbyCF-LightOblique.eot b/crates/collab/static/fonts/VisbyCF-LightOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-LightOblique.eot rename to crates/collab/static/fonts/VisbyCF-LightOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-LightOblique.woff b/crates/collab/static/fonts/VisbyCF-LightOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-LightOblique.woff rename to crates/collab/static/fonts/VisbyCF-LightOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-LightOblique.woff2 b/crates/collab/static/fonts/VisbyCF-LightOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-LightOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-LightOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-Medium.eot b/crates/collab/static/fonts/VisbyCF-Medium.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Medium.eot rename to crates/collab/static/fonts/VisbyCF-Medium.eot diff --git a/crates/server/static/fonts/VisbyCF-Medium.woff b/crates/collab/static/fonts/VisbyCF-Medium.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Medium.woff rename to crates/collab/static/fonts/VisbyCF-Medium.woff diff --git a/crates/server/static/fonts/VisbyCF-Medium.woff2 b/crates/collab/static/fonts/VisbyCF-Medium.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Medium.woff2 rename to crates/collab/static/fonts/VisbyCF-Medium.woff2 diff --git a/crates/server/static/fonts/VisbyCF-MediumOblique.eot b/crates/collab/static/fonts/VisbyCF-MediumOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-MediumOblique.eot rename to crates/collab/static/fonts/VisbyCF-MediumOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-MediumOblique.woff b/crates/collab/static/fonts/VisbyCF-MediumOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-MediumOblique.woff rename to crates/collab/static/fonts/VisbyCF-MediumOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-MediumOblique.woff2 b/crates/collab/static/fonts/VisbyCF-MediumOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-MediumOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-MediumOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-Regular.eot b/crates/collab/static/fonts/VisbyCF-Regular.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Regular.eot rename to crates/collab/static/fonts/VisbyCF-Regular.eot diff --git a/crates/server/static/fonts/VisbyCF-Regular.woff b/crates/collab/static/fonts/VisbyCF-Regular.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Regular.woff rename to crates/collab/static/fonts/VisbyCF-Regular.woff diff --git a/crates/server/static/fonts/VisbyCF-Regular.woff2 b/crates/collab/static/fonts/VisbyCF-Regular.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Regular.woff2 rename to crates/collab/static/fonts/VisbyCF-Regular.woff2 diff --git a/crates/server/static/fonts/VisbyCF-RegularOblique.eot b/crates/collab/static/fonts/VisbyCF-RegularOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-RegularOblique.eot rename to crates/collab/static/fonts/VisbyCF-RegularOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-RegularOblique.woff b/crates/collab/static/fonts/VisbyCF-RegularOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-RegularOblique.woff rename to crates/collab/static/fonts/VisbyCF-RegularOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-RegularOblique.woff2 b/crates/collab/static/fonts/VisbyCF-RegularOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-RegularOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-RegularOblique.woff2 diff --git a/crates/server/static/fonts/VisbyCF-Thin.eot b/crates/collab/static/fonts/VisbyCF-Thin.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-Thin.eot rename to crates/collab/static/fonts/VisbyCF-Thin.eot diff --git a/crates/server/static/fonts/VisbyCF-Thin.woff b/crates/collab/static/fonts/VisbyCF-Thin.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-Thin.woff rename to crates/collab/static/fonts/VisbyCF-Thin.woff diff --git a/crates/server/static/fonts/VisbyCF-Thin.woff2 b/crates/collab/static/fonts/VisbyCF-Thin.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-Thin.woff2 rename to crates/collab/static/fonts/VisbyCF-Thin.woff2 diff --git a/crates/server/static/fonts/VisbyCF-ThinOblique.eot b/crates/collab/static/fonts/VisbyCF-ThinOblique.eot similarity index 100% rename from crates/server/static/fonts/VisbyCF-ThinOblique.eot rename to crates/collab/static/fonts/VisbyCF-ThinOblique.eot diff --git a/crates/server/static/fonts/VisbyCF-ThinOblique.woff b/crates/collab/static/fonts/VisbyCF-ThinOblique.woff similarity index 100% rename from crates/server/static/fonts/VisbyCF-ThinOblique.woff rename to crates/collab/static/fonts/VisbyCF-ThinOblique.woff diff --git a/crates/server/static/fonts/VisbyCF-ThinOblique.woff2 b/crates/collab/static/fonts/VisbyCF-ThinOblique.woff2 similarity index 100% rename from crates/server/static/fonts/VisbyCF-ThinOblique.woff2 rename to crates/collab/static/fonts/VisbyCF-ThinOblique.woff2 diff --git a/crates/server/static/images/android-chrome-192x192.png b/crates/collab/static/images/android-chrome-192x192.png similarity index 100% rename from crates/server/static/images/android-chrome-192x192.png rename to crates/collab/static/images/android-chrome-192x192.png diff --git a/crates/server/static/images/android-chrome-512x512.png b/crates/collab/static/images/android-chrome-512x512.png similarity index 100% rename from crates/server/static/images/android-chrome-512x512.png rename to crates/collab/static/images/android-chrome-512x512.png diff --git a/crates/server/static/images/apple-touch-icon.png b/crates/collab/static/images/apple-touch-icon.png similarity index 100% rename from crates/server/static/images/apple-touch-icon.png rename to crates/collab/static/images/apple-touch-icon.png diff --git a/crates/server/static/images/favicon-16x16.png b/crates/collab/static/images/favicon-16x16.png similarity index 100% rename from crates/server/static/images/favicon-16x16.png rename to crates/collab/static/images/favicon-16x16.png diff --git a/crates/server/static/images/favicon-32x32.png b/crates/collab/static/images/favicon-32x32.png similarity index 100% rename from crates/server/static/images/favicon-32x32.png rename to crates/collab/static/images/favicon-32x32.png diff --git a/crates/server/static/images/favicon.png b/crates/collab/static/images/favicon.png similarity index 100% rename from crates/server/static/images/favicon.png rename to crates/collab/static/images/favicon.png diff --git a/crates/server/static/images/favicon.svg b/crates/collab/static/images/favicon.svg similarity index 100% rename from crates/server/static/images/favicon.svg rename to crates/collab/static/images/favicon.svg diff --git a/crates/server/static/images/mstile-144x144.png b/crates/collab/static/images/mstile-144x144.png similarity index 100% rename from crates/server/static/images/mstile-144x144.png rename to crates/collab/static/images/mstile-144x144.png diff --git a/crates/server/static/images/mstile-150x150.png b/crates/collab/static/images/mstile-150x150.png similarity index 100% rename from crates/server/static/images/mstile-150x150.png rename to crates/collab/static/images/mstile-150x150.png diff --git a/crates/server/static/images/mstile-310x150.png b/crates/collab/static/images/mstile-310x150.png similarity index 100% rename from crates/server/static/images/mstile-310x150.png rename to crates/collab/static/images/mstile-310x150.png diff --git a/crates/server/static/images/mstile-310x310.png b/crates/collab/static/images/mstile-310x310.png similarity index 100% rename from crates/server/static/images/mstile-310x310.png rename to crates/collab/static/images/mstile-310x310.png diff --git a/crates/server/static/images/mstile-70x70.png b/crates/collab/static/images/mstile-70x70.png similarity index 100% rename from crates/server/static/images/mstile-70x70.png rename to crates/collab/static/images/mstile-70x70.png diff --git a/crates/server/static/images/safari-pinned-tab.svg b/crates/collab/static/images/safari-pinned-tab.svg similarity index 100% rename from crates/server/static/images/safari-pinned-tab.svg rename to crates/collab/static/images/safari-pinned-tab.svg diff --git a/crates/server/static/images/zed-og-image.png b/crates/collab/static/images/zed-og-image.png similarity index 100% rename from crates/server/static/images/zed-og-image.png rename to crates/collab/static/images/zed-og-image.png diff --git a/crates/server/static/images/zed-twitter-image.png b/crates/collab/static/images/zed-twitter-image.png similarity index 100% rename from crates/server/static/images/zed-twitter-image.png rename to crates/collab/static/images/zed-twitter-image.png diff --git a/crates/server/static/prism.js b/crates/collab/static/prism.js similarity index 100% rename from crates/server/static/prism.js rename to crates/collab/static/prism.js diff --git a/crates/server/static/prose.css b/crates/collab/static/prose.css similarity index 100% rename from crates/server/static/prose.css rename to crates/collab/static/prose.css diff --git a/crates/server/static/prose.css.map b/crates/collab/static/prose.css.map similarity index 100% rename from crates/server/static/prose.css.map rename to crates/collab/static/prose.css.map diff --git a/crates/server/static/prose.scss b/crates/collab/static/prose.scss similarity index 100% rename from crates/server/static/prose.scss rename to crates/collab/static/prose.scss diff --git a/crates/server/static/site.webmanifest b/crates/collab/static/site.webmanifest similarity index 100% rename from crates/server/static/site.webmanifest rename to crates/collab/static/site.webmanifest diff --git a/crates/server/static/svg/hero.svg b/crates/collab/static/svg/hero.svg similarity index 100% rename from crates/server/static/svg/hero.svg rename to crates/collab/static/svg/hero.svg diff --git a/crates/server/styles.css b/crates/collab/styles.css similarity index 100% rename from crates/server/styles.css rename to crates/collab/styles.css diff --git a/crates/server/templates/admin.hbs b/crates/collab/templates/admin.hbs similarity index 100% rename from crates/server/templates/admin.hbs rename to crates/collab/templates/admin.hbs diff --git a/crates/server/templates/careers.hbs b/crates/collab/templates/careers.hbs similarity index 100% rename from crates/server/templates/careers.hbs rename to crates/collab/templates/careers.hbs diff --git a/crates/server/templates/community.hbs b/crates/collab/templates/community.hbs similarity index 100% rename from crates/server/templates/community.hbs rename to crates/collab/templates/community.hbs diff --git a/crates/server/templates/docs.hbs b/crates/collab/templates/docs.hbs similarity index 100% rename from crates/server/templates/docs.hbs rename to crates/collab/templates/docs.hbs diff --git a/crates/server/templates/error.hbs b/crates/collab/templates/error.hbs similarity index 100% rename from crates/server/templates/error.hbs rename to crates/collab/templates/error.hbs diff --git a/crates/server/templates/home.hbs b/crates/collab/templates/home.hbs similarity index 100% rename from crates/server/templates/home.hbs rename to crates/collab/templates/home.hbs diff --git a/crates/server/templates/partials/layout.hbs b/crates/collab/templates/partials/layout.hbs similarity index 100% rename from crates/server/templates/partials/layout.hbs rename to crates/collab/templates/partials/layout.hbs diff --git a/crates/server/templates/releases.hbs b/crates/collab/templates/releases.hbs similarity index 100% rename from crates/server/templates/releases.hbs rename to crates/collab/templates/releases.hbs diff --git a/crates/server/templates/signup.hbs b/crates/collab/templates/signup.hbs similarity index 100% rename from crates/server/templates/signup.hbs rename to crates/collab/templates/signup.hbs diff --git a/crates/server/templates/team.hbs b/crates/collab/templates/team.hbs similarity index 100% rename from crates/server/templates/team.hbs rename to crates/collab/templates/team.hbs diff --git a/crates/server/.env.toml b/crates/server/.env.toml deleted file mode 100644 index 931f7c4df2a006b422e54ec2dd0d972432c8cba5..0000000000000000000000000000000000000000 --- a/crates/server/.env.toml +++ /dev/null @@ -1,42 +0,0 @@ -# Prod database: CAREFUL! -# DATABASE_URL = "postgres://postgres:f71db7645055488d666f3c26392113104706af1f24d2cf15@zed-db.internal:5432/zed" - -HTTP_PORT = 8080 - -DATABASE_URL = "postgres://postgres@localhost/zed" -SESSION_SECRET = "6E1GS6IQNOLIBKWMEVWF1AFO4H78KNU8" -API_TOKEN = "secret" - -# Available at https://github.com/organizations/zed-industries/settings/apps/zed-local-development -GITHUB_APP_ID = 115633 -GITHUB_CLIENT_ID = "Iv1.768076c9becc75c4" -GITHUB_CLIENT_SECRET = "3592ffff1ecda9773a3df7b0e75375bfbe7992fc" -GITHUB_PRIVATE_KEY = """\ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAtt0O2t69ksn2zX5ucHpflNRoqdh342OOwrazLA6GS8Kp2hWM -NwLzymm2s8k1e2F7sAVYNHJvUPZCvM/xYuVMNpx33fVr00Tni2ATNJKS2lvCEBC0 -nTUKxXQImF82IQadg41o+81gofR3zt2UM7iDRMPbmn/aZe7K8vvFEERawSfKEMv3 -RqAzqt0fBDYvwHonje0Y7/5IAO5GDMd9kDE3w034ckwtyFAJDjRGYN5kVoRlua+Q -aIHoBkJ/jUAsS4kWqZt/r6hbrAcgok7Iv2RoapfgNTPeJKEe0pAagz1orqbrm9Qk -WBeAToTXl4YTfQruMNVyN2/5azqLnS8Urg2jHQIDAQABAoIBAF9TVY8bVk/TIOl2 -4zOXV4RKRlVkFvtexukSPMzWtYOA8vJREUsMKvJ1sVx/o3WyF7xmzNhqX0UhWyD6 -dadMSTKe1o3Khm8YGGw7pUdesVdLRhsB2mWpZPgRyPlFiP4maK5PZU7+fUVwH5Sj -RcLAiQ2r3CrqQ3unw/xu6wfT2kueBMJz6DBCx3y5wwEyrR7b+8ZGrjUy9BelzKti -yIT3OLWhilwho8l03Dg72SCSskotVMcywtc7SMr5PCILL7QANdJDhEO8FP4BysHx -6wlFwpfIPnNHN/RN1Dnnut5F64nPu//6vUs9DR9c34FzDp0SR2hJ98PLYn3uyD5b -6oOcZrECgYEA3QXrezpLwkZN2wS6r6vmNyEKSIevjpQpuFEzGSapJRJbGiP5/C+l -DfTmYud6Ld5YrL7xIQuf6SQWyO8WZkKA6D15VBdsFzM0pzhNGNGUgZYiTQ6rdh83 -5mL8l9IqzT5LD5RRXTj2CO7SB5iuyp8PrPyGCCVhILYJP+a4e4kHwEsCgYEA0803 -oF/QBhfKC3n/7xbRTeT4PcAHra+X84rY+KkyP1/qJXMRbCumpvTL6kZg7Jv2I3hG -SaRK7mGhi0/omVn9aEgn4E7UKmE2ZhVbigTiqnPdYoH/hmrbQ5Z7SVaT/MNzGuKQ -QZOmASgsZEjqSX7extXDzKOGD/AzMp3iWElUGTcCgYAOoT+vDnLJT0IEB1IcIrLA -X22A04ppU6FXU/if55E2pPpmxo7bhIPWYqmFTnEl7BvOg20OlOhm1D612i2PY0OJ -G9iWGl7LQlZv4ygnRmggE8H9e8UZsoNOuqqhmgW/RCpPw6+HDigq+zPn0NFxFApD -lwuAKok9Uw9VrX30n2Nl9QKBgAG7c/ED15e1Khnd7ZHvBdc1QDKBF478GKoNQKkH -+Tk7d5bG0iWoVbyX0/MekDxfKiwwF6MSjOpWMhQJm0VlzwTDUlArVODj2qYLFqyS -TahHOlBL7+MRjKmI2YlIA/3VO2PE5pkitADeaz6GuiPPvdKyfN93lukaddC8KdW/ -A8kRAoGBAJdU+sTC1zfP+tbgArzf4rU5qEknserAH+GE6C/Otn134WBEyqSgd2Jb -JpJsl2l/X/8Wfwh+SJQbhvDoY4ApMKlgLFBAIY/p2UcpEdUL2juec/F6+qGnBncQ -4I+MKiVfixBM9p66Afybiskh3a/RvXK+/6NNOVtVYaSd7aSIrq9W ------END RSA PRIVATE KEY----- -""" diff --git a/script/deploy b/script/deploy index ca325762814ef5e241d48fb57e4cef51a69e1bf0..4ba674766be227b757db4f8d870538f91ddf0cb2 100755 --- a/script/deploy +++ b/script/deploy @@ -28,7 +28,7 @@ if [[ $ZED_KUBE_NAMESPACE == "production" && -n $(git status --short) ]]; then fi git_sha=$(git rev-parse HEAD) -export ZED_IMAGE_ID="registry.digitalocean.com/zed/zed-server:${ZED_KUBE_NAMESPACE}-${git_sha}" +export ZED_IMAGE_ID="registry.digitalocean.com/zed/collab:${ZED_KUBE_NAMESPACE}-${git_sha}" export $(cat $ENV_FILE) docker build . --tag "$ZED_IMAGE_ID" diff --git a/script/seed-db b/script/seed-db index 437d1bcac89f6415ddd4dcfd96e4391d57ebde46..9da6ba2933b83e9b40254344e611aa6f770327f1 100755 --- a/script/seed-db +++ b/script/seed-db @@ -6,4 +6,4 @@ cd crates/server # Export contents of .env.toml eval "$(cargo run --bin dotenv)" -cargo run --package=zed-server --features seed-support --bin seed +cargo run --package=collab --features seed-support --bin seed From 3636c9ec2500132c89ee1a0ef2dccbbcadf63ca1 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 8 Apr 2022 17:32:58 -0700 Subject: [PATCH 128/245] Load workspace and editor key bindings from a JSON file --- crates/editor/src/editor.rs | 240 ++++--------------------- crates/gpui/src/app.rs | 3 +- crates/gpui/src/keymap.rs | 24 ++- crates/server/src/rpc.rs | 11 +- crates/workspace/src/menu.rs | 18 +- crates/workspace/src/pane.rs | 40 ++--- crates/workspace/src/pane_group.rs | 1 - crates/workspace/src/workspace.rs | 27 +-- crates/zed/assets/keymaps/default.json | 199 ++++++++++++++++++++ crates/zed/src/keymap_file.rs | 38 ++++ crates/zed/src/main.rs | 2 +- crates/zed/src/zed.rs | 16 +- 12 files changed, 326 insertions(+), 293 deletions(-) create mode 100644 crates/zed/assets/keymaps/default.json create mode 100644 crates/zed/src/keymap_file.rs diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 4d3265f8fa3ad73cc84c837c759920178e63b610..bda5cda412b49258ed079a30ae735bd8f023ae6e 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -23,7 +23,6 @@ use gpui::{ fonts::{self, HighlightStyle, TextStyle}, geometry::vector::{vec2f, Vector2F}, impl_actions, impl_internal_actions, - keymap::Binding, platform::CursorStyle, text_layout, AppContext, AsyncAppContext, ClipboardItem, Element, ElementBox, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, @@ -81,7 +80,7 @@ pub struct Scroll(pub Vector2F); #[derive(Clone)] pub struct Select(pub SelectPhase); -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct Input(pub String); #[derive(Clone, Deserialize)] @@ -97,13 +96,22 @@ pub struct SelectToEndOfLine { } #[derive(Clone, Deserialize)] -pub struct ToggleCodeActions(#[serde(default)] pub bool); +pub struct ToggleCodeActions { + #[serde(default)] + pub deployed_from_indicator: bool, +} -#[derive(Clone, Deserialize)] -pub struct ConfirmCompletion(#[serde(default)] pub Option); +#[derive(Clone, Default, Deserialize)] +pub struct ConfirmCompletion { + #[serde(default)] + pub item_ix: Option, +} -#[derive(Clone, Deserialize)] -pub struct ConfirmCodeAction(#[serde(default)] pub Option); +#[derive(Clone, Default, Deserialize)] +pub struct ConfirmCodeAction { + #[serde(default)] + pub item_ix: Option, +} actions!( editor, @@ -185,6 +193,7 @@ actions!( impl_actions!( editor, [ + Input, SelectNext, SelectToBeginningOfLine, SelectToEndOfLine, @@ -194,7 +203,7 @@ impl_actions!( ] ); -impl_internal_actions!(editor, [Scroll, Select, Input]); +impl_internal_actions!(editor, [Scroll, Select]); enum DocumentHighlightRead {} enum DocumentHighlightWrite {} @@ -206,187 +215,6 @@ pub enum Direction { } pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings(vec![ - Binding::new("escape", Cancel, Some("Editor")), - Binding::new("backspace", Backspace, Some("Editor")), - Binding::new("ctrl-h", Backspace, Some("Editor")), - Binding::new("delete", Delete, Some("Editor")), - Binding::new("ctrl-d", Delete, Some("Editor")), - Binding::new("enter", Newline, Some("Editor && mode == full")), - Binding::new( - "alt-enter", - Input("\n".into()), - Some("Editor && mode == auto_height"), - ), - Binding::new( - "enter", - ConfirmCompletion(None), - Some("Editor && showing_completions"), - ), - Binding::new( - "enter", - ConfirmCodeAction(None), - Some("Editor && showing_code_actions"), - ), - Binding::new("enter", ConfirmRename, Some("Editor && renaming")), - Binding::new("tab", Tab, Some("Editor")), - Binding::new("shift-tab", TabPrev, Some("Editor")), - Binding::new( - "tab", - ConfirmCompletion(None), - Some("Editor && showing_completions"), - ), - Binding::new("cmd-[", Outdent, Some("Editor")), - Binding::new("cmd-]", Indent, Some("Editor")), - Binding::new("ctrl-shift-K", DeleteLine, Some("Editor")), - Binding::new("alt-backspace", DeleteToPreviousWordStart, Some("Editor")), - Binding::new("alt-h", DeleteToPreviousWordStart, Some("Editor")), - Binding::new( - "ctrl-alt-backspace", - DeleteToPreviousSubwordStart, - Some("Editor"), - ), - Binding::new("ctrl-alt-h", DeleteToPreviousSubwordStart, Some("Editor")), - Binding::new("alt-delete", DeleteToNextWordEnd, Some("Editor")), - Binding::new("alt-d", DeleteToNextWordEnd, Some("Editor")), - Binding::new("ctrl-alt-delete", DeleteToNextSubwordEnd, Some("Editor")), - Binding::new("ctrl-alt-d", DeleteToNextSubwordEnd, Some("Editor")), - Binding::new("cmd-backspace", DeleteToBeginningOfLine, Some("Editor")), - Binding::new("cmd-delete", DeleteToEndOfLine, Some("Editor")), - Binding::new("ctrl-k", CutToEndOfLine, Some("Editor")), - Binding::new("cmd-shift-D", DuplicateLine, Some("Editor")), - Binding::new("ctrl-cmd-up", MoveLineUp, Some("Editor")), - Binding::new("ctrl-cmd-down", MoveLineDown, Some("Editor")), - Binding::new("cmd-x", Cut, Some("Editor")), - Binding::new("cmd-c", Copy, Some("Editor")), - Binding::new("cmd-v", Paste, Some("Editor")), - Binding::new("cmd-z", Undo, Some("Editor")), - Binding::new("cmd-shift-Z", Redo, Some("Editor")), - Binding::new("up", MoveUp, Some("Editor")), - Binding::new("down", MoveDown, Some("Editor")), - Binding::new("left", MoveLeft, Some("Editor")), - Binding::new("right", MoveRight, Some("Editor")), - Binding::new("ctrl-p", MoveUp, Some("Editor")), - Binding::new("ctrl-n", MoveDown, Some("Editor")), - Binding::new("ctrl-b", MoveLeft, Some("Editor")), - Binding::new("ctrl-f", MoveRight, Some("Editor")), - Binding::new("alt-left", MoveToPreviousWordStart, Some("Editor")), - Binding::new("alt-b", MoveToPreviousWordStart, Some("Editor")), - Binding::new("ctrl-alt-left", MoveToPreviousSubwordStart, Some("Editor")), - Binding::new("ctrl-alt-b", MoveToPreviousSubwordStart, Some("Editor")), - Binding::new("alt-right", MoveToNextWordEnd, Some("Editor")), - Binding::new("alt-f", MoveToNextWordEnd, Some("Editor")), - Binding::new("ctrl-alt-right", MoveToNextSubwordEnd, Some("Editor")), - Binding::new("ctrl-alt-f", MoveToNextSubwordEnd, Some("Editor")), - Binding::new("cmd-left", MoveToBeginningOfLine, Some("Editor")), - Binding::new("ctrl-a", MoveToBeginningOfLine, Some("Editor")), - Binding::new("cmd-right", MoveToEndOfLine, Some("Editor")), - Binding::new("ctrl-e", MoveToEndOfLine, Some("Editor")), - Binding::new("cmd-up", MoveToBeginning, Some("Editor")), - Binding::new("cmd-down", MoveToEnd, Some("Editor")), - Binding::new("shift-up", SelectUp, Some("Editor")), - Binding::new("ctrl-shift-P", SelectUp, Some("Editor")), - Binding::new("shift-down", SelectDown, Some("Editor")), - Binding::new("ctrl-shift-N", SelectDown, Some("Editor")), - Binding::new("shift-left", SelectLeft, Some("Editor")), - Binding::new("ctrl-shift-B", SelectLeft, Some("Editor")), - Binding::new("shift-right", SelectRight, Some("Editor")), - Binding::new("ctrl-shift-F", SelectRight, Some("Editor")), - Binding::new("alt-shift-left", SelectToPreviousWordStart, Some("Editor")), - Binding::new("alt-shift-B", SelectToPreviousWordStart, Some("Editor")), - Binding::new( - "ctrl-alt-shift-left", - SelectToPreviousSubwordStart, - Some("Editor"), - ), - Binding::new( - "ctrl-alt-shift-B", - SelectToPreviousSubwordStart, - Some("Editor"), - ), - Binding::new("alt-shift-right", SelectToNextWordEnd, Some("Editor")), - Binding::new("alt-shift-F", SelectToNextWordEnd, Some("Editor")), - Binding::new( - "cmd-shift-left", - SelectToBeginningOfLine { - stop_at_soft_wraps: true, - }, - Some("Editor"), - ), - Binding::new( - "ctrl-alt-shift-right", - SelectToNextSubwordEnd, - Some("Editor"), - ), - Binding::new("ctrl-alt-shift-F", SelectToNextSubwordEnd, Some("Editor")), - Binding::new( - "ctrl-shift-A", - SelectToBeginningOfLine { - stop_at_soft_wraps: true, - }, - Some("Editor"), - ), - Binding::new( - "cmd-shift-right", - SelectToEndOfLine { - stop_at_soft_wraps: true, - }, - Some("Editor"), - ), - Binding::new( - "ctrl-shift-E", - SelectToEndOfLine { - stop_at_soft_wraps: true, - }, - Some("Editor"), - ), - Binding::new("cmd-shift-up", SelectToBeginning, Some("Editor")), - Binding::new("cmd-shift-down", SelectToEnd, Some("Editor")), - Binding::new("cmd-a", SelectAll, Some("Editor")), - Binding::new("cmd-l", SelectLine, Some("Editor")), - Binding::new("cmd-shift-L", SplitSelectionIntoLines, Some("Editor")), - Binding::new("cmd-alt-up", AddSelectionAbove, Some("Editor")), - Binding::new("cmd-ctrl-p", AddSelectionAbove, Some("Editor")), - Binding::new("cmd-alt-down", AddSelectionBelow, Some("Editor")), - Binding::new("cmd-ctrl-n", AddSelectionBelow, Some("Editor")), - Binding::new( - "cmd-d", - SelectNext { - replace_newest: false, - }, - Some("Editor"), - ), - Binding::new( - "cmd-k cmd-d", - SelectNext { - replace_newest: true, - }, - Some("Editor"), - ), - Binding::new("cmd-/", ToggleComments, Some("Editor")), - Binding::new("alt-up", SelectLargerSyntaxNode, Some("Editor")), - Binding::new("ctrl-w", SelectLargerSyntaxNode, Some("Editor")), - Binding::new("alt-down", SelectSmallerSyntaxNode, Some("Editor")), - Binding::new("ctrl-shift-W", SelectSmallerSyntaxNode, Some("Editor")), - Binding::new("cmd-u", UndoSelection, Some("Editor")), - Binding::new("cmd-shift-U", RedoSelection, Some("Editor")), - Binding::new("f8", GoToNextDiagnostic, Some("Editor")), - Binding::new("shift-f8", GoToPrevDiagnostic, Some("Editor")), - Binding::new("f2", Rename, Some("Editor")), - Binding::new("f12", GoToDefinition, Some("Editor")), - Binding::new("alt-shift-f12", FindAllReferences, Some("Editor")), - Binding::new("ctrl-m", MoveToEnclosingBracket, Some("Editor")), - Binding::new("pageup", PageUp, Some("Editor")), - Binding::new("pagedown", PageDown, Some("Editor")), - Binding::new("alt-cmd-[", Fold, Some("Editor")), - Binding::new("alt-cmd-]", UnfoldLines, Some("Editor")), - Binding::new("alt-cmd-f", FoldSelectedRanges, Some("Editor")), - Binding::new("ctrl-space", ShowCompletions, Some("Editor")), - Binding::new("cmd-.", ToggleCodeActions(false), Some("Editor")), - Binding::new("alt-enter", OpenExcerpts, Some("Editor")), - Binding::new("cmd-f10", RestartLanguageServer, Some("Editor")), - ]); - cx.add_action(Editor::open_new); cx.add_action(|this: &mut Editor, action: &Scroll, cx| this.set_scroll_position(action.0, cx)); cx.add_action(Editor::select); @@ -396,6 +224,7 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(Editor::backspace); cx.add_action(Editor::delete); cx.add_action(Editor::tab); + cx.add_action(Editor::tab_prev); cx.add_action(Editor::indent); cx.add_action(Editor::outdent); cx.add_action(Editor::delete_line); @@ -849,7 +678,9 @@ impl CompletionsMenu { ) .with_cursor_style(CursorStyle::PointingHand) .on_mouse_down(move |cx| { - cx.dispatch_action(ConfirmCompletion(Some(item_ix))); + cx.dispatch_action(ConfirmCompletion { + item_ix: Some(item_ix), + }); }) .boxed(), ); @@ -975,7 +806,9 @@ impl CodeActionsMenu { }) .with_cursor_style(CursorStyle::PointingHand) .on_mouse_down(move |cx| { - cx.dispatch_action(ConfirmCodeAction(Some(item_ix))); + cx.dispatch_action(ConfirmCodeAction { + item_ix: Some(item_ix), + }); }) .boxed(), ); @@ -2473,7 +2306,7 @@ impl Editor { pub fn confirm_completion( &mut self, - ConfirmCompletion(completion_ix): &ConfirmCompletion, + action: &ConfirmCompletion, cx: &mut ViewContext, ) -> Option>> { use language::ToOffset as _; @@ -2486,7 +2319,7 @@ impl Editor { let mat = completions_menu .matches - .get(completion_ix.unwrap_or(completions_menu.selected_item))?; + .get(action.item_ix.unwrap_or(completions_menu.selected_item))?; let buffer_handle = completions_menu.buffer; let completion = completions_menu.completions.get(mat.candidate_id)?; @@ -2576,11 +2409,7 @@ impl Editor { })) } - pub fn toggle_code_actions( - &mut self, - &ToggleCodeActions(deployed_from_indicator): &ToggleCodeActions, - cx: &mut ViewContext, - ) { + pub fn toggle_code_actions(&mut self, action: &ToggleCodeActions, cx: &mut ViewContext) { if matches!( self.context_menu.as_ref(), Some(ContextMenu::CodeActions(_)) @@ -2590,6 +2419,7 @@ impl Editor { return; } + let deployed_from_indicator = action.deployed_from_indicator; let mut task = self.code_actions_task.take(); cx.spawn_weak(|this, mut cx| async move { while let Some(prev_task) = task { @@ -2624,7 +2454,7 @@ impl Editor { pub fn confirm_code_action( workspace: &mut Workspace, - ConfirmCodeAction(action_ix): &ConfirmCodeAction, + action: &ConfirmCodeAction, cx: &mut ViewContext, ) -> Option>> { let editor = workspace.active_item(cx)?.act_as::(cx)?; @@ -2635,7 +2465,7 @@ impl Editor { } else { return None; }; - let action_ix = action_ix.unwrap_or(actions_menu.selected_item); + let action_ix = action.item_ix.unwrap_or(actions_menu.selected_item); let action = actions_menu.actions.get(action_ix)?.clone(); let title = action.lsp_action.title.clone(); let buffer = actions_menu.buffer; @@ -2862,7 +2692,9 @@ impl Editor { .with_cursor_style(CursorStyle::PointingHand) .with_padding(Padding::uniform(3.)) .on_mouse_down(|cx| { - cx.dispatch_action(ToggleCodeActions(true)); + cx.dispatch_action(ToggleCodeActions { + deployed_from_indicator: true, + }); }) .boxed(), ) @@ -4558,7 +4390,7 @@ impl Editor { self.go_to_diagnostic(Direction::Next, cx) } - fn go_to_prev_diagnostic(&mut self, _: &GoToNextDiagnostic, cx: &mut ViewContext) { + fn go_to_prev_diagnostic(&mut self, _: &GoToPrevDiagnostic, cx: &mut ViewContext) { self.go_to_diagnostic(Direction::Prev, cx) } @@ -9394,7 +9226,7 @@ mod tests { let apply_additional_edits = editor.update(cx, |editor, cx| { editor.move_down(&MoveDown, cx); let apply_additional_edits = editor - .confirm_completion(&ConfirmCompletion(None), cx) + .confirm_completion(&ConfirmCompletion::default(), cx) .unwrap(); assert_eq!( editor.text(cx), @@ -9477,7 +9309,7 @@ mod tests { let apply_additional_edits = editor.update(cx, |editor, cx| { let apply_additional_edits = editor - .confirm_completion(&ConfirmCompletion(None), cx) + .confirm_completion(&ConfirmCompletion::default(), cx) .unwrap(); assert_eq!( editor.text(cx), diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index f7417f666349b9bad33acd6b2109fba9a36fe1f7..962343a28a9c190fe23f3d1487c50c113503350c 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -10,7 +10,7 @@ use crate::{ AssetCache, AssetSource, ClipboardItem, FontCache, PathPromptOptions, TextLayoutCache, }; pub use action::*; -use anyhow::{anyhow, Result}; +use anyhow::{anyhow, Context, Result}; use collections::btree_map; use keymap::MatchResult; use lazy_static::lazy_static; @@ -870,6 +870,7 @@ impl MutableAppContext { .get(name) .ok_or_else(|| anyhow!("unknown action {}", name))?; callback(argument.unwrap_or("{}")) + .with_context(|| format!("invalid data for action {}", name)) } pub fn add_action(&mut self, handler: F) diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index a94abb8252c46616cd733084839b317701d16a43..1b9e920ff2d98c68fcacdd7c23a2fed854a403fd 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -1,5 +1,5 @@ use crate::Action; -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use std::{ any::Any, collections::{HashMap, HashSet}, @@ -168,20 +168,26 @@ impl Keymap { impl Binding { pub fn new(keystrokes: &str, action: A, context: Option<&str>) -> Self { + Self::load(keystrokes, Box::new(action), context).unwrap() + } + + pub fn load(keystrokes: &str, action: Box, context: Option<&str>) -> Result { let context = if let Some(context) = context { - Some(ContextPredicate::parse(context).unwrap()) + Some(ContextPredicate::parse(context)?) } else { None }; - Self { - keystrokes: keystrokes - .split_whitespace() - .map(|key| Keystroke::parse(key).unwrap()) - .collect(), - action: Box::new(action), + let keystrokes = keystrokes + .split_whitespace() + .map(|key| Keystroke::parse(key)) + .collect::>()?; + + Ok(Self { + keystrokes, + action, context, - } + }) } } diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 5ebe36e8242bb5e2fe735e4701fd85f962b4c4da..fa7afa5b2fbfd9536a1a00b91787a9e98777714f 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -2419,7 +2419,7 @@ mod tests { .condition(&cx_b, |editor, _| editor.context_menu_visible()) .await; editor_b.update(cx_b, |editor, cx| { - editor.confirm_completion(&ConfirmCompletion(Some(0)), cx); + editor.confirm_completion(&ConfirmCompletion { item_ix: Some(0) }, cx); assert_eq!(editor.text(cx), "fn main() { a.first_method() }"); }); @@ -3608,7 +3608,12 @@ mod tests { // Toggle code actions and wait for them to display. editor_b.update(cx_b, |editor, cx| { - editor.toggle_code_actions(&ToggleCodeActions(false), cx); + editor.toggle_code_actions( + &ToggleCodeActions { + deployed_from_indicator: false, + }, + cx, + ); }); editor_b .condition(&cx_b, |editor, _| editor.context_menu_visible()) @@ -3619,7 +3624,7 @@ mod tests { // Confirming the code action will trigger a resolve request. let confirm_action = workspace_b .update(cx_b, |workspace, cx| { - Editor::confirm_code_action(workspace, &ConfirmCodeAction(Some(0)), cx) + Editor::confirm_code_action(workspace, &ConfirmCodeAction { item_ix: Some(0) }, cx) }) .unwrap(); fake_language_server.handle_request::( diff --git a/crates/workspace/src/menu.rs b/crates/workspace/src/menu.rs index e2412db7412bd4f19961c5474a3a46305c25684d..33de4a677a3d0503c4dee46243ec1841bbaa449a 100644 --- a/crates/workspace/src/menu.rs +++ b/crates/workspace/src/menu.rs @@ -1,18 +1,4 @@ -use gpui::{actions, keymap::Binding, MutableAppContext}; - -actions!( +gpui::actions!( menu, - [Confirm, SelectPrev, SelectNext, SelectFirst, SelectLast,] + [Confirm, SelectPrev, SelectNext, SelectFirst, SelectLast] ); - -pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([ - Binding::new("up", SelectPrev, Some("menu")), - Binding::new("ctrl-p", SelectPrev, Some("menu")), - Binding::new("down", SelectNext, Some("menu")), - Binding::new("ctrl-n", SelectNext, Some("menu")), - Binding::new("cmd-up", SelectFirst, Some("menu")), - Binding::new("cmd-down", SelectLast, Some("menu")), - Binding::new("enter", Confirm, Some("menu")), - ]); -} diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index a60e2ff9db038f0f8fc74a752c966957ec5abe95..a992897c1182c9e03a5ee515d6a71fd7cf2bc8d7 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -8,7 +8,6 @@ use gpui::{ elements::*, geometry::{rect::RectF, vector::vec2f}, impl_actions, impl_internal_actions, - keymap::Binding, platform::{CursorStyle, NavigationDirection}, AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, @@ -41,14 +40,20 @@ pub struct CloseItem { #[derive(Clone, Deserialize)] pub struct ActivateItem(pub usize); -#[derive(Clone)] -pub struct GoBack(pub Option>); +#[derive(Clone, Deserialize)] +pub struct GoBack { + #[serde(skip_deserializing)] + pub pane: Option>, +} -#[derive(Clone)] -pub struct GoForward(pub Option>); +#[derive(Clone, Deserialize)] +pub struct GoForward { + #[serde(skip_deserializing)] + pub pane: Option>, +} -impl_actions!(pane, [Split]); -impl_internal_actions!(pane, [CloseItem, ActivateItem, GoBack, GoForward]); +impl_actions!(pane, [Split, GoBack, GoForward]); +impl_internal_actions!(pane, [CloseItem, ActivateItem]); const MAX_NAVIGATION_HISTORY_LEN: usize = 1024; @@ -75,7 +80,7 @@ pub fn init(cx: &mut MutableAppContext) { Pane::go_back( workspace, action - .0 + .pane .as_ref() .and_then(|weak_handle| weak_handle.upgrade(cx)), cx, @@ -86,26 +91,13 @@ pub fn init(cx: &mut MutableAppContext) { Pane::go_forward( workspace, action - .0 + .pane .as_ref() .and_then(|weak_handle| weak_handle.upgrade(cx)), cx, ) .detach(); }); - - cx.add_bindings(vec![ - Binding::new("shift-cmd-{", ActivatePrevItem, Some("Pane")), - Binding::new("shift-cmd-}", ActivateNextItem, Some("Pane")), - Binding::new("cmd-w", CloseActiveItem, Some("Pane")), - Binding::new("alt-cmd-w", CloseInactiveItems, Some("Pane")), - Binding::new("cmd-k up", Split(SplitDirection::Up), Some("Pane")), - Binding::new("cmd-k down", Split(SplitDirection::Down), Some("Pane")), - Binding::new("cmd-k left", Split(SplitDirection::Left), Some("Pane")), - Binding::new("cmd-k right", Split(SplitDirection::Right), Some("Pane")), - Binding::new("ctrl--", GoBack(None), Some("Pane")), - Binding::new("shift-ctrl-_", GoForward(None), Some("Pane")), - ]); } pub enum Event { @@ -815,8 +807,8 @@ impl View for Pane { .on_navigate_mouse_down(move |direction, cx| { let this = this.clone(); match direction { - NavigationDirection::Back => cx.dispatch_action(GoBack(Some(this))), - NavigationDirection::Forward => cx.dispatch_action(GoForward(Some(this))), + NavigationDirection::Back => cx.dispatch_action(GoBack { pane: Some(this) }), + NavigationDirection::Forward => cx.dispatch_action(GoForward { pane: Some(this) }), } true diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rs index d5661ba2c9342fe92066b91503fc422ed48bbf96..a17805822f75cb351d519727b283d2f6e1f349d6 100644 --- a/crates/workspace/src/pane_group.rs +++ b/crates/workspace/src/pane_group.rs @@ -256,7 +256,6 @@ impl PaneAxis { } #[derive(Clone, Copy, Debug, Deserialize)] -#[serde(rename_all = "snake_case")] pub enum SplitDirection { Up, Down, diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 475913d9dbbf6ad51bfdcf7baa86ddf0bbe10dfd..d63626e1d33703df971bb0e19f3e90fc310e45e9 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -19,7 +19,6 @@ use gpui::{ geometry::{rect::RectF, vector::vec2f, PathBuilder}, impl_internal_actions, json::{self, to_string_pretty, ToJson}, - keymap::Binding, platform::{CursorStyle, WindowOptions}, AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Border, ClipboardItem, Entity, ImageData, ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, @@ -32,7 +31,7 @@ pub use pane_group::*; use postage::prelude::Stream; use project::{fs, Fs, Project, ProjectEntryId, ProjectPath, Worktree}; use settings::Settings; -use sidebar::{Side, Sidebar, SidebarItemId, ToggleSidebarItem, ToggleSidebarItemFocus}; +use sidebar::{Side, Sidebar, ToggleSidebarItem, ToggleSidebarItemFocus}; use status_bar::StatusBar; pub use status_bar::StatusItemView; use std::{ @@ -108,7 +107,6 @@ impl_internal_actions!( pub fn init(client: &Arc, cx: &mut MutableAppContext) { pane::init(cx); - menu::init(cx); cx.add_global_action(open); cx.add_global_action(move |action: &OpenPaths, cx: &mut MutableAppContext| { @@ -144,29 +142,6 @@ pub fn init(client: &Arc, cx: &mut MutableAppContext) { cx.add_action(|workspace: &mut Workspace, _: &ActivateNextPane, cx| { workspace.activate_next_pane(cx) }); - cx.add_bindings(vec![ - Binding::new("ctrl-alt-cmd-f", FollowNextCollaborator, None), - Binding::new("cmd-s", Save, None), - Binding::new("cmd-alt-i", DebugElements, None), - Binding::new("cmd-k cmd-left", ActivatePreviousPane, None), - Binding::new("cmd-k cmd-right", ActivateNextPane, None), - Binding::new( - "cmd-shift-!", - ToggleSidebarItem(SidebarItemId { - side: Side::Left, - item_index: 0, - }), - None, - ), - Binding::new( - "cmd-1", - ToggleSidebarItemFocus(SidebarItemId { - side: Side::Left, - item_index: 0, - }), - None, - ), - ]); client.add_view_request_handler(Workspace::handle_follow); client.add_view_message_handler(Workspace::handle_unfollow); diff --git a/crates/zed/assets/keymaps/default.json b/crates/zed/assets/keymaps/default.json new file mode 100644 index 0000000000000000000000000000000000000000..1339a5e54fb1c86703e179f2cce1b9d75c4449e3 --- /dev/null +++ b/crates/zed/assets/keymaps/default.json @@ -0,0 +1,199 @@ +{ + "": { + "ctrl-alt-cmd-f": "workspace::FollowNextCollaborator", + "cmd-s": "workspace::Save", + "cmd-alt-i": "workspace::DebugElements", + "cmd-k cmd-left": "workspace::ActivatePreviousPane", + "cmd-k cmd-right": "workspace::ActivateNextPane", + "cmd-=": "zed::IncreaseBufferFontSize", + "cmd--": "zed::DecreaseBufferFontSize", + "cmd-,": "zed::OpenSettings" + }, + "menu": { + "up": "menu::SelectPrev", + "ctrl-p": "menu::SelectPrev", + "down": "menu::SelectNext", + "ctrl-n": "menu::SelectNext", + "cmd-up": "menu::SelectFirst", + "cmd-down": "menu::SelectLast", + "enter": "menu::Confirm" + }, + "Pane": { + "shift-cmd-{": "pane::ActivatePrevItem", + "shift-cmd-}": "pane::ActivateNextItem", + "cmd-w": "pane::CloseActiveItem", + "alt-cmd-w": "pane::CloseInactiveItems", + "ctrl--": "pane::GoBack", + "shift-ctrl-_": "pane::GoForward", + "cmd-k up": [ + "pane::Split", + "Up" + ], + "cmd-k down": [ + "pane::Split", + "Down" + ], + "cmd-k left": [ + "pane::Split", + "Left" + ], + "cmd-k right": [ + "pane::Split", + "Right" + ] + }, + "Editor": { + "escape": "editor::Cancel", + "backspace": "editor::Backspace", + "ctrl-h": "editor::Backspace", + "delete": "editor::Delete", + "ctrl-d": "editor::Delete", + "tab": "editor::Tab", + "shift-tab": "editor::TabPrev", + "cmd-[": "editor::Outdent", + "cmd-]": "editor::Indent", + "ctrl-shift-K": "editor::DeleteLine", + "alt-backspace": "editor::DeleteToPreviousWordStart", + "alt-h": "editor::DeleteToPreviousWordStart", + "ctrl-alt-backspace": "editor::DeleteToPreviousSubwordStart", + "ctrl-alt-h": "editor::DeleteToPreviousSubwordStart", + "alt-delete": "editor::DeleteToNextWordEnd", + "alt-d": "editor::DeleteToNextWordEnd", + "ctrl-alt-delete": "editor::DeleteToNextSubwordEnd", + "ctrl-alt-d": "editor::DeleteToNextSubwordEnd", + "cmd-backspace": "editor::DeleteToBeginningOfLine", + "cmd-delete": "editor::DeleteToEndOfLine", + "ctrl-k": "editor::CutToEndOfLine", + "cmd-shift-D": "editor::DuplicateLine", + "ctrl-cmd-up": "editor::MoveLineUp", + "ctrl-cmd-down": "editor::MoveLineDown", + "cmd-x": "editor::Cut", + "cmd-c": "editor::Copy", + "cmd-v": "editor::Paste", + "cmd-z": "editor::Undo", + "cmd-shift-Z": "editor::Redo", + "up": "editor::MoveUp", + "down": "editor::MoveDown", + "left": "editor::MoveLeft", + "right": "editor::MoveRight", + "ctrl-p": "editor::MoveUp", + "ctrl-n": "editor::MoveDown", + "ctrl-b": "editor::MoveLeft", + "ctrl-f": "editor::MoveRight", + "alt-left": "editor::MoveToPreviousWordStart", + "alt-b": "editor::MoveToPreviousWordStart", + "ctrl-alt-left": "editor::MoveToPreviousSubwordStart", + "ctrl-alt-b": "editor::MoveToPreviousSubwordStart", + "alt-right": "editor::MoveToNextWordEnd", + "alt-f": "editor::MoveToNextWordEnd", + "ctrl-alt-right": "editor::MoveToNextSubwordEnd", + "ctrl-alt-f": "editor::MoveToNextSubwordEnd", + "cmd-left": "editor::MoveToBeginningOfLine", + "ctrl-a": "editor::MoveToBeginningOfLine", + "cmd-right": "editor::MoveToEndOfLine", + "ctrl-e": "editor::MoveToEndOfLine", + "cmd-up": "editor::MoveToBeginning", + "cmd-down": "editor::MoveToEnd", + "shift-up": "editor::SelectUp", + "ctrl-shift-P": "editor::SelectUp", + "shift-down": "editor::SelectDown", + "ctrl-shift-N": "editor::SelectDown", + "shift-left": "editor::SelectLeft", + "ctrl-shift-B": "editor::SelectLeft", + "shift-right": "editor::SelectRight", + "ctrl-shift-F": "editor::SelectRight", + "alt-shift-left": "editor::SelectToPreviousWordStart", + "alt-shift-B": "editor::SelectToPreviousWordStart", + "ctrl-alt-shift-left": "editor::SelectToPreviousSubwordStart", + "ctrl-alt-shift-B": "editor::SelectToPreviousSubwordStart", + "alt-shift-right": "editor::SelectToNextWordEnd", + "alt-shift-F": "editor::SelectToNextWordEnd", + "ctrl-alt-shift-right": "editor::SelectToNextSubwordEnd", + "cmd-shift-up": "editor::SelectToBeginning", + "cmd-shift-down": "editor::SelectToEnd", + "cmd-a": "editor::SelectAll", + "cmd-l": "editor::SelectLine", + "cmd-shift-L": "editor::SplitSelectionIntoLines", + "cmd-alt-up": "editor::AddSelectionAbove", + "cmd-ctrl-p": "editor::AddSelectionAbove", + "cmd-alt-down": "editor::AddSelectionBelow", + "cmd-ctrl-n": "editor::AddSelectionBelow", + "ctrl-alt-shift-F": "editor::SelectToNextSubwordEnd", + "cmd-shift-left": [ + "editor::SelectToBeginningOfLine", + { + "stop_at_soft_wraps": true + } + ], + "ctrl-shift-A": [ + "editor::SelectToBeginningOfLine", + { + "stop_at_soft_wraps": true + } + ], + "cmd-shift-right": [ + "editor::SelectToEndOfLine", + { + "stop_at_soft_wraps": true + } + ], + "ctrl-shift-E": [ + "editor::SelectToEndOfLine", + { + "stop_at_soft_wraps": true + } + ], + "cmd-d": [ + "editor::SelectNext", + { + "replace_newest": false + } + ], + "cmd-k cmd-d": [ + "editor::SelectNext", + { + "replace_newest": true + } + ], + "cmd-/": "editor::ToggleComments", + "alt-up": "editor::SelectLargerSyntaxNode", + "ctrl-w": "editor::SelectLargerSyntaxNode", + "alt-down": "editor::SelectSmallerSyntaxNode", + "ctrl-shift-W": "editor::SelectSmallerSyntaxNode", + "cmd-u": "editor::UndoSelection", + "cmd-shift-U": "editor::RedoSelection", + "f8": "editor::GoToNextDiagnostic", + "shift-f8": "editor::GoToPrevDiagnostic", + "f2": "editor::Rename", + "f12": "editor::GoToDefinition", + "alt-shift-f12": "editor::FindAllReferences", + "ctrl-m": "editor::MoveToEnclosingBracket", + "pageup": "editor::PageUp", + "pagedown": "editor::PageDown", + "alt-cmd-[": "editor::Fold", + "alt-cmd-]": "editor::UnfoldLines", + "alt-cmd-f": "editor::FoldSelectedRanges", + "ctrl-space": "editor::ShowCompletions", + "cmd-.": "editor::ToggleCodeActions", + "alt-enter": "editor::OpenExcerpts", + "cmd-f10": "editor::RestartLanguageServer" + }, + "Editor && renaming": { + "enter": "editor::ConfirmRename" + }, + "Editor && showing_completions": { + "enter": "editor::ConfirmCompletion" + }, + "Editor && showing_code_actions": { + "enter": "editor::ConfirmCodeAction" + }, + "Editor && mode == full": { + "enter": "editor::Newline" + }, + "Editor && mode == auto_height": { + "alt-enter": [ + "editor::Input", + "\n" + ] + } +} \ No newline at end of file diff --git a/crates/zed/src/keymap_file.rs b/crates/zed/src/keymap_file.rs new file mode 100644 index 0000000000000000000000000000000000000000..2eaf1b7ecba0cad5bbb024e3fb4cd5c02c3499de --- /dev/null +++ b/crates/zed/src/keymap_file.rs @@ -0,0 +1,38 @@ +use anyhow::Result; +use collections::BTreeMap; +use gpui::{keymap::Binding, MutableAppContext}; +use serde::Deserialize; +use serde_json::value::RawValue; + +#[derive(Deserialize)] +struct ActionWithData<'a>(#[serde(borrow)] &'a str, #[serde(borrow)] &'a RawValue); +type ActionSetsByContext<'a> = BTreeMap<&'a str, ActionsByKeystroke<'a>>; +type ActionsByKeystroke<'a> = BTreeMap<&'a str, &'a RawValue>; + +pub fn load_keymap(cx: &mut MutableAppContext, content: &str) -> Result<()> { + let actions: ActionSetsByContext = serde_json::from_str(content)?; + for (context, actions) in actions { + let context = if context.is_empty() { + None + } else { + Some(context) + }; + cx.add_bindings( + actions + .into_iter() + .map(|(keystroke, action)| { + let action = action.get(); + let action = if action.starts_with('[') { + let ActionWithData(name, data) = serde_json::from_str(action)?; + cx.deserialize_action(name, Some(data.get())) + } else { + let name = serde_json::from_str(action)?; + cx.deserialize_action(name, None) + }?; + Binding::load(keystroke, action, context) + }) + .collect::>>()?, + ) + } + Ok(()) +} diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index abdf68e6ab367a204e641e9fd5abdc3354e074be..bfb1b34256991584f105f68c34a36f48165b46bf 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -145,8 +145,8 @@ fn main() { build_workspace: &build_workspace, }); journal::init(app_state.clone(), cx); - zed::init(&app_state, cx); theme_selector::init(cx); + zed::init(&app_state, cx); cx.set_menus(menus::menus(&app_state.clone())); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 6465c9b2531b11c603219de46cddb8534ae5a476..bae7b517e94646fa68b877043a41783c84d46ac8 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -1,10 +1,12 @@ pub mod assets; +mod keymap_file; pub mod languages; pub mod menus; pub mod settings_file; #[cfg(any(test, feature = "test-support"))] pub mod test; +use assets::Assets; use breadcrumbs::Breadcrumbs; use chat_panel::ChatPanel; pub use client; @@ -14,7 +16,6 @@ pub use editor; use gpui::{ actions, geometry::vector::vec2f, - keymap::Binding, platform::{WindowBounds, WindowOptions}, ModelHandle, ViewContext, }; @@ -104,11 +105,11 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - cx.add_bindings(vec![ - Binding::new("cmd-=", IncreaseBufferFontSize, None), - Binding::new("cmd--", DecreaseBufferFontSize, None), - Binding::new("cmd-,", OpenSettings, None), - ]) + keymap_file::load_keymap( + cx, + std::str::from_utf8(Assets::get("keymaps/default.json").unwrap().data.as_ref()).unwrap(), + ) + .unwrap(); } pub fn build_workspace( @@ -208,9 +209,8 @@ fn quit(_: &Quit, cx: &mut gpui::MutableAppContext) { #[cfg(test)] mod tests { - use crate::assets::Assets; - use super::*; + use crate::assets::Assets; use editor::{DisplayPoint, Editor}; use gpui::{AssetSource, MutableAppContext, TestAppContext, ViewHandle}; use project::{Fs, ProjectPath}; From 1e2eeaa22a8ed338d7540633c1756403a27df583 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Sun, 10 Apr 2022 11:30:08 -0700 Subject: [PATCH 129/245] Load project and buffer search key bindings from JSON file --- crates/search/src/buffer_search.rs | 24 +++---------------- crates/search/src/project_search.rs | 15 +++--------- crates/zed/assets/keymaps/default.json | 33 ++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 71e9a90970a9a9288b68edad76ec873ff39723aa..b808b85160436285dc2a1a64f254a557807f839f 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -5,9 +5,9 @@ use crate::{ use collections::HashMap; use editor::{display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, Editor}; use gpui::{ - actions, elements::*, impl_actions, impl_internal_actions, keymap::Binding, - platform::CursorStyle, AppContext, Entity, MutableAppContext, RenderContext, Subscription, - Task, View, ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, impl_actions, impl_internal_actions, platform::CursorStyle, AppContext, + Entity, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, ViewHandle, + WeakViewHandle, }; use language::OffsetRangeExt; use project::search::SearchQuery; @@ -33,24 +33,6 @@ pub enum Event { } pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([ - Binding::new( - "cmd-f", - Deploy { focus: true }, - Some("Editor && mode == full"), - ), - Binding::new( - "cmd-e", - Deploy { focus: false }, - Some("Editor && mode == full"), - ), - Binding::new("escape", Dismiss, Some("BufferSearchBar")), - Binding::new("cmd-f", FocusEditor, Some("BufferSearchBar")), - Binding::new("enter", SelectNextMatch, Some("BufferSearchBar")), - Binding::new("shift-enter", SelectPrevMatch, Some("BufferSearchBar")), - Binding::new("cmd-g", SelectNextMatch, Some("Pane")), - Binding::new("cmd-shift-G", SelectPrevMatch, Some("Pane")), - ]); cx.add_action(BufferSearchBar::deploy); cx.add_action(BufferSearchBar::dismiss); cx.add_action(BufferSearchBar::focus_editor); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 39ff1a09ea312412b1b6d5e0dad6c4fe2776b803..5e4096e483631f0071aba5b3cbf5952dc9bdc222 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -5,9 +5,9 @@ use crate::{ use collections::HashMap; use editor::{Anchor, Autoscroll, Editor, MultiBuffer, SelectAll}; use gpui::{ - actions, elements::*, keymap::Binding, platform::CursorStyle, AppContext, ElementBox, Entity, - ModelContext, ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View, - ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle, + actions, elements::*, platform::CursorStyle, AppContext, ElementBox, Entity, ModelContext, + ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, + ViewHandle, WeakModelHandle, WeakViewHandle, }; use project::{search::SearchQuery, Project}; use settings::Settings; @@ -28,15 +28,6 @@ struct ActiveSearches(HashMap, WeakViewHandle Date: Sun, 10 Apr 2022 11:39:43 -0700 Subject: [PATCH 130/245] Load modal key bindings from JSON file --- crates/file_finder/src/file_finder.rs | 13 ++-------- crates/go_to_line/src/go_to_line.rs | 9 ++----- crates/outline/src/outline.rs | 12 ++------- crates/project_symbols/src/project_symbols.rs | 11 ++------ crates/theme_selector/src/theme_selector.rs | 13 ++-------- crates/zed/assets/keymaps/default.json | 26 +++++++++++++++++-- 6 files changed, 34 insertions(+), 50 deletions(-) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 659dde7c5b40b4befdf15ee0ce3bc3dca5b1731a..f3f2c31d2cfd5268135570251ed1d0697ca3610c 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -1,12 +1,8 @@ use editor::Editor; use fuzzy::PathMatch; use gpui::{ - actions, - elements::*, - impl_internal_actions, - keymap::{self, Binding}, - AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, - ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, impl_internal_actions, keymap, AppContext, Axis, Entity, ModelHandle, + MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; use project::{Project, ProjectPath, WorktreeId}; use settings::Settings; @@ -50,11 +46,6 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(FileFinder::select); cx.add_action(FileFinder::select_prev); cx.add_action(FileFinder::select_next); - - cx.add_bindings(vec![ - Binding::new("cmd-p", Toggle, None), - Binding::new("escape", Toggle, Some("FileFinder")), - ]); } pub enum Event { diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 9995736550dab5a6598cd54249f52e96c85581b8..16b633ad72dec170967f1965ad79f608c14f5ea8 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -1,7 +1,7 @@ use editor::{display_map::ToDisplayPoint, Autoscroll, DisplayPoint, Editor}; use gpui::{ - actions, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity, - MutableAppContext, RenderContext, View, ViewContext, ViewHandle, + actions, elements::*, geometry::vector::Vector2F, Axis, Entity, MutableAppContext, + RenderContext, View, ViewContext, ViewHandle, }; use settings::Settings; use text::{Bias, Point}; @@ -10,11 +10,6 @@ use workspace::Workspace; actions!(go_to_line, [Toggle, Confirm]); pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([ - Binding::new("ctrl-g", Toggle, Some("Editor")), - Binding::new("escape", Toggle, Some("GoToLine")), - Binding::new("enter", Confirm, Some("GoToLine")), - ]); cx.add_action(GoToLine::toggle); cx.add_action(GoToLine::confirm); } diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 5386657ef20c2567aeae4dfadc874a2635791695..08bc18a016a62f72d3aaf4b60c7aff33bb4cbfde 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -4,12 +4,8 @@ use editor::{ }; use fuzzy::StringMatch; use gpui::{ - actions, - elements::*, - geometry::vector::Vector2F, - keymap::{self, Binding}, - AppContext, Axis, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, - WeakViewHandle, + actions, elements::*, geometry::vector::Vector2F, keymap, AppContext, Axis, Entity, + MutableAppContext, RenderContext, View, ViewContext, ViewHandle, WeakViewHandle, }; use language::Outline; use ordered_float::OrderedFloat; @@ -23,10 +19,6 @@ use workspace::{ actions!(outline, [Toggle]); pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([ - Binding::new("cmd-shift-O", Toggle, Some("Editor")), - Binding::new("escape", Toggle, Some("OutlineView")), - ]); cx.add_action(OutlineView::toggle); cx.add_action(OutlineView::confirm); cx.add_action(OutlineView::select_prev); diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 689f579b81c0f14cda0281dc4635648c899f478b..c14f7bea33b70089f3988766e64ea38fe8f1d11e 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -3,11 +3,8 @@ use editor::{ }; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - actions, - elements::*, - keymap::{self, Binding}, - AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, - ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, keymap, AppContext, Axis, Entity, ModelHandle, MutableAppContext, + RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; use ordered_float::OrderedFloat; use project::{Project, Symbol}; @@ -25,10 +22,6 @@ use workspace::{ actions!(project_symbols, [Toggle]); pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([ - Binding::new("cmd-t", Toggle, None), - Binding::new("escape", Toggle, Some("ProjectSymbolsView")), - ]); cx.add_action(ProjectSymbolsView::toggle); cx.add_action(ProjectSymbolsView::confirm); cx.add_action(ProjectSymbolsView::select_prev); diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 733df65b82a779a4d8b29f2c9ebc99d02268bb60..37099eb510a9b476d59c396dd3b564a6acb581e8 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,11 +1,8 @@ use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ - actions, - elements::*, - keymap::{self, Binding}, - AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, View, - ViewContext, ViewHandle, + actions, elements::*, keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, + RenderContext, View, ViewContext, ViewHandle, }; use settings::Settings; use std::{cmp, sync::Arc}; @@ -33,12 +30,6 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(ThemeSelector::select_next); cx.add_action(ThemeSelector::toggle); cx.add_action(ThemeSelector::reload); - - cx.add_bindings(vec![ - Binding::new("cmd-k cmd-t", Toggle, None), - Binding::new("cmd-k t", Reload, None), - Binding::new("escape", Toggle, Some("ThemeSelector")), - ]); } pub enum Event { diff --git a/crates/zed/assets/keymaps/default.json b/crates/zed/assets/keymaps/default.json index c121edad7605c10ed2e86c5b3ce3007883ff572a..addd5ffb1e919a2f38a2b3e0016aca2bcf7fd808 100644 --- a/crates/zed/assets/keymaps/default.json +++ b/crates/zed/assets/keymaps/default.json @@ -47,7 +47,11 @@ "cmd-shift-G": "search::SelectPrevMatch" }, "Workspace": { - "cmd-shift-F": "project_search::Deploy" + "cmd-shift-F": "project_search::Deploy", + "cmd-k cmd-t": "theme_selector::Toggle", + "cmd-k t": "theme_selector::Reload", + "cmd-t": "project_symbols::Toggle", + "cmd-p": "file_finder::Toggle" }, "ProjectSearchBar": { "enter": "project_search::Search", @@ -217,12 +221,30 @@ { "focus": false } - ] + ], + "cmd-shift-O": "outline::Toggle", + "ctrl-g": "go_to_line::Toggle" }, "Editor && mode == auto_height": { "alt-enter": [ "editor::Input", "\n" ] + }, + "OutlineView": { + "escape": "outline::Toggle" + }, + "ProjectSymbolsView": { + "escape": "project_symbols::Toggle" + }, + "ThemeSelector": { + "escape": "theme_selector::Toggle" + }, + "GoToLine": { + "escape": "go_to_line::Toggle", + "enter": "go_to_line::Confirm" + }, + "FileFinder": { + "escape": "file_finder::Toggle" } } \ No newline at end of file From 9a4b8e3d8cbb6e207a2a1e057d34c40050545960 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Sun, 10 Apr 2022 14:29:45 -0700 Subject: [PATCH 131/245] Load all keybindings from JSON file --- crates/chat_panel/src/chat_panel.rs | 3 - crates/diagnostics/src/diagnostics.rs | 6 +- crates/journal/src/journal.rs | 3 +- crates/project_panel/src/project_panel.rs | 7 +-- crates/vim/src/insert.rs | 8 +-- crates/vim/src/normal.rs | 23 +------- crates/vim/src/normal/g_prefix.rs | 8 +-- crates/zed/assets/keymaps/default.json | 67 ++++++++++++++++++++++- crates/zed/src/keymap_file.rs | 9 ++- 9 files changed, 81 insertions(+), 53 deletions(-) diff --git a/crates/chat_panel/src/chat_panel.rs b/crates/chat_panel/src/chat_panel.rs index 3e432f98c1a8c1a4b30a01bd78c16efd3cf3a5ba..187c0139db16590b5651f547a757149fcbf8643e 100644 --- a/crates/chat_panel/src/chat_panel.rs +++ b/crates/chat_panel/src/chat_panel.rs @@ -6,7 +6,6 @@ use editor::Editor; use gpui::{ actions, elements::*, - keymap::Binding, platform::CursorStyle, views::{ItemType, Select, SelectStyle}, AppContext, Entity, ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View, @@ -38,8 +37,6 @@ actions!(chat_panel, [Send, LoadMoreMessages]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(ChatPanel::send); cx.add_action(ChatPanel::load_more_messages); - - cx.add_bindings(vec![Binding::new("enter", Send, Some("ChatPanel"))]); } impl ChatPanel { diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index ba5a518673c66e18ff45fb961ecb14bc601b4b32..ea8150da45cee293db84daf8be20014f4058fedc 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -8,9 +8,8 @@ use editor::{ highlight_diagnostic_message, Editor, ExcerptId, MultiBuffer, ToOffset, }; use gpui::{ - actions, elements::*, fonts::TextStyle, keymap::Binding, AnyViewHandle, AppContext, Entity, - ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, - WeakViewHandle, + actions, elements::*, fonts::TextStyle, AnyViewHandle, AppContext, Entity, ModelHandle, + MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; use language::{ Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, SelectionGoal, @@ -33,7 +32,6 @@ actions!(diagnostics, [Deploy]); const CONTEXT_LINE_COUNT: u32 = 1; pub fn init(cx: &mut MutableAppContext) { - cx.add_bindings([Binding::new("alt-shift-D", Deploy, Some("Workspace"))]); cx.add_action(ProjectDiagnosticsEditor::deploy); } diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index de9945d10e9cc2fefbffad04b1c9a15fd5dd2767..910c2947b428994b347494f67ff69aca88407648 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -1,6 +1,6 @@ use chrono::{Datelike, Local, Timelike}; use editor::{Autoscroll, Editor}; -use gpui::{actions, keymap::Binding, MutableAppContext}; +use gpui::{actions, MutableAppContext}; use std::{fs::OpenOptions, sync::Arc}; use util::TryFutureExt as _; use workspace::AppState; @@ -8,7 +8,6 @@ use workspace::AppState; actions!(journal, [NewJournalEntry]); pub fn init(app_state: Arc, cx: &mut MutableAppContext) { - cx.add_bindings(vec![Binding::new("ctrl-alt-cmd-j", NewJournalEntry, None)]); cx.add_global_action(move |_: &NewJournalEntry, cx| new_journal_entry(app_state.clone(), cx)); } diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index a14e03d27dfff794efa16847f8c54cc969822487..11e9f2db9ecad8c61f09fa745af7d3fc20984167 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -4,8 +4,7 @@ use gpui::{ Align, ConstrainedBox, Empty, Flex, Label, MouseEventHandler, ParentElement, ScrollTarget, Svg, UniformList, UniformListState, }, - impl_internal_actions, - keymap::{self, Binding}, + impl_internal_actions, keymap, platform::CursorStyle, AppContext, Element, ElementBox, Entity, ModelHandle, MutableAppContext, View, ViewContext, ViewHandle, WeakViewHandle, @@ -63,10 +62,6 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(ProjectPanel::select_prev); cx.add_action(ProjectPanel::select_next); cx.add_action(ProjectPanel::open_entry); - cx.add_bindings([ - Binding::new("right", ExpandSelectedEntry, Some("ProjectPanel")), - Binding::new("left", CollapseSelectedEntry, Some("ProjectPanel")), - ]); } pub enum Event { diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 749ae7c5d31cdbb1998e1faff491f9bd285b462f..597832f95ad2d48241645df6ca4b4bcec0631996 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -1,18 +1,12 @@ use crate::{mode::Mode, SwitchMode, VimState}; use editor::Bias; -use gpui::{actions, keymap::Binding, MutableAppContext, ViewContext}; +use gpui::{actions, MutableAppContext, ViewContext}; use language::SelectionGoal; use workspace::Workspace; actions!(vim, [NormalBefore]); pub fn init(cx: &mut MutableAppContext) { - let context = Some("Editor && vim_mode == insert"); - cx.add_bindings(vec![ - Binding::new("escape", NormalBefore, context), - Binding::new("ctrl-c", NormalBefore, context), - ]); - cx.add_action(normal_before); } diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 0a49d2c8fd9a0be6b6c0f68be14faae04a4596be..b6752544ae48ebbb451f80f3fe0aaaec8d4d132d 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -1,8 +1,8 @@ mod g_prefix; -use crate::{mode::NormalState, Mode, SwitchMode, VimState}; +use crate::VimState; use editor::{char_kind, movement, Bias}; -use gpui::{actions, impl_actions, keymap::Binding, MutableAppContext, ViewContext}; +use gpui::{actions, impl_actions, MutableAppContext, ViewContext}; use language::SelectionGoal; use serde::Deserialize; use workspace::Workspace; @@ -40,26 +40,7 @@ actions!( ); pub fn init(cx: &mut MutableAppContext) { - let context = Some("Editor && vim_mode == normal"); - cx.add_bindings(vec![ - Binding::new("i", SwitchMode(Mode::Insert), context), - Binding::new("g", SwitchMode(Mode::Normal(NormalState::GPrefix)), context), - Binding::new("h", MoveLeft, context), - Binding::new("j", MoveDown, context), - Binding::new("k", MoveUp, context), - Binding::new("l", MoveRight, context), - Binding::new("0", MoveToStartOfLine, context), - Binding::new("shift-$", MoveToEndOfLine, context), - Binding::new("shift-G", MoveToEnd, context), - Binding::new("w", MoveToNextWordStart(false), context), - Binding::new("shift-W", MoveToNextWordStart(true), context), - Binding::new("e", MoveToNextWordEnd(false), context), - Binding::new("shift-E", MoveToNextWordEnd(true), context), - Binding::new("b", MoveToPreviousWordStart(false), context), - Binding::new("shift-B", MoveToPreviousWordStart(true), context), - ]); g_prefix::init(cx); - cx.add_action(move_left); cx.add_action(move_down); cx.add_action(move_up); diff --git a/crates/vim/src/normal/g_prefix.rs b/crates/vim/src/normal/g_prefix.rs index 79c48a686ee73c484734e29791777804e332f375..5fecbc4c5bdb974f2482129a3e98c2801c72b94b 100644 --- a/crates/vim/src/normal/g_prefix.rs +++ b/crates/vim/src/normal/g_prefix.rs @@ -1,16 +1,10 @@ use crate::{mode::Mode, SwitchMode, VimState}; -use gpui::{actions, keymap::Binding, MutableAppContext, ViewContext}; +use gpui::{actions, MutableAppContext, ViewContext}; use workspace::Workspace; actions!(vim, [MoveToStart]); pub fn init(cx: &mut MutableAppContext) { - let context = Some("Editor && vim_mode == normal && vim_submode == g"); - cx.add_bindings(vec![ - Binding::new("g", MoveToStart, context), - Binding::new("escape", SwitchMode(Mode::normal()), context), - ]); - cx.add_action(move_to_start); } diff --git a/crates/zed/assets/keymaps/default.json b/crates/zed/assets/keymaps/default.json index addd5ffb1e919a2f38a2b3e0016aca2bcf7fd808..98a9901bd396644b4888861f1040f8850e3c006f 100644 --- a/crates/zed/assets/keymaps/default.json +++ b/crates/zed/assets/keymaps/default.json @@ -51,7 +51,9 @@ "cmd-k cmd-t": "theme_selector::Toggle", "cmd-k t": "theme_selector::Reload", "cmd-t": "project_symbols::Toggle", - "cmd-p": "file_finder::Toggle" + "cmd-p": "file_finder::Toggle", + "alt-shift-D": "diagnostics::Deploy", + "ctrl-alt-cmd-j": "journal::NewJournalEntry" }, "ProjectSearchBar": { "enter": "project_search::Search", @@ -246,5 +248,68 @@ }, "FileFinder": { "escape": "file_finder::Toggle" + }, + "ChatPanel": { + "enter": "chat_panel::Send" + }, + "ProjectPanel": { + "left": "project_panel::CollapseSelectedEntry", + "right": "project_panel::ExpandSelectedEntry" + }, + "Editor && vim_mode == insert": { + "escape": "vim::NormalBefore", + "ctrl-c": "vim::NormalBefore" + }, + "Editor && vim_mode == normal && vim_submode == g": { + "g": "vim::MoveToStart", + "escape": [ + "vim::SwitchMode", + { + "Normal": "None" + } + ] + }, + "Editor && vim_mode == normal": { + "i": [ + "vim::SwitchMode", + "Insert" + ], + "g": [ + "vim::SwitchMode", + { + "Normal": "GPrefix" + } + ], + "h": "vim::MoveLeft", + "j": "vim::MoveDown", + "k": "vim::MoveUp", + "l": "vim::MoveRight", + "0": "vim::MoveToStartOfLine", + "shift-$": "vim::MoveToEndOfLine", + "shift-G": "vim::MoveToEnd", + "w": [ + "vim::MoveToNextWordStart", + false + ], + "shift-W": [ + "vim::MoveToNextWordStart", + true + ], + "e": [ + "vim::MoveToNextWordEnd", + false + ], + "shift-E": [ + "vim::MoveToNextWordEnd", + true + ], + "b": [ + "vim::MoveToPreviousWordStart", + false + ], + "shift-B": [ + "vim::MoveToPreviousWordStart", + true + ] } } \ No newline at end of file diff --git a/crates/zed/src/keymap_file.rs b/crates/zed/src/keymap_file.rs index 2eaf1b7ecba0cad5bbb024e3fb4cd5c02c3499de..7d9423719e94518614e548792bbf6863e227c04a 100644 --- a/crates/zed/src/keymap_file.rs +++ b/crates/zed/src/keymap_file.rs @@ -1,4 +1,4 @@ -use anyhow::Result; +use anyhow::{Context, Result}; use collections::BTreeMap; use gpui::{keymap::Binding, MutableAppContext}; use serde::Deserialize; @@ -28,7 +28,12 @@ pub fn load_keymap(cx: &mut MutableAppContext, content: &str) -> Result<()> { } else { let name = serde_json::from_str(action)?; cx.deserialize_action(name, None) - }?; + } + .with_context(|| { + format!( + "invalid binding value for keystroke {keystroke}, context {context:?}" + ) + })?; Binding::load(keystroke, action, context) }) .collect::>>()?, From f9e0899e5820ee2c7d9e66dd7e929d4e7573e238 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 12:14:23 +0200 Subject: [PATCH 132/245] Fix divergence bug when peer reconnects reusing a prior replica id We forgot to observe the footprint of the reconnecting replica's prior undos into the local clock. This could cause the replica to generate edits with a version strictly smaller than what other peers may have observed. As such, those peers would think they had already seen those edits and skip them. --- crates/language/src/tests.rs | 56 ++++++++++++++++++++++++++++++++---- crates/text/src/text.rs | 5 ++-- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/crates/language/src/tests.rs b/crates/language/src/tests.rs index af2d8ee911338ae12aff702d0ae22c9d23c1db49..a194c26625185c72514121bb26914a17dd9b0066 100644 --- a/crates/language/src/tests.rs +++ b/crates/language/src/tests.rs @@ -821,7 +821,10 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { } 50..=59 if replica_ids.len() < max_peers => { let old_buffer = buffer.read(cx).to_proto(); - let new_replica_id = replica_ids.len() as ReplicaId; + let new_replica_id = (0..=replica_ids.len() as ReplicaId) + .filter(|replica_id| *replica_id != buffer.read(cx).replica_id()) + .choose(&mut rng) + .unwrap(); log::info!( "Adding new replica {} (replicating from {})", new_replica_id, @@ -830,6 +833,11 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { new_buffer = Some(cx.add_model(|cx| { let mut new_buffer = Buffer::from_proto(new_replica_id, old_buffer, None, cx).unwrap(); + log::info!( + "New replica {} text: {:?}", + new_buffer.replica_id(), + new_buffer.text() + ); new_buffer.set_group_interval(Duration::from_millis(rng.gen_range(0..=200))); let network = network.clone(); cx.subscribe(&cx.handle(), move |buffer, _, event, _| { @@ -843,8 +851,33 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { .detach(); new_buffer })); - replica_ids.push(new_replica_id); network.borrow_mut().replicate(replica_id, new_replica_id); + + if new_replica_id as usize == replica_ids.len() { + replica_ids.push(new_replica_id); + } else { + let new_buffer = new_buffer.take().unwrap(); + while network.borrow().has_unreceived(new_replica_id) { + let ops = network + .borrow_mut() + .receive(new_replica_id) + .into_iter() + .map(|op| proto::deserialize_operation(op).unwrap()); + if ops.len() > 0 { + log::info!( + "peer {} (version: {:?}) applying {} ops from the network. {:?}", + new_replica_id, + buffer.read(cx).version(), + ops.len(), + ops + ); + new_buffer.update(cx, |new_buffer, cx| { + new_buffer.apply_ops(ops, cx).unwrap(); + }); + } + } + buffers[new_replica_id as usize] = new_buffer; + } } 60..=69 if mutation_count != 0 => { buffer.update(cx, |buffer, cx| { @@ -861,9 +894,11 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { .map(|op| proto::deserialize_operation(op).unwrap()); if ops.len() > 0 { log::info!( - "peer {} applying {} ops from the network.", + "peer {} (version: {:?}) applying {} ops from the network. {:?}", replica_id, - ops.len() + buffer.read(cx).version(), + ops.len(), + ops ); buffer.update(cx, |buffer, cx| buffer.apply_ops(ops, cx).unwrap()); } @@ -886,6 +921,12 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { let first_buffer = buffers[0].read(cx).snapshot(); for buffer in &buffers[1..] { let buffer = buffer.read(cx).snapshot(); + assert_eq!( + buffer.version(), + first_buffer.version(), + "Replica {} version != Replica 0 version", + buffer.replica_id() + ); assert_eq!( buffer.text(), first_buffer.text(), @@ -915,7 +956,12 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) { .filter(|(replica_id, _)| **replica_id != buffer.replica_id()) .map(|(replica_id, selections)| (*replica_id, selections.iter().collect::>())) .collect::>(); - assert_eq!(actual_remote_selections, expected_remote_selections); + assert_eq!( + actual_remote_selections, + expected_remote_selections, + "Replica {} remote selections != expected selections", + buffer.replica_id() + ); } } diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 1c351079a7ddae872652707b106abea01c8f70fd..ed918cd5c59a29fe03d3f4f01dd27edbf2424d94 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -826,6 +826,8 @@ impl Buffer { edit.timestamp, ); self.snapshot.version.observe(edit.timestamp.local()); + self.local_clock.observe(edit.timestamp.local()); + self.lamport_clock.observe(edit.timestamp.lamport()); self.resolve_edit(edit.timestamp.local()); } } @@ -836,6 +838,7 @@ impl Buffer { if !self.version.observed(undo.id) { self.apply_undo(&undo)?; self.snapshot.version.observe(undo.id); + self.local_clock.observe(undo.id); self.lamport_clock.observe(lamport_timestamp); } } @@ -1033,8 +1036,6 @@ impl Buffer { self.snapshot.visible_text = visible_text; self.snapshot.deleted_text = deleted_text; self.snapshot.insertions.edit(new_insertions, &()); - self.local_clock.observe(timestamp.local()); - self.lamport_clock.observe(timestamp.lamport()); self.subscriptions.publish_mut(&edits); } From bb8dc6120bd2f83242b300995d403f343f8844c6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 10:58:57 +0200 Subject: [PATCH 133/245] Allow taking an `Arc` in `[gpui::test]`-decorated tests --- crates/gpui_macros/src/gpui_macros.rs | 99 +++++++++++++-------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/crates/gpui_macros/src/gpui_macros.rs b/crates/gpui_macros/src/gpui_macros.rs index c107175dca71fcec76e32a08dd8ff4e6579dadaf..7ec8b4fb7c6c17508fe028b213e1bd9f471ce19f 100644 --- a/crates/gpui_macros/src/gpui_macros.rs +++ b/crates/gpui_macros/src/gpui_macros.rs @@ -75,68 +75,65 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream { match last_segment.map(|s| s.ident.to_string()).as_deref() { Some("StdRng") => { inner_fn_args.extend(quote!(rand::SeedableRng::seed_from_u64(seed),)); + continue; } Some("bool") => { inner_fn_args.extend(quote!(is_last_iteration,)); + continue; } - _ => { - return TokenStream::from( - syn::Error::new_spanned(arg, "invalid argument") - .into_compile_error(), - ) - } - } - } else if let Type::Reference(ty) = &*arg.ty { - match &*ty.elem { - Type::Path(ty) => { - let last_segment = ty.path.segments.last(); - match last_segment.map(|s| s.ident.to_string()).as_deref() { - Some("TestAppContext") => { - let first_entity_id = ix * 100_000; - let cx_varname = format_ident!("cx_{}", ix); - cx_vars.extend(quote!( - let mut #cx_varname = #namespace::TestAppContext::new( - foreground_platform.clone(), - cx.platform().clone(), - deterministic.build_foreground(#ix), - deterministic.build_background(), - cx.font_cache().clone(), - cx.leak_detector(), - #first_entity_id, - ); - )); - cx_teardowns.extend(quote!( - #cx_varname.update(|cx| cx.remove_all_windows()); - deterministic.run_until_parked(); - #cx_varname.update(|_| {}); // flush effects - )); - inner_fn_args.extend(quote!(&mut #cx_varname,)); - } - _ => { - return TokenStream::from( - syn::Error::new_spanned(arg, "invalid argument") - .into_compile_error(), - ) + Some("Arc") => { + if let syn::PathArguments::AngleBracketed(args) = + &last_segment.unwrap().arguments + { + if let Some(syn::GenericArgument::Type(syn::Type::Path(ty))) = + args.args.last() + { + let last_segment = ty.path.segments.last(); + if let Some("Deterministic") = + last_segment.map(|s| s.ident.to_string()).as_deref() + { + inner_fn_args.extend(quote!(deterministic.clone(),)); + continue; + } } } } - _ => { - return TokenStream::from( - syn::Error::new_spanned(arg, "invalid argument") - .into_compile_error(), - ) + _ => {} + } + } else if let Type::Reference(ty) = &*arg.ty { + if let Type::Path(ty) = &*ty.elem { + let last_segment = ty.path.segments.last(); + if let Some("TestAppContext") = + last_segment.map(|s| s.ident.to_string()).as_deref() + { + let first_entity_id = ix * 100_000; + let cx_varname = format_ident!("cx_{}", ix); + cx_vars.extend(quote!( + let mut #cx_varname = #namespace::TestAppContext::new( + foreground_platform.clone(), + cx.platform().clone(), + deterministic.build_foreground(#ix), + deterministic.build_background(), + cx.font_cache().clone(), + cx.leak_detector(), + #first_entity_id, + ); + )); + cx_teardowns.extend(quote!( + #cx_varname.update(|cx| cx.remove_all_windows()); + deterministic.run_until_parked(); + #cx_varname.update(|_| {}); // flush effects + )); + inner_fn_args.extend(quote!(&mut #cx_varname,)); + continue; } } - } else { - return TokenStream::from( - syn::Error::new_spanned(arg, "invalid argument").into_compile_error(), - ); } - } else { - return TokenStream::from( - syn::Error::new_spanned(arg, "invalid argument").into_compile_error(), - ); } + + return TokenStream::from( + syn::Error::new_spanned(arg, "invalid argument").into_compile_error(), + ); } parse_quote! { From 02f96c6defa5dc40039731d8c950150cec2b666d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 11:00:31 +0200 Subject: [PATCH 134/245] Simulate parallelism among peers correctly in randomized collab test Previously they were all using the same foreground executor, which was not properly simulating concurrency among tasks from different peers. --- crates/server/src/rpc.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index ce35401b980ca529975705b777b190bedefb4789..d249c43398f60adbca01b88360d04226674c348b 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1087,7 +1087,11 @@ mod tests { self, ConfirmCodeAction, ConfirmCompletion, ConfirmRename, Editor, Input, Redo, Rename, ToOffset, ToggleCodeActions, Undo, }; - use gpui::{executor, geometry::vector::vec2f, ModelHandle, TestAppContext, ViewHandle}; + use gpui::{ + executor::{self, Deterministic}, + geometry::vector::vec2f, + ModelHandle, TestAppContext, ViewHandle, + }; use language::{ range_to_lsp, tree_sitter_rust, Diagnostic, DiagnosticEntry, FakeLspAdapter, Language, LanguageConfig, LanguageRegistry, OffsetRangeExt, Point, Rope, @@ -4969,7 +4973,11 @@ mod tests { } #[gpui::test(iterations = 100)] - async fn test_random_collaboration(cx: &mut TestAppContext, rng: StdRng) { + async fn test_random_collaboration( + cx: &mut TestAppContext, + deterministic: Arc, + rng: StdRng, + ) { cx.foreground().forbid_parking(); let max_peers = env::var("MAX_PEERS") .map(|i| i.parse().expect("invalid `MAX_PEERS` variable")) @@ -5002,8 +5010,8 @@ mod tests { let mut host_cx = TestAppContext::new( cx.foreground_platform(), cx.platform(), - cx.foreground(), - cx.background(), + deterministic.build_foreground(next_entity_id), + deterministic.build_background(), cx.font_cache(), cx.leak_detector(), next_entity_id, @@ -5165,7 +5173,7 @@ mod tests { let host_disconnected = Rc::new(AtomicBool::new(false)); user_ids.push(host.current_user_id(&host_cx)); - clients.push(cx.foreground().spawn(host.simulate_host( + clients.push(host_cx.foreground().spawn(host.simulate_host( host_project, files, operations.clone(), @@ -5187,8 +5195,8 @@ mod tests { let mut guest_cx = TestAppContext::new( cx.foreground_platform(), cx.platform(), - cx.foreground(), - cx.background(), + deterministic.build_foreground(next_entity_id), + deterministic.build_background(), cx.font_cache(), cx.leak_detector(), next_entity_id, @@ -5207,7 +5215,7 @@ mod tests { .await .unwrap(); user_ids.push(guest.current_user_id(&guest_cx)); - clients.push(cx.foreground().spawn(guest.simulate_guest( + clients.push(guest_cx.foreground().spawn(guest.simulate_guest( guest_id, guest_project, operations.clone(), From f99a1437cd614df74a093580760c4f5301eb6e78 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 14:36:36 +0200 Subject: [PATCH 135/245] Distribute operation workload evenly across peers in randomized test Co-Authored-By: Nathan Sobo --- crates/server/src/rpc.rs | 148 +++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 67 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index d249c43398f60adbca01b88360d04226674c348b..e825f98bdd8250dd98f4948781ecabe121a504d3 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1110,7 +1110,6 @@ mod tests { use settings::Settings; use sqlx::types::time::OffsetDateTime; use std::{ - cell::Cell, env, ops::Deref, path::{Path, PathBuf}, @@ -5000,10 +4999,10 @@ mod tests { ) .await; - let operations = Rc::new(Cell::new(0)); let mut server = TestServer::start(cx.foreground(), cx.background()).await; let mut clients = Vec::new(); let mut user_ids = Vec::new(); + let mut op_start_signals = Vec::new(); let files = Arc::new(Mutex::new(Vec::new())); let mut next_entity_id = 100000; @@ -5172,64 +5171,29 @@ mod tests { host_language_registry.add(Arc::new(language)); let host_disconnected = Rc::new(AtomicBool::new(false)); + let op_start_signal = futures::channel::mpsc::unbounded(); user_ids.push(host.current_user_id(&host_cx)); + op_start_signals.push(op_start_signal.0); clients.push(host_cx.foreground().spawn(host.simulate_host( host_project, files, - operations.clone(), - max_operations, + op_start_signal.1, rng.clone(), host_cx, ))); - while operations.get() < max_operations { - cx.background().simulate_random_delay().await; - if clients.len() >= max_peers { - break; - } else if rng.lock().gen_bool(0.05) { - operations.set(operations.get() + 1); - - let guest_id = clients.len(); - log::info!("Adding guest {}", guest_id); - next_entity_id += 100000; - let mut guest_cx = TestAppContext::new( - cx.foreground_platform(), - cx.platform(), - deterministic.build_foreground(next_entity_id), - deterministic.build_background(), - cx.font_cache(), - cx.leak_detector(), - next_entity_id, - ); - let guest = server - .create_client(&mut guest_cx, &format!("guest-{}", guest_id)) - .await; - let guest_project = Project::remote( - host_project_id, - guest.client.clone(), - guest.user_store.clone(), - guest_lang_registry.clone(), - FakeFs::new(cx.background()), - &mut guest_cx.to_async(), - ) - .await - .unwrap(); - user_ids.push(guest.current_user_id(&guest_cx)); - clients.push(guest_cx.foreground().spawn(guest.simulate_guest( - guest_id, - guest_project, - operations.clone(), - max_operations, - rng.clone(), - host_disconnected.clone(), - guest_cx, - ))); - - log::info!("Guest {} added", guest_id); - } else if rng.lock().gen_bool(0.05) { + let disconnect_host_at = if rng.lock().gen_bool(0.2) { + rng.lock().gen_range(0..max_operations) + } else { + max_operations + }; + let mut operations = 0; + while operations < max_operations { + if operations == disconnect_host_at { host_disconnected.store(true, SeqCst); server.disconnect_client(user_ids[0]); cx.foreground().advance_clock(RECEIVE_TIMEOUT); + drop(op_start_signals); let mut clients = futures::future::join_all(clients).await; cx.foreground().run_until_parked(); @@ -5258,8 +5222,68 @@ mod tests { return; } + + let distribution = rng.lock().gen_range(0..100); + match distribution { + 0..=19 if clients.len() < max_peers => { + let guest_id = clients.len(); + log::info!("Adding guest {}", guest_id); + next_entity_id += 100000; + let mut guest_cx = TestAppContext::new( + cx.foreground_platform(), + cx.platform(), + deterministic.build_foreground(next_entity_id), + deterministic.build_background(), + cx.font_cache(), + cx.leak_detector(), + next_entity_id, + ); + let guest = server + .create_client(&mut guest_cx, &format!("guest-{}", guest_id)) + .await; + let guest_project = Project::remote( + host_project_id, + guest.client.clone(), + guest.user_store.clone(), + guest_lang_registry.clone(), + FakeFs::new(cx.background()), + &mut guest_cx.to_async(), + ) + .await + .unwrap(); + let op_start_signal = futures::channel::mpsc::unbounded(); + user_ids.push(guest.current_user_id(&guest_cx)); + op_start_signals.push(op_start_signal.0); + clients.push(guest_cx.foreground().spawn(guest.simulate_guest( + guest_id, + guest_project, + op_start_signal.1, + rng.clone(), + host_disconnected.clone(), + guest_cx, + ))); + + log::info!("Guest {} added", guest_id); + operations += 1; + } + _ => { + while operations < max_operations && rng.lock().gen_bool(0.7) { + op_start_signals + .choose(&mut *rng.lock()) + .unwrap() + .unbounded_send(()) + .unwrap(); + operations += 1; + } + + if rng.lock().gen_bool(0.8) { + cx.foreground().run_until_parked(); + } + } + } } + drop(op_start_signals); let mut clients = futures::future::join_all(clients).await; cx.foreground().run_until_parked(); @@ -5655,8 +5679,7 @@ mod tests { mut self, project: ModelHandle, files: Arc>>, - operations: Rc>, - max_operations: usize, + op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, mut cx: TestAppContext, ) -> (Self, TestAppContext) { @@ -5664,15 +5687,13 @@ mod tests { client: &mut TestClient, project: ModelHandle, files: Arc>>, - operations: Rc>, - max_operations: usize, + mut op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, cx: &mut TestAppContext, ) -> anyhow::Result<()> { let fs = project.read_with(cx, |project, _| project.fs().clone()); - while operations.get() < max_operations { - operations.set(operations.get() + 1); + while op_start_signal.next().await.is_some() { let distribution = rng.lock().gen_range::(0..100); match distribution { 0..=20 if !files.lock().is_empty() => { @@ -5784,8 +5805,7 @@ mod tests { &mut self, project.clone(), files, - operations, - max_operations, + op_start_signal, rng, &mut cx, ) @@ -5800,8 +5820,7 @@ mod tests { mut self, guest_id: usize, project: ModelHandle, - operations: Rc>, - max_operations: usize, + op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, host_disconnected: Rc, mut cx: TestAppContext, @@ -5810,12 +5829,11 @@ mod tests { client: &mut TestClient, guest_id: usize, project: ModelHandle, - operations: Rc>, - max_operations: usize, + mut op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, cx: &mut TestAppContext, ) -> anyhow::Result<()> { - while operations.get() < max_operations { + while op_start_signal.next().await.is_some() { let buffer = if client.buffers.is_empty() || rng.lock().gen() { let worktree = if let Some(worktree) = project.read_with(cx, |project, cx| { @@ -5834,7 +5852,6 @@ mod tests { continue; }; - operations.set(operations.get() + 1); let (worktree_root_name, project_path) = worktree.read_with(cx, |worktree, _| { let entry = worktree @@ -5870,8 +5887,6 @@ mod tests { client.buffers.insert(buffer.clone()); buffer } else { - operations.set(operations.get() + 1); - client .buffers .iter() @@ -6073,8 +6088,7 @@ mod tests { &mut self, guest_id, project.clone(), - operations, - max_operations, + op_start_signal, rng, &mut cx, ) From c3927c541f612c45eb90decabd98b273925b38a0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 16:14:29 +0200 Subject: [PATCH 136/245] Simulate random guest disconnection and reconnection --- crates/server/src/rpc.rs | 216 ++++++++++++++++++++++++--------------- 1 file changed, 135 insertions(+), 81 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index e825f98bdd8250dd98f4948781ecabe121a504d3..c63f57f42c1735d2273d3ab0fc494c1e3e31d5e6 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1120,7 +1120,6 @@ mod tests { }, time::Duration, }; - use util::TryFutureExt; use workspace::{Item, SplitDirection, ToggleFollow, Workspace, WorkspaceParams}; #[cfg(test)] @@ -4981,6 +4980,8 @@ mod tests { let max_peers = env::var("MAX_PEERS") .map(|i| i.parse().expect("invalid `MAX_PEERS` variable")) .unwrap_or(5); + assert!(max_peers <= 5); + let max_operations = env::var("OPERATIONS") .map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .unwrap_or(10); @@ -4994,7 +4995,7 @@ mod tests { fs.insert_tree( "/_collab", json!({ - ".zed.toml": r#"collaborators = ["guest-1", "guest-2", "guest-3", "guest-4", "guest-5"]"# + ".zed.toml": r#"collaborators = ["guest-1", "guest-2", "guest-3", "guest-4"]"# }), ) .await; @@ -5170,7 +5171,6 @@ mod tests { }); host_language_registry.add(Arc::new(language)); - let host_disconnected = Rc::new(AtomicBool::new(false)); let op_start_signal = futures::channel::mpsc::unbounded(); user_ids.push(host.current_user_id(&host_cx)); op_start_signals.push(op_start_signal.0); @@ -5187,22 +5187,33 @@ mod tests { } else { max_operations }; + let mut available_guests = vec![ + "guest-1".to_string(), + "guest-2".to_string(), + "guest-3".to_string(), + "guest-4".to_string(), + ]; let mut operations = 0; while operations < max_operations { if operations == disconnect_host_at { - host_disconnected.store(true, SeqCst); server.disconnect_client(user_ids[0]); cx.foreground().advance_clock(RECEIVE_TIMEOUT); drop(op_start_signals); let mut clients = futures::future::join_all(clients).await; cx.foreground().run_until_parked(); - let (host, mut host_cx) = clients.remove(0); + let (host, mut host_cx, host_err) = clients.remove(0); + if let Some(host_err) = host_err { + log::error!("host error - {}", host_err); + } host.project .as_ref() .unwrap() .read_with(&host_cx, |project, _| assert!(!project.is_shared())); - for (guest, mut guest_cx) in clients { + for (guest, mut guest_cx, guest_err) in clients { + if let Some(guest_err) = guest_err { + log::error!("{} error - {}", guest.username, guest_err); + } let contacts = server .store .read() @@ -5225,9 +5236,10 @@ mod tests { let distribution = rng.lock().gen_range(0..100); match distribution { - 0..=19 if clients.len() < max_peers => { - let guest_id = clients.len(); - log::info!("Adding guest {}", guest_id); + 0..=19 if !available_guests.is_empty() => { + let guest_ix = rng.lock().gen_range(0..available_guests.len()); + let guest_username = available_guests.remove(guest_ix); + log::info!("Adding new connection for {}", guest_username); next_entity_id += 100000; let mut guest_cx = TestAppContext::new( cx.foreground_platform(), @@ -5238,9 +5250,7 @@ mod tests { cx.leak_detector(), next_entity_id, ); - let guest = server - .create_client(&mut guest_cx, &format!("guest-{}", guest_id)) - .await; + let guest = server.create_client(&mut guest_cx, &guest_username).await; let guest_project = Project::remote( host_project_id, guest.client.clone(), @@ -5255,15 +5265,54 @@ mod tests { user_ids.push(guest.current_user_id(&guest_cx)); op_start_signals.push(op_start_signal.0); clients.push(guest_cx.foreground().spawn(guest.simulate_guest( - guest_id, + guest_username.clone(), guest_project, op_start_signal.1, rng.clone(), - host_disconnected.clone(), guest_cx, ))); - log::info!("Guest {} added", guest_id); + log::info!("Added connection for {}", guest_username); + operations += 1; + } + 20..=30 if clients.len() > 1 => { + log::info!("Removing guest"); + let guest_ix = rng.lock().gen_range(1..clients.len()); + let removed_guest_id = user_ids.remove(guest_ix); + let guest = clients.remove(guest_ix); + op_start_signals.remove(guest_ix); + server.disconnect_client(removed_guest_id); + cx.foreground().advance_clock(RECEIVE_TIMEOUT); + let (guest, mut guest_cx, guest_err) = guest.await; + if let Some(guest_err) = guest_err { + log::error!("{} error - {}", guest.username, guest_err); + } + guest + .project + .as_ref() + .unwrap() + .read_with(&guest_cx, |project, _| assert!(project.is_read_only())); + for user_id in &user_ids { + for contact in server.store.read().contacts_for_user(*user_id) { + assert_ne!( + contact.user_id, removed_guest_id.0 as u64, + "removed guest is still a contact of another peer" + ); + for project in contact.projects { + for project_guest_id in project.guests { + assert_ne!( + project_guest_id, removed_guest_id.0 as u64, + "removed guest appears as still participating on a project" + ); + } + } + } + } + + log::info!("{} removed", guest.username); + available_guests.push(guest.username.clone()); + guest_cx.update(|_| drop(guest)); + operations += 1; } _ => { @@ -5287,7 +5336,10 @@ mod tests { let mut clients = futures::future::join_all(clients).await; cx.foreground().run_until_parked(); - let (host_client, mut host_cx) = clients.remove(0); + let (host_client, mut host_cx, host_err) = clients.remove(0); + if let Some(host_err) = host_err { + panic!("host error - {}", host_err); + } let host_project = host_client.project.as_ref().unwrap(); let host_worktree_snapshots = host_project.read_with(&host_cx, |project, cx| { project @@ -5305,8 +5357,10 @@ mod tests { .unwrap() .read_with(&host_cx, |project, cx| project.check_invariants(cx)); - for (guest_client, mut guest_cx) in clients.into_iter() { - let guest_id = guest_client.client.id(); + for (guest_client, mut guest_cx, guest_err) in clients.into_iter() { + if let Some(guest_err) = guest_err { + panic!("{} error - {}", guest_client.username, guest_err); + } let worktree_snapshots = guest_client .project @@ -5325,23 +5379,23 @@ mod tests { assert_eq!( worktree_snapshots.keys().collect::>(), host_worktree_snapshots.keys().collect::>(), - "guest {} has different worktrees than the host", - guest_id + "{} has different worktrees than the host", + guest_client.username ); for (id, host_snapshot) in &host_worktree_snapshots { let guest_snapshot = &worktree_snapshots[id]; assert_eq!( guest_snapshot.root_name(), host_snapshot.root_name(), - "guest {} has different root name than the host for worktree {}", - guest_id, + "{} has different root name than the host for worktree {}", + guest_client.username, id ); assert_eq!( guest_snapshot.entries(false).collect::>(), host_snapshot.entries(false).collect::>(), - "guest {} has different snapshot than the host for worktree {}", - guest_id, + "{} has different snapshot than the host for worktree {}", + guest_client.username, id ); } @@ -5357,7 +5411,7 @@ mod tests { let host_buffer = host_project.read_with(&host_cx, |project, cx| { project.buffer_for_id(buffer_id, cx).expect(&format!( "host does not have buffer for guest:{}, peer:{}, id:{}", - guest_id, guest_client.peer_id, buffer_id + guest_client.username, guest_client.peer_id, buffer_id )) }); let path = host_buffer @@ -5366,16 +5420,16 @@ mod tests { assert_eq!( guest_buffer.read_with(&guest_cx, |buffer, _| buffer.deferred_ops_len()), 0, - "guest {}, buffer {}, path {:?} has deferred operations", - guest_id, + "{}, buffer {}, path {:?} has deferred operations", + guest_client.username, buffer_id, path, ); assert_eq!( guest_buffer.read_with(&guest_cx, |buffer, _| buffer.text()), host_buffer.read_with(&host_cx, |buffer, _| buffer.text()), - "guest {}, buffer {}, path {:?}, differs from the host's buffer", - guest_id, + "{}, buffer {}, path {:?}, differs from the host's buffer", + guest_client.username, buffer_id, path ); @@ -5495,6 +5549,7 @@ mod tests { let client = TestClient { client, peer_id, + username: name.to_string(), user_store, language_registry: Arc::new(LanguageRegistry::test()), project: Default::default(), @@ -5571,6 +5626,7 @@ mod tests { struct TestClient { client: Arc, + username: String, pub peer_id: PeerId, pub user_store: ModelHandle, language_registry: Arc, @@ -5682,7 +5738,7 @@ mod tests { op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, mut cx: TestAppContext, - ) -> (Self, TestAppContext) { + ) -> (Self, TestAppContext, Option) { async fn simulate_host_internal( client: &mut TestClient, project: ModelHandle, @@ -5767,7 +5823,12 @@ mod tests { buffer.file().unwrap().full_path(cx), buffer.remote_id() ); - buffer.randomly_edit(&mut *rng.lock(), 5, cx) + + if rng.lock().gen_bool(0.7) { + buffer.randomly_edit(&mut *rng.lock(), 5, cx); + } else { + buffer.randomly_undo_redo(&mut *rng.lock(), cx); + } }); } } @@ -5801,7 +5862,7 @@ mod tests { Ok(()) } - simulate_host_internal( + let result = simulate_host_internal( &mut self, project.clone(), files, @@ -5809,25 +5870,23 @@ mod tests { rng, &mut cx, ) - .log_err() .await; log::info!("Host done"); self.project = Some(project); - (self, cx) + (self, cx, result.err()) } pub async fn simulate_guest( mut self, - guest_id: usize, + guest_username: String, project: ModelHandle, op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, - host_disconnected: Rc, mut cx: TestAppContext, - ) -> (Self, TestAppContext) { + ) -> (Self, TestAppContext, Option) { async fn simulate_guest_internal( client: &mut TestClient, - guest_id: usize, + guest_username: &str, project: ModelHandle, mut op_start_signal: futures::channel::mpsc::UnboundedReceiver<()>, rng: Arc>, @@ -5865,8 +5924,8 @@ mod tests { ) }); log::info!( - "Guest {}: opening path {:?} in worktree {} ({})", - guest_id, + "{}: opening path {:?} in worktree {} ({})", + guest_username, project_path.1, project_path.0, worktree_root_name, @@ -5877,8 +5936,8 @@ mod tests { }) .await?; log::info!( - "Guest {}: opened path {:?} in worktree {} ({}) with buffer id {}", - guest_id, + "{}: opened path {:?} in worktree {} ({}) with buffer id {}", + guest_username, project_path.1, project_path.0, worktree_root_name, @@ -5900,8 +5959,8 @@ mod tests { 0..=9 => { cx.update(|cx| { log::info!( - "Guest {}: dropping buffer {:?}", - guest_id, + "{}: dropping buffer {:?}", + guest_username, buffer.read(cx).file().unwrap().full_path(cx) ); client.buffers.remove(&buffer); @@ -5911,8 +5970,8 @@ mod tests { 10..=19 => { let completions = project.update(cx, |project, cx| { log::info!( - "Guest {}: requesting completions for buffer {} ({:?})", - guest_id, + "{}: requesting completions for buffer {} ({:?})", + guest_username, buffer.read(cx).remote_id(), buffer.read(cx).file().unwrap().full_path(cx) ); @@ -5925,7 +5984,7 @@ mod tests { .map_err(|err| anyhow!("completions request failed: {:?}", err)) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching completions request", guest_id); + log::info!("{}: detaching completions request", guest_username); cx.update(|cx| completions.detach_and_log_err(cx)); } else { completions.await?; @@ -5934,8 +5993,8 @@ mod tests { 20..=29 => { let code_actions = project.update(cx, |project, cx| { log::info!( - "Guest {}: requesting code actions for buffer {} ({:?})", - guest_id, + "{}: requesting code actions for buffer {} ({:?})", + guest_username, buffer.read(cx).remote_id(), buffer.read(cx).file().unwrap().full_path(cx) ); @@ -5948,7 +6007,7 @@ mod tests { }) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching code actions request", guest_id); + log::info!("{}: detaching code actions request", guest_username); cx.update(|cx| code_actions.detach_and_log_err(cx)); } else { code_actions.await?; @@ -5957,8 +6016,8 @@ mod tests { 30..=39 if buffer.read_with(cx, |buffer, _| buffer.is_dirty()) => { let (requested_version, save) = buffer.update(cx, |buffer, cx| { log::info!( - "Guest {}: saving buffer {} ({:?})", - guest_id, + "{}: saving buffer {} ({:?})", + guest_username, buffer.remote_id(), buffer.file().unwrap().full_path(cx) ); @@ -5972,7 +6031,7 @@ mod tests { Ok::<_, anyhow::Error>(()) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching save request", guest_id); + log::info!("{}: detaching save request", guest_username); cx.update(|cx| save.detach_and_log_err(cx)); } else { save.await?; @@ -5981,8 +6040,8 @@ mod tests { 40..=44 => { let prepare_rename = project.update(cx, |project, cx| { log::info!( - "Guest {}: preparing rename for buffer {} ({:?})", - guest_id, + "{}: preparing rename for buffer {} ({:?})", + guest_username, buffer.read(cx).remote_id(), buffer.read(cx).file().unwrap().full_path(cx) ); @@ -5995,7 +6054,7 @@ mod tests { }) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching prepare rename request", guest_id); + log::info!("{}: detaching prepare rename request", guest_username); cx.update(|cx| prepare_rename.detach_and_log_err(cx)); } else { prepare_rename.await?; @@ -6004,8 +6063,8 @@ mod tests { 45..=49 => { let definitions = project.update(cx, |project, cx| { log::info!( - "Guest {}: requesting definitions for buffer {} ({:?})", - guest_id, + "{}: requesting definitions for buffer {} ({:?})", + guest_username, buffer.read(cx).remote_id(), buffer.read(cx).file().unwrap().full_path(cx) ); @@ -6018,7 +6077,7 @@ mod tests { .map_err(|err| anyhow!("definitions request failed: {:?}", err)) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching definitions request", guest_id); + log::info!("{}: detaching definitions request", guest_username); cx.update(|cx| definitions.detach_and_log_err(cx)); } else { client @@ -6029,8 +6088,8 @@ mod tests { 50..=54 => { let highlights = project.update(cx, |project, cx| { log::info!( - "Guest {}: requesting highlights for buffer {} ({:?})", - guest_id, + "{}: requesting highlights for buffer {} ({:?})", + guest_username, buffer.read(cx).remote_id(), buffer.read(cx).file().unwrap().full_path(cx) ); @@ -6043,7 +6102,7 @@ mod tests { .map_err(|err| anyhow!("highlights request failed: {:?}", err)) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching highlights request", guest_id); + log::info!("{}: detaching highlights request", guest_username); cx.update(|cx| highlights.detach_and_log_err(cx)); } else { highlights.await?; @@ -6052,7 +6111,7 @@ mod tests { 55..=59 => { let search = project.update(cx, |project, cx| { let query = rng.lock().gen_range('a'..='z'); - log::info!("Guest {}: project-wide search {:?}", guest_id, query); + log::info!("{}: project-wide search {:?}", guest_username, query); project.search(SearchQuery::text(query, false, false), cx) }); let search = cx.background().spawn(async move { @@ -6061,7 +6120,7 @@ mod tests { .map_err(|err| anyhow!("search request failed: {:?}", err)) }); if rng.lock().gen_bool(0.3) { - log::info!("Guest {}: detaching search request", guest_id); + log::info!("{}: detaching search request", guest_username); cx.update(|cx| search.detach_and_log_err(cx)); } else { client.buffers.extend(search.await?.into_keys()); @@ -6070,12 +6129,16 @@ mod tests { _ => { buffer.update(cx, |buffer, cx| { log::info!( - "Guest {}: updating buffer {} ({:?})", - guest_id, + "{}: updating buffer {} ({:?})", + guest_username, buffer.remote_id(), buffer.file().unwrap().full_path(cx) ); - buffer.randomly_edit(&mut *rng.lock(), 5, cx) + if rng.lock().gen_bool(0.7) { + buffer.randomly_edit(&mut *rng.lock(), 5, cx); + } else { + buffer.randomly_undo_redo(&mut *rng.lock(), cx); + } }); } } @@ -6084,28 +6147,19 @@ mod tests { Ok(()) } - match simulate_guest_internal( + let result = simulate_guest_internal( &mut self, - guest_id, + &guest_username, project.clone(), op_start_signal, rng, &mut cx, ) - .await - { - Ok(()) => log::info!("guest {} done", guest_id), - Err(err) => { - if host_disconnected.load(SeqCst) { - log::error!("guest {} simulation error - {:?}", guest_id, err); - } else { - panic!("guest {} simulation error - {:?}", guest_id, err); - } - } - } + .await; + log::info!("{}: done", guest_username); self.project = Some(project); - (self, cx) + (self, cx, result.err()) } } From 273ee0ae58032d400b336d8e4f1344c27527a923 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 16:14:41 +0200 Subject: [PATCH 137/245] Acquire guest connection ids after save request has been forwarded This fixes a bug that would cause the server to broadcast the save message to guests that have potentially left the project. --- crates/server/src/rpc.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index c63f57f42c1735d2273d3ab0fc494c1e3e31d5e6..2fe0931c4ca8c6e97bfe1704e763a7f6d643e786 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -596,20 +596,19 @@ impl Server { self: Arc, request: TypedEnvelope, ) -> tide::Result { - let host; - let mut guests; - { - let state = self.state(); - let project = state.read_project(request.payload.project_id, request.sender_id)?; - host = project.host_connection_id; - guests = project.guest_connection_ids() - } - + let host = self + .state() + .read_project(request.payload.project_id, request.sender_id)? + .host_connection_id; let response = self .peer .forward_request(request.sender_id, host, request.payload.clone()) .await?; + let mut guests = self + .state() + .read_project(request.payload.project_id, request.sender_id)? + .connection_ids(); guests.retain(|guest_connection_id| *guest_connection_id != request.sender_id); broadcast(host, guests, |conn_id| { self.peer.forward_send(host, conn_id, response.clone()) From 9a8b0388fa0dd2f1f0bfd37685dccfed35f97012 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 17:38:17 +0200 Subject: [PATCH 138/245] Replace synchronous `Store` lock with an async lock This also fixes some failures due to `broadcast` and `update_contacts_for_users` being fallible. As part of this commit, these two functions don't return `Result` anymore: the reason for this change is that we don't want a request to fail only because a peer disconnected while we were trying to broadcast a message to them. --- crates/server/Cargo.toml | 1 + crates/server/src/rpc.rs | 256 ++++++++++++++++++++++----------- crates/server/src/rpc/store.rs | 25 +--- 3 files changed, 178 insertions(+), 104 deletions(-) diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index e0834b76c5ecb1c518e918a70af78824685e6f42..7c9bb8078597f1bbf37dcb2312d19eb594d94cf2 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -15,6 +15,7 @@ required-features = ["seed-support"] [dependencies] collections = { path = "../collections" } rpc = { path = "../rpc" } +util = { path = "../util" } anyhow = "1.0.40" async-io = "1.3" async-std = { version = "1.8.0", features = ["attributes"] } diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 2fe0931c4ca8c6e97bfe1704e763a7f6d643e786..0ffcde9176890ad2b541772f9a828f049823b15c 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -7,12 +7,14 @@ use super::{ }; use anyhow::anyhow; use async_io::Timer; -use async_std::task; +use async_std::{ + sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}, + task, +}; use async_tungstenite::{tungstenite::protocol::Role, WebSocketStream}; use collections::{HashMap, HashSet}; use futures::{channel::mpsc, future::BoxFuture, FutureExt, SinkExt, StreamExt}; use log::{as_debug, as_display}; -use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use rpc::{ proto::{self, AnyTypedEnvelope, EntityMessage, EnvelopedMessage, RequestMessage}, Connection, ConnectionId, Peer, TypedEnvelope, @@ -21,6 +23,9 @@ use sha1::{Digest as _, Sha1}; use std::{ any::TypeId, future::Future, + marker::PhantomData, + ops::{Deref, DerefMut}, + rc::Rc, sync::Arc, time::{Duration, Instant}, }; @@ -31,6 +36,7 @@ use tide::{ Request, Response, }; use time::OffsetDateTime; +use util::ResultExt; type MessageHandler = Box< dyn Send @@ -58,6 +64,16 @@ pub struct RealExecutor; const MESSAGE_COUNT_PER_PAGE: usize = 100; const MAX_MESSAGE_LEN: usize = 1024; +struct StoreReadGuard<'a> { + guard: RwLockReadGuard<'a, Store>, + _not_send: PhantomData>, +} + +struct StoreWriteGuard<'a> { + guard: RwLockWriteGuard<'a, Store>, + _not_send: PhantomData>, +} + impl Server { pub fn new( app_state: Arc, @@ -197,10 +213,10 @@ impl Server { let _ = send_connection_id.send(connection_id).await; } - this.state_mut().add_connection(connection_id, user_id); - if let Err(err) = this.update_contacts_for_users(&[user_id]) { - log::error!("error updating contacts for {:?}: {}", user_id, err); - } + this.state_mut() + .await + .add_connection(connection_id, user_id); + this.update_contacts_for_users(&[user_id]).await; let handle_io = handle_io.fuse(); futures::pin_mut!(handle_io); @@ -257,7 +273,7 @@ impl Server { async fn sign_out(self: &mut Arc, connection_id: ConnectionId) -> tide::Result<()> { self.peer.disconnect(connection_id); - let removed_connection = self.state_mut().remove_connection(connection_id)?; + let removed_connection = self.state_mut().await.remove_connection(connection_id)?; for (project_id, project) in removed_connection.hosted_projects { if let Some(share) = project.share { @@ -268,7 +284,7 @@ impl Server { self.peer .send(conn_id, proto::UnshareProject { project_id }) }, - )?; + ); } } @@ -281,10 +297,11 @@ impl Server { peer_id: connection_id.0, }, ) - })?; + }); } - self.update_contacts_for_users(removed_connection.contact_ids.iter())?; + self.update_contacts_for_users(removed_connection.contact_ids.iter()) + .await; Ok(()) } @@ -297,7 +314,7 @@ impl Server { request: TypedEnvelope, ) -> tide::Result { let project_id = { - let mut state = self.state_mut(); + let mut state = self.state_mut().await; let user_id = state.user_id_for_connection(request.sender_id)?; state.register_project(request.sender_id, user_id) }; @@ -310,8 +327,10 @@ impl Server { ) -> tide::Result<()> { let project = self .state_mut() + .await .unregister_project(request.payload.project_id, request.sender_id)?; - self.update_contacts_for_users(project.authorized_user_ids().iter())?; + self.update_contacts_for_users(project.authorized_user_ids().iter()) + .await; Ok(()) } @@ -320,6 +339,7 @@ impl Server { request: TypedEnvelope, ) -> tide::Result { self.state_mut() + .await .share_project(request.payload.project_id, request.sender_id); Ok(proto::Ack {}) } @@ -331,13 +351,15 @@ impl Server { let project_id = request.payload.project_id; let project = self .state_mut() + .await .unshare_project(project_id, request.sender_id)?; broadcast(request.sender_id, project.connection_ids, |conn_id| { self.peer .send(conn_id, proto::UnshareProject { project_id }) - })?; - self.update_contacts_for_users(&project.authorized_user_ids)?; + }); + self.update_contacts_for_users(&project.authorized_user_ids) + .await; Ok(()) } @@ -347,9 +369,13 @@ impl Server { ) -> tide::Result { let project_id = request.payload.project_id; - let user_id = self.state().user_id_for_connection(request.sender_id)?; + let user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let (response, connection_ids, contact_user_ids) = self .state_mut() + .await .join_project(request.sender_id, user_id, project_id) .and_then(|joined| { let share = joined.project.share()?; @@ -410,8 +436,8 @@ impl Server { }), }, ) - })?; - self.update_contacts_for_users(&contact_user_ids)?; + }); + self.update_contacts_for_users(&contact_user_ids).await; Ok(response) } @@ -421,7 +447,10 @@ impl Server { ) -> tide::Result<()> { let sender_id = request.sender_id; let project_id = request.payload.project_id; - let worktree = self.state_mut().leave_project(sender_id, project_id)?; + let worktree = self + .state_mut() + .await + .leave_project(sender_id, project_id)?; broadcast(sender_id, worktree.connection_ids, |conn_id| { self.peer.send( @@ -431,8 +460,9 @@ impl Server { peer_id: sender_id.0, }, ) - })?; - self.update_contacts_for_users(&worktree.authorized_user_ids)?; + }); + self.update_contacts_for_users(&worktree.authorized_user_ids) + .await; Ok(()) } @@ -441,7 +471,10 @@ impl Server { mut self: Arc, request: TypedEnvelope, ) -> tide::Result { - let host_user_id = self.state().user_id_for_connection(request.sender_id)?; + let host_user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let mut contact_user_ids = HashSet::default(); contact_user_ids.insert(host_user_id); @@ -453,7 +486,7 @@ impl Server { let contact_user_ids = contact_user_ids.into_iter().collect::>(); let guest_connection_ids; { - let mut state = self.state_mut(); + let mut state = self.state_mut().await; guest_connection_ids = state .read_project(request.payload.project_id, request.sender_id)? .guest_connection_ids(); @@ -471,8 +504,8 @@ impl Server { broadcast(request.sender_id, guest_connection_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; - self.update_contacts_for_users(&contact_user_ids)?; + }); + self.update_contacts_for_users(&contact_user_ids).await; Ok(proto::Ack {}) } @@ -482,9 +515,11 @@ impl Server { ) -> tide::Result<()> { let project_id = request.payload.project_id; let worktree_id = request.payload.worktree_id; - let (worktree, guest_connection_ids) = - self.state_mut() - .unregister_worktree(project_id, worktree_id, request.sender_id)?; + let (worktree, guest_connection_ids) = self.state_mut().await.unregister_worktree( + project_id, + worktree_id, + request.sender_id, + )?; broadcast(request.sender_id, guest_connection_ids, |conn_id| { self.peer.send( conn_id, @@ -493,8 +528,9 @@ impl Server { worktree_id, }, ) - })?; - self.update_contacts_for_users(&worktree.authorized_user_ids)?; + }); + self.update_contacts_for_users(&worktree.authorized_user_ids) + .await; Ok(()) } @@ -502,7 +538,7 @@ impl Server { mut self: Arc, request: TypedEnvelope, ) -> tide::Result { - let connection_ids = self.state_mut().update_worktree( + let connection_ids = self.state_mut().await.update_worktree( request.sender_id, request.payload.project_id, request.payload.worktree_id, @@ -513,7 +549,7 @@ impl Server { broadcast(request.sender_id, connection_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(proto::Ack {}) } @@ -527,7 +563,7 @@ impl Server { .summary .clone() .ok_or_else(|| anyhow!("invalid summary"))?; - let receiver_ids = self.state_mut().update_diagnostic_summary( + let receiver_ids = self.state_mut().await.update_diagnostic_summary( request.payload.project_id, request.payload.worktree_id, request.sender_id, @@ -537,7 +573,7 @@ impl Server { broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -545,7 +581,7 @@ impl Server { mut self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { - let receiver_ids = self.state_mut().start_language_server( + let receiver_ids = self.state_mut().await.start_language_server( request.payload.project_id, request.sender_id, request @@ -557,7 +593,7 @@ impl Server { broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -567,11 +603,12 @@ impl Server { ) -> tide::Result<()> { let receiver_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -584,6 +621,7 @@ impl Server { { let host_connection_id = self .state() + .await .read_project(request.payload.remote_entity_id(), request.sender_id)? .host_connection_id; Ok(self @@ -598,6 +636,7 @@ impl Server { ) -> tide::Result { let host = self .state() + .await .read_project(request.payload.project_id, request.sender_id)? .host_connection_id; let response = self @@ -607,12 +646,13 @@ impl Server { let mut guests = self .state() + .await .read_project(request.payload.project_id, request.sender_id)? .connection_ids(); guests.retain(|guest_connection_id| *guest_connection_id != request.sender_id); broadcast(host, guests, |conn_id| { self.peer.forward_send(host, conn_id, response.clone()) - })?; + }); Ok(response) } @@ -623,11 +663,12 @@ impl Server { ) -> tide::Result { let receiver_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(proto::Ack {}) } @@ -637,11 +678,12 @@ impl Server { ) -> tide::Result<()> { let receiver_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -651,11 +693,12 @@ impl Server { ) -> tide::Result<()> { let receiver_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -665,11 +708,12 @@ impl Server { ) -> tide::Result<()> { let receiver_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; broadcast(request.sender_id, receiver_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) - })?; + }); Ok(()) } @@ -681,6 +725,7 @@ impl Server { let follower_id = request.sender_id; if !self .state() + .await .project_connection_ids(request.payload.project_id, follower_id)? .contains(&leader_id) { @@ -703,6 +748,7 @@ impl Server { let leader_id = ConnectionId(request.payload.leader_id); if !self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)? .contains(&leader_id) { @@ -719,6 +765,7 @@ impl Server { ) -> tide::Result<()> { let connection_ids = self .state() + .await .project_connection_ids(request.payload.project_id, request.sender_id)?; let leader_id = request .payload @@ -743,7 +790,10 @@ impl Server { self: Arc, request: TypedEnvelope, ) -> tide::Result { - let user_id = self.state().user_id_for_connection(request.sender_id)?; + let user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let channels = self.app_state.db.get_accessible_channels(user_id).await?; Ok(proto::GetChannelsResponse { channels: channels @@ -781,33 +831,34 @@ impl Server { Ok(proto::GetUsersResponse { users }) } - fn update_contacts_for_users<'a>( + async fn update_contacts_for_users<'a>( self: &Arc, user_ids: impl IntoIterator, - ) -> anyhow::Result<()> { - let mut result = Ok(()); - let state = self.state(); + ) { + let state = self.state().await; for user_id in user_ids { let contacts = state.contacts_for_user(*user_id); for connection_id in state.connection_ids_for_user(*user_id) { - if let Err(error) = self.peer.send( - connection_id, - proto::UpdateContacts { - contacts: contacts.clone(), - }, - ) { - result = Err(error); - } + self.peer + .send( + connection_id, + proto::UpdateContacts { + contacts: contacts.clone(), + }, + ) + .log_err(); } } - result } async fn join_channel( mut self: Arc, request: TypedEnvelope, ) -> tide::Result { - let user_id = self.state().user_id_for_connection(request.sender_id)?; + let user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let channel_id = ChannelId::from_proto(request.payload.channel_id); if !self .app_state @@ -818,7 +869,9 @@ impl Server { Err(anyhow!("access denied"))?; } - self.state_mut().join_channel(request.sender_id, channel_id); + self.state_mut() + .await + .join_channel(request.sender_id, channel_id); let messages = self .app_state .db @@ -843,7 +896,10 @@ impl Server { mut self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { - let user_id = self.state().user_id_for_connection(request.sender_id)?; + let user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let channel_id = ChannelId::from_proto(request.payload.channel_id); if !self .app_state @@ -855,6 +911,7 @@ impl Server { } self.state_mut() + .await .leave_channel(request.sender_id, channel_id); Ok(()) @@ -868,7 +925,7 @@ impl Server { let user_id; let connection_ids; { - let state = self.state(); + let state = self.state().await; user_id = state.user_id_for_connection(request.sender_id)?; connection_ids = state.channel_connection_ids(channel_id)?; } @@ -909,7 +966,7 @@ impl Server { message: Some(message.clone()), }, ) - })?; + }); Ok(proto::SendChannelMessageResponse { message: Some(message), }) @@ -919,7 +976,10 @@ impl Server { self: Arc, request: TypedEnvelope, ) -> tide::Result { - let user_id = self.state().user_id_for_connection(request.sender_id)?; + let user_id = self + .state() + .await + .user_id_for_connection(request.sender_id)?; let channel_id = ChannelId::from_proto(request.payload.channel_id); if !self .app_state @@ -955,12 +1015,57 @@ impl Server { }) } - fn state<'a>(self: &'a Arc) -> RwLockReadGuard<'a, Store> { - self.store.read() + async fn state<'a>(self: &'a Arc) -> StoreReadGuard<'a> { + #[cfg(test)] + async_std::task::yield_now().await; + let guard = self.store.read().await; + #[cfg(test)] + async_std::task::yield_now().await; + StoreReadGuard { + guard, + _not_send: PhantomData, + } + } + + async fn state_mut<'a>(self: &'a mut Arc) -> StoreWriteGuard<'a> { + #[cfg(test)] + async_std::task::yield_now().await; + let guard = self.store.write().await; + #[cfg(test)] + async_std::task::yield_now().await; + StoreWriteGuard { + guard, + _not_send: PhantomData, + } + } +} + +impl<'a> Deref for StoreReadGuard<'a> { + type Target = Store; + + fn deref(&self) -> &Self::Target { + &*self.guard + } +} + +impl<'a> Deref for StoreWriteGuard<'a> { + type Target = Store; + + fn deref(&self) -> &Self::Target { + &*self.guard } +} - fn state_mut<'a>(self: &'a mut Arc) -> RwLockWriteGuard<'a, Store> { - self.store.write() +impl<'a> DerefMut for StoreWriteGuard<'a> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut *self.guard + } +} + +impl<'a> Drop for StoreWriteGuard<'a> { + fn drop(&mut self) { + #[cfg(test)] + self.check_invariants(); } } @@ -976,25 +1081,15 @@ impl Executor for RealExecutor { } } -fn broadcast( - sender_id: ConnectionId, - receiver_ids: Vec, - mut f: F, -) -> anyhow::Result<()> +fn broadcast(sender_id: ConnectionId, receiver_ids: Vec, mut f: F) where F: FnMut(ConnectionId) -> anyhow::Result<()>, { - let mut result = Ok(()); for receiver_id in receiver_ids { if receiver_id != sender_id { - if let Err(error) = f(receiver_id) { - if result.is_ok() { - result = Err(error); - } - } + f(receiver_id).log_err(); } } - result } pub fn add_routes(app: &mut tide::Server>, rpc: &Arc) { @@ -5216,6 +5311,7 @@ mod tests { let contacts = server .store .read() + .await .contacts_for_user(guest.current_user_id(&guest_cx)); assert!(!contacts .iter() @@ -5292,7 +5388,7 @@ mod tests { .unwrap() .read_with(&guest_cx, |project, _| assert!(project.is_read_only())); for user_id in &user_ids { - for contact in server.store.read().contacts_for_user(*user_id) { + for contact in server.store.read().await.contacts_for_user(*user_id) { assert_ne!( contact.user_id, removed_guest_id.0 as u64, "removed guest is still a contact of another peer" @@ -5590,7 +5686,7 @@ mod tests { } async fn state<'a>(&'a self) -> RwLockReadGuard<'a, Store> { - self.server.store.read() + self.server.store.read().await } async fn condition(&mut self, mut predicate: F) @@ -5598,7 +5694,7 @@ mod tests { F: FnMut(&Store) -> bool, { async_std::future::timeout(Duration::from_millis(500), async { - while !(predicate)(&*self.server.store.read()) { + while !(predicate)(&*self.server.store.read().await) { self.foreground.start_waiting(); self.notifications.next().await; self.foreground.finish_waiting(); diff --git a/crates/server/src/rpc/store.rs b/crates/server/src/rpc/store.rs index 6c330c9c8bae3e3558280ea940fc180207ce5c70..33d2a399816ad90f6e809373e8ece3ca67c8046e 100644 --- a/crates/server/src/rpc/store.rs +++ b/crates/server/src/rpc/store.rs @@ -130,9 +130,6 @@ impl Store { } } - #[cfg(test)] - self.check_invariants(); - Ok(result) } @@ -275,8 +272,6 @@ impl Store { share.worktrees.insert(worktree_id, Default::default()); } - #[cfg(test)] - self.check_invariants(); Ok(()) } else { Err(anyhow!("no such project"))? @@ -313,8 +308,6 @@ impl Store { } } - #[cfg(test)] - self.check_invariants(); Ok(project) } else { Err(anyhow!("no such project"))? @@ -359,9 +352,6 @@ impl Store { } } - #[cfg(test)] - self.check_invariants(); - Ok((worktree, guest_connection_ids)) } @@ -403,9 +393,6 @@ impl Store { } } - #[cfg(test)] - self.check_invariants(); - Ok(UnsharedProject { connection_ids, authorized_user_ids, @@ -491,9 +478,6 @@ impl Store { share.active_replica_ids.insert(replica_id); share.guests.insert(connection_id, (replica_id, user_id)); - #[cfg(test)] - self.check_invariants(); - Ok(JoinedProject { replica_id, project: &self.projects[&project_id], @@ -526,9 +510,6 @@ impl Store { let connection_ids = project.connection_ids(); let authorized_user_ids = project.authorized_user_ids(); - #[cfg(test)] - self.check_invariants(); - Ok(LeftProject { connection_ids, authorized_user_ids, @@ -556,10 +537,6 @@ impl Store { worktree.entries.insert(entry.id, entry.clone()); } let connection_ids = project.connection_ids(); - - #[cfg(test)] - self.check_invariants(); - Ok(connection_ids) } @@ -633,7 +610,7 @@ impl Store { } #[cfg(test)] - fn check_invariants(&self) { + pub fn check_invariants(&self) { for (connection_id, connection) in &self.connections { for project_id in &connection.projects { let project = &self.projects.get(&project_id).unwrap(); From 3c116e32cbe1013e917414ad2c297d7bea93abb5 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 11 Apr 2022 10:13:07 -0700 Subject: [PATCH 139/245] Reraise editor events in Project Search and activate workspace item from them --- crates/search/src/project_search.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 9009dfee79493b493868b6ba930fe0186709b99e..d89982a92c553a7515914c7958570ca887b939d6 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -139,6 +139,7 @@ impl ProjectSearch { pub enum ViewEvent { UpdateTab, + EditorEvent(editor::Event), } impl Entity for ProjectSearchView { @@ -307,6 +308,14 @@ impl Item for ProjectSearchView { .update(cx, |editor, cx| editor.navigate(data, cx)) } + fn should_activate_item_on_event(event: &Self::Event) -> bool { + if let ViewEvent::EditorEvent(editor_event) = event { + Editor::should_activate_item_on_event(editor_event) + } else { + false + } + } + fn should_update_tab_on_event(event: &ViewEvent) -> bool { matches!(event, ViewEvent::UpdateTab) } @@ -341,6 +350,11 @@ impl ProjectSearchView { editor.set_text(query_text, cx); editor }); + // Subcribe to query_editor in order to reraise editor events for workspace item activation purposes + cx.subscribe(&query_editor, |_, _, event, cx| { + cx.emit(ViewEvent::EditorEvent(event.clone())) + }) + .detach(); let results_editor = cx.add_view(|cx| { let mut editor = Editor::for_multibuffer(excerpts, Some(project), cx); @@ -353,6 +367,8 @@ impl ProjectSearchView { if matches!(event, editor::Event::SelectionsChanged { .. }) { this.update_match_index(cx); } + // Reraise editor events for workspace item activation purposes + cx.emit(ViewEvent::EditorEvent(event.clone())); }) .detach(); From 7abd3a98a85cf5a5990c4e2ae027cf19b488aed6 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 6 Apr 2022 21:28:46 -0700 Subject: [PATCH 140/245] Make atlas allocation fallable and skip rendering icons and paths when it fails --- crates/gpui/src/platform/mac/atlas.rs | 24 ++++++-------- crates/gpui/src/platform/mac/image_cache.rs | 5 ++- crates/gpui/src/platform/mac/renderer.rs | 12 ++++++- crates/gpui/src/platform/mac/sprite_cache.rs | 33 +++++++++++--------- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/crates/gpui/src/platform/mac/atlas.rs b/crates/gpui/src/platform/mac/atlas.rs index 33f6fc19db55077ee6cc03cb32c465ce8f6cad74..569a9646702fdb0374dfea1c1a0dce2dd9793806 100644 --- a/crates/gpui/src/platform/mac/atlas.rs +++ b/crates/gpui/src/platform/mac/atlas.rs @@ -2,7 +2,6 @@ use crate::geometry::{ rect::RectI, vector::{vec2i, Vector2I}, }; -use anyhow::anyhow; use etagere::BucketedAtlasAllocator; use foreign_types::ForeignType; use metal::{Device, TextureDescriptor}; @@ -41,36 +40,31 @@ impl AtlasAllocator { ) } - pub fn allocate(&mut self, requested_size: Vector2I) -> (AllocId, Vector2I) { + pub fn allocate(&mut self, requested_size: Vector2I) -> Option<(AllocId, Vector2I)> { let (alloc_id, origin) = self .atlases .last_mut() .unwrap() .allocate(requested_size) - .unwrap_or_else(|| { + .or_else(|| { let mut atlas = self.new_atlas(requested_size); - let (id, origin) = atlas - .allocate(requested_size) - .ok_or_else(|| { - anyhow!("could not allocate requested size {:?}", requested_size) - }) - .unwrap(); + let (id, origin) = atlas.allocate(requested_size)?; self.atlases.push(atlas); - (id, origin) - }); + Some((id, origin)) + })?; let id = AllocId { atlas_id: self.atlases.len() - 1, alloc_id, }; - (id, origin) + Some((id, origin)) } - pub fn upload(&mut self, size: Vector2I, bytes: &[u8]) -> (AllocId, RectI) { - let (alloc_id, origin) = self.allocate(size); + pub fn upload(&mut self, size: Vector2I, bytes: &[u8]) -> Option<(AllocId, RectI)> { + let (alloc_id, origin) = self.allocate(size)?; let bounds = RectI::new(origin, size); self.atlases[alloc_id.atlas_id].upload(bounds, bytes); - (alloc_id, bounds) + Some((alloc_id, bounds)) } pub fn deallocate(&mut self, id: AllocId) { diff --git a/crates/gpui/src/platform/mac/image_cache.rs b/crates/gpui/src/platform/mac/image_cache.rs index dac2e1a38b24051e983f54152a6e57c2926819b3..14b7b239860e8d6a7b295a86b73101273149144f 100644 --- a/crates/gpui/src/platform/mac/image_cache.rs +++ b/crates/gpui/src/platform/mac/image_cache.rs @@ -1,3 +1,4 @@ +use anyhow::anyhow; use metal::{MTLPixelFormat, TextureDescriptor, TextureRef}; use super::atlas::{AllocId, AtlasAllocator}; @@ -31,7 +32,9 @@ impl ImageCache { .prev_frame .remove(&image.id) .or_else(|| self.curr_frame.get(&image.id).copied()) - .unwrap_or_else(|| self.atlases.upload(image.size(), image.as_bytes())); + .or_else(|| self.atlases.upload(image.size(), image.as_bytes())) + .ok_or_else(|| anyhow!("Could not upload image of size {:?}", image.size())) + .unwrap(); self.curr_frame.insert(image.id, (alloc_id, atlas_bounds)); (alloc_id, atlas_bounds) } diff --git a/crates/gpui/src/platform/mac/renderer.rs b/crates/gpui/src/platform/mac/renderer.rs index 873586b61e35b6e1c5eebd0728213feb0bc1ebc0..0ecee57a09ad7731bd93e3a0adfc2dab99bf133d 100644 --- a/crates/gpui/src/platform/mac/renderer.rs +++ b/crates/gpui/src/platform/mac/renderer.rs @@ -172,7 +172,13 @@ impl Renderer { for path in layer.paths() { let origin = path.bounds.origin() * scene.scale_factor(); let size = (path.bounds.size() * scene.scale_factor()).ceil(); - let (alloc_id, atlas_origin) = self.path_atlases.allocate(size.to_i32()); + + let path_allocation = self.path_atlases.allocate(size.to_i32()); + if path_allocation.is_none() { + // Path size was likely zero. + continue; + } + let (alloc_id, atlas_origin) = path_allocation.unwrap(); let atlas_origin = atlas_origin.to_f32(); sprites.push(PathSprite { layer_id, @@ -569,6 +575,10 @@ impl Renderer { let sprite = self.sprite_cache .render_icon(source_size, icon.path.clone(), icon.svg.clone()); + if sprite.is_none() { + continue; + } + let sprite = sprite.unwrap(); sprites_by_atlas .entry(sprite.atlas_id) diff --git a/crates/gpui/src/platform/mac/sprite_cache.rs b/crates/gpui/src/platform/mac/sprite_cache.rs index 17fec020668e16fdb8995dd8c5be631d0501c445..2d2a604f6890af636b3231eef713af398656486b 100644 --- a/crates/gpui/src/platform/mac/sprite_cache.rs +++ b/crates/gpui/src/platform/mac/sprite_cache.rs @@ -4,6 +4,7 @@ use crate::{ geometry::vector::{vec2f, Vector2F, Vector2I}, platform, }; +use collections::hash_map::Entry; use metal::{MTLPixelFormat, TextureDescriptor}; use ordered_float::OrderedFloat; use std::{borrow::Cow, collections::HashMap, sync::Arc}; @@ -114,7 +115,9 @@ impl SpriteCache { scale_factor, )?; - let (alloc_id, atlas_bounds) = atlases.upload(glyph_bounds.size(), &mask); + let (alloc_id, atlas_bounds) = atlases + .upload(glyph_bounds.size(), &mask) + .expect("Could not upload glyph"); Some(GlyphSprite { atlas_id: alloc_id.atlas_id, atlas_origin: atlas_bounds.origin(), @@ -130,15 +133,15 @@ impl SpriteCache { size: Vector2I, path: Cow<'static, str>, svg: usvg::Tree, - ) -> IconSprite { + ) -> Option { let atlases = &mut self.atlases; - self.icons - .entry(IconDescriptor { - path, - width: size.x(), - height: size.y(), - }) - .or_insert_with(|| { + match self.icons.entry(IconDescriptor { + path, + width: size.x(), + height: size.y(), + }) { + Entry::Occupied(entry) => Some(entry.get().clone()), + Entry::Vacant(entry) => { let mut pixmap = tiny_skia::Pixmap::new(size.x() as u32, size.y() as u32).unwrap(); resvg::render(&svg, usvg::FitTo::Width(size.x() as u32), pixmap.as_mut()); let mask = pixmap @@ -146,15 +149,15 @@ impl SpriteCache { .iter() .map(|a| a.alpha()) .collect::>(); - - let (alloc_id, atlas_bounds) = atlases.upload(size, &mask); - IconSprite { + let (alloc_id, atlas_bounds) = atlases.upload(size, &mask)?; + let icon_sprite = IconSprite { atlas_id: alloc_id.atlas_id, atlas_origin: atlas_bounds.origin(), size, - } - }) - .clone() + }; + Some(entry.insert(icon_sprite).clone()) + } + } } pub fn atlas_texture(&self, atlas_id: usize) -> Option<&metal::TextureRef> { From 3844634765a64fc2655ea89dec625fba436f9978 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Apr 2022 19:30:52 +0200 Subject: [PATCH 141/245] Hold the state lock while responding to guest joining a project Co-Authored-By: Nathan Sobo --- crates/server/src/rpc.rs | 74 ++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 0ffcde9176890ad2b541772f9a828f049823b15c..1c4c76349da952cf6a55e9f21c4405dc260a1423 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -94,7 +94,7 @@ impl Server { .add_message_handler(Server::unregister_project) .add_request_handler(Server::share_project) .add_message_handler(Server::unshare_project) - .add_request_handler(Server::join_project) + .add_sync_request_handler(Server::join_project) .add_message_handler(Server::leave_project) .add_request_handler(Server::register_worktree) .add_message_handler(Server::unregister_worktree) @@ -186,6 +186,42 @@ impl Server { }) } + /// Handle a request while holding a lock to the store. This is useful when we're registering + /// a connection but we want to respond on the connection before anybody else can send on it. + fn add_sync_request_handler(&mut self, handler: F) -> &mut Self + where + F: 'static + + Send + + Sync + + Fn(Arc, &mut Store, TypedEnvelope) -> tide::Result, + M: RequestMessage, + { + let handler = Arc::new(handler); + self.add_message_handler(move |server, envelope| { + let receipt = envelope.receipt(); + let handler = handler.clone(); + async move { + let mut store = server.store.write().await; + let response = (handler)(server.clone(), &mut *store, envelope); + match response { + Ok(response) => { + server.peer.respond(receipt, response)?; + Ok(()) + } + Err(error) => { + server.peer.respond_with_error( + receipt, + proto::Error { + message: error.to_string(), + }, + )?; + Err(error) + } + } + } + }) + } + pub fn handle_connection( self: &Arc, connection: Connection, @@ -363,19 +399,15 @@ impl Server { Ok(()) } - async fn join_project( - mut self: Arc, + fn join_project( + self: Arc, + state: &mut Store, request: TypedEnvelope, ) -> tide::Result { let project_id = request.payload.project_id; - let user_id = self - .state() - .await - .user_id_for_connection(request.sender_id)?; - let (response, connection_ids, contact_user_ids) = self - .state_mut() - .await + let user_id = state.user_id_for_connection(request.sender_id)?; + let (response, connection_ids, contact_user_ids) = state .join_project(request.sender_id, user_id, project_id) .and_then(|joined| { let share = joined.project.share()?; @@ -437,7 +469,7 @@ impl Server { }, ) }); - self.update_contacts_for_users(&contact_user_ids).await; + self.update_contacts_for_users_sync(state, &contact_user_ids); Ok(response) } @@ -851,6 +883,26 @@ impl Server { } } + fn update_contacts_for_users_sync<'a>( + self: &Arc, + state: &Store, + user_ids: impl IntoIterator, + ) { + for user_id in user_ids { + let contacts = state.contacts_for_user(*user_id); + for connection_id in state.connection_ids_for_user(*user_id) { + self.peer + .send( + connection_id, + proto::UpdateContacts { + contacts: contacts.clone(), + }, + ) + .log_err(); + } + } + } + async fn join_channel( mut self: Arc, request: TypedEnvelope, From 0ca4c9946a0b01d261a725d2f81858a801cfb23d Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 11 Apr 2022 10:31:38 -0700 Subject: [PATCH 142/245] Add logging when atlas allocator fails to allocate --- crates/gpui/src/platform/mac/atlas.rs | 14 ++++++++++++-- crates/gpui/src/platform/mac/image_cache.rs | 2 +- crates/gpui/src/platform/mac/renderer.rs | 2 ++ crates/gpui/src/platform/mac/sprite_cache.rs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/platform/mac/atlas.rs b/crates/gpui/src/platform/mac/atlas.rs index 569a9646702fdb0374dfea1c1a0dce2dd9793806..a7a4de10006a7118469346e94e67898da1a8d0ca 100644 --- a/crates/gpui/src/platform/mac/atlas.rs +++ b/crates/gpui/src/platform/mac/atlas.rs @@ -4,6 +4,7 @@ use crate::geometry::{ }; use etagere::BucketedAtlasAllocator; use foreign_types::ForeignType; +use log::warn; use metal::{Device, TextureDescriptor}; use objc::{msg_send, sel, sel_impl}; @@ -41,7 +42,7 @@ impl AtlasAllocator { } pub fn allocate(&mut self, requested_size: Vector2I) -> Option<(AllocId, Vector2I)> { - let (alloc_id, origin) = self + let allocation = self .atlases .last_mut() .unwrap() @@ -51,7 +52,16 @@ impl AtlasAllocator { let (id, origin) = atlas.allocate(requested_size)?; self.atlases.push(atlas); Some((id, origin)) - })?; + }); + + if allocation.is_none() { + warn!( + "allocation of size {:?} could not be created", + requested_size, + ); + } + + let (alloc_id, origin) = allocation?; let id = AllocId { atlas_id: self.atlases.len() - 1, diff --git a/crates/gpui/src/platform/mac/image_cache.rs b/crates/gpui/src/platform/mac/image_cache.rs index 14b7b239860e8d6a7b295a86b73101273149144f..37129d4feafae5d782affd522d5e0573134ae8cf 100644 --- a/crates/gpui/src/platform/mac/image_cache.rs +++ b/crates/gpui/src/platform/mac/image_cache.rs @@ -33,7 +33,7 @@ impl ImageCache { .remove(&image.id) .or_else(|| self.curr_frame.get(&image.id).copied()) .or_else(|| self.atlases.upload(image.size(), image.as_bytes())) - .ok_or_else(|| anyhow!("Could not upload image of size {:?}", image.size())) + .ok_or_else(|| anyhow!("could not upload image of size {:?}", image.size())) .unwrap(); self.curr_frame.insert(image.id, (alloc_id, atlas_bounds)); (alloc_id, atlas_bounds) diff --git a/crates/gpui/src/platform/mac/renderer.rs b/crates/gpui/src/platform/mac/renderer.rs index 0ecee57a09ad7731bd93e3a0adfc2dab99bf133d..b06dabc738c4c86aadc18d0491c88e3cbb316f74 100644 --- a/crates/gpui/src/platform/mac/renderer.rs +++ b/crates/gpui/src/platform/mac/renderer.rs @@ -9,6 +9,7 @@ use crate::{ scene::{Glyph, Icon, Image, Layer, Quad, Scene, Shadow, Underline}, }; use cocoa::foundation::NSUInteger; +use log::warn; use metal::{MTLPixelFormat, MTLResourceOptions, NSRange}; use shaders::ToFloat2 as _; use std::{collections::HashMap, ffi::c_void, iter::Peekable, mem, sync::Arc, vec}; @@ -176,6 +177,7 @@ impl Renderer { let path_allocation = self.path_atlases.allocate(size.to_i32()); if path_allocation.is_none() { // Path size was likely zero. + warn!("could not allocate path texture of size {:?}", size); continue; } let (alloc_id, atlas_origin) = path_allocation.unwrap(); diff --git a/crates/gpui/src/platform/mac/sprite_cache.rs b/crates/gpui/src/platform/mac/sprite_cache.rs index 2d2a604f6890af636b3231eef713af398656486b..a9e6acb53fd895bf9a170f109522b2a4fa041be3 100644 --- a/crates/gpui/src/platform/mac/sprite_cache.rs +++ b/crates/gpui/src/platform/mac/sprite_cache.rs @@ -117,7 +117,7 @@ impl SpriteCache { let (alloc_id, atlas_bounds) = atlases .upload(glyph_bounds.size(), &mask) - .expect("Could not upload glyph"); + .expect("could not upload glyph"); Some(GlyphSprite { atlas_id: alloc_id.atlas_id, atlas_origin: atlas_bounds.origin(), From 4b295f566a71c88d9c342b513a5520903e333762 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 11 Apr 2022 15:11:23 -0700 Subject: [PATCH 143/245] Handle editor cancel in pane in order to dismiss find toolbar --- crates/editor/src/editor.rs | 42 ++++++++++++++++-------------- crates/search/src/buffer_search.rs | 11 ++++++++ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e10fe9c17cb1c64453e2ba8782136ef14f4d7778..fdb555583c9498c9d69c3de7fc73aaf26120546b 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1851,33 +1851,37 @@ impl Editor { return; } - if self.mode != EditorMode::Full { - cx.propagate_action(); - return; - } + if self.mode == EditorMode::Full { + if self.active_diagnostics.is_some() { + self.dismiss_diagnostics(cx); + return; + } - if self.active_diagnostics.is_some() { - self.dismiss_diagnostics(cx); - } else if let Some(pending) = self.pending_selection.clone() { - let mut selections = self.selections.clone(); - if selections.is_empty() { - selections = Arc::from([pending.selection]); + if let Some(pending) = self.pending_selection.clone() { + let mut selections = self.selections.clone(); + if selections.is_empty() { + selections = Arc::from([pending.selection]); + } + self.set_selections(selections, None, true, cx); + self.request_autoscroll(Autoscroll::Fit, cx); + return; } - self.set_selections(selections, None, true, cx); - self.request_autoscroll(Autoscroll::Fit, cx); - } else { + let mut oldest_selection = self.oldest_selection::(&cx); - if self.selection_count() == 1 { - if oldest_selection.is_empty() { - cx.propagate_action(); - return; - } + if self.selection_count() > 1 { + self.update_selections(vec![oldest_selection], Some(Autoscroll::Fit), cx); + return; + } + if !oldest_selection.is_empty() { oldest_selection.start = oldest_selection.head().clone(); oldest_selection.end = oldest_selection.head().clone(); + self.update_selections(vec![oldest_selection], Some(Autoscroll::Fit), cx); + return; } - self.update_selections(vec![oldest_selection], Some(Autoscroll::Fit), cx); } + + cx.propagate_action(); } #[cfg(any(test, feature = "test-support"))] diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index ffaf8e368de992392abea173960da31914f8c1a1..67ad695d0d9e44e9bab61d2bbc21b0bf1061f42e 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -50,6 +50,7 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(BufferSearchBar::toggle_search_option); cx.add_action(BufferSearchBar::select_match); cx.add_action(BufferSearchBar::select_match_on_pane); + cx.add_action(BufferSearchBar::handle_editor_cancel); } pub struct BufferSearchBar { @@ -339,6 +340,16 @@ impl BufferSearchBar { cx.propagate_action(); } + fn handle_editor_cancel(pane: &mut Pane, _: &editor::Cancel, cx: &mut ViewContext) { + if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::() { + if !search_bar.read(cx).dismissed { + search_bar.update(cx, |search_bar, cx| search_bar.dismiss(&Dismiss, cx)); + return; + } + } + cx.propagate_action(); + } + fn focus_editor(&mut self, _: &FocusEditor, cx: &mut ViewContext) { if let Some(active_editor) = self.active_editor.as_ref() { cx.focus(active_editor); From e0096ec1eb8c51459394312f35997d2c288aef03 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 15:22:18 -0700 Subject: [PATCH 144/245] Move keymap_file module into settings crate Co-authored-by: Keith Simmons settings}/src/keymap_file.rs | 0 crates/settings/src/settings.rs | 2 ++ crates/zed/src/zed.rs | 3 +-- 5 files changed, 5 insertions(+), 2 deletions(-) rename crates/{zed => settings}/src/keymap_file.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index d32a21d20158b2273f675779ea7670abd916f1f2..4cd3be49694d31dc5ea4a7cfaa5085b178e31f38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4425,6 +4425,7 @@ name = "settings" version = "0.1.0" dependencies = [ "anyhow", + "collections", "gpui", "schemars", "serde", diff --git a/crates/settings/Cargo.toml b/crates/settings/Cargo.toml index baaf787bee4dc43530d8185864bcf5ea732e0722..11487af0af0aabc059327ad7419887b7d8119608 100644 --- a/crates/settings/Cargo.toml +++ b/crates/settings/Cargo.toml @@ -11,6 +11,7 @@ doctest = false test-support = [] [dependencies] +collections = { path = "../collections" } gpui = { path = "../gpui" } theme = { path = "../theme" } util = { path = "../util" } diff --git a/crates/zed/src/keymap_file.rs b/crates/settings/src/keymap_file.rs similarity index 100% rename from crates/zed/src/keymap_file.rs rename to crates/settings/src/keymap_file.rs diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index c897586017bf40b7fb2963fa0c389fb5ca7c0c9f..aa38ac8840a79873014ab5c1eaf09fea2bf1eab9 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -1,3 +1,5 @@ +pub mod keymap_file; + use anyhow::Result; use gpui::font_cache::{FamilyId, FontCache}; use schemars::{schema_for, JsonSchema}; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index bae7b517e94646fa68b877043a41783c84d46ac8..5d5c065b5e8ca7deb2951aee046b478cae537db8 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -1,5 +1,4 @@ pub mod assets; -mod keymap_file; pub mod languages; pub mod menus; pub mod settings_file; @@ -105,7 +104,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - keymap_file::load_keymap( + settings::keymap_file::load_keymap( cx, std::str::from_utf8(Assets::get("keymaps/default.json").unwrap().data.as_ref()).unwrap(), ) From c065f283aa4214c4a59766832f864a0d931a78a8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 15:54:52 -0700 Subject: [PATCH 145/245] Move assets to their own crate, load keymaps in vim tests Also, move assets folder to the top-level. Co-authored-by: Keith Simmons --- Cargo.lock | 12 ++++ .../fonts/zed-mono/zed-mono-extended.ttf | Bin .../fonts/zed-mono/zed-mono-extendedbold.ttf | Bin .../zed-mono/zed-mono-extendedbolditalic.ttf | Bin .../zed-mono/zed-mono-extendeditalic.ttf | Bin .../fonts/zed-sans/zed-sans-extended.ttf | Bin .../fonts/zed-sans/zed-sans-extendedbold.ttf | Bin .../zed-sans/zed-sans-extendedbolditalic.ttf | Bin .../zed-sans/zed-sans-extendeditalic.ttf | Bin .../assets => assets}/icons/broadcast-24.svg | 0 .../assets => assets}/icons/comment-16.svg | 0 .../icons/diagnostic-error-10.svg | 0 .../icons/diagnostic-summary-error.svg | 0 .../icons/diagnostic-summary-warning.svg | 0 .../icons/diagnostic-warning-10.svg | 0 .../icons/disclosure-closed.svg | 0 .../icons/disclosure-open.svg | 0 .../zed/assets => assets}/icons/file-16.svg | 0 .../icons/folder-tree-16.svg | 0 .../zed/assets => assets}/icons/magnifier.svg | 0 .../assets => assets}/icons/offline-14.svg | 0 .../assets => assets}/icons/signed-out-12.svg | 0 .../zed/assets => assets}/icons/user-16.svg | 0 {crates/zed/assets => assets}/icons/x.svg | 0 {crates/zed/assets => assets}/icons/zap.svg | 0 .../assets => assets}/keymaps/default.json | 56 ----------------- assets/keymaps/vim.json | 58 ++++++++++++++++++ .../zed/assets => assets}/themes/dark.json | 0 .../zed/assets => assets}/themes/light.json | 0 crates/assets/Cargo.toml | 14 +++++ crates/{zed => assets}/src/assets.rs | 2 +- crates/settings/Cargo.toml | 1 + crates/settings/src/keymap_file.rs | 11 ++++ crates/vim/Cargo.toml | 1 + crates/vim/src/vim_test_context.rs | 3 + crates/workspace/Cargo.toml | 2 +- crates/zed/Cargo.toml | 1 + crates/zed/src/main.rs | 2 +- crates/zed/src/test.rs | 3 +- crates/zed/src/zed.rs | 10 +-- styles/src/buildThemes.ts | 2 +- 41 files changed, 109 insertions(+), 69 deletions(-) rename {crates/zed/assets => assets}/fonts/zed-mono/zed-mono-extended.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-mono/zed-mono-extendedbold.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-mono/zed-mono-extendedbolditalic.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-mono/zed-mono-extendeditalic.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-sans/zed-sans-extended.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-sans/zed-sans-extendedbold.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-sans/zed-sans-extendedbolditalic.ttf (100%) rename {crates/zed/assets => assets}/fonts/zed-sans/zed-sans-extendeditalic.ttf (100%) rename {crates/zed/assets => assets}/icons/broadcast-24.svg (100%) rename {crates/zed/assets => assets}/icons/comment-16.svg (100%) rename {crates/zed/assets => assets}/icons/diagnostic-error-10.svg (100%) rename {crates/zed/assets => assets}/icons/diagnostic-summary-error.svg (100%) rename {crates/zed/assets => assets}/icons/diagnostic-summary-warning.svg (100%) rename {crates/zed/assets => assets}/icons/diagnostic-warning-10.svg (100%) rename {crates/zed/assets => assets}/icons/disclosure-closed.svg (100%) rename {crates/zed/assets => assets}/icons/disclosure-open.svg (100%) rename {crates/zed/assets => assets}/icons/file-16.svg (100%) rename {crates/zed/assets => assets}/icons/folder-tree-16.svg (100%) rename {crates/zed/assets => assets}/icons/magnifier.svg (100%) rename {crates/zed/assets => assets}/icons/offline-14.svg (100%) rename {crates/zed/assets => assets}/icons/signed-out-12.svg (100%) rename {crates/zed/assets => assets}/icons/user-16.svg (100%) rename {crates/zed/assets => assets}/icons/x.svg (100%) rename {crates/zed/assets => assets}/icons/zap.svg (100%) rename {crates/zed/assets => assets}/keymaps/default.json (87%) create mode 100644 assets/keymaps/vim.json rename {crates/zed/assets => assets}/themes/dark.json (100%) rename {crates/zed/assets => assets}/themes/light.json (100%) create mode 100644 crates/assets/Cargo.toml rename crates/{zed => assets}/src/assets.rs (95%) diff --git a/Cargo.lock b/Cargo.lock index 4cd3be49694d31dc5ea4a7cfaa5085b178e31f38..8917fcac2f575ad9ea3460efb68027acc6199aa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,6 +168,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109" +[[package]] +name = "assets" +version = "0.1.0" +dependencies = [ + "anyhow", + "gpui", + "rust-embed", +] + [[package]] name = "async-attributes" version = "1.1.2" @@ -4425,6 +4434,7 @@ name = "settings" version = "0.1.0" dependencies = [ "anyhow", + "assets", "collections", "gpui", "schemars", @@ -5743,6 +5753,7 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" name = "vim" version = "0.1.0" dependencies = [ + "assets", "collections", "editor", "gpui", @@ -6018,6 +6029,7 @@ name = "zed" version = "0.25.0" dependencies = [ "anyhow", + "assets", "async-compression", "async-recursion", "async-trait", diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-extended.ttf b/assets/fonts/zed-mono/zed-mono-extended.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-mono/zed-mono-extended.ttf rename to assets/fonts/zed-mono/zed-mono-extended.ttf diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-extendedbold.ttf b/assets/fonts/zed-mono/zed-mono-extendedbold.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-mono/zed-mono-extendedbold.ttf rename to assets/fonts/zed-mono/zed-mono-extendedbold.ttf diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-extendedbolditalic.ttf b/assets/fonts/zed-mono/zed-mono-extendedbolditalic.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-mono/zed-mono-extendedbolditalic.ttf rename to assets/fonts/zed-mono/zed-mono-extendedbolditalic.ttf diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-extendeditalic.ttf b/assets/fonts/zed-mono/zed-mono-extendeditalic.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-mono/zed-mono-extendeditalic.ttf rename to assets/fonts/zed-mono/zed-mono-extendeditalic.ttf diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-extended.ttf b/assets/fonts/zed-sans/zed-sans-extended.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-sans/zed-sans-extended.ttf rename to assets/fonts/zed-sans/zed-sans-extended.ttf diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-extendedbold.ttf b/assets/fonts/zed-sans/zed-sans-extendedbold.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-sans/zed-sans-extendedbold.ttf rename to assets/fonts/zed-sans/zed-sans-extendedbold.ttf diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-extendedbolditalic.ttf b/assets/fonts/zed-sans/zed-sans-extendedbolditalic.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-sans/zed-sans-extendedbolditalic.ttf rename to assets/fonts/zed-sans/zed-sans-extendedbolditalic.ttf diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-extendeditalic.ttf b/assets/fonts/zed-sans/zed-sans-extendeditalic.ttf similarity index 100% rename from crates/zed/assets/fonts/zed-sans/zed-sans-extendeditalic.ttf rename to assets/fonts/zed-sans/zed-sans-extendeditalic.ttf diff --git a/crates/zed/assets/icons/broadcast-24.svg b/assets/icons/broadcast-24.svg similarity index 100% rename from crates/zed/assets/icons/broadcast-24.svg rename to assets/icons/broadcast-24.svg diff --git a/crates/zed/assets/icons/comment-16.svg b/assets/icons/comment-16.svg similarity index 100% rename from crates/zed/assets/icons/comment-16.svg rename to assets/icons/comment-16.svg diff --git a/crates/zed/assets/icons/diagnostic-error-10.svg b/assets/icons/diagnostic-error-10.svg similarity index 100% rename from crates/zed/assets/icons/diagnostic-error-10.svg rename to assets/icons/diagnostic-error-10.svg diff --git a/crates/zed/assets/icons/diagnostic-summary-error.svg b/assets/icons/diagnostic-summary-error.svg similarity index 100% rename from crates/zed/assets/icons/diagnostic-summary-error.svg rename to assets/icons/diagnostic-summary-error.svg diff --git a/crates/zed/assets/icons/diagnostic-summary-warning.svg b/assets/icons/diagnostic-summary-warning.svg similarity index 100% rename from crates/zed/assets/icons/diagnostic-summary-warning.svg rename to assets/icons/diagnostic-summary-warning.svg diff --git a/crates/zed/assets/icons/diagnostic-warning-10.svg b/assets/icons/diagnostic-warning-10.svg similarity index 100% rename from crates/zed/assets/icons/diagnostic-warning-10.svg rename to assets/icons/diagnostic-warning-10.svg diff --git a/crates/zed/assets/icons/disclosure-closed.svg b/assets/icons/disclosure-closed.svg similarity index 100% rename from crates/zed/assets/icons/disclosure-closed.svg rename to assets/icons/disclosure-closed.svg diff --git a/crates/zed/assets/icons/disclosure-open.svg b/assets/icons/disclosure-open.svg similarity index 100% rename from crates/zed/assets/icons/disclosure-open.svg rename to assets/icons/disclosure-open.svg diff --git a/crates/zed/assets/icons/file-16.svg b/assets/icons/file-16.svg similarity index 100% rename from crates/zed/assets/icons/file-16.svg rename to assets/icons/file-16.svg diff --git a/crates/zed/assets/icons/folder-tree-16.svg b/assets/icons/folder-tree-16.svg similarity index 100% rename from crates/zed/assets/icons/folder-tree-16.svg rename to assets/icons/folder-tree-16.svg diff --git a/crates/zed/assets/icons/magnifier.svg b/assets/icons/magnifier.svg similarity index 100% rename from crates/zed/assets/icons/magnifier.svg rename to assets/icons/magnifier.svg diff --git a/crates/zed/assets/icons/offline-14.svg b/assets/icons/offline-14.svg similarity index 100% rename from crates/zed/assets/icons/offline-14.svg rename to assets/icons/offline-14.svg diff --git a/crates/zed/assets/icons/signed-out-12.svg b/assets/icons/signed-out-12.svg similarity index 100% rename from crates/zed/assets/icons/signed-out-12.svg rename to assets/icons/signed-out-12.svg diff --git a/crates/zed/assets/icons/user-16.svg b/assets/icons/user-16.svg similarity index 100% rename from crates/zed/assets/icons/user-16.svg rename to assets/icons/user-16.svg diff --git a/crates/zed/assets/icons/x.svg b/assets/icons/x.svg similarity index 100% rename from crates/zed/assets/icons/x.svg rename to assets/icons/x.svg diff --git a/crates/zed/assets/icons/zap.svg b/assets/icons/zap.svg similarity index 100% rename from crates/zed/assets/icons/zap.svg rename to assets/icons/zap.svg diff --git a/crates/zed/assets/keymaps/default.json b/assets/keymaps/default.json similarity index 87% rename from crates/zed/assets/keymaps/default.json rename to assets/keymaps/default.json index 98a9901bd396644b4888861f1040f8850e3c006f..6b5511dbce460a0c12ade81d1d8b923ff03efe5a 100644 --- a/crates/zed/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -255,61 +255,5 @@ "ProjectPanel": { "left": "project_panel::CollapseSelectedEntry", "right": "project_panel::ExpandSelectedEntry" - }, - "Editor && vim_mode == insert": { - "escape": "vim::NormalBefore", - "ctrl-c": "vim::NormalBefore" - }, - "Editor && vim_mode == normal && vim_submode == g": { - "g": "vim::MoveToStart", - "escape": [ - "vim::SwitchMode", - { - "Normal": "None" - } - ] - }, - "Editor && vim_mode == normal": { - "i": [ - "vim::SwitchMode", - "Insert" - ], - "g": [ - "vim::SwitchMode", - { - "Normal": "GPrefix" - } - ], - "h": "vim::MoveLeft", - "j": "vim::MoveDown", - "k": "vim::MoveUp", - "l": "vim::MoveRight", - "0": "vim::MoveToStartOfLine", - "shift-$": "vim::MoveToEndOfLine", - "shift-G": "vim::MoveToEnd", - "w": [ - "vim::MoveToNextWordStart", - false - ], - "shift-W": [ - "vim::MoveToNextWordStart", - true - ], - "e": [ - "vim::MoveToNextWordEnd", - false - ], - "shift-E": [ - "vim::MoveToNextWordEnd", - true - ], - "b": [ - "vim::MoveToPreviousWordStart", - false - ], - "shift-B": [ - "vim::MoveToPreviousWordStart", - true - ] } } \ No newline at end of file diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json new file mode 100644 index 0000000000000000000000000000000000000000..f8273286df0f52afae8a6eae6c004f102b455452 --- /dev/null +++ b/assets/keymaps/vim.json @@ -0,0 +1,58 @@ +{ + "Editor && vim_mode == insert": { + "escape": "vim::NormalBefore", + "ctrl-c": "vim::NormalBefore" + }, + "Editor && vim_mode == normal && vim_submode == g": { + "g": "vim::MoveToStart", + "escape": [ + "vim::SwitchMode", + { + "Normal": "None" + } + ] + }, + "Editor && vim_mode == normal": { + "i": [ + "vim::SwitchMode", + "Insert" + ], + "g": [ + "vim::SwitchMode", + { + "Normal": "GPrefix" + } + ], + "h": "vim::MoveLeft", + "j": "vim::MoveDown", + "k": "vim::MoveUp", + "l": "vim::MoveRight", + "0": "vim::MoveToStartOfLine", + "shift-$": "vim::MoveToEndOfLine", + "shift-G": "vim::MoveToEnd", + "w": [ + "vim::MoveToNextWordStart", + false + ], + "shift-W": [ + "vim::MoveToNextWordStart", + true + ], + "e": [ + "vim::MoveToNextWordEnd", + false + ], + "shift-E": [ + "vim::MoveToNextWordEnd", + true + ], + "b": [ + "vim::MoveToPreviousWordStart", + false + ], + "shift-B": [ + "vim::MoveToPreviousWordStart", + true + ] + } +} \ No newline at end of file diff --git a/crates/zed/assets/themes/dark.json b/assets/themes/dark.json similarity index 100% rename from crates/zed/assets/themes/dark.json rename to assets/themes/dark.json diff --git a/crates/zed/assets/themes/light.json b/assets/themes/light.json similarity index 100% rename from crates/zed/assets/themes/light.json rename to assets/themes/light.json diff --git a/crates/assets/Cargo.toml b/crates/assets/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..71db57f320ea586d8c784be601f255a7d464077f --- /dev/null +++ b/crates/assets/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "assets" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/assets.rs" +doctest = false + +[dependencies] +gpui = { path = "../gpui" } +anyhow = "1.0.38" +rust-embed = { version = "6.3", features = ["include-exclude"] } + diff --git a/crates/zed/src/assets.rs b/crates/assets/src/assets.rs similarity index 95% rename from crates/zed/src/assets.rs rename to crates/assets/src/assets.rs index c0f3a1fbfc4726ef0cdbe0734518b3b3737c691e..7d5748e43b7647bbb5967b44696b620117f7c528 100644 --- a/crates/zed/src/assets.rs +++ b/crates/assets/src/assets.rs @@ -3,7 +3,7 @@ use gpui::AssetSource; use rust_embed::RustEmbed; #[derive(RustEmbed)] -#[folder = "assets"] +#[folder = "../../assets"] #[exclude = "*.DS_Store"] pub struct Assets; diff --git a/crates/settings/Cargo.toml b/crates/settings/Cargo.toml index 11487af0af0aabc059327ad7419887b7d8119608..cc37b1bcfdcf2f835ee7f0a2118d558d31e06672 100644 --- a/crates/settings/Cargo.toml +++ b/crates/settings/Cargo.toml @@ -11,6 +11,7 @@ doctest = false test-support = [] [dependencies] +assets = { path = "../assets" } collections = { path = "../collections" } gpui = { path = "../gpui" } theme = { path = "../theme" } diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 7d9423719e94518614e548792bbf6863e227c04a..621310c220ca4e6ce85bf695f3ea660fcb0ed319 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -1,4 +1,5 @@ use anyhow::{Context, Result}; +use assets::Assets; use collections::BTreeMap; use gpui::{keymap::Binding, MutableAppContext}; use serde::Deserialize; @@ -9,6 +10,16 @@ struct ActionWithData<'a>(#[serde(borrow)] &'a str, #[serde(borrow)] &'a RawValu type ActionSetsByContext<'a> = BTreeMap<&'a str, ActionsByKeystroke<'a>>; type ActionsByKeystroke<'a> = BTreeMap<&'a str, &'a RawValue>; +pub fn load_built_in_keymaps(cx: &mut MutableAppContext) { + for path in ["keymaps/default.json", "keymaps/vim.json"] { + load_keymap( + cx, + std::str::from_utf8(Assets::get(path).unwrap().data.as_ref()).unwrap(), + ) + .unwrap(); + } +} + pub fn load_keymap(cx: &mut MutableAppContext, content: &str) -> Result<()> { let actions: ActionSetsByContext = serde_json::from_str(content)?; for (context, actions) in actions { diff --git a/crates/vim/Cargo.toml b/crates/vim/Cargo.toml index f1413d7c517eb95a84ec7c8aed77b88223b4a674..aeda009ba47f2fefb2038467ed89a43646ee041a 100644 --- a/crates/vim/Cargo.toml +++ b/crates/vim/Cargo.toml @@ -8,6 +8,7 @@ path = "src/vim.rs" doctest = false [dependencies] +assets = { path = "../assets" } collections = { path = "../collections" } editor = { path = "../editor" } gpui = { path = "../gpui" } diff --git a/crates/vim/src/vim_test_context.rs b/crates/vim/src/vim_test_context.rs index 91acc8de6ced11caded405415f97997ea4e770ff..5818bdad652aa7a88555739cb60375b878aca8e8 100644 --- a/crates/vim/src/vim_test_context.rs +++ b/crates/vim/src/vim_test_context.rs @@ -23,7 +23,10 @@ impl<'a> VimTestContext<'a> { cx.update(|cx| { editor::init(cx); crate::init(cx); + + settings::keymap_file::load_built_in_keymaps(cx); }); + let params = cx.update(WorkspaceParams::test); cx.update(|cx| { diff --git a/crates/workspace/Cargo.toml b/crates/workspace/Cargo.toml index 75d1b1b8f2667ab111278d2efa6979c66e7d50bd..d9deef146b4e1ef0814243e5e8e94b431b3ec1eb 100644 --- a/crates/workspace/Cargo.toml +++ b/crates/workspace/Cargo.toml @@ -8,7 +8,7 @@ path = "src/workspace.rs" doctest = false [features] -test-support = ["client/test-support", "project/test-support"] +test-support = ["client/test-support", "project/test-support", "settings/test-support"] [dependencies] client = { path = "../client" } diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index f87046b05ebc5479d6282efd30028500f7a49c53..b0fbe48fe509684ad5bf06f50fb4e5b7143af4ac 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -29,6 +29,7 @@ test-support = [ ] [dependencies] +assets = { path = "../assets" } breadcrumbs = { path = "../breadcrumbs" } chat_panel = { path = "../chat_panel" } collections = { path = "../collections" } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index bfb1b34256991584f105f68c34a36f48165b46bf..112de0189885a7d2d12fb31e8d1e1c55d0a4b00e 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -15,9 +15,9 @@ use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; use workspace::{self, AppState, OpenNew, OpenPaths}; +use assets::Assets; use zed::{ self, - assets::Assets, build_window_options, build_workspace, fs::RealFs, languages, menus, diff --git a/crates/zed/src/test.rs b/crates/zed/src/test.rs index 363c852c352e9455aa838440c62cfbefd3545efa..0b81c4361b6c9eb70e1df67febde1bebce59663d 100644 --- a/crates/zed/src/test.rs +++ b/crates/zed/src/test.rs @@ -1,4 +1,5 @@ -use crate::{assets::Assets, build_window_options, build_workspace, AppState}; +use crate::{build_window_options, build_workspace, AppState}; +use assets::Assets; use client::{test::FakeHttpClient, ChannelList, Client, UserStore}; use gpui::MutableAppContext; use language::LanguageRegistry; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 5d5c065b5e8ca7deb2951aee046b478cae537db8..6ab961901674dda61e6e651280d312987d086f80 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -1,11 +1,9 @@ -pub mod assets; pub mod languages; pub mod menus; pub mod settings_file; #[cfg(any(test, feature = "test-support"))] pub mod test; -use assets::Assets; use breadcrumbs::Breadcrumbs; use chat_panel::ChatPanel; pub use client; @@ -104,11 +102,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - settings::keymap_file::load_keymap( - cx, - std::str::from_utf8(Assets::get("keymaps/default.json").unwrap().data.as_ref()).unwrap(), - ) - .unwrap(); + settings::keymap_file::load_built_in_keymaps(cx); } pub fn build_workspace( @@ -209,7 +203,7 @@ fn quit(_: &Quit, cx: &mut gpui::MutableAppContext) { #[cfg(test)] mod tests { use super::*; - use crate::assets::Assets; + use assets::Assets; use editor::{DisplayPoint, Editor}; use gpui::{AssetSource, MutableAppContext, TestAppContext, ViewHandle}; use project::{Fs, ProjectPath}; diff --git a/styles/src/buildThemes.ts b/styles/src/buildThemes.ts index ccbaf82c7ff1f8ed9470ad1945c607de5bf9db43..ce8812ebda0d805a12124d258958003bc1afa878 100644 --- a/styles/src/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -10,7 +10,7 @@ for (let theme of themes) { let styleTree = snakeCase(app(theme)); let styleTreeJSON = JSON.stringify(styleTree, null, 2); let outPath = path.resolve( - `${__dirname}/../../crates/zed/assets/themes/${theme.name}.json` + `${__dirname}/../assets/themes/${theme.name}.json` ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`- ${outPath} created`); From be11f63f1e23c408adc4aad2e625ab1c8ba7d49b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 16:50:44 -0700 Subject: [PATCH 146/245] Watch ~/.zed/bindings.json file for custom key bindings Co-authored-by: Keith Simmons --- crates/gpui/src/app.rs | 4 ++ crates/gpui/src/keymap.rs | 9 ++++ crates/settings/src/keymap_file.rs | 83 ++++++++++++++++-------------- crates/settings/src/settings.rs | 4 +- crates/vim/src/vim_test_context.rs | 2 +- crates/zed/src/main.rs | 32 ++++++++---- crates/zed/src/settings_file.rs | 33 ++++++++---- crates/zed/src/zed.rs | 3 +- 8 files changed, 110 insertions(+), 60 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 962343a28a9c190fe23f3d1487c50c113503350c..f0d33252e43981d562cffe82bb107b46779a952c 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1358,6 +1358,10 @@ impl MutableAppContext { self.keystroke_matcher.add_bindings(bindings); } + pub fn clear_bindings(&mut self) { + self.keystroke_matcher.clear_bindings(); + } + pub fn dispatch_keystroke( &mut self, window_id: usize, diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 1b9e920ff2d98c68fcacdd7c23a2fed854a403fd..723403f16012641924051ac4dd5d80b61cfbbb6f 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -106,6 +106,11 @@ impl Matcher { self.keymap.add_bindings(bindings); } + pub fn clear_bindings(&mut self) { + self.pending.clear(); + self.keymap.clear(); + } + pub fn clear_pending(&mut self) { self.pending.clear(); } @@ -164,6 +169,10 @@ impl Keymap { fn add_bindings>(&mut self, bindings: T) { self.0.extend(bindings.into_iter()); } + + fn clear(&mut self) { + self.0.clear(); + } } impl Binding { diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 621310c220ca4e6ce85bf695f3ea660fcb0ed319..9ecebfd5d2990d4617fecfa8d8d6239d7b2ef309 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -5,50 +5,57 @@ use gpui::{keymap::Binding, MutableAppContext}; use serde::Deserialize; use serde_json::value::RawValue; +#[derive(Deserialize, Default, Clone)] +#[serde(transparent)] +pub struct KeyMapFile(BTreeMap); + +type ActionsByKeystroke = BTreeMap>; + #[derive(Deserialize)] struct ActionWithData<'a>(#[serde(borrow)] &'a str, #[serde(borrow)] &'a RawValue); -type ActionSetsByContext<'a> = BTreeMap<&'a str, ActionsByKeystroke<'a>>; -type ActionsByKeystroke<'a> = BTreeMap<&'a str, &'a RawValue>; -pub fn load_built_in_keymaps(cx: &mut MutableAppContext) { - for path in ["keymaps/default.json", "keymaps/vim.json"] { - load_keymap( - cx, - std::str::from_utf8(Assets::get(path).unwrap().data.as_ref()).unwrap(), - ) - .unwrap(); +impl KeyMapFile { + pub fn load_defaults(cx: &mut MutableAppContext) { + for path in ["keymaps/default.json", "keymaps/vim.json"] { + Self::load(path, cx).unwrap(); + } + } + + pub fn load(asset_path: &str, cx: &mut MutableAppContext) -> Result<()> { + let content = Assets::get(asset_path).unwrap().data; + let content_str = std::str::from_utf8(content.as_ref()).unwrap(); + Ok(serde_json::from_str::(content_str)?.add(cx)?) } -} -pub fn load_keymap(cx: &mut MutableAppContext, content: &str) -> Result<()> { - let actions: ActionSetsByContext = serde_json::from_str(content)?; - for (context, actions) in actions { - let context = if context.is_empty() { - None - } else { - Some(context) - }; - cx.add_bindings( - actions - .into_iter() - .map(|(keystroke, action)| { - let action = action.get(); - let action = if action.starts_with('[') { - let ActionWithData(name, data) = serde_json::from_str(action)?; - cx.deserialize_action(name, Some(data.get())) - } else { - let name = serde_json::from_str(action)?; - cx.deserialize_action(name, None) - } - .with_context(|| { - format!( + pub fn add(self, cx: &mut MutableAppContext) -> Result<()> { + for (context, actions) in self.0 { + let context = if context.is_empty() { + None + } else { + Some(context) + }; + cx.add_bindings( + actions + .into_iter() + .map(|(keystroke, action)| { + let action = action.get(); + let action = if action.starts_with('[') { + let ActionWithData(name, data) = serde_json::from_str(action)?; + cx.deserialize_action(name, Some(data.get())) + } else { + let name = serde_json::from_str(action)?; + cx.deserialize_action(name, None) + } + .with_context(|| { + format!( "invalid binding value for keystroke {keystroke}, context {context:?}" ) - })?; - Binding::load(keystroke, action, context) - }) - .collect::>>()?, - ) + })?; + Binding::load(&keystroke, action, context.as_deref()) + }) + .collect::>>()?, + ) + } + Ok(()) } - Ok(()) } diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index d9a86037a2845a8c86b598ab3b9aafbc6211f3bb..eb4120bb52daeb781597cba4b57f89855dd44a8f 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -1,4 +1,4 @@ -pub mod keymap_file; +mod keymap_file; use anyhow::Result; use gpui::font_cache::{FamilyId, FontCache}; @@ -15,6 +15,8 @@ use std::{collections::HashMap, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; +pub use keymap_file::KeyMapFile; + #[derive(Clone)] pub struct Settings { pub buffer_font_family: FamilyId, diff --git a/crates/vim/src/vim_test_context.rs b/crates/vim/src/vim_test_context.rs index 5818bdad652aa7a88555739cb60375b878aca8e8..2e9b0f60aa59a4bd7e431371da53713a4851c89e 100644 --- a/crates/vim/src/vim_test_context.rs +++ b/crates/vim/src/vim_test_context.rs @@ -24,7 +24,7 @@ impl<'a> VimTestContext<'a> { editor::init(cx); crate::init(cx); - settings::keymap_file::load_built_in_keymaps(cx); + settings::KeyMapFile::load("keymaps/vim.json", cx).unwrap(); }); let params = cx.update(WorkspaceParams::test); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 112de0189885a7d2d12fb31e8d1e1c55d0a4b00e..d7b43bd721c6f2f11e8bade2fed82de4de02fb5e 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -2,6 +2,7 @@ #![allow(non_snake_case)] use anyhow::{anyhow, Context, Result}; +use assets::Assets; use client::{self, http, ChannelList, UserStore}; use fs::OpenOptions; use futures::{channel::oneshot, StreamExt}; @@ -9,19 +10,17 @@ use gpui::{App, AssetSource, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; -use settings::{self, Settings}; +use settings::{self, KeyMapFile, Settings, SettingsFileContent}; use smol::process::Command; use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; use workspace::{self, AppState, OpenNew, OpenPaths}; -use assets::Assets; use zed::{ - self, - build_window_options, build_workspace, + self, build_window_options, build_workspace, fs::RealFs, languages, menus, - settings_file::{settings_from_files, SettingsFile}, + settings_file::{settings_from_files, watch_keymap_file, WatchedJsonFile}, }; fn main() { @@ -63,7 +62,8 @@ fn main() { ..Default::default() }, ); - let settings_file = load_settings_file(&app, fs.clone()); + + let config_files = load_config_files(&app, fs.clone()); let login_shell_env_loaded = if stdout_is_a_pty() { Task::ready(()) @@ -112,13 +112,16 @@ fn main() { }) .detach_and_log_err(cx); - let settings_file = cx.background().block(settings_file).unwrap(); + let (settings_file, bindings_file) = cx.background().block(config_files).unwrap(); let mut settings_rx = settings_from_files( default_settings, vec![settings_file], themes.clone(), cx.font_cache().clone(), ); + + cx.spawn(|cx| watch_keymap_file(bindings_file, cx)).detach(); + let settings = cx.background().block(settings_rx.next()).unwrap(); cx.spawn(|mut cx| async move { while let Some(settings) = settings_rx.next().await { @@ -254,14 +257,23 @@ fn load_embedded_fonts(app: &App) { .unwrap(); } -fn load_settings_file(app: &App, fs: Arc) -> oneshot::Receiver { +fn load_config_files( + app: &App, + fs: Arc, +) -> oneshot::Receiver<( + WatchedJsonFile, + WatchedJsonFile, +)> { let executor = app.background(); let (tx, rx) = oneshot::channel(); executor .clone() .spawn(async move { - let file = SettingsFile::new(fs, &executor, zed::SETTINGS_PATH.clone()).await; - tx.send(file).ok() + let settings_file = + WatchedJsonFile::new(fs.clone(), &executor, zed::SETTINGS_PATH.clone()).await; + let bindings_file = + WatchedJsonFile::new(fs, &executor, zed::BINDINGS_PATH.clone()).await; + tx.send((settings_file, bindings_file)).ok() }) .detach(); rx diff --git a/crates/zed/src/settings_file.rs b/crates/zed/src/settings_file.rs index 46a3d41eb14c1cf2ede1a951de494014e0977fa1..024a49447f788c92f9f752ce4026962cfefc1d40 100644 --- a/crates/zed/src/settings_file.rs +++ b/crates/zed/src/settings_file.rs @@ -1,17 +1,22 @@ use futures::{stream, StreamExt}; -use gpui::{executor, FontCache}; +use gpui::{executor, AsyncAppContext, FontCache}; use postage::sink::Sink as _; use postage::{prelude::Stream, watch}; use project::Fs; +use serde::Deserialize; +use settings::KeyMapFile; use settings::{Settings, SettingsFileContent}; use std::{path::Path, sync::Arc, time::Duration}; use theme::ThemeRegistry; use util::ResultExt; #[derive(Clone)] -pub struct SettingsFile(watch::Receiver); +pub struct WatchedJsonFile(watch::Receiver); -impl SettingsFile { +impl WatchedJsonFile +where + T: 'static + for<'de> Deserialize<'de> + Clone + Default + Send + Sync, +{ pub async fn new( fs: Arc, executor: &executor::Background, @@ -35,21 +40,21 @@ impl SettingsFile { Self(rx) } - async fn load(fs: Arc, path: &Path) -> Option { + async fn load(fs: Arc, path: &Path) -> Option { if fs.is_file(&path).await { fs.load(&path) .await .log_err() .and_then(|data| serde_json::from_str(&data).log_err()) } else { - Some(SettingsFileContent::default()) + Some(T::default()) } } } pub fn settings_from_files( defaults: Settings, - sources: Vec, + sources: Vec>, theme_registry: Arc, font_cache: Arc, ) -> impl futures::stream::Stream { @@ -72,6 +77,16 @@ pub fn settings_from_files( }) } +pub async fn watch_keymap_file(mut file: WatchedJsonFile, mut cx: AsyncAppContext) { + while let Some(content) = file.0.recv().await { + cx.update(|cx| { + cx.clear_bindings(); + settings::KeyMapFile::load_defaults(cx); + content.add(cx).log_err(); + }); + } +} + #[cfg(test)] mod tests { use super::*; @@ -102,9 +117,9 @@ mod tests { .await .unwrap(); - let source1 = SettingsFile::new(fs.clone(), &executor, "/settings1.json".as_ref()).await; - let source2 = SettingsFile::new(fs.clone(), &executor, "/settings2.json".as_ref()).await; - let source3 = SettingsFile::new(fs.clone(), &executor, "/settings3.json".as_ref()).await; + let source1 = WatchedJsonFile::new(fs.clone(), &executor, "/settings1.json".as_ref()).await; + let source2 = WatchedJsonFile::new(fs.clone(), &executor, "/settings2.json".as_ref()).await; + let source3 = WatchedJsonFile::new(fs.clone(), &executor, "/settings3.json".as_ref()).await; let mut settings_rx = settings_from_files( cx.read(Settings::test), diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 5632c610387c9644555cf41d1b037553461dfe03..6deecc9b0c433d6a2527a0a0ddd9bdcc8800bd99 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -45,6 +45,7 @@ lazy_static! { .expect("failed to determine home directory") .join(".zed"); pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json"); + pub static ref BINDINGS_PATH: PathBuf = ROOT_PATH.join("bindings.json"); } pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { @@ -102,7 +103,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - settings::keymap_file::load_built_in_keymaps(cx); + settings::KeyMapFile::load_defaults(cx); } pub fn build_workspace( From ee3eb9658f9e2fa249304136fdbd8b876fa6aa61 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 17:02:16 -0700 Subject: [PATCH 147/245] Use the word 'keymap' more consistently Co-authored-by: Keith Simmons --- crates/settings/src/keymap_file.rs | 4 ++-- crates/settings/src/settings.rs | 2 +- crates/vim/src/vim_test_context.rs | 2 +- crates/zed/src/main.rs | 13 ++++++------- crates/zed/src/settings_file.rs | 7 +++---- crates/zed/src/zed.rs | 4 ++-- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 9ecebfd5d2990d4617fecfa8d8d6239d7b2ef309..97ea45138a4a53dbced1c137983d03c1be149edc 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -7,14 +7,14 @@ use serde_json::value::RawValue; #[derive(Deserialize, Default, Clone)] #[serde(transparent)] -pub struct KeyMapFile(BTreeMap); +pub struct KeymapFile(BTreeMap); type ActionsByKeystroke = BTreeMap>; #[derive(Deserialize)] struct ActionWithData<'a>(#[serde(borrow)] &'a str, #[serde(borrow)] &'a RawValue); -impl KeyMapFile { +impl KeymapFile { pub fn load_defaults(cx: &mut MutableAppContext) { for path in ["keymaps/default.json", "keymaps/vim.json"] { Self::load(path, cx).unwrap(); diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index eb4120bb52daeb781597cba4b57f89855dd44a8f..ccd39baf46a11cad371862e57585158515c6fac0 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -15,7 +15,7 @@ use std::{collections::HashMap, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; -pub use keymap_file::KeyMapFile; +pub use keymap_file::KeymapFile; #[derive(Clone)] pub struct Settings { diff --git a/crates/vim/src/vim_test_context.rs b/crates/vim/src/vim_test_context.rs index 2e9b0f60aa59a4bd7e431371da53713a4851c89e..2e87115af25f10abb9fdc9e4aa2bdd30394fc8df 100644 --- a/crates/vim/src/vim_test_context.rs +++ b/crates/vim/src/vim_test_context.rs @@ -24,7 +24,7 @@ impl<'a> VimTestContext<'a> { editor::init(cx); crate::init(cx); - settings::KeyMapFile::load("keymaps/vim.json", cx).unwrap(); + settings::KeymapFile::load("keymaps/vim.json", cx).unwrap(); }); let params = cx.update(WorkspaceParams::test); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index d7b43bd721c6f2f11e8bade2fed82de4de02fb5e..1d1f08f639dcaa52e408628f998a055f77aad8d2 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -10,7 +10,7 @@ use gpui::{App, AssetSource, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; -use settings::{self, KeyMapFile, Settings, SettingsFileContent}; +use settings::{self, KeymapFile, Settings, SettingsFileContent}; use smol::process::Command; use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; @@ -112,7 +112,7 @@ fn main() { }) .detach_and_log_err(cx); - let (settings_file, bindings_file) = cx.background().block(config_files).unwrap(); + let (settings_file, keymap_file) = cx.background().block(config_files).unwrap(); let mut settings_rx = settings_from_files( default_settings, vec![settings_file], @@ -120,7 +120,7 @@ fn main() { cx.font_cache().clone(), ); - cx.spawn(|cx| watch_keymap_file(bindings_file, cx)).detach(); + cx.spawn(|cx| watch_keymap_file(keymap_file, cx)).detach(); let settings = cx.background().block(settings_rx.next()).unwrap(); cx.spawn(|mut cx| async move { @@ -262,7 +262,7 @@ fn load_config_files( fs: Arc, ) -> oneshot::Receiver<( WatchedJsonFile, - WatchedJsonFile, + WatchedJsonFile, )> { let executor = app.background(); let (tx, rx) = oneshot::channel(); @@ -271,9 +271,8 @@ fn load_config_files( .spawn(async move { let settings_file = WatchedJsonFile::new(fs.clone(), &executor, zed::SETTINGS_PATH.clone()).await; - let bindings_file = - WatchedJsonFile::new(fs, &executor, zed::BINDINGS_PATH.clone()).await; - tx.send((settings_file, bindings_file)).ok() + let keymap_file = WatchedJsonFile::new(fs, &executor, zed::KEYMAP_PATH.clone()).await; + tx.send((settings_file, keymap_file)).ok() }) .detach(); rx diff --git a/crates/zed/src/settings_file.rs b/crates/zed/src/settings_file.rs index 024a49447f788c92f9f752ce4026962cfefc1d40..d805e7490df445e9669a74eefcfba54e01280ecd 100644 --- a/crates/zed/src/settings_file.rs +++ b/crates/zed/src/settings_file.rs @@ -4,8 +4,7 @@ use postage::sink::Sink as _; use postage::{prelude::Stream, watch}; use project::Fs; use serde::Deserialize; -use settings::KeyMapFile; -use settings::{Settings, SettingsFileContent}; +use settings::{KeymapFile, Settings, SettingsFileContent}; use std::{path::Path, sync::Arc, time::Duration}; use theme::ThemeRegistry; use util::ResultExt; @@ -77,11 +76,11 @@ pub fn settings_from_files( }) } -pub async fn watch_keymap_file(mut file: WatchedJsonFile, mut cx: AsyncAppContext) { +pub async fn watch_keymap_file(mut file: WatchedJsonFile, mut cx: AsyncAppContext) { while let Some(content) = file.0.recv().await { cx.update(|cx| { cx.clear_bindings(); - settings::KeyMapFile::load_defaults(cx); + settings::KeymapFile::load_defaults(cx); content.add(cx).log_err(); }); } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 6deecc9b0c433d6a2527a0a0ddd9bdcc8800bd99..7b1ff803f5c54d579ed1c371d548b07bc15ddcb0 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -45,7 +45,7 @@ lazy_static! { .expect("failed to determine home directory") .join(".zed"); pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json"); - pub static ref BINDINGS_PATH: PathBuf = ROOT_PATH.join("bindings.json"); + pub static ref KEYMAP_PATH: PathBuf = ROOT_PATH.join("keymap.json"); } pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { @@ -103,7 +103,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - settings::KeyMapFile::load_defaults(cx); + settings::KeymapFile::load_defaults(cx); } pub fn build_workspace( From 28da5b4afcb5e85c4bf20ebcee91a1dffbef607b Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 11 Apr 2022 17:05:24 -0700 Subject: [PATCH 148/245] Don't focus active editor when deploying project search and focus query editor on project search focus --- crates/search/src/project_search.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index f96e3c84d1979b99e414f1b028dcd927f3ae4102..03fb99a972b783c09944505acc9fa88b3b062335 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -177,11 +177,7 @@ impl View for ProjectSearchView { .insert(self.model.read(cx).project.downgrade(), handle) }); - if self.model.read(cx).match_ranges.is_empty() { - cx.focus(&self.query_editor); - } else { - self.focus_results_editor(cx); - } + self.focus_query_editor(cx); } } @@ -390,6 +386,7 @@ impl ProjectSearchView { if let Some(existing) = existing { workspace.activate_item(&existing, cx); + existing.update(cx, |existing, cx| existing.focus_query_editor(cx)); } else { let model = cx.add_model(|cx| ProjectSearch::new(workspace.project().clone(), cx)); workspace.add_item( From 3b852ee2bd9e2796ca07d518dafae040534bb953 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 11 Apr 2022 18:15:41 -0600 Subject: [PATCH 149/245] Update Kubernetes manifest to refer to "collab" instead of "zed" --- crates/collab/k8s/manifest.template.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/collab/k8s/manifest.template.yml b/crates/collab/k8s/manifest.template.yml index cb6b7107575591afcc80a11cf39302055716519a..7f604fbf605c73e0addbc360cd03770a65dcb37b 100644 --- a/crates/collab/k8s/manifest.template.yml +++ b/crates/collab/k8s/manifest.template.yml @@ -8,14 +8,14 @@ kind: Service apiVersion: v1 metadata: namespace: ${ZED_KUBE_NAMESPACE} - name: zed + name: collab annotations: service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443" service.beta.kubernetes.io/do-loadbalancer-certificate-id: "2634d353-1ab4-437f-add2-4ffd8f315233" spec: type: LoadBalancer selector: - app: zed + app: collab ports: - name: web protocol: TCP @@ -26,19 +26,19 @@ apiVersion: apps/v1 kind: Deployment metadata: namespace: ${ZED_KUBE_NAMESPACE} - name: zed + name: collab spec: replicas: 1 selector: matchLabels: - app: zed + app: collab template: metadata: labels: - app: zed + app: collab spec: containers: - - name: zed + - name: collab image: "${ZED_IMAGE_ID}" ports: - containerPort: 8080 From add0dad6d73ae69e113389576ded8b9cbd73272e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 17:17:03 -0700 Subject: [PATCH 150/245] Use '*' to represent the default context in keymap files Co-authored-by: Keith Simmons --- assets/keymaps/default.json | 2 +- crates/settings/src/keymap_file.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index 6b5511dbce460a0c12ade81d1d8b923ff03efe5a..dbfbcc03aba54c68a42b822ee46f84ae9e792fcd 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -1,5 +1,5 @@ { - "": { + "*": { "ctrl-alt-cmd-f": "workspace::FollowNextCollaborator", "cmd-s": "workspace::Save", "cmd-alt-i": "workspace::DebugElements", diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 97ea45138a4a53dbced1c137983d03c1be149edc..d82c7ef8f6f4aefad0abe792dc4bfccb147071f6 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -29,16 +29,17 @@ impl KeymapFile { pub fn add(self, cx: &mut MutableAppContext) -> Result<()> { for (context, actions) in self.0 { - let context = if context.is_empty() { - None - } else { - Some(context) - }; + let context = if context == "*" { None } else { Some(context) }; cx.add_bindings( actions .into_iter() .map(|(keystroke, action)| { let action = action.get(); + + // This is a workaround for a limitation in serde: serde-rs/json#497 + // We want to deserialize the action data as a `RawValue` so that we can + // deserialize the action itself dynamically directly from the JSON + // string. But `RawValue` currently does not work inside of an untagged enum. let action = if action.starts_with('[') { let ActionWithData(name, data) = serde_json::from_str(action)?; cx.deserialize_action(name, Some(data.get())) From 72ea71ca52751afba6063512a6c296a3412ed8f5 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 11 Apr 2022 18:18:12 -0600 Subject: [PATCH 151/245] Update paths to renamed collab crate --- script/build-css | 2 +- script/deploy | 4 ++-- script/seed-db | 2 +- script/sqlx | 2 +- script/tailwind.config.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/script/build-css b/script/build-css index 5dc9b33ec8ddfd72eb9e25b63067d90a9e92166a..08b205495d91aa022a0bc68127a1e8a02124f7df 100755 --- a/script/build-css +++ b/script/build-css @@ -7,4 +7,4 @@ cd ./script if [[ $1 == --release ]]; then export NODE_ENV=production # Purge unused styles in --release mode fi -npx tailwindcss build ../crates/server/styles.css --output ../crates/server/static/styles.css +npx tailwindcss build ../crates/collab/styles.css --output ../crates/collab/static/styles.css diff --git a/script/deploy b/script/deploy index 4ba674766be227b757db4f8d870538f91ddf0cb2..ce50737170f65a2ed151a3f7f370decf9f46b342 100755 --- a/script/deploy +++ b/script/deploy @@ -16,7 +16,7 @@ if [[ $# < 1 ]]; then fi export ZED_KUBE_NAMESPACE=$1 -ENV_FILE="crates/server/k8s/environments/${ZED_KUBE_NAMESPACE}.sh" +ENV_FILE="crates/collab/k8s/environments/${ZED_KUBE_NAMESPACE}.sh" if [[ ! -f $ENV_FILE ]]; then echo "Invalid environment name '${ZED_KUBE_NAMESPACE}'" exit 1 @@ -34,4 +34,4 @@ export $(cat $ENV_FILE) docker build . --tag "$ZED_IMAGE_ID" docker push "$ZED_IMAGE_ID" -envsubst < crates/server/k8s/manifest.template.yml | kubectl apply -f - +envsubst < crates/collab/k8s/manifest.template.yml | kubectl apply -f - diff --git a/script/seed-db b/script/seed-db index 9da6ba2933b83e9b40254344e611aa6f770327f1..c69af799dd9ed32ebbac054584a499db7eededc9 100755 --- a/script/seed-db +++ b/script/seed-db @@ -1,7 +1,7 @@ #!/bin/bash set -e -cd crates/server +cd crates/collab # Export contents of .env.toml eval "$(cargo run --bin dotenv)" diff --git a/script/sqlx b/script/sqlx index 3d3ea00cc44260d2fa8b693105a65c0e45f22cf2..2241f4fa9a3a0ecf9185c12bb7ebae6f665962a2 100755 --- a/script/sqlx +++ b/script/sqlx @@ -5,7 +5,7 @@ set -e # Install sqlx-cli if needed [[ "$(sqlx --version)" == "sqlx-cli 0.5.7" ]] || cargo install sqlx-cli --version 0.5.7 -cd crates/server +cd crates/collab # Export contents of .env.toml eval "$(cargo run --bin dotenv)" diff --git a/script/tailwind.config.js b/script/tailwind.config.js index f237516efffb34606617b9bab6c999eca31115c5..3c1670b0a439088e1e36ade3fca5a4395e656f07 100644 --- a/script/tailwind.config.js +++ b/script/tailwind.config.js @@ -40,7 +40,7 @@ module.exports = { }, darkMode: false, purge: [ - "../crates/server/templates/**/*.hbs", - "../crates/server/templates/*.hbs" + "../crates/collab/templates/**/*.hbs", + "../crates/collab/templates/*.hbs" ] } \ No newline at end of file From 5a5506ae1d68ad8d47d623289b86c29f525685a0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 11 Apr 2022 18:33:55 -0600 Subject: [PATCH 152/245] Update certificate --- crates/collab/k8s/manifest.template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/collab/k8s/manifest.template.yml b/crates/collab/k8s/manifest.template.yml index 7f604fbf605c73e0addbc360cd03770a65dcb37b..f243a0adacb063f4fc0b803878b1c51d041ac408 100644 --- a/crates/collab/k8s/manifest.template.yml +++ b/crates/collab/k8s/manifest.template.yml @@ -11,7 +11,7 @@ metadata: name: collab annotations: service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443" - service.beta.kubernetes.io/do-loadbalancer-certificate-id: "2634d353-1ab4-437f-add2-4ffd8f315233" + service.beta.kubernetes.io/do-loadbalancer-certificate-id: "40879815-9a6b-4bbb-8207-8f2c7c0218f9" spec: type: LoadBalancer selector: From 1d8afdff801cf40887574a00a4c5d0fe30a5763b Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 11 Apr 2022 12:59:31 -0700 Subject: [PATCH 153/245] Set tsx default indent to 2 and remove js from extension list in tsx config.toml --- crates/zed/src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 8633005899f5e5e0d1405748b56dad4ecc790cdf..f05660e0f2967a20891806fc6f002a4389625089 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -62,6 +62,13 @@ fn main() { tab_size: Some(2), ..Default::default() }, + ) + .with_overrides( + "TSX", + settings::LanguageOverride { + tab_size: Some(2), + ..Default::default() + }, ); let settings_file = load_settings_file(&app, fs.clone()); From 949fbe7cd302423ada34658a9d516bdb7a69146e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 19:51:46 -0700 Subject: [PATCH 154/245] Allow dumping the project diagnostic view's state as JSON Also, improve DebugElements action so that it shows the JSON in an editor. Co-authored-by: Nathan Sobo --- assets/keymaps/default.json | 2 +- crates/diagnostics/src/diagnostics.rs | 31 +++++++++++++++++++++++++-- crates/diagnostics/src/items.rs | 7 +++++- crates/editor/src/editor.rs | 2 +- crates/gpui/src/app.rs | 20 +++++++++++++++++ crates/gpui/src/presenter.rs | 20 ++++++++++------- crates/project/src/project.rs | 24 +++++++++++++++------ crates/workspace/src/workspace.rs | 26 ++++------------------ crates/zed/src/zed.rs | 26 ++++++++++++++++++++++ 9 files changed, 116 insertions(+), 42 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index dbfbcc03aba54c68a42b822ee46f84ae9e792fcd..b517f9aebbd450826cf7867b8a9b5f8667de5736 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -2,7 +2,7 @@ "*": { "ctrl-alt-cmd-f": "workspace::FollowNextCollaborator", "cmd-s": "workspace::Save", - "cmd-alt-i": "workspace::DebugElements", + "cmd-alt-i": "zed::DebugElements", "cmd-k cmd-left": "workspace::ActivatePreviousPane", "cmd-k cmd-right": "workspace::ActivateNextPane", "cmd-=": "zed::IncreaseBufferFontSize", diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index ea8150da45cee293db84daf8be20014f4058fedc..c15c20c775e05b8b91e2302849ba2c6be7fd6e59 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -8,13 +8,15 @@ use editor::{ highlight_diagnostic_message, Editor, ExcerptId, MultiBuffer, ToOffset, }; use gpui::{ - actions, elements::*, fonts::TextStyle, AnyViewHandle, AppContext, Entity, ModelHandle, - MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, fonts::TextStyle, serde_json, AnyViewHandle, AppContext, Entity, + ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, + WeakViewHandle, }; use language::{ Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, SelectionGoal, }; use project::{DiagnosticSummary, Project, ProjectPath}; +use serde_json::json; use settings::Settings; use std::{ any::{Any, TypeId}, @@ -90,6 +92,31 @@ impl View for ProjectDiagnosticsEditor { cx.focus(&self.editor); } } + + fn debug_json(&self, cx: &AppContext) -> serde_json::Value { + let project = self.project.read(cx); + json!({ + "project": json!({ + "language_servers": project.language_server_statuses().collect::>(), + "summary": project.diagnostic_summary(cx), + }), + "summary": self.summary, + "paths_to_update": self.paths_to_update.iter().map(|path| + path.path.to_string_lossy() + ).collect::>(), + "paths_states": self.path_states.iter().map(|state| + json!({ + "path": state.path.path.to_string_lossy(), + "groups": state.diagnostic_groups.iter().map(|group| + json!({ + "block_count": group.blocks.len(), + "excerpt_count": group.excerpts.len(), + }) + ).collect::>(), + }) + ).collect::>(), + }) + } } impl ProjectDiagnosticsEditor { diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index 0f00b6dd7e9db2d022453d328300e00a481c2009..2f9a228256f4f91993698a54ac4382b82498c629 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -1,6 +1,7 @@ use crate::render_summary; use gpui::{ - elements::*, platform::CursorStyle, Entity, ModelHandle, RenderContext, View, ViewContext, + elements::*, platform::CursorStyle, serde_json, Entity, ModelHandle, RenderContext, View, + ViewContext, }; use project::Project; use settings::Settings; @@ -67,6 +68,10 @@ impl View for DiagnosticSummary { .on_click(|cx| cx.dispatch_action(crate::Deploy)) .boxed() } + + fn debug_json(&self, _: &gpui::AppContext) -> serde_json::Value { + serde_json::json!({ "summary": self.summary }) + } } impl StatusItemView for DiagnosticSummary { diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 28d794729f5c2b430d3c2be184d25c785a1e6806..bc398754a78edcf1f889e4dff1bd5328ba697f88 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1008,7 +1008,7 @@ impl Editor { if project.read(cx).is_remote() { cx.propagate_action(); } else if let Some(buffer) = project - .update(cx, |project, cx| project.create_buffer(cx)) + .update(cx, |project, cx| project.create_buffer("", None, cx)) .log_err() { workspace.add_item( diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index f0d33252e43981d562cffe82bb107b46779a952c..eb97b85c679d712e9d96fc9f12491895025a208e 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -62,6 +62,9 @@ pub trait View: Entity + Sized { cx.set.insert(Self::ui_name().into()); cx } + fn debug_json(&self, _: &AppContext) -> serde_json::Value { + serde_json::Value::Null + } } pub trait ReadModel { @@ -2277,6 +2280,12 @@ pub struct AppContext { } impl AppContext { + pub(crate) fn root_view(&self, window_id: usize) -> Option { + self.windows + .get(&window_id) + .map(|window| window.root_view.clone()) + } + pub fn root_view_id(&self, window_id: usize) -> Option { self.windows .get(&window_id) @@ -2590,6 +2599,7 @@ pub trait AnyView { fn on_focus(&mut self, cx: &mut MutableAppContext, window_id: usize, view_id: usize); fn on_blur(&mut self, cx: &mut MutableAppContext, window_id: usize, view_id: usize); fn keymap_context(&self, cx: &AppContext) -> keymap::Context; + fn debug_json(&self, cx: &AppContext) -> serde_json::Value; } impl AnyView for T @@ -2653,6 +2663,10 @@ where fn keymap_context(&self, cx: &AppContext) -> keymap::Context { View::keymap_context(self, cx) } + + fn debug_json(&self, cx: &AppContext) -> serde_json::Value { + View::debug_json(self, cx) + } } pub struct ModelContext<'a, T: ?Sized> { @@ -3927,6 +3941,12 @@ impl AnyViewHandle { pub fn view_type(&self) -> TypeId { self.view_type } + + pub fn debug_json(&self, cx: &AppContext) -> serde_json::Value { + cx.views + .get(&(self.window_id, self.view_id)) + .map_or_else(|| serde_json::Value::Null, |view| view.debug_json(cx)) + } } impl Clone for AnyViewHandle { diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index ee840bd1e717e9d4c33a085302e89a47cd3193dd..4585e321c442feffd7948bf399d2a08bb0929a63 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -209,15 +209,18 @@ impl Presenter { } pub fn debug_elements(&self, cx: &AppContext) -> Option { - cx.root_view_id(self.window_id) - .and_then(|root_view_id| self.rendered_views.get(&root_view_id)) - .map(|root_element| { - root_element.debug(&DebugContext { - rendered_views: &self.rendered_views, - font_cache: &self.font_cache, - app: cx, + let view = cx.root_view(self.window_id)?; + Some(json!({ + "root_view": view.debug_json(cx), + "root_element": self.rendered_views.get(&view.id()) + .map(|root_element| { + root_element.debug(&DebugContext { + rendered_views: &self.rendered_views, + font_cache: &self.font_cache, + app: cx, + }) }) - }) + })) } } @@ -554,6 +557,7 @@ impl Element for ChildView { "type": "ChildView", "view_id": self.view.id(), "bounds": bounds.to_json(), + "view": self.view.debug_json(cx.app), "child": if let Some(view) = cx.rendered_views.get(&self.view.id()) { view.debug(cx) } else { diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 409e49e9fbc73429fdf84f0ff09b849d385e8d2b..1bc2d841099a3b97013c87917054d79070c5fb67 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -28,6 +28,7 @@ use parking_lot::Mutex; use postage::watch; use rand::prelude::*; use search::SearchQuery; +use serde::Serialize; use settings::Settings; use sha2::{Digest, Sha256}; use similar::{ChangeTag, TextDiff}; @@ -132,16 +133,18 @@ pub enum Event { CollaboratorLeft(PeerId), } +#[derive(Serialize)] pub struct LanguageServerStatus { pub name: String, pub pending_work: BTreeMap, - pending_diagnostic_updates: isize, + pub pending_diagnostic_updates: isize, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Serialize)] pub struct LanguageServerProgress { pub message: Option, pub percentage: Option, + #[serde(skip_serializing)] pub last_update_at: Instant, } @@ -151,7 +154,7 @@ pub struct ProjectPath { pub path: Arc, } -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq, Serialize)] pub struct DiagnosticSummary { pub error_count: usize, pub warning_count: usize, @@ -467,7 +470,6 @@ impl Project { .and_then(|buffer| buffer.upgrade(cx)) } - #[cfg(any(test, feature = "test-support"))] pub fn languages(&self) -> &Arc { &self.languages } @@ -813,13 +815,19 @@ impl Project { !self.is_local() } - pub fn create_buffer(&mut self, cx: &mut ModelContext) -> Result> { + pub fn create_buffer( + &mut self, + text: &str, + language: Option>, + cx: &mut ModelContext, + ) -> Result> { if self.is_remote() { return Err(anyhow!("creating buffers as a guest is not supported yet")); } let buffer = cx.add_model(|cx| { - Buffer::new(self.replica_id(), "", cx).with_language(language::PLAIN_TEXT.clone(), cx) + Buffer::new(self.replica_id(), text, cx) + .with_language(language.unwrap_or(language::PLAIN_TEXT.clone()), cx) }); self.register_buffer(&buffer, cx)?; Ok(buffer) @@ -6581,7 +6589,9 @@ mod tests { .unwrap(); let worktree_id = worktree.read_with(cx, |worktree, _| worktree.id()); - let buffer = project.update(cx, |project, cx| project.create_buffer(cx).unwrap()); + let buffer = project.update(cx, |project, cx| { + project.create_buffer("", None, cx).unwrap() + }); buffer.update(cx, |buffer, cx| { buffer.edit([0..0], "abc", cx); assert!(buffer.is_dirty()); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index d63626e1d33703df971bb0e19f3e90fc310e45e9..c73a6bab5b335d9cb2fd50b6dc9ba2bc28f32f9f 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -18,11 +18,11 @@ use gpui::{ elements::*, geometry::{rect::RectF, vector::vec2f, PathBuilder}, impl_internal_actions, - json::{self, to_string_pretty, ToJson}, + json::{self, ToJson}, platform::{CursorStyle, WindowOptions}, - AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Border, ClipboardItem, Entity, - ImageData, ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, - View, ViewContext, ViewHandle, WeakViewHandle, + AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Border, Entity, ImageData, + ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, View, + ViewContext, ViewHandle, WeakViewHandle, }; use language::LanguageRegistry; use log::error; @@ -75,7 +75,6 @@ actions!( ToggleShare, Unfollow, Save, - DebugElements, ActivatePreviousPane, ActivateNextPane, FollowNextCollaborator, @@ -133,7 +132,6 @@ pub fn init(client: &Arc, cx: &mut MutableAppContext) { workspace.save_active_item(cx).detach_and_log_err(cx); }, ); - cx.add_action(Workspace::debug_elements); cx.add_action(Workspace::toggle_sidebar_item); cx.add_action(Workspace::toggle_sidebar_item_focus); cx.add_action(|workspace: &mut Workspace, _: &ActivatePreviousPane, cx| { @@ -1053,22 +1051,6 @@ impl Workspace { cx.notify(); } - pub fn debug_elements(&mut self, _: &DebugElements, cx: &mut ViewContext) { - match to_string_pretty(&cx.debug_elements()) { - Ok(json) => { - let kib = json.len() as f32 / 1024.; - cx.as_mut().write_to_clipboard(ClipboardItem::new(json)); - log::info!( - "copied {:.1} KiB of element debug JSON to the clipboard", - kib - ); - } - Err(error) => { - log::error!("error debugging elements: {}", error); - } - }; - } - fn add_pane(&mut self, cx: &mut ViewContext) -> ViewHandle { let pane = cx.add_view(|cx| Pane::new(cx)); let pane_id = pane.id(); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 7b1ff803f5c54d579ed1c371d548b07bc15ddcb0..e9ed88655798adf391e39554b38fafa9bf9a43e1 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -10,6 +10,7 @@ pub use client; pub use contacts_panel; use contacts_panel::ContactsPanel; pub use editor; +use editor::Editor; use gpui::{ actions, geometry::vector::vec2f, @@ -22,8 +23,10 @@ use project::Project; pub use project::{self, fs}; use project_panel::ProjectPanel; use search::{BufferSearchBar, ProjectSearchBar}; +use serde_json::to_string_pretty; use settings::Settings; use std::{path::PathBuf, sync::Arc}; +use util::ResultExt; pub use workspace; use workspace::{AppState, Workspace, WorkspaceParams}; @@ -32,6 +35,7 @@ actions!( [ About, Quit, + DebugElements, OpenSettings, IncreaseBufferFontSize, DecreaseBufferFontSize @@ -100,6 +104,28 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { .detach_and_log_err(cx); } }); + cx.add_action( + |workspace: &mut Workspace, _: &DebugElements, cx: &mut ViewContext| { + let content = to_string_pretty(&cx.debug_elements()).unwrap(); + let project = workspace.project().clone(); + let json_language = project.read(cx).languages().get_language("JSON").unwrap(); + if project.read(cx).is_remote() { + cx.propagate_action(); + } else if let Some(buffer) = project + .update(cx, |project, cx| { + project.create_buffer(&content, Some(json_language), cx) + }) + .log_err() + { + workspace.add_item( + Box::new( + cx.add_view(|cx| Editor::for_buffer(buffer, Some(project.clone()), cx)), + ), + cx, + ); + } + }, + ); workspace::lsp_status::init(cx); From ae9f71cc07f186b47d2afee0ea6cc046db71b740 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 11 Apr 2022 21:09:01 -0700 Subject: [PATCH 155/245] Avoid bailing out of Project::symbols when one LSP request fails --- crates/project/src/project.rs | 137 ++++++++++++++++------------------ 1 file changed, 66 insertions(+), 71 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 409e49e9fbc73429fdf84f0ff09b849d385e8d2b..f3479c47572a972495a04b0aaa76795953700a5b 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2270,86 +2270,81 @@ impl Project { pub fn symbols(&self, query: &str, cx: &mut ModelContext) -> Task>> { if self.is_local() { - let mut language_servers = HashMap::default(); + let mut requests = Vec::new(); for ((worktree_id, _), (lsp_adapter, language_server)) in self.language_servers.iter() { + let worktree_id = *worktree_id; if let Some(worktree) = self - .worktree_for_id(*worktree_id, cx) + .worktree_for_id(worktree_id, cx) .and_then(|worktree| worktree.read(cx).as_local()) { - language_servers - .entry(Arc::as_ptr(language_server)) - .or_insert(( - lsp_adapter.clone(), - language_server.clone(), - *worktree_id, - worktree.abs_path().clone(), - )); + let lsp_adapter = lsp_adapter.clone(); + let worktree_abs_path = worktree.abs_path().clone(); + requests.push( + language_server + .request::(lsp::WorkspaceSymbolParams { + query: query.to_string(), + ..Default::default() + }) + .log_err() + .map(move |response| { + ( + lsp_adapter, + worktree_id, + worktree_abs_path, + response.unwrap_or_default(), + ) + }), + ); } } - let mut requests = Vec::new(); - for (_, language_server, _, _) in language_servers.values() { - requests.push(language_server.request::( - lsp::WorkspaceSymbolParams { - query: query.to_string(), - ..Default::default() - }, - )); - } - cx.spawn_weak(|this, cx| async move { - let responses = futures::future::try_join_all(requests).await?; - - let mut symbols = Vec::new(); - if let Some(this) = this.upgrade(&cx) { - this.read_with(&cx, |this, cx| { - for ((adapter, _, source_worktree_id, worktree_abs_path), lsp_symbols) in - language_servers.into_values().zip(responses) - { - symbols.extend(lsp_symbols.into_iter().flatten().filter_map( - |lsp_symbol| { - let abs_path = lsp_symbol.location.uri.to_file_path().ok()?; - let mut worktree_id = source_worktree_id; - let path; - if let Some((worktree, rel_path)) = - this.find_local_worktree(&abs_path, cx) - { - worktree_id = worktree.read(cx).id(); - path = rel_path; - } else { - path = relativize_path(&worktree_abs_path, &abs_path); - } - - let label = this - .languages - .select_language(&path) - .and_then(|language| { - language - .label_for_symbol(&lsp_symbol.name, lsp_symbol.kind) - }) - .unwrap_or_else(|| { - CodeLabel::plain(lsp_symbol.name.clone(), None) - }); - let signature = this.symbol_signature(worktree_id, &path); - - Some(Symbol { - source_worktree_id, - worktree_id, - language_server_name: adapter.name(), - name: lsp_symbol.name, - kind: lsp_symbol.kind, - label, - path, - range: range_from_lsp(lsp_symbol.location.range), - signature, - }) - }, - )); - } - }) - } + let responses = futures::future::join_all(requests).await; + let this = if let Some(this) = this.upgrade(&cx) { + this + } else { + return Ok(Default::default()); + }; + this.read_with(&cx, |this, cx| { + let mut symbols = Vec::new(); + for (adapter, source_worktree_id, worktree_abs_path, response) in responses { + symbols.extend(response.into_iter().flatten().filter_map(|lsp_symbol| { + let abs_path = lsp_symbol.location.uri.to_file_path().ok()?; + let mut worktree_id = source_worktree_id; + let path; + if let Some((worktree, rel_path)) = + this.find_local_worktree(&abs_path, cx) + { + worktree_id = worktree.read(cx).id(); + path = rel_path; + } else { + path = relativize_path(&worktree_abs_path, &abs_path); + } - Ok(symbols) + let label = this + .languages + .select_language(&path) + .and_then(|language| { + language.label_for_symbol(&lsp_symbol.name, lsp_symbol.kind) + }) + .unwrap_or_else(|| CodeLabel::plain(lsp_symbol.name.clone(), None)); + let signature = this.symbol_signature(worktree_id, &path); + + Some(Symbol { + source_worktree_id, + worktree_id, + language_server_name: adapter.name(), + name: lsp_symbol.name, + kind: lsp_symbol.kind, + label, + path, + range: range_from_lsp(lsp_symbol.location.range), + signature, + }) + })); + } + Ok(symbols) + }) }) } else if let Some(project_id) = self.remote_id() { let request = self.client.request(proto::GetProjectSymbols { From c06e5f3d1e6d23af23b826af9ea9b411d6b60967 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 09:43:36 +0200 Subject: [PATCH 156/245] Limit incoming size to 1 in tests to more easily simulate backpressure --- crates/rpc/src/peer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 76fd6aac185fa0d941c02285b377f4c93d8693ad..a2b88f795c69396770e1775473aef68d3e61f339 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -126,7 +126,11 @@ impl Peer { // can always send messages without yielding. For incoming messages, use a // bounded channel so that other peers will receive backpressure if they send // messages faster than this peer can process them. - let (mut incoming_tx, incoming_rx) = mpsc::channel(64); + #[cfg(any(test, feature = "test-support"))] + const INCOMING_BUFFER_SIZE: usize = 1; + #[cfg(not(any(test, feature = "test-support")))] + const INCOMING_BUFFER_SIZE: usize = 64; + let (mut incoming_tx, incoming_rx) = mpsc::channel(INCOMING_BUFFER_SIZE); let (outgoing_tx, mut outgoing_rx) = mpsc::unbounded(); let connection_id = ConnectionId(self.next_connection_id.fetch_add(1, SeqCst)); From 56b9e5b0a0a13ec7db65737cc2fff5a5e691cfb1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 09:44:23 +0200 Subject: [PATCH 157/245] Make `Server::update_contacts_for_users` always synchronous --- crates/server/src/rpc.rs | 149 +++++++++++++++------------------------ 1 file changed, 55 insertions(+), 94 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 1c4c76349da952cf6a55e9f21c4405dc260a1423..0b4551001196e0b2549cfbcdb1c718f20f67f8d1 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -249,10 +249,11 @@ impl Server { let _ = send_connection_id.send(connection_id).await; } - this.state_mut() - .await - .add_connection(connection_id, user_id); - this.update_contacts_for_users(&[user_id]).await; + { + let mut state = this.state_mut().await; + state.add_connection(connection_id, user_id); + this.update_contacts_for_users(&*state, &[user_id]); + } let handle_io = handle_io.fuse(); futures::pin_mut!(handle_io); @@ -309,7 +310,8 @@ impl Server { async fn sign_out(self: &mut Arc, connection_id: ConnectionId) -> tide::Result<()> { self.peer.disconnect(connection_id); - let removed_connection = self.state_mut().await.remove_connection(connection_id)?; + let mut state = self.state_mut().await; + let removed_connection = state.remove_connection(connection_id)?; for (project_id, project) in removed_connection.hosted_projects { if let Some(share) = project.share { @@ -336,8 +338,7 @@ impl Server { }); } - self.update_contacts_for_users(removed_connection.contact_ids.iter()) - .await; + self.update_contacts_for_users(&*state, removed_connection.contact_ids.iter()); Ok(()) } @@ -346,7 +347,7 @@ impl Server { } async fn register_project( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result { let project_id = { @@ -358,20 +359,17 @@ impl Server { } async fn unregister_project( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { - let project = self - .state_mut() - .await - .unregister_project(request.payload.project_id, request.sender_id)?; - self.update_contacts_for_users(project.authorized_user_ids().iter()) - .await; + let mut state = self.state_mut().await; + let project = state.unregister_project(request.payload.project_id, request.sender_id)?; + self.update_contacts_for_users(&*state, &project.authorized_user_ids()); Ok(()) } async fn share_project( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result { self.state_mut() @@ -381,21 +379,17 @@ impl Server { } async fn unshare_project( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let project_id = request.payload.project_id; - let project = self - .state_mut() - .await - .unshare_project(project_id, request.sender_id)?; - + let mut state = self.state_mut().await; + let project = state.unshare_project(project_id, request.sender_id)?; broadcast(request.sender_id, project.connection_ids, |conn_id| { self.peer .send(conn_id, proto::UnshareProject { project_id }) }); - self.update_contacts_for_users(&project.authorized_user_ids) - .await; + self.update_contacts_for_users(&mut *state, &project.authorized_user_ids); Ok(()) } @@ -469,21 +463,18 @@ impl Server { }, ) }); - self.update_contacts_for_users_sync(state, &contact_user_ids); + self.update_contacts_for_users(state, &contact_user_ids); Ok(response) } async fn leave_project( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let sender_id = request.sender_id; let project_id = request.payload.project_id; - let worktree = self - .state_mut() - .await - .leave_project(sender_id, project_id)?; - + let mut state = self.state_mut().await; + let worktree = state.leave_project(sender_id, project_id)?; broadcast(sender_id, worktree.connection_ids, |conn_id| { self.peer.send( conn_id, @@ -493,65 +484,56 @@ impl Server { }, ) }); - self.update_contacts_for_users(&worktree.authorized_user_ids) - .await; - + self.update_contacts_for_users(&*state, &worktree.authorized_user_ids); Ok(()) } async fn register_worktree( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result { - let host_user_id = self - .state() - .await - .user_id_for_connection(request.sender_id)?; - let mut contact_user_ids = HashSet::default(); - contact_user_ids.insert(host_user_id); for github_login in &request.payload.authorized_logins { let contact_user_id = self.app_state.db.create_user(github_login, false).await?; contact_user_ids.insert(contact_user_id); } + let mut state = self.state_mut().await; + let host_user_id = state.user_id_for_connection(request.sender_id)?; + contact_user_ids.insert(host_user_id); + let contact_user_ids = contact_user_ids.into_iter().collect::>(); - let guest_connection_ids; - { - let mut state = self.state_mut().await; - guest_connection_ids = state - .read_project(request.payload.project_id, request.sender_id)? - .guest_connection_ids(); - state.register_worktree( - request.payload.project_id, - request.payload.worktree_id, - request.sender_id, - Worktree { - authorized_user_ids: contact_user_ids.clone(), - root_name: request.payload.root_name.clone(), - visible: request.payload.visible, - }, - )?; - } + let guest_connection_ids = state + .read_project(request.payload.project_id, request.sender_id)? + .guest_connection_ids(); + state.register_worktree( + request.payload.project_id, + request.payload.worktree_id, + request.sender_id, + Worktree { + authorized_user_ids: contact_user_ids.clone(), + root_name: request.payload.root_name.clone(), + visible: request.payload.visible, + }, + )?; + broadcast(request.sender_id, guest_connection_ids, |connection_id| { self.peer .forward_send(request.sender_id, connection_id, request.payload.clone()) }); - self.update_contacts_for_users(&contact_user_ids).await; + self.update_contacts_for_users(&*state, &contact_user_ids); Ok(proto::Ack {}) } async fn unregister_worktree( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let project_id = request.payload.project_id; let worktree_id = request.payload.worktree_id; - let (worktree, guest_connection_ids) = self.state_mut().await.unregister_worktree( - project_id, - worktree_id, - request.sender_id, - )?; + let mut state = self.state_mut().await; + let (worktree, guest_connection_ids) = + state.unregister_worktree(project_id, worktree_id, request.sender_id)?; broadcast(request.sender_id, guest_connection_ids, |conn_id| { self.peer.send( conn_id, @@ -561,13 +543,12 @@ impl Server { }, ) }); - self.update_contacts_for_users(&worktree.authorized_user_ids) - .await; + self.update_contacts_for_users(&*state, &worktree.authorized_user_ids); Ok(()) } async fn update_worktree( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result { let connection_ids = self.state_mut().await.update_worktree( @@ -587,7 +568,7 @@ impl Server { } async fn update_diagnostic_summary( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let summary = request @@ -610,7 +591,7 @@ impl Server { } async fn start_language_server( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let receiver_ids = self.state_mut().await.start_language_server( @@ -863,27 +844,7 @@ impl Server { Ok(proto::GetUsersResponse { users }) } - async fn update_contacts_for_users<'a>( - self: &Arc, - user_ids: impl IntoIterator, - ) { - let state = self.state().await; - for user_id in user_ids { - let contacts = state.contacts_for_user(*user_id); - for connection_id in state.connection_ids_for_user(*user_id) { - self.peer - .send( - connection_id, - proto::UpdateContacts { - contacts: contacts.clone(), - }, - ) - .log_err(); - } - } - } - - fn update_contacts_for_users_sync<'a>( + fn update_contacts_for_users<'a>( self: &Arc, state: &Store, user_ids: impl IntoIterator, @@ -904,7 +865,7 @@ impl Server { } async fn join_channel( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result { let user_id = self @@ -945,7 +906,7 @@ impl Server { } async fn leave_channel( - mut self: Arc, + self: Arc, request: TypedEnvelope, ) -> tide::Result<()> { let user_id = self @@ -1079,7 +1040,7 @@ impl Server { } } - async fn state_mut<'a>(self: &'a mut Arc) -> StoreWriteGuard<'a> { + async fn state_mut<'a>(self: &'a Arc) -> StoreWriteGuard<'a> { #[cfg(test)] async_std::task::yield_now().await; let guard = self.store.write().await; From 1d84876cfd88c7eb7a25edca75c2cf4885eed025 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 10:15:38 +0200 Subject: [PATCH 158/245] Adjust distribution in randomized test --- crates/collab/src/rpc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 23c3e80e6b7ef4745b238ff23d6abfc4c286529a..be6ba0750f1e7f52d601dcb6726bfed9cbc278d7 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -5390,7 +5390,7 @@ mod tests { log::info!("Added connection for {}", guest_username); operations += 1; } - 20..=30 if clients.len() > 1 => { + 20..=29 if clients.len() > 1 => { log::info!("Removing guest"); let guest_ix = rng.lock().gen_range(1..clients.len()); let removed_guest_id = user_ids.remove(guest_ix); From 71beebc913875247e93ae0d8b4399876f504eb9b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 10:52:16 +0200 Subject: [PATCH 159/245] Fix warning --- crates/collab/src/rpc.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index be6ba0750f1e7f52d601dcb6726bfed9cbc278d7..65f4d4ba4e72ceb53c3fd9538a3d86458ed50eb9 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -1228,7 +1228,6 @@ mod tests { time::Duration, }; use theme::ThemeRegistry; - use util::TryFutureExt; use workspace::{Item, SplitDirection, ToggleFollow, Workspace, WorkspaceParams}; #[cfg(test)] From 4e057da69b422eb990aac1acfd1b624a9537d3ad Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 11:41:20 +0200 Subject: [PATCH 160/245] Update contacts list when a project is shared --- crates/collab/src/rpc.rs | 39 +++++++++++++++++++++++++--------- crates/collab/src/rpc/store.rs | 16 +++++++++++--- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 65f4d4ba4e72ceb53c3fd9538a3d86458ed50eb9..4c38e63d5ebdcb71dac39d401e1ada0d4fa2362e 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -372,9 +372,9 @@ impl Server { self: Arc, request: TypedEnvelope, ) -> tide::Result { - self.state_mut() - .await - .share_project(request.payload.project_id, request.sender_id); + let mut state = self.state_mut().await; + let project = state.share_project(request.payload.project_id, request.sender_id)?; + self.update_contacts_for_users(&mut *state, &project.authorized_user_ids); Ok(proto::Ack {}) } @@ -4465,19 +4465,19 @@ mod tests { client_a .user_store .condition(&cx_a, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec![])])] + contacts(user_store) == vec![("user_a", vec![("a", false, vec![])])] }) .await; client_b .user_store .condition(&cx_b, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec![])])] + contacts(user_store) == vec![("user_a", vec![("a", false, vec![])])] }) .await; client_c .user_store .condition(&cx_c, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec![])])] + contacts(user_store) == vec![("user_a", vec![("a", false, vec![])])] }) .await; @@ -4488,6 +4488,24 @@ mod tests { .update(cx_a, |project, cx| project.share(cx)) .await .unwrap(); + client_a + .user_store + .condition(&cx_a, |user_store, _| { + contacts(user_store) == vec![("user_a", vec![("a", true, vec![])])] + }) + .await; + client_b + .user_store + .condition(&cx_b, |user_store, _| { + contacts(user_store) == vec![("user_a", vec![("a", true, vec![])])] + }) + .await; + client_c + .user_store + .condition(&cx_c, |user_store, _| { + contacts(user_store) == vec![("user_a", vec![("a", true, vec![])])] + }) + .await; let _project_b = Project::remote( project_id, @@ -4503,19 +4521,19 @@ mod tests { client_a .user_store .condition(&cx_a, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec!["user_b"])])] + contacts(user_store) == vec![("user_a", vec![("a", true, vec!["user_b"])])] }) .await; client_b .user_store .condition(&cx_b, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec!["user_b"])])] + contacts(user_store) == vec![("user_a", vec![("a", true, vec!["user_b"])])] }) .await; client_c .user_store .condition(&cx_c, |user_store, _| { - contacts(user_store) == vec![("user_a", vec![("a", vec!["user_b"])])] + contacts(user_store) == vec![("user_a", vec![("a", true, vec!["user_b"])])] }) .await; @@ -4539,7 +4557,7 @@ mod tests { .condition(&cx_c, |user_store, _| contacts(user_store) == vec![]) .await; - fn contacts(user_store: &UserStore) -> Vec<(&str, Vec<(&str, Vec<&str>)>)> { + fn contacts(user_store: &UserStore) -> Vec<(&str, Vec<(&str, bool, Vec<&str>)>)> { user_store .contacts() .iter() @@ -4550,6 +4568,7 @@ mod tests { .map(|p| { ( p.worktree_root_names[0].as_str(), + p.is_shared, p.guests.iter().map(|p| p.github_login.as_str()).collect(), ) }) diff --git a/crates/collab/src/rpc/store.rs b/crates/collab/src/rpc/store.rs index 33d2a399816ad90f6e809373e8ece3ca67c8046e..946e9f84209ad3cef8d6e58cd8f54ab6479acee9 100644 --- a/crates/collab/src/rpc/store.rs +++ b/crates/collab/src/rpc/store.rs @@ -66,6 +66,10 @@ pub struct JoinedProject<'a> { pub project: &'a Project, } +pub struct SharedProject { + pub authorized_user_ids: Vec, +} + pub struct UnsharedProject { pub connection_ids: Vec, pub authorized_user_ids: Vec, @@ -355,7 +359,11 @@ impl Store { Ok((worktree, guest_connection_ids)) } - pub fn share_project(&mut self, project_id: u64, connection_id: ConnectionId) -> bool { + pub fn share_project( + &mut self, + project_id: u64, + connection_id: ConnectionId, + ) -> tide::Result { if let Some(project) = self.projects.get_mut(&project_id) { if project.host_connection_id == connection_id { let mut share = ProjectShare::default(); @@ -363,10 +371,12 @@ impl Store { share.worktrees.insert(*worktree_id, Default::default()); } project.share = Some(share); - return true; + return Ok(SharedProject { + authorized_user_ids: project.authorized_user_ids(), + }); } } - false + Err(anyhow!("no such project"))? } pub fn unshare_project( From 409b81871733b8a9fe04273b564e352ca5865306 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 12 Apr 2022 12:37:38 -0400 Subject: [PATCH 161/245] Fix incorrect path in theme build script `buildThemes.ts` had an incorrect path for generating the theme json files. It probably happened when we did some reorganization of the styles directory. Co-Authored-By: gibusu <95764254+gibusu@users.noreply.github.com> --- styles/src/buildThemes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/src/buildThemes.ts b/styles/src/buildThemes.ts index ce8812ebda0d805a12124d258958003bc1afa878..0e8d90d96a00e63a83ce11e0897ee6fec3119a86 100644 --- a/styles/src/buildThemes.ts +++ b/styles/src/buildThemes.ts @@ -10,7 +10,7 @@ for (let theme of themes) { let styleTree = snakeCase(app(theme)); let styleTreeJSON = JSON.stringify(styleTree, null, 2); let outPath = path.resolve( - `${__dirname}/../assets/themes/${theme.name}.json` + `${__dirname}/../../assets/themes/${theme.name}.json` ); fs.writeFileSync(outPath, styleTreeJSON); console.log(`- ${outPath} created`); From 726045e78e03b01c91277693ff6890b30d53b3c8 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 12 Apr 2022 12:44:38 -0400 Subject: [PATCH 162/245] Update theme feature colors - border focus color - Text feature color - Match & active match highlight color Matches should be more legible now in both themes. `activeMatch` is still not hooked up on the rust side, so it won't take any effect yet. Co-Authored-By: gibusu <95764254+gibusu@users.noreply.github.com> --- assets/themes/dark.json | 12 ++++++------ assets/themes/light.json | 12 ++++++------ styles/src/themes/dark.ts | 8 ++++---- styles/src/themes/light.ts | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index ccd6ef82e0c477cd6f7d34dbe3ac67ab807c9187..41729736d16915dd3ea30ddb676115081f309e44 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1096d3", + "color": "#96e818", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1096d3", + "color": "#96e818", "weight": "bold", "size": 14 }, @@ -413,7 +413,7 @@ }, "match_highlight": { "family": "Zed Mono", - "color": "#1096d3", + "color": "#96e818", "size": 14 }, "selected_item": { @@ -674,9 +674,9 @@ "color": "#de900c", "weight": "bold" }, - "emphasis": "#1096d3", + "emphasis": "#96e818", "emphasis_strong": { - "color": "#1096d3", + "color": "#96e818", "weight": "bold" }, "link_uri": { @@ -1103,7 +1103,7 @@ } }, "search": { - "match_background": "#1096d329", + "match_background": "#3f15a380", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { diff --git a/assets/themes/light.json b/assets/themes/light.json index 7d963a883970858aee73fb84d377b86de3587cf5..c942dbb39b99a1b72e1cfea404ce05dab2e3dbad 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1b1edc", + "color": "#484bed", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#1b1edc", + "color": "#484bed", "weight": "bold", "size": 14 }, @@ -413,7 +413,7 @@ }, "match_highlight": { "family": "Zed Mono", - "color": "#1b1edc", + "color": "#484bed", "size": 14 }, "selected_item": { @@ -674,9 +674,9 @@ "color": "#1096d3", "weight": "bold" }, - "emphasis": "#1b1edc", + "emphasis": "#484bed", "emphasis_strong": { - "color": "#1b1edc", + "color": "#484bed", "weight": "bold" }, "link_uri": { @@ -1103,7 +1103,7 @@ } }, "search": { - "match_background": "#eb2d2d33", + "match_background": "#fce9b7", "tab_icon_spacing": 4, "tab_icon_width": 14, "active_hovered_option_button": { diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 09a8a07c6758ec7804bdc4d9d624e4f3bcc6aa63..4ff3db435c06c02e1540748f2e2b9f0926ff4cef 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -51,7 +51,7 @@ const borderColor = { primary: colors.neutral[875], secondary: colors.neutral[775], muted: colors.neutral[675], - focused: colors.neutral[500], + focused: colors.indigo[500], active: colors.neutral[900], ok: colors.green[500], error: colors.red[500], @@ -66,7 +66,7 @@ const textColor = { placeholder: colors.neutral[650], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.sky[500], + feature: colors.lime[400], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], @@ -114,8 +114,8 @@ const editor = { occurrence: withOpacity(colors.neutral[0], 0.12), activeOccurrence: withOpacity(colors.neutral[0], 0.16), // TODO: This is not correctly hooked up to occurences on the rust side matchingBracket: backgroundColor[500].active, - match: withOpacity(colors.sky[500], 0.16), - activeMatch: withOpacity(colors.sky[800], 0.32), + match: withOpacity(colors.violet[700], 0.5), + activeMatch: withOpacity(colors.violet[600], 0.7), related: backgroundColor[500].focused, }, gutter: { diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index 74caa4987d6af5e3b26c88ca20b6dbc7bc88b627..c9e3a73ad14109aa60140c994d0992b3cd98deac 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -51,7 +51,7 @@ const borderColor = { primary: colors.neutral[150], secondary: colors.neutral[150], muted: colors.neutral[100], - focused: colors.neutral[100], + focused: colors.indigo[500], active: colors.neutral[250], ok: colors.green[200], error: colors.red[200], @@ -65,7 +65,7 @@ const textColor = { muted: colors.neutral[550], placeholder: colors.neutral[450], active: colors.neutral[900], - feature: colors.indigo[600], + feature: colors.indigo[500], ok: colors.green[500], error: colors.red[500], warning: colors.yellow[500], @@ -112,8 +112,8 @@ const editor = { occurrence: withOpacity(colors.neutral[900], 0.06), activeOccurrence: withOpacity(colors.neutral[900], 0.16), // TODO: This is not hooked up to occurences on the rust side matchingBracket: colors.neutral[0], - match: withOpacity(colors.red[500], 0.2), - activeMatch: withOpacity(colors.indigo[400], 0.36), // TODO: This is not hooked up to occurences on the rust side + match: colors.yellow[100], + activeMatch: colors.yellow[200], // TODO: This is not hooked up to occurences on the rust side related: colors.neutral[0], }, gutter: { From 6b629dfa5cecd0b866292de137145bd4edc6974f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 12 Apr 2022 19:37:26 +0200 Subject: [PATCH 163/245] Use `CTFont::draw_glyphs` to rasterize glyphs This API supports rendering emojis in addition to normal glyphs. --- crates/gpui/src/platform/mac/fonts.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index 1706134f6709af5b1915f19674b1d41d3ac69e7a..23639fa077d4b4f5d01afd6956494dd319c047de 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -198,15 +198,18 @@ impl FontSystemState { ty: -transform.vector.y() as CGFloat, }); - cx.set_font(&font.native_font().copy_to_CGFont()); - cx.set_font_size(font_size as CGFloat); - cx.show_glyphs_at_positions( - &[glyph_id as CGGlyph], - &[CGPoint::new( - (subpixel_shift.x() / scale_factor) as CGFloat, - (subpixel_shift.y() / scale_factor) as CGFloat, - )], - ); + cx.set_should_subpixel_position_fonts(true); + cx.set_should_subpixel_quantize_fonts(false); + font.native_font() + .clone_with_font_size(font_size as CGFloat) + .draw_glyphs( + &[glyph_id as CGGlyph], + &[CGPoint::new( + (subpixel_shift.x() / scale_factor) as CGFloat, + (subpixel_shift.y() / scale_factor) as CGFloat, + )], + cx, + ); Some((bounds, pixels)) } From 6cc9306f0077d4605805fb6cf24f846608aeb4aa Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 13 Apr 2022 11:36:54 +0200 Subject: [PATCH 164/245] Make room for font subpixel variants correctly --- crates/gpui/src/platform/mac/fonts.rs | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index 23639fa077d4b4f5d01afd6956494dd319c047de..cf0f0c8b27747430d402dc284c83cc2747e5db79 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -159,7 +159,7 @@ impl FontSystemState { ) -> Option<(RectI, Vec)> { let font = &self.fonts[font_id.0]; let scale = Transform2F::from_scale(scale_factor); - let bounds = font + let glyph_bounds = font .raster_bounds( glyph_id, font_size, @@ -169,26 +169,26 @@ impl FontSystemState { ) .ok()?; - if bounds.width() == 0 || bounds.height() == 0 { + if glyph_bounds.width() == 0 || glyph_bounds.height() == 0 { None } else { // Make room for subpixel variants. - let bounds = RectI::new(bounds.origin(), bounds.size() + vec2i(1, 1)); - let mut pixels = vec![0; bounds.width() as usize * bounds.height() as usize]; + let cx_bounds = RectI::new(glyph_bounds.origin(), glyph_bounds.size() + vec2i(1, 1)); + let mut bytes = vec![0; cx_bounds.width() as usize * cx_bounds.height() as usize]; let cx = CGContext::create_bitmap_context( - Some(pixels.as_mut_ptr() as *mut _), - bounds.width() as usize, - bounds.height() as usize, + Some(bytes.as_mut_ptr() as *mut _), + cx_bounds.width() as usize, + cx_bounds.height() as usize, 8, - bounds.width() as usize, + cx_bounds.width() as usize, &CGColorSpace::create_device_gray(), kCGImageAlphaOnly, ); // Move the origin to bottom left and account for scaling, this // makes drawing text consistent with the font-kit's raster_bounds. - cx.translate(0.0, bounds.height() as CGFloat); - let transform = scale.translate(-bounds.origin().to_f32()); + cx.translate(0.0, glyph_bounds.height() as CGFloat); + let transform = Transform2F::from_translation(-glyph_bounds.origin().to_f32()); cx.set_text_matrix(&CGAffineTransform { a: transform.matrix.m11() as CGFloat, b: -transform.matrix.m21() as CGFloat, @@ -198,20 +198,22 @@ impl FontSystemState { ty: -transform.vector.y() as CGFloat, }); + cx.set_allows_font_subpixel_positioning(true); cx.set_should_subpixel_position_fonts(true); + cx.set_allows_font_subpixel_quantization(false); cx.set_should_subpixel_quantize_fonts(false); font.native_font() - .clone_with_font_size(font_size as CGFloat) + .clone_with_font_size((font_size * scale_factor) as CGFloat) .draw_glyphs( &[glyph_id as CGGlyph], &[CGPoint::new( - (subpixel_shift.x() / scale_factor) as CGFloat, - (subpixel_shift.y() / scale_factor) as CGFloat, + subpixel_shift.x() as CGFloat, + subpixel_shift.y() as CGFloat, )], cx, ); - Some((bounds, pixels)) + Some((cx_bounds, bytes)) } } From 4249b5687e83899084833e7855317ea54ab598c1 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Tue, 12 Apr 2022 14:09:29 -0700 Subject: [PATCH 165/245] Implement font fallback in layout_line Co-authored-by: Max Brunsfeld --- crates/gpui/src/platform/mac/fonts.rs | 50 ++++++++++++++++----------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index cf0f0c8b27747430d402dc284c83cc2747e5db79..8ea596369725bcf4083ccbb49220a4dc9012fd7e 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -13,13 +13,12 @@ use core_foundation::{ array::CFIndex, attributed_string::{CFAttributedStringRef, CFMutableAttributedString}, base::{CFRange, TCFType}, - number::CFNumber, string::CFString, }; use core_graphics::{ base::CGGlyph, color_space::CGColorSpace, context::CGContext, geometry::CGAffineTransform, }; -use core_text::{line::CTLine, string_attributes::kCTFontAttributeName}; +use core_text::{font::CTFont, line::CTLine, string_attributes::kCTFontAttributeName}; use font_kit::{ canvas::RasterizationOptions, handle::Handle, hinting::HintingOptions, source::SystemSource, sources::mem::MemSource, @@ -91,7 +90,7 @@ impl platform::FontSystem for FontSystem { } fn layout_line(&self, text: &str, font_size: f32, runs: &[(usize, RunStyle)]) -> LineLayout { - self.0.read().layout_line(text, font_size, runs) + self.0.write().layout_line(text, font_size, runs) } fn wrap_line(&self, text: &str, font_id: FontId, font_size: f32, width: f32) -> Vec { @@ -149,6 +148,19 @@ impl FontSystemState { self.fonts[font_id.0].glyph_for_char(ch) } + fn id_for_font(&mut self, requested_font: font_kit::font::Font) -> FontId { + // TODO: don't allocate the postscript name + // Note: Coretext always returns a Some option for postscript_name + let requested_font_name = requested_font.postscript_name(); + for (id, font) in self.fonts.iter().enumerate() { + if font.postscript_name() == requested_font_name { + return FontId(id); + } + } + self.fonts.push(requested_font); + FontId(self.fonts.len() - 1) + } + fn rasterize_glyph( &self, font_id: FontId, @@ -217,9 +229,12 @@ impl FontSystemState { } } - fn layout_line(&self, text: &str, font_size: f32, runs: &[(usize, RunStyle)]) -> LineLayout { - let font_id_attr_name = CFString::from_static_string("zed_font_id"); - + fn layout_line( + &mut self, + text: &str, + font_size: f32, + runs: &[(usize, RunStyle)], + ) -> LineLayout { // Construct the attributed string, converting UTF8 ranges to UTF16 ranges. let mut string = CFMutableAttributedString::new(); { @@ -269,11 +284,6 @@ impl FontSystemState { kCTFontAttributeName, &font.native_font().clone_with_font_size(font_size as f64), ); - string.set_attribute( - cf_range, - font_id_attr_name.as_concrete_TypeRef(), - &CFNumber::from(font_id.0 as i64), - ); } if utf16_end == utf16_line_len { @@ -287,15 +297,15 @@ impl FontSystemState { let mut runs = Vec::new(); for run in line.glyph_runs().into_iter() { - let font_id = FontId( - run.attributes() - .unwrap() - .get(&font_id_attr_name) - .downcast::() - .unwrap() - .to_i64() - .unwrap() as usize, - ); + let attributes = run.attributes().unwrap(); + let font = unsafe { + let native_font = attributes + .get(kCTFontAttributeName) + .downcast::() + .unwrap(); + font_kit::font::Font::from_native_font(native_font) + }; + let font_id = self.id_for_font(font); let mut ix_converter = StringIndexConverter::new(text); let mut glyphs = Vec::new(); From fff1d9c63177896fe6f7d81ebf278df46aa70e25 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 13 Apr 2022 15:56:32 +0200 Subject: [PATCH 166/245] Implement glyph scaling in a way that works with emojis as well --- crates/gpui/src/platform/mac/fonts.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index 8ea596369725bcf4083ccbb49220a4dc9012fd7e..31f39d5851249e407ea20a85a682ca4e0710edc4 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -199,28 +199,23 @@ impl FontSystemState { // Move the origin to bottom left and account for scaling, this // makes drawing text consistent with the font-kit's raster_bounds. - cx.translate(0.0, glyph_bounds.height() as CGFloat); - let transform = Transform2F::from_translation(-glyph_bounds.origin().to_f32()); - cx.set_text_matrix(&CGAffineTransform { - a: transform.matrix.m11() as CGFloat, - b: -transform.matrix.m21() as CGFloat, - c: -transform.matrix.m12() as CGFloat, - d: transform.matrix.m22() as CGFloat, - tx: transform.vector.x() as CGFloat, - ty: -transform.vector.y() as CGFloat, - }); + cx.translate( + -glyph_bounds.origin_x() as CGFloat, + (glyph_bounds.origin_y() + glyph_bounds.height()) as CGFloat, + ); + cx.scale(scale_factor as CGFloat, scale_factor as CGFloat); cx.set_allows_font_subpixel_positioning(true); cx.set_should_subpixel_position_fonts(true); cx.set_allows_font_subpixel_quantization(false); cx.set_should_subpixel_quantize_fonts(false); font.native_font() - .clone_with_font_size((font_size * scale_factor) as CGFloat) + .clone_with_font_size(font_size as CGFloat) .draw_glyphs( &[glyph_id as CGGlyph], &[CGPoint::new( - subpixel_shift.x() as CGFloat, - subpixel_shift.y() as CGFloat, + (subpixel_shift.x() / scale_factor) as CGFloat, + (subpixel_shift.y() / scale_factor) as CGFloat, )], cx, ); From cdcdccfb89d2eece1fe9ab69c7148a261e369643 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 13 Apr 2022 17:31:10 +0200 Subject: [PATCH 167/245] Render emojis Co-Authored-By: Nathan Sobo --- crates/gpui/src/platform.rs | 7 ++ crates/gpui/src/platform/mac/fonts.rs | 98 +++++++++++++++----- crates/gpui/src/platform/mac/image_cache.rs | 75 +++++++++++++-- crates/gpui/src/platform/mac/renderer.rs | 45 +++++++-- crates/gpui/src/platform/mac/sprite_cache.rs | 3 +- crates/gpui/src/scene.rs | 36 +++++-- crates/gpui/src/text_layout.rs | 47 +++++++--- 7 files changed, 255 insertions(+), 56 deletions(-) diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 6afdfb4637ad7778e6fc086a2588a56df310cd76..9abff5b0f79b0b73df9c07f34f7f6cb8f6b8a1cf 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -129,6 +129,12 @@ pub enum CursorStyle { PointingHand, } +#[derive(Copy, Clone, Debug)] +pub enum RasterizationOptions { + Alpha, + Bgra, +} + pub trait FontSystem: Send + Sync { fn add_fonts(&self, fonts: &[Arc>]) -> anyhow::Result<()>; fn load_family(&self, name: &str) -> anyhow::Result>; @@ -148,6 +154,7 @@ pub trait FontSystem: Send + Sync { glyph_id: GlyphId, subpixel_shift: Vector2F, scale_factor: f32, + options: RasterizationOptions, ) -> Option<(RectI, Vec)>; fn layout_line(&self, text: &str, font_size: f32, runs: &[(usize, RunStyle)]) -> LineLayout; fn wrap_line(&self, text: &str, font_id: FontId, font_size: f32, width: f32) -> Vec; diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index 31f39d5851249e407ea20a85a682ca4e0710edc4..417bfe6728abcad67526c40c4f238523ce698ed7 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -3,9 +3,9 @@ use crate::{ geometry::{ rect::{RectF, RectI}, transform2d::Transform2F, - vector::{vec2f, vec2i, Vector2F}, + vector::{vec2f, Vector2F}, }, - platform, + platform::{self, RasterizationOptions}, text_layout::{Glyph, LineLayout, Run, RunStyle}, }; use cocoa::appkit::{CGFloat, CGPoint}; @@ -16,12 +16,13 @@ use core_foundation::{ string::CFString, }; use core_graphics::{ - base::CGGlyph, color_space::CGColorSpace, context::CGContext, geometry::CGAffineTransform, + base::{kCGImageAlphaPremultipliedLast, CGGlyph}, + color_space::CGColorSpace, + context::CGContext, }; use core_text::{font::CTFont, line::CTLine, string_attributes::kCTFontAttributeName}; use font_kit::{ - canvas::RasterizationOptions, handle::Handle, hinting::HintingOptions, source::SystemSource, - sources::mem::MemSource, + handle::Handle, hinting::HintingOptions, source::SystemSource, sources::mem::MemSource, }; use parking_lot::RwLock; use std::{cell::RefCell, char, cmp, convert::TryFrom, ffi::c_void, sync::Arc}; @@ -35,15 +36,19 @@ struct FontSystemState { memory_source: MemSource, system_source: SystemSource, fonts: Vec, + emoji_font_id: FontId, } impl FontSystem { pub fn new() -> Self { - Self(RwLock::new(FontSystemState { + let mut state = FontSystemState { memory_source: MemSource::empty(), system_source: SystemSource::new(), fonts: Vec::new(), - })) + emoji_font_id: FontId(0), // This will be the first font that we load. + }; + state.load_family("Apple Color Emoji").unwrap(); + Self(RwLock::new(state)) } } @@ -83,10 +88,16 @@ impl platform::FontSystem for FontSystem { glyph_id: GlyphId, subpixel_shift: Vector2F, scale_factor: f32, + options: RasterizationOptions, ) -> Option<(RectI, Vec)> { - self.0 - .read() - .rasterize_glyph(font_id, font_size, glyph_id, subpixel_shift, scale_factor) + self.0.read().rasterize_glyph( + font_id, + font_size, + glyph_id, + subpixel_shift, + scale_factor, + options, + ) } fn layout_line(&self, text: &str, font_size: f32, runs: &[(usize, RunStyle)]) -> LineLayout { @@ -168,6 +179,7 @@ impl FontSystemState { glyph_id: GlyphId, subpixel_shift: Vector2F, scale_factor: f32, + options: RasterizationOptions, ) -> Option<(RectI, Vec)> { let font = &self.fonts[font_id.0]; let scale = Transform2F::from_scale(scale_factor); @@ -177,7 +189,7 @@ impl FontSystemState { font_size, scale, HintingOptions::None, - RasterizationOptions::GrayscaleAa, + font_kit::canvas::RasterizationOptions::GrayscaleAa, ) .ok()?; @@ -185,18 +197,41 @@ impl FontSystemState { None } else { // Make room for subpixel variants. - let cx_bounds = RectI::new(glyph_bounds.origin(), glyph_bounds.size() + vec2i(1, 1)); - let mut bytes = vec![0; cx_bounds.width() as usize * cx_bounds.height() as usize]; - let cx = CGContext::create_bitmap_context( - Some(bytes.as_mut_ptr() as *mut _), - cx_bounds.width() as usize, - cx_bounds.height() as usize, - 8, - cx_bounds.width() as usize, - &CGColorSpace::create_device_gray(), - kCGImageAlphaOnly, + let subpixel_padding = subpixel_shift.ceil().to_i32(); + let cx_bounds = RectI::new( + glyph_bounds.origin(), + glyph_bounds.size() + subpixel_padding, ); + let mut bytes; + let cx; + match options { + RasterizationOptions::Alpha => { + bytes = vec![0; cx_bounds.width() as usize * cx_bounds.height() as usize]; + cx = CGContext::create_bitmap_context( + Some(bytes.as_mut_ptr() as *mut _), + cx_bounds.width() as usize, + cx_bounds.height() as usize, + 8, + cx_bounds.width() as usize, + &CGColorSpace::create_device_gray(), + kCGImageAlphaOnly, + ); + } + RasterizationOptions::Bgra => { + bytes = vec![0; cx_bounds.width() as usize * 4 * cx_bounds.height() as usize]; + cx = CGContext::create_bitmap_context( + Some(bytes.as_mut_ptr() as *mut _), + cx_bounds.width() as usize, + cx_bounds.height() as usize, + 8, + cx_bounds.width() as usize * 4, + &CGColorSpace::create_device_rgb(), + kCGImageAlphaPremultipliedLast, + ); + } + } + // Move the origin to bottom left and account for scaling, this // makes drawing text consistent with the font-kit's raster_bounds. cx.translate( @@ -220,6 +255,17 @@ impl FontSystemState { cx, ); + if let RasterizationOptions::Bgra = options { + // Convert from RGBA with premultiplied alpha to BGRA with straight alpha. + for pixel in bytes.chunks_exact_mut(4) { + pixel.swap(0, 2); + let a = pixel[3] as f32 / 255.; + pixel[0] = (pixel[0] as f32 / a) as u8; + pixel[1] = (pixel[1] as f32 / a) as u8; + pixel[2] = (pixel[2] as f32 / a) as u8; + } + } + Some((cx_bounds, bytes)) } } @@ -316,6 +362,7 @@ impl FontSystemState { id: *glyph_id as GlyphId, position: vec2f(position.x as f32, position.y as f32), index: ix_converter.utf8_ix, + is_emoji: font_id == self.emoji_font_id, }); } @@ -520,7 +567,14 @@ mod tests { for i in 0..VARIANTS { let variant = i as f32 / VARIANTS as f32; let (bounds, bytes) = fonts - .rasterize_glyph(font_id, 16.0, glyph_id, vec2f(variant, variant), 2.) + .rasterize_glyph( + font_id, + 16.0, + glyph_id, + vec2f(variant, variant), + 2., + RasterizationOptions::Alpha, + ) .unwrap(); let name = format!("/Users/as-cii/Desktop/twog-{}.png", i); diff --git a/crates/gpui/src/platform/mac/image_cache.rs b/crates/gpui/src/platform/mac/image_cache.rs index 37129d4feafae5d782affd522d5e0573134ae8cf..f16c62462b5c2c445eac9aa207457e90741e4c7e 100644 --- a/crates/gpui/src/platform/mac/image_cache.rs +++ b/crates/gpui/src/platform/mac/image_cache.rs @@ -1,21 +1,39 @@ -use anyhow::anyhow; -use metal::{MTLPixelFormat, TextureDescriptor, TextureRef}; - use super::atlas::{AllocId, AtlasAllocator}; use crate::{ + fonts::{FontId, GlyphId}, geometry::{rect::RectI, vector::Vector2I}, - ImageData, + platform::RasterizationOptions, + scene::ImageGlyph, + FontSystem, ImageData, }; -use std::{collections::HashMap, mem}; +use anyhow::anyhow; +use metal::{MTLPixelFormat, TextureDescriptor, TextureRef}; +use ordered_float::OrderedFloat; +use std::{collections::HashMap, mem, sync::Arc}; + +#[derive(Hash, Eq, PartialEq)] +struct GlyphDescriptor { + font_id: FontId, + font_size: OrderedFloat, + glyph_id: GlyphId, +} pub struct ImageCache { prev_frame: HashMap, curr_frame: HashMap, + image_glyphs: HashMap>, atlases: AtlasAllocator, + scale_factor: f32, + fonts: Arc, } impl ImageCache { - pub fn new(device: metal::Device, size: Vector2I) -> Self { + pub fn new( + device: metal::Device, + size: Vector2I, + scale_factor: f32, + fonts: Arc, + ) -> Self { let descriptor = TextureDescriptor::new(); descriptor.set_pixel_format(MTLPixelFormat::BGRA8Unorm); descriptor.set_width(size.x() as u64); @@ -23,7 +41,21 @@ impl ImageCache { Self { prev_frame: Default::default(), curr_frame: Default::default(), + image_glyphs: Default::default(), atlases: AtlasAllocator::new(device, descriptor), + scale_factor, + fonts, + } + } + + pub fn set_scale_factor(&mut self, scale_factor: f32) { + if scale_factor != self.scale_factor { + self.scale_factor = scale_factor; + for (_, glyph) in self.image_glyphs.drain() { + if let Some((alloc_id, _, _)) = glyph { + self.atlases.deallocate(alloc_id); + } + } } } @@ -39,6 +71,37 @@ impl ImageCache { (alloc_id, atlas_bounds) } + pub fn render_glyph(&mut self, image_glyph: &ImageGlyph) -> Option<(AllocId, RectI, Vector2I)> { + *self + .image_glyphs + .entry(GlyphDescriptor { + font_id: image_glyph.font_id, + font_size: OrderedFloat(image_glyph.font_size), + glyph_id: image_glyph.id, + }) + .or_insert_with(|| { + let (glyph_bounds, bytes) = self.fonts.rasterize_glyph( + image_glyph.font_id, + image_glyph.font_size, + image_glyph.id, + Default::default(), + self.scale_factor, + RasterizationOptions::Bgra, + )?; + let (alloc_id, atlas_bounds) = self + .atlases + .upload(glyph_bounds.size(), &bytes) + .ok_or_else(|| { + anyhow!( + "could not upload image glyph of size {:?}", + glyph_bounds.size() + ) + }) + .unwrap(); + Some((alloc_id, atlas_bounds, glyph_bounds.origin())) + }) + } + pub fn finish_frame(&mut self) { mem::swap(&mut self.prev_frame, &mut self.curr_frame); for (_, (id, _)) in self.curr_frame.drain() { diff --git a/crates/gpui/src/platform/mac/renderer.rs b/crates/gpui/src/platform/mac/renderer.rs index b06dabc738c4c86aadc18d0491c88e3cbb316f74..99dbd2030e0ed2fb3bea88bd295055024d9c879b 100644 --- a/crates/gpui/src/platform/mac/renderer.rs +++ b/crates/gpui/src/platform/mac/renderer.rs @@ -6,7 +6,7 @@ use crate::{ vector::{vec2f, vec2i, Vector2F}, }, platform, - scene::{Glyph, Icon, Image, Layer, Quad, Scene, Shadow, Underline}, + scene::{Glyph, Icon, Image, ImageGlyph, Layer, Quad, Scene, Shadow, Underline}, }; use cocoa::foundation::NSUInteger; use log::warn; @@ -67,8 +67,13 @@ impl Renderer { MTLResourceOptions::StorageModeManaged, ); - let sprite_cache = SpriteCache::new(device.clone(), vec2i(1024, 768), scale_factor, fonts); - let image_cache = ImageCache::new(device.clone(), vec2i(1024, 768)); + let sprite_cache = SpriteCache::new( + device.clone(), + vec2i(1024, 768), + scale_factor, + fonts.clone(), + ); + let image_cache = ImageCache::new(device.clone(), vec2i(1024, 768), scale_factor, fonts); let path_atlases = AtlasAllocator::new(device.clone(), build_path_atlas_texture_descriptor()); let quad_pipeline_state = build_pipeline_state( @@ -141,6 +146,9 @@ impl Renderer { command_buffer: &metal::CommandBufferRef, output: &metal::TextureRef, ) { + self.sprite_cache.set_scale_factor(scene.scale_factor()); + self.image_cache.set_scale_factor(scene.scale_factor()); + let mut offset = 0; let path_sprites = self.render_path_atlases(scene, &mut offset, command_buffer); @@ -359,6 +367,7 @@ impl Renderer { ); self.render_images( layer.images(), + layer.image_glyphs(), scale_factor, offset, drawable_size, @@ -541,8 +550,6 @@ impl Renderer { return; } - self.sprite_cache.set_scale_factor(scale_factor); - let mut sprites_by_atlas = HashMap::new(); for glyph in glyphs { @@ -653,12 +660,13 @@ impl Renderer { fn render_images( &mut self, images: &[Image], + image_glyphs: &[ImageGlyph], scale_factor: f32, offset: &mut usize, drawable_size: Vector2F, command_encoder: &metal::RenderCommandEncoderRef, ) { - if images.is_empty() { + if images.is_empty() && image_glyphs.is_empty() { return; } @@ -686,6 +694,31 @@ impl Renderer { }); } + for image_glyph in image_glyphs { + let origin = (image_glyph.origin * scale_factor).floor(); + if let Some((alloc_id, atlas_bounds, glyph_origin)) = + self.image_cache.render_glyph(image_glyph) + { + images_by_atlas + .entry(alloc_id.atlas_id) + .or_insert_with(Vec::new) + .push(shaders::GPUIImage { + origin: (origin + glyph_origin.to_f32()).to_float2(), + target_size: atlas_bounds.size().to_float2(), + source_size: atlas_bounds.size().to_float2(), + atlas_origin: atlas_bounds.origin().to_float2(), + border_top: 0., + border_right: 0., + border_bottom: 0., + border_left: 0., + border_color: Default::default(), + corner_radius: 0., + }); + } else { + log::warn!("could not render glyph with id {}", image_glyph.id); + } + } + command_encoder.set_render_pipeline_state(&self.image_pipeline_state); command_encoder.set_vertex_buffer( shaders::GPUIImageVertexInputIndex_GPUIImageVertexInputIndexVertices as u64, diff --git a/crates/gpui/src/platform/mac/sprite_cache.rs b/crates/gpui/src/platform/mac/sprite_cache.rs index a9e6acb53fd895bf9a170f109522b2a4fa041be3..a93df3b187bbc07fd334efb571563ded383e8131 100644 --- a/crates/gpui/src/platform/mac/sprite_cache.rs +++ b/crates/gpui/src/platform/mac/sprite_cache.rs @@ -2,7 +2,7 @@ use super::atlas::AtlasAllocator; use crate::{ fonts::{FontId, GlyphId}, geometry::vector::{vec2f, Vector2F, Vector2I}, - platform, + platform::{self, RasterizationOptions}, }; use collections::hash_map::Entry; use metal::{MTLPixelFormat, TextureDescriptor}; @@ -113,6 +113,7 @@ impl SpriteCache { glyph_id, subpixel_shift, scale_factor, + RasterizationOptions::Alpha, )?; let (alloc_id, atlas_bounds) = atlases diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs index 450edc6d8f6ea09c52d43025446c390c98361af8..6c23a731bcfe7bc13cc2421cc856cdf28df93eba 100644 --- a/crates/gpui/src/scene.rs +++ b/crates/gpui/src/scene.rs @@ -29,6 +29,7 @@ pub struct Layer { images: Vec, shadows: Vec, glyphs: Vec, + image_glyphs: Vec, icons: Vec, paths: Vec, } @@ -58,6 +59,14 @@ pub struct Glyph { pub color: Color, } +#[derive(Debug)] +pub struct ImageGlyph { + pub font_id: FontId, + pub font_size: f32, + pub id: GlyphId, + pub origin: Vector2F, +} + pub struct Icon { pub bounds: RectF, pub svg: usvg::Tree, @@ -204,6 +213,10 @@ impl Scene { self.active_layer().push_glyph(glyph) } + pub fn push_image_glyph(&mut self, image_glyph: ImageGlyph) { + self.active_layer().push_image_glyph(image_glyph) + } + pub fn push_icon(&mut self, icon: Icon) { self.active_layer().push_icon(icon) } @@ -264,13 +277,14 @@ impl Layer { pub fn new(clip_bounds: Option) -> Self { Self { clip_bounds, - quads: Vec::new(), - underlines: Vec::new(), - images: Vec::new(), - shadows: Vec::new(), - glyphs: Vec::new(), - icons: Vec::new(), - paths: Vec::new(), + quads: Default::default(), + underlines: Default::default(), + images: Default::default(), + shadows: Default::default(), + image_glyphs: Default::default(), + glyphs: Default::default(), + icons: Default::default(), + paths: Default::default(), } } @@ -318,6 +332,14 @@ impl Layer { self.shadows.as_slice() } + fn push_image_glyph(&mut self, glyph: ImageGlyph) { + self.image_glyphs.push(glyph); + } + + pub fn image_glyphs(&self) -> &[ImageGlyph] { + self.image_glyphs.as_slice() + } + fn push_glyph(&mut self, glyph: Glyph) { self.glyphs.push(glyph); } diff --git a/crates/gpui/src/text_layout.rs b/crates/gpui/src/text_layout.rs index a866ea0a85086f810a130d9dcb477a18834a5043..2d8672aab3dc9e283e7d3faee856bc22a31b54fc 100644 --- a/crates/gpui/src/text_layout.rs +++ b/crates/gpui/src/text_layout.rs @@ -191,6 +191,7 @@ pub struct Glyph { pub id: GlyphId, pub position: Vector2F, pub index: usize, + pub is_emoji: bool, } impl Line { @@ -323,13 +324,22 @@ impl Line { }); } - cx.scene.push_glyph(scene::Glyph { - font_id: run.font_id, - font_size: self.layout.font_size, - id: glyph.id, - origin: glyph_origin, - color, - }); + if glyph.is_emoji { + cx.scene.push_image_glyph(scene::ImageGlyph { + font_id: run.font_id, + font_size: self.layout.font_size, + id: glyph.id, + origin: glyph_origin, + }); + } else { + cx.scene.push_glyph(scene::Glyph { + font_id: run.font_id, + font_size: self.layout.font_size, + id: glyph.id, + origin: glyph_origin, + color, + }); + } } } @@ -389,13 +399,22 @@ impl Line { .bounding_box(run.font_id, self.layout.font_size), ); if glyph_bounds.intersects(visible_bounds) { - cx.scene.push_glyph(scene::Glyph { - font_id: run.font_id, - font_size: self.layout.font_size, - id: glyph.id, - origin: glyph_bounds.origin() + baseline_origin, - color, - }); + if glyph.is_emoji { + cx.scene.push_image_glyph(scene::ImageGlyph { + font_id: run.font_id, + font_size: self.layout.font_size, + id: glyph.id, + origin: glyph_bounds.origin() + baseline_origin, + }); + } else { + cx.scene.push_glyph(scene::Glyph { + font_id: run.font_id, + font_size: self.layout.font_size, + id: glyph.id, + origin: glyph_bounds.origin() + baseline_origin, + color, + }); + } } } } From 847322215e5f499cfecea63353fe9531204538ae Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 09:34:42 -0700 Subject: [PATCH 168/245] 0.26.0 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4309508ab7161f05fe94119e6996219bb50d5750..ccb0eefa47938f3b0754afdfe9762af28b044e97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6126,7 +6126,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.25.0" +version = "0.26.0" dependencies = [ "anyhow", "assets", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 886f20bdbc4400ee8c19984d1518676aa5c1c09a..d8aa58721d8b68e3506bba1ace28f3b8b16fc908 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.25.0" +version = "0.26.0" [lib] name = "zed" From 8e890747145574c2a75e8766be60a75e561e149d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 13 Apr 2022 19:06:34 +0200 Subject: [PATCH 169/245] Reduce allocations when caching fonts Co-Authored-By: Nathan Sobo --- crates/gpui/src/platform/mac/fonts.rs | 63 +++++++++++++++++---------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index 417bfe6728abcad67526c40c4f238523ce698ed7..5a08cacf09d78aa36dc1158ff7de61686c36c5c7 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -9,6 +9,7 @@ use crate::{ text_layout::{Glyph, LineLayout, Run, RunStyle}, }; use cocoa::appkit::{CGFloat, CGPoint}; +use collections::HashMap; use core_foundation::{ array::CFIndex, attributed_string::{CFAttributedStringRef, CFMutableAttributedString}, @@ -36,19 +37,19 @@ struct FontSystemState { memory_source: MemSource, system_source: SystemSource, fonts: Vec, - emoji_font_id: FontId, + font_ids_by_postscript_name: HashMap, + postscript_names_by_font_id: HashMap, } impl FontSystem { pub fn new() -> Self { - let mut state = FontSystemState { + Self(RwLock::new(FontSystemState { memory_source: MemSource::empty(), system_source: SystemSource::new(), fonts: Vec::new(), - emoji_font_id: FontId(0), // This will be the first font that we load. - }; - state.load_family("Apple Color Emoji").unwrap(); - Self(RwLock::new(state)) + font_ids_by_postscript_name: Default::default(), + postscript_names_by_font_id: Default::default(), + })) } } @@ -128,7 +129,13 @@ impl FontSystemState { .or_else(|_| self.system_source.select_family_by_name(name))?; for font in family.fonts() { let font = font.load()?; - font_ids.push(FontId(self.fonts.len())); + let font_id = FontId(self.fonts.len()); + font_ids.push(font_id); + let postscript_name = font.postscript_name().unwrap(); + self.font_ids_by_postscript_name + .insert(postscript_name.clone(), font_id); + self.postscript_names_by_font_id + .insert(font_id, postscript_name); self.fonts.push(font); } Ok(font_ids) @@ -159,17 +166,30 @@ impl FontSystemState { self.fonts[font_id.0].glyph_for_char(ch) } - fn id_for_font(&mut self, requested_font: font_kit::font::Font) -> FontId { - // TODO: don't allocate the postscript name - // Note: Coretext always returns a Some option for postscript_name - let requested_font_name = requested_font.postscript_name(); - for (id, font) in self.fonts.iter().enumerate() { - if font.postscript_name() == requested_font_name { - return FontId(id); - } + fn id_for_native_font(&mut self, requested_font: CTFont) -> FontId { + let postscript_name = requested_font.postscript_name(); + if let Some(font_id) = self.font_ids_by_postscript_name.get(&postscript_name) { + *font_id + } else { + let font_id = FontId(self.fonts.len()); + self.font_ids_by_postscript_name + .insert(postscript_name.clone(), font_id); + self.postscript_names_by_font_id + .insert(font_id, postscript_name); + self.fonts + .push(font_kit::font::Font::from_core_graphics_font( + requested_font.copy_to_CGFont(), + )); + font_id } - self.fonts.push(requested_font); - FontId(self.fonts.len() - 1) + } + + fn is_emoji(&self, font_id: FontId) -> bool { + self.postscript_names_by_font_id + .get(&font_id) + .map_or(false, |postscript_name| { + postscript_name == "AppleColorEmoji" + }) } fn rasterize_glyph( @@ -340,13 +360,12 @@ impl FontSystemState { for run in line.glyph_runs().into_iter() { let attributes = run.attributes().unwrap(); let font = unsafe { - let native_font = attributes + attributes .get(kCTFontAttributeName) .downcast::() - .unwrap(); - font_kit::font::Font::from_native_font(native_font) + .unwrap() }; - let font_id = self.id_for_font(font); + let font_id = self.id_for_native_font(font); let mut ix_converter = StringIndexConverter::new(text); let mut glyphs = Vec::new(); @@ -362,7 +381,7 @@ impl FontSystemState { id: *glyph_id as GlyphId, position: vec2f(position.x as f32, position.y as f32), index: ix_converter.utf8_ix, - is_emoji: font_id == self.emoji_font_id, + is_emoji: self.is_emoji(font_id), }); } From 1e0182f6c7abc269df1069df89f555eecf46328e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 10:35:05 -0700 Subject: [PATCH 170/245] Add back key binding for confirming completions with tab --- assets/keymaps/default.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index b517f9aebbd450826cf7867b8a9b5f8667de5736..d0275a31b67bebab9fc17d988a9a26a98aa5f68b 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -205,7 +205,8 @@ "enter": "editor::ConfirmRename" }, "Editor && showing_completions": { - "enter": "editor::ConfirmCompletion" + "enter": "editor::ConfirmCompletion", + "tab": "editor::ConfirmCompletion" }, "Editor && showing_code_actions": { "enter": "editor::ConfirmCodeAction" From 544ca443e3dc51e94557c4284f79003d228dc719 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Tue, 12 Apr 2022 11:30:37 -0700 Subject: [PATCH 171/245] Add javascript and jsx specific languages --- crates/zed/src/languages.rs | 10 + .../zed/src/languages/javascript/brackets.scm | 5 + .../zed/src/languages/javascript/config.toml | 12 + .../src/languages/javascript/highlights.scm | 219 ++++++++++++++++++ .../zed/src/languages/javascript/indents.scm | 15 ++ .../zed/src/languages/javascript/outline.scm | 55 +++++ crates/zed/src/languages/jsx/brackets.scm | 5 + crates/zed/src/languages/jsx/config.toml | 12 + .../zed/src/languages/jsx/highlights-jsx.scm | 0 crates/zed/src/languages/jsx/highlights.scm | 219 ++++++++++++++++++ crates/zed/src/languages/jsx/indents.scm | 15 ++ crates/zed/src/languages/jsx/outline.scm | 55 +++++ crates/zed/src/languages/tsx/config.toml | 2 +- crates/zed/src/main.rs | 14 ++ 14 files changed, 637 insertions(+), 1 deletion(-) create mode 100644 crates/zed/src/languages/javascript/brackets.scm create mode 100644 crates/zed/src/languages/javascript/config.toml create mode 100644 crates/zed/src/languages/javascript/highlights.scm create mode 100644 crates/zed/src/languages/javascript/indents.scm create mode 100644 crates/zed/src/languages/javascript/outline.scm create mode 100644 crates/zed/src/languages/jsx/brackets.scm create mode 100644 crates/zed/src/languages/jsx/config.toml create mode 100644 crates/zed/src/languages/jsx/highlights-jsx.scm create mode 100644 crates/zed/src/languages/jsx/highlights.scm create mode 100644 crates/zed/src/languages/jsx/indents.scm create mode 100644 crates/zed/src/languages/jsx/outline.scm diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs index 75a5030ec6a9991ef87d7ebc764c5aabaa6d27d6..b62ae1bfdbb54300eca966f1827664d7c4690dd5 100644 --- a/crates/zed/src/languages.rs +++ b/crates/zed/src/languages.rs @@ -42,11 +42,21 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi tree_sitter_typescript::language_tsx(), Some(Arc::new(typescript::TypeScriptLspAdapter)), ), + ( + "jsx", + tree_sitter_typescript::language_tsx(), + Some(Arc::new(typescript::TypeScriptLspAdapter)), + ), ( "typescript", tree_sitter_typescript::language_typescript(), Some(Arc::new(typescript::TypeScriptLspAdapter)), ), + ( + "javascript", + tree_sitter_typescript::language_typescript(), + Some(Arc::new(typescript::TypeScriptLspAdapter)), + ), ] { languages.add(Arc::new(language(name, grammar, lsp_adapter))); } diff --git a/crates/zed/src/languages/javascript/brackets.scm b/crates/zed/src/languages/javascript/brackets.scm new file mode 100644 index 0000000000000000000000000000000000000000..63395f81d84e6452c631a9e582e2d697cba445ef --- /dev/null +++ b/crates/zed/src/languages/javascript/brackets.scm @@ -0,0 +1,5 @@ +("(" @open ")" @close) +("[" @open "]" @close) +("{" @open "}" @close) +("<" @open ">" @close) +("\"" @open "\"" @close) diff --git a/crates/zed/src/languages/javascript/config.toml b/crates/zed/src/languages/javascript/config.toml new file mode 100644 index 0000000000000000000000000000000000000000..875dcdaf8e585908bbf9b05b64f43dcc2ee25b91 --- /dev/null +++ b/crates/zed/src/languages/javascript/config.toml @@ -0,0 +1,12 @@ +name = "JavaScript" +path_suffixes = ["js"] +line_comment = "// " +autoclose_before = ";:.,=}])>" +brackets = [ + { start = "{", end = "}", close = true, newline = true }, + { start = "[", end = "]", close = true, newline = true }, + { start = "(", end = ")", close = true, newline = true }, + { start = "<", end = ">", close = false, newline = true }, + { start = "\"", end = "\"", close = true, newline = false }, + { start = "/*", end = " */", close = true, newline = false }, +] diff --git a/crates/zed/src/languages/javascript/highlights.scm b/crates/zed/src/languages/javascript/highlights.scm new file mode 100644 index 0000000000000000000000000000000000000000..cb4e82b33d8b04da41e90c6926499669fee33b60 --- /dev/null +++ b/crates/zed/src/languages/javascript/highlights.scm @@ -0,0 +1,219 @@ +; Variables + +(identifier) @variable + +; Properties + +(property_identifier) @property + +; Function and method calls + +(call_expression + function: (identifier) @function) + +(call_expression + function: (member_expression + property: (property_identifier) @function.method)) + +; Function and method definitions + +(function + name: (identifier) @function) +(function_declaration + name: (identifier) @function) +(method_definition + name: (property_identifier) @function.method) + +(pair + key: (property_identifier) @function.method + value: [(function) (arrow_function)]) + +(assignment_expression + left: (member_expression + property: (property_identifier) @function.method) + right: [(function) (arrow_function)]) + +(variable_declarator + name: (identifier) @function + value: [(function) (arrow_function)]) + +(assignment_expression + left: (identifier) @function + right: [(function) (arrow_function)]) + +; Special identifiers + +((identifier) @constructor + (#match? @constructor "^[A-Z]")) + +([ + (identifier) + (shorthand_property_identifier) + (shorthand_property_identifier_pattern) + ] @constant + (#match? @constant "^[A-Z_][A-Z\\d_]+$")) + +; Literals + +(this) @variable.builtin +(super) @variable.builtin + +[ + (true) + (false) + (null) + (undefined) +] @constant.builtin + +(comment) @comment + +[ + (string) + (template_string) +] @string + +(regex) @string.special +(number) @number + +; Tokens + +(template_substitution + "${" @punctuation.special + "}" @punctuation.special) @embedded + +[ + ";" + "?." + "." + "," +] @punctuation.delimiter + +[ + "-" + "--" + "-=" + "+" + "++" + "+=" + "*" + "*=" + "**" + "**=" + "/" + "/=" + "%" + "%=" + "<" + "<=" + "<<" + "<<=" + "=" + "==" + "===" + "!" + "!=" + "!==" + "=>" + ">" + ">=" + ">>" + ">>=" + ">>>" + ">>>=" + "~" + "^" + "&" + "|" + "^=" + "&=" + "|=" + "&&" + "||" + "??" + "&&=" + "||=" + "??=" +] @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "as" + "async" + "await" + "break" + "case" + "catch" + "class" + "const" + "continue" + "debugger" + "default" + "delete" + "do" + "else" + "export" + "extends" + "finally" + "for" + "from" + "function" + "get" + "if" + "import" + "in" + "instanceof" + "let" + "new" + "of" + "return" + "set" + "static" + "switch" + "target" + "throw" + "try" + "typeof" + "var" + "void" + "while" + "with" + "yield" +] @keyword + +; Types + +(type_identifier) @type +(predefined_type) @type.builtin + +((identifier) @type + (#match? @type "^[A-Z]")) + +(type_arguments + "<" @punctuation.bracket + ">" @punctuation.bracket) + +; Keywords + +[ "abstract" + "declare" + "enum" + "export" + "implements" + "interface" + "keyof" + "namespace" + "private" + "protected" + "public" + "type" + "readonly" + "override" +] @keyword \ No newline at end of file diff --git a/crates/zed/src/languages/javascript/indents.scm b/crates/zed/src/languages/javascript/indents.scm new file mode 100644 index 0000000000000000000000000000000000000000..107e6ff8e03b633f408676243c24d0d9707a2a26 --- /dev/null +++ b/crates/zed/src/languages/javascript/indents.scm @@ -0,0 +1,15 @@ +[ + (call_expression) + (assignment_expression) + (member_expression) + (lexical_declaration) + (variable_declaration) + (assignment_expression) + (if_statement) + (for_statement) +] @indent + +(_ "[" "]" @end) @indent +(_ "<" ">" @end) @indent +(_ "{" "}" @end) @indent +(_ "(" ")" @end) @indent diff --git a/crates/zed/src/languages/javascript/outline.scm b/crates/zed/src/languages/javascript/outline.scm new file mode 100644 index 0000000000000000000000000000000000000000..f8691fa41d9f64bc71e8a7ada2e6d64d62268a3a --- /dev/null +++ b/crates/zed/src/languages/javascript/outline.scm @@ -0,0 +1,55 @@ +(internal_module + "namespace" @context + name: (_) @name) @item + +(enum_declaration + "enum" @context + name: (_) @name) @item + +(function_declaration + "async"? @context + "function" @context + name: (_) @name + parameters: (formal_parameters + "(" @context + ")" @context)) @item + +(interface_declaration + "interface" @context + name: (_) @name) @item + +(program + (lexical_declaration + ["let" "const"] @context + (variable_declarator + name: (_) @name) @item)) + +(class_declaration + "class" @context + name: (_) @name) @item + +(method_definition + [ + "get" + "set" + "async" + "*" + "readonly" + "static" + (override_modifier) + (accessibility_modifier) + ]* @context + name: (_) @name + parameters: (formal_parameters + "(" @context + ")" @context)) @item + +(public_field_definition + [ + "declare" + "readonly" + "abstract" + "static" + (accessibility_modifier) + ]* @context + name: (_) @name) @item diff --git a/crates/zed/src/languages/jsx/brackets.scm b/crates/zed/src/languages/jsx/brackets.scm new file mode 100644 index 0000000000000000000000000000000000000000..63395f81d84e6452c631a9e582e2d697cba445ef --- /dev/null +++ b/crates/zed/src/languages/jsx/brackets.scm @@ -0,0 +1,5 @@ +("(" @open ")" @close) +("[" @open "]" @close) +("{" @open "}" @close) +("<" @open ">" @close) +("\"" @open "\"" @close) diff --git a/crates/zed/src/languages/jsx/config.toml b/crates/zed/src/languages/jsx/config.toml new file mode 100644 index 0000000000000000000000000000000000000000..3e4dc5f79f300de8ec2883f6d012b64e0c989dc4 --- /dev/null +++ b/crates/zed/src/languages/jsx/config.toml @@ -0,0 +1,12 @@ +name = "JSX" +path_suffixes = ["jsx"] +line_comment = "// " +autoclose_before = ";:.,=}])>" +brackets = [ + { start = "{", end = "}", close = true, newline = true }, + { start = "[", end = "]", close = true, newline = true }, + { start = "(", end = ")", close = true, newline = true }, + { start = "<", end = ">", close = false, newline = true }, + { start = "\"", end = "\"", close = true, newline = false }, + { start = "/*", end = " */", close = true, newline = false }, +] diff --git a/crates/zed/src/languages/jsx/highlights-jsx.scm b/crates/zed/src/languages/jsx/highlights-jsx.scm new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/crates/zed/src/languages/jsx/highlights.scm b/crates/zed/src/languages/jsx/highlights.scm new file mode 100644 index 0000000000000000000000000000000000000000..cb4e82b33d8b04da41e90c6926499669fee33b60 --- /dev/null +++ b/crates/zed/src/languages/jsx/highlights.scm @@ -0,0 +1,219 @@ +; Variables + +(identifier) @variable + +; Properties + +(property_identifier) @property + +; Function and method calls + +(call_expression + function: (identifier) @function) + +(call_expression + function: (member_expression + property: (property_identifier) @function.method)) + +; Function and method definitions + +(function + name: (identifier) @function) +(function_declaration + name: (identifier) @function) +(method_definition + name: (property_identifier) @function.method) + +(pair + key: (property_identifier) @function.method + value: [(function) (arrow_function)]) + +(assignment_expression + left: (member_expression + property: (property_identifier) @function.method) + right: [(function) (arrow_function)]) + +(variable_declarator + name: (identifier) @function + value: [(function) (arrow_function)]) + +(assignment_expression + left: (identifier) @function + right: [(function) (arrow_function)]) + +; Special identifiers + +((identifier) @constructor + (#match? @constructor "^[A-Z]")) + +([ + (identifier) + (shorthand_property_identifier) + (shorthand_property_identifier_pattern) + ] @constant + (#match? @constant "^[A-Z_][A-Z\\d_]+$")) + +; Literals + +(this) @variable.builtin +(super) @variable.builtin + +[ + (true) + (false) + (null) + (undefined) +] @constant.builtin + +(comment) @comment + +[ + (string) + (template_string) +] @string + +(regex) @string.special +(number) @number + +; Tokens + +(template_substitution + "${" @punctuation.special + "}" @punctuation.special) @embedded + +[ + ";" + "?." + "." + "," +] @punctuation.delimiter + +[ + "-" + "--" + "-=" + "+" + "++" + "+=" + "*" + "*=" + "**" + "**=" + "/" + "/=" + "%" + "%=" + "<" + "<=" + "<<" + "<<=" + "=" + "==" + "===" + "!" + "!=" + "!==" + "=>" + ">" + ">=" + ">>" + ">>=" + ">>>" + ">>>=" + "~" + "^" + "&" + "|" + "^=" + "&=" + "|=" + "&&" + "||" + "??" + "&&=" + "||=" + "??=" +] @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "as" + "async" + "await" + "break" + "case" + "catch" + "class" + "const" + "continue" + "debugger" + "default" + "delete" + "do" + "else" + "export" + "extends" + "finally" + "for" + "from" + "function" + "get" + "if" + "import" + "in" + "instanceof" + "let" + "new" + "of" + "return" + "set" + "static" + "switch" + "target" + "throw" + "try" + "typeof" + "var" + "void" + "while" + "with" + "yield" +] @keyword + +; Types + +(type_identifier) @type +(predefined_type) @type.builtin + +((identifier) @type + (#match? @type "^[A-Z]")) + +(type_arguments + "<" @punctuation.bracket + ">" @punctuation.bracket) + +; Keywords + +[ "abstract" + "declare" + "enum" + "export" + "implements" + "interface" + "keyof" + "namespace" + "private" + "protected" + "public" + "type" + "readonly" + "override" +] @keyword \ No newline at end of file diff --git a/crates/zed/src/languages/jsx/indents.scm b/crates/zed/src/languages/jsx/indents.scm new file mode 100644 index 0000000000000000000000000000000000000000..107e6ff8e03b633f408676243c24d0d9707a2a26 --- /dev/null +++ b/crates/zed/src/languages/jsx/indents.scm @@ -0,0 +1,15 @@ +[ + (call_expression) + (assignment_expression) + (member_expression) + (lexical_declaration) + (variable_declaration) + (assignment_expression) + (if_statement) + (for_statement) +] @indent + +(_ "[" "]" @end) @indent +(_ "<" ">" @end) @indent +(_ "{" "}" @end) @indent +(_ "(" ")" @end) @indent diff --git a/crates/zed/src/languages/jsx/outline.scm b/crates/zed/src/languages/jsx/outline.scm new file mode 100644 index 0000000000000000000000000000000000000000..f8691fa41d9f64bc71e8a7ada2e6d64d62268a3a --- /dev/null +++ b/crates/zed/src/languages/jsx/outline.scm @@ -0,0 +1,55 @@ +(internal_module + "namespace" @context + name: (_) @name) @item + +(enum_declaration + "enum" @context + name: (_) @name) @item + +(function_declaration + "async"? @context + "function" @context + name: (_) @name + parameters: (formal_parameters + "(" @context + ")" @context)) @item + +(interface_declaration + "interface" @context + name: (_) @name) @item + +(program + (lexical_declaration + ["let" "const"] @context + (variable_declarator + name: (_) @name) @item)) + +(class_declaration + "class" @context + name: (_) @name) @item + +(method_definition + [ + "get" + "set" + "async" + "*" + "readonly" + "static" + (override_modifier) + (accessibility_modifier) + ]* @context + name: (_) @name + parameters: (formal_parameters + "(" @context + ")" @context)) @item + +(public_field_definition + [ + "declare" + "readonly" + "abstract" + "static" + (accessibility_modifier) + ]* @context + name: (_) @name) @item diff --git a/crates/zed/src/languages/tsx/config.toml b/crates/zed/src/languages/tsx/config.toml index a6f4a6d2d000d5bcf83219a27b52446178c7e079..62717266df9e0bd56d83b336cfbf28aa2b01ee4b 100644 --- a/crates/zed/src/languages/tsx/config.toml +++ b/crates/zed/src/languages/tsx/config.toml @@ -1,5 +1,5 @@ name = "TSX" -path_suffixes = ["tsx", "js"] +path_suffixes = ["tsx"] line_comment = "// " autoclose_before = ";:.,=}])>" brackets = [ diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 1c24c613d7cb437fbe92c97b46ab5372a29ed92e..599754dd9e0abfb63eec8c2ba04ccb4587713f83 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -55,6 +55,20 @@ fn main() { ..Default::default() }, ) + .with_overrides( + "JavaScript", + settings::LanguageOverride { + tab_size: Some(2), + ..Default::default() + }, + ) + .with_overrides( + "JSX", + settings::LanguageOverride { + tab_size: Some(2), + ..Default::default() + }, + ) .with_overrides( "TypeScript", settings::LanguageOverride { From 2ea2ba358f215499f41e85cb3dd96c7016578425 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 11:08:21 -0700 Subject: [PATCH 172/245] Add back toggle sidebar key bindings --- assets/keymaps/default.json | 16 +++++++++++++++- crates/workspace/src/sidebar.rs | 15 +++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index d0275a31b67bebab9fc17d988a9a26a98aa5f68b..d9d5742b663ca80a52d88f906e9ba791c9dda707 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -53,7 +53,21 @@ "cmd-t": "project_symbols::Toggle", "cmd-p": "file_finder::Toggle", "alt-shift-D": "diagnostics::Deploy", - "ctrl-alt-cmd-j": "journal::NewJournalEntry" + "ctrl-alt-cmd-j": "journal::NewJournalEntry", + "cmd-1": [ + "workspace::ToggleSidebarItemFocus", + { + "side": "Left", + "item_index": 0 + } + ], + "cmd-shift-!": [ + "workspace::ToggleSidebarItem", + { + "side": "Left", + "item_index": 0 + } + ] }, "ProjectSearchBar": { "enter": "project_search::Search", diff --git a/crates/workspace/src/sidebar.rs b/crates/workspace/src/sidebar.rs index 78b1d4a6ea1224c59a4e127d27823ac87330a603..cd5ec3220127609805bae9b285d39ee8a20d9339 100644 --- a/crates/workspace/src/sidebar.rs +++ b/crates/workspace/src/sidebar.rs @@ -1,7 +1,6 @@ use super::Workspace; -use gpui::{ - elements::*, impl_internal_actions, platform::CursorStyle, AnyViewHandle, RenderContext, -}; +use gpui::{elements::*, impl_actions, platform::CursorStyle, AnyViewHandle, RenderContext}; +use serde::Deserialize; use std::{cell::RefCell, rc::Rc}; use theme::Theme; @@ -12,7 +11,7 @@ pub struct Sidebar { width: Rc>, } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Deserialize)] pub enum Side { Left, Right, @@ -23,15 +22,15 @@ struct Item { view: AnyViewHandle, } -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct ToggleSidebarItem(pub SidebarItemId); -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct ToggleSidebarItemFocus(pub SidebarItemId); -impl_internal_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]); +impl_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]); -#[derive(Clone)] +#[derive(Clone, Deserialize)] pub struct SidebarItemId { pub side: Side, pub item_index: usize, From f20e3f35a1855e35af5f7fe6f765fba764623b7c Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 12:30:33 -0700 Subject: [PATCH 173/245] Record scroll position in nav history --- crates/editor/src/editor.rs | 25 ++++++++++++++++++++++++- crates/editor/src/items.rs | 9 +++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index bc398754a78edcf1f889e4dff1bd5328ba697f88..73674362c6b260cd8b1e431ca36a3445dfa996f9 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -850,6 +850,9 @@ struct ClipboardSelection { pub struct NavigationData { anchor: Anchor, offset: usize, + scroll_position: Vector2F, + scroll_top_anchor: Anchor, + scroll_top_offset: usize, } pub struct EditorCreated(pub ViewHandle); @@ -3896,6 +3899,7 @@ impl Editor { let buffer = self.buffer.read(cx).read(cx); let offset = position.to_offset(&buffer); let point = position.to_point(&buffer); + let scroll_top_offset = self.scroll_top_anchor.to_offset(&buffer); drop(buffer); if let Some(new_position) = new_position { @@ -3908,6 +3912,9 @@ impl Editor { nav_history.push(Some(NavigationData { anchor: position, offset, + scroll_position: self.scroll_position, + scroll_top_anchor: self.scroll_top_anchor.clone(), + scroll_top_offset, })); } } @@ -6705,7 +6712,7 @@ mod tests { cx.set_global(Settings::test(cx)); use workspace::Item; let nav_history = Rc::new(RefCell::new(workspace::NavHistory::default())); - let buffer = MultiBuffer::build_simple(&sample_text(30, 5, 'a'), cx); + let buffer = MultiBuffer::build_simple(&sample_text(300, 5, 'a'), cx); cx.add_window(Default::default(), |cx| { let mut editor = build_editor(buffer.clone(), cx); @@ -6756,6 +6763,22 @@ mod tests { ); assert!(nav_history.borrow_mut().pop_backward().is_none()); + // Set scroll position to check later + editor.set_scroll_position(Vector2F::new(5.5, 5.5), cx); + let original_scroll_position = editor.scroll_position; + let original_scroll_top_anchor = editor.scroll_top_anchor.clone(); + + // Jump to the end of the document and adjust scroll + editor.move_to_end(&MoveToEnd, cx); + editor.set_scroll_position(Vector2F::new(-2.5, -0.5), cx); + assert_ne!(editor.scroll_position, original_scroll_position); + assert_ne!(editor.scroll_top_anchor, original_scroll_top_anchor); + + let nav_entry = nav_history.borrow_mut().pop_backward().unwrap(); + editor.navigate(nav_entry.data.unwrap(), cx); + assert_eq!(editor.scroll_position, original_scroll_position); + assert_eq!(editor.scroll_top_anchor, original_scroll_top_anchor); + editor }); } diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 9a102dd5ce66661f6b1b4c5e37d2ecafa98393b1..7e767b10a2bbdc44613d02fbef5277d85af69c72 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -253,12 +253,21 @@ impl Item for Editor { buffer.clip_offset(data.offset, Bias::Left) }; let newest_selection = self.newest_selection_with_snapshot::(&buffer); + + let scroll_top_anchor = if buffer.can_resolve(&data.scroll_top_anchor) { + data.scroll_top_anchor.clone() + } else { + buffer.anchor_at(data.scroll_top_offset, Bias::Left) + }; + drop(buffer); if newest_selection.head() == offset { false } else { let nav_history = self.nav_history.take(); + self.scroll_position = data.scroll_position; + self.scroll_top_anchor = scroll_top_anchor; self.select_ranges([offset..offset], Some(Autoscroll::Fit), cx); self.nav_history = nav_history; true From 9cec6d8d651bbbf5825ccd0bb0099d3a6b0c0160 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 13:30:03 -0700 Subject: [PATCH 174/245] add comment explaining offsets --- crates/editor/src/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 73674362c6b260cd8b1e431ca36a3445dfa996f9..c67a9c233fd06428426dc210c368da443dd48133 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -848,6 +848,8 @@ struct ClipboardSelection { } pub struct NavigationData { + // Matching offsets for anchor and scroll_top_anchor allows us to recreate the anchor if the buffer + // has since been closed anchor: Anchor, offset: usize, scroll_position: Vector2F, From 031472dc5a599b92d3b041558de4a740273d2412 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 14:00:09 -0700 Subject: [PATCH 175/245] 0.27.0 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccb0eefa47938f3b0754afdfe9762af28b044e97..4cba8251cf40f80dc0940ae20848f7a7326c881d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6126,7 +6126,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.26.0" +version = "0.27.0" dependencies = [ "anyhow", "assets", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index d8aa58721d8b68e3506bba1ace28f3b8b16fc908..05efff0ebd64b397cd707ab3de19ca9e59175325 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.26.0" +version = "0.27.0" [lib] name = "zed" From 8cde15cb7260f2279bb5689c259e7fabfa02059c Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 14:49:18 -0700 Subject: [PATCH 176/245] Notify when buffer search matches change --- crates/search/src/buffer_search.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index c81daf6f5b78b62f38d2e79cfd0e3a722d8c06ad..017c137dbc4a23a5608709f27096a07b298e9599 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -552,6 +552,7 @@ impl BufferSearchBar { ); }); } + cx.notify(); }); } })); From b893cb6d82390b6f92a9b63dc7fa9bbdf58c25ac Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 14:53:47 -0700 Subject: [PATCH 177/245] rename NavigationData anchor and offset to cursor_anchor and cursor_offset --- crates/editor/src/editor.rs | 8 ++++---- crates/editor/src/items.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index c67a9c233fd06428426dc210c368da443dd48133..357e0237c74bd7d4187a95ac769742ab2f3ccebe 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -850,8 +850,8 @@ struct ClipboardSelection { pub struct NavigationData { // Matching offsets for anchor and scroll_top_anchor allows us to recreate the anchor if the buffer // has since been closed - anchor: Anchor, - offset: usize, + cursor_anchor: Anchor, + cursor_offset: usize, scroll_position: Vector2F, scroll_top_anchor: Anchor, scroll_top_offset: usize, @@ -3912,8 +3912,8 @@ impl Editor { } nav_history.push(Some(NavigationData { - anchor: position, - offset, + cursor_anchor: position, + cursor_offset: offset, scroll_position: self.scroll_position, scroll_top_anchor: self.scroll_top_anchor.clone(), scroll_top_offset, diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 7e767b10a2bbdc44613d02fbef5277d85af69c72..9fe6e21b718c85b7804f133ba0a02a22bb50a561 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -247,10 +247,10 @@ impl Item for Editor { fn navigate(&mut self, data: Box, cx: &mut ViewContext) -> bool { if let Some(data) = data.downcast_ref::() { let buffer = self.buffer.read(cx).read(cx); - let offset = if buffer.can_resolve(&data.anchor) { - data.anchor.to_offset(&buffer) + let offset = if buffer.can_resolve(&data.cursor_anchor) { + data.cursor_anchor.to_offset(&buffer) } else { - buffer.clip_offset(data.offset, Bias::Left) + buffer.clip_offset(data.cursor_offset, Bias::Left) }; let newest_selection = self.newest_selection_with_snapshot::(&buffer); From 4b55b578b29520b5a01b6b6eb5b19718459d899b Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 14:57:16 -0700 Subject: [PATCH 178/245] Don't panic when allocating tiny_skia pixmap --- crates/gpui/src/platform/mac/sprite_cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/sprite_cache.rs b/crates/gpui/src/platform/mac/sprite_cache.rs index a93df3b187bbc07fd334efb571563ded383e8131..ceeb06698cf67ead5c877c62b9d194ad3cc445b0 100644 --- a/crates/gpui/src/platform/mac/sprite_cache.rs +++ b/crates/gpui/src/platform/mac/sprite_cache.rs @@ -143,7 +143,7 @@ impl SpriteCache { }) { Entry::Occupied(entry) => Some(entry.get().clone()), Entry::Vacant(entry) => { - let mut pixmap = tiny_skia::Pixmap::new(size.x() as u32, size.y() as u32).unwrap(); + let mut pixmap = tiny_skia::Pixmap::new(size.x() as u32, size.y() as u32)?; resvg::render(&svg, usvg::FitTo::Width(size.x() as u32), pixmap.as_mut()); let mask = pixmap .pixels() From 292d075f81d79c685dc13ce8c920342f2ba581cf Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 13 Apr 2022 15:30:57 -0700 Subject: [PATCH 179/245] Store accessors for editor highlight colors not colors themselves --- crates/editor/src/editor.rs | 52 +++++++++++++++-------------- crates/editor/src/element.rs | 3 ++ crates/search/src/buffer_search.rs | 3 +- crates/search/src/project_search.rs | 7 ++-- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index bc398754a78edcf1f889e4dff1bd5328ba697f88..ea6fd38d1a451eaf085e940c355f6d5be80ca682 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -56,7 +56,7 @@ use std::{ }; pub use sum_tree::Bias; use text::rope::TextDimension; -use theme::DiagnosticStyle; +use theme::{DiagnosticStyle, Theme}; use util::{post_inc, ResultExt, TryFutureExt}; use workspace::{ItemNavHistory, Workspace}; @@ -401,7 +401,7 @@ pub struct Editor { vertical_scroll_margin: f32, placeholder_text: Option>, highlighted_rows: Option>, - background_highlights: BTreeMap>)>, + background_highlights: BTreeMap Color, Vec>)>, nav_history: Option, context_menu: Option, completion_tasks: Vec<(CompletionId, Task>)>, @@ -2548,8 +2548,11 @@ impl Editor { cx.add_view(|cx| Editor::for_multibuffer(excerpt_buffer, Some(project), cx)); workspace.add_item(Box::new(editor.clone()), cx); editor.update(cx, |editor, cx| { - let color = editor.style(cx).highlighted_line_background; - editor.highlight_background::(ranges_to_highlight, color, cx); + editor.highlight_background::( + ranges_to_highlight, + |theme| theme.editor.highlighted_line_background, + cx, + ); }); }); @@ -2616,9 +2619,6 @@ impl Editor { } let buffer_id = cursor_position.buffer_id; - let style = this.style(cx); - let read_background = style.document_highlight_read_background; - let write_background = style.document_highlight_write_background; let buffer = this.buffer.read(cx); if !buffer .text_anchor_for_position(cursor_position, cx) @@ -2665,12 +2665,12 @@ impl Editor { this.highlight_background::( read_ranges, - read_background, + |theme| theme.editor.document_highlight_read_background, cx, ); this.highlight_background::( write_ranges, - write_background, + |theme| theme.editor.document_highlight_write_background, cx, ); cx.notify(); @@ -4582,8 +4582,11 @@ impl Editor { let editor = cx.add_view(|cx| Editor::for_multibuffer(excerpt_buffer, Some(project), cx)); editor.update(cx, |editor, cx| { - let color = editor.style(cx).highlighted_line_background; - editor.highlight_background::(ranges_to_highlight, color, cx); + editor.highlight_background::( + ranges_to_highlight, + |theme| theme.editor.highlighted_line_background, + cx, + ); }); workspace.add_item(Box::new(editor), cx); }); @@ -5651,18 +5654,18 @@ impl Editor { pub fn highlight_background( &mut self, ranges: Vec>, - color: Color, + color_fetcher: fn(&Theme) -> Color, cx: &mut ViewContext, ) { self.background_highlights - .insert(TypeId::of::(), (color, ranges)); + .insert(TypeId::of::(), (color_fetcher, ranges)); cx.notify(); } pub fn clear_background_highlights( &mut self, cx: &mut ViewContext, - ) -> Option<(Color, Vec>)> { + ) -> Option<(fn(&Theme) -> Color, Vec>)> { cx.notify(); self.background_highlights.remove(&TypeId::of::()) } @@ -5676,23 +5679,20 @@ impl Editor { let buffer = &snapshot.buffer_snapshot; let start = buffer.anchor_before(0); let end = buffer.anchor_after(buffer.len()); - self.background_highlights_in_range(start..end, &snapshot) - } - - pub fn background_highlights_for_type(&self) -> Option<(Color, &[Range])> { - self.background_highlights - .get(&TypeId::of::()) - .map(|(color, ranges)| (*color, ranges.as_slice())) + let theme = cx.global::().theme.as_ref(); + self.background_highlights_in_range(start..end, &snapshot, theme) } pub fn background_highlights_in_range( &self, search_range: Range, display_snapshot: &DisplaySnapshot, + theme: &Theme, ) -> Vec<(Range, Color)> { let mut results = Vec::new(); let buffer = &display_snapshot.buffer_snapshot; - for (color, ranges) in self.background_highlights.values() { + for (color_fetcher, ranges) in self.background_highlights.values() { + let color = color_fetcher(theme); let start_ix = match ranges.binary_search_by(|probe| { let cmp = probe.end.cmp(&search_range.start, &buffer); if cmp.is_gt() { @@ -5715,7 +5715,7 @@ impl Editor { .end .to_point(buffer) .to_display_point(display_snapshot); - results.push((start..end, *color)) + results.push((start..end, color)) } } results @@ -9796,7 +9796,7 @@ mod tests { anchor_range(Point::new(6, 3)..Point::new(6, 5)), anchor_range(Point::new(8, 4)..Point::new(8, 6)), ], - Color::red(), + |_| Color::red(), cx, ); editor.highlight_background::( @@ -9806,7 +9806,7 @@ mod tests { anchor_range(Point::new(7, 4)..Point::new(7, 7)), anchor_range(Point::new(9, 5)..Point::new(9, 8)), ], - Color::green(), + |_| Color::green(), cx, ); @@ -9814,6 +9814,7 @@ mod tests { let mut highlighted_ranges = editor.background_highlights_in_range( anchor_range(Point::new(3, 4)..Point::new(7, 4)), &snapshot, + cx.global::().theme.as_ref(), ); // Enforce a consistent ordering based on color without relying on the ordering of the // highlight's `TypeId` which is non-deterministic. @@ -9843,6 +9844,7 @@ mod tests { editor.background_highlights_in_range( anchor_range(Point::new(5, 6)..Point::new(6, 4)), &snapshot, + cx.global::().theme.as_ref(), ), &[( DisplayPoint::new(6, 3)..DisplayPoint::new(6, 5), diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 640ba80ac226c22ecf1bc85e614be48ffb813040..cd53e629645daaca4561af48a410823c8aa1dcdd 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -22,6 +22,7 @@ use gpui::{ }; use json::json; use language::{Bias, DiagnosticSeverity}; +use settings::Settings; use smallvec::SmallVec; use std::{ cmp::{self, Ordering}, @@ -917,9 +918,11 @@ impl Element for EditorElement { let display_map = view.display_map.update(cx, |map, cx| map.snapshot(cx)); highlighted_rows = view.highlighted_rows(); + let theme = cx.global::().theme.as_ref(); highlighted_ranges = view.background_highlights_in_range( start_anchor.clone()..end_anchor.clone(), &display_map, + theme, ); let mut remote_selections = HashMap::default(); diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index c81daf6f5b78b62f38d2e79cfd0e3a722d8c06ad..e0f0974b0aed996fc0bcb51d0c9cef4052a8f08c 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -544,10 +544,9 @@ impl BufferSearchBar { } } - let theme = &cx.global::().theme.search; editor.highlight_background::( ranges, - theme.match_background, + |theme| theme.search.match_background, cx, ); }); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 7ed4e802b300ed57d9d08ba11352c030c5c52793..fe3e2e95cf8441536f3ac21cd07ec1ebca7cb31b 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -473,8 +473,11 @@ impl ProjectSearchView { if reset_selections { editor.select_ranges(match_ranges.first().cloned(), Some(Autoscroll::Fit), cx); } - let theme = &cx.global::().theme.search; - editor.highlight_background::(match_ranges, theme.match_background, cx); + editor.highlight_background::( + match_ranges, + |theme| theme.search.match_background, + cx, + ); }); if self.query_editor.is_focused(cx) { self.focus_results_editor(cx); From 91d4c835ad937024abf2e5c71099819098ea0009 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 12:55:33 +0200 Subject: [PATCH 180/245] Introduce `TabMap::line_len` --- crates/editor/src/display_map/tab_map.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/display_map/tab_map.rs b/crates/editor/src/display_map/tab_map.rs index 77ec73d8bf8b3cb8d2e116b401155634efcdc62f..1491c790f60229e68ec86f1b967a157a51378b43 100644 --- a/crates/editor/src/display_map/tab_map.rs +++ b/crates/editor/src/display_map/tab_map.rs @@ -96,6 +96,22 @@ impl TabSnapshot { self.fold_snapshot.buffer_snapshot() } + pub fn line_len(&self, row: u32) -> u32 { + let max_point = self.max_point(); + if row < max_point.row() { + self.chunks( + TabPoint::new(row, 0)..TabPoint::new(row + 1, 0), + false, + None, + ) + .map(|chunk| chunk.text.len() as u32) + .sum::() + - 1 + } else { + max_point.column() + } + } + pub fn text_summary(&self) -> TextSummary { self.text_summary_for_range(TabPoint::zero()..self.max_point()) } @@ -517,8 +533,11 @@ mod tests { actual_summary.longest_row = expected_summary.longest_row; actual_summary.longest_row_chars = expected_summary.longest_row_chars; } + assert_eq!(actual_summary, expected_summary); + } - assert_eq!(actual_summary, expected_summary,); + for row in 0..=text.max_point().row { + assert_eq!(tabs_snapshot.line_len(row), text.line_len(row)); } } } From 1a1d67010400c28a25d0e04b79a6244dca6c35a7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 13:01:29 +0200 Subject: [PATCH 181/245] Speed up `WrapSnapshot::line_len` using the indexed transforms --- crates/editor/src/display_map/wrap_map.rs | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 00e9b63b1ad66625942c62daf21c4b04c372bb9f..be356044f8b573c13ae0d6614f30cea33af22228 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -599,16 +599,23 @@ impl WrapSnapshot { } pub fn line_len(&self, row: u32) -> u32 { - let mut len = 0; - for chunk in self.text_chunks(row) { - if let Some(newline_ix) = chunk.find('\n') { - len += newline_ix; - break; + let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(); + cursor.seek(&WrapPoint::new(row + 1, 0), Bias::Left, &()); + if cursor + .item() + .map_or(false, |transform| transform.is_isomorphic()) + { + let overshoot = row - cursor.start().0.row(); + let tab_row = cursor.start().1.row() + overshoot; + let tab_line_len = self.tab_snapshot.line_len(tab_row); + if overshoot == 0 { + cursor.start().0.column() + (tab_line_len - cursor.start().1.column()) } else { - len += chunk.len(); + tab_line_len } + } else { + cursor.start().0.column() } - len as u32 } pub fn soft_wrap_indent(&self, row: u32) -> Option { @@ -741,6 +748,7 @@ impl WrapSnapshot { } } + let text = language::Rope::from(self.text().as_str()); let input_buffer_rows = self.buffer_snapshot().buffer_rows(0).collect::>(); let mut expected_buffer_rows = Vec::new(); let mut prev_tab_row = 0; @@ -754,6 +762,8 @@ impl WrapSnapshot { expected_buffer_rows.push(input_buffer_rows[buffer_point.row as usize]); prev_tab_row = tab_point.row(); } + + assert_eq!(self.line_len(display_row), text.line_len(display_row)); } for start_display_row in 0..expected_buffer_rows.len() { @@ -957,6 +967,10 @@ impl WrapPoint { &mut self.0.row } + pub fn column(self) -> u32 { + self.0.column + } + pub fn column_mut(&mut self) -> &mut u32 { &mut self.0.column } From 6d33697e82e9a55355b7e643d1e3022d2caa614c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 13:03:46 +0200 Subject: [PATCH 182/245] Fix warning --- crates/editor/src/display_map/wrap_map.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index be356044f8b573c13ae0d6614f30cea33af22228..0e88d87bd77b06ff3a4ab8bfb49c7f0c1aa2433e 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -559,11 +559,6 @@ impl WrapSnapshot { Patch::new(wrap_edits) } - pub fn text_chunks(&self, wrap_row: u32) -> impl Iterator { - self.chunks(wrap_row..self.max_point().row() + 1, false, None) - .map(|h| h.text) - } - pub fn chunks<'a>( &'a self, rows: Range, @@ -1286,6 +1281,11 @@ mod tests { self.text_chunks(0).collect() } + pub fn text_chunks(&self, wrap_row: u32) -> impl Iterator { + self.chunks(wrap_row..self.max_point().row() + 1, false, None) + .map(|h| h.text) + } + fn verify_chunks(&mut self, rng: &mut impl Rng) { for _ in 0..5 { let mut end_row = rng.gen_range(0..=self.max_point().row()); From c4203868ea101f3232901aaa554e22dfa0461816 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 14 Apr 2022 07:53:15 -0600 Subject: [PATCH 183/245] Revert "Focus Project Search query editor always when deployed" --- crates/search/src/project_search.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 7ed4e802b300ed57d9d08ba11352c030c5c52793..7d11fcbea5ca1513d53005eaae535c6d543cb1c9 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -170,7 +170,11 @@ impl View for ProjectSearchView { .insert(self.model.read(cx).project.downgrade(), handle) }); - self.focus_query_editor(cx); + if self.model.read(cx).match_ranges.is_empty() { + cx.focus(&self.query_editor); + } else { + self.focus_results_editor(cx); + } } } @@ -394,7 +398,6 @@ impl ProjectSearchView { if let Some(existing) = existing { workspace.activate_item(&existing, cx); - existing.update(cx, |existing, cx| existing.focus_query_editor(cx)); } else { let model = cx.add_model(|cx| ProjectSearch::new(workspace.project().clone(), cx)); workspace.add_item( From 27057fdb1b25af3efd4b5e29d6b168f10a76a82b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 14 Apr 2022 08:52:24 -0600 Subject: [PATCH 184/245] Only process a single focus effect per batch This allows us to focus the query editor of the project search when deploying it. Previously, a complex interplay between focus events was preventing this from working in an intuitive way. What happened previously: - We'd activate the project search, which enqueued a focus effect for the project search view - We'd focus the query editor, which enqueued an effect - We'd process the focus effect for the search view, which would enqueue an effect to transfer focus to the results editor - We'd process the effect to focus the query editor - We'd process the effect to focus the results editor Now... - We activate the project search pane item, enqueuing a focus effect for the project search itself - We focus the query editor and *remove* the previous pending focus change effect - We process the focus effect --- crates/gpui/src/app.rs | 61 +++++++++++++++++------------ crates/search/src/project_search.rs | 3 ++ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index eb97b85c679d712e9d96fc9f12491895025a208e..b70602f2caa1f187ec16d9d9b800692b8f289cd2 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -745,6 +745,7 @@ pub struct MutableAppContext { HashMap>, Box)>, foreground: Rc, pending_effects: VecDeque, + pending_focus_index: Option, pending_notifications: HashSet, pending_global_notifications: HashSet, pending_flushes: usize, @@ -795,6 +796,7 @@ impl MutableAppContext { presenters_and_platform_windows: HashMap::new(), foreground, pending_effects: VecDeque::new(), + pending_focus_index: None, pending_notifications: HashSet::new(), pending_global_notifications: HashSet::new(), pending_flushes: 0, @@ -1670,7 +1672,7 @@ impl MutableAppContext { }); if let Some(view_id) = change_focus_to { - self.focus(window_id, Some(view_id)); + self.handle_focus_effect(window_id, Some(view_id)); } self.pending_effects @@ -1693,6 +1695,9 @@ impl MutableAppContext { let mut refreshing = false; loop { if let Some(effect) = self.pending_effects.pop_front() { + if let Some(pending_focus_index) = self.pending_focus_index.as_mut() { + *pending_focus_index = pending_focus_index.saturating_sub(1); + } match effect { Effect::Subscription { entity_id, @@ -1716,13 +1721,13 @@ impl MutableAppContext { callback, } => self.handle_observation_effect(entity_id, subscription_id, callback), Effect::ModelNotification { model_id } => { - self.notify_model_observers(model_id) + self.handle_model_notification_effect(model_id) } Effect::ViewNotification { window_id, view_id } => { - self.notify_view_observers(window_id, view_id) + self.handle_view_notification_effect(window_id, view_id) } Effect::GlobalNotification { type_id } => { - self.notify_global_observers(type_id) + self.handle_global_notification_effect(type_id) } Effect::Deferred { callback, @@ -1735,13 +1740,13 @@ impl MutableAppContext { } } Effect::ModelRelease { model_id, model } => { - self.notify_release_observers(model_id, model.as_any()) + self.handle_entity_release_effect(model_id, model.as_any()) } Effect::ViewRelease { view_id, view } => { - self.notify_release_observers(view_id, view.as_any()) + self.handle_entity_release_effect(view_id, view.as_any()) } Effect::Focus { window_id, view_id } => { - self.focus(window_id, view_id); + self.handle_focus_effect(window_id, view_id); } Effect::ResizeWindow { window_id } => { if let Some(window) = self.cx.windows.get_mut(&window_id) { @@ -1973,7 +1978,7 @@ impl MutableAppContext { } } - fn notify_model_observers(&mut self, observed_id: usize) { + fn handle_model_notification_effect(&mut self, observed_id: usize) { let callbacks = self.observations.lock().remove(&observed_id); if let Some(callbacks) = callbacks { if self.cx.models.contains_key(&observed_id) { @@ -2002,7 +2007,11 @@ impl MutableAppContext { } } - fn notify_view_observers(&mut self, observed_window_id: usize, observed_view_id: usize) { + fn handle_view_notification_effect( + &mut self, + observed_window_id: usize, + observed_view_id: usize, + ) { if let Some(window) = self.cx.windows.get_mut(&observed_window_id) { window .invalidation @@ -2043,7 +2052,7 @@ impl MutableAppContext { } } - fn notify_global_observers(&mut self, observed_type_id: TypeId) { + fn handle_global_notification_effect(&mut self, observed_type_id: TypeId) { let callbacks = self.global_observations.lock().remove(&observed_type_id); if let Some(callbacks) = callbacks { if let Some(global) = self.cx.globals.remove(&observed_type_id) { @@ -2071,7 +2080,7 @@ impl MutableAppContext { } } - fn notify_release_observers(&mut self, entity_id: usize, entity: &dyn Any) { + fn handle_entity_release_effect(&mut self, entity_id: usize, entity: &dyn Any) { let callbacks = self.release_observations.lock().remove(&entity_id); if let Some(callbacks) = callbacks { for (_, mut callback) in callbacks { @@ -2080,7 +2089,9 @@ impl MutableAppContext { } } - fn focus(&mut self, window_id: usize, focused_id: Option) { + fn handle_focus_effect(&mut self, window_id: usize, focused_id: Option) { + self.pending_focus_index.take(); + if self .cx .windows @@ -2091,6 +2102,8 @@ impl MutableAppContext { return; } + log::info!("process focus effect {:?}", focused_id); + self.update(|this| { let blurred_id = this.cx.windows.get_mut(&window_id).and_then(|window| { let blurred_id = window.focused_view_id; @@ -2114,6 +2127,15 @@ impl MutableAppContext { }) } + fn focus(&mut self, window_id: usize, view_id: Option) { + if let Some(pending_focus_index) = self.pending_focus_index { + self.pending_effects.remove(pending_focus_index); + } + self.pending_focus_index = Some(self.pending_effects.len()); + self.pending_effects + .push_back(Effect::Focus { window_id, view_id }); + } + pub fn spawn(&self, f: F) -> Task where F: FnOnce(AsyncAppContext) -> Fut, @@ -2948,24 +2970,15 @@ impl<'a, T: View> ViewContext<'a, T> { S: Into, { let handle = handle.into(); - self.app.pending_effects.push_back(Effect::Focus { - window_id: handle.window_id, - view_id: Some(handle.view_id), - }); + self.app.focus(handle.window_id, Some(handle.view_id)); } pub fn focus_self(&mut self) { - self.app.pending_effects.push_back(Effect::Focus { - window_id: self.window_id, - view_id: Some(self.view_id), - }); + self.app.focus(self.window_id, Some(self.view_id)); } pub fn blur(&mut self) { - self.app.pending_effects.push_back(Effect::Focus { - window_id: self.window_id, - view_id: None, - }); + self.app.focus(self.window_id, None); } pub fn add_model(&mut self, build_model: F) -> ModelHandle diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 7d11fcbea5ca1513d53005eaae535c6d543cb1c9..2d1d6c780f9dbe1faa340a0fe7f06135dadcba0e 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -398,6 +398,9 @@ impl ProjectSearchView { if let Some(existing) = existing { workspace.activate_item(&existing, cx); + existing.update(cx, |existing, cx| { + existing.focus_query_editor(cx); + }); } else { let model = cx.add_model(|cx| ProjectSearch::new(workspace.project().clone(), cx)); workspace.add_item( From 5a8297a02ffe5e8eca8040af8178eafe7dbeed50 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 18:22:32 +0200 Subject: [PATCH 185/245] Introduce `ViewContext::observe_focus` --- crates/gpui/src/app.rs | 196 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 189 insertions(+), 7 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index b70602f2caa1f187ec16d9d9b800692b8f289cd2..d553b9ba26b81bcc74ed529df4c224c4de1a5660 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -716,6 +716,7 @@ type GlobalActionCallback = dyn FnMut(&dyn Action, &mut MutableAppContext); type SubscriptionCallback = Box bool>; type GlobalSubscriptionCallback = Box; type ObservationCallback = Box bool>; +type FocusObservationCallback = Box bool>; type GlobalObservationCallback = Box; type ReleaseObservationCallback = Box; type DeserializeActionCallback = fn(json: &str) -> anyhow::Result>; @@ -738,6 +739,8 @@ pub struct MutableAppContext { global_subscriptions: Arc>>>>, observations: Arc>>>>, + focus_observations: + Arc>>>>, global_observations: Arc>>>>, release_observations: Arc>>>, @@ -791,6 +794,7 @@ impl MutableAppContext { subscriptions: Default::default(), global_subscriptions: Default::default(), observations: Default::default(), + focus_observations: Default::default(), release_observations: Default::default(), global_observations: Default::default(), presenters_and_platform_windows: HashMap::new(), @@ -1185,6 +1189,32 @@ impl MutableAppContext { } } + fn observe_focus(&mut self, handle: &ViewHandle, mut callback: F) -> Subscription + where + F: 'static + FnMut(ViewHandle, &mut MutableAppContext) -> bool, + V: View, + { + let subscription_id = post_inc(&mut self.next_subscription_id); + let observed = handle.downgrade(); + let view_id = handle.id(); + self.pending_effects.push_back(Effect::FocusObservation { + view_id, + subscription_id, + callback: Box::new(move |cx| { + if let Some(observed) = observed.upgrade(cx) { + callback(observed, cx) + } else { + false + } + }), + }); + Subscription::FocusObservation { + id: subscription_id, + view_id, + observations: Some(Arc::downgrade(&self.focus_observations)), + } + } + pub fn observe_global(&mut self, mut observe: F) -> Subscription where G: Any, @@ -1748,6 +1778,13 @@ impl MutableAppContext { Effect::Focus { window_id, view_id } => { self.handle_focus_effect(window_id, view_id); } + Effect::FocusObservation { + view_id, + subscription_id, + callback, + } => { + self.handle_focus_observation_effect(view_id, subscription_id, callback) + } Effect::ResizeWindow { window_id } => { if let Some(window) = self.cx.windows.get_mut(&window_id) { window @@ -1978,6 +2015,30 @@ impl MutableAppContext { } } + fn handle_focus_observation_effect( + &mut self, + view_id: usize, + subscription_id: usize, + callback: FocusObservationCallback, + ) { + match self + .focus_observations + .lock() + .entry(view_id) + .or_default() + .entry(subscription_id) + { + btree_map::Entry::Vacant(entry) => { + entry.insert(Some(callback)); + } + // Observation was dropped before effect was processed + btree_map::Entry::Occupied(entry) => { + debug_assert!(entry.get().is_none()); + entry.remove(); + } + } + } + fn handle_model_notification_effect(&mut self, observed_id: usize) { let callbacks = self.observations.lock().remove(&observed_id); if let Some(callbacks) = callbacks { @@ -2102,8 +2163,6 @@ impl MutableAppContext { return; } - log::info!("process focus effect {:?}", focused_id); - self.update(|this| { let blurred_id = this.cx.windows.get_mut(&window_id).and_then(|window| { let blurred_id = window.focused_view_id; @@ -2122,6 +2181,31 @@ impl MutableAppContext { if let Some(mut focused_view) = this.cx.views.remove(&(window_id, focused_id)) { focused_view.on_focus(this, window_id, focused_id); this.cx.views.insert((window_id, focused_id), focused_view); + + let callbacks = this.focus_observations.lock().remove(&focused_id); + if let Some(callbacks) = callbacks { + for (id, callback) in callbacks { + if let Some(mut callback) = callback { + let alive = callback(this); + if alive { + match this + .focus_observations + .lock() + .entry(focused_id) + .or_default() + .entry(id) + { + btree_map::Entry::Vacant(entry) => { + entry.insert(Some(callback)); + } + btree_map::Entry::Occupied(entry) => { + entry.remove(); + } + } + } + } + } + } } } }) @@ -2487,6 +2571,11 @@ pub enum Effect { window_id: usize, view_id: Option, }, + FocusObservation { + view_id: usize, + subscription_id: usize, + callback: FocusObservationCallback, + }, ResizeWindow { window_id: usize, }, @@ -2558,6 +2647,15 @@ impl Debug for Effect { .field("window_id", window_id) .field("view_id", view_id) .finish(), + Effect::FocusObservation { + view_id, + subscription_id, + .. + } => f + .debug_struct("Effect::FocusObservation") + .field("view_id", view_id) + .field("subscription_id", subscription_id) + .finish(), Effect::ResizeWindow { window_id } => f .debug_struct("Effect::RefreshWindow") .field("window_id", window_id) @@ -3045,6 +3143,24 @@ impl<'a, T: View> ViewContext<'a, T> { }) } + pub fn observe_focus(&mut self, handle: &ViewHandle, mut callback: F) -> Subscription + where + F: 'static + FnMut(&mut T, ViewHandle, &mut ViewContext), + V: View, + { + let observer = self.weak_handle(); + self.app.observe_focus(handle, move |observed, cx| { + if let Some(observer) = observer.upgrade(cx) { + observer.update(cx, |observer, cx| { + callback(observer, observed, cx); + }); + true + } else { + false + } + }) + } + pub fn observe_release(&mut self, handle: &H, mut callback: F) -> Subscription where E: Entity, @@ -4309,6 +4425,12 @@ pub enum Subscription { Weak>>>>, >, }, + FocusObservation { + id: usize, + view_id: usize, + observations: + Option>>>>>, + }, ReleaseObservation { id: usize, entity_id: usize, @@ -4335,6 +4457,9 @@ impl Subscription { Subscription::ReleaseObservation { observations, .. } => { observations.take(); } + Subscription::FocusObservation { observations, .. } => { + observations.take(); + } } } } @@ -4427,6 +4552,22 @@ impl Drop for Subscription { } } } + Subscription::FocusObservation { + id, + view_id, + observations, + } => { + if let Some(observations) = observations.as_ref().and_then(Weak::upgrade) { + match observations.lock().entry(*view_id).or_default().entry(*id) { + btree_map::Entry::Vacant(entry) => { + entry.insert(None); + } + btree_map::Entry::Occupied(entry) => { + entry.remove(); + } + } + } + } } } } @@ -5715,23 +5856,56 @@ mod tests { } } - let events: Arc>> = Default::default(); + let view_events: Arc>> = Default::default(); let (window_id, view_1) = cx.add_window(Default::default(), |_| View { - events: events.clone(), + events: view_events.clone(), name: "view 1".to_string(), }); let view_2 = cx.add_view(window_id, |_| View { - events: events.clone(), + events: view_events.clone(), name: "view 2".to_string(), }); - view_1.update(cx, |_, cx| cx.focus(&view_2)); + let observed_events: Arc>> = Default::default(); + view_1.update(cx, |_, cx| { + cx.observe_focus(&view_2, { + let observed_events = observed_events.clone(); + move |this, view, cx| { + observed_events.lock().push(format!( + "{} observed {} focus", + this.name, + view.read(cx).name + )) + } + }) + .detach(); + }); + view_2.update(cx, |_, cx| { + cx.observe_focus(&view_1, { + let observed_events = observed_events.clone(); + move |this, view, cx| { + observed_events.lock().push(format!( + "{} observed {}'s focus", + this.name, + view.read(cx).name + )) + } + }) + .detach(); + }); + + view_1.update(cx, |_, cx| { + // Ensure only the latest focus is honored. + cx.focus(&view_2); + cx.focus(&view_1); + cx.focus(&view_2); + }); view_1.update(cx, |_, cx| cx.focus(&view_1)); view_1.update(cx, |_, cx| cx.focus(&view_2)); view_1.update(cx, |_, _| drop(view_2)); assert_eq!( - *events.lock(), + *view_events.lock(), [ "view 1 focused".to_string(), "view 1 blurred".to_string(), @@ -5743,6 +5917,14 @@ mod tests { "view 1 focused".to_string(), ], ); + assert_eq!( + *observed_events.lock(), + [ + "view 1 observed view 2's focus".to_string(), + "view 2 observed view 1's focus".to_string(), + "view 1 observed view 2's focus".to_string(), + ] + ); } #[crate::test(self)] From ce3a31d8bde0f86d964cc90f00c06c68d06e539e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 18:36:42 +0200 Subject: [PATCH 186/245] Persist project search focus state ...so that we can re-focus the previously-active editor when switching back to the project search tab. --- crates/search/src/project_search.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 2d1d6c780f9dbe1faa340a0fe7f06135dadcba0e..c49ca3405230439cf84a54fbe6964568fe0860f6 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -55,6 +55,7 @@ pub struct ProjectSearchView { regex: bool, query_contains_error: bool, active_match_index: Option, + results_editor_was_focused: bool, } pub struct ProjectSearchBar { @@ -170,10 +171,10 @@ impl View for ProjectSearchView { .insert(self.model.read(cx).project.downgrade(), handle) }); - if self.model.read(cx).match_ranges.is_empty() { - cx.focus(&self.query_editor); - } else { + if self.results_editor_was_focused && !self.model.read(cx).match_ranges.is_empty() { self.focus_results_editor(cx); + } else { + cx.focus(&self.query_editor); } } } @@ -344,6 +345,10 @@ impl ProjectSearchView { cx.emit(ViewEvent::EditorEvent(event.clone())) }) .detach(); + cx.observe_focus(&query_editor, |this, _, _| { + this.results_editor_was_focused = false; + }) + .detach(); let results_editor = cx.add_view(|cx| { let mut editor = Editor::for_multibuffer(excerpts, Some(project), cx); @@ -352,6 +357,10 @@ impl ProjectSearchView { }); cx.observe(&results_editor, |_, _, cx| cx.emit(ViewEvent::UpdateTab)) .detach(); + cx.observe_focus(&results_editor, |this, _, _| { + this.results_editor_was_focused = true; + }) + .detach(); cx.subscribe(&results_editor, |this, _, event, cx| { if matches!(event, editor::Event::SelectionsChanged { .. }) { this.update_match_index(cx); @@ -370,6 +379,7 @@ impl ProjectSearchView { regex, query_contains_error: false, active_match_index: None, + results_editor_was_focused: false, }; this.model_changed(false, cx); this From 77d3cc359ef8e420db008a40ba2f2a3e7604992f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2022 18:50:45 +0200 Subject: [PATCH 187/245] Fix tests --- crates/gpui/src/app.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index d553b9ba26b81bcc74ed529df4c224c4de1a5660..acc84588b09eef2152e077dae4deda14a97a09c4 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -5872,7 +5872,7 @@ mod tests { let observed_events = observed_events.clone(); move |this, view, cx| { observed_events.lock().push(format!( - "{} observed {} focus", + "{} observed {}'s focus", this.name, view.read(cx).name )) From 2695b1394754d90d1d3c14d47ed43b07ee0debab Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 15 Apr 2022 10:26:39 +0200 Subject: [PATCH 188/245] Always clear rename state when selections change At some point during the implementation of rename, we added logic for invalidating the rename state when the selection moved outside the original rename range. After transitioning to displaying renames as a block decoration, we don't need that anymore given that a new, temporary editor is used instead. This commit removes that invalidation logic and always calls `Editor::take_rename` when the editor selections change. Doing so also fixes a bug that was causing Zed to hide the cursor when clicking on the editor to dismiss the rename. --- crates/editor/src/editor.rs | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 4822d4557076a6614b706b8ec4d27e76e14b3d00..97be28ebd420163a96a100073fd1a1a46c8e0df1 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -4808,25 +4808,6 @@ impl Editor { Some(rename) } - fn invalidate_rename_range( - &mut self, - buffer: &MultiBufferSnapshot, - cx: &mut ViewContext, - ) { - if let Some(rename) = self.pending_rename.as_ref() { - if self.selections.len() == 1 { - let head = self.selections[0].head().to_offset(buffer); - let range = rename.range.to_offset(buffer).to_inclusive(); - if range.contains(&head) { - return; - } - } - let rename = self.pending_rename.take().unwrap(); - self.remove_blocks([rename.block_id].into_iter().collect(), cx); - self.clear_background_highlights::(cx); - } - } - #[cfg(any(test, feature = "test-support"))] pub fn pending_rename(&self) -> Option<&RenameState> { self.pending_rename.as_ref() @@ -5332,7 +5313,7 @@ impl Editor { self.select_larger_syntax_node_stack.clear(); self.autoclose_stack.invalidate(&self.selections, &buffer); self.snippet_stack.invalidate(&self.selections, &buffer); - self.invalidate_rename_range(&buffer, cx); + self.take_rename(false, cx); let new_cursor_position = self.newest_anchor_selection().head(); From 63278041e17cdc4e79150ee08e646363313856ab Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Fri, 15 Apr 2022 16:00:44 -0700 Subject: [PATCH 189/245] Add c and d operators to vim normal mode Extracted motions from normal mode Changed vim_submode to be vim_operator to enable better composition of operators --- assets/keymaps/vim.json | 117 ++++--- crates/vim/src/editor_events.rs | 24 +- crates/vim/src/insert.rs | 12 +- crates/vim/src/mode.rs | 73 ----- crates/vim/src/motion.rs | 296 +++++++++++++++++ crates/vim/src/normal.rs | 495 +++++++++++++++++------------ crates/vim/src/normal/g_prefix.rs | 75 ----- crates/vim/src/state.rs | 82 +++++ crates/vim/src/vim.rs | 86 +++-- crates/vim/src/vim_test_context.rs | 37 ++- 10 files changed, 863 insertions(+), 434 deletions(-) delete mode 100644 crates/vim/src/mode.rs create mode 100644 crates/vim/src/motion.rs delete mode 100644 crates/vim/src/normal/g_prefix.rs create mode 100644 crates/vim/src/state.rs diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index f8273286df0f52afae8a6eae6c004f102b455452..312416f42cd114ca1e2e313b7c9c1a4d8e4e62e3 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -1,58 +1,93 @@ { - "Editor && vim_mode == insert": { - "escape": "vim::NormalBefore", - "ctrl-c": "vim::NormalBefore" - }, - "Editor && vim_mode == normal && vim_submode == g": { - "g": "vim::MoveToStart", - "escape": [ - "vim::SwitchMode", - { - "Normal": "None" - } - ] - }, - "Editor && vim_mode == normal": { + "Editor && VimControl": { "i": [ "vim::SwitchMode", "Insert" ], "g": [ - "vim::SwitchMode", + "vim::PushOperator", { - "Normal": "GPrefix" + "Namespace": "G" } ], - "h": "vim::MoveLeft", - "j": "vim::MoveDown", - "k": "vim::MoveUp", - "l": "vim::MoveRight", - "0": "vim::MoveToStartOfLine", - "shift-$": "vim::MoveToEndOfLine", - "shift-G": "vim::MoveToEnd", - "w": [ - "vim::MoveToNextWordStart", - false - ], + "h": "vim::Left", + "j": "vim::Down", + "k": "vim::Up", + "l": "vim::Right", + "0": "vim::StartOfLine", + "shift-$": "vim::EndOfLine", + "shift-G": "vim::EndOfDocument", + "w": "vim::NextWordStart", "shift-W": [ - "vim::MoveToNextWordStart", - true - ], - "e": [ - "vim::MoveToNextWordEnd", - false + "vim::NextWordStart", + { + "ignorePunctuation": true + } ], + "e": "vim::NextWordEnd", "shift-E": [ - "vim::MoveToNextWordEnd", - true - ], - "b": [ - "vim::MoveToPreviousWordStart", - false + "vim::NextWordEnd", + { + "ignorePunctuation": true + } ], + "b": "vim::PreviousWordStart", "shift-B": [ - "vim::MoveToPreviousWordStart", - true + "vim::PreviousWordStart", + { + "ignorePunctuation": true + } + ], + "escape": [ + "vim::SwitchMode", + "Normal" + ] + }, + "Editor && vim_operator == g": { + "g": "vim::StartOfDocument" + }, + "Editor && vim_mode == insert": { + "escape": "vim::NormalBefore", + "ctrl-c": "vim::NormalBefore" + }, + "Editor && vim_mode == normal": { + "c": [ + "vim::PushOperator", + "Change" + ], + "d": [ + "vim::PushOperator", + "Delete" + ] + }, + "Editor && vim_operator == c": { + "w": [ + "vim::NextWordEnd", + { + "ignorePunctuation": false + } + ], + "shift-W": [ + "vim::NextWordEnd", + { + "ignorePunctuation": true + } + ] + }, + "Editor && vim_operator == d": { + "w": [ + "vim::NextWordStart", + { + "ignorePunctuation": false, + "stopAtNewline": true + } + ], + "shift-W": [ + "vim::NextWordStart", + { + "ignorePunctuation": true, + "stopAtNewline": true + } ] } } \ No newline at end of file diff --git a/crates/vim/src/editor_events.rs b/crates/vim/src/editor_events.rs index e4035197fd8036922cc4fa1cc5006f15948bb948..12b90ec8e6213c12e7cfecacb1c3c77635457c7f 100644 --- a/crates/vim/src/editor_events.rs +++ b/crates/vim/src/editor_events.rs @@ -1,7 +1,7 @@ use editor::{EditorBlurred, EditorCreated, EditorFocused, EditorMode, EditorReleased}; use gpui::MutableAppContext; -use crate::{mode::Mode, SwitchMode, VimState}; +use crate::{state::Mode, Vim}; pub fn init(cx: &mut MutableAppContext) { cx.subscribe_global(editor_created).detach(); @@ -11,9 +11,9 @@ pub fn init(cx: &mut MutableAppContext) { } fn editor_created(EditorCreated(editor): &EditorCreated, cx: &mut MutableAppContext) { - cx.update_default_global(|vim_state: &mut VimState, cx| { - vim_state.editors.insert(editor.id(), editor.downgrade()); - vim_state.sync_editor_options(cx); + cx.update_default_global(|vim: &mut Vim, cx| { + vim.editors.insert(editor.id(), editor.downgrade()); + vim.sync_editor_options(cx); }) } @@ -21,17 +21,17 @@ fn editor_focused(EditorFocused(editor): &EditorFocused, cx: &mut MutableAppCont let mode = if matches!(editor.read(cx).mode(), EditorMode::SingleLine) { Mode::Insert } else { - Mode::normal() + Mode::Normal }; - VimState::update_global(cx, |state, cx| { + Vim::update(cx, |state, cx| { state.active_editor = Some(editor.downgrade()); - state.switch_mode(&SwitchMode(mode), cx); + state.switch_mode(mode, cx); }); } fn editor_blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut MutableAppContext) { - VimState::update_global(cx, |state, cx| { + Vim::update(cx, |state, cx| { if let Some(previous_editor) = state.active_editor.clone() { if previous_editor == editor.clone() { state.active_editor = None; @@ -42,11 +42,11 @@ fn editor_blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut MutableAppCont } fn editor_released(EditorReleased(editor): &EditorReleased, cx: &mut MutableAppContext) { - cx.update_default_global(|vim_state: &mut VimState, _| { - vim_state.editors.remove(&editor.id()); - if let Some(previous_editor) = vim_state.active_editor.clone() { + cx.update_default_global(|vim: &mut Vim, _| { + vim.editors.remove(&editor.id()); + if let Some(previous_editor) = vim.active_editor.clone() { if previous_editor == editor.clone() { - vim_state.active_editor = None; + vim.active_editor = None; } } }); diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 597832f95ad2d48241645df6ca4b4bcec0631996..c98c9db8411e13a2d3c57a196dc9bc17d89f6135 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -1,4 +1,4 @@ -use crate::{mode::Mode, SwitchMode, VimState}; +use crate::{state::Mode, Vim}; use editor::Bias; use gpui::{actions, MutableAppContext, ViewContext}; use language::SelectionGoal; @@ -11,30 +11,30 @@ pub fn init(cx: &mut MutableAppContext) { } fn normal_before(_: &mut Workspace, _: &NormalBefore, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { + Vim::update(cx, |state, cx| { state.update_active_editor(cx, |editor, cx| { editor.move_cursors(cx, |map, mut cursor, _| { *cursor.column_mut() = cursor.column().saturating_sub(1); (map.clip_point(cursor, Bias::Left), SelectionGoal::None) }); }); - state.switch_mode(&SwitchMode(Mode::normal()), cx); + state.switch_mode(Mode::Normal, cx); }) } #[cfg(test)] mod test { - use crate::{mode::Mode, vim_test_context::VimTestContext}; + use crate::{state::Mode, vim_test_context::VimTestContext}; #[gpui::test] async fn test_enter_and_exit_insert_mode(cx: &mut gpui::TestAppContext) { let mut cx = VimTestContext::new(cx, true, "").await; cx.simulate_keystroke("i"); assert_eq!(cx.mode(), Mode::Insert); - cx.simulate_keystrokes(&["T", "e", "s", "t"]); + cx.simulate_keystrokes(["T", "e", "s", "t"]); cx.assert_editor_state("Test|"); cx.simulate_keystroke("escape"); - assert_eq!(cx.mode(), Mode::normal()); + assert_eq!(cx.mode(), Mode::Normal); cx.assert_editor_state("Tes|t"); } } diff --git a/crates/vim/src/mode.rs b/crates/vim/src/mode.rs deleted file mode 100644 index ccebf0ad68ed7cad0f8d0c4828a5610fe8dbfd0f..0000000000000000000000000000000000000000 --- a/crates/vim/src/mode.rs +++ /dev/null @@ -1,73 +0,0 @@ -use editor::CursorShape; -use gpui::keymap::Context; -use serde::Deserialize; - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)] -pub enum Mode { - Normal(NormalState), - Insert, -} - -impl Mode { - pub fn cursor_shape(&self) -> CursorShape { - match self { - Mode::Normal(_) => CursorShape::Block, - Mode::Insert => CursorShape::Bar, - } - } - - pub fn keymap_context_layer(&self) -> Context { - let mut context = Context::default(); - context.map.insert( - "vim_mode".to_string(), - match self { - Self::Normal(_) => "normal", - Self::Insert => "insert", - } - .to_string(), - ); - - match self { - Self::Normal(normal_state) => normal_state.set_context(&mut context), - _ => {} - } - context - } - - pub fn normal() -> Mode { - Mode::Normal(Default::default()) - } -} - -impl Default for Mode { - fn default() -> Self { - Self::Normal(Default::default()) - } -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)] -pub enum NormalState { - None, - GPrefix, -} - -impl NormalState { - pub fn set_context(&self, context: &mut Context) { - let submode = match self { - Self::GPrefix => Some("g"), - _ => None, - }; - - if let Some(submode) = submode { - context - .map - .insert("vim_submode".to_string(), submode.to_string()); - } - } -} - -impl Default for NormalState { - fn default() -> Self { - NormalState::None - } -} diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs new file mode 100644 index 0000000000000000000000000000000000000000..beea48ef886b93a662c1a155b37631fc65729777 --- /dev/null +++ b/crates/vim/src/motion.rs @@ -0,0 +1,296 @@ +use editor::{ + char_kind, + display_map::{DisplaySnapshot, ToDisplayPoint}, + movement, Bias, DisplayPoint, +}; +use gpui::{actions, impl_actions, MutableAppContext}; +use language::{Selection, SelectionGoal}; +use serde::Deserialize; +use workspace::Workspace; + +use crate::{ + normal::normal_motion, + state::{Mode, Operator}, + Vim, +}; + +#[derive(Copy, Clone)] +pub enum Motion { + Left, + Down, + Up, + Right, + NextWordStart { + ignore_punctuation: bool, + stop_at_newline: bool, + }, + NextWordEnd { + ignore_punctuation: bool, + }, + PreviousWordStart { + ignore_punctuation: bool, + }, + StartOfLine, + EndOfLine, + StartOfDocument, + EndOfDocument, +} + +#[derive(Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +struct NextWordStart { + #[serde(default)] + ignore_punctuation: bool, + #[serde(default)] + stop_at_newline: bool, +} + +#[derive(Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +struct NextWordEnd { + #[serde(default)] + ignore_punctuation: bool, +} + +#[derive(Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +struct PreviousWordStart { + #[serde(default)] + ignore_punctuation: bool, +} + +actions!( + vim, + [ + Left, + Down, + Up, + Right, + StartOfLine, + EndOfLine, + StartOfDocument, + EndOfDocument + ] +); +impl_actions!(vim, [NextWordStart, NextWordEnd, PreviousWordStart]); + +pub fn init(cx: &mut MutableAppContext) { + cx.add_action(|_: &mut Workspace, _: &Left, cx: _| motion(Motion::Left, cx)); + cx.add_action(|_: &mut Workspace, _: &Down, cx: _| motion(Motion::Down, cx)); + cx.add_action(|_: &mut Workspace, _: &Up, cx: _| motion(Motion::Up, cx)); + cx.add_action(|_: &mut Workspace, _: &Right, cx: _| motion(Motion::Right, cx)); + cx.add_action(|_: &mut Workspace, _: &StartOfLine, cx: _| motion(Motion::StartOfLine, cx)); + cx.add_action(|_: &mut Workspace, _: &EndOfLine, cx: _| motion(Motion::EndOfLine, cx)); + cx.add_action(|_: &mut Workspace, _: &StartOfDocument, cx: _| { + motion(Motion::StartOfDocument, cx) + }); + cx.add_action(|_: &mut Workspace, _: &EndOfDocument, cx: _| motion(Motion::EndOfDocument, cx)); + + cx.add_action( + |_: &mut Workspace, + &NextWordStart { + ignore_punctuation, + stop_at_newline, + }: &NextWordStart, + cx: _| { + motion( + Motion::NextWordStart { + ignore_punctuation, + stop_at_newline, + }, + cx, + ) + }, + ); + cx.add_action( + |_: &mut Workspace, &NextWordEnd { ignore_punctuation }: &NextWordEnd, cx: _| { + motion(Motion::NextWordEnd { ignore_punctuation }, cx) + }, + ); + cx.add_action( + |_: &mut Workspace, + &PreviousWordStart { ignore_punctuation }: &PreviousWordStart, + cx: _| { motion(Motion::PreviousWordStart { ignore_punctuation }, cx) }, + ); +} + +fn motion(motion: Motion, cx: &mut MutableAppContext) { + Vim::update(cx, |vim, cx| { + if let Some(Operator::Namespace(_)) = vim.active_operator() { + vim.pop_operator(cx); + } + }); + match Vim::read(cx).state.mode { + Mode::Normal => normal_motion(motion, cx), + Mode::Insert => panic!("motion bindings in insert mode interfere with normal typing"), + } +} + +impl Motion { + pub fn move_point( + self, + map: &DisplaySnapshot, + point: DisplayPoint, + goal: SelectionGoal, + ) -> (DisplayPoint, SelectionGoal) { + use Motion::*; + match self { + Left => (left(map, point), SelectionGoal::None), + Down => movement::down(map, point, goal), + Up => movement::up(map, point, goal), + Right => (right(map, point), SelectionGoal::None), + NextWordStart { + ignore_punctuation, + stop_at_newline, + } => ( + next_word_start(map, point, ignore_punctuation, stop_at_newline), + SelectionGoal::None, + ), + NextWordEnd { ignore_punctuation } => ( + next_word_end(map, point, ignore_punctuation, true), + SelectionGoal::None, + ), + PreviousWordStart { ignore_punctuation } => ( + previous_word_start(map, point, ignore_punctuation), + SelectionGoal::None, + ), + StartOfLine => ( + movement::line_beginning(map, point, false), + SelectionGoal::None, + ), + EndOfLine => ( + map.clip_point(movement::line_end(map, point, false), Bias::Left), + SelectionGoal::None, + ), + StartOfDocument => (start_of_document(map), SelectionGoal::None), + EndOfDocument => (end_of_document(map), SelectionGoal::None), + } + } + + pub fn expand_selection(self, map: &DisplaySnapshot, selection: &mut Selection) { + use Motion::*; + match self { + Up => { + let (start, _) = Up.move_point(map, selection.start, SelectionGoal::None); + // Cursor at top of file. Return early rather + if start == selection.start { + return; + } + let (start, _) = StartOfLine.move_point(map, start, SelectionGoal::None); + let (end, _) = EndOfLine.move_point(map, selection.end, SelectionGoal::None); + selection.start = start; + selection.end = end; + // TODO: Make sure selection goal is correct here + selection.goal = SelectionGoal::None; + } + Down => { + let (end, _) = Down.move_point(map, selection.end, SelectionGoal::None); + // Cursor at top of file. Return early rather + if end == selection.start { + return; + } + let (start, _) = StartOfLine.move_point(map, selection.start, SelectionGoal::None); + let (end, _) = EndOfLine.move_point(map, end, SelectionGoal::None); + selection.start = start; + selection.end = end; + // TODO: Make sure selection goal is correct here + selection.goal = SelectionGoal::None; + } + NextWordEnd { ignore_punctuation } => { + selection.set_head( + next_word_end(map, selection.head(), ignore_punctuation, false), + SelectionGoal::None, + ); + } + _ => { + let (head, goal) = self.move_point(map, selection.head(), selection.goal); + selection.set_head(head, goal); + } + } + } +} + +fn left(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint { + *point.column_mut() = point.column().saturating_sub(1); + map.clip_point(point, Bias::Left) +} + +fn right(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint { + *point.column_mut() += 1; + map.clip_point(point, Bias::Right) +} + +fn next_word_start( + map: &DisplaySnapshot, + point: DisplayPoint, + ignore_punctuation: bool, + stop_at_newline: bool, +) -> DisplayPoint { + let mut crossed_newline = false; + movement::find_boundary(map, point, |left, right| { + let left_kind = char_kind(left).coerce_punctuation(ignore_punctuation); + let right_kind = char_kind(right).coerce_punctuation(ignore_punctuation); + let at_newline = right == '\n'; + + let found = (left_kind != right_kind && !right.is_whitespace()) + || (at_newline && (crossed_newline || stop_at_newline)) + || (at_newline && left == '\n'); // Prevents skipping repeated empty lines + + if at_newline { + crossed_newline = true; + } + found + }) +} + +fn next_word_end( + map: &DisplaySnapshot, + mut point: DisplayPoint, + ignore_punctuation: bool, + before_end_character: bool, +) -> DisplayPoint { + *point.column_mut() += 1; + point = movement::find_boundary(map, point, |left, right| { + let left_kind = char_kind(left).coerce_punctuation(ignore_punctuation); + let right_kind = char_kind(right).coerce_punctuation(ignore_punctuation); + + left_kind != right_kind && !left.is_whitespace() + }); + // find_boundary clips, so if the character after the next character is a newline or at the end of the document, we know + // we have backtraced already + if before_end_character + && !map + .chars_at(point) + .skip(1) + .next() + .map(|c| c == '\n') + .unwrap_or(true) + { + *point.column_mut() = point.column().saturating_sub(1); + } + map.clip_point(point, Bias::Left) +} + +fn previous_word_start( + map: &DisplaySnapshot, + mut point: DisplayPoint, + ignore_punctuation: bool, +) -> DisplayPoint { + // This works even though find_preceding_boundary is called for every character in the line containing + // cursor because the newline is checked only once. + point = movement::find_preceding_boundary(map, point, |left, right| { + let left_kind = char_kind(left).coerce_punctuation(ignore_punctuation); + let right_kind = char_kind(right).coerce_punctuation(ignore_punctuation); + + (left_kind != right_kind && !right.is_whitespace()) || left == '\n' + }); + point +} + +fn start_of_document(map: &DisplaySnapshot) -> DisplayPoint { + 0usize.to_display_point(map) +} + +fn end_of_document(map: &DisplaySnapshot) -> DisplayPoint { + map.clip_point(map.max_point(), Bias::Left) +} diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index b6752544ae48ebbb451f80f3fe0aaaec8d4d132d..235eece06f455eae8f92f9f6cc9e191a5ad39ebe 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -1,212 +1,77 @@ -mod g_prefix; - -use crate::VimState; -use editor::{char_kind, movement, Bias}; -use gpui::{actions, impl_actions, MutableAppContext, ViewContext}; +use crate::{ + motion::Motion, + state::{Mode, Operator}, + Vim, +}; +use editor::Bias; +use gpui::MutableAppContext; use language::SelectionGoal; -use serde::Deserialize; -use workspace::Workspace; - -#[derive(Clone, Deserialize)] -struct MoveToNextWordStart(pub bool); - -#[derive(Clone, Deserialize)] -struct MoveToNextWordEnd(pub bool); - -#[derive(Clone, Deserialize)] -struct MoveToPreviousWordStart(pub bool); - -impl_actions!( - vim, - [ - MoveToNextWordStart, - MoveToNextWordEnd, - MoveToPreviousWordStart, - ] -); - -actions!( - vim, - [ - GPrefix, - MoveLeft, - MoveDown, - MoveUp, - MoveRight, - MoveToStartOfLine, - MoveToEndOfLine, - MoveToEnd, - ] -); - -pub fn init(cx: &mut MutableAppContext) { - g_prefix::init(cx); - cx.add_action(move_left); - cx.add_action(move_down); - cx.add_action(move_up); - cx.add_action(move_right); - cx.add_action(move_to_start_of_line); - cx.add_action(move_to_end_of_line); - cx.add_action(move_to_end); - cx.add_action(move_to_next_word_start); - cx.add_action(move_to_next_word_end); - cx.add_action(move_to_previous_word_start); -} - -fn move_left(_: &mut Workspace, _: &MoveLeft, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, mut cursor, _| { - *cursor.column_mut() = cursor.column().saturating_sub(1); - (map.clip_point(cursor, Bias::Left), SelectionGoal::None) - }); - }); - }) -} - -fn move_down(_: &mut Workspace, _: &MoveDown, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, movement::down); - }); - }); -} - -fn move_up(_: &mut Workspace, _: &MoveUp, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, movement::up); - }); - }); -} - -fn move_right(_: &mut Workspace, _: &MoveRight, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, mut cursor, _| { - *cursor.column_mut() += 1; - (map.clip_point(cursor, Bias::Right), SelectionGoal::None) - }); - }); - }); -} - -fn move_to_start_of_line( - _: &mut Workspace, - _: &MoveToStartOfLine, - cx: &mut ViewContext, -) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, cursor, _| { - ( - movement::line_beginning(map, cursor, false), - SelectionGoal::None, - ) - }); - }); - }); -} -fn move_to_end_of_line(_: &mut Workspace, _: &MoveToEndOfLine, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, cursor, _| { - ( - map.clip_point(movement::line_end(map, cursor, false), Bias::Left), - SelectionGoal::None, - ) - }); - }); +pub fn normal_motion(motion: Motion, cx: &mut MutableAppContext) { + Vim::update(cx, |vim, cx| { + match vim.state.operator_stack.pop() { + None => move_cursor(vim, motion, cx), + Some(Operator::Change) => change_over(vim, motion, cx), + Some(Operator::Delete) => delete_over(vim, motion, cx), + Some(Operator::Namespace(_)) => panic!( + "Normal mode recieved motion with namespaced operator. Likely this means an invalid keymap was used"), + } + vim.clear_operator(cx); }); } -fn move_to_end(_: &mut Workspace, _: &MoveToEnd, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.replace_selections_with(cx, |map| map.clip_point(map.max_point(), Bias::Left)); - }); +fn move_cursor(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { + vim.update_active_editor(cx, |editor, cx| { + editor.move_cursors(cx, |map, cursor, goal| motion.move_point(map, cursor, goal)) }); } -fn move_to_next_word_start( - _: &mut Workspace, - &MoveToNextWordStart(treat_punctuation_as_word): &MoveToNextWordStart, - cx: &mut ViewContext, -) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, mut cursor, _| { - let mut crossed_newline = false; - cursor = movement::find_boundary(map, cursor, |left, right| { - let left_kind = char_kind(left).coerce_punctuation(treat_punctuation_as_word); - let right_kind = char_kind(right).coerce_punctuation(treat_punctuation_as_word); - let at_newline = right == '\n'; - - let found = (left_kind != right_kind && !right.is_whitespace()) - || (at_newline && crossed_newline) - || (at_newline && left == '\n'); // Prevents skipping repeated empty lines - - if at_newline { - crossed_newline = true; - } - found +fn change_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { + vim.update_active_editor(cx, |editor, cx| { + editor.transact(cx, |editor, cx| { + // Don't clip at line ends during change operation + editor.set_clip_at_line_ends(false, cx); + editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); + editor.set_clip_at_line_ends(true, cx); + match motion { + Motion::Up => editor.insert(&"\n", cx), + Motion::Down => editor.insert(&"\n", cx), + _ => editor.insert(&"", cx), + } + + if let Motion::Up = motion { + // Position cursor on previous line after change + editor.move_cursors(cx, |map, cursor, goal| { + Motion::Up.move_point(map, cursor, goal) }); - (cursor, SelectionGoal::None) - }); + } }); }); + vim.switch_mode(Mode::Insert, cx) } -fn move_to_next_word_end( - _: &mut Workspace, - &MoveToNextWordEnd(treat_punctuation_as_word): &MoveToNextWordEnd, - cx: &mut ViewContext, -) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, mut cursor, _| { - *cursor.column_mut() += 1; - cursor = movement::find_boundary(map, cursor, |left, right| { - let left_kind = char_kind(left).coerce_punctuation(treat_punctuation_as_word); - let right_kind = char_kind(right).coerce_punctuation(treat_punctuation_as_word); - - left_kind != right_kind && !left.is_whitespace() +fn delete_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { + vim.update_active_editor(cx, |editor, cx| { + editor.transact(cx, |editor, cx| { + // Don't clip at line ends during delete operation + editor.set_clip_at_line_ends(false, cx); + editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); + match motion { + Motion::Up => editor.insert(&"\n", cx), + Motion::Down => editor.insert(&"\n", cx), + _ => editor.insert(&"", cx), + } + + if let Motion::Up = motion { + // Position cursor on previous line after change + editor.move_cursors(cx, |map, cursor, goal| { + Motion::Up.move_point(map, cursor, goal) }); - // find_boundary clips, so if the character after the next character is a newline or at the end of the document, we know - // we have backtraced already - if !map - .chars_at(cursor) - .skip(1) - .next() - .map(|c| c == '\n') - .unwrap_or(true) - { - *cursor.column_mut() = cursor.column().saturating_sub(1); - } - (map.clip_point(cursor, Bias::Left), SelectionGoal::None) - }); - }); - }); -} - -fn move_to_previous_word_start( - _: &mut Workspace, - &MoveToPreviousWordStart(treat_punctuation_as_word): &MoveToPreviousWordStart, - cx: &mut ViewContext, -) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, mut cursor, _| { - // This works even though find_preceding_boundary is called for every character in the line containing - // cursor because the newline is checked only once. - cursor = movement::find_preceding_boundary(map, cursor, |left, right| { - let left_kind = char_kind(left).coerce_punctuation(treat_punctuation_as_word); - let right_kind = char_kind(right).coerce_punctuation(treat_punctuation_as_word); - - (left_kind != right_kind && !right.is_whitespace()) || left == '\n' - }); - (cursor, SelectionGoal::None) + } + // Fixup cursor position after the deletion + editor.set_clip_at_line_ends(true, cx); + editor.move_selection_heads(cx, |map, head, _| { + (map.clip_point(head, Bias::Left), SelectionGoal::None) }); }); }); @@ -217,7 +82,13 @@ mod test { use indoc::indoc; use util::test::marked_text; - use crate::vim_test_context::VimTestContext; + use crate::{ + state::{ + Mode::{self, *}, + Namespace, Operator, + }, + vim_test_context::VimTestContext, + }; #[gpui::test] async fn test_hjkl(cx: &mut gpui::TestAppContext) { @@ -362,7 +233,7 @@ mod test { } // Reset and test ignoring punctuation - cx.simulate_keystrokes(&["g", "g"]); + cx.simulate_keystrokes(["g", "g"]); let (_, cursor_offsets) = marked_text(indoc! {" The |quick-brown | @@ -392,7 +263,7 @@ mod test { } // Reset and test ignoring punctuation - cx.simulate_keystrokes(&["g", "g"]); + cx.simulate_keystrokes(["g", "g"]); let (_, cursor_offsets) = marked_text(indoc! {" Th|e quick-brow|n @@ -434,4 +305,232 @@ mod test { cx.assert_newest_selection_head_offset(cursor_offset); } } + + #[gpui::test] + async fn test_g_prefix_and_abort(cx: &mut gpui::TestAppContext) { + let mut cx = VimTestContext::new(cx, true, "").await; + + // Can abort with escape to get back to normal mode + cx.simulate_keystroke("g"); + assert_eq!(cx.mode(), Normal); + assert_eq!( + cx.active_operator(), + Some(Operator::Namespace(Namespace::G)) + ); + cx.simulate_keystroke("escape"); + assert_eq!(cx.mode(), Normal); + assert_eq!(cx.active_operator(), None); + } + + #[gpui::test] + async fn test_move_to_start(cx: &mut gpui::TestAppContext) { + let initial_content = indoc! {" + The quick + + brown fox jumps + over the lazy dog"}; + let mut cx = VimTestContext::new(cx, true, initial_content).await; + + // Jump to the end to + cx.simulate_keystroke("shift-G"); + cx.assert_editor_state(indoc! {" + The quick + + brown fox jumps + over the lazy do|g"}); + + // Jump to the start + cx.simulate_keystrokes(["g", "g"]); + cx.assert_editor_state(indoc! {" + |The quick + + brown fox jumps + over the lazy dog"}); + assert_eq!(cx.mode(), Normal); + assert_eq!(cx.active_operator(), None); + + // Repeat action doesn't change + cx.simulate_keystrokes(["g", "g"]); + cx.assert_editor_state(indoc! {" + |The quick + + brown fox jumps + over the lazy dog"}); + assert_eq!(cx.mode(), Normal); + assert_eq!(cx.active_operator(), None); + } + + #[gpui::test] + async fn test_change(cx: &mut gpui::TestAppContext) { + fn assert(motion: &str, initial_state: &str, state_after: &str, cx: &mut VimTestContext) { + cx.assert_binding( + ["c", motion], + initial_state, + Mode::Normal, + state_after, + Mode::Insert, + ); + } + let cx = &mut VimTestContext::new(cx, true, "").await; + assert("h", "Te|st", "T|st", cx); + assert("l", "Te|st", "Te|t", cx); + assert("w", "|Test", "|", cx); + assert("w", "Te|st", "Te|", cx); + assert("w", "Te|st Test", "Te| Test", cx); + assert("e", "Te|st Test", "Te| Test", cx); + assert("b", "Te|st", "|st", cx); + assert("b", "Test Te|st", "Test |st", cx); + assert( + "w", + indoc! {" + The quick + brown |fox + jumps over"}, + indoc! {" + The quick + brown | + jumps over"}, + cx, + ); + assert( + "shift-W", + indoc! {" + The quick + brown |fox-fox + jumps over"}, + indoc! {" + The quick + brown | + jumps over"}, + cx, + ); + assert( + "k", + indoc! {" + The quick + brown |fox"}, + indoc! {" + | + "}, + cx, + ); + assert( + "j", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + + |"}, + cx, + ); + assert( + "shift-$", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + The q| + brown fox"}, + cx, + ); + assert( + "0", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + |uick + brown fox"}, + cx, + ); + } + + #[gpui::test] + async fn test_delete(cx: &mut gpui::TestAppContext) { + fn assert(motion: &str, initial_state: &str, state_after: &str, cx: &mut VimTestContext) { + cx.assert_binding( + ["d", motion], + initial_state, + Mode::Normal, + state_after, + Mode::Normal, + ); + } + let cx = &mut VimTestContext::new(cx, true, "").await; + assert("h", "Te|st", "T|st", cx); + assert("l", "Te|st", "Te|t", cx); + assert("w", "|Test", "|", cx); + assert("w", "Te|st", "T|e", cx); + assert("w", "Te|st Test", "Te|Test", cx); + assert("e", "Te|st Test", "Te| Test", cx); + assert("b", "Te|st", "|st", cx); + assert("b", "Test Te|st", "Test |st", cx); + assert( + "w", + indoc! {" + The quick + brown |fox + jumps over"}, + // Trailing space after cursor + indoc! {" + The quick + brown| + jumps over"}, + cx, + ); + assert( + "shift-W", + indoc! {" + The quick + brown |fox-fox + jumps over"}, + // Trailing space after cursor + indoc! {" + The quick + brown| + jumps over"}, + cx, + ); + assert( + "k", + indoc! {" + The quick + brown |fox"}, + indoc! {" + | + "}, + cx, + ); + assert( + "j", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + + |"}, + cx, + ); + assert( + "shift-$", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + The |q + brown fox"}, + cx, + ); + assert( + "0", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + |uick + brown fox"}, + cx, + ); + } } diff --git a/crates/vim/src/normal/g_prefix.rs b/crates/vim/src/normal/g_prefix.rs deleted file mode 100644 index 5fecbc4c5bdb974f2482129a3e98c2801c72b94b..0000000000000000000000000000000000000000 --- a/crates/vim/src/normal/g_prefix.rs +++ /dev/null @@ -1,75 +0,0 @@ -use crate::{mode::Mode, SwitchMode, VimState}; -use gpui::{actions, MutableAppContext, ViewContext}; -use workspace::Workspace; - -actions!(vim, [MoveToStart]); - -pub fn init(cx: &mut MutableAppContext) { - cx.add_action(move_to_start); -} - -fn move_to_start(_: &mut Workspace, _: &MoveToStart, cx: &mut ViewContext) { - VimState::update_global(cx, |state, cx| { - state.update_active_editor(cx, |editor, cx| { - editor.move_to_beginning(&editor::MoveToBeginning, cx); - }); - state.switch_mode(&SwitchMode(Mode::normal()), cx); - }) -} - -#[cfg(test)] -mod test { - use indoc::indoc; - - use crate::{ - mode::{Mode, NormalState}, - vim_test_context::VimTestContext, - }; - - #[gpui::test] - async fn test_g_prefix_and_abort(cx: &mut gpui::TestAppContext) { - let mut cx = VimTestContext::new(cx, true, "").await; - - // Can abort with escape to get back to normal mode - cx.simulate_keystroke("g"); - assert_eq!(cx.mode(), Mode::Normal(NormalState::GPrefix)); - cx.simulate_keystroke("escape"); - assert_eq!(cx.mode(), Mode::normal()); - } - - #[gpui::test] - async fn test_move_to_start(cx: &mut gpui::TestAppContext) { - let initial_content = indoc! {" - The quick - - brown fox jumps - over the lazy dog"}; - let mut cx = VimTestContext::new(cx, true, initial_content).await; - - // Jump to the end to - cx.simulate_keystroke("shift-G"); - cx.assert_editor_state(indoc! {" - The quick - - brown fox jumps - over the lazy do|g"}); - - // Jump to the start - cx.simulate_keystrokes(&["g", "g"]); - cx.assert_editor_state(indoc! {" - |The quick - - brown fox jumps - over the lazy dog"}); - assert_eq!(cx.mode(), Mode::normal()); - - // Repeat action doesn't change - cx.simulate_keystrokes(&["g", "g"]); - cx.assert_editor_state(indoc! {" - |The quick - - brown fox jumps - over the lazy dog"}); - assert_eq!(cx.mode(), Mode::normal()); - } -} diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs new file mode 100644 index 0000000000000000000000000000000000000000..73769eafbcc99a18e104316c593deb328d59e4b2 --- /dev/null +++ b/crates/vim/src/state.rs @@ -0,0 +1,82 @@ +use editor::CursorShape; +use gpui::keymap::Context; +use serde::Deserialize; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)] +pub enum Mode { + Normal, + Insert, +} + +impl Default for Mode { + fn default() -> Self { + Self::Normal + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)] +pub enum Namespace { + G, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)] +pub enum Operator { + Namespace(Namespace), + Change, + Delete, +} + +#[derive(Default)] +pub struct VimState { + pub mode: Mode, + pub operator_stack: Vec, +} + +impl VimState { + pub fn cursor_shape(&self) -> CursorShape { + match self.mode { + Mode::Normal => CursorShape::Block, + Mode::Insert => CursorShape::Bar, + } + } + + pub fn vim_controlled(&self) -> bool { + !matches!(self.mode, Mode::Insert) + } + + pub fn keymap_context_layer(&self) -> Context { + let mut context = Context::default(); + context.map.insert( + "vim_mode".to_string(), + match self.mode { + Mode::Normal => "normal", + Mode::Insert => "insert", + } + .to_string(), + ); + + if self.vim_controlled() { + context.set.insert("VimControl".to_string()); + } + + if let Some(operator) = &self.operator_stack.last() { + operator.set_context(&mut context); + } + context + } +} + +impl Operator { + pub fn set_context(&self, context: &mut Context) { + let operator_context = match self { + Operator::Namespace(Namespace::G) => "g", + Operator::Change => "c", + Operator::Delete => "d", + } + .to_owned(); + + context + .map + .insert("vim_operator".to_string(), operator_context.to_string()); + } +} diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index adcf2fb130a61a137c9226b809daccdec60b381e..65acce7a42606ef17bf2b750de92b212c756c85d 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -1,7 +1,8 @@ mod editor_events; mod insert; -mod mode; +mod motion; mod normal; +mod state; #[cfg(test)] mod vim_test_context; @@ -10,41 +11,53 @@ use editor::{CursorShape, Editor}; use gpui::{impl_actions, MutableAppContext, ViewContext, WeakViewHandle}; use serde::Deserialize; -use mode::Mode; use settings::Settings; +use state::{Mode, Operator, VimState}; use workspace::{self, Workspace}; #[derive(Clone, Deserialize)] pub struct SwitchMode(pub Mode); -impl_actions!(vim, [SwitchMode]); +#[derive(Clone, Deserialize)] +pub struct PushOperator(pub Operator); + +impl_actions!(vim, [SwitchMode, PushOperator]); pub fn init(cx: &mut MutableAppContext) { editor_events::init(cx); insert::init(cx); - normal::init(cx); + motion::init(cx); - cx.add_action(|_: &mut Workspace, action: &SwitchMode, cx| { - VimState::update_global(cx, |state, cx| state.switch_mode(action, cx)) + cx.add_action(|_: &mut Workspace, &SwitchMode(mode): &SwitchMode, cx| { + Vim::update(cx, |vim, cx| vim.switch_mode(mode, cx)) }); + cx.add_action( + |_: &mut Workspace, &PushOperator(operator): &PushOperator, cx| { + Vim::update(cx, |vim, cx| vim.push_operator(operator, cx)) + }, + ); cx.observe_global::(|settings, cx| { - VimState::update_global(cx, |state, cx| state.set_enabled(settings.vim_mode, cx)) + Vim::update(cx, |state, cx| state.set_enabled(settings.vim_mode, cx)) }) .detach(); } #[derive(Default)] -pub struct VimState { +pub struct Vim { editors: HashMap>, active_editor: Option>, enabled: bool, - mode: Mode, + state: VimState, } -impl VimState { - fn update_global(cx: &mut MutableAppContext, update: F) -> S +impl Vim { + fn read(cx: &mut MutableAppContext) -> &Self { + cx.default_global() + } + + fn update(cx: &mut MutableAppContext, update: F) -> S where F: FnOnce(&mut Self, &mut MutableAppContext) -> S, { @@ -62,33 +75,54 @@ impl VimState { .map(|ae| ae.update(cx, update)) } - fn switch_mode(&mut self, SwitchMode(mode): &SwitchMode, cx: &mut MutableAppContext) { - self.mode = *mode; + fn switch_mode(&mut self, mode: Mode, cx: &mut MutableAppContext) { + self.state.mode = mode; + self.state.operator_stack.clear(); self.sync_editor_options(cx); } + fn push_operator(&mut self, operator: Operator, cx: &mut MutableAppContext) { + self.state.operator_stack.push(operator); + self.sync_editor_options(cx); + } + + fn pop_operator(&mut self, cx: &mut MutableAppContext) -> Operator { + let popped_operator = self.state.operator_stack.pop().expect("Operator popped when no operator was on the stack. This likely means there is an invalid keymap config"); + self.sync_editor_options(cx); + popped_operator + } + + fn clear_operator(&mut self, cx: &mut MutableAppContext) { + self.state.operator_stack.clear(); + self.sync_editor_options(cx); + } + + fn active_operator(&mut self) -> Option { + self.state.operator_stack.last().copied() + } + fn set_enabled(&mut self, enabled: bool, cx: &mut MutableAppContext) { if self.enabled != enabled { self.enabled = enabled; - self.mode = Default::default(); + self.state = Default::default(); if enabled { - self.mode = Mode::normal(); + self.state.mode = Mode::Normal; } self.sync_editor_options(cx); } } fn sync_editor_options(&self, cx: &mut MutableAppContext) { - let mode = self.mode; - let cursor_shape = mode.cursor_shape(); + let state = &self.state; + let cursor_shape = state.cursor_shape(); for editor in self.editors.values() { if let Some(editor) = editor.upgrade(cx) { editor.update(cx, |editor, cx| { if self.enabled { editor.set_cursor_shape(cursor_shape, cx); editor.set_clip_at_line_ends(cursor_shape == CursorShape::Block, cx); - editor.set_input_enabled(mode == Mode::Insert); - let context_layer = mode.keymap_context_layer(); + editor.set_input_enabled(!state.vim_controlled()); + let context_layer = state.keymap_context_layer(); editor.set_keymap_context_layer::(context_layer); } else { editor.set_cursor_shape(CursorShape::Bar, cx); @@ -104,12 +138,12 @@ impl VimState { #[cfg(test)] mod test { - use crate::{mode::Mode, vim_test_context::VimTestContext}; + use crate::{state::Mode, vim_test_context::VimTestContext}; #[gpui::test] async fn test_initially_disabled(cx: &mut gpui::TestAppContext) { let mut cx = VimTestContext::new(cx, false, "").await; - cx.simulate_keystrokes(&["h", "j", "k", "l"]); + cx.simulate_keystrokes(["h", "j", "k", "l"]); cx.assert_editor_state("hjkl|"); } @@ -122,22 +156,22 @@ mod test { // Editor acts as though vim is disabled cx.disable_vim(); - cx.simulate_keystrokes(&["h", "j", "k", "l"]); + cx.simulate_keystrokes(["h", "j", "k", "l"]); cx.assert_editor_state("hjkl|"); // Enabling dynamically sets vim mode again and restores normal mode cx.enable_vim(); - assert_eq!(cx.mode(), Mode::normal()); - cx.simulate_keystrokes(&["h", "h", "h", "l"]); + assert_eq!(cx.mode(), Mode::Normal); + cx.simulate_keystrokes(["h", "h", "h", "l"]); assert_eq!(cx.editor_text(), "hjkl".to_owned()); cx.assert_editor_state("hj|kl"); - cx.simulate_keystrokes(&["i", "T", "e", "s", "t"]); + cx.simulate_keystrokes(["i", "T", "e", "s", "t"]); cx.assert_editor_state("hjTest|kl"); // Disabling and enabling resets to normal mode assert_eq!(cx.mode(), Mode::Insert); cx.disable_vim(); cx.enable_vim(); - assert_eq!(cx.mode(), Mode::normal()); + assert_eq!(cx.mode(), Mode::Normal); } } diff --git a/crates/vim/src/vim_test_context.rs b/crates/vim/src/vim_test_context.rs index 2e87115af25f10abb9fdc9e4aa2bdd30394fc8df..1e10b5e206260c7593b7aff160fbdc3b1e327ccb 100644 --- a/crates/vim/src/vim_test_context.rs +++ b/crates/vim/src/vim_test_context.rs @@ -6,7 +6,7 @@ use language::{Point, Selection}; use util::test::marked_text; use workspace::{WorkspaceHandle, WorkspaceParams}; -use crate::*; +use crate::{state::Operator, *}; pub struct VimTestContext<'a> { cx: &'a mut gpui::TestAppContext, @@ -100,7 +100,12 @@ impl<'a> VimTestContext<'a> { } pub fn mode(&mut self) -> Mode { - self.cx.update(|cx| cx.global::().mode) + self.cx.read(|cx| cx.global::().state.mode) + } + + pub fn active_operator(&mut self) -> Option { + self.cx + .read(|cx| cx.global::().state.operator_stack.last().copied()) } pub fn editor_text(&mut self) -> String { @@ -119,12 +124,23 @@ impl<'a> VimTestContext<'a> { .dispatch_keystroke(self.window_id, keystroke, input, false); } - pub fn simulate_keystrokes(&mut self, keystroke_texts: &[&str]) { + pub fn simulate_keystrokes(&mut self, keystroke_texts: [&str; COUNT]) { for keystroke_text in keystroke_texts.into_iter() { self.simulate_keystroke(keystroke_text); } } + pub fn set_state(&mut self, text: &str, mode: Mode) { + self.cx + .update(|cx| Vim::update(cx, |vim, cx| vim.switch_mode(mode, cx))); + self.editor.update(self.cx, |editor, cx| { + let (unmarked_text, markers) = marked_text(&text); + editor.set_text(unmarked_text, cx); + let cursor_offset = markers[0]; + editor.replace_selections_with(cx, |map| cursor_offset.to_display_point(map)); + }) + } + pub fn assert_newest_selection_head_offset(&mut self, expected_offset: usize) { let actual_head = self.newest_selection().head(); let (actual_offset, expected_head) = self.editor.update(self.cx, |editor, cx| { @@ -171,6 +187,21 @@ impl<'a> VimTestContext<'a> { actual_position_text, expected_position_text ) } + + pub fn assert_binding( + &mut self, + keystrokes: [&str; COUNT], + initial_state: &str, + initial_mode: Mode, + state_after: &str, + mode_after: Mode, + ) { + self.set_state(initial_state, initial_mode); + self.simulate_keystrokes(keystrokes); + self.assert_editor_state(state_after); + assert_eq!(self.mode(), mode_after); + assert_eq!(self.active_operator(), None); + } } impl<'a> Deref for VimTestContext<'a> { From ec704cae253738236534cd35366305e2052e5f3c Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 17 Apr 2022 22:37:08 -0400 Subject: [PATCH 190/245] update feature color in dark theme --- assets/themes/dark.json | 10 +++++----- styles/dist/dark.json | 14 +++++++------- styles/dist/light.json | 20 ++++++++++---------- styles/dist/tokens.json | 34 +++++++++++++++++----------------- styles/src/themes/dark.ts | 2 +- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index 41729736d16915dd3ea30ddb676115081f309e44..96f1ee0efc64e9c95536dcbf4086c05663509702 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -18,7 +18,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#96e818", + "color": "#4f8ff7", "weight": "bold", "size": 14 } @@ -38,7 +38,7 @@ }, "highlight_text": { "family": "Zed Sans", - "color": "#96e818", + "color": "#4f8ff7", "weight": "bold", "size": 14 }, @@ -413,7 +413,7 @@ }, "match_highlight": { "family": "Zed Mono", - "color": "#96e818", + "color": "#4f8ff7", "size": 14 }, "selected_item": { @@ -674,9 +674,9 @@ "color": "#de900c", "weight": "bold" }, - "emphasis": "#96e818", + "emphasis": "#4f8ff7", "emphasis_strong": { - "color": "#96e818", + "color": "#4f8ff7", "weight": "bold" }, "link_uri": { diff --git a/styles/dist/dark.json b/styles/dist/dark.json index 760790a3cb6bceb1ca87c85c1ce51d532d9c4116..0aed7aa7b7d77bc844cd04a47af180f65a77e53c 100644 --- a/styles/dist/dark.json +++ b/styles/dist/dark.json @@ -29,8 +29,8 @@ "type": "color" }, "feature": { - "value": "#1096d3", - "step": 500, + "value": "#4f8ff7", + "step": 400, "type": "color" }, "ok": { @@ -279,7 +279,7 @@ "type": "color" }, "focused": { - "value": "#717171", + "value": "#484bed", "step": 500, "type": "color" }, @@ -374,13 +374,13 @@ "type": "color" }, "match": { - "value": "#1096d329", - "step": 500, + "value": "#3f15a380", + "step": 700, "type": "color" }, "activeMatch": { - "value": "#0e415852", - "step": 800, + "value": "#5316e0b3", + "step": 600, "type": "color" }, "related": { diff --git a/styles/dist/light.json b/styles/dist/light.json index 90fba12ac762cdaa47e7b77b6360f5df8a9319e7..897b03a6fd131a52f6d7c309a678a33b9a5f7b97 100644 --- a/styles/dist/light.json +++ b/styles/dist/light.json @@ -279,8 +279,8 @@ "type": "color" }, "focused": { - "value": "#e3e3e3", - "step": 100, + "value": "#484bed", + "step": 500, "type": "color" }, "active": { @@ -374,13 +374,13 @@ "type": "color" }, "match": { - "value": "#eb2d2d33", - "step": 500, + "value": "#fce9b7", + "step": 100, "type": "color" }, "activeMatch": { - "value": "#7274f35c", - "step": 400, + "value": "#f9da82", + "step": 200, "type": "color" }, "related": { @@ -416,19 +416,19 @@ "type": "color" }, "function": { - "value": "#f9812e", + "value": "#bb550e", "type": "color" }, "type": { - "value": "#de900c", + "value": "#a8820e", "type": "color" }, "variant": { - "value": "#1096d3", + "value": "#97142a", "type": "color" }, "property": { - "value": "#118a62", + "value": "#106c4e", "type": "color" }, "enum": { diff --git a/styles/dist/tokens.json b/styles/dist/tokens.json index 29d9daeec3c2cd007a6b1eb6ae9d8173057cbd15..dc9438cdc7a292e2f2fb453278039ebff959e5eb 100644 --- a/styles/dist/tokens.json +++ b/styles/dist/tokens.json @@ -1185,8 +1185,8 @@ "type": "color" }, "feature": { - "value": "#1096d3", - "step": 500, + "value": "#4f8ff7", + "step": 400, "type": "color" }, "ok": { @@ -1435,7 +1435,7 @@ "type": "color" }, "focused": { - "value": "#717171", + "value": "#484bed", "step": 500, "type": "color" }, @@ -1530,13 +1530,13 @@ "type": "color" }, "match": { - "value": "#1096d329", - "step": 500, + "value": "#3f15a380", + "step": 700, "type": "color" }, "activeMatch": { - "value": "#0e415852", - "step": 800, + "value": "#5316e0b3", + "step": 600, "type": "color" }, "related": { @@ -2072,8 +2072,8 @@ "type": "color" }, "focused": { - "value": "#e3e3e3", - "step": 100, + "value": "#484bed", + "step": 500, "type": "color" }, "active": { @@ -2167,13 +2167,13 @@ "type": "color" }, "match": { - "value": "#eb2d2d33", - "step": 500, + "value": "#fce9b7", + "step": 100, "type": "color" }, "activeMatch": { - "value": "#7274f35c", - "step": 400, + "value": "#f9da82", + "step": 200, "type": "color" }, "related": { @@ -2209,19 +2209,19 @@ "type": "color" }, "function": { - "value": "#f9812e", + "value": "#bb550e", "type": "color" }, "type": { - "value": "#de900c", + "value": "#a8820e", "type": "color" }, "variant": { - "value": "#1096d3", + "value": "#97142a", "type": "color" }, "property": { - "value": "#118a62", + "value": "#106c4e", "type": "color" }, "enum": { diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 4ff3db435c06c02e1540748f2e2b9f0926ff4cef..9b69f5cc85ec20140f7622b5ae7506754decfd52 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -66,7 +66,7 @@ const textColor = { placeholder: colors.neutral[650], active: colors.neutral[0], //TODO: (design) define feature and it's correct value - feature: colors.lime[400], + feature: colors.blue[400], ok: colors.green[600], error: colors.red[400], warning: colors.amber[300], From dcd59226098a17a93ed524a70403dd8195ce12a7 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 14 Apr 2022 11:30:19 -0700 Subject: [PATCH 191/245] Merge jsx language into js --- crates/zed/src/languages.rs | 5 - .../zed/src/languages/javascript/config.toml | 2 +- crates/zed/src/languages/jsx/brackets.scm | 5 - crates/zed/src/languages/jsx/config.toml | 12 - .../zed/src/languages/jsx/highlights-jsx.scm | 0 crates/zed/src/languages/jsx/highlights.scm | 219 ------------------ crates/zed/src/languages/jsx/indents.scm | 15 -- crates/zed/src/languages/jsx/outline.scm | 55 ----- crates/zed/src/main.rs | 7 - 9 files changed, 1 insertion(+), 319 deletions(-) delete mode 100644 crates/zed/src/languages/jsx/brackets.scm delete mode 100644 crates/zed/src/languages/jsx/config.toml delete mode 100644 crates/zed/src/languages/jsx/highlights-jsx.scm delete mode 100644 crates/zed/src/languages/jsx/highlights.scm delete mode 100644 crates/zed/src/languages/jsx/indents.scm delete mode 100644 crates/zed/src/languages/jsx/outline.scm diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs index b62ae1bfdbb54300eca966f1827664d7c4690dd5..ac13c818159506ba8e21f783851e7dca46da5d13 100644 --- a/crates/zed/src/languages.rs +++ b/crates/zed/src/languages.rs @@ -42,11 +42,6 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi tree_sitter_typescript::language_tsx(), Some(Arc::new(typescript::TypeScriptLspAdapter)), ), - ( - "jsx", - tree_sitter_typescript::language_tsx(), - Some(Arc::new(typescript::TypeScriptLspAdapter)), - ), ( "typescript", tree_sitter_typescript::language_typescript(), diff --git a/crates/zed/src/languages/javascript/config.toml b/crates/zed/src/languages/javascript/config.toml index 875dcdaf8e585908bbf9b05b64f43dcc2ee25b91..3688da705c9f6a57edb241ae55d678d4f51500f8 100644 --- a/crates/zed/src/languages/javascript/config.toml +++ b/crates/zed/src/languages/javascript/config.toml @@ -1,5 +1,5 @@ name = "JavaScript" -path_suffixes = ["js"] +path_suffixes = ["js", "jsx"] line_comment = "// " autoclose_before = ";:.,=}])>" brackets = [ diff --git a/crates/zed/src/languages/jsx/brackets.scm b/crates/zed/src/languages/jsx/brackets.scm deleted file mode 100644 index 63395f81d84e6452c631a9e582e2d697cba445ef..0000000000000000000000000000000000000000 --- a/crates/zed/src/languages/jsx/brackets.scm +++ /dev/null @@ -1,5 +0,0 @@ -("(" @open ")" @close) -("[" @open "]" @close) -("{" @open "}" @close) -("<" @open ">" @close) -("\"" @open "\"" @close) diff --git a/crates/zed/src/languages/jsx/config.toml b/crates/zed/src/languages/jsx/config.toml deleted file mode 100644 index 3e4dc5f79f300de8ec2883f6d012b64e0c989dc4..0000000000000000000000000000000000000000 --- a/crates/zed/src/languages/jsx/config.toml +++ /dev/null @@ -1,12 +0,0 @@ -name = "JSX" -path_suffixes = ["jsx"] -line_comment = "// " -autoclose_before = ";:.,=}])>" -brackets = [ - { start = "{", end = "}", close = true, newline = true }, - { start = "[", end = "]", close = true, newline = true }, - { start = "(", end = ")", close = true, newline = true }, - { start = "<", end = ">", close = false, newline = true }, - { start = "\"", end = "\"", close = true, newline = false }, - { start = "/*", end = " */", close = true, newline = false }, -] diff --git a/crates/zed/src/languages/jsx/highlights-jsx.scm b/crates/zed/src/languages/jsx/highlights-jsx.scm deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/crates/zed/src/languages/jsx/highlights.scm b/crates/zed/src/languages/jsx/highlights.scm deleted file mode 100644 index cb4e82b33d8b04da41e90c6926499669fee33b60..0000000000000000000000000000000000000000 --- a/crates/zed/src/languages/jsx/highlights.scm +++ /dev/null @@ -1,219 +0,0 @@ -; Variables - -(identifier) @variable - -; Properties - -(property_identifier) @property - -; Function and method calls - -(call_expression - function: (identifier) @function) - -(call_expression - function: (member_expression - property: (property_identifier) @function.method)) - -; Function and method definitions - -(function - name: (identifier) @function) -(function_declaration - name: (identifier) @function) -(method_definition - name: (property_identifier) @function.method) - -(pair - key: (property_identifier) @function.method - value: [(function) (arrow_function)]) - -(assignment_expression - left: (member_expression - property: (property_identifier) @function.method) - right: [(function) (arrow_function)]) - -(variable_declarator - name: (identifier) @function - value: [(function) (arrow_function)]) - -(assignment_expression - left: (identifier) @function - right: [(function) (arrow_function)]) - -; Special identifiers - -((identifier) @constructor - (#match? @constructor "^[A-Z]")) - -([ - (identifier) - (shorthand_property_identifier) - (shorthand_property_identifier_pattern) - ] @constant - (#match? @constant "^[A-Z_][A-Z\\d_]+$")) - -; Literals - -(this) @variable.builtin -(super) @variable.builtin - -[ - (true) - (false) - (null) - (undefined) -] @constant.builtin - -(comment) @comment - -[ - (string) - (template_string) -] @string - -(regex) @string.special -(number) @number - -; Tokens - -(template_substitution - "${" @punctuation.special - "}" @punctuation.special) @embedded - -[ - ";" - "?." - "." - "," -] @punctuation.delimiter - -[ - "-" - "--" - "-=" - "+" - "++" - "+=" - "*" - "*=" - "**" - "**=" - "/" - "/=" - "%" - "%=" - "<" - "<=" - "<<" - "<<=" - "=" - "==" - "===" - "!" - "!=" - "!==" - "=>" - ">" - ">=" - ">>" - ">>=" - ">>>" - ">>>=" - "~" - "^" - "&" - "|" - "^=" - "&=" - "|=" - "&&" - "||" - "??" - "&&=" - "||=" - "??=" -] @operator - -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket - -[ - "as" - "async" - "await" - "break" - "case" - "catch" - "class" - "const" - "continue" - "debugger" - "default" - "delete" - "do" - "else" - "export" - "extends" - "finally" - "for" - "from" - "function" - "get" - "if" - "import" - "in" - "instanceof" - "let" - "new" - "of" - "return" - "set" - "static" - "switch" - "target" - "throw" - "try" - "typeof" - "var" - "void" - "while" - "with" - "yield" -] @keyword - -; Types - -(type_identifier) @type -(predefined_type) @type.builtin - -((identifier) @type - (#match? @type "^[A-Z]")) - -(type_arguments - "<" @punctuation.bracket - ">" @punctuation.bracket) - -; Keywords - -[ "abstract" - "declare" - "enum" - "export" - "implements" - "interface" - "keyof" - "namespace" - "private" - "protected" - "public" - "type" - "readonly" - "override" -] @keyword \ No newline at end of file diff --git a/crates/zed/src/languages/jsx/indents.scm b/crates/zed/src/languages/jsx/indents.scm deleted file mode 100644 index 107e6ff8e03b633f408676243c24d0d9707a2a26..0000000000000000000000000000000000000000 --- a/crates/zed/src/languages/jsx/indents.scm +++ /dev/null @@ -1,15 +0,0 @@ -[ - (call_expression) - (assignment_expression) - (member_expression) - (lexical_declaration) - (variable_declaration) - (assignment_expression) - (if_statement) - (for_statement) -] @indent - -(_ "[" "]" @end) @indent -(_ "<" ">" @end) @indent -(_ "{" "}" @end) @indent -(_ "(" ")" @end) @indent diff --git a/crates/zed/src/languages/jsx/outline.scm b/crates/zed/src/languages/jsx/outline.scm deleted file mode 100644 index f8691fa41d9f64bc71e8a7ada2e6d64d62268a3a..0000000000000000000000000000000000000000 --- a/crates/zed/src/languages/jsx/outline.scm +++ /dev/null @@ -1,55 +0,0 @@ -(internal_module - "namespace" @context - name: (_) @name) @item - -(enum_declaration - "enum" @context - name: (_) @name) @item - -(function_declaration - "async"? @context - "function" @context - name: (_) @name - parameters: (formal_parameters - "(" @context - ")" @context)) @item - -(interface_declaration - "interface" @context - name: (_) @name) @item - -(program - (lexical_declaration - ["let" "const"] @context - (variable_declarator - name: (_) @name) @item)) - -(class_declaration - "class" @context - name: (_) @name) @item - -(method_definition - [ - "get" - "set" - "async" - "*" - "readonly" - "static" - (override_modifier) - (accessibility_modifier) - ]* @context - name: (_) @name - parameters: (formal_parameters - "(" @context - ")" @context)) @item - -(public_field_definition - [ - "declare" - "readonly" - "abstract" - "static" - (accessibility_modifier) - ]* @context - name: (_) @name) @item diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 599754dd9e0abfb63eec8c2ba04ccb4587713f83..41e27eb49425513fc9377642b4af7a4f60eb31dd 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -62,13 +62,6 @@ fn main() { ..Default::default() }, ) - .with_overrides( - "JSX", - settings::LanguageOverride { - tab_size: Some(2), - ..Default::default() - }, - ) .with_overrides( "TypeScript", settings::LanguageOverride { From dd25ab5798319ff416ca9f29b393cd972496f32c Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 18 Apr 2022 14:44:11 -0700 Subject: [PATCH 192/245] Revert d/c j and k binding special casing --- crates/vim/src/normal.rs | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 235eece06f455eae8f92f9f6cc9e191a5ad39ebe..e8b17e9b898246c9f48a810db3213f147cc45488 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -33,18 +33,7 @@ fn change_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { editor.set_clip_at_line_ends(false, cx); editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); editor.set_clip_at_line_ends(true, cx); - match motion { - Motion::Up => editor.insert(&"\n", cx), - Motion::Down => editor.insert(&"\n", cx), - _ => editor.insert(&"", cx), - } - - if let Motion::Up = motion { - // Position cursor on previous line after change - editor.move_cursors(cx, |map, cursor, goal| { - Motion::Up.move_point(map, cursor, goal) - }); - } + editor.insert(&"", cx); }); }); vim.switch_mode(Mode::Insert, cx) @@ -56,18 +45,8 @@ fn delete_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { // Don't clip at line ends during delete operation editor.set_clip_at_line_ends(false, cx); editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); - match motion { - Motion::Up => editor.insert(&"\n", cx), - Motion::Down => editor.insert(&"\n", cx), - _ => editor.insert(&"", cx), - } - - if let Motion::Up = motion { - // Position cursor on previous line after change - editor.move_cursors(cx, |map, cursor, goal| { - Motion::Up.move_point(map, cursor, goal) - }); - } + editor.insert(&"", cx); + // Fixup cursor position after the deletion editor.set_clip_at_line_ends(true, cx); editor.move_selection_heads(cx, |map, head, _| { @@ -410,8 +389,7 @@ mod test { The quick brown |fox"}, indoc! {" - | - "}, + |"}, cx, ); assert( @@ -420,7 +398,6 @@ mod test { The q|uick brown fox"}, indoc! {" - |"}, cx, ); @@ -498,8 +475,7 @@ mod test { The quick brown |fox"}, indoc! {" - | - "}, + |"}, cx, ); assert( @@ -508,7 +484,6 @@ mod test { The q|uick brown fox"}, indoc! {" - |"}, cx, ); From 26f2aa4d69d5396b2d119b6b3f5e4f72b709d947 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 18 Apr 2022 15:26:57 -0700 Subject: [PATCH 193/245] Swap to parsing javascript as jsx --- crates/zed/src/languages.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs index ac13c818159506ba8e21f783851e7dca46da5d13..e90a1cd7370946c975f166ac887d63c31324c72b 100644 --- a/crates/zed/src/languages.rs +++ b/crates/zed/src/languages.rs @@ -49,7 +49,7 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi ), ( "javascript", - tree_sitter_typescript::language_typescript(), + tree_sitter_typescript::language_tsx(), Some(Arc::new(typescript::TypeScriptLspAdapter)), ), ] { From 99f8466cb550b85afdc9fe1800f0e49829cc85d2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 11:32:39 -0700 Subject: [PATCH 194/245] Add a gpui method for listing the available actions --- crates/gpui/src/app.rs | 44 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index acc84588b09eef2152e077dae4deda14a97a09c4..9724a6c0944c4d95663f9509c8ef3a482a4a0c17 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -726,7 +726,7 @@ pub struct MutableAppContext { foreground_platform: Rc, assets: Arc, cx: AppContext, - action_deserializers: HashMap<&'static str, DeserializeActionCallback>, + action_deserializers: HashMap<&'static str, (TypeId, DeserializeActionCallback)>, capture_actions: HashMap>>>, actions: HashMap>>>, global_actions: HashMap>, @@ -877,7 +877,8 @@ impl MutableAppContext { let callback = self .action_deserializers .get(name) - .ok_or_else(|| anyhow!("unknown action {}", name))?; + .ok_or_else(|| anyhow!("unknown action {}", name))? + .1; callback(argument.unwrap_or("{}")) .with_context(|| format!("invalid data for action {}", name)) } @@ -926,7 +927,7 @@ impl MutableAppContext { self.action_deserializers .entry(A::qualified_name()) - .or_insert(A::from_json_str); + .or_insert((TypeId::of::(), A::from_json_str)); let actions = if capture { &mut self.capture_actions @@ -965,7 +966,7 @@ impl MutableAppContext { self.action_deserializers .entry(A::qualified_name()) - .or_insert(A::from_json_str); + .or_insert((TypeId::of::(), A::from_json_str)); if self .global_actions @@ -1304,6 +1305,41 @@ impl MutableAppContext { } } + pub fn available_actions( + &self, + window_id: usize, + view_id: usize, + ) -> Vec<(&'static str, Box)> { + let mut action_types: HashSet<_> = self.global_actions.keys().copied().collect(); + + let presenter = self + .presenters_and_platform_windows + .get(&window_id) + .unwrap() + .0 + .clone(); + let dispatch_path = presenter.borrow().dispatch_path_from(view_id); + for view_id in dispatch_path { + if let Some(view) = self.views.get(&(window_id, view_id)) { + let view_type = view.as_any().type_id(); + if let Some(actions) = self.actions.get(&view_type) { + action_types.extend(actions.keys().copied()); + } + } + } + + self.action_deserializers + .iter() + .filter_map(|(name, (type_id, deserialize))| { + if action_types.contains(type_id) { + Some((*name, deserialize("{}").ok()?)) + } else { + None + } + }) + .collect() + } + pub fn dispatch_action( &mut self, window_id: usize, From 4630071f58f4d892ae3b49c74d09a6cf647349c5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 13 Apr 2022 13:20:59 -0700 Subject: [PATCH 195/245] Start work on a command palette --- Cargo.lock | 17 ++ assets/keymaps/default.json | 4 +- crates/command_palette/Cargo.toml | 24 ++ crates/command_palette/src/command_palette.rs | 179 ++++++++++++++ crates/command_palette/src/selector.rs | 222 ++++++++++++++++++ crates/file_finder/src/file_finder.rs | 23 +- crates/gpui/src/app.rs | 11 + crates/gpui/src/presenter.rs | 20 +- crates/workspace/src/menu.rs | 9 +- crates/zed/Cargo.toml | 1 + crates/zed/src/main.rs | 1 + 11 files changed, 486 insertions(+), 25 deletions(-) create mode 100644 crates/command_palette/Cargo.toml create mode 100644 crates/command_palette/src/command_palette.rs create mode 100644 crates/command_palette/src/selector.rs diff --git a/Cargo.lock b/Cargo.lock index 4cba8251cf40f80dc0940ae20848f7a7326c881d..484dab47d84372d794780e4a8811a18b0da16edb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1143,6 +1143,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "command_palette" +version = "0.1.0" +dependencies = [ + "ctor", + "editor", + "env_logger 0.8.3", + "fuzzy", + "gpui", + "serde_json", + "settings", + "theme", + "util", + "workspace", +] + [[package]] name = "comrak" version = "0.10.1" @@ -6138,6 +6154,7 @@ dependencies = [ "client", "clock", "collections", + "command_palette", "contacts_panel", "crossbeam-channel", "ctor", diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index d9d5742b663ca80a52d88f906e9ba791c9dda707..e517f853d5c66f70c2c811885c08e091bc9f946b 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -16,7 +16,8 @@ "ctrl-n": "menu::SelectNext", "cmd-up": "menu::SelectFirst", "cmd-down": "menu::SelectLast", - "enter": "menu::Confirm" + "enter": "menu::Confirm", + "escape": "menu::Cancel" }, "Pane": { "shift-cmd-{": "pane::ActivatePrevItem", @@ -52,6 +53,7 @@ "cmd-k t": "theme_selector::Reload", "cmd-t": "project_symbols::Toggle", "cmd-p": "file_finder::Toggle", + "cmd-shift-P": "command_palette::Toggle", "alt-shift-D": "diagnostics::Deploy", "ctrl-alt-cmd-j": "journal::NewJournalEntry", "cmd-1": [ diff --git a/crates/command_palette/Cargo.toml b/crates/command_palette/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..b360a041254a61956bfb5cb2ea92d22e1ec73ba0 --- /dev/null +++ b/crates/command_palette/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "command_palette" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/command_palette.rs" +doctest = false + +[dependencies] +editor = { path = "../editor" } +fuzzy = { path = "../fuzzy" } +gpui = { path = "../gpui" } +settings = { path = "../settings" } +util = { path = "../util" } +theme = { path = "../theme" } +workspace = { path = "../workspace" } + +[dev-dependencies] +gpui = { path = "../gpui", features = ["test-support"] } +serde_json = { version = "1.0.64", features = ["preserve_order"] } +workspace = { path = "../workspace", features = ["test-support"] } +ctor = "0.1" +env_logger = "0.8" diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs new file mode 100644 index 0000000000000000000000000000000000000000..7e1c2b43b1be72b2d5c9780ab9e599138c0ae501 --- /dev/null +++ b/crates/command_palette/src/command_palette.rs @@ -0,0 +1,179 @@ +use std::cmp; + +use fuzzy::{StringMatch, StringMatchCandidate}; +use gpui::{ + actions, + elements::{ChildView, Label}, + Action, Element, Entity, MutableAppContext, View, ViewContext, ViewHandle, +}; +use selector::{SelectorModal, SelectorModalDelegate}; +use settings::Settings; +use workspace::Workspace; + +mod selector; + +pub fn init(cx: &mut MutableAppContext) { + cx.add_action(CommandPalette::toggle); + selector::init::(cx); +} + +actions!(command_palette, [Toggle]); + +pub struct CommandPalette { + selector: ViewHandle>, + actions: Vec<(&'static str, Box)>, + matches: Vec, + selected_ix: usize, + focused_view_id: usize, +} + +pub enum Event { + Dismissed, +} + +impl CommandPalette { + pub fn new( + focused_view_id: usize, + actions: Vec<(&'static str, Box)>, + cx: &mut ViewContext, + ) -> Self { + let this = cx.weak_handle(); + let selector = cx.add_view(|cx| SelectorModal::new(this, cx)); + Self { + selector, + actions, + matches: vec![], + selected_ix: 0, + focused_view_id, + } + } + + fn toggle(_: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { + let workspace = cx.handle(); + let window_id = cx.window_id(); + let focused_view_id = cx.focused_view_id(window_id).unwrap_or(workspace.id()); + + cx.as_mut().defer(move |cx| { + let actions = cx.available_actions(window_id, focused_view_id); + workspace.update(cx, |workspace, cx| { + workspace.toggle_modal(cx, |cx, _| { + let selector = cx.add_view(|cx| Self::new(focused_view_id, actions, cx)); + cx.subscribe(&selector, Self::on_event).detach(); + selector + }); + }); + }); + } + + fn on_event( + workspace: &mut Workspace, + _: ViewHandle, + event: &Event, + cx: &mut ViewContext, + ) { + match event { + Event::Dismissed => { + workspace.dismiss_modal(cx); + } + } + } +} + +impl Entity for CommandPalette { + type Event = Event; +} + +impl View for CommandPalette { + fn ui_name() -> &'static str { + "CommandPalette" + } + + fn render(&mut self, _: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox { + ChildView::new(self.selector.clone()).boxed() + } + + fn on_focus(&mut self, cx: &mut ViewContext) { + cx.focus(&self.selector); + } +} + +impl SelectorModalDelegate for CommandPalette { + fn match_count(&self) -> usize { + self.matches.len() + } + + fn selected_index(&self) -> usize { + self.selected_ix + } + + fn set_selected_index(&mut self, ix: usize) { + self.selected_ix = ix; + } + + fn update_matches( + &mut self, + query: String, + cx: &mut gpui::ViewContext, + ) -> gpui::Task<()> { + let candidates = self + .actions + .iter() + .enumerate() + .map(|(ix, (name, _))| StringMatchCandidate { + id: ix, + string: name.to_string(), + char_bag: name.chars().collect(), + }) + .collect::>(); + cx.spawn(move |this, mut cx| async move { + let matches = fuzzy::match_strings( + &candidates, + &query, + true, + 10000, + &Default::default(), + cx.background(), + ) + .await; + this.update(&mut cx, |this, _| { + this.matches = matches; + if this.matches.is_empty() { + this.selected_ix = 0; + } else { + this.selected_ix = cmp::min(this.selected_ix, this.matches.len() - 1); + } + }); + }) + } + + fn dismiss(&mut self, cx: &mut ViewContext) { + cx.emit(Event::Dismissed); + } + + fn confirm(&mut self, cx: &mut ViewContext) { + if !self.matches.is_empty() { + let window_id = cx.window_id(); + let action_ix = self.matches[self.selected_ix].candidate_id; + cx.dispatch_action_at( + window_id, + self.focused_view_id, + self.actions[action_ix].1.as_ref(), + ) + } + cx.emit(Event::Dismissed); + } + + fn render_match(&self, ix: usize, selected: bool, cx: &gpui::AppContext) -> gpui::ElementBox { + let settings = cx.global::(); + let theme = &settings.theme.selector; + let style = if selected { + &theme.active_item + } else { + &theme.item + }; + Label::new(self.matches[ix].string.clone(), style.label.clone()) + .contained() + .with_style(style.container) + .boxed() + } +} diff --git a/crates/command_palette/src/selector.rs b/crates/command_palette/src/selector.rs new file mode 100644 index 0000000000000000000000000000000000000000..daa0f5ff6a1a286d4304ef56272abf3ee9d908ed --- /dev/null +++ b/crates/command_palette/src/selector.rs @@ -0,0 +1,222 @@ +use editor::Editor; +use gpui::{ + elements::{ + ChildView, Flex, FlexItem, Label, ParentElement, ScrollTarget, UniformList, + UniformListState, + }, + keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, Task, + View, ViewContext, ViewHandle, WeakViewHandle, +}; +use settings::Settings; +use std::cmp; +use workspace::menu::{Cancel, Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}; + +pub fn init(cx: &mut MutableAppContext) { + cx.add_action(SelectorModal::::select_first); + cx.add_action(SelectorModal::::select_last); + cx.add_action(SelectorModal::::select_next); + cx.add_action(SelectorModal::::select_prev); + cx.add_action(SelectorModal::::confirm); + cx.add_action(SelectorModal::::cancel); +} + +pub struct SelectorModal { + delegate: WeakViewHandle, + query_editor: ViewHandle, + list_state: UniformListState, +} + +pub trait SelectorModalDelegate: View { + fn match_count(&self) -> usize; + fn selected_index(&self) -> usize; + fn set_selected_index(&mut self, ix: usize); + fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()>; + fn confirm(&mut self, cx: &mut ViewContext); + fn dismiss(&mut self, cx: &mut ViewContext); + fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox; +} + +impl Entity for SelectorModal { + type Event = (); +} + +impl View for SelectorModal { + fn ui_name() -> &'static str { + "SelectorModal" + } + + fn render(&mut self, cx: &mut RenderContext) -> gpui::ElementBox { + let settings = cx.global::(); + Flex::new(Axis::Vertical) + .with_child( + ChildView::new(&self.query_editor) + .contained() + .with_style(settings.theme.selector.input_editor.container) + .boxed(), + ) + .with_child( + FlexItem::new(self.render_matches(cx)) + .flex(1., false) + .boxed(), + ) + .contained() + .with_style(settings.theme.selector.container) + .constrained() + .with_max_width(500.0) + .with_max_height(420.0) + .aligned() + .top() + .named("selector") + } + + fn keymap_context(&self, _: &AppContext) -> keymap::Context { + let mut cx = Self::default_keymap_context(); + cx.set.insert("menu".into()); + cx + } + + fn on_focus(&mut self, cx: &mut ViewContext) { + cx.focus(&self.query_editor); + } +} + +impl SelectorModal { + pub fn new(delegate: WeakViewHandle, cx: &mut ViewContext) -> Self { + let query_editor = cx.add_view(|cx| { + Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) + }); + cx.subscribe(&query_editor, Self::on_query_editor_event) + .detach(); + + Self { + delegate, + query_editor, + list_state: Default::default(), + } + } + + fn render_matches(&self, cx: &AppContext) -> ElementBox { + let delegate = self.delegate.clone(); + let match_count = if let Some(delegate) = delegate.upgrade(cx) { + delegate.read(cx).match_count() + } else { + 0 + }; + + if match_count == 0 { + let settings = cx.global::(); + return Label::new( + "No matches".into(), + settings.theme.selector.empty.label.clone(), + ) + .contained() + .with_style(settings.theme.selector.empty.container) + .named("empty matches"); + } + + UniformList::new( + self.list_state.clone(), + match_count, + move |mut range, items, cx| { + let cx = cx.as_ref(); + let delegate = delegate.upgrade(cx).unwrap(); + let delegate = delegate.read(cx); + let selected_ix = delegate.selected_index(); + range.end = cmp::min(range.end, delegate.match_count()); + items.extend(range.map(move |ix| delegate.render_match(ix, ix == selected_ix, cx))); + }, + ) + .contained() + .with_margin_top(6.0) + .named("matches") + } + + fn on_query_editor_event( + &mut self, + _: ViewHandle, + event: &editor::Event, + cx: &mut ViewContext, + ) { + if let Some(delegate) = self.delegate.upgrade(cx) { + match event { + editor::Event::BufferEdited { .. } => { + let query = self.query_editor.read(cx).text(cx); + let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); + cx.spawn(|this, mut cx| async move { + update.await; + this.update(&mut cx, |_, cx| cx.notify()); + }) + .detach(); + } + editor::Event::Blurred => delegate.update(cx, |delegate, cx| { + delegate.dismiss(cx); + }), + _ => {} + } + } + } + + fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let index = 0; + delegate.update(cx, |delegate, _| delegate.set_selected_index(0)); + self.list_state.scroll_to(ScrollTarget::Show(index)); + cx.notify(); + } + } + + fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let index = delegate.update(cx, |delegate, _| { + let match_count = delegate.match_count(); + let index = if match_count > 0 { match_count - 1 } else { 0 }; + delegate.set_selected_index(index); + index + }); + self.list_state.scroll_to(ScrollTarget::Show(index)); + cx.notify(); + } + } + + fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let index = delegate.update(cx, |delegate, _| { + let mut selected_index = delegate.selected_index(); + if selected_index + 1 < delegate.match_count() { + selected_index += 1; + delegate.set_selected_index(selected_index); + } + selected_index + }); + self.list_state.scroll_to(ScrollTarget::Show(index)); + cx.notify(); + } + } + + fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let index = delegate.update(cx, |delegate, _| { + let mut selected_index = delegate.selected_index(); + if selected_index > 0 { + selected_index -= 1; + delegate.set_selected_index(selected_index); + } + selected_index + }); + self.list_state.scroll_to(ScrollTarget::Show(index)); + cx.notify(); + } + } + + fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + delegate.update(cx, |delegate, cx| delegate.confirm(cx)); + } + } + + fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + delegate.update(cx, |delegate, cx| delegate.dismiss(cx)); + } + } +} diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index f3f2c31d2cfd5268135570251ed1d0697ca3610c..82368788940d92b24a88bfee73b10e1380bccf74 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -275,9 +275,7 @@ impl FileFinder { fn project_updated(&mut self, _: ModelHandle, cx: &mut ViewContext) { let query = self.query_editor.update(cx, |buffer, cx| buffer.text(cx)); - if let Some(task) = self.spawn_search(query, cx) { - task.detach(); - } + self.spawn_search(query, cx).detach(); } fn on_query_editor_event( @@ -294,9 +292,7 @@ impl FileFinder { self.matches.clear(); cx.notify(); } else { - if let Some(task) = self.spawn_search(query, cx) { - task.detach(); - } + self.spawn_search(query, cx).detach(); } } editor::Event::Blurred => cx.emit(Event::Dismissed), @@ -354,14 +350,13 @@ impl FileFinder { cx.emit(Event::Selected(project_path.clone())); } - #[must_use] - fn spawn_search(&mut self, query: String, cx: &mut ViewContext) -> Option> { + fn spawn_search(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { let search_id = util::post_inc(&mut self.search_count); self.cancel_flag.store(true, atomic::Ordering::Relaxed); self.cancel_flag = Arc::new(AtomicBool::new(false)); let cancel_flag = self.cancel_flag.clone(); let project = self.project.clone(); - Some(cx.spawn(|this, mut cx| async move { + cx.spawn(|this, mut cx| async move { let matches = project .read_with(&cx, |project, cx| { project.match_paths(&query, false, false, 100, cancel_flag.as_ref(), cx) @@ -371,7 +366,7 @@ impl FileFinder { this.update(&mut cx, |this, cx| { this.update_matches((search_id, did_cancel, query, matches), cx) }); - })) + }) } fn update_matches( @@ -514,7 +509,6 @@ mod tests { let query = "hi".to_string(); finder .update(cx, |f, cx| f.spawn_search(query.clone(), cx)) - .unwrap() .await; finder.read_with(cx, |f, _| assert_eq!(f.matches.len(), 5)); @@ -523,7 +517,7 @@ mod tests { // Simulate a search being cancelled after the time limit, // returning only a subset of the matches that would have been found. - finder.spawn_search(query.clone(), cx).unwrap().detach(); + finder.spawn_search(query.clone(), cx).detach(); finder.update_matches( ( finder.latest_search_id, @@ -535,7 +529,7 @@ mod tests { ); // Simulate another cancellation. - finder.spawn_search(query.clone(), cx).unwrap().detach(); + finder.spawn_search(query.clone(), cx).detach(); finder.update_matches( ( finder.latest_search_id, @@ -576,7 +570,6 @@ mod tests { // is included in the matching, because the worktree is a single file. finder .update(cx, |f, cx| f.spawn_search("thf".into(), cx)) - .unwrap() .await; cx.read(|cx| { let finder = finder.read(cx); @@ -594,7 +587,6 @@ mod tests { // not match anything. finder .update(cx, |f, cx| f.spawn_search("thf/".into(), cx)) - .unwrap() .await; finder.read_with(cx, |f, _| assert_eq!(f.matches.len(), 0)); } @@ -633,7 +625,6 @@ mod tests { // Run a search that matches two files with the same relative path. finder .update(cx, |f, cx| f.spawn_search("a.t".into(), cx)) - .unwrap() .await; // Can switch between different matches with the same relative path. diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 9724a6c0944c4d95663f9509c8ef3a482a4a0c17..f8721770820ce73f44fa771c200578e7df30a5fc 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1340,6 +1340,17 @@ impl MutableAppContext { .collect() } + pub fn dispatch_action_at(&mut self, window_id: usize, view_id: usize, action: &dyn Action) { + let presenter = self + .presenters_and_platform_windows + .get(&window_id) + .unwrap() + .0 + .clone(); + let dispatch_path = presenter.borrow().dispatch_path_from(view_id); + self.dispatch_action_any(window_id, &dispatch_path, action); + } + pub fn dispatch_action( &mut self, window_id: usize, diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index 4585e321c442feffd7948bf399d2a08bb0929a63..793f41f48782079cf8008cc896587cbb5a50a5bc 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -51,15 +51,21 @@ impl Presenter { } pub fn dispatch_path(&self, app: &AppContext) -> Vec { + if let Some(view_id) = app.focused_view_id(self.window_id) { + self.dispatch_path_from(view_id) + } else { + Vec::new() + } + } + + pub(crate) fn dispatch_path_from(&self, mut view_id: usize) -> Vec { let mut path = Vec::new(); - if let Some(mut view_id) = app.focused_view_id(self.window_id) { - path.push(view_id); - while let Some(parent_id) = self.parents.get(&view_id).copied() { - path.push(parent_id); - view_id = parent_id; - } - path.reverse(); + path.push(view_id); + while let Some(parent_id) = self.parents.get(&view_id).copied() { + path.push(parent_id); + view_id = parent_id; } + path.reverse(); path } diff --git a/crates/workspace/src/menu.rs b/crates/workspace/src/menu.rs index 33de4a677a3d0503c4dee46243ec1841bbaa449a..81716028b970e56aabcb77b11032ba325b0aaf38 100644 --- a/crates/workspace/src/menu.rs +++ b/crates/workspace/src/menu.rs @@ -1,4 +1,11 @@ gpui::actions!( menu, - [Confirm, SelectPrev, SelectNext, SelectFirst, SelectLast] + [ + Cancel, + Confirm, + SelectPrev, + SelectNext, + SelectFirst, + SelectLast + ] ); diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 05efff0ebd64b397cd707ab3de19ca9e59175325..24a06b9f6744e5a8cad39e122d59f4be6198a403 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -33,6 +33,7 @@ assets = { path = "../assets" } breadcrumbs = { path = "../breadcrumbs" } chat_panel = { path = "../chat_panel" } collections = { path = "../collections" } +command_palette = { path = "../command_palette" } client = { path = "../client" } clock = { path = "../clock" } contacts_panel = { path = "../contacts_panel" } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 41e27eb49425513fc9377642b4af7a4f60eb31dd..cead3ac39040f2371ed8e3d3908820b1bf1d0afb 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -98,6 +98,7 @@ fn main() { project::Project::init(&client); client::Channel::init(&client); client::init(client.clone(), cx); + command_palette::init(cx); workspace::init(&client, cx); editor::init(cx); go_to_line::init(cx); From 3901d9d544496af7752d13a7e6ea8ecfdc185f28 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 13:50:00 -0700 Subject: [PATCH 196/245] Display key bindings in the command palette They still need to be styled. Co-authored-by: Antonio Scandurra --- crates/command_palette/src/command_palette.rs | 91 +++++++++++++++---- crates/gpui/src/app.rs | 16 +++- crates/gpui/src/keymap.rs | 55 +++++++++-- 3 files changed, 132 insertions(+), 30 deletions(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 7e1c2b43b1be72b2d5c9780ab9e599138c0ae501..d8b83ce328a9e74a5bb3ad12d9e3451d17b50f96 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -1,13 +1,13 @@ -use std::cmp; - use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ actions, - elements::{ChildView, Label}, + elements::{ChildView, Flex, Label, ParentElement}, + keymap::Keystroke, Action, Element, Entity, MutableAppContext, View, ViewContext, ViewHandle, }; use selector::{SelectorModal, SelectorModalDelegate}; use settings::Settings; +use std::cmp; use workspace::Workspace; mod selector; @@ -21,7 +21,7 @@ actions!(command_palette, [Toggle]); pub struct CommandPalette { selector: ViewHandle>, - actions: Vec<(&'static str, Box)>, + actions: Vec, matches: Vec, selected_ix: usize, focused_view_id: usize, @@ -31,13 +31,27 @@ pub enum Event { Dismissed, } +struct Command { + name: &'static str, + action: Box, + keystrokes: Vec, + has_multiple_bindings: bool, +} + impl CommandPalette { - pub fn new( - focused_view_id: usize, - actions: Vec<(&'static str, Box)>, - cx: &mut ViewContext, - ) -> Self { + pub fn new(focused_view_id: usize, cx: &mut ViewContext) -> Self { let this = cx.weak_handle(); + let actions = cx + .available_actions(cx.window_id(), focused_view_id) + .map(|(name, action, bindings)| Command { + name, + action, + keystrokes: bindings + .last() + .map_or(Vec::new(), |binding| binding.keystrokes().to_vec()), + has_multiple_bindings: bindings.len() > 1, + }) + .collect(); let selector = cx.add_view(|cx| SelectorModal::new(this, cx)); Self { selector, @@ -54,12 +68,11 @@ impl CommandPalette { let focused_view_id = cx.focused_view_id(window_id).unwrap_or(workspace.id()); cx.as_mut().defer(move |cx| { - let actions = cx.available_actions(window_id, focused_view_id); + let this = cx.add_view(window_id, |cx| Self::new(focused_view_id, cx)); workspace.update(cx, |workspace, cx| { workspace.toggle_modal(cx, |cx, _| { - let selector = cx.add_view(|cx| Self::new(focused_view_id, actions, cx)); - cx.subscribe(&selector, Self::on_event).detach(); - selector + cx.subscribe(&this, Self::on_event).detach(); + this }); }); }); @@ -119,10 +132,10 @@ impl SelectorModalDelegate for CommandPalette { .actions .iter() .enumerate() - .map(|(ix, (name, _))| StringMatchCandidate { + .map(|(ix, command)| StringMatchCandidate { id: ix, - string: name.to_string(), - char_bag: name.chars().collect(), + string: command.name.to_string(), + char_bag: command.name.chars().collect(), }) .collect::>(); cx.spawn(move |this, mut cx| async move { @@ -157,13 +170,15 @@ impl SelectorModalDelegate for CommandPalette { cx.dispatch_action_at( window_id, self.focused_view_id, - self.actions[action_ix].1.as_ref(), + self.actions[action_ix].action.as_ref(), ) } cx.emit(Event::Dismissed); } fn render_match(&self, ix: usize, selected: bool, cx: &gpui::AppContext) -> gpui::ElementBox { + let mat = &self.matches[ix]; + let command = &self.actions[mat.candidate_id]; let settings = cx.global::(); let theme = &settings.theme.selector; let style = if selected { @@ -171,9 +186,49 @@ impl SelectorModalDelegate for CommandPalette { } else { &theme.item }; - Label::new(self.matches[ix].string.clone(), style.label.clone()) + + Flex::row() + .with_child(Label::new(mat.string.clone(), style.label.clone()).boxed()) + .with_children(command.keystrokes.iter().map(|keystroke| { + Flex::row() + .with_children( + [ + (keystroke.ctrl, "^"), + (keystroke.alt, "⎇"), + (keystroke.cmd, "⌘"), + (keystroke.shift, "⇧"), + ] + .into_iter() + .filter_map(|(modifier, label)| { + if modifier { + Some(Label::new(label.into(), style.label.clone()).boxed()) + } else { + None + } + }), + ) + .with_child(Label::new(keystroke.key.clone(), style.label.clone()).boxed()) + .contained() + .with_margin_left(5.0) + .flex_float() + .boxed() + })) + .with_children(if command.has_multiple_bindings { + Some(Label::new("+".into(), style.label.clone()).boxed()) + } else { + None + }) .contained() .with_style(style.container) .boxed() } } + +impl std::fmt::Debug for Command { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Command") + .field("name", &self.name) + .field("keystrokes", &self.keystrokes) + .finish() + } +} diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index f8721770820ce73f44fa771c200578e7df30a5fc..683ea46999297e162ba8fa4228b6b9a917b290c0 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -3,7 +3,7 @@ pub mod action; use crate::{ elements::ElementBox, executor::{self, Task}, - keymap::{self, Keystroke}, + keymap::{self, Binding, Keystroke}, platform::{self, CursorStyle, Platform, PromptLevel, WindowOptions}, presenter::Presenter, util::post_inc, @@ -17,6 +17,7 @@ use lazy_static::lazy_static; use parking_lot::Mutex; use platform::Event; use postage::oneshot; +use smallvec::SmallVec; use smol::prelude::*; use std::{ any::{type_name, Any, TypeId}, @@ -1309,7 +1310,7 @@ impl MutableAppContext { &self, window_id: usize, view_id: usize, - ) -> Vec<(&'static str, Box)> { + ) -> impl Iterator, SmallVec<[&Binding; 1]>)> { let mut action_types: HashSet<_> = self.global_actions.keys().copied().collect(); let presenter = self @@ -1330,14 +1331,19 @@ impl MutableAppContext { self.action_deserializers .iter() - .filter_map(|(name, (type_id, deserialize))| { + .filter_map(move |(name, (type_id, deserialize))| { if action_types.contains(type_id) { - Some((*name, deserialize("{}").ok()?)) + Some(( + *name, + deserialize("{}").ok()?, + self.keystroke_matcher + .bindings_for_action_type(*type_id) + .collect(), + )) } else { None } }) - .collect() } pub fn dispatch_action_at(&mut self, window_id: usize, view_id: usize, action: &dyn Action) { diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 723403f16012641924051ac4dd5d80b61cfbbb6f..c42fbff907061e5e6813da2411477b62a697c28c 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -1,7 +1,8 @@ use crate::Action; use anyhow::{anyhow, Result}; +use smallvec::SmallVec; use std::{ - any::Any, + any::{Any, TypeId}, collections::{HashMap, HashSet}, fmt::Debug, }; @@ -23,7 +24,10 @@ struct Pending { } #[derive(Default)] -pub struct Keymap(Vec); +pub struct Keymap { + bindings: Vec, + binding_indices_by_action_type: HashMap>, +} pub struct Binding { keystrokes: Vec, @@ -111,6 +115,10 @@ impl Matcher { self.keymap.clear(); } + pub fn bindings_for_action_type(&self, action_type: TypeId) -> impl Iterator { + self.keymap.bindings_for_action_type(action_type) + } + pub fn clear_pending(&mut self) { self.pending.clear(); } @@ -132,7 +140,7 @@ impl Matcher { pending.keystrokes.push(keystroke); let mut retain_pending = false; - for binding in self.keymap.0.iter().rev() { + for binding in self.keymap.bindings.iter().rev() { if binding.keystrokes.starts_with(&pending.keystrokes) && binding.context.as_ref().map(|c| c.eval(cx)).unwrap_or(true) { @@ -163,15 +171,44 @@ impl Default for Matcher { impl Keymap { pub fn new(bindings: Vec) -> Self { - Self(bindings) + let mut binding_indices_by_action_type = HashMap::new(); + for (ix, binding) in bindings.iter().enumerate() { + binding_indices_by_action_type + .entry(binding.action.as_any().type_id()) + .or_insert_with(|| SmallVec::new()) + .push(ix); + } + Self { + binding_indices_by_action_type, + bindings, + } + } + + fn bindings_for_action_type<'a>( + &'a self, + action_type: TypeId, + ) -> impl Iterator { + self.binding_indices_by_action_type + .get(&action_type) + .map(SmallVec::as_slice) + .unwrap_or(&[]) + .iter() + .map(|ix| &self.bindings[*ix]) } fn add_bindings>(&mut self, bindings: T) { - self.0.extend(bindings.into_iter()); + for binding in bindings { + self.binding_indices_by_action_type + .entry(binding.action.as_any().type_id()) + .or_default() + .push(self.bindings.len()); + self.bindings.push(binding); + } } fn clear(&mut self) { - self.0.clear(); + self.bindings.clear(); + self.binding_indices_by_action_type.clear(); } } @@ -198,6 +235,10 @@ impl Binding { context, }) } + + pub fn keystrokes(&self) -> &[Keystroke] { + &self.keystrokes + } } impl Keystroke { @@ -446,7 +487,7 @@ mod tests { a: &'static str, } - let keymap = Keymap(vec![ + let keymap = Keymap::new(vec![ Binding::new("a", A("x".to_string()), Some("a")), Binding::new("b", B, Some("a")), Binding::new("a b", Ab, Some("a || b")), From bde52d5c938c2770dbaf026d2e08b11cab50b156 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 16:04:32 -0700 Subject: [PATCH 197/245] Add basic styling to keystrokes in command palette --- assets/themes/dark.json | 23 ++++++++++++++ assets/themes/light.json | 23 ++++++++++++++ crates/command_palette/src/command_palette.rs | 31 +++++++++++-------- crates/theme/src/theme.rs | 9 +++++- styles/src/styleTree/app.ts | 2 ++ styles/src/styleTree/commandPalette.ts | 21 +++++++++++++ styles/src/styleTree/selectorModal.ts | 2 +- 7 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 styles/src/styleTree/commandPalette.ts diff --git a/assets/themes/dark.json b/assets/themes/dark.json index 96f1ee0efc64e9c95536dcbf4086c05663509702..e8a082d2caa021f5fc61ccd455e0facc3a4cd719 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -708,6 +708,29 @@ } } }, + "command_palette": { + "keystroke_spacing": 8, + "key": { + "text": { + "family": "Zed Mono", + "color": "#9c9c9c", + "size": 12 + }, + "corner_radius": 3, + "background": "#2472f2", + "border": { + "color": "#2472f2", + "width": 1 + }, + "padding": { + "left": 3, + "right": 3 + }, + "margin": { + "left": 3 + } + } + }, "project_panel": { "padding": { "top": 6, diff --git a/assets/themes/light.json b/assets/themes/light.json index c942dbb39b99a1b72e1cfea404ce05dab2e3dbad..bf9b287a379d7e75dfd0d08aadaa1cc9ea08a15d 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -708,6 +708,29 @@ } } }, + "command_palette": { + "keystroke_spacing": 8, + "key": { + "text": { + "family": "Zed Mono", + "color": "#474747", + "size": 12 + }, + "corner_radius": 3, + "background": "#c5dafc", + "border": { + "color": "#9ec1fa", + "width": 1 + }, + "padding": { + "left": 3, + "right": 3 + }, + "margin": { + "left": 3 + } + } + }, "project_panel": { "padding": { "top": 6, diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index d8b83ce328a9e74a5bb3ad12d9e3451d17b50f96..b75c54bdf085ce43da3ec8327e2df69668def2b1 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -35,7 +35,6 @@ struct Command { name: &'static str, action: Box, keystrokes: Vec, - has_multiple_bindings: bool, } impl CommandPalette { @@ -49,7 +48,6 @@ impl CommandPalette { keystrokes: bindings .last() .map_or(Vec::new(), |binding| binding.keystrokes().to_vec()), - has_multiple_bindings: bindings.len() > 1, }) .collect(); let selector = cx.add_view(|cx| SelectorModal::new(this, cx)); @@ -180,12 +178,14 @@ impl SelectorModalDelegate for CommandPalette { let mat = &self.matches[ix]; let command = &self.actions[mat.candidate_id]; let settings = cx.global::(); - let theme = &settings.theme.selector; + let theme = &settings.theme; let style = if selected { - &theme.active_item + &theme.selector.active_item } else { - &theme.item + &theme.selector.item }; + let key_style = &theme.command_palette.key; + let keystroke_spacing = theme.command_palette.keystroke_spacing; Flex::row() .with_child(Label::new(mat.string.clone(), style.label.clone()).boxed()) @@ -201,23 +201,28 @@ impl SelectorModalDelegate for CommandPalette { .into_iter() .filter_map(|(modifier, label)| { if modifier { - Some(Label::new(label.into(), style.label.clone()).boxed()) + Some( + Label::new(label.into(), key_style.label.clone()) + .contained() + .with_style(key_style.container) + .boxed(), + ) } else { None } }), ) - .with_child(Label::new(keystroke.key.clone(), style.label.clone()).boxed()) + .with_child( + Label::new(keystroke.key.clone(), key_style.label.clone()) + .contained() + .with_style(key_style.container) + .boxed(), + ) .contained() - .with_margin_left(5.0) + .with_margin_left(keystroke_spacing) .flex_float() .boxed() })) - .with_children(if command.has_multiple_bindings { - Some(Label::new("+".into(), style.label.clone()).boxed()) - } else { - None - }) .contained() .with_style(style.container) .boxed() diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index b3c239b4b9f119159f76a3ed23ec477069c6bbd8..c831738423af54b16dada92589838667dc819938 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -21,6 +21,7 @@ pub struct Theme { pub chat_panel: ChatPanel, pub contacts_panel: ContactsPanel, pub project_panel: ProjectPanel, + pub command_palette: CommandPalette, pub selector: Selector, pub editor: Editor, pub search: Search, @@ -187,6 +188,12 @@ pub struct ProjectPanelEntry { pub icon_spacing: f32, } +#[derive(Debug, Deserialize, Default)] +pub struct CommandPalette { + pub key: ContainedLabel, + pub keystroke_spacing: f32, +} + #[derive(Deserialize, Default)] pub struct ContactsPanel { #[serde(flatten)] @@ -259,7 +266,7 @@ pub struct ContainedText { pub text: TextStyle, } -#[derive(Clone, Deserialize, Default)] +#[derive(Clone, Debug, Deserialize, Default)] pub struct ContainedLabel { #[serde(flatten)] pub container: ContainerStyle, diff --git a/styles/src/styleTree/app.ts b/styles/src/styleTree/app.ts index 03e527d03dec98755e84b789ad016a7aa67a3306..1f98f8ba9c52bbf01e3f61c24175a9e463478b60 100644 --- a/styles/src/styleTree/app.ts +++ b/styles/src/styleTree/app.ts @@ -2,6 +2,7 @@ import Theme from "../themes/theme"; import chatPanel from "./chatPanel"; import { text } from "./components"; import contactsPanel from "./contactsPanel"; +import commandPalette from "./commandPalette"; import editor from "./editor"; import projectPanel from "./projectPanel"; import search from "./search"; @@ -29,6 +30,7 @@ export default function app(theme: Theme): Object { }, }, }, + commandPalette: commandPalette(theme), projectPanel: projectPanel(theme), chatPanel: chatPanel(theme), contactsPanel: contactsPanel(theme), diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/styleTree/commandPalette.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7a0f51f6eb2949914cbda235a571e549c6e8420 --- /dev/null +++ b/styles/src/styleTree/commandPalette.ts @@ -0,0 +1,21 @@ +import Theme from "../themes/theme"; +import { text, backgroundColor, border } from "./components"; + +export default function commandPalette(theme: Theme) { + return { + keystrokeSpacing: 8, + key: { + text: text(theme, "mono", "secondary", { size: "xs" }), + cornerRadius: 3, + background: backgroundColor(theme, "info", "base"), + border: border(theme, "info"), + padding: { + left: 3, + right: 3, + }, + margin: { + left: 3 + }, + } + } +} diff --git a/styles/src/styleTree/selectorModal.ts b/styles/src/styleTree/selectorModal.ts index 90570cc09374290dd842296e96f97ce0127be05d..1bb44a776fb7382b205ce7bd45db85afcd7aab47 100644 --- a/styles/src/styleTree/selectorModal.ts +++ b/styles/src/styleTree/selectorModal.ts @@ -38,7 +38,7 @@ export default function selectorModal(theme: Theme): Object { }, inputEditor: { background: backgroundColor(theme, 500), - corner_radius: 6, + cornerRadius: 6, placeholderText: text(theme, "sans", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), From 7964464e3d465977ac4aeafa684c9b0bd1a0d514 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 16:21:22 -0700 Subject: [PATCH 198/245] Rename SelectorModal -> Picker, put it in its own crate --- Cargo.lock | 16 ++++++++++ crates/command_palette/Cargo.toml | 1 + crates/command_palette/src/command_palette.rs | 12 +++---- crates/picker/Cargo.toml | 23 +++++++++++++ .../src/selector.rs => picker/src/picker.rs} | 32 +++++++++---------- 5 files changed, 61 insertions(+), 23 deletions(-) create mode 100644 crates/picker/Cargo.toml rename crates/{command_palette/src/selector.rs => picker/src/picker.rs} (91%) diff --git a/Cargo.lock b/Cargo.lock index 484dab47d84372d794780e4a8811a18b0da16edb..d501ed4b7e7e6301295b4d916a709cd91677ddd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1152,6 +1152,7 @@ dependencies = [ "env_logger 0.8.3", "fuzzy", "gpui", + "picker", "serde_json", "settings", "theme", @@ -3545,6 +3546,21 @@ dependencies = [ "indexmap", ] +[[package]] +name = "picker" +version = "0.1.0" +dependencies = [ + "ctor", + "editor", + "env_logger 0.8.3", + "gpui", + "serde_json", + "settings", + "theme", + "util", + "workspace", +] + [[package]] name = "pico-args" version = "0.4.0" diff --git a/crates/command_palette/Cargo.toml b/crates/command_palette/Cargo.toml index b360a041254a61956bfb5cb2ea92d22e1ec73ba0..ecff82f6f44a455bc1d58d45c120312e37af31a5 100644 --- a/crates/command_palette/Cargo.toml +++ b/crates/command_palette/Cargo.toml @@ -11,6 +11,7 @@ doctest = false editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } +picker = { path = "../picker" } settings = { path = "../settings" } util = { path = "../util" } theme = { path = "../theme" } diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index b75c54bdf085ce43da3ec8327e2df69668def2b1..18773aaf9c76752032eb5fd0eb60403d435aafa6 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -5,22 +5,20 @@ use gpui::{ keymap::Keystroke, Action, Element, Entity, MutableAppContext, View, ViewContext, ViewHandle, }; -use selector::{SelectorModal, SelectorModalDelegate}; +use picker::{Picker, PickerDelegate}; use settings::Settings; use std::cmp; use workspace::Workspace; -mod selector; - pub fn init(cx: &mut MutableAppContext) { cx.add_action(CommandPalette::toggle); - selector::init::(cx); + Picker::::init(cx); } actions!(command_palette, [Toggle]); pub struct CommandPalette { - selector: ViewHandle>, + selector: ViewHandle>, actions: Vec, matches: Vec, selected_ix: usize, @@ -50,7 +48,7 @@ impl CommandPalette { .map_or(Vec::new(), |binding| binding.keystrokes().to_vec()), }) .collect(); - let selector = cx.add_view(|cx| SelectorModal::new(this, cx)); + let selector = cx.add_view(|cx| Picker::new(this, cx)); Self { selector, actions, @@ -108,7 +106,7 @@ impl View for CommandPalette { } } -impl SelectorModalDelegate for CommandPalette { +impl PickerDelegate for CommandPalette { fn match_count(&self) -> usize { self.matches.len() } diff --git a/crates/picker/Cargo.toml b/crates/picker/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..86e657ecad9073dba73d82e7c6d285b0426e79cb --- /dev/null +++ b/crates/picker/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "picker" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/picker.rs" +doctest = false + +[dependencies] +editor = { path = "../editor" } +gpui = { path = "../gpui" } +settings = { path = "../settings" } +util = { path = "../util" } +theme = { path = "../theme" } +workspace = { path = "../workspace" } + +[dev-dependencies] +gpui = { path = "../gpui", features = ["test-support"] } +serde_json = { version = "1.0.64", features = ["preserve_order"] } +workspace = { path = "../workspace", features = ["test-support"] } +ctor = "0.1" +env_logger = "0.8" diff --git a/crates/command_palette/src/selector.rs b/crates/picker/src/picker.rs similarity index 91% rename from crates/command_palette/src/selector.rs rename to crates/picker/src/picker.rs index daa0f5ff6a1a286d4304ef56272abf3ee9d908ed..797f681d42a97d16a3caebd359a687c04b10f7ea 100644 --- a/crates/command_palette/src/selector.rs +++ b/crates/picker/src/picker.rs @@ -11,22 +11,13 @@ use settings::Settings; use std::cmp; use workspace::menu::{Cancel, Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}; -pub fn init(cx: &mut MutableAppContext) { - cx.add_action(SelectorModal::::select_first); - cx.add_action(SelectorModal::::select_last); - cx.add_action(SelectorModal::::select_next); - cx.add_action(SelectorModal::::select_prev); - cx.add_action(SelectorModal::::confirm); - cx.add_action(SelectorModal::::cancel); -} - -pub struct SelectorModal { +pub struct Picker { delegate: WeakViewHandle, query_editor: ViewHandle, list_state: UniformListState, } -pub trait SelectorModalDelegate: View { +pub trait PickerDelegate: View { fn match_count(&self) -> usize; fn selected_index(&self) -> usize; fn set_selected_index(&mut self, ix: usize); @@ -36,13 +27,13 @@ pub trait SelectorModalDelegate: View { fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox; } -impl Entity for SelectorModal { +impl Entity for Picker { type Event = (); } -impl View for SelectorModal { +impl View for Picker { fn ui_name() -> &'static str { - "SelectorModal" + "Picker" } fn render(&mut self, cx: &mut RenderContext) -> gpui::ElementBox { @@ -66,7 +57,7 @@ impl View for SelectorModal { .with_max_height(420.0) .aligned() .top() - .named("selector") + .named("picker") } fn keymap_context(&self, _: &AppContext) -> keymap::Context { @@ -80,7 +71,16 @@ impl View for SelectorModal { } } -impl SelectorModal { +impl Picker { + pub fn init(cx: &mut MutableAppContext) { + cx.add_action(Self::select_first); + cx.add_action(Self::select_last); + cx.add_action(Self::select_next); + cx.add_action(Self::select_prev); + cx.add_action(Self::confirm); + cx.add_action(Self::cancel); + } + pub fn new(delegate: WeakViewHandle, cx: &mut ViewContext) -> Self { let query_editor = cx.add_view(|cx| { Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) From 7b168608063a5531a3a9fe4211ebf02f06e50dd7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 16:51:14 -0700 Subject: [PATCH 199/245] Use Picker in ThemeSelector --- Cargo.lock | 1 + crates/command_palette/src/command_palette.rs | 12 +- crates/picker/src/picker.rs | 16 +- crates/theme_selector/Cargo.toml | 1 + crates/theme_selector/src/theme_selector.rs | 332 +++++++----------- 5 files changed, 136 insertions(+), 226 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d501ed4b7e7e6301295b4d916a709cd91677ddd2..0b5a802c520978a51b542f63373e51c0d5974ba9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5310,6 +5310,7 @@ dependencies = [ "gpui", "log", "parking_lot", + "picker", "postage", "settings", "smol", diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 18773aaf9c76752032eb5fd0eb60403d435aafa6..ddefe4d8308ce114ac5b0f5da78626b2b1c5d58c 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -18,7 +18,7 @@ pub fn init(cx: &mut MutableAppContext) { actions!(command_palette, [Toggle]); pub struct CommandPalette { - selector: ViewHandle>, + picker: ViewHandle>, actions: Vec, matches: Vec, selected_ix: usize, @@ -48,9 +48,9 @@ impl CommandPalette { .map_or(Vec::new(), |binding| binding.keystrokes().to_vec()), }) .collect(); - let selector = cx.add_view(|cx| Picker::new(this, cx)); + let picker = cx.add_view(|cx| Picker::new(this, cx)); Self { - selector, + picker, actions, matches: vec![], selected_ix: 0, @@ -98,11 +98,11 @@ impl View for CommandPalette { } fn render(&mut self, _: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox { - ChildView::new(self.selector.clone()).boxed() + ChildView::new(self.picker.clone()).boxed() } fn on_focus(&mut self, cx: &mut ViewContext) { - cx.focus(&self.selector); + cx.focus(&self.picker); } } @@ -115,7 +115,7 @@ impl PickerDelegate for CommandPalette { self.selected_ix } - fn set_selected_index(&mut self, ix: usize) { + fn set_selected_index(&mut self, ix: usize, _: &mut ViewContext) { self.selected_ix = ix; } diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 797f681d42a97d16a3caebd359a687c04b10f7ea..913d182aa5f60bdde01afcfd62c7ee6be17363eb 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -20,7 +20,7 @@ pub struct Picker { pub trait PickerDelegate: View { fn match_count(&self) -> usize; fn selected_index(&self) -> usize; - fn set_selected_index(&mut self, ix: usize); + fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext); fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()>; fn confirm(&mut self, cx: &mut ViewContext); fn dismiss(&mut self, cx: &mut ViewContext); @@ -159,7 +159,7 @@ impl Picker { fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = 0; - delegate.update(cx, |delegate, _| delegate.set_selected_index(0)); + delegate.update(cx, |delegate, cx| delegate.set_selected_index(0, cx)); self.list_state.scroll_to(ScrollTarget::Show(index)); cx.notify(); } @@ -167,10 +167,10 @@ impl Picker { fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { - let index = delegate.update(cx, |delegate, _| { + let index = delegate.update(cx, |delegate, cx| { let match_count = delegate.match_count(); let index = if match_count > 0 { match_count - 1 } else { 0 }; - delegate.set_selected_index(index); + delegate.set_selected_index(index, cx); index }); self.list_state.scroll_to(ScrollTarget::Show(index)); @@ -180,11 +180,11 @@ impl Picker { fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { - let index = delegate.update(cx, |delegate, _| { + let index = delegate.update(cx, |delegate, cx| { let mut selected_index = delegate.selected_index(); if selected_index + 1 < delegate.match_count() { selected_index += 1; - delegate.set_selected_index(selected_index); + delegate.set_selected_index(selected_index, cx); } selected_index }); @@ -195,11 +195,11 @@ impl Picker { fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { - let index = delegate.update(cx, |delegate, _| { + let index = delegate.update(cx, |delegate, cx| { let mut selected_index = delegate.selected_index(); if selected_index > 0 { selected_index -= 1; - delegate.set_selected_index(selected_index); + delegate.set_selected_index(selected_index, cx); } selected_index }); diff --git a/crates/theme_selector/Cargo.toml b/crates/theme_selector/Cargo.toml index 9993287c8580b65870e20736c51ea66ca87f90c6..804eff2c7a6cbab7035811391f17ff63ad34a8b8 100644 --- a/crates/theme_selector/Cargo.toml +++ b/crates/theme_selector/Cargo.toml @@ -11,6 +11,7 @@ doctest = false editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } +picker = { path = "../picker" } theme = { path = "../theme" } settings = { path = "../settings" } workspace = { path = "../workspace" } diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index 37099eb510a9b476d59c396dd3b564a6acb581e8..f1e933774f8e0dfab2ff6b65b30fb5bb465432c7 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,35 +1,30 @@ -use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ - actions, elements::*, keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, + actions, elements::*, AppContext, Element, ElementBox, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle, }; +use picker::{Picker, PickerDelegate}; use settings::Settings; -use std::{cmp, sync::Arc}; +use std::sync::Arc; use theme::{Theme, ThemeRegistry}; -use workspace::{ - menu::{Confirm, SelectNext, SelectPrev}, - Workspace, -}; +use workspace::Workspace; pub struct ThemeSelector { - themes: Arc, + registry: Arc, + theme_names: Vec, matches: Vec, - query_editor: ViewHandle, - list_state: UniformListState, - selected_index: usize, original_theme: Arc, + picker: ViewHandle>, selection_completed: bool, + selected_index: usize, } actions!(theme_selector, [Toggle, Reload]); pub fn init(cx: &mut MutableAppContext) { - cx.add_action(ThemeSelector::confirm); - cx.add_action(ThemeSelector::select_prev); - cx.add_action(ThemeSelector::select_next); cx.add_action(ThemeSelector::toggle); cx.add_action(ThemeSelector::reload); + Picker::::init(cx); } pub enum Event { @@ -38,38 +33,38 @@ pub enum Event { impl ThemeSelector { fn new(registry: Arc, cx: &mut ViewContext) -> Self { - let query_editor = cx.add_view(|cx| { - Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) - }); - - cx.subscribe(&query_editor, Self::on_query_editor_event) - .detach(); - + let handle = cx.weak_handle(); + let picker = cx.add_view(|cx| Picker::new(handle, cx)); let original_theme = cx.global::().theme.clone(); - + let theme_names = registry.list().collect::>(); + let matches = theme_names + .iter() + .map(|name| StringMatch { + candidate_id: 0, + score: 0.0, + positions: Default::default(), + string: name.clone(), + }) + .collect(); let mut this = Self { - themes: registry, - query_editor, - matches: Vec::new(), - list_state: Default::default(), - selected_index: 0, // Default index for now + registry, + theme_names, + matches, + picker, original_theme: original_theme.clone(), + selected_index: 0, selection_completed: false, }; - this.update_matches(cx); - - // Set selected index to current theme this.select_if_matching(&original_theme.name); - this } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { let themes = workspace.themes(); workspace.toggle_modal(cx, |cx, _| { - let selector = cx.add_view(|cx| Self::new(themes, cx)); - cx.subscribe(&selector, Self::on_event).detach(); - selector + let this = cx.add_view(|cx| Self::new(themes, cx)); + cx.subscribe(&this, Self::on_event).detach(); + this }); } @@ -88,36 +83,9 @@ impl ThemeSelector { } } - fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { - self.selection_completed = true; - cx.emit(Event::Dismissed); - } - - fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { - if self.selected_index > 0 { - self.selected_index -= 1; - } - self.list_state - .scroll_to(ScrollTarget::Show(self.selected_index)); - - self.show_selected_theme(cx); - cx.notify(); - } - - fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { - if self.selected_index + 1 < self.matches.len() { - self.selected_index += 1; - } - self.list_state - .scroll_to(ScrollTarget::Show(self.selected_index)); - - self.show_selected_theme(cx); - cx.notify(); - } - fn show_selected_theme(&mut self, cx: &mut ViewContext) { if let Some(mat) = self.matches.get(self.selected_index) { - match self.themes.get(&mat.string) { + match self.registry.get(&mat.string) { Ok(theme) => Self::set_theme(theme, cx), Err(error) => { log::error!("error loading theme {}: {}", mat.string, error) @@ -134,49 +102,6 @@ impl ThemeSelector { .unwrap_or(self.selected_index); } - fn update_matches(&mut self, cx: &mut ViewContext) { - let background = cx.background().clone(); - let candidates = self - .themes - .list() - .enumerate() - .map(|(id, name)| StringMatchCandidate { - id, - char_bag: name.as_str().into(), - string: name, - }) - .collect::>(); - let query = self.query_editor.update(cx, |buffer, cx| buffer.text(cx)); - - self.matches = if query.is_empty() { - candidates - .into_iter() - .enumerate() - .map(|(index, candidate)| StringMatch { - candidate_id: index, - string: candidate.string, - positions: Vec::new(), - score: 0.0, - }) - .collect() - } else { - smol::block_on(match_strings( - &candidates, - &query, - false, - 100, - &Default::default(), - background, - )) - }; - - self.selected_index = self - .selected_index - .min(self.matches.len().saturating_sub(1)); - - cx.notify(); - } - fn on_event( workspace: &mut Workspace, _: ViewHandle, @@ -190,89 +115,104 @@ impl ThemeSelector { } } - fn on_query_editor_event( - &mut self, - _: ViewHandle, - event: &editor::Event, - cx: &mut ViewContext, - ) { - match event { - editor::Event::BufferEdited { .. } => { - self.update_matches(cx); - self.select_if_matching(&cx.global::().theme.name); - self.show_selected_theme(cx); - } - editor::Event::Blurred => cx.emit(Event::Dismissed), - _ => {} - } + fn set_theme(theme: Arc, cx: &mut MutableAppContext) { + cx.update_global::(|settings, cx| { + settings.theme = theme; + cx.refresh_windows(); + }); } +} - fn render_matches(&self, cx: &mut RenderContext) -> ElementBox { - if self.matches.is_empty() { - let settings = cx.global::(); - return Container::new( - Label::new( - "No matches".into(), - settings.theme.selector.empty.label.clone(), - ) - .boxed(), - ) - .with_style(settings.theme.selector.empty.container) - .named("empty matches"); +impl PickerDelegate for ThemeSelector { + fn match_count(&self) -> usize { + self.matches.len() + } + + fn confirm(&mut self, cx: &mut ViewContext) { + self.selection_completed = true; + cx.emit(Event::Dismissed); + } + + fn dismiss(&mut self, cx: &mut ViewContext) { + if !self.selection_completed { + Self::set_theme(self.original_theme.clone(), cx); + self.selection_completed = true; } + cx.emit(Event::Dismissed); + } - let handle = cx.handle(); - let list = - UniformList::new( - self.list_state.clone(), - self.matches.len(), - move |mut range, items, cx| { - let cx = cx.as_ref(); - let selector = handle.upgrade(cx).unwrap(); - let selector = selector.read(cx); - let start = range.start; - range.end = cmp::min(range.end, selector.matches.len()); - items.extend(selector.matches[range].iter().enumerate().map( - move |(i, path_match)| selector.render_match(path_match, start + i, cx), - )); - }, - ); + fn selected_index(&self) -> usize { + self.selected_index + } - Container::new(list.boxed()) - .with_margin_top(6.0) - .named("matches") + fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext) { + self.selected_index = ix; + self.show_selected_theme(cx); } - fn render_match(&self, theme_match: &StringMatch, index: usize, cx: &AppContext) -> ElementBox { - let settings = cx.global::(); - let theme = &settings.theme; + fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> gpui::Task<()> { + let background = cx.background().clone(); + let candidates = self + .theme_names + .iter() + .enumerate() + .map(|(id, name)| StringMatchCandidate { + id, + char_bag: name.as_str().into(), + string: name.clone(), + }) + .collect::>(); - let container = Container::new( - Label::new( - theme_match.string.clone(), - if index == self.selected_index { - theme.selector.active_item.label.clone() - } else { - theme.selector.item.label.clone() - }, - ) - .with_highlights(theme_match.positions.clone()) - .boxed(), - ) - .with_style(if index == self.selected_index { - theme.selector.active_item.container - } else { - theme.selector.item.container - }); + cx.spawn(|this, mut cx| async move { + let matches = if query.is_empty() { + candidates + .into_iter() + .enumerate() + .map(|(index, candidate)| StringMatch { + candidate_id: index, + string: candidate.string, + positions: Vec::new(), + score: 0.0, + }) + .collect() + } else { + match_strings( + &candidates, + &query, + false, + 100, + &Default::default(), + background, + ) + .await + }; - container.boxed() + this.update(&mut cx, |this, cx| { + this.matches = matches; + this.selected_index = this + .selected_index + .min(this.matches.len().saturating_sub(1)); + this.show_selected_theme(cx); + cx.notify(); + }); + }) } - fn set_theme(theme: Arc, cx: &mut MutableAppContext) { - cx.update_global::(|settings, cx| { - settings.theme = theme; - cx.refresh_windows(); - }); + fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox { + let settings = cx.global::(); + let theme = &settings.theme; + let theme_match = &self.matches[ix]; + let style = if selected { + &theme.selector.active_item + } else { + &theme.selector.item + }; + + Label::new(theme_match.string.clone(), style.label.clone()) + .with_highlights(theme_match.positions.clone()) + .contained() + .with_style(style.container) + .boxed() } } @@ -291,43 +231,11 @@ impl View for ThemeSelector { "ThemeSelector" } - fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - let theme = cx.global::().theme.clone(); - Align::new( - ConstrainedBox::new( - Container::new( - Flex::new(Axis::Vertical) - .with_child( - ChildView::new(&self.query_editor) - .contained() - .with_style(theme.selector.input_editor.container) - .boxed(), - ) - .with_child( - FlexItem::new(self.render_matches(cx)) - .flex(1., false) - .boxed(), - ) - .boxed(), - ) - .with_style(theme.selector.container) - .boxed(), - ) - .with_max_width(600.0) - .with_max_height(400.0) - .boxed(), - ) - .top() - .named("theme selector") + fn render(&mut self, _: &mut RenderContext) -> ElementBox { + ChildView::new(self.picker.clone()).boxed() } fn on_focus(&mut self, cx: &mut ViewContext) { - cx.focus(&self.query_editor); - } - - fn keymap_context(&self, _: &AppContext) -> keymap::Context { - let mut cx = Self::default_keymap_context(); - cx.set.insert("menu".into()); - cx + cx.focus(&self.picker); } } From c75ffc583cf532309de3ccb82c590639ab41f2b5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 17:35:32 -0700 Subject: [PATCH 200/245] Use Picker in ProjectSymbolsView --- Cargo.lock | 1 + crates/picker/src/picker.rs | 46 ++- crates/project_symbols/Cargo.toml | 1 + crates/project_symbols/src/project_symbols.rs | 331 ++++++------------ 4 files changed, 145 insertions(+), 234 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b5a802c520978a51b542f63373e51c0d5974ba9..ed7c23bab51b76dc8d8787854c6d89bdc825ab30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3794,6 +3794,7 @@ dependencies = [ "fuzzy", "gpui", "ordered-float", + "picker", "postage", "project", "settings", diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 913d182aa5f60bdde01afcfd62c7ee6be17363eb..38bcdeda307fb9f6a541fdd5667124336296e0fb 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -15,6 +15,7 @@ pub struct Picker { delegate: WeakViewHandle, query_editor: ViewHandle, list_state: UniformListState, + update_task: Option>, } pub trait PickerDelegate: View { @@ -87,12 +88,14 @@ impl Picker { }); cx.subscribe(&query_editor, Self::on_query_editor_event) .detach(); - - Self { - delegate, + let mut this = Self { query_editor, list_state: Default::default(), - } + update_task: None, + delegate, + }; + this.update_matches(cx); + this } fn render_matches(&self, cx: &AppContext) -> ElementBox { @@ -137,22 +140,31 @@ impl Picker { event: &editor::Event, cx: &mut ViewContext, ) { - if let Some(delegate) = self.delegate.upgrade(cx) { - match event { - editor::Event::BufferEdited { .. } => { - let query = self.query_editor.read(cx).text(cx); - let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); - cx.spawn(|this, mut cx| async move { - update.await; - this.update(&mut cx, |_, cx| cx.notify()); + match event { + editor::Event::BufferEdited { .. } => self.update_matches(cx), + editor::Event::Blurred => { + if let Some(delegate) = self.delegate.upgrade(cx) { + delegate.update(cx, |delegate, cx| { + delegate.dismiss(cx); }) - .detach(); } - editor::Event::Blurred => delegate.update(cx, |delegate, cx| { - delegate.dismiss(cx); - }), - _ => {} } + _ => {} + } + } + + fn update_matches(&mut self, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let query = self.query_editor.read(cx).text(cx); + let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); + cx.notify(); + self.update_task = Some(cx.spawn(|this, mut cx| async move { + update.await; + this.update(&mut cx, |this, cx| { + cx.notify(); + this.update_task.take(); + }); + })); } } diff --git a/crates/project_symbols/Cargo.toml b/crates/project_symbols/Cargo.toml index de22c0eda027a4a3ec1e0a6c0f0bc4024fb58747..e199b700f6860db74ce2da5c09b7d0474cb84c5c 100644 --- a/crates/project_symbols/Cargo.toml +++ b/crates/project_symbols/Cargo.toml @@ -11,6 +11,7 @@ doctest = false editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } +picker = { path = "../picker" } project = { path = "../project" } text = { path = "../text" } settings = { path = "../settings" } diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index c14f7bea33b70089f3988766e64ea38fe8f1d11e..2c048c4b7e0c6c66c63966712433c6e7e752c14a 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -3,43 +3,32 @@ use editor::{ }; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - actions, elements::*, keymap, AppContext, Axis, Entity, ModelHandle, MutableAppContext, - RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, AppContext, Entity, ModelHandle, MutableAppContext, RenderContext, Task, + View, ViewContext, ViewHandle, }; use ordered_float::OrderedFloat; +use picker::{Picker, PickerDelegate}; use project::{Project, Symbol}; use settings::Settings; -use std::{ - borrow::Cow, - cmp::{self, Reverse}, -}; +use std::{borrow::Cow, cmp::Reverse}; use util::ResultExt; -use workspace::{ - menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}, - Workspace, -}; +use workspace::Workspace; actions!(project_symbols, [Toggle]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(ProjectSymbolsView::toggle); - cx.add_action(ProjectSymbolsView::confirm); - cx.add_action(ProjectSymbolsView::select_prev); - cx.add_action(ProjectSymbolsView::select_next); - cx.add_action(ProjectSymbolsView::select_first); - cx.add_action(ProjectSymbolsView::select_last); + Picker::::init(cx); } pub struct ProjectSymbolsView { - handle: WeakViewHandle, + picker: ViewHandle>, project: ModelHandle, selected_match_index: usize, - list_state: UniformListState, symbols: Vec, match_candidates: Vec, + show_worktree_root_name: bool, matches: Vec, - pending_symbols_task: Task>, - query_editor: ViewHandle, } pub enum Event { @@ -56,59 +45,29 @@ impl View for ProjectSymbolsView { "ProjectSymbolsView" } - fn keymap_context(&self, _: &AppContext) -> keymap::Context { - let mut cx = Self::default_keymap_context(); - cx.set.insert("menu".into()); - cx - } - - fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - let settings = cx.global::(); - Flex::new(Axis::Vertical) - .with_child( - Container::new(ChildView::new(&self.query_editor).boxed()) - .with_style(settings.theme.selector.input_editor.container) - .boxed(), - ) - .with_child( - FlexItem::new(self.render_matches(cx)) - .flex(1., false) - .boxed(), - ) - .contained() - .with_style(settings.theme.selector.container) - .constrained() - .with_max_width(500.0) - .with_max_height(420.0) - .aligned() - .top() - .named("project symbols view") + fn render(&mut self, _: &mut RenderContext) -> ElementBox { + ChildView::new(self.picker.clone()).boxed() } fn on_focus(&mut self, cx: &mut ViewContext) { - cx.focus(&self.query_editor); + cx.focus(&self.picker); } } impl ProjectSymbolsView { fn new(project: ModelHandle, cx: &mut ViewContext) -> Self { - let query_editor = cx.add_view(|cx| { - Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) - }); - cx.subscribe(&query_editor, Self::on_query_editor_event) - .detach(); + let handle = cx.weak_handle(); + let picker = cx.add_view(|cx| Picker::new(handle, cx)); let mut this = Self { - handle: cx.weak_handle(), + picker, project, selected_match_index: 0, - list_state: Default::default(), symbols: Default::default(), match_candidates: Default::default(), matches: Default::default(), - pending_symbols_task: Task::ready(None), - query_editor, + show_worktree_root_name: false, }; - this.update_matches(cx); + this.update_matches(String::new(), cx).detach(); this } @@ -121,72 +80,7 @@ impl ProjectSymbolsView { }); } - fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { - if self.selected_match_index > 0 { - self.select(self.selected_match_index - 1, cx); - } - } - - fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { - if self.selected_match_index + 1 < self.matches.len() { - self.select(self.selected_match_index + 1, cx); - } - } - - fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { - self.select(0, cx); - } - - fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { - self.select(self.matches.len().saturating_sub(1), cx); - } - - fn select(&mut self, index: usize, cx: &mut ViewContext) { - self.selected_match_index = index; - self.list_state.scroll_to(ScrollTarget::Show(index)); - cx.notify(); - } - - fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { - if let Some(symbol) = self - .matches - .get(self.selected_match_index) - .map(|mat| self.symbols[mat.candidate_id].clone()) - { - cx.emit(Event::Selected(symbol)); - } - } - - fn update_matches(&mut self, cx: &mut ViewContext) { - self.filter(cx); - let query = self.query_editor.read(cx).text(cx); - let symbols = self - .project - .update(cx, |project, cx| project.symbols(&query, cx)); - self.pending_symbols_task = cx.spawn_weak(|this, mut cx| async move { - let symbols = symbols.await.log_err()?; - if let Some(this) = this.upgrade(&cx) { - this.update(&mut cx, |this, cx| { - this.match_candidates = symbols - .iter() - .enumerate() - .map(|(id, symbol)| { - StringMatchCandidate::new( - id, - symbol.label.text[symbol.label.filter_range.clone()].to_string(), - ) - }) - .collect(); - this.symbols = symbols; - this.filter(cx); - }); - } - None - }); - } - - fn filter(&mut self, cx: &mut ViewContext) { - let query = self.query_editor.read(cx).text(cx); + fn filter(&mut self, query: &str, cx: &mut ViewContext) { let mut matches = if query.is_empty() { self.match_candidates .iter() @@ -201,7 +95,7 @@ impl ProjectSymbolsView { } else { smol::block_on(fuzzy::match_strings( &self.match_candidates, - &query, + query, false, 100, &Default::default(), @@ -225,57 +119,111 @@ impl ProjectSymbolsView { } self.matches = matches; - self.select_first(&SelectFirst, cx); + self.set_selected_index(0, cx); cx.notify(); } - fn render_matches(&self, cx: &AppContext) -> ElementBox { - if self.matches.is_empty() { - let settings = cx.global::(); - return Container::new( - Label::new( - "No matches".into(), - settings.theme.selector.empty.label.clone(), - ) - .boxed(), - ) - .with_style(settings.theme.selector.empty.container) - .named("empty matches"); + fn on_event( + workspace: &mut Workspace, + _: ViewHandle, + event: &Event, + cx: &mut ViewContext, + ) { + match event { + Event::Dismissed => workspace.dismiss_modal(cx), + Event::Selected(symbol) => { + let buffer = workspace + .project() + .update(cx, |project, cx| project.open_buffer_for_symbol(symbol, cx)); + + let symbol = symbol.clone(); + cx.spawn(|workspace, mut cx| async move { + let buffer = buffer.await?; + workspace.update(&mut cx, |workspace, cx| { + let position = buffer + .read(cx) + .clip_point_utf16(symbol.range.start, Bias::Left); + + let editor = workspace.open_project_item::(buffer, cx); + editor.update(cx, |editor, cx| { + editor.select_ranges( + [position..position], + Some(Autoscroll::Center), + cx, + ); + }); + }); + Ok::<_, anyhow::Error>(()) + }) + .detach_and_log_err(cx); + workspace.dismiss_modal(cx); + } } + } +} - let handle = self.handle.clone(); - let list = UniformList::new( - self.list_state.clone(), - self.matches.len(), - move |mut range, items, cx| { - let cx = cx.as_ref(); - let view = handle.upgrade(cx).unwrap(); - let view = view.read(cx); - let start = range.start; - range.end = cmp::min(range.end, view.matches.len()); +impl PickerDelegate for ProjectSymbolsView { + fn confirm(&mut self, cx: &mut ViewContext) { + if let Some(symbol) = self + .matches + .get(self.selected_match_index) + .map(|mat| self.symbols[mat.candidate_id].clone()) + { + cx.emit(Event::Selected(symbol)); + } + } + + fn dismiss(&mut self, cx: &mut ViewContext) { + cx.emit(Event::Dismissed); + } - let show_worktree_root_name = - view.project.read(cx).visible_worktrees(cx).count() > 1; - items.extend(view.matches[range].iter().enumerate().map(move |(ix, m)| { - view.render_match(m, start + ix, show_worktree_root_name, cx) - })); - }, - ); + fn match_count(&self) -> usize { + self.matches.len() + } - Container::new(list.boxed()) - .with_margin_top(6.0) - .named("matches") + fn selected_index(&self) -> usize { + self.selected_match_index } - fn render_match( - &self, - string_match: &StringMatch, - index: usize, - show_worktree_root_name: bool, - cx: &AppContext, - ) -> ElementBox { + fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext) { + self.selected_match_index = ix; + cx.notify(); + } + + fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { + self.filter(&query, cx); + self.show_worktree_root_name = self.project.read(cx).visible_worktrees(cx).count() > 1; + let symbols = self + .project + .update(cx, |project, cx| project.symbols(&query, cx)); + cx.spawn_weak(|this, mut cx| async move { + let symbols = symbols.await.log_err(); + if let Some(this) = this.upgrade(&cx) { + if let Some(symbols) = symbols { + this.update(&mut cx, |this, cx| { + this.match_candidates = symbols + .iter() + .enumerate() + .map(|(id, symbol)| { + StringMatchCandidate::new( + id, + symbol.label.text[symbol.label.filter_range.clone()] + .to_string(), + ) + }) + .collect(); + this.symbols = symbols; + this.filter(&query, cx); + }); + } + } + }) + } + + fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox { + let string_match = &self.matches[ix]; let settings = cx.global::(); - let style = if index == self.selected_match_index { + let style = if selected { &settings.theme.selector.active_item } else { &settings.theme.selector.item @@ -284,7 +232,7 @@ impl ProjectSymbolsView { let syntax_runs = styled_runs_for_code_label(&symbol.label, &settings.theme.editor.syntax); let mut path = symbol.path.to_string_lossy(); - if show_worktree_root_name { + if self.show_worktree_root_name { let project = self.project.read(cx); if let Some(worktree) = project.worktree_for_id(symbol.worktree_id, cx) { path = Cow::Owned(format!( @@ -317,55 +265,4 @@ impl ProjectSymbolsView { .with_style(style.container) .boxed() } - - fn on_query_editor_event( - &mut self, - _: ViewHandle, - event: &editor::Event, - cx: &mut ViewContext, - ) { - match event { - editor::Event::Blurred => cx.emit(Event::Dismissed), - editor::Event::BufferEdited { .. } => self.update_matches(cx), - _ => {} - } - } - - fn on_event( - workspace: &mut Workspace, - _: ViewHandle, - event: &Event, - cx: &mut ViewContext, - ) { - match event { - Event::Dismissed => workspace.dismiss_modal(cx), - Event::Selected(symbol) => { - let buffer = workspace - .project() - .update(cx, |project, cx| project.open_buffer_for_symbol(symbol, cx)); - - let symbol = symbol.clone(); - cx.spawn(|workspace, mut cx| async move { - let buffer = buffer.await?; - workspace.update(&mut cx, |workspace, cx| { - let position = buffer - .read(cx) - .clip_point_utf16(symbol.range.start, Bias::Left); - - let editor = workspace.open_project_item::(buffer, cx); - editor.update(cx, |editor, cx| { - editor.select_ranges( - [position..position], - Some(Autoscroll::Center), - cx, - ); - }); - }); - Ok::<_, anyhow::Error>(()) - }) - .detach_and_log_err(cx); - workspace.dismiss_modal(cx); - } - } - } } From c7527f92a479fc5642f9799a032a58290250ced6 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 18:16:04 -0700 Subject: [PATCH 201/245] Use Picker in FileFinder --- Cargo.lock | 1 + crates/file_finder/Cargo.toml | 1 + crates/file_finder/src/file_finder.rs | 359 +++++++++----------------- crates/picker/src/picker.rs | 16 +- 4 files changed, 130 insertions(+), 247 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed7c23bab51b76dc8d8787854c6d89bdc825ab30..a2d65dd9a5c5103f441e4b0ff5a5e2cef45a899d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1907,6 +1907,7 @@ dependencies = [ "env_logger 0.8.3", "fuzzy", "gpui", + "picker", "postage", "project", "serde_json", diff --git a/crates/file_finder/Cargo.toml b/crates/file_finder/Cargo.toml index 47dd9b15bc07423c9cb4a86ef493f41ba7bf4c9b..cb85183ef073484c9cec7f3b5f2ad553a53bd992 100644 --- a/crates/file_finder/Cargo.toml +++ b/crates/file_finder/Cargo.toml @@ -11,6 +11,7 @@ doctest = false editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } +picker = { path = "../picker" } project = { path = "../project" } settings = { path = "../settings" } util = { path = "../util" } diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 82368788940d92b24a88bfee73b10e1380bccf74..dd19f61a15f549d9b700a1fa06031104fd29adff 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -1,13 +1,12 @@ -use editor::Editor; use fuzzy::PathMatch; use gpui::{ - actions, elements::*, impl_internal_actions, keymap, AppContext, Axis, Entity, ModelHandle, - MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, impl_internal_actions, AppContext, Entity, ModelHandle, + MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, }; +use picker::{Picker, PickerDelegate}; use project::{Project, ProjectPath, WorktreeId}; use settings::Settings; use std::{ - cmp, path::Path, sync::{ atomic::{self, AtomicBool}, @@ -15,15 +14,11 @@ use std::{ }, }; use util::post_inc; -use workspace::{ - menu::{Confirm, SelectNext, SelectPrev}, - Workspace, -}; +use workspace::Workspace; pub struct FileFinder { - handle: WeakViewHandle, project: ModelHandle, - query_editor: ViewHandle, + picker: ViewHandle>, search_count: usize, latest_search_id: usize, latest_search_did_cancel: bool, @@ -31,7 +26,6 @@ pub struct FileFinder { matches: Vec, selected: Option<(usize, Arc)>, cancel_flag: Arc, - list_state: UniformListState, } #[derive(Clone)] @@ -42,10 +36,7 @@ impl_internal_actions!(file_finder, [Select]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(FileFinder::toggle); - cx.add_action(FileFinder::confirm); - cx.add_action(FileFinder::select); - cx.add_action(FileFinder::select_prev); - cx.add_action(FileFinder::select_next); + Picker::::init(cx); } pub enum Event { @@ -62,140 +53,16 @@ impl View for FileFinder { "FileFinder" } - fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - let settings = cx.global::(); - Align::new( - ConstrainedBox::new( - Container::new( - Flex::new(Axis::Vertical) - .with_child( - ChildView::new(&self.query_editor) - .contained() - .with_style(settings.theme.selector.input_editor.container) - .boxed(), - ) - .with_child( - FlexItem::new(self.render_matches(cx)) - .flex(1., false) - .boxed(), - ) - .boxed(), - ) - .with_style(settings.theme.selector.container) - .boxed(), - ) - .with_max_width(500.0) - .with_max_height(420.0) - .boxed(), - ) - .top() - .named("file finder") + fn render(&mut self, _: &mut RenderContext) -> ElementBox { + ChildView::new(self.picker.clone()).boxed() } fn on_focus(&mut self, cx: &mut ViewContext) { - cx.focus(&self.query_editor); - } - - fn keymap_context(&self, _: &AppContext) -> keymap::Context { - let mut cx = Self::default_keymap_context(); - cx.set.insert("menu".into()); - cx + cx.focus(&self.picker); } } impl FileFinder { - fn render_matches(&self, cx: &AppContext) -> ElementBox { - if self.matches.is_empty() { - let settings = cx.global::(); - return Container::new( - Label::new( - "No matches".into(), - settings.theme.selector.empty.label.clone(), - ) - .boxed(), - ) - .with_style(settings.theme.selector.empty.container) - .named("empty matches"); - } - - let handle = self.handle.clone(); - let list = - UniformList::new( - self.list_state.clone(), - self.matches.len(), - move |mut range, items, cx| { - let cx = cx.as_ref(); - let finder = handle.upgrade(cx).unwrap(); - let finder = finder.read(cx); - let start = range.start; - range.end = cmp::min(range.end, finder.matches.len()); - items.extend(finder.matches[range].iter().enumerate().map( - move |(i, path_match)| finder.render_match(path_match, start + i, cx), - )); - }, - ); - - Container::new(list.boxed()) - .with_margin_top(6.0) - .named("matches") - } - - fn render_match(&self, path_match: &PathMatch, index: usize, cx: &AppContext) -> ElementBox { - let selected_index = self.selected_index(); - let settings = cx.global::(); - let style = if index == selected_index { - &settings.theme.selector.active_item - } else { - &settings.theme.selector.item - }; - let (file_name, file_name_positions, full_path, full_path_positions) = - self.labels_for_match(path_match); - let container = Container::new( - Flex::row() - // .with_child( - // Container::new( - // LineBox::new( - // Svg::new("icons/file-16.svg") - // .with_color(style.label.text.color) - // .boxed(), - // style.label.text.clone(), - // ) - // .boxed(), - // ) - // .with_padding_right(6.0) - // .boxed(), - // ) - .with_child( - Flex::column() - .with_child( - Label::new(file_name.to_string(), style.label.clone()) - .with_highlights(file_name_positions) - .boxed(), - ) - .with_child( - Label::new(full_path, style.label.clone()) - .with_highlights(full_path_positions) - .boxed(), - ) - .flex(1., false) - .boxed(), - ) - .boxed(), - ) - .with_style(style.container); - - let action = Select(ProjectPath { - worktree_id: WorktreeId::from_usize(path_match.worktree_id), - path: path_match.path.clone(), - }); - EventHandler::new(container.boxed()) - .on_mouse_down(move |cx| { - cx.dispatch_action(action.clone()); - true - }) - .named("match") - } - fn labels_for_match(&self, path_match: &PathMatch) -> (String, Vec, String, Vec) { let path_string = path_match.path.to_string_lossy(); let full_path = [path_match.path_prefix.as_ref(), path_string.as_ref()].join(""); @@ -252,16 +119,12 @@ impl FileFinder { pub fn new(project: ModelHandle, cx: &mut ViewContext) -> Self { cx.observe(&project, Self::project_updated).detach(); - let query_editor = cx.add_view(|cx| { - Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) - }); - cx.subscribe(&query_editor, Self::on_query_editor_event) - .detach(); + let handle = cx.weak_handle(); + let picker = cx.add_view(|cx| Picker::new(handle, cx)); Self { - handle: cx.weak_handle(), project, - query_editor, + picker, search_count: 0, latest_search_id: 0, latest_search_did_cancel: false, @@ -269,36 +132,60 @@ impl FileFinder { matches: Vec::new(), selected: None, cancel_flag: Arc::new(AtomicBool::new(false)), - list_state: Default::default(), } } fn project_updated(&mut self, _: ModelHandle, cx: &mut ViewContext) { - let query = self.query_editor.update(cx, |buffer, cx| buffer.text(cx)); - self.spawn_search(query, cx).detach(); + self.spawn_search(self.latest_search_query.clone(), cx) + .detach(); + } + + fn spawn_search(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { + let search_id = util::post_inc(&mut self.search_count); + self.cancel_flag.store(true, atomic::Ordering::Relaxed); + self.cancel_flag = Arc::new(AtomicBool::new(false)); + let cancel_flag = self.cancel_flag.clone(); + let project = self.project.clone(); + cx.spawn(|this, mut cx| async move { + let matches = project + .read_with(&cx, |project, cx| { + project.match_paths(&query, false, false, 100, cancel_flag.as_ref(), cx) + }) + .await; + let did_cancel = cancel_flag.load(atomic::Ordering::Relaxed); + this.update(&mut cx, |this, cx| { + this.set_matches(search_id, did_cancel, query, matches, cx) + }); + }) } - fn on_query_editor_event( + fn set_matches( &mut self, - _: ViewHandle, - event: &editor::Event, + search_id: usize, + did_cancel: bool, + query: String, + matches: Vec, cx: &mut ViewContext, ) { - match event { - editor::Event::BufferEdited { .. } => { - let query = self.query_editor.update(cx, |buffer, cx| buffer.text(cx)); - if query.is_empty() { - self.latest_search_id = post_inc(&mut self.search_count); - self.matches.clear(); - cx.notify(); - } else { - self.spawn_search(query, cx).detach(); - } + if search_id >= self.latest_search_id { + self.latest_search_id = search_id; + if self.latest_search_did_cancel && query == self.latest_search_query { + util::extend_sorted(&mut self.matches, matches.into_iter(), 100, |a, b| b.cmp(a)); + } else { + self.matches = matches; } - editor::Event::Blurred => cx.emit(Event::Dismissed), - _ => {} + self.latest_search_query = query; + self.latest_search_did_cancel = did_cancel; + cx.notify(); + self.picker.update(cx, |_, cx| cx.notify()); } } +} + +impl PickerDelegate for FileFinder { + fn match_count(&self) -> usize { + self.matches.len() + } fn selected_index(&self) -> usize { if let Some(selected) = self.selected.as_ref() { @@ -313,31 +200,24 @@ impl FileFinder { 0 } - fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { - let mut selected_index = self.selected_index(); - if selected_index > 0 { - selected_index -= 1; - let mat = &self.matches[selected_index]; - self.selected = Some((mat.worktree_id, mat.path.clone())); - } - self.list_state - .scroll_to(ScrollTarget::Show(selected_index)); + fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext) { + let mat = &self.matches[ix]; + self.selected = Some((mat.worktree_id, mat.path.clone())); cx.notify(); } - fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { - let mut selected_index = self.selected_index(); - if selected_index + 1 < self.matches.len() { - selected_index += 1; - let mat = &self.matches[selected_index]; - self.selected = Some((mat.worktree_id, mat.path.clone())); + fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { + if query.is_empty() { + self.latest_search_id = post_inc(&mut self.search_count); + self.matches.clear(); + cx.notify(); + Task::ready(()) + } else { + self.spawn_search(query, cx) } - self.list_state - .scroll_to(ScrollTarget::Show(selected_index)); - cx.notify(); } - fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { + fn confirm(&mut self, cx: &mut ViewContext) { if let Some(m) = self.matches.get(self.selected_index()) { cx.emit(Event::Selected(ProjectPath { worktree_id: WorktreeId::from_usize(m.worktree_id), @@ -346,56 +226,57 @@ impl FileFinder { } } - fn select(&mut self, Select(project_path): &Select, cx: &mut ViewContext) { - cx.emit(Event::Selected(project_path.clone())); + fn dismiss(&mut self, cx: &mut ViewContext) { + cx.emit(Event::Dismissed); } - fn spawn_search(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { - let search_id = util::post_inc(&mut self.search_count); - self.cancel_flag.store(true, atomic::Ordering::Relaxed); - self.cancel_flag = Arc::new(AtomicBool::new(false)); - let cancel_flag = self.cancel_flag.clone(); - let project = self.project.clone(); - cx.spawn(|this, mut cx| async move { - let matches = project - .read_with(&cx, |project, cx| { - project.match_paths(&query, false, false, 100, cancel_flag.as_ref(), cx) - }) - .await; - let did_cancel = cancel_flag.load(atomic::Ordering::Relaxed); - this.update(&mut cx, |this, cx| { - this.update_matches((search_id, did_cancel, query, matches), cx) - }); - }) - } + fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox { + let path_match = &self.matches[ix]; + let settings = cx.global::(); + let style = if selected { + &settings.theme.selector.active_item + } else { + &settings.theme.selector.item + }; + let (file_name, file_name_positions, full_path, full_path_positions) = + self.labels_for_match(path_match); + let action = Select(ProjectPath { + worktree_id: WorktreeId::from_usize(path_match.worktree_id), + path: path_match.path.clone(), + }); - fn update_matches( - &mut self, - (search_id, did_cancel, query, matches): (usize, bool, String, Vec), - cx: &mut ViewContext, - ) { - if search_id >= self.latest_search_id { - self.latest_search_id = search_id; - if self.latest_search_did_cancel && query == self.latest_search_query { - util::extend_sorted(&mut self.matches, matches.into_iter(), 100, |a, b| b.cmp(a)); - } else { - self.matches = matches; - } - self.latest_search_query = query; - self.latest_search_did_cancel = did_cancel; - self.list_state - .scroll_to(ScrollTarget::Show(self.selected_index())); - cx.notify(); - } + EventHandler::new( + Flex::column() + .with_child( + Label::new(file_name.to_string(), style.label.clone()) + .with_highlights(file_name_positions) + .boxed(), + ) + .with_child( + Label::new(full_path, style.label.clone()) + .with_highlights(full_path_positions) + .boxed(), + ) + .flex(1., false) + .contained() + .with_style(style.container) + .boxed(), + ) + .on_mouse_down(move |cx| { + cx.dispatch_action(action.clone()); + true + }) + .named("match") } } #[cfg(test)] mod tests { use super::*; - use editor::Input; + use editor::{Editor, Input}; use serde_json::json; use std::path::PathBuf; + use workspace::menu::{Confirm, SelectNext}; use workspace::{Workspace, WorkspaceParams}; #[ctor::ctor] @@ -518,25 +399,21 @@ mod tests { // Simulate a search being cancelled after the time limit, // returning only a subset of the matches that would have been found. finder.spawn_search(query.clone(), cx).detach(); - finder.update_matches( - ( - finder.latest_search_id, - true, // did-cancel - query.clone(), - vec![matches[1].clone(), matches[3].clone()], - ), + finder.set_matches( + finder.latest_search_id, + true, // did-cancel + query.clone(), + vec![matches[1].clone(), matches[3].clone()], cx, ); // Simulate another cancellation. finder.spawn_search(query.clone(), cx).detach(); - finder.update_matches( - ( - finder.latest_search_id, - true, // did-cancel - query.clone(), - vec![matches[0].clone(), matches[2].clone(), matches[3].clone()], - ), + finder.set_matches( + finder.latest_search_id, + true, // did-cancel + query.clone(), + vec![matches[0].clone(), matches[2].clone(), matches[3].clone()], cx, ); @@ -631,9 +508,9 @@ mod tests { finder.update(cx, |f, cx| { assert_eq!(f.matches.len(), 2); assert_eq!(f.selected_index(), 0); - f.select_next(&SelectNext, cx); + f.set_selected_index(1, cx); assert_eq!(f.selected_index(), 1); - f.select_prev(&SelectPrev, cx); + f.set_selected_index(0, cx); assert_eq!(f.selected_index(), 0); }); } diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 38bcdeda307fb9f6a541fdd5667124336296e0fb..d21bff3945666e06f0a6cd41cd5b5894e99a2ea8 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -161,14 +161,18 @@ impl Picker { self.update_task = Some(cx.spawn(|this, mut cx| async move { update.await; this.update(&mut cx, |this, cx| { - cx.notify(); - this.update_task.take(); + if let Some(delegate) = this.delegate.upgrade(cx) { + let index = delegate.read(cx).selected_index(); + this.list_state.scroll_to(ScrollTarget::Show(index)); + cx.notify(); + this.update_task.take(); + } }); })); } } - fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { + pub fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = 0; delegate.update(cx, |delegate, cx| delegate.set_selected_index(0, cx)); @@ -177,7 +181,7 @@ impl Picker { } } - fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { + pub fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = delegate.update(cx, |delegate, cx| { let match_count = delegate.match_count(); @@ -190,7 +194,7 @@ impl Picker { } } - fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { + pub fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = delegate.update(cx, |delegate, cx| { let mut selected_index = delegate.selected_index(); @@ -205,7 +209,7 @@ impl Picker { } } - fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { + pub fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = delegate.update(cx, |delegate, cx| { let mut selected_index = delegate.selected_index(); From 20657566b3dfa3d33dad60e72ef326917857b232 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 14 Apr 2022 18:28:26 -0700 Subject: [PATCH 202/245] Make all pickers respect mouse clicks --- crates/file_finder/src/file_finder.rs | 50 +++++++++------------------ crates/picker/src/picker.rs | 26 ++++++++++++-- crates/workspace/src/menu.rs | 5 +++ 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index dd19f61a15f549d9b700a1fa06031104fd29adff..755ba3dd76061a9f3cb94c4ced2b8efe4c51cc00 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -1,7 +1,7 @@ use fuzzy::PathMatch; use gpui::{ - actions, elements::*, impl_internal_actions, AppContext, Entity, ModelHandle, - MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, + actions, elements::*, AppContext, Entity, ModelHandle, MutableAppContext, RenderContext, Task, + View, ViewContext, ViewHandle, }; use picker::{Picker, PickerDelegate}; use project::{Project, ProjectPath, WorktreeId}; @@ -28,11 +28,7 @@ pub struct FileFinder { cancel_flag: Arc, } -#[derive(Clone)] -pub struct Select(pub ProjectPath); - actions!(file_finder, [Toggle]); -impl_internal_actions!(file_finder, [Select]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(FileFinder::toggle); @@ -240,33 +236,21 @@ impl PickerDelegate for FileFinder { }; let (file_name, file_name_positions, full_path, full_path_positions) = self.labels_for_match(path_match); - let action = Select(ProjectPath { - worktree_id: WorktreeId::from_usize(path_match.worktree_id), - path: path_match.path.clone(), - }); - - EventHandler::new( - Flex::column() - .with_child( - Label::new(file_name.to_string(), style.label.clone()) - .with_highlights(file_name_positions) - .boxed(), - ) - .with_child( - Label::new(full_path, style.label.clone()) - .with_highlights(full_path_positions) - .boxed(), - ) - .flex(1., false) - .contained() - .with_style(style.container) - .boxed(), - ) - .on_mouse_down(move |cx| { - cx.dispatch_action(action.clone()); - true - }) - .named("match") + Flex::column() + .with_child( + Label::new(file_name.to_string(), style.label.clone()) + .with_highlights(file_name_positions) + .boxed(), + ) + .with_child( + Label::new(full_path, style.label.clone()) + .with_highlights(full_path_positions) + .boxed(), + ) + .flex(1., false) + .contained() + .with_style(style.container) + .named("match") } } diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index d21bff3945666e06f0a6cd41cd5b5894e99a2ea8..9feb944e3adb74e2e9f6bc06e34fc1e981340565 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -1,7 +1,7 @@ use editor::Editor; use gpui::{ elements::{ - ChildView, Flex, FlexItem, Label, ParentElement, ScrollTarget, UniformList, + ChildView, EventHandler, Flex, FlexItem, Label, ParentElement, ScrollTarget, UniformList, UniformListState, }, keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, Task, @@ -9,7 +9,9 @@ use gpui::{ }; use settings::Settings; use std::cmp; -use workspace::menu::{Cancel, Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}; +use workspace::menu::{ + Cancel, Confirm, SelectFirst, SelectIndex, SelectLast, SelectNext, SelectPrev, +}; pub struct Picker { delegate: WeakViewHandle, @@ -78,6 +80,7 @@ impl Picker { cx.add_action(Self::select_last); cx.add_action(Self::select_next); cx.add_action(Self::select_prev); + cx.add_action(Self::select_index); cx.add_action(Self::confirm); cx.add_action(Self::cancel); } @@ -126,7 +129,14 @@ impl Picker { let delegate = delegate.read(cx); let selected_ix = delegate.selected_index(); range.end = cmp::min(range.end, delegate.match_count()); - items.extend(range.map(move |ix| delegate.render_match(ix, ix == selected_ix, cx))); + items.extend(range.map(move |ix| { + EventHandler::new(delegate.render_match(ix, ix == selected_ix, cx)) + .on_mouse_down(move |cx| { + cx.dispatch_action(SelectIndex(ix)); + true + }) + .boxed() + })); }, ) .contained() @@ -181,6 +191,16 @@ impl Picker { } } + pub fn select_index(&mut self, action: &SelectIndex, cx: &mut ViewContext) { + if let Some(delegate) = self.delegate.upgrade(cx) { + let index = action.0; + delegate.update(cx, |delegate, cx| { + delegate.set_selected_index(index, cx); + delegate.confirm(cx); + }); + } + } + pub fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = delegate.update(cx, |delegate, cx| { diff --git a/crates/workspace/src/menu.rs b/crates/workspace/src/menu.rs index 81716028b970e56aabcb77b11032ba325b0aaf38..c37ad530bbfb13d0b2c9cc18e50b7f6ff62e1369 100644 --- a/crates/workspace/src/menu.rs +++ b/crates/workspace/src/menu.rs @@ -1,3 +1,6 @@ +#[derive(Clone)] +pub struct SelectIndex(pub usize); + gpui::actions!( menu, [ @@ -9,3 +12,5 @@ gpui::actions!( SelectLast ] ); + +gpui::impl_internal_actions!(menu, [SelectIndex]); From d0413ac0e1e9f7c333ab012b7f3dd7cb1408de45 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Apr 2022 10:48:01 -0700 Subject: [PATCH 203/245] Fix crash when dropping a task that is awaiting a call to Background::scoped Co-authored-by: Keith Simmons --- crates/gpui/src/executor.rs | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/crates/gpui/src/executor.rs b/crates/gpui/src/executor.rs index 2c3a8df8a1468a127589bef5ea8f12ec427b8e28..6d8e946f589a44f521b71596501b4a23ab5d59a6 100644 --- a/crates/gpui/src/executor.rs +++ b/crates/gpui/src/executor.rs @@ -8,7 +8,7 @@ use std::{ mem, pin::Pin, rc::Rc, - sync::Arc, + sync::{mpsc, Arc}, task::{Context, Poll}, thread, time::Duration, @@ -625,13 +625,9 @@ impl Background { where F: FnOnce(&mut Scope<'scope>), { - let mut scope = Scope { - futures: Default::default(), - _phantom: PhantomData, - }; + let mut scope = Scope::new(); (scheduler)(&mut scope); - let spawned = scope - .futures + let spawned = mem::take(&mut scope.futures) .into_iter() .map(|f| self.spawn(f)) .collect::>(); @@ -669,24 +665,53 @@ impl Background { pub struct Scope<'a> { futures: Vec + Send + 'static>>>, + tx: Option>, + rx: mpsc::Receiver<()>, _phantom: PhantomData<&'a ()>, } impl<'a> Scope<'a> { + fn new() -> Self { + let (tx, rx) = mpsc::channel(); + Self { + tx: Some(tx), + rx, + futures: Default::default(), + _phantom: PhantomData, + } + } + pub fn spawn(&mut self, f: F) where F: Future + Send + 'a, { + let tx = self.tx.clone().unwrap(); + + // Safety: The 'a lifetime is guaranteed to outlive any of these futures because + // dropping this `Scope` blocks until all of the futures have resolved. let f = unsafe { mem::transmute::< Pin + Send + 'a>>, Pin + Send + 'static>>, - >(Box::pin(f)) + >(Box::pin(async move { + f.await; + drop(tx); + })) }; self.futures.push(f); } } +impl<'a> Drop for Scope<'a> { + fn drop(&mut self) { + self.tx.take().unwrap(); + + // Wait until the channel is closed, which means that all of the spawned + // futures have resolved. + self.rx.recv().ok(); + } +} + impl Task { pub fn ready(value: T) -> Self { Self::Ready(Some(value)) From df0b5779a8c50ed071840118700fc48d0d547281 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Apr 2022 10:51:26 -0700 Subject: [PATCH 204/245] Remove unused crossbeam-channel dependency in zed crate Co-authored-by: Keith Simmons --- Cargo.lock | 1 - crates/zed/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2d65dd9a5c5103f441e4b0ff5a5e2cef45a899d..72fefd90ec51e147f8566ef345d736eebf06b2a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6175,7 +6175,6 @@ dependencies = [ "collections", "command_palette", "contacts_panel", - "crossbeam-channel", "ctor", "diagnostics", "dirs 3.0.1", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 24a06b9f6744e5a8cad39e122d59f4be6198a403..7411b53441ab7d5c48c934c3c7892add8652e1c5 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -65,7 +65,6 @@ anyhow = "1.0.38" async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] } async-recursion = "0.3" async-trait = "0.1" -crossbeam-channel = "0.5.0" ctor = "0.1.20" dirs = "3.0" easy-parallel = "3.1.0" From c56e2ead23128c427d7e4ac62d3755625227df69 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Apr 2022 13:25:21 -0700 Subject: [PATCH 205/245] Fix hang when dropping ::scoped future under deterministic executor Co-authored-by: Nathan Sobo Co-authored-by: Keith Simmons --- crates/gpui/src/executor.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/gpui/src/executor.rs b/crates/gpui/src/executor.rs index 6d8e946f589a44f521b71596501b4a23ab5d59a6..24ab663071b4c47da2468763d41994e9068ea2b2 100644 --- a/crates/gpui/src/executor.rs +++ b/crates/gpui/src/executor.rs @@ -1,5 +1,6 @@ use anyhow::{anyhow, Result}; use async_task::Runnable; +use futures::channel::mpsc; use smol::{channel, prelude::*, Executor}; use std::{ any::Any, @@ -8,7 +9,7 @@ use std::{ mem, pin::Pin, rc::Rc, - sync::{mpsc, Arc}, + sync::Arc, task::{Context, Poll}, thread, time::Duration, @@ -621,11 +622,11 @@ impl Background { Err(async { *future.await.downcast().unwrap() }) } - pub async fn scoped<'scope, F>(&self, scheduler: F) + pub async fn scoped<'scope, F>(self: &Arc, scheduler: F) where F: FnOnce(&mut Scope<'scope>), { - let mut scope = Scope::new(); + let mut scope = Scope::new(self.clone()); (scheduler)(&mut scope); let spawned = mem::take(&mut scope.futures) .into_iter() @@ -664,6 +665,7 @@ impl Background { } pub struct Scope<'a> { + executor: Arc, futures: Vec + Send + 'static>>>, tx: Option>, rx: mpsc::Receiver<()>, @@ -671,9 +673,10 @@ pub struct Scope<'a> { } impl<'a> Scope<'a> { - fn new() -> Self { - let (tx, rx) = mpsc::channel(); + fn new(executor: Arc) -> Self { + let (tx, rx) = mpsc::channel(1); Self { + executor, tx: Some(tx), rx, futures: Default::default(), @@ -708,7 +711,7 @@ impl<'a> Drop for Scope<'a> { // Wait until the channel is closed, which means that all of the spawned // futures have resolved. - self.rx.recv().ok(); + self.executor.block(self.rx.next()); } } From 3bbc021a7eee040e415923a6ac2211df3f7e32c2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Apr 2022 14:28:01 -0700 Subject: [PATCH 206/245] Use Picker in Outline view --- Cargo.lock | 1 + assets/keymaps/default.json | 12 - crates/file_finder/src/file_finder.rs | 7 +- crates/outline/Cargo.toml | 1 + crates/outline/src/outline.rs | 224 +++++------------- crates/picker/src/picker.rs | 112 +++++---- crates/project_symbols/src/project_symbols.rs | 9 +- 7 files changed, 130 insertions(+), 236 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 72fefd90ec51e147f8566ef345d736eebf06b2a0..0a4540ba39db3a6110d5bfcbb749de3bd201bc2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3374,6 +3374,7 @@ dependencies = [ "gpui", "language", "ordered-float", + "picker", "postage", "settings", "smol", diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index e517f853d5c66f70c2c811885c08e091bc9f946b..506dd362d4c3ec8262ac472aa0321951a3a96ef3 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -250,22 +250,10 @@ "\n" ] }, - "OutlineView": { - "escape": "outline::Toggle" - }, - "ProjectSymbolsView": { - "escape": "project_symbols::Toggle" - }, - "ThemeSelector": { - "escape": "theme_selector::Toggle" - }, "GoToLine": { "escape": "go_to_line::Toggle", "enter": "go_to_line::Confirm" }, - "FileFinder": { - "escape": "file_finder::Toggle" - }, "ChatPanel": { "enter": "chat_panel::Send" }, diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 755ba3dd76061a9f3cb94c4ced2b8efe4c51cc00..9877cef3d80e8d4fa47fb1ddbbf4059ef1e93b46 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -113,14 +113,11 @@ impl FileFinder { } pub fn new(project: ModelHandle, cx: &mut ViewContext) -> Self { - cx.observe(&project, Self::project_updated).detach(); - let handle = cx.weak_handle(); - let picker = cx.add_view(|cx| Picker::new(handle, cx)); - + cx.observe(&project, Self::project_updated).detach(); Self { project, - picker, + picker: cx.add_view(|cx| Picker::new(handle, cx)), search_count: 0, latest_search_id: 0, latest_search_did_cancel: false, diff --git a/crates/outline/Cargo.toml b/crates/outline/Cargo.toml index fc9444a14c705b9fdd6aeb5a1bb1b8b0f6e6c851..5b4751e620485b81931099cd980d4e2a35524d92 100644 --- a/crates/outline/Cargo.toml +++ b/crates/outline/Cargo.toml @@ -12,6 +12,7 @@ editor = { path = "../editor" } fuzzy = { path = "../fuzzy" } gpui = { path = "../gpui" } language = { path = "../language" } +picker = { path = "../picker" } settings = { path = "../settings" } text = { path = "../text" } workspace = { path = "../workspace" } diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 08bc18a016a62f72d3aaf4b60c7aff33bb4cbfde..a5492a8f69214e7447485d2442871ed8b5c3d33d 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -4,38 +4,31 @@ use editor::{ }; use fuzzy::StringMatch; use gpui::{ - actions, elements::*, geometry::vector::Vector2F, keymap, AppContext, Axis, Entity, - MutableAppContext, RenderContext, View, ViewContext, ViewHandle, WeakViewHandle, + actions, elements::*, geometry::vector::Vector2F, AppContext, Entity, MutableAppContext, + RenderContext, Task, View, ViewContext, ViewHandle, }; use language::Outline; use ordered_float::OrderedFloat; +use picker::{Picker, PickerDelegate}; use settings::Settings; use std::cmp::{self, Reverse}; -use workspace::{ - menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}, - Workspace, -}; +use workspace::Workspace; actions!(outline, [Toggle]); pub fn init(cx: &mut MutableAppContext) { cx.add_action(OutlineView::toggle); - cx.add_action(OutlineView::confirm); - cx.add_action(OutlineView::select_prev); - cx.add_action(OutlineView::select_next); - cx.add_action(OutlineView::select_first); - cx.add_action(OutlineView::select_last); + Picker::::init(cx); } struct OutlineView { - handle: WeakViewHandle, + picker: ViewHandle>, active_editor: ViewHandle, outline: Outline, selected_match_index: usize, prev_scroll_position: Option, matches: Vec, - query_editor: ViewHandle, - list_state: UniformListState, + last_query: String, } pub enum Event { @@ -55,38 +48,12 @@ impl View for OutlineView { "OutlineView" } - fn keymap_context(&self, _: &AppContext) -> keymap::Context { - let mut cx = Self::default_keymap_context(); - cx.set.insert("menu".into()); - cx - } - - fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - let settings = cx.global::(); - - Flex::new(Axis::Vertical) - .with_child( - Container::new(ChildView::new(&self.query_editor).boxed()) - .with_style(settings.theme.selector.input_editor.container) - .boxed(), - ) - .with_child( - FlexItem::new(self.render_matches(cx)) - .flex(1.0, false) - .boxed(), - ) - .contained() - .with_style(settings.theme.selector.container) - .constrained() - .with_max_width(800.0) - .with_max_height(1200.0) - .aligned() - .top() - .named("outline view") + fn render(&mut self, _: &mut RenderContext) -> ElementBox { + ChildView::new(self.picker.clone()).boxed() } fn on_focus(&mut self, cx: &mut ViewContext) { - cx.focus(&self.query_editor); + cx.focus(&self.picker); } } @@ -96,24 +63,16 @@ impl OutlineView { editor: ViewHandle, cx: &mut ViewContext, ) -> Self { - let query_editor = cx.add_view(|cx| { - Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx) - }); - cx.subscribe(&query_editor, Self::on_query_editor_event) - .detach(); - - let mut this = Self { - handle: cx.weak_handle(), + let handle = cx.weak_handle(); + Self { + picker: cx.add_view(|cx| Picker::new(handle, cx).with_max_size(800., 1200.)), + last_query: Default::default(), matches: Default::default(), selected_match_index: 0, prev_scroll_position: Some(editor.update(cx, |editor, cx| editor.scroll_position(cx))), active_editor: editor, outline, - query_editor, - list_state: Default::default(), - }; - this.update_matches(cx); - this + } } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { @@ -137,34 +96,18 @@ impl OutlineView { } } - fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext) { - if self.selected_match_index > 0 { - self.select(self.selected_match_index - 1, true, false, cx); - } - } - - fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext) { - if self.selected_match_index + 1 < self.matches.len() { - self.select(self.selected_match_index + 1, true, false, cx); - } - } - - fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext) { - self.select(0, true, false, cx); - } - - fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext) { - self.select(self.matches.len().saturating_sub(1), true, false, cx); + fn restore_active_editor(&mut self, cx: &mut MutableAppContext) { + self.active_editor.update(cx, |editor, cx| { + editor.highlight_rows(None); + if let Some(scroll_position) = self.prev_scroll_position { + editor.set_scroll_position(scroll_position, cx); + } + }) } - fn select(&mut self, index: usize, navigate: bool, center: bool, cx: &mut ViewContext) { - self.selected_match_index = index; - self.list_state.scroll_to(if center { - ScrollTarget::Center(index) - } else { - ScrollTarget::Show(index) - }); - if navigate { + fn set_selected_index(&mut self, ix: usize, navigate: bool, cx: &mut ViewContext) { + self.selected_match_index = ix; + if navigate && !self.matches.is_empty() { let selected_match = &self.matches[self.selected_match_index]; let outline_item = &self.outline.items[selected_match.candidate_id]; self.active_editor.update(cx, |active_editor, cx| { @@ -181,27 +124,6 @@ impl OutlineView { cx.notify(); } - fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { - self.prev_scroll_position.take(); - self.active_editor.update(cx, |active_editor, cx| { - if let Some(rows) = active_editor.highlighted_rows() { - let snapshot = active_editor.snapshot(cx).display_snapshot; - let position = DisplayPoint::new(rows.start, 0).to_point(&snapshot); - active_editor.select_ranges([position..position], Some(Autoscroll::Center), cx); - } - }); - cx.emit(Event::Dismissed); - } - - fn restore_active_editor(&mut self, cx: &mut MutableAppContext) { - self.active_editor.update(cx, |editor, cx| { - editor.highlight_rows(None); - if let Some(scroll_position) = self.prev_scroll_position { - editor.set_scroll_position(scroll_position, cx); - } - }) - } - fn on_event( workspace: &mut Workspace, _: ViewHandle, @@ -212,24 +134,27 @@ impl OutlineView { Event::Dismissed => workspace.dismiss_modal(cx), } } +} - fn on_query_editor_event( - &mut self, - _: ViewHandle, - event: &editor::Event, - cx: &mut ViewContext, - ) { - match event { - editor::Event::Blurred => cx.emit(Event::Dismissed), - editor::Event::BufferEdited { .. } => self.update_matches(cx), - _ => {} - } +impl PickerDelegate for OutlineView { + fn match_count(&self) -> usize { + self.matches.len() + } + + fn selected_index(&self) -> usize { + self.selected_match_index } - fn update_matches(&mut self, cx: &mut ViewContext) { + fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext) { + self.set_selected_index(ix, true, cx); + } + + fn center_selection_after_match_updates(&self) -> bool { + true + } + + fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { let selected_index; - let navigate_to_selected_index; - let query = self.query_editor.update(cx, |buffer, cx| buffer.text(cx)); if query.is_empty() { self.restore_active_editor(cx); self.matches = self @@ -271,7 +196,6 @@ impl OutlineView { .max_by_key(|(_, depth, distance)| (*depth, Reverse(*distance))) .map(|(ix, _, _)| ix) .unwrap_or(0); - navigate_to_selected_index = false; } else { self.matches = smol::block_on(self.outline.search(&query, cx.background().clone())); selected_index = self @@ -281,57 +205,33 @@ impl OutlineView { .max_by_key(|(_, m)| OrderedFloat(m.score)) .map(|(ix, _)| ix) .unwrap_or(0); - navigate_to_selected_index = !self.matches.is_empty(); } - self.select(selected_index, navigate_to_selected_index, true, cx); + self.last_query = query; + self.set_selected_index(selected_index, false, cx); + Task::ready(()) } - fn render_matches(&self, cx: &AppContext) -> ElementBox { - if self.matches.is_empty() { - let settings = cx.global::(); - return Container::new( - Label::new( - "No matches".into(), - settings.theme.selector.empty.label.clone(), - ) - .boxed(), - ) - .with_style(settings.theme.selector.empty.container) - .named("empty matches"); - } - - let handle = self.handle.clone(); - let list = UniformList::new( - self.list_state.clone(), - self.matches.len(), - move |mut range, items, cx| { - let cx = cx.as_ref(); - let view = handle.upgrade(cx).unwrap(); - let view = view.read(cx); - let start = range.start; - range.end = cmp::min(range.end, view.matches.len()); - items.extend( - view.matches[range] - .iter() - .enumerate() - .map(move |(ix, m)| view.render_match(m, start + ix, cx)), - ); - }, - ); + fn confirm(&mut self, cx: &mut ViewContext) { + self.prev_scroll_position.take(); + self.active_editor.update(cx, |active_editor, cx| { + if let Some(rows) = active_editor.highlighted_rows() { + let snapshot = active_editor.snapshot(cx).display_snapshot; + let position = DisplayPoint::new(rows.start, 0).to_point(&snapshot); + active_editor.select_ranges([position..position], Some(Autoscroll::Center), cx); + } + }); + cx.emit(Event::Dismissed); + } - Container::new(list.boxed()) - .with_margin_top(6.0) - .named("matches") + fn dismiss(&mut self, cx: &mut ViewContext) { + self.restore_active_editor(cx); + cx.emit(Event::Dismissed); } - fn render_match( - &self, - string_match: &StringMatch, - index: usize, - cx: &AppContext, - ) -> ElementBox { + fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox { let settings = cx.global::(); - let style = if index == self.selected_match_index { + let string_match = &self.matches[ix]; + let style = if selected { &settings.theme.selector.active_item } else { &settings.theme.selector.item diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 9feb944e3adb74e2e9f6bc06e34fc1e981340565..76b9d99d29e1f2c679e091140a0c33db2e2791c2 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -1,9 +1,10 @@ use editor::Editor; use gpui::{ elements::{ - ChildView, EventHandler, Flex, FlexItem, Label, ParentElement, ScrollTarget, UniformList, + ChildView, EventHandler, Flex, Label, ParentElement, ScrollTarget, UniformList, UniformListState, }, + geometry::vector::{vec2f, Vector2F}, keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, }; @@ -18,6 +19,7 @@ pub struct Picker { query_editor: ViewHandle, list_state: UniformListState, update_task: Option>, + max_size: Vector2F, } pub trait PickerDelegate: View { @@ -28,6 +30,9 @@ pub trait PickerDelegate: View { fn confirm(&mut self, cx: &mut ViewContext); fn dismiss(&mut self, cx: &mut ViewContext); fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox; + fn center_selection_after_match_updates(&self) -> bool { + false + } } impl Entity for Picker { @@ -41,6 +46,13 @@ impl View for Picker { fn render(&mut self, cx: &mut RenderContext) -> gpui::ElementBox { let settings = cx.global::(); + let delegate = self.delegate.clone(); + let match_count = if let Some(delegate) = delegate.upgrade(cx.app) { + delegate.read(cx).match_count() + } else { + 0 + }; + Flex::new(Axis::Vertical) .with_child( ChildView::new(&self.query_editor) @@ -49,15 +61,44 @@ impl View for Picker { .boxed(), ) .with_child( - FlexItem::new(self.render_matches(cx)) - .flex(1., false) - .boxed(), + if match_count == 0 { + Label::new( + "No matches".into(), + settings.theme.selector.empty.label.clone(), + ) + .contained() + .with_style(settings.theme.selector.empty.container) + } else { + UniformList::new( + self.list_state.clone(), + match_count, + move |mut range, items, cx| { + let cx = cx.as_ref(); + let delegate = delegate.upgrade(cx).unwrap(); + let delegate = delegate.read(cx); + let selected_ix = delegate.selected_index(); + range.end = cmp::min(range.end, delegate.match_count()); + items.extend(range.map(move |ix| { + EventHandler::new(delegate.render_match(ix, ix == selected_ix, cx)) + .on_mouse_down(move |cx| { + cx.dispatch_action(SelectIndex(ix)); + true + }) + .boxed() + })); + }, + ) + .contained() + .with_margin_top(6.0) + } + .flex(1., false) + .boxed(), ) .contained() .with_style(settings.theme.selector.container) .constrained() - .with_max_width(500.0) - .with_max_height(420.0) + .with_max_width(self.max_size.x()) + .with_max_height(self.max_size.y()) .aligned() .top() .named("picker") @@ -91,57 +132,20 @@ impl Picker { }); cx.subscribe(&query_editor, Self::on_query_editor_event) .detach(); - let mut this = Self { + let this = Self { query_editor, list_state: Default::default(), update_task: None, delegate, + max_size: vec2f(500., 420.), }; - this.update_matches(cx); + cx.defer(|this, cx| this.update_matches(cx)); this } - fn render_matches(&self, cx: &AppContext) -> ElementBox { - let delegate = self.delegate.clone(); - let match_count = if let Some(delegate) = delegate.upgrade(cx) { - delegate.read(cx).match_count() - } else { - 0 - }; - - if match_count == 0 { - let settings = cx.global::(); - return Label::new( - "No matches".into(), - settings.theme.selector.empty.label.clone(), - ) - .contained() - .with_style(settings.theme.selector.empty.container) - .named("empty matches"); - } - - UniformList::new( - self.list_state.clone(), - match_count, - move |mut range, items, cx| { - let cx = cx.as_ref(); - let delegate = delegate.upgrade(cx).unwrap(); - let delegate = delegate.read(cx); - let selected_ix = delegate.selected_index(); - range.end = cmp::min(range.end, delegate.match_count()); - items.extend(range.map(move |ix| { - EventHandler::new(delegate.render_match(ix, ix == selected_ix, cx)) - .on_mouse_down(move |cx| { - cx.dispatch_action(SelectIndex(ix)); - true - }) - .boxed() - })); - }, - ) - .contained() - .with_margin_top(6.0) - .named("matches") + pub fn with_max_size(mut self, width: f32, height: f32) -> Self { + self.max_size = vec2f(width, height); + self } fn on_query_editor_event( @@ -172,8 +176,14 @@ impl Picker { update.await; this.update(&mut cx, |this, cx| { if let Some(delegate) = this.delegate.upgrade(cx) { - let index = delegate.read(cx).selected_index(); - this.list_state.scroll_to(ScrollTarget::Show(index)); + let delegate = delegate.read(cx); + let index = delegate.selected_index(); + let target = if delegate.center_selection_after_match_updates() { + ScrollTarget::Center(index) + } else { + ScrollTarget::Show(index) + }; + this.list_state.scroll_to(target); cx.notify(); this.update_task.take(); } diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 2c048c4b7e0c6c66c63966712433c6e7e752c14a..8e89951a00d913f079b62e4c4285cf72d778b575 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -57,18 +57,15 @@ impl View for ProjectSymbolsView { impl ProjectSymbolsView { fn new(project: ModelHandle, cx: &mut ViewContext) -> Self { let handle = cx.weak_handle(); - let picker = cx.add_view(|cx| Picker::new(handle, cx)); - let mut this = Self { - picker, + Self { project, + picker: cx.add_view(|cx| Picker::new(handle, cx)), selected_match_index: 0, symbols: Default::default(), match_candidates: Default::default(), matches: Default::default(), show_worktree_root_name: false, - }; - this.update_matches(String::new(), cx).detach(); - this + } } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { From f5377c2f50de9d982f2f4c9397794cba898e336d Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Apr 2022 09:00:47 -0700 Subject: [PATCH 207/245] Highlight fuzzy match positions in command palette --- crates/command_palette/src/command_palette.rs | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index ddefe4d8308ce114ac5b0f5da78626b2b1c5d58c..0786d9b764175579b20c96d9ae56273f242dc121 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -135,15 +135,28 @@ impl PickerDelegate for CommandPalette { }) .collect::>(); cx.spawn(move |this, mut cx| async move { - let matches = fuzzy::match_strings( - &candidates, - &query, - true, - 10000, - &Default::default(), - cx.background(), - ) - .await; + let matches = if query.is_empty() { + candidates + .into_iter() + .enumerate() + .map(|(index, candidate)| StringMatch { + candidate_id: index, + string: candidate.string, + positions: Vec::new(), + score: 0.0, + }) + .collect() + } else { + fuzzy::match_strings( + &candidates, + &query, + true, + 10000, + &Default::default(), + cx.background(), + ) + .await + }; this.update(&mut cx, |this, _| { this.matches = matches; if this.matches.is_empty() { @@ -186,7 +199,11 @@ impl PickerDelegate for CommandPalette { let keystroke_spacing = theme.command_palette.keystroke_spacing; Flex::row() - .with_child(Label::new(mat.string.clone(), style.label.clone()).boxed()) + .with_child( + Label::new(mat.string.clone(), style.label.clone()) + .with_highlights(mat.positions.clone()) + .boxed(), + ) .with_children(command.keystrokes.iter().map(|keystroke| { Flex::row() .with_children( From 11eba96cb868d86a966d06822c51748fc62f19d8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Apr 2022 11:33:15 -0700 Subject: [PATCH 208/245] Allow toggling other modals from the command palette --- crates/command_palette/src/command_palette.rs | 31 ++++++++++++++----- crates/picker/src/picker.rs | 6 +++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 0786d9b764175579b20c96d9ae56273f242dc121..211ecdd2d03b6576527864fea5f97746e3cf92c3 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -27,6 +27,11 @@ pub struct CommandPalette { pub enum Event { Dismissed, + Confirmed { + window_id: usize, + focused_view_id: usize, + action: Box, + }, } struct Command { @@ -81,8 +86,18 @@ impl CommandPalette { cx: &mut ViewContext, ) { match event { - Event::Dismissed => { + Event::Dismissed => workspace.dismiss_modal(cx), + Event::Confirmed { + window_id, + focused_view_id, + action, + } => { + let window_id = *window_id; + let focused_view_id = *focused_view_id; + let action = (*action).boxed_clone(); workspace.dismiss_modal(cx); + cx.as_mut() + .defer(move |cx| cx.dispatch_action_at(window_id, focused_view_id, &*action)) } } } @@ -174,15 +189,15 @@ impl PickerDelegate for CommandPalette { fn confirm(&mut self, cx: &mut ViewContext) { if !self.matches.is_empty() { - let window_id = cx.window_id(); let action_ix = self.matches[self.selected_ix].candidate_id; - cx.dispatch_action_at( - window_id, - self.focused_view_id, - self.actions[action_ix].action.as_ref(), - ) + cx.emit(Event::Confirmed { + window_id: cx.window_id(), + focused_view_id: self.focused_view_id, + action: self.actions.remove(action_ix).action, + }); + } else { + cx.emit(Event::Dismissed); } - cx.emit(Event::Dismissed); } fn render_match(&self, ix: usize, selected: bool, cx: &gpui::AppContext) -> gpui::ElementBox { diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 76b9d99d29e1f2c679e091140a0c33db2e2791c2..f23467247820bf4117a8f5606dec9a009489fb61 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -20,6 +20,7 @@ pub struct Picker { list_state: UniformListState, update_task: Option>, max_size: Vector2F, + confirmed: bool, } pub trait PickerDelegate: View { @@ -138,6 +139,7 @@ impl Picker { update_task: None, delegate, max_size: vec2f(500., 420.), + confirmed: false, }; cx.defer(|this, cx| this.update_matches(cx)); this @@ -156,7 +158,7 @@ impl Picker { ) { match event { editor::Event::BufferEdited { .. } => self.update_matches(cx), - editor::Event::Blurred => { + editor::Event::Blurred if !self.confirmed => { if let Some(delegate) = self.delegate.upgrade(cx) { delegate.update(cx, |delegate, cx| { delegate.dismiss(cx); @@ -204,6 +206,7 @@ impl Picker { pub fn select_index(&mut self, action: &SelectIndex, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let index = action.0; + self.confirmed = true; delegate.update(cx, |delegate, cx| { delegate.set_selected_index(index, cx); delegate.confirm(cx); @@ -256,6 +259,7 @@ impl Picker { fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { + self.confirmed = true; delegate.update(cx, |delegate, cx| delegate.confirm(cx)); } } From a4f259066bc11d67a0afd940cdfbe2458c606e60 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Apr 2022 17:30:17 -0700 Subject: [PATCH 209/245] tmp --- crates/command_palette/src/command_palette.rs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 211ecdd2d03b6576527864fea5f97746e3cf92c3..2f231cabb6e52840deb6c58ab52f8bce7754bafc 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -35,7 +35,7 @@ pub enum Event { } struct Command { - name: &'static str, + name: String, action: Box, keystrokes: Vec, } @@ -46,7 +46,7 @@ impl CommandPalette { let actions = cx .available_actions(cx.window_id(), focused_view_id) .map(|(name, action, bindings)| Command { - name, + name: humanize(name), action, keystrokes: bindings .last() @@ -259,6 +259,30 @@ impl PickerDelegate for CommandPalette { } } +fn humanize(name: &str) -> String { + let capacity = name.len() + name.chars().filter(|c| c.is_uppercase()).count(); + let mut result = String::with_capacity(capacity); + let mut prev_char = '\0'; + for char in name.chars() { + if char == ':' { + if prev_char == ':' { + result.push(' '); + } else { + result.push(':'); + } + } else if char.is_uppercase() { + if prev_char.is_lowercase() { + result.push(' '); + } + result.push(char); + } else { + result.push(char); + } + prev_char = char; + } + result +} + impl std::fmt::Debug for Command { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Command") @@ -267,3 +291,5 @@ impl std::fmt::Debug for Command { .finish() } } + +// #[cfg(test)] From d8ad0d8e4e8459a4805ab820a1f05375d0a37acc Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Apr 2022 18:07:17 -0700 Subject: [PATCH 210/245] Format action names more readably in command palette Also add a unit test for the command palette --- crates/command_palette/Cargo.toml | 1 + crates/command_palette/src/command_palette.rs | 83 +++++++++++++++++-- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/crates/command_palette/Cargo.toml b/crates/command_palette/Cargo.toml index ecff82f6f44a455bc1d58d45c120312e37af31a5..aeaffa3e6f0fd77082a1e4b9cd7896da9b713669 100644 --- a/crates/command_palette/Cargo.toml +++ b/crates/command_palette/Cargo.toml @@ -19,6 +19,7 @@ workspace = { path = "../workspace" } [dev-dependencies] gpui = { path = "../gpui", features = ["test-support"] } +editor = { path = "../editor", features = ["test-support"] } serde_json = { version = "1.0.64", features = ["preserve_order"] } workspace = { path = "../workspace", features = ["test-support"] } ctor = "0.1" diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 2f231cabb6e52840deb6c58ab52f8bce7754bafc..b535450d12eb86903c4a381a2b70a814de04a565 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -46,7 +46,7 @@ impl CommandPalette { let actions = cx .available_actions(cx.window_id(), focused_view_id) .map(|(name, action, bindings)| Command { - name: humanize(name), + name: humanize_action_name(name), action, keystrokes: bindings .last() @@ -259,26 +259,24 @@ impl PickerDelegate for CommandPalette { } } -fn humanize(name: &str) -> String { +fn humanize_action_name(name: &str) -> String { let capacity = name.len() + name.chars().filter(|c| c.is_uppercase()).count(); let mut result = String::with_capacity(capacity); - let mut prev_char = '\0'; for char in name.chars() { if char == ':' { - if prev_char == ':' { + if result.ends_with(':') { result.push(' '); } else { result.push(':'); } } else if char.is_uppercase() { - if prev_char.is_lowercase() { + if !result.ends_with(' ') { result.push(' '); } - result.push(char); + result.extend(char.to_lowercase()); } else { result.push(char); } - prev_char = char; } result } @@ -292,4 +290,73 @@ impl std::fmt::Debug for Command { } } -// #[cfg(test)] +#[cfg(test)] +mod tests { + use super::*; + use editor::Editor; + use gpui::TestAppContext; + use workspace::{Workspace, WorkspaceParams}; + + #[test] + fn test_humanize_action_name() { + assert_eq!( + &humanize_action_name("editor::GoToDefinition"), + "editor: go to definition" + ); + assert_eq!( + &humanize_action_name("editor::Backspace"), + "editor: backspace" + ); + } + + #[gpui::test] + async fn test_command_palette(cx: &mut TestAppContext) { + let params = cx.update(WorkspaceParams::test); + + cx.update(|cx| { + editor::init(cx); + workspace::init(¶ms.client, cx); + init(cx); + }); + + let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx)); + let editor = cx.add_view(window_id, |cx| { + let mut editor = Editor::single_line(None, cx); + editor.set_text("abc", cx); + editor + }); + + workspace.update(cx, |workspace, cx| { + cx.focus(editor.clone()); + workspace.add_item(Box::new(editor.clone()), cx) + }); + + workspace.update(cx, |workspace, cx| { + CommandPalette::toggle(workspace, &Toggle, cx) + }); + + let palette = workspace.read_with(cx, |workspace, _| { + workspace + .modal() + .unwrap() + .clone() + .downcast::() + .unwrap() + }); + + palette + .update(cx, |palette, cx| { + palette.update_matches("bcksp".to_string(), cx) + }) + .await; + + palette.update(cx, |palette, cx| { + assert_eq!(palette.matches[0].string, "editor: backspace"); + palette.confirm(cx); + }); + + editor.read_with(cx, |editor, cx| { + assert_eq!(editor.text(cx), "ab"); + }); + } +} From 0af129d50a594fc61985a0a3418e304747479ea5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Apr 2022 18:14:45 -0700 Subject: [PATCH 211/245] Use primary text color for keystrokes in command palette --- assets/themes/dark.json | 2 +- assets/themes/light.json | 2 +- styles/src/styleTree/commandPalette.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index e8a082d2caa021f5fc61ccd455e0facc3a4cd719..85822e8e05ec35f47a0f08bf42a53ed8db401efd 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -713,7 +713,7 @@ "key": { "text": { "family": "Zed Mono", - "color": "#9c9c9c", + "color": "#f1f1f1", "size": 12 }, "corner_radius": 3, diff --git a/assets/themes/light.json b/assets/themes/light.json index bf9b287a379d7e75dfd0d08aadaa1cc9ea08a15d..9a93749bfb3e4fea1d158ea1a5118af88ba0531b 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -713,7 +713,7 @@ "key": { "text": { "family": "Zed Mono", - "color": "#474747", + "color": "#2b2b2b", "size": 12 }, "corner_radius": 3, diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/styleTree/commandPalette.ts index f7a0f51f6eb2949914cbda235a571e549c6e8420..00005d619796be416d32407d976571d267c26d77 100644 --- a/styles/src/styleTree/commandPalette.ts +++ b/styles/src/styleTree/commandPalette.ts @@ -5,7 +5,7 @@ export default function commandPalette(theme: Theme) { return { keystrokeSpacing: 8, key: { - text: text(theme, "mono", "secondary", { size: "xs" }), + text: text(theme, "mono", "primary", { size: "xs" }), cornerRadius: 3, background: backgroundColor(theme, "info", "base"), border: border(theme, "info"), From 408f8d429784ad68684641fe0024d9f87ade5ba6 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 19 Apr 2022 02:34:45 -0400 Subject: [PATCH 212/245] Update inputs, tabs, pickers, autocomplete --- assets/themes/dark.json | 188 ++++++++++++++----------- assets/themes/light.json | 188 ++++++++++++++----------- styles/src/styleTree/app.ts | 2 +- styles/src/styleTree/commandPalette.ts | 19 +-- styles/src/styleTree/editor.ts | 4 +- styles/src/styleTree/search.ts | 45 +++--- styles/src/styleTree/selectorModal.ts | 14 +- styles/src/styleTree/workspace.ts | 20 ++- styles/src/themes/dark.ts | 12 ++ styles/src/themes/light.ts | 14 +- styles/src/themes/theme.ts | 2 + 11 files changed, 294 insertions(+), 214 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index 85822e8e05ec35f47a0f08bf42a53ed8db401efd..119450cd7119c26cd105652312d97917b5407857 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -1,16 +1,16 @@ { "selector": { "background": "#1c1c1c", - "corner_radius": 6, + "corner_radius": 8, "padding": 8, "item": { "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 4 }, - "corner_radius": 6, + "corner_radius": 8, "text": { "family": "Zed Sans", "color": "#9c9c9c", @@ -26,11 +26,11 @@ "active_item": { "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 4 }, - "corner_radius": 6, + "corner_radius": 8, "text": { "family": "Zed Sans", "color": "#f1f1f1", @@ -56,14 +56,14 @@ }, "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 8 } }, "input_editor": { "background": "#000000", - "corner_radius": 6, + "corner_radius": 8, "placeholder_text": { "family": "Zed Sans", "color": "#474747", @@ -114,9 +114,9 @@ "icon_conflict": "#f6a724", "icon_dirty": "#135acd", "icon_width": 8, - "spacing": 10, + "spacing": 8, "text": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#9c9c9c", "size": 14 }, @@ -128,8 +128,8 @@ "overlay": true }, "padding": { - "left": 12, - "right": 12 + "left": 8, + "right": 8 } }, "active_tab": { @@ -140,9 +140,9 @@ "icon_conflict": "#f6a724", "icon_dirty": "#135acd", "icon_width": 8, - "spacing": 10, + "spacing": 8, "text": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#ffffff", "size": 14 }, @@ -154,8 +154,8 @@ "overlay": true }, "padding": { - "left": 12, - "right": 12 + "left": 8, + "right": 8 } }, "left_sidebar": { @@ -272,18 +272,36 @@ "family": "Zed Sans", "color": "#9c9c9c", "size": 12, - "underline": true, + "border": { + "color": "#070707", + "width": 1 + }, + "corner_radius": 6, + "margin": { + "top": 1, + "right": 6 + }, "padding": { - "right": 8 + "left": 6, + "right": 6 } }, "hovered_sign_in_prompt": { "family": "Zed Sans", "color": "#ffffff", "size": 12, - "underline": true, + "border": { + "color": "#070707", + "width": 1 + }, + "corner_radius": 6, + "margin": { + "top": 1, + "right": 6 + }, "padding": { - "right": 8 + "left": 6, + "right": 6 } }, "offline_icon": { @@ -383,8 +401,8 @@ ], "autocomplete": { "background": "#000000", - "corner_radius": 6, - "padding": 6, + "corner_radius": 8, + "padding": 4, "border": { "color": "#232323", "width": 1 @@ -713,21 +731,23 @@ "key": { "text": { "family": "Zed Mono", - "color": "#f1f1f1", + "color": "#ffffff", "size": 12 }, - "corner_radius": 3, - "background": "#2472f2", + "corner_radius": 4, + "background": "#0e0e0e", "border": { - "color": "#2472f2", + "color": "#232323", "width": 1 }, "padding": { - "left": 3, - "right": 3 + "top": 3, + "bottom": 3, + "left": 8, + "right": 8 }, "margin": { - "left": 3 + "left": 2 } } }, @@ -1127,53 +1147,53 @@ }, "search": { "match_background": "#3f15a380", - "tab_icon_spacing": 4, + "tab_icon_spacing": 8, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#9c9c9c", + "color": "#ffffff", "size": 14, - "background": "#2b2b2b", - "corner_radius": 6, + "background": "#232323", + "corner_radius": 4, "border": { - "color": "#070707", + "color": "#404040", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "active_option_button": { "family": "Zed Mono", - "color": "#9c9c9c", + "color": "#ffffff", "size": 14, - "background": "#2b2b2b", - "corner_radius": 6, + "background": "#232323", + "corner_radius": 4, "border": { - "color": "#070707", + "color": "#404040", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "editor": { "background": "#000000", - "corner_radius": 6, + "corner_radius": 8, "min_width": 200, "max_width": 500, "placeholder_text": { @@ -1187,7 +1207,7 @@ }, "text": { "family": "Zed Mono", - "color": "#f1f1f1", + "color": "#ffffff", "size": 14 }, "border": { @@ -1195,39 +1215,39 @@ "width": 1 }, "margin": { - "right": 5 + "right": 6 }, "padding": { "top": 3, "bottom": 3, - "left": 14, - "right": 14 + "left": 12, + "right": 8 } }, "hovered_option_button": { "family": "Zed Mono", - "color": "#9c9c9c", + "color": "#ffffff", "size": 14, - "background": "#2b2b2b", - "corner_radius": 6, + "background": "#0e0e0e", + "corner_radius": 4, "border": { - "color": "#070707", + "color": "#404040", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "invalid_editor": { "background": "#000000", - "corner_radius": 6, + "corner_radius": 8, "min_width": 200, "max_width": 500, "placeholder_text": { @@ -1241,7 +1261,7 @@ }, "text": { "family": "Zed Mono", - "color": "#f1f1f1", + "color": "#ffffff", "size": 14 }, "border": { @@ -1249,13 +1269,13 @@ "width": 1 }, "margin": { - "right": 5 + "right": 6 }, "padding": { "top": 3, "bottom": 3, - "left": 14, - "right": 14 + "left": 12, + "right": 8 } }, "match_index": { @@ -1268,27 +1288,27 @@ "family": "Zed Mono", "color": "#9c9c9c", "size": 14, - "background": "#1c1c1c", - "corner_radius": 6, + "background": "#0e0e0e", + "corner_radius": 4, "border": { - "color": "#070707", + "color": "#232323", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "option_button_group": { "padding": { - "left": 2, - "right": 2 + "left": 4, + "right": 4 } }, "results_status": { @@ -1299,7 +1319,7 @@ }, "breadcrumbs": { "family": "Zed Sans", - "color": "#f1f1f1", + "color": "#9c9c9c", "size": 14, "padding": { "left": 6 diff --git a/assets/themes/light.json b/assets/themes/light.json index 9a93749bfb3e4fea1d158ea1a5118af88ba0531b..192c6ebe93e1d1520b61ac1f37af241f4d77cc65 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -1,16 +1,16 @@ { "selector": { "background": "#f8f8f8", - "corner_radius": 6, + "corner_radius": 8, "padding": 8, "item": { "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 4 }, - "corner_radius": 6, + "corner_radius": 8, "text": { "family": "Zed Sans", "color": "#474747", @@ -26,11 +26,11 @@ "active_item": { "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 4 }, - "corner_radius": 6, + "corner_radius": 8, "text": { "family": "Zed Sans", "color": "#2b2b2b", @@ -42,7 +42,7 @@ "weight": "bold", "size": 14 }, - "background": "#dcdcdc" + "background": "#e3e3e3" }, "border": { "color": "#d5d5d5", @@ -56,14 +56,14 @@ }, "padding": { "bottom": 4, - "left": 16, - "right": 16, + "left": 12, + "right": 12, "top": 8 } }, "input_editor": { "background": "#ffffff", - "corner_radius": 6, + "corner_radius": 8, "placeholder_text": { "family": "Zed Sans", "color": "#808080", @@ -114,9 +114,9 @@ "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", "icon_width": 8, - "spacing": 10, + "spacing": 8, "text": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#474747", "size": 14 }, @@ -128,8 +128,8 @@ "overlay": true }, "padding": { - "left": 12, - "right": 12 + "left": 8, + "right": 8 } }, "active_tab": { @@ -140,9 +140,9 @@ "icon_conflict": "#f7bf17", "icon_dirty": "#135acd", "icon_width": 8, - "spacing": 10, + "spacing": 8, "text": { - "family": "Zed Mono", + "family": "Zed Sans", "color": "#000000", "size": 14 }, @@ -154,8 +154,8 @@ "overlay": true }, "padding": { - "left": 12, - "right": 12 + "left": 8, + "right": 8 } }, "left_sidebar": { @@ -272,18 +272,36 @@ "family": "Zed Sans", "color": "#474747", "size": 12, - "underline": true, + "border": { + "color": "#d5d5d5", + "width": 1 + }, + "corner_radius": 6, + "margin": { + "top": 1, + "right": 6 + }, "padding": { - "right": 8 + "left": 6, + "right": 6 } }, "hovered_sign_in_prompt": { "family": "Zed Sans", "color": "#000000", "size": 12, - "underline": true, + "border": { + "color": "#d5d5d5", + "width": 1 + }, + "corner_radius": 6, + "margin": { + "top": 1, + "right": 6 + }, "padding": { - "right": 8 + "left": 6, + "right": 6 } }, "offline_icon": { @@ -383,8 +401,8 @@ ], "autocomplete": { "background": "#ffffff", - "corner_radius": 6, - "padding": 6, + "corner_radius": 8, + "padding": 4, "border": { "color": "#d5d5d5", "width": 1 @@ -713,21 +731,23 @@ "key": { "text": { "family": "Zed Mono", - "color": "#2b2b2b", + "color": "#000000", "size": 12 }, - "corner_radius": 3, - "background": "#c5dafc", + "corner_radius": 4, + "background": "#f1f1f1", "border": { - "color": "#9ec1fa", + "color": "#d5d5d5", "width": 1 }, "padding": { - "left": 3, - "right": 3 + "top": 3, + "bottom": 3, + "left": 8, + "right": 8 }, "margin": { - "left": 3 + "left": 2 } } }, @@ -1127,53 +1147,53 @@ }, "search": { "match_background": "#fce9b7", - "tab_icon_spacing": 4, + "tab_icon_spacing": 8, "tab_icon_width": 14, "active_hovered_option_button": { "family": "Zed Mono", - "color": "#474747", + "color": "#000000", "size": 14, - "background": "#eaeaea", - "corner_radius": 6, + "background": "#ffffff", + "corner_radius": 4, "border": { - "color": "#d5d5d5", + "color": "#e3e3e3", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "active_option_button": { "family": "Zed Mono", - "color": "#474747", + "color": "#000000", "size": 14, - "background": "#eaeaea", - "corner_radius": 6, + "background": "#ffffff", + "corner_radius": 4, "border": { - "color": "#d5d5d5", + "color": "#e3e3e3", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "editor": { "background": "#ffffff", - "corner_radius": 6, + "corner_radius": 8, "min_width": 200, "max_width": 500, "placeholder_text": { @@ -1187,7 +1207,7 @@ }, "text": { "family": "Zed Mono", - "color": "#2b2b2b", + "color": "#000000", "size": 14 }, "border": { @@ -1195,39 +1215,39 @@ "width": 1 }, "margin": { - "right": 5 + "right": 6 }, "padding": { "top": 3, "bottom": 3, - "left": 14, - "right": 14 + "left": 12, + "right": 8 } }, "hovered_option_button": { "family": "Zed Mono", - "color": "#474747", + "color": "#000000", "size": 14, - "background": "#eaeaea", - "corner_radius": 6, + "background": "#f1f1f1", + "corner_radius": 4, "border": { - "color": "#d5d5d5", + "color": "#e3e3e3", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "invalid_editor": { "background": "#ffffff", - "corner_radius": 6, + "corner_radius": 8, "min_width": 200, "max_width": 500, "placeholder_text": { @@ -1241,7 +1261,7 @@ }, "text": { "family": "Zed Mono", - "color": "#2b2b2b", + "color": "#000000", "size": 14 }, "border": { @@ -1249,13 +1269,13 @@ "width": 1 }, "margin": { - "right": 5 + "right": 6 }, "padding": { "top": 3, "bottom": 3, - "left": 14, - "right": 14 + "left": 12, + "right": 8 } }, "match_index": { @@ -1268,27 +1288,27 @@ "family": "Zed Mono", "color": "#474747", "size": 14, - "background": "#f8f8f8", - "corner_radius": 6, + "background": "#f1f1f1", + "corner_radius": 4, "border": { "color": "#d5d5d5", "width": 1 }, "margin": { - "left": 1, - "right": 1 + "left": 2, + "right": 2 }, "padding": { - "bottom": 1, - "left": 6, - "right": 6, - "top": 1 + "bottom": 3, + "left": 8, + "right": 8, + "top": 3 } }, "option_button_group": { "padding": { - "left": 2, - "right": 2 + "left": 4, + "right": 4 } }, "results_status": { @@ -1299,7 +1319,7 @@ }, "breadcrumbs": { "family": "Zed Sans", - "color": "#2b2b2b", + "color": "#474747", "size": 14, "padding": { "left": 6 diff --git a/styles/src/styleTree/app.ts b/styles/src/styleTree/app.ts index 1f98f8ba9c52bbf01e3f61c24175a9e463478b60..9596e319370a3d105619e00583aa5bb020921d7e 100644 --- a/styles/src/styleTree/app.ts +++ b/styles/src/styleTree/app.ts @@ -36,7 +36,7 @@ export default function app(theme: Theme): Object { contactsPanel: contactsPanel(theme), search: search(theme), breadcrumbs: { - ...text(theme, "sans", "primary"), + ...text(theme, "sans", "secondary"), padding: { left: 6, }, diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/styleTree/commandPalette.ts index 00005d619796be416d32407d976571d267c26d77..fd967a6d202134726631d23101a10a679a6a20e3 100644 --- a/styles/src/styleTree/commandPalette.ts +++ b/styles/src/styleTree/commandPalette.ts @@ -1,20 +1,23 @@ import Theme from "../themes/theme"; -import { text, backgroundColor, border } from "./components"; +import { colors } from "../tokens"; +import { text, backgroundColor, border, borderColor } from "./components"; export default function commandPalette(theme: Theme) { return { keystrokeSpacing: 8, key: { - text: text(theme, "mono", "primary", { size: "xs" }), - cornerRadius: 3, - background: backgroundColor(theme, "info", "base"), - border: border(theme, "info"), + text: text(theme, "mono", "active", { size: "xs" }), + cornerRadius: 4, + background: backgroundColor(theme, "on300"), + border: border(theme, "secondary"), padding: { - left: 3, - right: 3, + top: 3, + bottom: 3, + left: 8, + right: 8, }, margin: { - left: 3 + left: 2 }, } } diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index 261f0cfbbec96832a1b294c04e3bfc0cc8db6787..db7ebd63f74e5b230656d227f6070a99f9dd1eb5 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -67,8 +67,8 @@ export default function editor(theme: Theme) { ], autocomplete: { background: backgroundColor(theme, 500), - cornerRadius: 6, - padding: 6, + cornerRadius: 8, + padding: 4, border: border(theme, "secondary"), item: autocompleteItem, hoveredItem: { diff --git a/styles/src/styleTree/search.ts b/styles/src/styleTree/search.ts index 19046f49c4b70dcc8bac018d225bdbc110a03678..57aeff04300223f67dd58b116aebd9f69eca3636 100644 --- a/styles/src/styleTree/search.ts +++ b/styles/src/styleTree/search.ts @@ -4,57 +4,62 @@ import { backgroundColor, border, player, text } from "./components"; export default function search(theme: Theme) { const optionButton = { ...text(theme, "mono", "secondary"), - background: backgroundColor(theme, 300), - cornerRadius: 6, - border: border(theme, "primary"), + background: backgroundColor(theme, "on500"), + cornerRadius: 4, + border: border(theme, "secondary"), margin: { - left: 1, - right: 1, + left: 2, + right: 2, }, padding: { - bottom: 1, - left: 6, - right: 6, - top: 1, + bottom: 3, + left: 8, + right: 8, + top: 3, }, }; const editor = { background: backgroundColor(theme, 500), - cornerRadius: 6, + cornerRadius: 8, minWidth: 200, maxWidth: 500, placeholderText: text(theme, "mono", "placeholder"), selection: player(theme, 1).selection, - text: text(theme, "mono", "primary"), + text: text(theme, "mono", "active"), border: border(theme, "secondary"), margin: { - right: 5, + right: 6, }, padding: { top: 3, bottom: 3, - left: 14, - right: 14, + left: 12, + right: 8, }, }; return { matchBackground: theme.editor.highlight.match.value, - tabIconSpacing: 4, + tabIconSpacing: 8, tabIconWidth: 14, activeHoveredOptionButton: { ...optionButton, - background: backgroundColor(theme, 100), + ...text(theme, "mono", "active"), + background: backgroundColor(theme, "on500", "active"), + border: border(theme, "muted"), }, activeOptionButton: { ...optionButton, - background: backgroundColor(theme, 100), + ...text(theme, "mono", "active"), + background: backgroundColor(theme, "on500", "active"), + border: border(theme, "muted"), }, editor, hoveredOptionButton: { ...optionButton, - background: backgroundColor(theme, 100), + ...text(theme, "mono", "active"), + border: border(theme, "muted"), }, invalidEditor: { ...editor, @@ -67,8 +72,8 @@ export default function search(theme: Theme) { optionButton, optionButtonGroup: { padding: { - left: 2, - right: 2, + left: 4, + right: 4, }, }, resultsStatus: { diff --git a/styles/src/styleTree/selectorModal.ts b/styles/src/styleTree/selectorModal.ts index 1bb44a776fb7382b205ce7bd45db85afcd7aab47..b4dce880a7a1775f6b3cb6ba0479f86fb9829f43 100644 --- a/styles/src/styleTree/selectorModal.ts +++ b/styles/src/styleTree/selectorModal.ts @@ -5,11 +5,11 @@ export default function selectorModal(theme: Theme): Object { const item = { padding: { bottom: 4, - left: 16, - right: 16, + left: 12, + right: 12, top: 4, }, - cornerRadius: 6, + cornerRadius: 8, text: text(theme, "sans", "secondary"), highlightText: text(theme, "sans", "feature", { weight: "bold" }), }; @@ -22,7 +22,7 @@ export default function selectorModal(theme: Theme): Object { return { background: backgroundColor(theme, 300), - cornerRadius: 6, + cornerRadius: 8, padding: 8, item, activeItem, @@ -31,14 +31,14 @@ export default function selectorModal(theme: Theme): Object { text: text(theme, "sans", "placeholder"), padding: { bottom: 4, - left: 16, - right: 16, + left: 12, + right: 12, top: 8, }, }, inputEditor: { background: backgroundColor(theme, 500), - cornerRadius: 6, + cornerRadius: 8, placeholderText: text(theme, "sans", "placeholder"), selection: player(theme, 1).selection, text: text(theme, "mono", "primary"), diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index f9f1ff283e14417751f2a137914edc91b61c0105..75e5e75fb079431240572ca2c25f4faa7a95372c 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -4,9 +4,15 @@ import { backgroundColor, border, iconColor, text } from "./components"; export default function workspace(theme: Theme) { const signInPrompt = { ...text(theme, "sans", "secondary", { size: "xs" }), - underline: true, + border: border(theme, "primary"), + cornerRadius: 6, + margin: { + top: 1, + right: 6, + }, padding: { - right: 8, + left: 6, + right: 6, }, }; @@ -18,23 +24,23 @@ export default function workspace(theme: Theme) { iconConflict: iconColor(theme, "warning"), iconDirty: iconColor(theme, "info"), iconWidth: 8, - spacing: 10, - text: text(theme, "mono", "secondary", { size: "sm" }), + spacing: 8, + text: text(theme, "sans", "secondary", { size: "sm" }), border: border(theme, "primary", { left: true, bottom: true, overlay: true, }), padding: { - left: 12, - right: 12, + left: 8, + right: 8, }, }; const activeTab = { ...tab, background: backgroundColor(theme, 500), - text: text(theme, "mono", "active", { size: "sm" }), + text: text(theme, "sans", "active", { size: "sm" }), border: { ...tab.border, bottom: false, diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 9b69f5cc85ec20140f7622b5ae7506754decfd52..095c5864ef8f43d7fac1e224ac8befd9639ef5b3 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -21,6 +21,18 @@ const backgroundColor = { active: withOpacity(colors.neutral[0], 0.12), focused: colors.neutral[825], }, + on300: { + base: colors.neutral[850], + hovered: colors.neutral[875], + active: colors.neutral[900], + focused: colors.neutral[875], + }, + on500: { + base: colors.neutral[850], + hovered: colors.neutral[800], + active: colors.neutral[775], + focused: colors.neutral[800], + }, ok: { base: colors.green[600], hovered: colors.green[600], diff --git a/styles/src/themes/light.ts b/styles/src/themes/light.ts index c9e3a73ad14109aa60140c994d0992b3cd98deac..397c16534104f3b53eb7c47c4737de251b1813de 100644 --- a/styles/src/themes/light.ts +++ b/styles/src/themes/light.ts @@ -12,7 +12,7 @@ const backgroundColor = { 300: { base: colors.neutral[25], hovered: colors.neutral[75], - active: colors.neutral[125], + active: colors.neutral[100], focused: colors.neutral[75], }, 500: { @@ -21,6 +21,18 @@ const backgroundColor = { active: withOpacity(colors.neutral[900], 0.06), focused: colors.neutral[50], }, + on300: { + base: colors.neutral[50], + hovered: colors.neutral[100], + active: colors.neutral[150], + focused: colors.neutral[100], + }, + on500: { + base: colors.neutral[50], + hovered: colors.neutral[25], + active: colors.neutral[0], + focused: colors.neutral[25], + }, ok: { base: colors.green[100], hovered: colors.green[100], diff --git a/styles/src/themes/theme.ts b/styles/src/themes/theme.ts index 945b22ca4ae11d9d08d86507ed2443c47aed1851..f4b3bcc6808082efb3cac6877eb4421fcb7ddfd8 100644 --- a/styles/src/themes/theme.ts +++ b/styles/src/themes/theme.ts @@ -63,6 +63,8 @@ export default interface Theme { 100: BackgroundColorSet; 300: BackgroundColorSet; 500: BackgroundColorSet; + on300: BackgroundColorSet; + on500: BackgroundColorSet; ok: BackgroundColorSet; error: BackgroundColorSet; warning: BackgroundColorSet; From 484204c2a0cc3e1ab7398132d8ff15f4845bb86d Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Tue, 19 Apr 2022 02:48:35 -0400 Subject: [PATCH 213/245] Reduce key icon size to avoid extra padding on command palette item - Also remove unneeded imports --- assets/themes/dark.json | 4 ++-- assets/themes/light.json | 4 ++-- styles/src/styleTree/commandPalette.ts | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index 119450cd7119c26cd105652312d97917b5407857..77d3706e3b74334fbf446cb5a3f346288d7171dd 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -741,8 +741,8 @@ "width": 1 }, "padding": { - "top": 3, - "bottom": 3, + "top": 2, + "bottom": 2, "left": 8, "right": 8 }, diff --git a/assets/themes/light.json b/assets/themes/light.json index 192c6ebe93e1d1520b61ac1f37af241f4d77cc65..dc4381ada8b71c4da6b327f8ba8286abbebed18a 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -741,8 +741,8 @@ "width": 1 }, "padding": { - "top": 3, - "bottom": 3, + "top": 2, + "bottom": 2, "left": 8, "right": 8 }, diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/styleTree/commandPalette.ts index fd967a6d202134726631d23101a10a679a6a20e3..9242f67cbe7114e579158e889d87a87966ee4a98 100644 --- a/styles/src/styleTree/commandPalette.ts +++ b/styles/src/styleTree/commandPalette.ts @@ -1,6 +1,5 @@ import Theme from "../themes/theme"; -import { colors } from "../tokens"; -import { text, backgroundColor, border, borderColor } from "./components"; +import { text, backgroundColor, border } from "./components"; export default function commandPalette(theme: Theme) { return { @@ -11,8 +10,8 @@ export default function commandPalette(theme: Theme) { background: backgroundColor(theme, "on300"), border: border(theme, "secondary"), padding: { - top: 3, - bottom: 3, + top: 2, + bottom: 2, left: 8, right: 8, }, From eaa6637b0598009b0653e90e051f129bda1ef8d2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 19 Apr 2022 12:06:14 +0200 Subject: [PATCH 214/245] Use the entire `ProjectPath` to find open buffer for an LSP diagnostic Previously, we would only compare the path relative to the worktree root, which would cause Zed to sometimes update diagnostics on the wrong buffer. This manifested in the project diagnostics not showing those errors/warnings while the status bar and the tab title displayed a summary with errors/warnings. This commit simply uses `Project::get_open_buffer` which correctly locates a buffer with the given project path. --- crates/project/src/project.rs | 131 ++++++++++++++++++++++++++++++---- 1 file changed, 119 insertions(+), 12 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 0e3625bcb557aa08e9f4400d85e6473a348df17a..8c91c70904422b99085312a20c4767ec41d1da17 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1961,19 +1961,10 @@ impl Project { worktree_id: worktree.read(cx).id(), path: relative_path.into(), }; - - for buffer in self.opened_buffers.values() { - if let Some(buffer) = buffer.upgrade(cx) { - if buffer - .read(cx) - .file() - .map_or(false, |file| *file.path() == project_path.path) - { - self.update_buffer_diagnostics(&buffer, diagnostics.clone(), version, cx)?; - break; - } - } + if let Some(buffer) = self.get_open_buffer(&project_path, cx) { + self.update_buffer_diagnostics(&buffer, diagnostics.clone(), version, cx)?; } + worktree.update(cx, |worktree, cx| { worktree .as_local_mut() @@ -5347,6 +5338,122 @@ mod tests { ); } + #[gpui::test] + async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) { + cx.foreground().forbid_parking(); + + let fs = FakeFs::new(cx.background()); + fs.insert_tree( + "/dir", + json!({ + "a.rs": "let a = 1;", + "b.rs": "let b = 2;" + }), + ) + .await; + + let project = Project::test(fs, cx); + let worktree_a_id = project + .update(cx, |project, cx| { + project.find_or_create_local_worktree("/dir/a.rs", true, cx) + }) + .await + .unwrap() + .0 + .read_with(cx, |tree, _| tree.id()); + let worktree_b_id = project + .update(cx, |project, cx| { + project.find_or_create_local_worktree("/dir/b.rs", true, cx) + }) + .await + .unwrap() + .0 + .read_with(cx, |tree, _| tree.id()); + + let buffer_a = project + .update(cx, |project, cx| { + project.open_buffer((worktree_a_id, ""), cx) + }) + .await + .unwrap(); + let buffer_b = project + .update(cx, |project, cx| { + project.open_buffer((worktree_b_id, ""), cx) + }) + .await + .unwrap(); + + project.update(cx, |project, cx| { + project + .update_diagnostics( + lsp::PublishDiagnosticsParams { + uri: Url::from_file_path("/dir/a.rs").unwrap(), + version: None, + diagnostics: vec![lsp::Diagnostic { + range: lsp::Range::new( + lsp::Position::new(0, 4), + lsp::Position::new(0, 5), + ), + severity: Some(lsp::DiagnosticSeverity::ERROR), + message: "error 1".to_string(), + ..Default::default() + }], + }, + &[], + cx, + ) + .unwrap(); + project + .update_diagnostics( + lsp::PublishDiagnosticsParams { + uri: Url::from_file_path("/dir/b.rs").unwrap(), + version: None, + diagnostics: vec![lsp::Diagnostic { + range: lsp::Range::new( + lsp::Position::new(0, 4), + lsp::Position::new(0, 5), + ), + severity: Some(lsp::DiagnosticSeverity::WARNING), + message: "error 2".to_string(), + ..Default::default() + }], + }, + &[], + cx, + ) + .unwrap(); + }); + + buffer_a.read_with(cx, |buffer, _| { + let chunks = chunks_with_diagnostics(&buffer, 0..buffer.len()); + assert_eq!( + chunks + .iter() + .map(|(s, d)| (s.as_str(), *d)) + .collect::>(), + &[ + ("let ", None), + ("a", Some(DiagnosticSeverity::ERROR)), + (" = 1;", None), + ] + ); + }); + buffer_b.read_with(cx, |buffer, _| { + let chunks = chunks_with_diagnostics(&buffer, 0..buffer.len()); + assert_eq!( + chunks + .iter() + .map(|(s, d)| (s.as_str(), *d)) + .collect::>(), + &[ + ("let ", None), + ("b", Some(DiagnosticSeverity::WARNING)), + (" = 2;", None), + ] + ); + }); + } + #[gpui::test] async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) { cx.foreground().forbid_parking(); From ef784cf21e679262a071b2647027f3529dac47c1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 19 Apr 2022 15:30:46 +0200 Subject: [PATCH 215/245] Remove summaries that don't contain any errors or warnings When opening a buffer, some language servers might start reporting diagnostics. When closing a buffer, they might report that no diagnostics are present for that buffer. Previously, we would keep an empty summary entry which would cause us to open a buffer in the project diagnostics view, only to drop it because it contained no diagnostics. However, the act of opening it caused the language server to asynchronously report non-empty diagnostics. We would therefore handle this as an update, but the previous closing of the buffer would cause the language server to report empty diagnostics again. This would cause the project diagnostics view to thrash infinitely between these two states, pegging the CPU and constantly refreshing the UI. With this commit we won't maintain empty summary entries for files that contain no diagnostics, which fixes the above issue. Co-Authored-By: Nathan Sobo --- crates/collab/src/rpc.rs | 19 ++++++++++++++++++ crates/project/src/project.rs | 14 ++++---------- crates/project/src/worktree.rs | 35 ++++++++++++++++++---------------- crates/rpc/proto/zed.proto | 2 -- crates/rpc/src/rpc.rs | 2 +- 5 files changed, 43 insertions(+), 29 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 4c38e63d5ebdcb71dac39d401e1ada0d4fa2362e..ba93be570ca188878d0a1cdfcae17b7f63d4feb7 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -2363,6 +2363,25 @@ mod tests { ] ); }); + + // Simulate a language server reporting no errors for a file. + fake_language_server.notify::( + lsp::PublishDiagnosticsParams { + uri: lsp::Url::from_file_path("/a/a.rs").unwrap(), + version: None, + diagnostics: vec![], + }, + ); + project_a + .condition(cx_a, |project, cx| { + project.diagnostic_summaries(cx).collect::>() == &[] + }) + .await; + project_b + .condition(cx_b, |project, cx| { + project.diagnostic_summaries(cx).collect::>() == &[] + }) + .await; } #[gpui::test(iterations = 10)] diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 8c91c70904422b99085312a20c4767ec41d1da17..a74ee6026c8c133cfcbe5c862a36c3e435cf0133 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -158,8 +158,6 @@ pub struct ProjectPath { pub struct DiagnosticSummary { pub error_count: usize, pub warning_count: usize, - pub info_count: usize, - pub hint_count: usize, } #[derive(Debug)] @@ -195,8 +193,6 @@ impl DiagnosticSummary { let mut this = Self { error_count: 0, warning_count: 0, - info_count: 0, - hint_count: 0, }; for entry in diagnostics { @@ -204,8 +200,6 @@ impl DiagnosticSummary { match entry.diagnostic.severity { DiagnosticSeverity::ERROR => this.error_count += 1, DiagnosticSeverity::WARNING => this.warning_count += 1, - DiagnosticSeverity::INFORMATION => this.info_count += 1, - DiagnosticSeverity::HINT => this.hint_count += 1, _ => {} } } @@ -214,13 +208,15 @@ impl DiagnosticSummary { this } + pub fn is_empty(&self) -> bool { + self.error_count == 0 && self.warning_count == 0 + } + pub fn to_proto(&self, path: &Path) -> proto::DiagnosticSummary { proto::DiagnosticSummary { path: path.to_string_lossy().to_string(), error_count: self.error_count as u32, warning_count: self.warning_count as u32, - info_count: self.info_count as u32, - hint_count: self.hint_count as u32, } } } @@ -3497,8 +3493,6 @@ impl Project { for (_, path_summary) in self.diagnostic_summaries(cx) { summary.error_count += path_summary.error_count; summary.warning_count += path_summary.warning_count; - summary.info_count += path_summary.info_count; - summary.hint_count += path_summary.hint_count; } summary } diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index ac0c4bf8ff90426f5d72035622dd7fd3e5e0aefb..f9e36a461e562f0fcec91d740101919c90a47563 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -233,8 +233,6 @@ impl Worktree { DiagnosticSummary { error_count: summary.error_count as usize, warning_count: summary.warning_count as usize, - info_count: summary.info_count as usize, - hint_count: summary.hint_count as usize, }, ) }), @@ -568,9 +566,15 @@ impl LocalWorktree { _: &mut ModelContext, ) -> Result<()> { let summary = DiagnosticSummary::new(&diagnostics); - self.diagnostic_summaries - .insert(PathKey(worktree_path.clone()), summary.clone()); - self.diagnostics.insert(worktree_path.clone(), diagnostics); + if summary.is_empty() { + self.diagnostic_summaries + .remove(&PathKey(worktree_path.clone())); + self.diagnostics.remove(&worktree_path); + } else { + self.diagnostic_summaries + .insert(PathKey(worktree_path.clone()), summary.clone()); + self.diagnostics.insert(worktree_path.clone(), diagnostics); + } if let Some(share) = self.share.as_ref() { self.client @@ -581,8 +585,6 @@ impl LocalWorktree { path: worktree_path.to_string_lossy().to_string(), error_count: summary.error_count as u32, warning_count: summary.warning_count as u32, - info_count: summary.info_count as u32, - hint_count: summary.hint_count as u32, }), }) .log_err(); @@ -846,15 +848,16 @@ impl RemoteWorktree { path: Arc, summary: &proto::DiagnosticSummary, ) { - self.diagnostic_summaries.insert( - PathKey(path.clone()), - DiagnosticSummary { - error_count: summary.error_count as usize, - warning_count: summary.warning_count as usize, - info_count: summary.info_count as usize, - hint_count: summary.hint_count as usize, - }, - ); + let summary = DiagnosticSummary { + error_count: summary.error_count as usize, + warning_count: summary.warning_count as usize, + }; + if summary.is_empty() { + self.diagnostic_summaries.remove(&PathKey(path.clone())); + } else { + self.diagnostic_summaries + .insert(PathKey(path.clone()), summary); + } } } diff --git a/crates/rpc/proto/zed.proto b/crates/rpc/proto/zed.proto index f61d6275c91971ac568bf157b43ac98d36e1fccf..79a50e56d4b846e928fc7be1286658d12b2a409a 100644 --- a/crates/rpc/proto/zed.proto +++ b/crates/rpc/proto/zed.proto @@ -453,8 +453,6 @@ message DiagnosticSummary { string path = 1; uint32 error_count = 2; uint32 warning_count = 3; - uint32 info_count = 4; - uint32 hint_count = 5; } message UpdateLanguageServer { diff --git a/crates/rpc/src/rpc.rs b/crates/rpc/src/rpc.rs index 9ee18faae2543b93e194f0e3c2a4fbe9e6604a84..eac21cc35d2ce868424e91063584b4de2b487430 100644 --- a/crates/rpc/src/rpc.rs +++ b/crates/rpc/src/rpc.rs @@ -5,4 +5,4 @@ pub mod proto; pub use conn::Connection; pub use peer::*; -pub const PROTOCOL_VERSION: u32 = 13; +pub const PROTOCOL_VERSION: u32 = 14; From 360b876f363c52386e0871234a76ac2b7b6105e2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 19 Apr 2022 09:40:32 -0600 Subject: [PATCH 216/245] v0.28.0 Co-Authored-By: Antonio Scandurra --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a4540ba39db3a6110d5bfcbb749de3bd201bc2c..a117842cbfc468bd42f2f5fc6eab85f530af1474 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6162,7 +6162,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.27.0" +version = "0.28.0" dependencies = [ "anyhow", "assets", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 7411b53441ab7d5c48c934c3c7892add8652e1c5..08afa08ef2038b523eb85f82ee7179e2727f2298 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.27.0" +version = "0.28.0" [lib] name = "zed" From 93d307aecb33c785a5df10f2911121c2eb640ee9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 19 Apr 2022 10:12:42 -0600 Subject: [PATCH 217/245] Navigate to best match when updating outline view query Co-Authored-By: Antonio Scandurra Co-Authored-By: Keith Simmons Co-Authored-By: Max Brunsfeld --- crates/outline/src/outline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index a5492a8f69214e7447485d2442871ed8b5c3d33d..2ff5c4a57f8f4598af7f662152e4c784aa5ac4a7 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -207,7 +207,7 @@ impl PickerDelegate for OutlineView { .unwrap_or(0); } self.last_query = query; - self.set_selected_index(selected_index, false, cx); + self.set_selected_index(selected_index, !self.last_query.is_empty(), cx); Task::ready(()) } From 8ff027710352a9090e99a7da3eecc0df3f4fe054 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Tue, 19 Apr 2022 11:36:44 -0700 Subject: [PATCH 218/245] Handle linewise motions correctly and fix panic when executing invalid actions --- crates/vim/src/motion.rs | 83 +++------ crates/vim/src/normal.rs | 371 +++++++++++++++++++++++++++++++++++---- 2 files changed, 362 insertions(+), 92 deletions(-) diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index beea48ef886b93a662c1a155b37631fc65729777..530ee1d657c2e26fe47b09882f45ae45224de569 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -4,7 +4,7 @@ use editor::{ movement, Bias, DisplayPoint, }; use gpui::{actions, impl_actions, MutableAppContext}; -use language::{Selection, SelectionGoal}; +use language::SelectionGoal; use serde::Deserialize; use workspace::Workspace; @@ -122,7 +122,9 @@ fn motion(motion: Motion, cx: &mut MutableAppContext) { }); match Vim::read(cx).state.mode { Mode::Normal => normal_motion(motion, cx), - Mode::Insert => panic!("motion bindings in insert mode interfere with normal typing"), + Mode::Insert => { + // Shouldn't execute a motion in insert mode. Ignoring + } } } @@ -132,6 +134,7 @@ impl Motion { map: &DisplaySnapshot, point: DisplayPoint, goal: SelectionGoal, + block_cursor_positioning: bool, ) -> (DisplayPoint, SelectionGoal) { use Motion::*; match self { @@ -147,65 +150,25 @@ impl Motion { SelectionGoal::None, ), NextWordEnd { ignore_punctuation } => ( - next_word_end(map, point, ignore_punctuation, true), + next_word_end(map, point, ignore_punctuation, block_cursor_positioning), SelectionGoal::None, ), PreviousWordStart { ignore_punctuation } => ( previous_word_start(map, point, ignore_punctuation), SelectionGoal::None, ), - StartOfLine => ( - movement::line_beginning(map, point, false), - SelectionGoal::None, - ), - EndOfLine => ( - map.clip_point(movement::line_end(map, point, false), Bias::Left), - SelectionGoal::None, - ), - StartOfDocument => (start_of_document(map), SelectionGoal::None), - EndOfDocument => (end_of_document(map), SelectionGoal::None), + StartOfLine => (start_of_line(map, point), SelectionGoal::None), + EndOfLine => (end_of_line(map, point), SelectionGoal::None), + StartOfDocument => (start_of_document(map, point), SelectionGoal::None), + EndOfDocument => (end_of_document(map, point), SelectionGoal::None), } } - pub fn expand_selection(self, map: &DisplaySnapshot, selection: &mut Selection) { + pub fn line_wise(self) -> bool { use Motion::*; match self { - Up => { - let (start, _) = Up.move_point(map, selection.start, SelectionGoal::None); - // Cursor at top of file. Return early rather - if start == selection.start { - return; - } - let (start, _) = StartOfLine.move_point(map, start, SelectionGoal::None); - let (end, _) = EndOfLine.move_point(map, selection.end, SelectionGoal::None); - selection.start = start; - selection.end = end; - // TODO: Make sure selection goal is correct here - selection.goal = SelectionGoal::None; - } - Down => { - let (end, _) = Down.move_point(map, selection.end, SelectionGoal::None); - // Cursor at top of file. Return early rather - if end == selection.start { - return; - } - let (start, _) = StartOfLine.move_point(map, selection.start, SelectionGoal::None); - let (end, _) = EndOfLine.move_point(map, end, SelectionGoal::None); - selection.start = start; - selection.end = end; - // TODO: Make sure selection goal is correct here - selection.goal = SelectionGoal::None; - } - NextWordEnd { ignore_punctuation } => { - selection.set_head( - next_word_end(map, selection.head(), ignore_punctuation, false), - SelectionGoal::None, - ); - } - _ => { - let (head, goal) = self.move_point(map, selection.head(), selection.goal); - selection.set_head(head, goal); - } + Down | Up | StartOfDocument | EndOfDocument => true, + _ => false, } } } @@ -287,10 +250,22 @@ fn previous_word_start( point } -fn start_of_document(map: &DisplaySnapshot) -> DisplayPoint { - 0usize.to_display_point(map) +fn start_of_line(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint { + map.prev_line_boundary(point.to_point(map)).1 +} + +fn end_of_line(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint { + map.clip_point(map.next_line_boundary(point.to_point(map)).1, Bias::Left) +} + +fn start_of_document(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint { + let mut new_point = 0usize.to_display_point(map); + *new_point.column_mut() = point.column(); + map.clip_point(new_point, Bias::Left) } -fn end_of_document(map: &DisplaySnapshot) -> DisplayPoint { - map.clip_point(map.max_point(), Bias::Left) +fn end_of_document(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint { + let mut new_point = map.max_point(); + *new_point.column_mut() = point.column(); + map.clip_point(new_point, Bias::Left) } diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index e8b17e9b898246c9f48a810db3213f147cc45488..d0ca7ae870988887de804899004060c326aa1315 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -13,8 +13,9 @@ pub fn normal_motion(motion: Motion, cx: &mut MutableAppContext) { None => move_cursor(vim, motion, cx), Some(Operator::Change) => change_over(vim, motion, cx), Some(Operator::Delete) => delete_over(vim, motion, cx), - Some(Operator::Namespace(_)) => panic!( - "Normal mode recieved motion with namespaced operator. Likely this means an invalid keymap was used"), + Some(Operator::Namespace(_)) => { + // Can't do anything for a namespace operator. Ignoring + } } vim.clear_operator(cx); }); @@ -22,7 +23,9 @@ pub fn normal_motion(motion: Motion, cx: &mut MutableAppContext) { fn move_cursor(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { vim.update_active_editor(cx, |editor, cx| { - editor.move_cursors(cx, |map, cursor, goal| motion.move_point(map, cursor, goal)) + editor.move_cursors(cx, |map, cursor, goal| { + motion.move_point(map, cursor, goal, true) + }) }); } @@ -31,7 +34,15 @@ fn change_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { editor.transact(cx, |editor, cx| { // Don't clip at line ends during change operation editor.set_clip_at_line_ends(false, cx); - editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); + editor.move_selections(cx, |map, selection| { + let (head, goal) = motion.move_point(map, selection.head(), selection.goal, false); + selection.set_head(head, goal); + + if motion.line_wise() { + selection.start = map.prev_line_boundary(selection.start.to_point(map)).1; + selection.end = map.next_line_boundary(selection.end.to_point(map)).1; + } + }); editor.set_clip_at_line_ends(true, cx); editor.insert(&"", cx); }); @@ -42,15 +53,50 @@ fn change_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { fn delete_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) { vim.update_active_editor(cx, |editor, cx| { editor.transact(cx, |editor, cx| { - // Don't clip at line ends during delete operation + // Use goal column to preserve previous position editor.set_clip_at_line_ends(false, cx); - editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection)); + editor.move_selections(cx, |map, selection| { + let original_head = selection.head(); + let (head, _) = motion.move_point(map, selection.head(), selection.goal, false); + // Set the goal column to the original position in order to fix it up + // after the deletion + selection.set_head(head, SelectionGoal::Column(original_head.column())); + + if motion.line_wise() { + if selection.end.row() == map.max_point().row() { + // Delete previous line break since we are at the end of the document + if selection.start.row() > 0 { + *selection.start.row_mut() = selection.start.row().saturating_sub(1); + selection.start = map.clip_point(selection.start, Bias::Left); + selection.start = + map.next_line_boundary(selection.start.to_point(map)).1; + } else { + // Selection covers the whole document. Just delete to the start of the + // line. + selection.start = + map.prev_line_boundary(selection.start.to_point(map)).1; + } + selection.end = map.next_line_boundary(selection.end.to_point(map)).1; + } else { + // Delete next line break so that we leave the previous line alone + selection.start = map.prev_line_boundary(selection.start.to_point(map)).1; + *selection.end.column_mut() = 0; + *selection.end.row_mut() += 1; + selection.end = map.clip_point(selection.end, Bias::Left); + } + } + }); editor.insert(&"", cx); // Fixup cursor position after the deletion editor.set_clip_at_line_ends(true, cx); - editor.move_selection_heads(cx, |map, head, _| { - (map.clip_point(head, Bias::Left), SelectionGoal::None) + editor.move_cursors(cx, |map, mut cursor, goal| { + if motion.line_wise() { + if let SelectionGoal::Column(column) = goal { + *cursor.column_mut() = column + } + } + (map.clip_point(cursor, Bias::Left), SelectionGoal::None) }); }); }); @@ -173,19 +219,22 @@ mod test { #[gpui::test] async fn test_jump_to_end(cx: &mut gpui::TestAppContext) { - let initial_content = indoc! {" - The quick + let mut cx = VimTestContext::new(cx, true, "").await; + + cx.set_state( + indoc! {" + The |quick brown fox jumps - over the lazy dog"}; - let mut cx = VimTestContext::new(cx, true, initial_content).await; - + over the lazy dog"}, + Mode::Normal, + ); cx.simulate_keystroke("shift-G"); cx.assert_editor_state(indoc! {" The quick brown fox jumps - over the lazy do|g"}); + over| the lazy dog"}); // Repeat the action doesn't move cx.simulate_keystroke("shift-G"); @@ -193,7 +242,7 @@ mod test { The quick brown fox jumps - over the lazy do|g"}); + over| the lazy dog"}); } #[gpui::test] @@ -212,7 +261,7 @@ mod test { } // Reset and test ignoring punctuation - cx.simulate_keystrokes(["g", "g"]); + cx.simulate_keystrokes(["g", "g", "0"]); let (_, cursor_offsets) = marked_text(indoc! {" The |quick-brown | @@ -242,7 +291,7 @@ mod test { } // Reset and test ignoring punctuation - cx.simulate_keystrokes(["g", "g"]); + cx.simulate_keystrokes(["g", "g", "0"]); let (_, cursor_offsets) = marked_text(indoc! {" Th|e quick-brow|n @@ -264,7 +313,7 @@ mod test { |fox_jumps |over |the"}); let mut cx = VimTestContext::new(cx, true, &initial_content).await; - cx.simulate_keystroke("shift-G"); + cx.simulate_keystrokes(["shift-G", "shift-$"]); for cursor_offset in cursor_offsets.into_iter().rev() { cx.simulate_keystroke("b"); @@ -272,7 +321,7 @@ mod test { } // Reset and test ignoring punctuation - cx.simulate_keystroke("shift-G"); + cx.simulate_keystrokes(["shift-G", "shift-$"]); let (_, cursor_offsets) = marked_text(indoc! {" ||The |quick-brown | @@ -303,12 +352,16 @@ mod test { #[gpui::test] async fn test_move_to_start(cx: &mut gpui::TestAppContext) { - let initial_content = indoc! {" - The quick + let mut cx = VimTestContext::new(cx, true, "").await; + + cx.set_state( + indoc! {" + The q|uick brown fox jumps - over the lazy dog"}; - let mut cx = VimTestContext::new(cx, true, initial_content).await; + over the lazy dog"}, + Mode::Normal, + ); // Jump to the end to cx.simulate_keystroke("shift-G"); @@ -316,12 +369,12 @@ mod test { The quick brown fox jumps - over the lazy do|g"}); + over |the lazy dog"}); // Jump to the start cx.simulate_keystrokes(["g", "g"]); cx.assert_editor_state(indoc! {" - |The quick + The q|uick brown fox jumps over the lazy dog"}); @@ -331,7 +384,7 @@ mod test { // Repeat action doesn't change cx.simulate_keystrokes(["g", "g"]); cx.assert_editor_state(indoc! {" - |The quick + The q|uick brown fox jumps over the lazy dog"}); @@ -469,43 +522,285 @@ mod test { jumps over"}, cx, ); + assert( + "shift-$", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + The |q + brown fox"}, + cx, + ); + assert( + "0", + indoc! {" + The q|uick + brown fox"}, + indoc! {" + |uick + brown fox"}, + cx, + ); + } + + #[gpui::test] + async fn test_linewise_delete(cx: &mut gpui::TestAppContext) { + fn assert(motion: &str, initial_state: &str, state_after: &str, cx: &mut VimTestContext) { + cx.assert_binding( + ["d", motion], + initial_state, + Mode::Normal, + state_after, + Mode::Normal, + ); + } + let cx = &mut VimTestContext::new(cx, true, "").await; + assert( + "k", + indoc! {" + The quick + brown |fox + jumps over"}, + indoc! {" + jumps |over"}, + cx, + ); assert( "k", indoc! {" The quick - brown |fox"}, + brown fox + jumps |over"}, indoc! {" - |"}, + The qu|ick"}, cx, ); assert( "j", indoc! {" The q|uick - brown fox"}, + brown fox + jumps over"}, indoc! {" - |"}, + jumps| over"}, cx, ); assert( - "shift-$", + "j", + indoc! {" + The quick + brown| fox + jumps over"}, + indoc! {" + The q|uick"}, + cx, + ); + assert( + "j", + indoc! {" + The quick + brown| fox + jumps over"}, + indoc! {" + The q|uick"}, + cx, + ); + cx.assert_binding( + ["d", "g", "g"], + indoc! {" + The quick + brown| fox + jumps over + the lazy"}, + Mode::Normal, + indoc! {" + jumps| over + the lazy"}, + Mode::Normal, + ); + cx.assert_binding( + ["d", "g", "g"], + indoc! {" + The quick + brown fox + jumps over + the l|azy"}, + Mode::Normal, + "|", + Mode::Normal, + ); + assert( + "shift-G", + indoc! {" + The quick + brown| fox + jumps over + the lazy"}, + indoc! {" + The q|uick"}, + cx, + ); + cx.assert_binding( + ["d", "g", "g"], indoc! {" The q|uick - brown fox"}, + brown fox + jumps over + the lazy"}, + Mode::Normal, indoc! {" - The |q - brown fox"}, + brown| fox + jumps over + the lazy"}, + Mode::Normal, + ); + } + + #[gpui::test] + async fn test_linewise_change(cx: &mut gpui::TestAppContext) { + fn assert(motion: &str, initial_state: &str, state_after: &str, cx: &mut VimTestContext) { + cx.assert_binding( + ["c", motion], + initial_state, + Mode::Normal, + state_after, + Mode::Insert, + ); + } + let cx = &mut VimTestContext::new(cx, true, "").await; + assert( + "k", + indoc! {" + The quick + brown |fox + jumps over"}, + indoc! {" + | + jumps over"}, cx, ); assert( - "0", + "k", + indoc! {" + The quick + brown fox + jumps |over"}, + indoc! {" + The quick + |"}, + cx, + ); + assert( + "j", indoc! {" The q|uick - brown fox"}, + brown fox + jumps over"}, indoc! {" - |uick - brown fox"}, + | + jumps over"}, + cx, + ); + assert( + "j", + indoc! {" + The quick + brown| fox + jumps over"}, + indoc! {" + The quick + |"}, + cx, + ); + assert( + "j", + indoc! {" + The quick + brown| fox + jumps over"}, + indoc! {" + The quick + |"}, + cx, + ); + assert( + "shift-G", + indoc! {" + The quick + brown| fox + jumps over + the lazy"}, + indoc! {" + The quick + |"}, + cx, + ); + assert( + "shift-G", + indoc! {" + The quick + brown| fox + jumps over + the lazy"}, + indoc! {" + The quick + |"}, cx, ); + assert( + "shift-G", + indoc! {" + The quick + brown fox + jumps over + the l|azy"}, + indoc! {" + The quick + brown fox + jumps over + |"}, + cx, + ); + cx.assert_binding( + ["c", "g", "g"], + indoc! {" + The quick + brown| fox + jumps over + the lazy"}, + Mode::Normal, + indoc! {" + | + jumps over + the lazy"}, + Mode::Insert, + ); + cx.assert_binding( + ["c", "g", "g"], + indoc! {" + The quick + brown fox + jumps over + the l|azy"}, + Mode::Normal, + "|", + Mode::Insert, + ); + cx.assert_binding( + ["c", "g", "g"], + indoc! {" + The q|uick + brown fox + jumps over + the lazy"}, + Mode::Normal, + indoc! {" + | + brown fox + jumps over + the lazy"}, + Mode::Insert, + ); } } From 47379677f25750c96cbb124180c5c4e283dc4819 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 13:10:36 -0700 Subject: [PATCH 219/245] Update file finder correctly when project files change --- crates/file_finder/src/file_finder.rs | 6 +++--- crates/picker/src/picker.rs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 9877cef3d80e8d4fa47fb1ddbbf4059ef1e93b46..b43319345647dfd506b78583a9715d99a4a20099 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -129,7 +129,7 @@ impl FileFinder { } fn project_updated(&mut self, _: ModelHandle, cx: &mut ViewContext) { - self.spawn_search(self.latest_search_query.clone(), cx) + self.spawn_search(self.picker.read(cx).query(cx), cx) .detach(); } @@ -379,7 +379,7 @@ mod tests { // Simulate a search being cancelled after the time limit, // returning only a subset of the matches that would have been found. - finder.spawn_search(query.clone(), cx).detach(); + drop(finder.spawn_search(query.clone(), cx)); finder.set_matches( finder.latest_search_id, true, // did-cancel @@ -389,7 +389,7 @@ mod tests { ); // Simulate another cancellation. - finder.spawn_search(query.clone(), cx).detach(); + drop(finder.spawn_search(query.clone(), cx)); finder.set_matches( finder.latest_search_id, true, // did-cancel diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index f23467247820bf4117a8f5606dec9a009489fb61..199429b07e6f857a651fc5822f034216551f6c10 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -150,6 +150,10 @@ impl Picker { self } + pub fn query(&self, cx: &AppContext) -> String { + self.query_editor.read(cx).text(cx) + } + fn on_query_editor_event( &mut self, _: ViewHandle, @@ -171,7 +175,7 @@ impl Picker { fn update_matches(&mut self, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { - let query = self.query_editor.read(cx).text(cx); + let query = self.query(cx); let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); cx.notify(); self.update_task = Some(cx.spawn(|this, mut cx| async move { From 717ebe6a4c17394dbbccfcfbc22817376815888a Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 13:16:57 -0700 Subject: [PATCH 220/245] Don't cancel match updates when picker query changes The file finder often cancels an in-progress match task when the project updates. But it still needs to take the matches that it did find and add them to its results. So we should not cancel the entire task, as this will cause the partial results to be discarded. --- crates/picker/src/picker.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 199429b07e6f857a651fc5822f034216551f6c10..96062dc0e66a10c47781b5588c71dbe4a8b11f7b 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -18,7 +18,6 @@ pub struct Picker { delegate: WeakViewHandle, query_editor: ViewHandle, list_state: UniformListState, - update_task: Option>, max_size: Vector2F, confirmed: bool, } @@ -136,7 +135,6 @@ impl Picker { let this = Self { query_editor, list_state: Default::default(), - update_task: None, delegate, max_size: vec2f(500., 420.), confirmed: false, @@ -178,7 +176,7 @@ impl Picker { let query = self.query(cx); let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); cx.notify(); - self.update_task = Some(cx.spawn(|this, mut cx| async move { + cx.spawn(|this, mut cx| async move { update.await; this.update(&mut cx, |this, cx| { if let Some(delegate) = this.delegate.upgrade(cx) { @@ -191,10 +189,10 @@ impl Picker { }; this.list_state.scroll_to(target); cx.notify(); - this.update_task.take(); } }); - })); + }) + .detach() } } From 8ef6b1d8a9787091cd967ba74bc39bb369e381a5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 15:02:38 +0200 Subject: [PATCH 221/245] Don't emit event when LSP reports consecutive empty diagnostics This is related to #849: in that pull request we avoided *storing* empty diagnostics, but we'd still report an event when receiving consecutive empty diagnostics. So if the project diagnostics editor was open, it could happen that opening a buffer would cause the language server to report zero diagnostics. We would therefore close the buffer because there were no diagnostics, but doing so would cause the LSP to report another event with zero diagnostics. This would repeat forever, causing Zed to use a lot of CPU and the UI not to refresh properly. With this commit we will simply avoid emitting a `DiagnosticsUpdated` event altogether if no diagnostics were present before *and* the LSP is reporting a `PublishDiagnostics` event with no diagnostics in it. --- crates/project/src/project.rs | 33 +++++++++++++++++++++--- crates/project/src/worktree.rs | 46 ++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index a74ee6026c8c133cfcbe5c862a36c3e435cf0133..5c1064400edbd0c411a71b536e2932f7fbe9291f 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -154,7 +154,7 @@ pub struct ProjectPath { pub path: Arc, } -#[derive(Clone, Debug, Default, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize)] pub struct DiagnosticSummary { pub error_count: usize, pub warning_count: usize, @@ -1961,13 +1961,15 @@ impl Project { self.update_buffer_diagnostics(&buffer, diagnostics.clone(), version, cx)?; } - worktree.update(cx, |worktree, cx| { + let updated = worktree.update(cx, |worktree, cx| { worktree .as_local_mut() .ok_or_else(|| anyhow!("not a local worktree"))? .update_diagnostics(project_path.path.clone(), diagnostics, cx) })?; - cx.emit(Event::DiagnosticsUpdated(project_path)); + if updated { + cx.emit(Event::DiagnosticsUpdated(project_path)); + } Ok(()) } @@ -4879,7 +4881,7 @@ mod tests { }; use lsp::Url; use serde_json::json; - use std::{cell::RefCell, os::unix, path::PathBuf, rc::Rc}; + use std::{cell::RefCell, os::unix, path::PathBuf, rc::Rc, task::Poll}; use unindent::Unindent as _; use util::{assert_set_eq, test::temp_tree}; use worktree::WorktreeHandle as _; @@ -5564,6 +5566,29 @@ mod tests { }] ) }); + + // Ensure publishing empty diagnostics twice only results in one update event. + fake_server.notify::( + lsp::PublishDiagnosticsParams { + uri: Url::from_file_path("/dir/a.rs").unwrap(), + version: None, + diagnostics: Default::default(), + }, + ); + assert_eq!( + events.next().await.unwrap(), + Event::DiagnosticsUpdated((worktree_id, Path::new("a.rs")).into()) + ); + + fake_server.notify::( + lsp::PublishDiagnosticsParams { + uri: Url::from_file_path("/dir/a.rs").unwrap(), + version: None, + diagnostics: Default::default(), + }, + ); + cx.foreground().run_until_parked(); + assert_eq!(futures::poll!(events.next()), Poll::Pending); } #[gpui::test] diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index f9e36a461e562f0fcec91d740101919c90a47563..19b490b0e294a302f8122b43444d819561830422 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -564,33 +564,37 @@ impl LocalWorktree { worktree_path: Arc, diagnostics: Vec>, _: &mut ModelContext, - ) -> Result<()> { - let summary = DiagnosticSummary::new(&diagnostics); - if summary.is_empty() { + ) -> Result { + self.diagnostics.remove(&worktree_path); + let old_summary = self + .diagnostic_summaries + .remove(&PathKey(worktree_path.clone())) + .unwrap_or_default(); + let new_summary = DiagnosticSummary::new(&diagnostics); + if !new_summary.is_empty() { self.diagnostic_summaries - .remove(&PathKey(worktree_path.clone())); - self.diagnostics.remove(&worktree_path); - } else { - self.diagnostic_summaries - .insert(PathKey(worktree_path.clone()), summary.clone()); + .insert(PathKey(worktree_path.clone()), new_summary); self.diagnostics.insert(worktree_path.clone(), diagnostics); } - if let Some(share) = self.share.as_ref() { - self.client - .send(proto::UpdateDiagnosticSummary { - project_id: share.project_id, - worktree_id: self.id().to_proto(), - summary: Some(proto::DiagnosticSummary { - path: worktree_path.to_string_lossy().to_string(), - error_count: summary.error_count as u32, - warning_count: summary.warning_count as u32, - }), - }) - .log_err(); + let updated = !old_summary.is_empty() || !new_summary.is_empty(); + if updated { + if let Some(share) = self.share.as_ref() { + self.client + .send(proto::UpdateDiagnosticSummary { + project_id: share.project_id, + worktree_id: self.id().to_proto(), + summary: Some(proto::DiagnosticSummary { + path: worktree_path.to_string_lossy().to_string(), + error_count: new_summary.error_count as u32, + warning_count: new_summary.warning_count as u32, + }), + }) + .log_err(); + } } - Ok(()) + Ok(updated) } pub fn scan_complete(&self) -> impl Future { From 0c9816822757431fe50991f8a4a9071ad50c6190 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 15:21:15 +0200 Subject: [PATCH 222/245] v0.28.1 --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a117842cbfc468bd42f2f5fc6eab85f530af1474..37caa8836476cc3663933bccf6d94148d6bd426e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6162,7 +6162,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "zed" -version = "0.28.0" +version = "0.28.1" dependencies = [ "anyhow", "assets", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 08afa08ef2038b523eb85f82ee7179e2727f2298..b4ae84a4f3444abfac34bc8dd4ceacda4a04b9c1 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.28.0" +version = "0.28.1" [lib] name = "zed" From 01eb2dce24ac00fc091f4c079f7f406c2beeee1f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 15 Apr 2022 16:55:26 +0200 Subject: [PATCH 223/245] WIP: Start on a new `cli` crate Co-Authored-By: Nathan Sobo --- Cargo.lock | 309 ++++++++++++++++++----- crates/cli/Cargo.toml | 12 + crates/cli/src/main.rs | 95 +++++++ crates/collab/Cargo.toml | 2 +- crates/gpui/src/platform/mac/platform.rs | 28 ++ 5 files changed, 377 insertions(+), 69 deletions(-) create mode 100644 crates/cli/Cargo.toml create mode 100644 crates/cli/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 37caa8836476cc3663933bccf6d94148d6bd426e..b0ca3b628c043702f51d52128e3aaf0c96b86313 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,7 +135,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -309,7 +309,7 @@ dependencies = [ "polling", "vec-arena", "waker-fn", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -364,7 +364,7 @@ dependencies = [ "futures-lite", "once_cell", "signal-hook", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -458,7 +458,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "futures-channel", "futures-core", "futures-io", @@ -550,7 +550,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -909,7 +909,7 @@ dependencies = [ "num-traits", "serde", "time 0.1.44", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -964,9 +964,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.0-beta.2" +version = "3.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142" +checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" dependencies = [ "atty", "bitflags", @@ -976,24 +976,34 @@ dependencies = [ "os_str_bytes", "strsim 0.10.0", "termcolor", - "textwrap 0.12.1", - "unicode-width", - "vec_map", + "textwrap 0.15.0", ] [[package]] name = "clap_derive" -version = "3.0.0-beta.2" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" +checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" dependencies = [ - "heck", + "heck 0.4.0", "proc-macro-error", "proc-macro2", "quote", "syn", ] +[[package]] +name = "cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap 3.1.8", + "core-foundation", + "core-services", + "ipc-channel", + "serde", +] + [[package]] name = "client" version = "0.1.0" @@ -1087,7 +1097,7 @@ dependencies = [ "async-trait", "async-tungstenite", "base64 0.13.0", - "clap 3.0.0-beta.2", + "clap 3.1.8", "client", "collections", "comrak", @@ -1272,6 +1282,15 @@ dependencies = [ "libc", ] +[[package]] +name = "core-services" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b344b958cae90858bf6086f49599ecc5ec8698eacad0ea155509ba11fab347" +dependencies = [ + "core-foundation", +] + [[package]] name = "core-text" version = "19.2.0" @@ -1326,6 +1345,16 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +dependencies = [ + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + [[package]] name = "crossbeam-channel" version = "0.5.0" @@ -1333,7 +1362,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.2", ] [[package]] @@ -1344,7 +1373,7 @@ checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-utils 0.8.2", ] [[package]] @@ -1354,7 +1383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d60ab4a8dba064f2fbb5aa270c28da5cf4bbd0e72dae1140a6b0353a779dbe00" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "lazy_static", "loom", "memoffset", @@ -1368,7 +1397,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f6cb3c7f5b8e51bc3ebb73a2327ad4abdbd119dc13223f14f961d2f38486756" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.2", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg 1.0.1", + "cfg-if 0.1.10", + "lazy_static", ] [[package]] @@ -1472,7 +1512,7 @@ dependencies = [ "openssl-sys", "schannel", "socket2 0.4.0", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1488,7 +1528,7 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1634,7 +1674,7 @@ checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1645,7 +1685,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1668,7 +1708,7 @@ checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" dependencies = [ "lazy_static", "libc", - "winapi", + "winapi 0.3.9", "wio", ] @@ -1865,9 +1905,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fastrand" -version = "1.4.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -1985,7 +2025,7 @@ dependencies = [ "pathfinder_simd", "servo-fontconfig", "walkdir", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2070,6 +2110,22 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "funty" version = "1.1.0" @@ -2201,7 +2257,7 @@ dependencies = [ "libc", "log", "rustc_version", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2449,6 +2505,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.18" @@ -2608,7 +2670,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.2", "globset", "lazy_static", "log", @@ -2673,6 +2735,34 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipc-channel" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cb1d9211085f0ea6f1379d944b93c4d07e8207aa3bcf49f37eda12b85081887" +dependencies = [ + "bincode", + "crossbeam-channel 0.4.4", + "fnv", + "lazy_static", + "libc", + "mio", + "rand 0.7.3", + "serde", + "tempfile", + "uuid", + "winapi 0.3.9", +] + [[package]] name = "isahc" version = "0.9.14" @@ -2680,7 +2770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2948a0ce43e2c2ef11d7edf6816508998d99e13badd1150be0914205df9388a" dependencies = [ "bytes 0.5.6", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "curl", "curl-sys", "flume", @@ -2797,6 +2887,16 @@ dependencies = [ "sha2 0.9.5", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "kurbo" version = "0.8.1" @@ -2893,7 +2993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" dependencies = [ "cfg-if 1.0.0", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3031,6 +3131,12 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "md-5" version = "0.9.1" @@ -3124,6 +3230,37 @@ dependencies = [ "autocfg 1.0.1", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "multimap" version = "0.8.3" @@ -3140,6 +3277,17 @@ dependencies = [ "socket2 0.3.19", ] +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + [[package]] name = "nom" version = "5.1.2" @@ -3361,9 +3509,12 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "2.4.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] [[package]] name = "outline" @@ -3421,7 +3572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3647,7 +3798,7 @@ dependencies = [ "libc", "log", "wepoll-sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3727,9 +3878,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] @@ -3823,7 +3974,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.0.1", - "heck", + "heck 0.3.3", "itertools", "log", "multimap", @@ -3888,7 +4039,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4005,9 +4156,9 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", + "crossbeam-channel 0.5.0", "crossbeam-deque", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "lazy_static", "num_cpus", ] @@ -4069,7 +4220,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4109,7 +4260,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4311,7 +4462,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4791,7 +4942,7 @@ checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if 1.0.0", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4801,7 +4952,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4875,9 +5026,9 @@ dependencies = [ "bytes 0.5.6", "chrono", "crc", - "crossbeam-channel", + "crossbeam-channel 0.5.0", "crossbeam-queue", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "either", "futures-channel", "futures-core", @@ -4923,9 +5074,9 @@ dependencies = [ "byteorder", "bytes 1.0.1", "crc", - "crossbeam-channel", + "crossbeam-channel 0.5.0", "crossbeam-queue", - "crossbeam-utils", + "crossbeam-utils 0.8.2", "dirs 3.0.1", "either", "futures-channel", @@ -4971,7 +5122,7 @@ dependencies = [ "dotenv", "either", "futures", - "heck", + "heck 0.3.3", "lazy_static", "proc-macro2", "quote", @@ -4992,7 +5143,7 @@ dependencies = [ "dotenv", "either", "futures", - "heck", + "heck 0.3.3", "once_cell", "proc-macro2", "quote", @@ -5191,9 +5342,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.67" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" dependencies = [ "proc-macro2", "quote", @@ -5230,16 +5381,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand 0.8.3", "redox_syscall", "remove_dir_all", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5283,12 +5434,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.12.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789" -dependencies = [ - "unicode-width", -] +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "theme" @@ -5410,7 +5558,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5425,7 +5573,7 @@ dependencies = [ "stdweb", "time-macros", "version_check", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5846,6 +5994,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.2", +] [[package]] name = "value-bag" @@ -5916,7 +6067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi", + "winapi 0.3.9", "winapi-util", ] @@ -6073,6 +6224,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -6083,6 +6240,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -6095,7 +6258,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -6110,7 +6273,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -6136,6 +6299,16 @@ dependencies = [ "util", ] +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "wyz" version = "0.2.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee4b01941848beea015046f7e780447d564adc0a --- /dev/null +++ b/crates/cli/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "cli" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0" +core-foundation = "0.9" +core-services = "0.2" +clap = { version = "3.1", features = ["derive"] } +ipc-channel = "0.16" +serde = { version = "1.0", features = ["derive"] } \ No newline at end of file diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs new file mode 100644 index 0000000000000000000000000000000000000000..a8531125c2e5c3c826861dc5717963d1bb3ddd3c --- /dev/null +++ b/crates/cli/src/main.rs @@ -0,0 +1,95 @@ +use anyhow::{anyhow, Result}; +use clap::Parser; +use core_foundation::{ + array::{CFArray, CFIndex}, + string::kCFStringEncodingUTF8, + url::{CFURLCreateWithBytes, CFURL}, +}; +use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType}; +use ipc_channel::ipc::IpcOneShotServer; +use serde::{Deserialize, Serialize}; +use std::{path::PathBuf, process, ptr}; + +#[derive(Parser)] +#[clap(name = "zed")] +struct Args { + /// Wait for all of the given paths to be closed before exiting. + #[clap(short, long)] + wait: bool, + /// A sequence of space-separated paths that you want to open. + #[clap()] + paths: Vec, +} + +#[derive(Serialize, Deserialize)] +struct OpenResult { + exit_status: i32, + stdout_message: Option, + stderr_message: Option, +} + +fn main() -> Result<()> { + let args = Args::parse(); + + let (server, server_name) = IpcOneShotServer::::new()?; + let app_path = locate_app()?; + launch_app(app_path, args.paths, server_name)?; + + let (_, result) = server.accept()?; + if let Some(message) = result.stdout_message { + println!("{}", message); + } + if let Some(message) = result.stderr_message { + eprintln!("{}", message); + } + + process::exit(result.exit_status) +} + +fn locate_app() -> Result { + Ok("/Applications/Zed.app".into()) +} + +fn launch_app(app_path: PathBuf, paths_to_open: Vec, server_name: String) -> Result<()> { + let status = unsafe { + let app_url = + CFURL::from_path(&app_path, true).ok_or_else(|| anyhow!("invalid app path"))?; + let mut urls_to_open = paths_to_open + .into_iter() + .map(|path| { + CFURL::from_path(&path, true).ok_or_else(|| anyhow!("{:?} is invalid", path)) + }) + .collect::>>()?; + + let server_url = format!("zed_cli_response://{server_name}"); + urls_to_open.push(CFURL::wrap_under_create_rule(CFURLCreateWithBytes( + ptr::null(), + server_url.as_ptr(), + server_url.len() as CFIndex, + kCFStringEncodingUTF8, + ptr::null(), + ))); + + let urls_to_open = CFArray::from_copyable( + &urls_to_open + .iter() + .map(|url| url.as_concrete_TypeRef()) + .collect::>(), + ); + LSOpenFromURLSpec( + &LSLaunchURLSpec { + appURL: app_url.as_concrete_TypeRef(), + itemURLs: urls_to_open.as_concrete_TypeRef(), + passThruParams: ptr::null(), + launchFlags: kLSLaunchDefaults, + asyncRefCon: ptr::null_mut(), + }, + ptr::null_mut(), + ) + }; + if status == 0 { + Ok(()) + } else { + Err(anyhow!("cannot start {:?}", app_path)) + } +} diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index c588cc50b2cb830b1a34a3c9b8b30aacd0b331f3..34047406a7028f610d5930caaca610839bf13601 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -22,7 +22,7 @@ async-std = { version = "1.8.0", features = ["attributes"] } async-trait = "0.1.50" async-tungstenite = "0.16" base64 = "0.13" -clap = "=3.0.0-beta.2" +clap = "3.1" comrak = "0.10" either = "1.6" envy = "0.4.2" diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index d8969e795753e5ff0d67feab2e47cd6d79360736..eeadd0c476244333d4a19490638e02ca13949566 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -94,6 +94,10 @@ unsafe fn build_classes() { sel!(application:openFiles:), open_files as extern "C" fn(&mut Object, Sel, id, id), ); + decl.add_method( + sel!(application:openURLs:), + open_urls as extern "C" fn(&mut Object, Sel, id, id), + ); decl.register() } } @@ -702,6 +706,30 @@ extern "C" fn open_files(this: &mut Object, _: Sel, _: id, paths: id) { } } +extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, paths: id) { + let paths = unsafe { + (0..paths.count()) + .into_iter() + .filter_map(|i| { + let path = paths.objectAtIndex(i); + match dbg!( + CStr::from_ptr(path.absoluteString().UTF8String() as *mut c_char).to_str() + ) { + Ok(string) => Some(PathBuf::from(string)), + Err(err) => { + log::error!("error converting path to string: {}", err); + None + } + } + }) + .collect::>() + }; + // let platform = unsafe { get_foreground_platform(this) }; + // if let Some(callback) = platform.0.borrow_mut().open_files.as_mut() { + // callback(paths); + // } +} + extern "C" fn handle_menu_item(this: &mut Object, _: Sel, item: id) { unsafe { let platform = get_foreground_platform(this); From 75f0326e54a10ee110118772eb765252b229a426 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 15 Apr 2022 17:33:56 -0600 Subject: [PATCH 224/245] Use ipc_channel crate to communicate between cli and app We still aren't handling CLI requests in the app, but this lays the foundation for bi-directional communication. Co-Authored-By: Max Brunsfeld --- Cargo.lock | 1 + crates/cli/Cargo.toml | 8 +++ crates/cli/src/cli.rs | 21 +++++++ crates/cli/src/main.rs | 74 +++++++++++------------- crates/gpui/src/app.rs | 20 ++++++- crates/gpui/src/platform.rs | 1 + crates/gpui/src/platform/mac/platform.rs | 23 +++++--- crates/gpui/src/platform/test.rs | 2 + crates/zed/Cargo.toml | 1 + crates/zed/src/main.rs | 35 ++++++++++- 10 files changed, 134 insertions(+), 52 deletions(-) create mode 100644 crates/cli/src/cli.rs diff --git a/Cargo.lock b/Cargo.lock index b0ca3b628c043702f51d52128e3aaf0c96b86313..69c75fef67d83ffe33ee2a5104c572ebf95ad33a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6344,6 +6344,7 @@ dependencies = [ "async-trait", "breadcrumbs", "chat_panel", + "cli", "client", "clock", "collections", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index ee4b01941848beea015046f7e780447d564adc0a..011ed9caa1eb4446fa4cf339e9d1af1904047a63 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -3,6 +3,14 @@ name = "cli" version = "0.1.0" edition = "2021" +[lib] +path = "src/cli.rs" +doctest = false + +[[bin]] +name = "cli" +path = "src/main.rs" + [dependencies] anyhow = "1.0" core-foundation = "0.9" diff --git a/crates/cli/src/cli.rs b/crates/cli/src/cli.rs new file mode 100644 index 0000000000000000000000000000000000000000..af7e78ea31bf62f1b301149f094e4540d9cc2522 --- /dev/null +++ b/crates/cli/src/cli.rs @@ -0,0 +1,21 @@ +pub use ipc_channel::ipc; +use serde::{Deserialize, Serialize}; +use std::path::PathBuf; + +#[derive(Serialize, Deserialize)] +pub struct IpcHandshake { + pub requests: ipc::IpcSender, + pub responses: ipc::IpcReceiver, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum CliRequest { + Open { paths: Vec, wait: bool }, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum CliResponse { + Stdout { message: String }, + Stderr { message: String }, + Exit { status: i32 }, +} diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index a8531125c2e5c3c826861dc5717963d1bb3ddd3c..2977f97ad38cda9f5b22f09dae06983c3711375a 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -1,14 +1,14 @@ use anyhow::{anyhow, Result}; use clap::Parser; +use cli::{CliRequest, CliResponse, IpcHandshake}; use core_foundation::{ array::{CFArray, CFIndex}, string::kCFStringEncodingUTF8, url::{CFURLCreateWithBytes, CFURL}, }; use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType}; -use ipc_channel::ipc::IpcOneShotServer; -use serde::{Deserialize, Serialize}; -use std::{path::PathBuf, process, ptr}; +use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender}; +use std::{fs, path::PathBuf, ptr}; #[derive(Parser)] #[clap(name = "zed")] @@ -21,61 +21,55 @@ struct Args { paths: Vec, } -#[derive(Serialize, Deserialize)] -struct OpenResult { - exit_status: i32, - stdout_message: Option, - stderr_message: Option, -} - fn main() -> Result<()> { let args = Args::parse(); - let (server, server_name) = IpcOneShotServer::::new()?; let app_path = locate_app()?; - launch_app(app_path, args.paths, server_name)?; + let (tx, rx) = launch_app(app_path)?; - let (_, result) = server.accept()?; - if let Some(message) = result.stdout_message { - println!("{}", message); - } - if let Some(message) = result.stderr_message { - eprintln!("{}", message); + tx.send(CliRequest::Open { + paths: args + .paths + .into_iter() + .map(|path| fs::canonicalize(path).map_err(|error| anyhow!(error))) + .collect::>>()?, + wait: false, + })?; + + while let Ok(response) = rx.recv() { + match response { + CliResponse::Stdout { message } => println!("{message}"), + CliResponse::Stderr { message } => eprintln!("{message}"), + CliResponse::Exit { status } => std::process::exit(status), + } } - process::exit(result.exit_status) + Ok(()) } fn locate_app() -> Result { - Ok("/Applications/Zed.app".into()) + Ok("/Users/nathan/src/zed/target/debug/bundle/osx/Zed.app".into()) + // Ok("/Applications/Zed.app".into()) } -fn launch_app(app_path: PathBuf, paths_to_open: Vec, server_name: String) -> Result<()> { +fn launch_app(app_path: PathBuf) -> Result<(IpcSender, IpcReceiver)> { + let (server, server_name) = IpcOneShotServer::::new()?; + let status = unsafe { let app_url = CFURL::from_path(&app_path, true).ok_or_else(|| anyhow!("invalid app path"))?; - let mut urls_to_open = paths_to_open - .into_iter() - .map(|path| { - CFURL::from_path(&path, true).ok_or_else(|| anyhow!("{:?} is invalid", path)) - }) - .collect::>>()?; - let server_url = format!("zed_cli_response://{server_name}"); - urls_to_open.push(CFURL::wrap_under_create_rule(CFURLCreateWithBytes( + let url = format!("zed-cli://{server_name}"); + let url_to_open = CFURL::wrap_under_create_rule(CFURLCreateWithBytes( ptr::null(), - server_url.as_ptr(), - server_url.len() as CFIndex, + url.as_ptr(), + url.len() as CFIndex, kCFStringEncodingUTF8, ptr::null(), - ))); + )); + + let urls_to_open = CFArray::from_copyable(&[url_to_open.as_concrete_TypeRef()]); - let urls_to_open = CFArray::from_copyable( - &urls_to_open - .iter() - .map(|url| url.as_concrete_TypeRef()) - .collect::>(), - ); LSOpenFromURLSpec( &LSLaunchURLSpec { appURL: app_url.as_concrete_TypeRef(), @@ -87,8 +81,10 @@ fn launch_app(app_path: PathBuf, paths_to_open: Vec, server_name: Strin ptr::null_mut(), ) }; + if status == 0 { - Ok(()) + let (_, handshake) = server.accept()?; + Ok((handshake.requests, handshake.responses)) } else { Err(anyhow!("cannot start {:?}", app_path)) } diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 683ea46999297e162ba8fa4228b6b9a917b290c0..57df8879f7a75780604a6658ed13bcf785c83aed 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -248,7 +248,7 @@ impl App { self } - pub fn on_quit(self, mut callback: F) -> Self + pub fn on_quit(&mut self, mut callback: F) -> &mut Self where F: 'static + FnMut(&mut MutableAppContext), { @@ -260,7 +260,7 @@ impl App { self } - pub fn on_event(self, mut callback: F) -> Self + pub fn on_event(&mut self, mut callback: F) -> &mut Self where F: 'static + FnMut(Event, &mut MutableAppContext) -> bool, { @@ -274,7 +274,7 @@ impl App { self } - pub fn on_open_files(self, mut callback: F) -> Self + pub fn on_open_files(&mut self, mut callback: F) -> &mut Self where F: 'static + FnMut(Vec, &mut MutableAppContext), { @@ -288,6 +288,20 @@ impl App { self } + pub fn on_open_urls(&mut self, mut callback: F) -> &mut Self + where + F: 'static + FnMut(Vec, &mut MutableAppContext), + { + let cx = self.0.clone(); + self.0 + .borrow_mut() + .foreground_platform + .on_open_urls(Box::new(move |paths| { + callback(paths, &mut *cx.borrow_mut()) + })); + self + } + pub fn run(self, on_finish_launching: F) where F: 'static + FnOnce(&mut MutableAppContext), diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 9abff5b0f79b0b73df9c07f34f7f6cb8f6b8a1cf..6d4215468ae77a6f10d97077dd45aabec76885a2 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -64,6 +64,7 @@ pub(crate) trait ForegroundPlatform { fn on_quit(&self, callback: Box); fn on_event(&self, callback: Box bool>); fn on_open_files(&self, callback: Box)>); + fn on_open_urls(&self, callback: Box)>); fn run(&self, on_finish_launching: Box ()>); fn on_menu_command(&self, callback: Box); diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index eeadd0c476244333d4a19490638e02ca13949566..813cf550d00ad1f01d9e21cb70451be99a268047 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -113,6 +113,7 @@ pub struct MacForegroundPlatformState { event: Option bool>>, menu_command: Option>, open_files: Option)>>, + open_urls: Option)>>, finish_launching: Option ()>>, menu_actions: Vec>, } @@ -218,6 +219,10 @@ impl platform::ForegroundPlatform for MacForegroundPlatform { self.0.borrow_mut().open_files = Some(callback); } + fn on_open_urls(&self, callback: Box)>) { + self.0.borrow_mut().open_urls = Some(callback); + } + fn run(&self, on_finish_launching: Box ()>) { self.0.borrow_mut().finish_launching = Some(on_finish_launching); @@ -706,16 +711,16 @@ extern "C" fn open_files(this: &mut Object, _: Sel, _: id, paths: id) { } } -extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, paths: id) { - let paths = unsafe { - (0..paths.count()) +extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, urls: id) { + let urls = unsafe { + (0..urls.count()) .into_iter() .filter_map(|i| { - let path = paths.objectAtIndex(i); + let path = urls.objectAtIndex(i); match dbg!( CStr::from_ptr(path.absoluteString().UTF8String() as *mut c_char).to_str() ) { - Ok(string) => Some(PathBuf::from(string)), + Ok(string) => Some(string.to_string()), Err(err) => { log::error!("error converting path to string: {}", err); None @@ -724,10 +729,10 @@ extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, paths: id) { }) .collect::>() }; - // let platform = unsafe { get_foreground_platform(this) }; - // if let Some(callback) = platform.0.borrow_mut().open_files.as_mut() { - // callback(paths); - // } + let platform = unsafe { get_foreground_platform(this) }; + if let Some(callback) = platform.0.borrow_mut().open_urls.as_mut() { + callback(urls); + } } extern "C" fn handle_menu_item(this: &mut Object, _: Sel, item: id) { diff --git a/crates/gpui/src/platform/test.rs b/crates/gpui/src/platform/test.rs index a18f52a4f60e5c89c3ea797e0aa626f814d23c84..e0dd3059fcf3504f9e577966476fa1b0d77d30ee 100644 --- a/crates/gpui/src/platform/test.rs +++ b/crates/gpui/src/platform/test.rs @@ -68,6 +68,8 @@ impl super::ForegroundPlatform for ForegroundPlatform { fn on_open_files(&self, _: Box)>) {} + fn on_open_urls(&self, _: Box)>) {} + fn run(&self, _on_finish_launching: Box ()>) { unimplemented!() } diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index b4ae84a4f3444abfac34bc8dd4ceacda4a04b9c1..d327acb17343b7e3749e3dae9262d4ba4da582ca 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -32,6 +32,7 @@ test-support = [ assets = { path = "../assets" } breadcrumbs = { path = "../breadcrumbs" } chat_panel = { path = "../chat_panel" } +cli = { path = "../cli" } collections = { path = "../collections" } command_palette = { path = "../command_palette" } client = { path = "../client" } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index cead3ac39040f2371ed8e3d3908820b1bf1d0afb..a70473087eae4de9bb1dccae84be08db53879455 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -3,6 +3,7 @@ use anyhow::{anyhow, Context, Result}; use assets::Assets; +use cli::{ipc, CliRequest, CliResponse, IpcHandshake}; use client::{self, http, ChannelList, UserStore}; use fs::OpenOptions; use futures::{channel::oneshot, StreamExt}; @@ -26,7 +27,7 @@ use zed::{ fn main() { init_logger(); - let app = gpui::App::new(Assets).unwrap(); + let mut app = gpui::App::new(Assets).unwrap(); load_embedded_fonts(&app); let fs = Arc::new(RealFs); @@ -87,6 +88,12 @@ fn main() { }) }; + app.on_open_urls(|urls, _| { + if let Some(server_name) = urls.first().and_then(|url| url.strip_prefix("zed-cli://")) { + connect_to_cli(server_name).log_err(); + } + }); + app.run(move |cx| { let http = http::client(); let client = client::Client::new(http.clone()); @@ -292,3 +299,29 @@ fn load_config_files( .detach(); rx } + +fn connect_to_cli(server_name: &str) -> Result<()> { + let handshake_tx = cli::ipc::IpcSender::::connect(server_name.to_string()) + .context("error connecting to cli")?; + let (request_tx, request_rx) = ipc::channel::()?; + let (response_tx, response_rx) = ipc::channel::()?; + + handshake_tx + .send(IpcHandshake { + requests: request_tx, + responses: response_rx, + }) + .context("error sending ipc handshake")?; + + std::thread::spawn(move || { + while let Ok(cli_request) = request_rx.recv() { + log::info!("{cli_request:?}"); + response_tx.send(CliResponse::Stdout { + message: "Hi, CLI!".into(), + })?; + response_tx.send(CliResponse::Exit { status: 0 })?; + } + Ok::<_, anyhow::Error>(()) + }); + Ok(()) +} From 05c44b9414751933cd748ddd4a211e5911c04b9f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 15 Apr 2022 18:06:40 -0600 Subject: [PATCH 225/245] Process incoming CLI requests on the main thread --- crates/zed/src/main.rs | 59 ++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index a70473087eae4de9bb1dccae84be08db53879455..03ceef3a4387e743309db96c0ab9ee0efe1651f1 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -3,17 +3,23 @@ use anyhow::{anyhow, Context, Result}; use assets::Assets; -use cli::{ipc, CliRequest, CliResponse, IpcHandshake}; +use cli::{ + ipc::{self, IpcSender}, + CliRequest, CliResponse, IpcHandshake, +}; use client::{self, http, ChannelList, UserStore}; use fs::OpenOptions; -use futures::{channel::oneshot, StreamExt}; +use futures::{ + channel::{mpsc, oneshot}, + SinkExt, StreamExt, +}; use gpui::{App, AssetSource, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; use settings::{self, KeymapFile, Settings, SettingsFileContent}; use smol::process::Command; -use std::{env, fs, path::PathBuf, sync::Arc}; +use std::{env, fs, path::PathBuf, sync::Arc, thread}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; use workspace::{self, AppState, OpenNew, OpenPaths}; @@ -88,9 +94,33 @@ fn main() { }) }; - app.on_open_urls(|urls, _| { + app.on_open_urls(|urls, cx| { if let Some(server_name) = urls.first().and_then(|url| url.strip_prefix("zed-cli://")) { - connect_to_cli(server_name).log_err(); + if let Some((mut requests, responses)) = connect_to_cli(server_name).log_err() { + cx.spawn(|_| async move { + for request in requests.next().await { + match request { + CliRequest::Open { paths, wait } => { + if wait { + todo!(); + } + + log::info!("open paths {:?}", paths); + responses + .send(CliResponse::Stdout { + message: "Hello CLI!".to_string(), + }) + .log_err(); + responses.send(CliResponse::Exit { status: 0 }).log_err(); + + // TODO... get rid of AppState so we can do this here? + // cx.update(|cx| open_paths(&paths, app_state, cx)); + } + } + } + }) + .detach(); + }; } }); @@ -300,7 +330,9 @@ fn load_config_files( rx } -fn connect_to_cli(server_name: &str) -> Result<()> { +fn connect_to_cli( + server_name: &str, +) -> Result<(mpsc::Receiver, IpcSender)> { let handshake_tx = cli::ipc::IpcSender::::connect(server_name.to_string()) .context("error connecting to cli")?; let (request_tx, request_rx) = ipc::channel::()?; @@ -313,15 +345,16 @@ fn connect_to_cli(server_name: &str) -> Result<()> { }) .context("error sending ipc handshake")?; - std::thread::spawn(move || { + let (mut async_request_tx, async_request_rx) = + futures::channel::mpsc::channel::(16); + thread::spawn(move || { while let Ok(cli_request) = request_rx.recv() { - log::info!("{cli_request:?}"); - response_tx.send(CliResponse::Stdout { - message: "Hi, CLI!".into(), - })?; - response_tx.send(CliResponse::Exit { status: 0 })?; + if smol::block_on(async_request_tx.send(cli_request)).is_err() { + break; + } } Ok::<_, anyhow::Error>(()) }); - Ok(()) + + Ok((async_request_rx, response_tx)) } From 43763fa2f86ed3b85a3e47ad2ac7e6d8369857f4 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 11:32:46 -0700 Subject: [PATCH 226/245] Allow opening paths from the CLI Co-Authored-By: Antonio Scandurra --- Cargo.lock | 1 + crates/cli/Cargo.toml | 1 + crates/cli/src/main.rs | 6 ++-- crates/zed/src/main.rs | 73 ++++++++++++++++++++++++------------------ 4 files changed, 47 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 69c75fef67d83ffe33ee2a5104c572ebf95ad33a..05382c74ee3ac29c87cd9d1da31aafd0f81b136d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1000,6 +1000,7 @@ dependencies = [ "clap 3.1.8", "core-foundation", "core-services", + "dirs 3.0.1", "ipc-channel", "serde", ] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 011ed9caa1eb4446fa4cf339e9d1af1904047a63..367db26c8cceac47b16a9a6c9bfb0b5fcd60e0c0 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -16,5 +16,6 @@ anyhow = "1.0" core-foundation = "0.9" core-services = "0.2" clap = { version = "3.1", features = ["derive"] } +dirs = "3.0" ipc-channel = "0.16" serde = { version = "1.0", features = ["derive"] } \ No newline at end of file diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 2977f97ad38cda9f5b22f09dae06983c3711375a..6620f3d08b7703fcf96a14892f19bf4458ffcb65 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -48,8 +48,10 @@ fn main() -> Result<()> { } fn locate_app() -> Result { - Ok("/Users/nathan/src/zed/target/debug/bundle/osx/Zed.app".into()) - // Ok("/Applications/Zed.app".into()) + Ok(std::env::current_exe()? + .parent() + .unwrap() + .join("bundle/osx/Zed.app")) } fn launch_app(app_path: PathBuf) -> Result<(IpcSender, IpcReceiver)> { diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 03ceef3a4387e743309db96c0ab9ee0efe1651f1..6a6dc5ef498e793ce224f2f9d557243f9d05a441 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -13,7 +13,7 @@ use futures::{ channel::{mpsc, oneshot}, SinkExt, StreamExt, }; -use gpui::{App, AssetSource, Task}; +use gpui::{App, AssetSource, AsyncAppContext, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; @@ -94,32 +94,14 @@ fn main() { }) }; - app.on_open_urls(|urls, cx| { + let (cli_connections_tx, mut cli_connections_rx) = mpsc::unbounded(); + app.on_open_urls(move |urls, _| { if let Some(server_name) = urls.first().and_then(|url| url.strip_prefix("zed-cli://")) { - if let Some((mut requests, responses)) = connect_to_cli(server_name).log_err() { - cx.spawn(|_| async move { - for request in requests.next().await { - match request { - CliRequest::Open { paths, wait } => { - if wait { - todo!(); - } - - log::info!("open paths {:?}", paths); - responses - .send(CliResponse::Stdout { - message: "Hello CLI!".to_string(), - }) - .log_err(); - responses.send(CliResponse::Exit { status: 0 }).log_err(); - - // TODO... get rid of AppState so we can do this here? - // cx.update(|cx| open_paths(&paths, app_state, cx)); - } - } - } - }) - .detach(); + if let Some(cli_connection) = connect_to_cli(server_name).log_err() { + cli_connections_tx + .unbounded_send(cli_connection) + .map_err(|_| anyhow!("no listener for cli connections")) + .log_err(); }; } }); @@ -207,13 +189,25 @@ fn main() { if stdout_is_a_pty() { cx.platform().activate(true); - } - - let paths = collect_path_args(); - if paths.is_empty() { - cx.dispatch_global_action(OpenNew(app_state.clone())); + let paths = collect_path_args(); + if paths.is_empty() { + cx.dispatch_global_action(OpenNew(app_state.clone())); + } else { + cx.dispatch_global_action(OpenPaths { paths, app_state }); + } } else { - cx.dispatch_global_action(OpenPaths { paths, app_state }); + if let Ok(Some(connection)) = cli_connections_rx.try_next() { + cx.spawn(|cx| handle_cli_connection(connection, app_state.clone(), cx)) + .detach(); + } else { + cx.dispatch_global_action(OpenNew(app_state.clone())); + } + cx.spawn(|cx| async move { + while let Some(connection) = cli_connections_rx.next().await { + handle_cli_connection(connection, app_state.clone(), cx.clone()).await; + } + }) + .detach(); } }); } @@ -358,3 +352,18 @@ fn connect_to_cli( Ok((async_request_rx, response_tx)) } + +async fn handle_cli_connection( + (mut requests, responses): (mpsc::Receiver, IpcSender), + app_state: Arc, + mut cx: AsyncAppContext, +) { + if let Some(request) = requests.next().await { + match request { + CliRequest::Open { paths, .. } => { + cx.update(|cx| cx.dispatch_global_action(OpenPaths { paths, app_state })); + responses.send(CliResponse::Exit { status: 0 }).log_err(); + } + } + } +} From a81f7ebbf65946566e627f8fb935c12d2de66cfd Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 13:42:33 -0700 Subject: [PATCH 227/245] Locate the Zed app from the CLI using NSWorkspace API --- Cargo.lock | 2 ++ crates/cli/Cargo.toml | 10 +++++++--- crates/cli/src/main.rs | 43 +++++++++++++++++++++++++++++++++--------- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 05382c74ee3ac29c87cd9d1da31aafd0f81b136d..79ce44125864200d4d76a1189abd7297b95ca94d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -998,10 +998,12 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 3.1.8", + "cocoa", "core-foundation", "core-services", "dirs 3.0.1", "ipc-channel", + "objc", "serde", ] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 367db26c8cceac47b16a9a6c9bfb0b5fcd60e0c0..be58523140b293bcc74d18c2ace6e6b6fa70d507 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -13,9 +13,13 @@ path = "src/main.rs" [dependencies] anyhow = "1.0" -core-foundation = "0.9" -core-services = "0.2" clap = { version = "3.1", features = ["derive"] } dirs = "3.0" ipc-channel = "0.16" -serde = { version = "1.0", features = ["derive"] } \ No newline at end of file +serde = { version = "1.0", features = ["derive"] } + +[target.'cfg(target_os = "macos")'.dependencies] +cocoa = "0.24" +core-foundation = "0.9" +core-services = "0.2" +objc = "0.2" \ No newline at end of file diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 6620f3d08b7703fcf96a14892f19bf4458ffcb65..159462fe574ce2643d3ddff39b0d5270ea15de89 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -8,7 +8,8 @@ use core_foundation::{ }; use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType}; use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender}; -use std::{fs, path::PathBuf, ptr}; +use objc::{class, msg_send, sel, sel_impl}; +use std::{ffi::CStr, fs, path::PathBuf, ptr}; #[derive(Parser)] #[clap(name = "zed")] @@ -48,20 +49,46 @@ fn main() -> Result<()> { } fn locate_app() -> Result { - Ok(std::env::current_exe()? - .parent() - .unwrap() - .join("bundle/osx/Zed.app")) + if cfg!(debug_assertions) { + Ok(std::env::current_exe()? + .parent() + .unwrap() + .join("bundle/osx/Zed.app")) + } else { + Ok(path_to_app_with_bundle_identifier("dev.zed.Zed") + .unwrap_or_else(|| "/Applications/Zed.dev".into())) + } +} + +fn path_to_app_with_bundle_identifier(bundle_id: &str) -> Option { + use cocoa::{ + base::{id, nil}, + foundation::{NSString, NSURL as _}, + }; + + unsafe { + let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace]; + let bundle_id = NSString::alloc(nil).init_str(bundle_id); + let app_url: id = msg_send![workspace, URLForApplicationWithBundleIdentifier: bundle_id]; + if !app_url.is_null() { + Some(PathBuf::from( + CStr::from_ptr(app_url.path().UTF8String()) + .to_string_lossy() + .to_string(), + )) + } else { + None + } + } } fn launch_app(app_path: PathBuf) -> Result<(IpcSender, IpcReceiver)> { let (server, server_name) = IpcOneShotServer::::new()?; + let url = format!("zed-cli://{server_name}"); let status = unsafe { let app_url = CFURL::from_path(&app_path, true).ok_or_else(|| anyhow!("invalid app path"))?; - - let url = format!("zed-cli://{server_name}"); let url_to_open = CFURL::wrap_under_create_rule(CFURLCreateWithBytes( ptr::null(), url.as_ptr(), @@ -69,9 +96,7 @@ fn launch_app(app_path: PathBuf) -> Result<(IpcSender, IpcReceiver Date: Tue, 19 Apr 2022 14:19:22 -0700 Subject: [PATCH 228/245] Update bundle script to include fat CLI binary --- script/bundle | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/script/bundle b/script/bundle index bcaa68c1e9c04c9d6aaa7379a5b2de5e82920a93..fc6bab355f4cdf2a4a61b8d9e92638d76f2af952 100755 --- a/script/bundle +++ b/script/bundle @@ -4,24 +4,33 @@ set -e export ZED_BUNDLE=true -# Install cargo-bundle 0.5.0 if it's not already installed +echo "Installing cargo bundle" cargo install cargo-bundle --version 0.5.0 # Deal with versions of macOS that don't include libstdc++ headers export CXXFLAGS="-stdlib=libc++" -# Build the app bundle for x86_64 -pushd crates/zed > /dev/null -cargo bundle --release --target x86_64-apple-darwin -popd > /dev/null +echo "Compiling binaries" +cargo build --release --package zed --target aarch64-apple-darwin +cargo build --release --package zed --target x86_64-apple-darwin +cargo build --release --package cli --target aarch64-apple-darwin +cargo build --release --package cli --target x86_64-apple-darwin -# Build the binary for aarch64 (Apple M1) -cargo build --release --target aarch64-apple-darwin +echo "Creating application bundle" +(cd crates/zed && cargo bundle --release --target x86_64-apple-darwin) -# Replace the bundle's binary with a "fat binary" that combines the two architecture-specific binaries -lipo -create target/x86_64-apple-darwin/release/Zed target/aarch64-apple-darwin/release/Zed -output target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/zed +echo "Creating fat binaries" +lipo \ + -create \ + target/{x86_64-apple-darwin,aarch64-apple-darwin}/release/Zed \ + -output \ + target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/zed +lipo \ + -create \ + target/{x86_64-apple-darwin,aarch64-apple-darwin}/release/cli \ + -output \ + target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/cli -# Sign the app bundle with an ad-hoc signature so it runs on the M1. We need a real certificate but this works for now. if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then echo "Signing bundle with Apple-issued certificate" security create-keychain -p $MACOS_CERTIFICATE_PASSWORD zed.keychain || echo "" @@ -39,7 +48,6 @@ else codesign --force --deep --sign - target/x86_64-apple-darwin/release/bundle/osx/Zed.app -v fi -# Create a DMG echo "Creating DMG" mkdir -p target/release hdiutil create -volname Zed -srcfolder target/x86_64-apple-darwin/release/bundle/osx -ov -format UDZO target/release/Zed.dmg From eee1cec3d4f58b50728ecf5d99c3583d3ac2ae1f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 14:34:01 -0700 Subject: [PATCH 229/245] :art: Remove unnecessary JoinProjectParams struct --- crates/contacts_panel/src/contacts_panel.rs | 9 ++++----- crates/workspace/src/workspace.rs | 13 +++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/crates/contacts_panel/src/contacts_panel.rs b/crates/contacts_panel/src/contacts_panel.rs index deb6f8e4a32919270342d420e8006da510d79fc4..45b5f69b5e2efea846b6ae49716777ea9ae0b7a1 100644 --- a/crates/contacts_panel/src/contacts_panel.rs +++ b/crates/contacts_panel/src/contacts_panel.rs @@ -1,5 +1,3 @@ -use std::sync::Arc; - use client::{Contact, UserStore}; use gpui::{ elements::*, @@ -8,8 +6,9 @@ use gpui::{ Element, ElementBox, Entity, LayoutContext, ModelHandle, RenderContext, Subscription, View, ViewContext, }; -use workspace::{AppState, JoinProject, JoinProjectParams}; use settings::Settings; +use std::sync::Arc; +use workspace::{AppState, JoinProject}; pub struct ContactsPanel { contacts: ListState, @@ -207,10 +206,10 @@ impl ContactsPanel { }) .on_click(move |cx| { if !is_host && !is_guest { - cx.dispatch_global_action(JoinProject(JoinProjectParams { + cx.dispatch_global_action(JoinProject { project_id, app_state: app_state.clone(), - })); + }); } }) .flex(1., true) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index c73a6bab5b335d9cb2fd50b6dc9ba2bc28f32f9f..cfff617ff4d8c789af05afe0f9b7350a8045ba7a 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -97,7 +97,10 @@ pub struct OpenPaths { pub struct ToggleFollow(pub PeerId); #[derive(Clone)] -pub struct JoinProject(pub JoinProjectParams); +pub struct JoinProject { + pub project_id: u64, + pub app_state: Arc, +} impl_internal_actions!( workspace, @@ -115,7 +118,7 @@ pub fn init(client: &Arc, cx: &mut MutableAppContext) { open_new(&action.0, cx) }); cx.add_global_action(move |action: &JoinProject, cx: &mut MutableAppContext| { - join_project(action.0.project_id, &action.0.app_state, cx).detach(); + join_project(action.project_id, &action.app_state, cx).detach(); }); cx.add_action(Workspace::toggle_share); @@ -187,12 +190,6 @@ pub struct AppState { ) -> Workspace, } -#[derive(Clone)] -pub struct JoinProjectParams { - pub project_id: u64, - pub app_state: Arc, -} - pub trait Item: View { fn deactivated(&mut self, _: &mut ViewContext) {} fn navigate(&mut self, _: Box, _: &mut ViewContext) -> bool { From fbd1afc51f22ce22a7c4ad294f8ff4b9c40d70ac Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 16:15:00 -0700 Subject: [PATCH 230/245] Add a command for installing the CLI --- crates/gpui/src/platform.rs | 3 +- crates/gpui/src/platform/mac/platform.rs | 66 +++++++++++------------- crates/gpui/src/platform/test.rs | 2 +- crates/zed/src/zed.rs | 17 +++++- 4 files changed, 49 insertions(+), 39 deletions(-) diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 6d4215468ae77a6f10d97077dd45aabec76885a2..b4f77df1eb9f40fd3267c3b0d265755880d62f2b 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -54,8 +54,7 @@ pub trait Platform: Send + Sync { fn set_cursor_style(&self, style: CursorStyle); fn local_timezone(&self) -> UtcOffset; - - fn path_for_resource(&self, name: Option<&str>, extension: Option<&str>) -> Result; + fn path_for_auxiliary_executable(&self, name: &str) -> Result; } pub(crate) trait ForegroundPlatform { diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index 813cf550d00ad1f01d9e21cb70451be99a268047..5789b2f61146d26058bf78217b6c26e8c25a14e3 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -14,9 +14,7 @@ use cocoa::{ NSPasteboardTypeString, NSSavePanel, NSWindow, }, base::{id, nil, selector, YES}, - foundation::{ - NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSString, NSUInteger, NSURL, - }, + foundation::{NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSString, NSURL}, }; use core_foundation::{ base::{CFType, CFTypeRef, OSStatus, TCFType as _}, @@ -38,8 +36,8 @@ use ptr::null_mut; use std::{ cell::{Cell, RefCell}, convert::TryInto, - ffi::{c_void, CStr}, - os::raw::c_char, + ffi::{c_void, CStr, OsStr}, + os::{raw::c_char, unix::ffi::OsStrExt}, path::{Path, PathBuf}, ptr, rc::Rc, @@ -48,9 +46,6 @@ use std::{ }; use time::UtcOffset; -#[allow(non_upper_case_globals)] -const NSUTF8StringEncoding: NSUInteger = 4; - const MAC_PLATFORM_IVAR: &'static str = "platform"; static mut APP_CLASS: *const Class = ptr::null(); static mut APP_DELEGATE_CLASS: *const Class = ptr::null(); @@ -274,10 +269,9 @@ impl platform::ForegroundPlatform for MacForegroundPlatform { for i in 0..urls.count() { let url = urls.objectAtIndex(i); if url.isFileURL() == YES { - let path = std::ffi::CStr::from_ptr(url.path().UTF8String()) - .to_string_lossy() - .to_string(); - result.push(PathBuf::from(path)); + if let Ok(path) = ns_url_to_path(url) { + result.push(path) + } } } Some(result) @@ -305,19 +299,13 @@ impl platform::ForegroundPlatform for MacForegroundPlatform { let (done_tx, done_rx) = oneshot::channel(); let done_tx = Cell::new(Some(done_tx)); let block = ConcreteBlock::new(move |response: NSModalResponse| { - let result = if response == NSModalResponse::NSModalResponseOk { + let mut result = None; + if response == NSModalResponse::NSModalResponseOk { let url = panel.URL(); if url.isFileURL() == YES { - let path = std::ffi::CStr::from_ptr(url.path().UTF8String()) - .to_string_lossy() - .to_string(); - Some(PathBuf::from(path)) - } else { - None + result = ns_url_to_path(panel.URL()).ok() } - } else { - None - }; + } if let Some(mut done_tx) = done_tx.take() { let _ = postage::sink::Sink::try_send(&mut done_tx, result); @@ -612,22 +600,18 @@ impl platform::Platform for MacPlatform { } } - fn path_for_resource(&self, name: Option<&str>, extension: Option<&str>) -> Result { + fn path_for_auxiliary_executable(&self, name: &str) -> Result { unsafe { let bundle: id = NSBundle::mainBundle(); if bundle.is_null() { Err(anyhow!("app is not running inside a bundle")) } else { - let name = name.map_or(nil, |name| ns_string(name)); - let extension = extension.map_or(nil, |extension| ns_string(extension)); - let path: id = msg_send![bundle, pathForResource: name ofType: extension]; - if path.is_null() { - Err(anyhow!("resource could not be found")) + let name = ns_string(name); + let url: id = msg_send![bundle, URLForAuxiliaryExecutable: name]; + if url.is_null() { + Err(anyhow!("resource not found")) } else { - let len = msg_send![path, lengthOfBytesUsingEncoding: NSUTF8StringEncoding]; - let bytes = path.UTF8String() as *const u8; - let path = str::from_utf8(slice::from_raw_parts(bytes, len)).unwrap(); - Ok(PathBuf::from(path)) + ns_url_to_path(url) } } } @@ -717,9 +701,7 @@ extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, urls: id) { .into_iter() .filter_map(|i| { let path = urls.objectAtIndex(i); - match dbg!( - CStr::from_ptr(path.absoluteString().UTF8String() as *mut c_char).to_str() - ) { + match CStr::from_ptr(path.absoluteString().UTF8String() as *mut c_char).to_str() { Ok(string) => Some(string.to_string()), Err(err) => { log::error!("error converting path to string: {}", err); @@ -754,6 +736,20 @@ unsafe fn ns_string(string: &str) -> id { NSString::alloc(nil).init_str(string).autorelease() } +unsafe fn ns_url_to_path(url: id) -> Result { + let path: *mut c_char = msg_send![url, fileSystemRepresentation]; + if path.is_null() { + Err(anyhow!( + "url is not a file path: {}", + CStr::from_ptr(url.absoluteString().UTF8String()).to_string_lossy() + )) + } else { + Ok(PathBuf::from(OsStr::from_bytes( + CStr::from_ptr(path).to_bytes(), + ))) + } +} + mod security { #![allow(non_upper_case_globals)] use super::*; diff --git a/crates/gpui/src/platform/test.rs b/crates/gpui/src/platform/test.rs index e0dd3059fcf3504f9e577966476fa1b0d77d30ee..296d4ea90da676c7f5b301deccb5a5f9b09b9a8b 100644 --- a/crates/gpui/src/platform/test.rs +++ b/crates/gpui/src/platform/test.rs @@ -163,7 +163,7 @@ impl super::Platform for Platform { UtcOffset::UTC } - fn path_for_resource(&self, _name: Option<&str>, _extension: Option<&str>) -> Result { + fn path_for_auxiliary_executable(&self, _name: &str) -> Result { Err(anyhow!("app not running inside a bundle")) } } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index e9ed88655798adf391e39554b38fafa9bf9a43e1..439b3e63ee44d6157c0091973e4e517d64aecd69 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -38,7 +38,8 @@ actions!( DebugElements, OpenSettings, IncreaseBufferFontSize, - DecreaseBufferFontSize + DecreaseBufferFontSize, + InstallCommandLineTool, ] ); @@ -66,6 +67,20 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { cx.refresh_windows(); }); }); + cx.add_global_action(move |_: &InstallCommandLineTool, cx| { + cx.spawn(|cx| async move { + let path = cx.platform().path_for_auxiliary_executable("cli")?; + let link_path = "/usr/local/bin/zed"; + smol::fs::unix::symlink(link_path, path.as_path()).await?; + log::info!( + "created symlink {} -> {}", + link_path, + path.to_string_lossy() + ); + Ok::<_, anyhow::Error>(()) + }) + .detach(); + }); cx.add_action({ let app_state = app_state.clone(); move |_: &mut Workspace, _: &OpenSettings, cx: &mut ViewContext| { From 0d9a0e2cbe3c16afa6436326ae0dfc94430c05ab Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 19 Apr 2022 17:00:41 -0700 Subject: [PATCH 231/245] Avoid permissions error when installing CLI symlink --- crates/zed/src/zed.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 439b3e63ee44d6157c0091973e4e517d64aecd69..caecfd5a929aa125995ff261cac7515050a9c23a 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -4,6 +4,7 @@ pub mod settings_file; #[cfg(any(test, feature = "test-support"))] pub mod test; +use anyhow::Context; use breadcrumbs::Breadcrumbs; use chat_panel::ChatPanel; pub use client; @@ -69,15 +70,22 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { }); cx.add_global_action(move |_: &InstallCommandLineTool, cx| { cx.spawn(|cx| async move { - let path = cx.platform().path_for_auxiliary_executable("cli")?; - let link_path = "/usr/local/bin/zed"; - smol::fs::unix::symlink(link_path, path.as_path()).await?; + log::info!("installing command line launcher"); + let cli_path = cx + .platform() + .path_for_auxiliary_executable("cli") + .log_err()?; + let link_path = "/opt/homebrew/bin/zed"; + smol::fs::unix::symlink(cli_path.as_path(), link_path) + .await + .context("failed to install cli symlink") + .log_err()?; log::info!( "created symlink {} -> {}", link_path, - path.to_string_lossy() + cli_path.to_string_lossy() ); - Ok::<_, anyhow::Error>(()) + Some(()) }) .detach(); }); From b3f2b7a92cb66bfc2f407a1369c0fb52b65f7cc4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 10:22:20 +0200 Subject: [PATCH 232/245] Use osascript to escalate privileges and copy the CLI to /usr/local/bin --- crates/zed/src/zed.rs | 78 +++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index caecfd5a929aa125995ff261cac7515050a9c23a..53a0875248111b892fc9f8d531ff136f6906780d 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -4,7 +4,7 @@ pub mod settings_file; #[cfg(any(test, feature = "test-support"))] pub mod test; -use anyhow::Context; +use anyhow::{anyhow, Context, Result}; use breadcrumbs::Breadcrumbs; use chat_panel::ChatPanel; pub use client; @@ -16,7 +16,7 @@ use gpui::{ actions, geometry::vector::vec2f, platform::{WindowBounds, WindowOptions}, - ModelHandle, ViewContext, + AsyncAppContext, ModelHandle, ViewContext, }; use lazy_static::lazy_static; pub use lsp; @@ -26,7 +26,10 @@ use project_panel::ProjectPanel; use search::{BufferSearchBar, ProjectSearchBar}; use serde_json::to_string_pretty; use settings::Settings; -use std::{path::PathBuf, sync::Arc}; +use std::{ + path::{Path, PathBuf}, + sync::Arc, +}; use util::ResultExt; pub use workspace; use workspace::{AppState, Workspace, WorkspaceParams}; @@ -69,25 +72,8 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { }); }); cx.add_global_action(move |_: &InstallCommandLineTool, cx| { - cx.spawn(|cx| async move { - log::info!("installing command line launcher"); - let cli_path = cx - .platform() - .path_for_auxiliary_executable("cli") - .log_err()?; - let link_path = "/opt/homebrew/bin/zed"; - smol::fs::unix::symlink(cli_path.as_path(), link_path) - .await - .context("failed to install cli symlink") - .log_err()?; - log::info!( - "created symlink {} -> {}", - link_path, - cli_path.to_string_lossy() - ); - Some(()) - }) - .detach(); + cx.spawn(|cx| async move { install_cli(&cx).await.context("error creating CLI symlink") }) + .detach_and_log_err(cx); }); cx.add_action({ let app_state = app_state.clone(); @@ -253,6 +239,54 @@ fn quit(_: &Quit, cx: &mut gpui::MutableAppContext) { cx.platform().quit(); } +async fn install_cli(cx: &AsyncAppContext) -> Result<()> { + let cli_path = cx.platform().path_for_auxiliary_executable("cli")?; + let link_path = Path::new("/usr/local/bin/zed"); + let bin_dir_path = link_path.parent().unwrap(); + + // Don't re-create symlink if it points to the same CLI binary. + if smol::fs::read_link(link_path).await.ok().as_ref() == Some(&cli_path) { + return Ok(()); + } + + // If the symlink is not there or is outdated, first try replacing it + // without escalating. + smol::fs::remove_file(link_path).await.log_err(); + if smol::fs::unix::symlink(&cli_path, link_path) + .await + .log_err() + .is_some() + { + return Ok(()); + } + + // The symlink could not be created, so use osascript with admin privileges + // to create it. + let status = smol::process::Command::new("osascript") + .args([ + "-e", + &dbg!(format!( + "do shell script \" \ + mkdir -p \'{}\' && \ + ln -sf \'{}\' \'{}\' \ + \" with administrator privileges", + bin_dir_path.to_string_lossy(), + cli_path.to_string_lossy(), + link_path.to_string_lossy(), + )), + ]) + .stdout(smol::process::Stdio::inherit()) + .stderr(smol::process::Stdio::inherit()) + .output() + .await? + .status; + if status.success() { + Ok(()) + } else { + Err(anyhow!("error running osascript")) + } +} + #[cfg(test)] mod tests { use super::*; From b013b1ba5d350713a8b1a2d8597f9b15aafc7ad9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 10:42:09 +0200 Subject: [PATCH 233/245] Call `language::init_test` in `test_single_file_worktrees_diagnostics` --- crates/project/src/project.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 5c1064400edbd0c411a71b536e2932f7fbe9291f..e72ca7ac92f12bc1fb3849798e92baaaaa2e3f91 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -5337,6 +5337,7 @@ mod tests { #[gpui::test] async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) { cx.foreground().forbid_parking(); + language::init_test(cx); let fs = FakeFs::new(cx.background()); fs.insert_tree( From f7055c2accb22fbba4397afd0d194206d482902b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 12:54:34 +0200 Subject: [PATCH 234/245] Implement `zed --wait` --- crates/cli/src/cli.rs | 1 + crates/cli/src/main.rs | 3 +- crates/gpui/src/app.rs | 8 ++-- crates/journal/src/journal.rs | 2 +- crates/workspace/src/workspace.rs | 80 ++++++++++++++++++------------- crates/zed/src/main.rs | 80 +++++++++++++++++++++++++++++-- 6 files changed, 131 insertions(+), 43 deletions(-) diff --git a/crates/cli/src/cli.rs b/crates/cli/src/cli.rs index af7e78ea31bf62f1b301149f094e4540d9cc2522..7cad42b534c6022a8dbe01139a6147a84a30572a 100644 --- a/crates/cli/src/cli.rs +++ b/crates/cli/src/cli.rs @@ -15,6 +15,7 @@ pub enum CliRequest { #[derive(Debug, Serialize, Deserialize)] pub enum CliResponse { + Ping, Stdout { message: String }, Stderr { message: String }, Exit { status: i32 }, diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 159462fe574ce2643d3ddff39b0d5270ea15de89..9aac438724849bd7fbbdf5a8859070879495c2c2 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -34,11 +34,12 @@ fn main() -> Result<()> { .into_iter() .map(|path| fs::canonicalize(path).map_err(|error| anyhow!(error))) .collect::>>()?, - wait: false, + wait: args.wait, })?; while let Ok(response) = rx.recv() { match response { + CliResponse::Ping => {} CliResponse::Stdout { message } => println!("{message}"), CliResponse::Stderr { message } => eprintln!("{message}"), CliResponse::Exit { status } => std::process::exit(status), diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 57df8879f7a75780604a6658ed13bcf785c83aed..0f9a3041b312ffb2b9adf0d8c38b152f8be7bf17 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -733,7 +733,7 @@ type GlobalSubscriptionCallback = Box bool>; type FocusObservationCallback = Box bool>; type GlobalObservationCallback = Box; -type ReleaseObservationCallback = Box; +type ReleaseObservationCallback = Box; type DeserializeActionCallback = fn(json: &str) -> anyhow::Result>; pub struct MutableAppContext { @@ -1259,12 +1259,12 @@ impl MutableAppContext { } } - pub fn observe_release(&mut self, handle: &H, mut callback: F) -> Subscription + pub fn observe_release(&mut self, handle: &H, callback: F) -> Subscription where E: Entity, E::Event: 'static, H: Handle, - F: 'static + FnMut(&E, &mut Self), + F: 'static + FnOnce(&E, &mut Self), { let id = post_inc(&mut self.next_subscription_id); self.release_observations @@ -2211,7 +2211,7 @@ impl MutableAppContext { fn handle_entity_release_effect(&mut self, entity_id: usize, entity: &dyn Any) { let callbacks = self.release_observations.lock().remove(&entity_id); if let Some(callbacks) = callbacks { - for (_, mut callback) in callbacks { + for (_, callback) in callbacks { callback(entity, self); } } diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 910c2947b428994b347494f67ff69aca88407648..7aa8be4d973859dd5fc57d3af1d3592dfa591c74 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -43,7 +43,7 @@ pub fn new_journal_entry(app_state: Arc, cx: &mut MutableAppContext) { cx.spawn(|mut cx| { async move { let (journal_dir, entry_path) = create_entry.await?; - let workspace = cx + let (workspace, _) = cx .update(|cx| workspace::open_paths(&[journal_dir], &app_state, cx)) .await; diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index cfff617ff4d8c789af05afe0f9b7350a8045ba7a..62a79ff706474d97c86bc3b31a87060ce65be4d4 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -376,6 +376,11 @@ pub trait ItemHandle: 'static + fmt::Debug { -> Task>; fn act_as_type(&self, type_id: TypeId, cx: &AppContext) -> Option; fn to_followable_item_handle(&self, cx: &AppContext) -> Option>; + fn on_release( + &self, + cx: &mut MutableAppContext, + callback: Box, + ) -> gpui::Subscription; } pub trait WeakItemHandle { @@ -411,17 +416,17 @@ impl ItemHandle for ViewHandle { Box::new(self.clone()) } - fn clone_on_split(&self, cx: &mut MutableAppContext) -> Option> { + fn set_nav_history(&self, nav_history: Rc>, cx: &mut MutableAppContext) { self.update(cx, |item, cx| { - cx.add_option_view(|cx| item.clone_on_split(cx)) + item.set_nav_history(ItemNavHistory::new(nav_history, &cx.handle()), cx); }) - .map(|handle| Box::new(handle) as Box) } - fn set_nav_history(&self, nav_history: Rc>, cx: &mut MutableAppContext) { + fn clone_on_split(&self, cx: &mut MutableAppContext) -> Option> { self.update(cx, |item, cx| { - item.set_nav_history(ItemNavHistory::new(nav_history, &cx.handle()), cx); + cx.add_option_view(|cx| item.clone_on_split(cx)) }) + .map(|handle| Box::new(handle) as Box) } fn added_to_pane( @@ -512,6 +517,30 @@ impl ItemHandle for ViewHandle { self.update(cx, |this, cx| this.navigate(data, cx)) } + fn id(&self) -> usize { + self.id() + } + + fn to_any(&self) -> AnyViewHandle { + self.into() + } + + fn is_dirty(&self, cx: &AppContext) -> bool { + self.read(cx).is_dirty(cx) + } + + fn has_conflict(&self, cx: &AppContext) -> bool { + self.read(cx).has_conflict(cx) + } + + fn can_save(&self, cx: &AppContext) -> bool { + self.read(cx).can_save(cx) + } + + fn can_save_as(&self, cx: &AppContext) -> bool { + self.read(cx).can_save_as(cx) + } + fn save(&self, project: ModelHandle, cx: &mut MutableAppContext) -> Task> { self.update(cx, |item, cx| item.save(project, cx)) } @@ -533,30 +562,6 @@ impl ItemHandle for ViewHandle { self.update(cx, |item, cx| item.reload(project, cx)) } - fn is_dirty(&self, cx: &AppContext) -> bool { - self.read(cx).is_dirty(cx) - } - - fn has_conflict(&self, cx: &AppContext) -> bool { - self.read(cx).has_conflict(cx) - } - - fn id(&self) -> usize { - self.id() - } - - fn to_any(&self) -> AnyViewHandle { - self.into() - } - - fn can_save(&self, cx: &AppContext) -> bool { - self.read(cx).can_save(cx) - } - - fn can_save_as(&self, cx: &AppContext) -> bool { - self.read(cx).can_save_as(cx) - } - fn act_as_type(&self, type_id: TypeId, cx: &AppContext) -> Option { self.read(cx).act_as_type(type_id, self, cx) } @@ -570,6 +575,14 @@ impl ItemHandle for ViewHandle { None } } + + fn on_release( + &self, + cx: &mut MutableAppContext, + callback: Box, + ) -> gpui::Subscription { + cx.observe_release(self, move |_, cx| callback(cx)) + } } impl Into for Box { @@ -2102,7 +2115,10 @@ pub fn open_paths( abs_paths: &[PathBuf], app_state: &Arc, cx: &mut MutableAppContext, -) -> Task> { +) -> Task<( + ViewHandle, + Vec, Arc>>>, +)> { log::info!("open paths {:?}", abs_paths); // Open paths in existing workspace if possible @@ -2139,8 +2155,8 @@ pub fn open_paths( let task = workspace.update(cx, |workspace, cx| workspace.open_paths(abs_paths, cx)); cx.spawn(|_| async move { - task.await; - workspace + let items = task.await; + (workspace, items) }) } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 6a6dc5ef498e793ce224f2f9d557243f9d05a441..5fbf634262f1124ab47c80aed654d6c9847618ee 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -11,7 +11,7 @@ use client::{self, http, ChannelList, UserStore}; use fs::OpenOptions; use futures::{ channel::{mpsc, oneshot}, - SinkExt, StreamExt, + FutureExt, SinkExt, StreamExt, }; use gpui::{App, AssetSource, AsyncAppContext, Task}; use log::LevelFilter; @@ -19,7 +19,7 @@ use parking_lot::Mutex; use project::Fs; use settings::{self, KeymapFile, Settings, SettingsFileContent}; use smol::process::Command; -use std::{env, fs, path::PathBuf, sync::Arc, thread}; +use std::{env, fs, path::PathBuf, sync::Arc, thread, time::Duration}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use util::ResultExt; use workspace::{self, AppState, OpenNew, OpenPaths}; @@ -360,9 +360,79 @@ async fn handle_cli_connection( ) { if let Some(request) = requests.next().await { match request { - CliRequest::Open { paths, .. } => { - cx.update(|cx| cx.dispatch_global_action(OpenPaths { paths, app_state })); - responses.send(CliResponse::Exit { status: 0 }).log_err(); + CliRequest::Open { paths, wait } => { + let (workspace, items) = cx + .update(|cx| workspace::open_paths(&paths, &app_state, cx)) + .await; + + let mut errored = false; + let mut futures = Vec::new(); + cx.update(|cx| { + for (item, path) in items.into_iter().zip(&paths) { + match item { + Some(Ok(item)) => { + let released = oneshot::channel(); + item.on_release( + cx, + Box::new(move |_| { + let _ = released.0.send(()); + }), + ) + .detach(); + futures.push(released.1); + } + Some(Err(err)) => { + responses + .send(CliResponse::Stderr { + message: format!("error opening {:?}: {}", path, err), + }) + .log_err(); + errored = true; + } + None => {} + } + } + }); + + if wait { + let background = cx.background(); + let wait = async move { + if paths.is_empty() { + let (done_tx, done_rx) = oneshot::channel(); + let _subscription = cx.update(|cx| { + cx.observe_release(&workspace, move |_, _| { + let _ = done_tx.send(()); + }) + }); + drop(workspace); + let _ = done_rx.await; + } else { + let _ = futures::future::try_join_all(futures).await; + }; + } + .fuse(); + futures::pin_mut!(wait); + + loop { + // Repeatedly check if CLI is still open to avoid wasting resources + // waiting for files or workspaces to close. + let mut timer = background.timer(Duration::from_secs(1)).fuse(); + futures::select_biased! { + _ = wait => break, + _ = timer => { + if responses.send(CliResponse::Ping).is_err() { + break; + } + } + } + } + } + + responses + .send(CliResponse::Exit { + status: if errored { 1 } else { 0 }, + }) + .log_err(); } } } From 5ab35bd6fdb63acbd840ba443968852cc8d47712 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 14:34:38 +0200 Subject: [PATCH 235/245] Remove stray dbg --- crates/zed/src/zed.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 53a0875248111b892fc9f8d531ff136f6906780d..379b6172ab109ef0d4bbb893e6d30eea11b4d307 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -265,7 +265,7 @@ async fn install_cli(cx: &AsyncAppContext) -> Result<()> { let status = smol::process::Command::new("osascript") .args([ "-e", - &dbg!(format!( + &format!( "do shell script \" \ mkdir -p \'{}\' && \ ln -sf \'{}\' \'{}\' \ @@ -273,7 +273,7 @@ async fn install_cli(cx: &AsyncAppContext) -> Result<()> { bin_dir_path.to_string_lossy(), cli_path.to_string_lossy(), link_path.to_string_lossy(), - )), + ), ]) .stdout(smol::process::Stdio::inherit()) .stderr(smol::process::Stdio::inherit()) From 926c75dadff2e527d78d9bbc2e41a47ee83e9d8c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 16:00:41 +0200 Subject: [PATCH 236/245] Implement `zed --version` Co-Authored-By: Nathan Sobo --- Cargo.lock | 53 ++++++++++++++++++++++++++++++++++++++---- crates/cli/Cargo.toml | 3 ++- crates/cli/src/main.rs | 23 +++++++++++++++++- 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79ce44125864200d4d76a1189abd7297b95ca94d..181a15fe697a4f830c8b867a638c0946b45fbdb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1004,6 +1004,7 @@ dependencies = [ "dirs 3.0.1", "ipc-channel", "objc", + "plist", "serde", ] @@ -2595,7 +2596,7 @@ checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ "bytes 1.0.1", "fnv", - "itoa", + "itoa 0.4.7", ] [[package]] @@ -2804,6 +2805,12 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + [[package]] name = "jobserver" version = "0.1.24" @@ -3027,6 +3034,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "line-wrap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" +dependencies = [ + "safemem", +] + [[package]] name = "lipsum" version = "0.8.0" @@ -3779,6 +3795,20 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +[[package]] +name = "plist" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" +dependencies = [ + "base64 0.13.0", + "indexmap", + "line-wrap", + "serde", + "time 0.3.7", + "xml-rs", +] + [[package]] name = "png" version = "0.16.8" @@ -4440,6 +4470,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "salsa20" version = "0.8.0" @@ -4642,7 +4678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "indexmap", - "itoa", + "itoa 0.4.7", "ryu", "serde", ] @@ -4686,7 +4722,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ "form_urlencoded", - "itoa", + "itoa 0.4.7", "ryu", "serde", ] @@ -5039,7 +5075,7 @@ dependencies = [ "hashlink 0.6.0", "hex", "hmac 0.10.1", - "itoa", + "itoa 0.4.7", "libc", "log", "md-5", @@ -5088,7 +5124,7 @@ dependencies = [ "hashlink 0.7.0", "hex", "hmac 0.10.1", - "itoa", + "itoa 0.4.7", "libc", "log", "md-5", @@ -5585,6 +5621,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" dependencies = [ + "itoa 1.0.1", "libc", "num_threads", ] @@ -6324,6 +6361,12 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "xmlparser" version = "0.13.3" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index be58523140b293bcc74d18c2ace6e6b6fa70d507..a8836cf64e68b0879a54512ed13a0af804aa5f9c 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -22,4 +22,5 @@ serde = { version = "1.0", features = ["derive"] } cocoa = "0.24" core-foundation = "0.9" core-services = "0.2" -objc = "0.2" \ No newline at end of file +objc = "0.2" +plist = "1.3" \ No newline at end of file diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 9aac438724849bd7fbbdf5a8859070879495c2c2..613f64215bad45d46e448f8a2cc07c6a5050d490 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -9,10 +9,11 @@ use core_foundation::{ use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType}; use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender}; use objc::{class, msg_send, sel, sel_impl}; +use serde::Deserialize; use std::{ffi::CStr, fs, path::PathBuf, ptr}; #[derive(Parser)] -#[clap(name = "zed")] +#[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))] struct Args { /// Wait for all of the given paths to be closed before exiting. #[clap(short, long)] @@ -20,12 +21,32 @@ struct Args { /// A sequence of space-separated paths that you want to open. #[clap()] paths: Vec, + /// Print Zed's version and the app path. + #[clap(short, long)] + version: bool, +} + +#[derive(Debug, Deserialize)] +struct InfoPlist { + #[serde(rename = "CFBundleShortVersionString")] + bundle_short_version_string: String, } fn main() -> Result<()> { let args = Args::parse(); let app_path = locate_app()?; + if args.version { + let plist_path = app_path.join("Contents/Info.plist"); + let plist = plist::from_file::<_, InfoPlist>(plist_path)?; + println!( + "Zed {} – {}", + plist.bundle_short_version_string, + app_path.to_string_lossy() + ); + return Ok(()); + } + let (tx, rx) = launch_app(app_path)?; tx.send(CliRequest::Open { From f77239bd965343718f7d7a4d0936b554e96d58f9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 16:34:01 +0200 Subject: [PATCH 237/245] Add application menu to install CLI Co-Authored-By: Nathan Sobo --- crates/project/src/project.rs | 1 - crates/zed/src/menus.rs | 6 ++++++ crates/zed/src/zed.rs | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index e72ca7ac92f12bc1fb3849798e92baaaaa2e3f91..5c1064400edbd0c411a71b536e2932f7fbe9291f 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -5337,7 +5337,6 @@ mod tests { #[gpui::test] async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) { cx.foreground().forbid_parking(); - language::init_test(cx); let fs = FakeFs::new(cx.background()); fs.insert_tree( diff --git a/crates/zed/src/menus.rs b/crates/zed/src/menus.rs index 33ac76e63cc3d7ff75fb3df1c9f6f9523854acf9..48883d5c05c71619afa1e57d055c9aab62bf0a67 100644 --- a/crates/zed/src/menus.rs +++ b/crates/zed/src/menus.rs @@ -14,6 +14,12 @@ pub fn menus(state: &Arc) -> Vec> { action: Box::new(super::About), }, MenuItem::Separator, + MenuItem::Action { + name: "Install CLI", + keystroke: None, + action: Box::new(super::InstallCommandLineInterface), + }, + MenuItem::Separator, MenuItem::Action { name: "Quit", keystroke: Some("cmd-q"), diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 379b6172ab109ef0d4bbb893e6d30eea11b4d307..4619979e7b2a60e0c3c7558fe1f0b6a5e9d86345 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -43,7 +43,7 @@ actions!( OpenSettings, IncreaseBufferFontSize, DecreaseBufferFontSize, - InstallCommandLineTool, + InstallCommandLineInterface, ] ); @@ -71,7 +71,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { cx.refresh_windows(); }); }); - cx.add_global_action(move |_: &InstallCommandLineTool, cx| { + cx.add_global_action(move |_: &InstallCommandLineInterface, cx| { cx.spawn(|cx| async move { install_cli(&cx).await.context("error creating CLI symlink") }) .detach_and_log_err(cx); }); From 07562c2ccd954d0fa9d331c27fa50ee697a7f863 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 16:34:22 +0200 Subject: [PATCH 238/245] Locate app bundle based on location of CLI binary The app bundle can also be specified via `-b` or `--bundle-path`. Co-Authored-By: Nathan Sobo --- Cargo.lock | 2 -- crates/cli/Cargo.toml | 2 -- crates/cli/src/main.rs | 56 +++++++++++++++--------------------------- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 181a15fe697a4f830c8b867a638c0946b45fbdb4..f48e24c8d8d41b82a06b9c1e95c99a05bde16234 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -998,12 +998,10 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 3.1.8", - "cocoa", "core-foundation", "core-services", "dirs 3.0.1", "ipc-channel", - "objc", "plist", "serde", ] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index a8836cf64e68b0879a54512ed13a0af804aa5f9c..ec87bf20a494443b364c0cc7ee2c6cea511a7936 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -19,8 +19,6 @@ ipc-channel = "0.16" serde = { version = "1.0", features = ["derive"] } [target.'cfg(target_os = "macos")'.dependencies] -cocoa = "0.24" core-foundation = "0.9" core-services = "0.2" -objc = "0.2" plist = "1.3" \ No newline at end of file diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 613f64215bad45d46e448f8a2cc07c6a5050d490..4bc2d6e73d43e0e9e1a0afcba710bcddcb33e4d9 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -8,9 +8,8 @@ use core_foundation::{ }; use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType}; use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender}; -use objc::{class, msg_send, sel, sel_impl}; use serde::Deserialize; -use std::{ffi::CStr, fs, path::PathBuf, ptr}; +use std::{ffi::OsStr, fs, path::PathBuf, ptr}; #[derive(Parser)] #[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))] @@ -24,6 +23,9 @@ struct Args { /// Print Zed's version and the app path. #[clap(short, long)] version: bool, + /// Custom Zed.app path + #[clap(short, long)] + bundle_path: Option, } #[derive(Debug, Deserialize)] @@ -35,19 +37,24 @@ struct InfoPlist { fn main() -> Result<()> { let args = Args::parse(); - let app_path = locate_app()?; + let bundle_path = if let Some(bundle_path) = args.bundle_path { + bundle_path.canonicalize()? + } else { + locate_bundle()? + }; + if args.version { - let plist_path = app_path.join("Contents/Info.plist"); + let plist_path = bundle_path.join("Contents/Info.plist"); let plist = plist::from_file::<_, InfoPlist>(plist_path)?; println!( "Zed {} – {}", plist.bundle_short_version_string, - app_path.to_string_lossy() + bundle_path.to_string_lossy() ); return Ok(()); } - let (tx, rx) = launch_app(app_path)?; + let (tx, rx) = launch_app(bundle_path)?; tx.send(CliRequest::Open { paths: args @@ -70,38 +77,15 @@ fn main() -> Result<()> { Ok(()) } -fn locate_app() -> Result { - if cfg!(debug_assertions) { - Ok(std::env::current_exe()? - .parent() - .unwrap() - .join("bundle/osx/Zed.app")) - } else { - Ok(path_to_app_with_bundle_identifier("dev.zed.Zed") - .unwrap_or_else(|| "/Applications/Zed.dev".into())) - } -} - -fn path_to_app_with_bundle_identifier(bundle_id: &str) -> Option { - use cocoa::{ - base::{id, nil}, - foundation::{NSString, NSURL as _}, - }; - - unsafe { - let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace]; - let bundle_id = NSString::alloc(nil).init_str(bundle_id); - let app_url: id = msg_send![workspace, URLForApplicationWithBundleIdentifier: bundle_id]; - if !app_url.is_null() { - Some(PathBuf::from( - CStr::from_ptr(app_url.path().UTF8String()) - .to_string_lossy() - .to_string(), - )) - } else { - None +fn locate_bundle() -> Result { + let cli_path = std::env::current_exe()?.canonicalize()?; + let mut app_path = cli_path.clone(); + while app_path.extension() != Some(OsStr::new("app")) { + if !app_path.pop() { + return Err(anyhow!("cannot find app bundle containing {:?}", cli_path)); } } + Ok(app_path) } fn launch_app(app_path: PathBuf) -> Result<(IpcSender, IpcReceiver)> { From d725876e648e51d73f7a4ec60859c67329073604 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 17:36:03 +0200 Subject: [PATCH 239/245] :lipstick: Co-Authored-By: Nathan Sobo --- crates/cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index ec87bf20a494443b364c0cc7ee2c6cea511a7936..be7cc24b3e71a6ecd5cd7a16e63260aacbdb1cdd 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -21,4 +21,4 @@ serde = { version = "1.0", features = ["derive"] } [target.'cfg(target_os = "macos")'.dependencies] core-foundation = "0.9" core-services = "0.2" -plist = "1.3" \ No newline at end of file +plist = "1.3" From a210b05d00cd71c6ee75d0ebbd9d6918ece750e4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 20 Apr 2022 17:36:27 +0200 Subject: [PATCH 240/245] Remove `App::on_open_files`, as it's a subset of `on_open_urls` Co-Authored-By: Nathan Sobo --- crates/gpui/src/app.rs | 14 ----------- crates/gpui/src/platform.rs | 1 - crates/gpui/src/platform/mac/platform.rs | 31 ------------------------ crates/gpui/src/platform/test.rs | 2 -- 4 files changed, 48 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 0f9a3041b312ffb2b9adf0d8c38b152f8be7bf17..37cf03a3cc63a09add10c601b359cc056eb55936 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -274,20 +274,6 @@ impl App { self } - pub fn on_open_files(&mut self, mut callback: F) -> &mut Self - where - F: 'static + FnMut(Vec, &mut MutableAppContext), - { - let cx = self.0.clone(); - self.0 - .borrow_mut() - .foreground_platform - .on_open_files(Box::new(move |paths| { - callback(paths, &mut *cx.borrow_mut()) - })); - self - } - pub fn on_open_urls(&mut self, mut callback: F) -> &mut Self where F: 'static + FnMut(Vec, &mut MutableAppContext), diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index b4f77df1eb9f40fd3267c3b0d265755880d62f2b..1e7ab84d50a19c5b7064febf2f9836671a2c93d7 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -62,7 +62,6 @@ pub(crate) trait ForegroundPlatform { fn on_resign_active(&self, callback: Box); fn on_quit(&self, callback: Box); fn on_event(&self, callback: Box bool>); - fn on_open_files(&self, callback: Box)>); fn on_open_urls(&self, callback: Box)>); fn run(&self, on_finish_launching: Box ()>); diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index 5789b2f61146d26058bf78217b6c26e8c25a14e3..e637ebfa3e44395fce61873282856785b7782660 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -85,10 +85,6 @@ unsafe fn build_classes() { sel!(handleGPUIMenuItem:), handle_menu_item as extern "C" fn(&mut Object, Sel, id), ); - decl.add_method( - sel!(application:openFiles:), - open_files as extern "C" fn(&mut Object, Sel, id, id), - ); decl.add_method( sel!(application:openURLs:), open_urls as extern "C" fn(&mut Object, Sel, id, id), @@ -107,7 +103,6 @@ pub struct MacForegroundPlatformState { quit: Option>, event: Option bool>>, menu_command: Option>, - open_files: Option)>>, open_urls: Option)>>, finish_launching: Option ()>>, menu_actions: Vec>, @@ -210,10 +205,6 @@ impl platform::ForegroundPlatform for MacForegroundPlatform { self.0.borrow_mut().event = Some(callback); } - fn on_open_files(&self, callback: Box)>) { - self.0.borrow_mut().open_files = Some(callback); - } - fn on_open_urls(&self, callback: Box)>) { self.0.borrow_mut().open_urls = Some(callback); } @@ -673,28 +664,6 @@ extern "C" fn will_terminate(this: &mut Object, _: Sel, _: id) { } } -extern "C" fn open_files(this: &mut Object, _: Sel, _: id, paths: id) { - let paths = unsafe { - (0..paths.count()) - .into_iter() - .filter_map(|i| { - let path = paths.objectAtIndex(i); - match CStr::from_ptr(path.UTF8String() as *mut c_char).to_str() { - Ok(string) => Some(PathBuf::from(string)), - Err(err) => { - log::error!("error converting path to string: {}", err); - None - } - } - }) - .collect::>() - }; - let platform = unsafe { get_foreground_platform(this) }; - if let Some(callback) = platform.0.borrow_mut().open_files.as_mut() { - callback(paths); - } -} - extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, urls: id) { let urls = unsafe { (0..urls.count()) diff --git a/crates/gpui/src/platform/test.rs b/crates/gpui/src/platform/test.rs index 296d4ea90da676c7f5b301deccb5a5f9b09b9a8b..85ef26cce35abfee39befa1ac5360474a487d065 100644 --- a/crates/gpui/src/platform/test.rs +++ b/crates/gpui/src/platform/test.rs @@ -66,8 +66,6 @@ impl super::ForegroundPlatform for ForegroundPlatform { fn on_event(&self, _: Box bool>) {} - fn on_open_files(&self, _: Box)>) {} - fn on_open_urls(&self, _: Box)>) {} fn run(&self, _on_finish_launching: Box ()>) { From ea11f2e183d3ae14718aaf8c1433df5c562c46f0 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 20 Apr 2022 11:54:57 -0400 Subject: [PATCH 241/245] Increase min-width for all Pickers, minor style changes - Increases the Picker min-width from 500 to 540 - Makes some changes to the styling of keyboard shortcuts in the command palette --- assets/themes/dark.json | 4 ++-- assets/themes/light.json | 2 +- crates/picker/src/picker.rs | 2 +- styles/src/styleTree/commandPalette.ts | 2 +- styles/src/themes/dark.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/themes/dark.json b/assets/themes/dark.json index 77d3706e3b74334fbf446cb5a3f346288d7171dd..42785b123c47244f7567d3ff33ed3fb817c989ee 100644 --- a/assets/themes/dark.json +++ b/assets/themes/dark.json @@ -731,11 +731,11 @@ "key": { "text": { "family": "Zed Mono", - "color": "#ffffff", + "color": "#9c9c9c", "size": 12 }, "corner_radius": 4, - "background": "#0e0e0e", + "background": "#0e0e0e80", "border": { "color": "#232323", "width": 1 diff --git a/assets/themes/light.json b/assets/themes/light.json index dc4381ada8b71c4da6b327f8ba8286abbebed18a..9d810765e1bf799fe8f9be7c352d27990e17126e 100644 --- a/assets/themes/light.json +++ b/assets/themes/light.json @@ -731,7 +731,7 @@ "key": { "text": { "family": "Zed Mono", - "color": "#000000", + "color": "#474747", "size": 12 }, "corner_radius": 4, diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index f23467247820bf4117a8f5606dec9a009489fb61..ff9d653bc0da7cf32b1ceb2f367765a14fb30a89 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -138,7 +138,7 @@ impl Picker { list_state: Default::default(), update_task: None, delegate, - max_size: vec2f(500., 420.), + max_size: vec2f(540., 420.), confirmed: false, }; cx.defer(|this, cx| this.update_matches(cx)); diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/styleTree/commandPalette.ts index 9242f67cbe7114e579158e889d87a87966ee4a98..fbd9bea9b0686ce8bb6b237edd3ae1a0883e7ed3 100644 --- a/styles/src/styleTree/commandPalette.ts +++ b/styles/src/styleTree/commandPalette.ts @@ -5,7 +5,7 @@ export default function commandPalette(theme: Theme) { return { keystrokeSpacing: 8, key: { - text: text(theme, "mono", "active", { size: "xs" }), + text: text(theme, "mono", "secondary", { size: "xs" }), cornerRadius: 4, background: backgroundColor(theme, "on300"), border: border(theme, "secondary"), diff --git a/styles/src/themes/dark.ts b/styles/src/themes/dark.ts index 095c5864ef8f43d7fac1e224ac8befd9639ef5b3..f7407699dd27bf22456e86e3f03efdbe20f511c0 100644 --- a/styles/src/themes/dark.ts +++ b/styles/src/themes/dark.ts @@ -22,7 +22,7 @@ const backgroundColor = { focused: colors.neutral[825], }, on300: { - base: colors.neutral[850], + base: withOpacity(colors.neutral[850], 0.5), hovered: colors.neutral[875], active: colors.neutral[900], focused: colors.neutral[875], From 7bc6f8b5eed929d7ea6f002cf05d8866e9258ff5 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 20 Apr 2022 15:30:33 -0400 Subject: [PATCH 242/245] Build tokens for Figma --- styles/dist/dark.json | 44 ++++++++++++++++++++ styles/dist/light.json | 48 ++++++++++++++++++++- styles/dist/tokens.json | 92 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 180 insertions(+), 4 deletions(-) diff --git a/styles/dist/dark.json b/styles/dist/dark.json index 0aed7aa7b7d77bc844cd04a47af180f65a77e53c..872e1d128037cd429a7294f897f909e8bccdfe2b 100644 --- a/styles/dist/dark.json +++ b/styles/dist/dark.json @@ -173,6 +173,50 @@ "type": "color" } }, + "on300": { + "base": { + "value": "#0e0e0e80", + "step": 850, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "focused": { + "value": "#070707", + "step": 875, + "type": "color" + } + }, + "on500": { + "base": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "hovered": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "active": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + } + }, "ok": { "base": { "value": "#1b9447", diff --git a/styles/dist/light.json b/styles/dist/light.json index 897b03a6fd131a52f6d7c309a678a33b9a5f7b97..cb94077e953b006230ee7a8f821b62f53e30c2b3 100644 --- a/styles/dist/light.json +++ b/styles/dist/light.json @@ -141,8 +141,8 @@ "type": "color" }, "active": { - "value": "#dcdcdc", - "step": 125, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "focused": { @@ -173,6 +173,50 @@ "type": "color" } }, + "on300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "on500": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "focused": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + } + }, "ok": { "base": { "value": "#b7f9ce", diff --git a/styles/dist/tokens.json b/styles/dist/tokens.json index dc9438cdc7a292e2f2fb453278039ebff959e5eb..2d52abc280ea7932ef03476ce27b574a5f9911e8 100644 --- a/styles/dist/tokens.json +++ b/styles/dist/tokens.json @@ -1329,6 +1329,50 @@ "type": "color" } }, + "on300": { + "base": { + "value": "#0e0e0e80", + "step": 850, + "type": "color" + }, + "hovered": { + "value": "#070707", + "step": 875, + "type": "color" + }, + "active": { + "value": "#000000", + "step": 900, + "type": "color" + }, + "focused": { + "value": "#070707", + "step": 875, + "type": "color" + } + }, + "on500": { + "base": { + "value": "#0e0e0e", + "step": 850, + "type": "color" + }, + "hovered": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + }, + "active": { + "value": "#232323", + "step": 775, + "type": "color" + }, + "focused": { + "value": "#1c1c1c", + "step": 800, + "type": "color" + } + }, "ok": { "base": { "value": "#1b9447", @@ -1934,8 +1978,8 @@ "type": "color" }, "active": { - "value": "#dcdcdc", - "step": 125, + "value": "#e3e3e3", + "step": 100, "type": "color" }, "focused": { @@ -1966,6 +2010,50 @@ "type": "color" } }, + "on300": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + }, + "active": { + "value": "#d5d5d5", + "step": 150, + "type": "color" + }, + "focused": { + "value": "#e3e3e3", + "step": 100, + "type": "color" + } + }, + "on500": { + "base": { + "value": "#f1f1f1", + "step": 50, + "type": "color" + }, + "hovered": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + }, + "active": { + "value": "#ffffff", + "step": 0, + "type": "color" + }, + "focused": { + "value": "#f8f8f8", + "step": 25, + "type": "color" + } + }, "ok": { "base": { "value": "#b7f9ce", From 84df1d6564f982b172a69bac95dbfb8a3fb3b7ea Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 20 Apr 2022 15:07:05 -0700 Subject: [PATCH 243/245] Add unit test for project symbols that demonstrates crash --- Cargo.lock | 3 + crates/picker/src/picker.rs | 7 +- crates/project_symbols/Cargo.toml | 8 + crates/project_symbols/src/project_symbols.rs | 137 +++++++++++++++++- 4 files changed, 150 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f48e24c8d8d41b82a06b9c1e95c99a05bde16234..2c2ec4595c294c87ed74b25a69300b6c86429b46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3975,8 +3975,11 @@ version = "0.1.0" dependencies = [ "anyhow", "editor", + "futures", "fuzzy", "gpui", + "language", + "lsp", "ordered-float", "picker", "postage", diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 720fcfd5441775d23ea25474714c9b8d2a7c2555..cf07def52ac6ca435f5e0a6ce20144b5fd8907a1 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -139,7 +139,7 @@ impl Picker { max_size: vec2f(540., 420.), confirmed: false, }; - cx.defer(|this, cx| this.update_matches(cx)); + cx.defer(|this, cx| this.update_matches(String::new(), cx)); this } @@ -159,7 +159,7 @@ impl Picker { cx: &mut ViewContext, ) { match event { - editor::Event::BufferEdited { .. } => self.update_matches(cx), + editor::Event::BufferEdited { .. } => self.update_matches(self.query(cx), cx), editor::Event::Blurred if !self.confirmed => { if let Some(delegate) = self.delegate.upgrade(cx) { delegate.update(cx, |delegate, cx| { @@ -171,9 +171,8 @@ impl Picker { } } - fn update_matches(&mut self, cx: &mut ViewContext) { + pub fn update_matches(&mut self, query: String, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { - let query = self.query(cx); let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); cx.notify(); cx.spawn(|this, mut cx| async move { diff --git a/crates/project_symbols/Cargo.toml b/crates/project_symbols/Cargo.toml index e199b700f6860db74ce2da5c09b7d0474cb84c5c..cb1f186bdec84d2aa9bcf2b11d094ce22a2ef6ae 100644 --- a/crates/project_symbols/Cargo.toml +++ b/crates/project_symbols/Cargo.toml @@ -21,3 +21,11 @@ anyhow = "1.0.38" ordered-float = "2.1.1" postage = { version = "0.4", features = ["futures-traits"] } smol = "1.2" + +[dev-dependencies] +futures = "0.3" +settings = { path = "../settings", features = ["test-support"] } +gpui = { path = "../gpui", features = ["test-support"] } +language = { path = "../language", features = ["test-support"] } +lsp = { path = "../lsp", features = ["test-support"] } +project = { path = "../project", features = ["test-support"] } \ No newline at end of file diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 8e89951a00d913f079b62e4c4285cf72d778b575..cbdc83d19e816e5937519721c967c11cd7de3886 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -90,7 +90,7 @@ impl ProjectSymbolsView { }) .collect() } else { - smol::block_on(fuzzy::match_strings( + cx.background_executor().block(fuzzy::match_strings( &self.match_candidates, query, false, @@ -263,3 +263,138 @@ impl PickerDelegate for ProjectSymbolsView { .boxed() } } + +#[cfg(test)] +mod tests { + use super::*; + use futures::StreamExt; + use gpui::{serde_json::json, TestAppContext}; + use language::{FakeLspAdapter, Language, LanguageConfig}; + use project::FakeFs; + use std::sync::Arc; + + #[gpui::test] + async fn test_project_symbols(cx: &mut TestAppContext) { + cx.foreground().forbid_parking(); + cx.update(|cx| cx.set_global(Settings::test(cx))); + + let mut language = Language::new( + LanguageConfig { + name: "Rust".into(), + path_suffixes: vec!["rs".to_string()], + ..Default::default() + }, + None, + ); + let mut fake_servers = language.set_fake_lsp_adapter(FakeLspAdapter::default()); + + let fs = FakeFs::new(cx.background()); + fs.insert_tree("/dir", json!({ "test.rs": "" })).await; + + let project = Project::test(fs.clone(), cx); + project.update(cx, |project, _| { + project.languages().add(Arc::new(language)); + }); + + let worktree_id = project + .update(cx, |project, cx| { + project.find_or_create_local_worktree("/dir", true, cx) + }) + .await + .unwrap() + .0 + .read_with(cx, |tree, _| tree.id()); + + let _buffer = project + .update(cx, |project, cx| { + project.open_buffer((worktree_id, "test.rs"), cx) + }) + .await + .unwrap(); + + // Set up fake langauge server to return fuzzy matches against + // a fixed set of symbol names. + let fake_symbol_names = ["one", "ton", "uno"]; + let fake_server = fake_servers.next().await.unwrap(); + fake_server.handle_request::( + move |params: lsp::WorkspaceSymbolParams, cx| { + let executor = cx.background(); + async move { + let candidates = fake_symbol_names + .into_iter() + .map(|name| StringMatchCandidate::new(0, name.into())) + .collect::>(); + let matches = fuzzy::match_strings( + &candidates, + ¶ms.query, + true, + 100, + &Default::default(), + executor.clone(), + ) + .await; + Ok(Some( + matches.into_iter().map(|mat| symbol(&mat.string)).collect(), + )) + } + }, + ); + + // Create the project symbols view. + let (_, symbols_view) = cx.add_window(|cx| ProjectSymbolsView::new(project.clone(), cx)); + let picker = symbols_view.read_with(cx, |symbols_view, _| symbols_view.picker.clone()); + + // Spawn multiples updates before the first update completes, + // such that in the end, there are no matches. Testing for regression: + // https://github.com/zed-industries/zed/issues/861 + picker.update(cx, |p, cx| { + p.update_matches("o".to_string(), cx); + p.update_matches("on".to_string(), cx); + p.update_matches("onex".to_string(), cx); + }); + + cx.foreground().run_until_parked(); + symbols_view.read_with(cx, |symbols_view, _| { + assert_eq!(symbols_view.matches.len(), 0); + }); + + // Spawn more updates such that in the end, there are matches. + picker.update(cx, |p, cx| { + p.update_matches("one".to_string(), cx); + p.update_matches("on".to_string(), cx); + }); + + cx.foreground().run_until_parked(); + symbols_view.read_with(cx, |symbols_view, _| { + assert_eq!(symbols_view.matches.len(), 2); + assert_eq!(symbols_view.matches[0].string, "one"); + assert_eq!(symbols_view.matches[1].string, "ton"); + }); + + // Spawn more updates such that in the end, there are again no matches. + picker.update(cx, |p, cx| { + p.update_matches("o".to_string(), cx); + p.update_matches("".to_string(), cx); + }); + + cx.foreground().run_until_parked(); + symbols_view.read_with(cx, |symbols_view, _| { + assert_eq!(symbols_view.matches.len(), 0); + }); + } + + fn symbol(name: &str) -> lsp::SymbolInformation { + #[allow(deprecated)] + lsp::SymbolInformation { + name: name.to_string(), + kind: lsp::SymbolKind::FUNCTION, + tags: None, + deprecated: None, + container_name: None, + location: lsp::Location::new( + lsp::Url::from_file_path("/a/b").unwrap(), + lsp::Range::new(lsp::Position::new(0, 0), lsp::Position::new(0, 0)), + ), + } + } +} From 3619d4c1c47c95086d2bf9cc27a7e6047fbd8c7f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 20 Apr 2022 16:03:11 -0700 Subject: [PATCH 244/245] Always notify a Picker when its delegate notifies --- crates/picker/src/picker.rs | 8 ++++++-- crates/project_symbols/src/project_symbols.rs | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index cf07def52ac6ca435f5e0a6ce20144b5fd8907a1..4e4a7e92aad96fb9de331d975488617cf1ec3047 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -139,7 +139,12 @@ impl Picker { max_size: vec2f(540., 420.), confirmed: false, }; - cx.defer(|this, cx| this.update_matches(String::new(), cx)); + cx.defer(|this, cx| { + if let Some(delegate) = this.delegate.upgrade(cx) { + cx.observe(&delegate, |_, _, cx| cx.notify()).detach(); + this.update_matches(String::new(), cx) + } + }); this } @@ -174,7 +179,6 @@ impl Picker { pub fn update_matches(&mut self, query: String, cx: &mut ViewContext) { if let Some(delegate) = self.delegate.upgrade(cx) { let update = delegate.update(cx, |d, cx| d.update_matches(query, cx)); - cx.notify(); cx.spawn(|this, mut cx| async move { update.await; this.update(&mut cx, |this, cx| { diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index cbdc83d19e816e5937519721c967c11cd7de3886..d2c6850e8bd83e5f738ed03a569266927e2dbc2a 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -28,6 +28,7 @@ pub struct ProjectSymbolsView { symbols: Vec, match_candidates: Vec, show_worktree_root_name: bool, + pending_update: Task<()>, matches: Vec, } @@ -65,6 +66,7 @@ impl ProjectSymbolsView { match_candidates: Default::default(), matches: Default::default(), show_worktree_root_name: false, + pending_update: Task::ready(()), } } @@ -193,7 +195,7 @@ impl PickerDelegate for ProjectSymbolsView { let symbols = self .project .update(cx, |project, cx| project.symbols(&query, cx)); - cx.spawn_weak(|this, mut cx| async move { + self.pending_update = cx.spawn_weak(|this, mut cx| async move { let symbols = symbols.await.log_err(); if let Some(this) = this.upgrade(&cx) { if let Some(symbols) = symbols { @@ -214,7 +216,8 @@ impl PickerDelegate for ProjectSymbolsView { }); } } - }) + }); + Task::ready(()) } fn render_match(&self, ix: usize, selected: bool, cx: &AppContext) -> ElementBox { From 9d3048ebe79a96cb97009fbc84af87613935c640 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 20 Apr 2022 16:10:07 -0700 Subject: [PATCH 245/245] v0.29.0 --- crates/zed/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index d327acb17343b7e3749e3dae9262d4ba4da582ca..d07a030d34b33ccc9def3815ceebb6ce9bdb047e 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] description = "The fast, collaborative code editor." edition = "2021" name = "zed" -version = "0.28.1" +version = "0.29.0" [lib] name = "zed"