From 2e162f8af7e561b504f98b4c47186689044277ff Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 28 Jun 2023 18:20:43 -0400 Subject: [PATCH] WIP convert to `snake_case` --- styles/mod.py | 42 +++++++++++ styles/package.json | 8 +- .../{buildLicenses.ts => build_licenses.ts} | 0 .../src/{buildThemes.ts => build_themes.ts} | 6 +- .../src/{buildTokens.ts => build_tokens.ts} | 6 +- styles/src/{buildTypes.ts => build_types.ts} | 1 - styles/src/component/icon_button.ts | 10 +-- styles/src/component/text_button.ts | 10 +-- styles/src/styleTree/app.ts | 75 ------------------- styles/src/style_tree/app.ts | 75 +++++++++++++++++++ .../{styleTree => style_tree}/assistant.ts | 2 +- .../command_palette.ts} | 4 +- .../{styleTree => style_tree}/components.ts | 2 +- .../contact_finder.ts} | 4 +- .../contact_list.ts} | 4 +- .../contact_notification.ts} | 4 +- .../contacts_popover.ts} | 4 +- .../context_menu.ts} | 4 +- .../src/{styleTree => style_tree}/copilot.ts | 2 +- .../src/{styleTree => style_tree}/editor.ts | 18 ++--- .../src/{styleTree => style_tree}/feedback.ts | 2 +- .../hover_popover.ts} | 4 +- .../incoming_call_notification.ts} | 4 +- .../src/{styleTree => style_tree}/picker.ts | 2 +- .../project_diagnostics.ts} | 4 +- .../project_panel.ts} | 28 +++---- .../project_shared_notification.ts} | 4 +- .../src/{styleTree => style_tree}/search.ts | 2 +- .../shared_screen.ts} | 2 +- .../simple_message_notification.ts} | 4 +- .../statusBar.ts => style_tree/status_bar.ts} | 4 +- .../tabBar.ts => style_tree/tab_bar.ts} | 4 +- .../src/{styleTree => style_tree}/terminal.ts | 2 +- .../src/{styleTree => style_tree}/titlebar.ts | 0 .../toolbar_dropdown_menu.ts} | 4 +- .../src/{styleTree => style_tree}/tooltip.ts | 2 +- .../update_notification.ts} | 4 +- .../src/{styleTree => style_tree}/welcome.ts | 2 +- .../{styleTree => style_tree}/workspace.ts | 16 ++-- .../theme/{colorScheme.ts => color_scheme.ts} | 6 +- styles/src/theme/index.ts | 4 +- styles/src/theme/ramps.ts | 4 +- styles/src/theme/syntax.ts | 2 +- .../theme/{themeConfig.ts => theme_config.ts} | 0 .../{colorScheme.ts => color_scheme.ts} | 6 +- styles/src/theme/tokens/layer.ts | 2 +- styles/src/theme/tokens/players.ts | 2 +- .../src/types/{styleTree.ts => style_tree.ts} | 0 .../src/utils/{snakeCase.ts => snake_case.ts} | 0 49 files changed, 221 insertions(+), 180 deletions(-) create mode 100644 styles/mod.py rename styles/src/{buildLicenses.ts => build_licenses.ts} (100%) rename styles/src/{buildThemes.ts => build_themes.ts} (90%) rename styles/src/{buildTokens.ts => build_tokens.ts} (92%) rename styles/src/{buildTypes.ts => build_types.ts} (95%) delete mode 100644 styles/src/styleTree/app.ts create mode 100644 styles/src/style_tree/app.ts rename styles/src/{styleTree => style_tree}/assistant.ts (99%) rename styles/src/{styleTree/commandPalette.ts => style_tree/command_palette.ts} (89%) rename styles/src/{styleTree => style_tree}/components.ts (99%) rename styles/src/{styleTree/contactFinder.ts => style_tree/contact_finder.ts} (93%) rename styles/src/{styleTree/contactList.ts => style_tree/contact_list.ts} (98%) rename styles/src/{styleTree/contactNotification.ts => style_tree/contact_notification.ts} (91%) rename styles/src/{styleTree/contactsPopover.ts => style_tree/contacts_popover.ts} (72%) rename styles/src/{styleTree/contextMenu.ts => style_tree/context_menu.ts} (94%) rename styles/src/{styleTree => style_tree}/copilot.ts (99%) rename styles/src/{styleTree => style_tree}/editor.ts (96%) rename styles/src/{styleTree => style_tree}/feedback.ts (96%) rename styles/src/{styleTree/hoverPopover.ts => style_tree/hover_popover.ts} (91%) rename styles/src/{styleTree/incomingCallNotification.ts => style_tree/incoming_call_notification.ts} (93%) rename styles/src/{styleTree => style_tree}/picker.ts (98%) rename styles/src/{styleTree/projectDiagnostics.ts => style_tree/project_diagnostics.ts} (70%) rename styles/src/{styleTree/projectPanel.ts => style_tree/project_panel.ts} (88%) rename styles/src/{styleTree/projectSharedNotification.ts => style_tree/project_shared_notification.ts} (93%) rename styles/src/{styleTree => style_tree}/search.ts (98%) rename styles/src/{styleTree/sharedScreen.ts => style_tree/shared_screen.ts} (84%) rename styles/src/{styleTree/simpleMessageNotification.ts => style_tree/simple_message_notification.ts} (93%) rename styles/src/{styleTree/statusBar.ts => style_tree/status_bar.ts} (97%) rename styles/src/{styleTree/tabBar.ts => style_tree/tab_bar.ts} (96%) rename styles/src/{styleTree => style_tree}/terminal.ts (97%) rename styles/src/{styleTree => style_tree}/titlebar.ts (100%) rename styles/src/{styleTree/toolbarDropdownMenu.ts => style_tree/toolbar_dropdown_menu.ts} (94%) rename styles/src/{styleTree => style_tree}/tooltip.ts (93%) rename styles/src/{styleTree/updateNotification.ts => style_tree/update_notification.ts} (89%) rename styles/src/{styleTree => style_tree}/welcome.ts (98%) rename styles/src/{styleTree => style_tree}/workspace.ts (94%) rename styles/src/theme/{colorScheme.ts => color_scheme.ts} (98%) rename styles/src/theme/{themeConfig.ts => theme_config.ts} (100%) rename styles/src/theme/tokens/{colorScheme.ts => color_scheme.ts} (95%) rename styles/src/types/{styleTree.ts => style_tree.ts} (100%) rename styles/src/utils/{snakeCase.ts => snake_case.ts} (100%) diff --git a/styles/mod.py b/styles/mod.py new file mode 100644 index 0000000000..77238e5b45 --- /dev/null +++ b/styles/mod.py @@ -0,0 +1,42 @@ +import os, sys, re + + +def camel_to_snake(inputstring): + REG = r'(? { - const id = `${scheme.isLight ? "light" : "dark"}_${scheme.name + const id = `${scheme.is_light ? "light" : "dark"}_${scheme.name .toLowerCase() .replace(/\s+/g, "_")}_${index}` const selectedTokenSets: { [key: string]: "enabled" } = {} @@ -47,7 +47,7 @@ function buildThemesIndex(colorSchemes: ColorScheme[]): TokenSet[] { return { id, - name: `${scheme.name} - ${scheme.isLight ? "Light" : "Dark"}`, + name: `${scheme.name} - ${scheme.is_light ? "Light" : "Dark"}`, selectedTokenSets, } }) diff --git a/styles/src/buildTypes.ts b/styles/src/build_types.ts similarity index 95% rename from styles/src/buildTypes.ts rename to styles/src/build_types.ts index cd788c540e..5957ae5076 100644 --- a/styles/src/buildTypes.ts +++ b/styles/src/build_types.ts @@ -43,7 +43,6 @@ async function main() { return } } catch (e) { - // @ts-expect-error - It's fine if there's no output from a previous run. if (e.code !== "ENOENT") { throw e } diff --git a/styles/src/component/icon_button.ts b/styles/src/component/icon_button.ts index 39c1adb5e5..4664928d55 100644 --- a/styles/src/component/icon_button.ts +++ b/styles/src/component/icon_button.ts @@ -1,6 +1,6 @@ -import { ColorScheme } from "../common" import { interactive, toggleable } from "../element" -import { background, foreground } from "../styleTree/components" +import { background, foreground } from "../style_tree/components" +import { ColorScheme } from "../theme/color_scheme" export type Margin = { top: number @@ -11,9 +11,9 @@ export type Margin = { interface IconButtonOptions { layer?: - | ColorScheme["lowest"] - | ColorScheme["middle"] - | ColorScheme["highest"] + | ColorScheme["lowest"] + | ColorScheme["middle"] + | ColorScheme["highest"] color?: keyof ColorScheme["lowest"] margin?: Partial } diff --git a/styles/src/component/text_button.ts b/styles/src/component/text_button.ts index b8a2272cd3..64a91de7b0 100644 --- a/styles/src/component/text_button.ts +++ b/styles/src/component/text_button.ts @@ -1,18 +1,18 @@ -import { ColorScheme } from "../common" import { interactive, toggleable } from "../element" import { TextProperties, background, foreground, text, -} from "../styleTree/components" +} from "../style_tree/components" +import { ColorScheme } from "../theme/color_scheme" import { Margin } from "./icon_button" interface TextButtonOptions { layer?: - | ColorScheme["lowest"] - | ColorScheme["middle"] - | ColorScheme["highest"] + | ColorScheme["lowest"] + | ColorScheme["middle"] + | ColorScheme["highest"] color?: keyof ColorScheme["lowest"] margin?: Partial text_properties?: TextProperties diff --git a/styles/src/styleTree/app.ts b/styles/src/styleTree/app.ts deleted file mode 100644 index a843002831..0000000000 --- a/styles/src/styleTree/app.ts +++ /dev/null @@ -1,75 +0,0 @@ -import contactFinder from "./contactFinder" -import contactsPopover from "./contactsPopover" -import commandPalette from "./commandPalette" -import editor from "./editor" -import projectPanel from "./projectPanel" -import search from "./search" -import picker from "./picker" -import workspace from "./workspace" -import contextMenu from "./contextMenu" -import sharedScreen from "./sharedScreen" -import projectDiagnostics from "./projectDiagnostics" -import contactNotification from "./contactNotification" -import updateNotification from "./updateNotification" -import simpleMessageNotification from "./simpleMessageNotification" -import projectSharedNotification from "./projectSharedNotification" -import tooltip from "./tooltip" -import terminal from "./terminal" -import contactList from "./contactList" -import toolbarDropdownMenu from "./toolbarDropdownMenu" -import incomingCallNotification from "./incomingCallNotification" -import { ColorScheme } from "../theme/colorScheme" -import feedback from "./feedback" -import welcome from "./welcome" -import copilot from "./copilot" -import assistant from "./assistant" -import { titlebar } from "./titlebar" - -export default function app(colorScheme: ColorScheme): any { - return { - meta: { - name: colorScheme.name, - isLight: colorScheme.isLight, - }, - commandPalette: commandPalette(colorScheme), - contactNotification: contactNotification(colorScheme), - projectSharedNotification: projectSharedNotification(colorScheme), - incomingCallNotification: incomingCallNotification(colorScheme), - picker: picker(colorScheme), - workspace: workspace(colorScheme), - titlebar: titlebar(colorScheme), - copilot: copilot(colorScheme), - welcome: welcome(colorScheme), - contextMenu: contextMenu(colorScheme), - editor: editor(colorScheme), - projectDiagnostics: projectDiagnostics(colorScheme), - projectPanel: projectPanel(colorScheme), - contactsPopover: contactsPopover(colorScheme), - contactFinder: contactFinder(colorScheme), - contactList: contactList(colorScheme), - toolbarDropdownMenu: toolbarDropdownMenu(colorScheme), - search: search(colorScheme), - sharedScreen: sharedScreen(colorScheme), - updateNotification: updateNotification(colorScheme), - simpleMessageNotification: simpleMessageNotification(colorScheme), - tooltip: tooltip(colorScheme), - terminal: terminal(colorScheme), - assistant: assistant(colorScheme), - feedback: feedback(colorScheme), - colorScheme: { - ...colorScheme, - players: Object.values(colorScheme.players), - ramps: { - neutral: colorScheme.ramps.neutral.colors(100, "hex"), - red: colorScheme.ramps.red.colors(100, "hex"), - orange: colorScheme.ramps.orange.colors(100, "hex"), - yellow: colorScheme.ramps.yellow.colors(100, "hex"), - green: colorScheme.ramps.green.colors(100, "hex"), - cyan: colorScheme.ramps.cyan.colors(100, "hex"), - blue: colorScheme.ramps.blue.colors(100, "hex"), - violet: colorScheme.ramps.violet.colors(100, "hex"), - magenta: colorScheme.ramps.magenta.colors(100, "hex"), - }, - }, - } -} diff --git a/styles/src/style_tree/app.ts b/styles/src/style_tree/app.ts new file mode 100644 index 0000000000..684614d073 --- /dev/null +++ b/styles/src/style_tree/app.ts @@ -0,0 +1,75 @@ +import contact_finder from "./contact_finder" +import contacts_popover from "./contacts_popover" +import command_palette from "./command_palette" +import project_panel from "./project_panel" +import search from "./search" +import picker from "./picker" +import workspace from "./workspace" +import context_menu from "./context_menu" +import shared_screen from "./shared_screen" +import project_diagnostics from "./project_diagnostics" +import contact_notification from "./contact_notification" +import update_notification from "./update_notification" +import simple_message_notification from "./simple_message_notification" +import project_shared_notification from "./project_shared_notification" +import tooltip from "./tooltip" +import terminal from "./terminal" +import contact_list from "./contact_list" +import toolbar_dropdown_menu from "./toolbar_dropdown_menu" +import incoming_call_notification from "./incoming_call_notification" +import { ColorScheme } from "../theme/color_scheme" +import welcome from "./welcome" +import copilot from "./copilot" +import assistant from "./assistant" +import { titlebar } from "./titlebar" +import editor from "./editor" +import feedback from "./feedback" + +export default function app(theme: ColorScheme): any { + return { + meta: { + name: theme.name, + is_light: theme.is_light, + }, + command_palette: command_palette(theme), + contact_notification: contact_notification(theme), + project_shared_notification: project_shared_notification(theme), + incoming_call_notification: incoming_call_notification(theme), + picker: picker(theme), + workspace: workspace(theme), + titlebar: titlebar(theme), + copilot: copilot(theme), + welcome: welcome(theme), + context_menu: context_menu(theme), + editor: editor(theme), + project_diagnostics: project_diagnostics(theme), + project_panel: project_panel(theme), + contacts_popover: contacts_popover(theme), + contact_finder: contact_finder(theme), + contact_list: contact_list(theme), + toolbar_dropdown_menu: toolbar_dropdown_menu(theme), + search: search(theme), + shared_screen: shared_screen(theme), + update_notification: update_notification(theme), + simple_message_notification: simple_message_notification(theme), + tooltip: tooltip(theme), + terminal: terminal(theme), + assistant: assistant(theme), + feedback: feedback(theme), + color_scheme: { + ...theme, + players: Object.values(theme.players), + ramps: { + neutral: theme.ramps.neutral.colors(100, "hex"), + red: theme.ramps.red.colors(100, "hex"), + orange: theme.ramps.orange.colors(100, "hex"), + yellow: theme.ramps.yellow.colors(100, "hex"), + green: theme.ramps.green.colors(100, "hex"), + cyan: theme.ramps.cyan.colors(100, "hex"), + blue: theme.ramps.blue.colors(100, "hex"), + violet: theme.ramps.violet.colors(100, "hex"), + magenta: theme.ramps.magenta.colors(100, "hex"), + }, + }, + } +} diff --git a/styles/src/styleTree/assistant.ts b/styles/src/style_tree/assistant.ts similarity index 99% rename from styles/src/styleTree/assistant.ts rename to styles/src/style_tree/assistant.ts index f233f02786..7003e0765c 100644 --- a/styles/src/styleTree/assistant.ts +++ b/styles/src/style_tree/assistant.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { text, border, background, foreground } from "./components" import editor from "./editor" import { interactive } from "../element" diff --git a/styles/src/styleTree/commandPalette.ts b/styles/src/style_tree/command_palette.ts similarity index 89% rename from styles/src/styleTree/commandPalette.ts rename to styles/src/style_tree/command_palette.ts index 101f4d437e..988a1c949b 100644 --- a/styles/src/styleTree/commandPalette.ts +++ b/styles/src/style_tree/command_palette.ts @@ -1,9 +1,9 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { text, background } from "./components" import { toggleable } from "../element" -export default function commandPalette(colorScheme: ColorScheme): any { +export default function command_palette(colorScheme: ColorScheme): any { const layer = colorScheme.highest const key = toggleable({ diff --git a/styles/src/styleTree/components.ts b/styles/src/style_tree/components.ts similarity index 99% rename from styles/src/styleTree/components.ts rename to styles/src/style_tree/components.ts index 8db1fa4b2e..6f69023d12 100644 --- a/styles/src/styleTree/components.ts +++ b/styles/src/style_tree/components.ts @@ -1,5 +1,5 @@ import { fontFamilies, fontSizes, FontWeight } from "../common" -import { Layer, Styles, StyleSets, Style } from "../theme/colorScheme" +import { Layer, Styles, StyleSets, Style } from "../theme/color_scheme" function isStyleSet(key: any): key is StyleSets { return [ diff --git a/styles/src/styleTree/contactFinder.ts b/styles/src/style_tree/contact_finder.ts similarity index 93% rename from styles/src/styleTree/contactFinder.ts rename to styles/src/style_tree/contact_finder.ts index f0720d0588..239b4b5004 100644 --- a/styles/src/styleTree/contactFinder.ts +++ b/styles/src/style_tree/contact_finder.ts @@ -1,8 +1,8 @@ import picker from "./picker" -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, foreground, text } from "./components" -export default function contactFinder(colorScheme: ColorScheme): any { +export default function contact_finder(colorScheme: ColorScheme): any { const layer = colorScheme.middle const sideMargin = 6 diff --git a/styles/src/styleTree/contactList.ts b/styles/src/style_tree/contact_list.ts similarity index 98% rename from styles/src/styleTree/contactList.ts rename to styles/src/style_tree/contact_list.ts index 9194e809ee..fb6b665a14 100644 --- a/styles/src/styleTree/contactList.ts +++ b/styles/src/style_tree/contact_list.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, borderColor, foreground, text } from "./components" import { interactive, toggleable } from "../element" -export default function contactsPanel(colorScheme: ColorScheme): any { +export default function contacts_panel(colorScheme: ColorScheme): any { const nameMargin = 8 const sidePadding = 12 diff --git a/styles/src/styleTree/contactNotification.ts b/styles/src/style_tree/contact_notification.ts similarity index 91% rename from styles/src/styleTree/contactNotification.ts rename to styles/src/style_tree/contact_notification.ts index 450f927535..6ae2dc5d20 100644 --- a/styles/src/styleTree/contactNotification.ts +++ b/styles/src/style_tree/contact_notification.ts @@ -1,10 +1,10 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, foreground, text } from "./components" import { interactive } from "../element" const avatarSize = 12 const headerPadding = 8 -export default function contactNotification(colorScheme: ColorScheme): any { +export default function contact_notification(colorScheme: ColorScheme): any { const layer = colorScheme.lowest return { headerAvatar: { diff --git a/styles/src/styleTree/contactsPopover.ts b/styles/src/style_tree/contacts_popover.ts similarity index 72% rename from styles/src/styleTree/contactsPopover.ts rename to styles/src/style_tree/contacts_popover.ts index 6d9f84322d..0c9d1a47eb 100644 --- a/styles/src/styleTree/contactsPopover.ts +++ b/styles/src/style_tree/contacts_popover.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border } from "./components" -export default function contactsPopover(colorScheme: ColorScheme): any { +export default function contacts_popover(colorScheme: ColorScheme): any { const layer = colorScheme.middle return { background: background(layer), diff --git a/styles/src/styleTree/contextMenu.ts b/styles/src/style_tree/context_menu.ts similarity index 94% rename from styles/src/styleTree/contextMenu.ts rename to styles/src/style_tree/context_menu.ts index 1064eedd0d..52795be796 100644 --- a/styles/src/styleTree/contextMenu.ts +++ b/styles/src/style_tree/context_menu.ts @@ -1,8 +1,8 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, borderColor, text } from "./components" import { interactive, toggleable } from "../element" -export default function contextMenu(colorScheme: ColorScheme): any { +export default function context_menu(colorScheme: ColorScheme): any { const layer = colorScheme.middle return { background: background(layer), diff --git a/styles/src/styleTree/copilot.ts b/styles/src/style_tree/copilot.ts similarity index 99% rename from styles/src/styleTree/copilot.ts rename to styles/src/style_tree/copilot.ts index 2f82e94c43..cd2bbe0584 100644 --- a/styles/src/styleTree/copilot.ts +++ b/styles/src/style_tree/copilot.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, foreground, svg, text } from "./components" import { interactive } from "../element" export default function copilot(colorScheme: ColorScheme): any { diff --git a/styles/src/styleTree/editor.ts b/styles/src/style_tree/editor.ts similarity index 96% rename from styles/src/styleTree/editor.ts rename to styles/src/style_tree/editor.ts index 71c34207eb..9bf4605580 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/style_tree/editor.ts @@ -1,13 +1,13 @@ import { withOpacity } from "../theme/color" -import { ColorScheme, Layer, StyleSets } from "../theme/colorScheme" +import { ColorScheme, Layer, StyleSets } from "../theme/color_scheme" import { background, border, borderColor, foreground, text } from "./components" -import hoverPopover from "./hoverPopover" +import hoverPopover from "./hover_popover" import { buildSyntax } from "../theme/syntax" import { interactive, toggleable } from "../element" export default function editor(colorScheme: ColorScheme): any { - const { isLight } = colorScheme + const { is_light } = colorScheme const layer = colorScheme.highest @@ -130,13 +130,13 @@ export default function editor(colorScheme: ColorScheme): any { foldBackground: foreground(layer, "variant"), }, diff: { - deleted: isLight + deleted: is_light ? colorScheme.ramps.red(0.5).hex() : colorScheme.ramps.red(0.4).hex(), - modified: isLight + modified: is_light ? colorScheme.ramps.yellow(0.5).hex() : colorScheme.ramps.yellow(0.5).hex(), - inserted: isLight + inserted: is_light ? colorScheme.ramps.green(0.4).hex() : colorScheme.ramps.green(0.5).hex(), removedWidthEm: 0.275, @@ -292,13 +292,13 @@ export default function editor(colorScheme: ColorScheme): any { }, }, git: { - deleted: isLight + deleted: is_light ? withOpacity(colorScheme.ramps.red(0.5).hex(), 0.8) : withOpacity(colorScheme.ramps.red(0.4).hex(), 0.8), - modified: isLight + modified: is_light ? withOpacity(colorScheme.ramps.yellow(0.5).hex(), 0.8) : withOpacity(colorScheme.ramps.yellow(0.4).hex(), 0.8), - inserted: isLight + inserted: is_light ? withOpacity(colorScheme.ramps.green(0.5).hex(), 0.8) : withOpacity(colorScheme.ramps.green(0.4).hex(), 0.8), }, diff --git a/styles/src/styleTree/feedback.ts b/styles/src/style_tree/feedback.ts similarity index 96% rename from styles/src/styleTree/feedback.ts rename to styles/src/style_tree/feedback.ts index 9b66015dc6..88f3cebc37 100644 --- a/styles/src/styleTree/feedback.ts +++ b/styles/src/style_tree/feedback.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, text } from "./components" import { interactive } from "../element" diff --git a/styles/src/styleTree/hoverPopover.ts b/styles/src/style_tree/hover_popover.ts similarity index 91% rename from styles/src/styleTree/hoverPopover.ts rename to styles/src/style_tree/hover_popover.ts index 9e2f8d0a78..68eba19494 100644 --- a/styles/src/styleTree/hoverPopover.ts +++ b/styles/src/style_tree/hover_popover.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, foreground, text } from "./components" -export default function HoverPopover(colorScheme: ColorScheme): any { +export default function hover_popover(colorScheme: ColorScheme): any { const layer = colorScheme.middle const baseContainer = { background: background(layer), diff --git a/styles/src/styleTree/incomingCallNotification.ts b/styles/src/style_tree/incoming_call_notification.ts similarity index 93% rename from styles/src/styleTree/incomingCallNotification.ts rename to styles/src/style_tree/incoming_call_notification.ts index 6249bfb693..9a6d400017 100644 --- a/styles/src/styleTree/incomingCallNotification.ts +++ b/styles/src/style_tree/incoming_call_notification.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, text } from "./components" -export default function incomingCallNotification( +export default function incoming_call_notification( colorScheme: ColorScheme ): unknown { const layer = colorScheme.middle diff --git a/styles/src/styleTree/picker.ts b/styles/src/style_tree/picker.ts similarity index 98% rename from styles/src/styleTree/picker.ts rename to styles/src/style_tree/picker.ts index aaf2740a6e..417c1faea4 100644 --- a/styles/src/styleTree/picker.ts +++ b/styles/src/style_tree/picker.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { background, border, text } from "./components" import { interactive, toggleable } from "../element" diff --git a/styles/src/styleTree/projectDiagnostics.ts b/styles/src/style_tree/project_diagnostics.ts similarity index 70% rename from styles/src/styleTree/projectDiagnostics.ts rename to styles/src/style_tree/project_diagnostics.ts index d2c2152ab4..f3f5a5a144 100644 --- a/styles/src/styleTree/projectDiagnostics.ts +++ b/styles/src/style_tree/project_diagnostics.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, text } from "./components" -export default function projectDiagnostics(colorScheme: ColorScheme): any { +export default function project_diagnostics(colorScheme: ColorScheme): any { const layer = colorScheme.highest return { background: background(layer), diff --git a/styles/src/styleTree/projectPanel.ts b/styles/src/style_tree/project_panel.ts similarity index 88% rename from styles/src/styleTree/projectPanel.ts rename to styles/src/style_tree/project_panel.ts index de4a98df53..c38c689f4f 100644 --- a/styles/src/styleTree/projectPanel.ts +++ b/styles/src/style_tree/project_panel.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { Border, @@ -10,10 +10,10 @@ import { } from "./components" import { interactive, toggleable } from "../element" import merge from "ts-deepmerge" -export default function projectPanel(colorScheme: ColorScheme): any { - const { isLight } = colorScheme +export default function project_panel(theme: ColorScheme): any { + const { is_light } = theme - const layer = colorScheme.middle + const layer = theme.middle type EntryStateProps = { background?: string @@ -31,15 +31,15 @@ export default function projectPanel(colorScheme: ColorScheme): any { const entry = (unselected?: EntryState, selected?: EntryState) => { const git_status = { git: { - modified: isLight - ? colorScheme.ramps.yellow(0.6).hex() - : colorScheme.ramps.yellow(0.5).hex(), - inserted: isLight - ? colorScheme.ramps.green(0.45).hex() - : colorScheme.ramps.green(0.5).hex(), - conflict: isLight - ? colorScheme.ramps.red(0.6).hex() - : colorScheme.ramps.red(0.5).hex(), + modified: is_light + ? theme.ramps.yellow(0.6).hex() + : theme.ramps.yellow(0.5).hex(), + inserted: is_light + ? theme.ramps.green(0.45).hex() + : theme.ramps.green(0.5).hex(), + conflict: is_light + ? theme.ramps.red(0.6).hex() + : theme.ramps.red(0.5).hex(), }, } @@ -182,7 +182,7 @@ export default function projectPanel(colorScheme: ColorScheme): any { filenameEditor: { background: background(layer, "on"), text: text(layer, "mono", "on", { size: "sm" }), - selection: colorScheme.players[0], + selection: theme.players[0], }, } } diff --git a/styles/src/styleTree/projectSharedNotification.ts b/styles/src/style_tree/project_shared_notification.ts similarity index 93% rename from styles/src/styleTree/projectSharedNotification.ts rename to styles/src/style_tree/project_shared_notification.ts index c114e17176..f8b103e2e4 100644 --- a/styles/src/styleTree/projectSharedNotification.ts +++ b/styles/src/style_tree/project_shared_notification.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, text } from "./components" -export default function projectSharedNotification( +export default function project_shared_notification( colorScheme: ColorScheme ): unknown { const layer = colorScheme.middle diff --git a/styles/src/styleTree/search.ts b/styles/src/style_tree/search.ts similarity index 98% rename from styles/src/styleTree/search.ts rename to styles/src/style_tree/search.ts index 9ecad3ab19..c236284fa0 100644 --- a/styles/src/styleTree/search.ts +++ b/styles/src/style_tree/search.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { background, border, foreground, text } from "./components" import { interactive, toggleable } from "../element" diff --git a/styles/src/styleTree/sharedScreen.ts b/styles/src/style_tree/shared_screen.ts similarity index 84% rename from styles/src/styleTree/sharedScreen.ts rename to styles/src/style_tree/shared_screen.ts index 59968d5949..718ea20642 100644 --- a/styles/src/styleTree/sharedScreen.ts +++ b/styles/src/style_tree/shared_screen.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { StyleTree } from "../types" import { background } from "./components" diff --git a/styles/src/styleTree/simpleMessageNotification.ts b/styles/src/style_tree/simple_message_notification.ts similarity index 93% rename from styles/src/styleTree/simpleMessageNotification.ts rename to styles/src/style_tree/simple_message_notification.ts index 99dc878a79..207924a99f 100644 --- a/styles/src/styleTree/simpleMessageNotification.ts +++ b/styles/src/style_tree/simple_message_notification.ts @@ -1,10 +1,10 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, foreground, text } from "./components" import { interactive } from "../element" const headerPadding = 8 -export default function simpleMessageNotification( +export default function simple_message_notification( colorScheme: ColorScheme ): unknown { const layer = colorScheme.middle diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/style_tree/status_bar.ts similarity index 97% rename from styles/src/styleTree/statusBar.ts rename to styles/src/style_tree/status_bar.ts index 6ca53afb18..e86afb1c0d 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/style_tree/status_bar.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, foreground, text } from "./components" import { interactive, toggleable } from "../element" -export default function statusBar(colorScheme: ColorScheme): any { +export default function status_bar(colorScheme: ColorScheme): any { const layer = colorScheme.lowest const statusContainer = { diff --git a/styles/src/styleTree/tabBar.ts b/styles/src/style_tree/tab_bar.ts similarity index 96% rename from styles/src/styleTree/tabBar.ts rename to styles/src/style_tree/tab_bar.ts index ae9512d8ce..fe43934f79 100644 --- a/styles/src/styleTree/tabBar.ts +++ b/styles/src/style_tree/tab_bar.ts @@ -1,9 +1,9 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { text, border, background, foreground } from "./components" import { interactive, toggleable } from "../element" -export default function tabBar(colorScheme: ColorScheme): any { +export default function tab_bar(colorScheme: ColorScheme): any { const height = 32 const activeLayer = colorScheme.highest diff --git a/styles/src/styleTree/terminal.ts b/styles/src/style_tree/terminal.ts similarity index 97% rename from styles/src/styleTree/terminal.ts rename to styles/src/style_tree/terminal.ts index 5198cb195d..4e3dc18627 100644 --- a/styles/src/styleTree/terminal.ts +++ b/styles/src/style_tree/terminal.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { StyleTree } from "../types" export default function terminal(theme: ColorScheme): StyleTree.TerminalStyle { diff --git a/styles/src/styleTree/titlebar.ts b/styles/src/style_tree/titlebar.ts similarity index 100% rename from styles/src/styleTree/titlebar.ts rename to styles/src/style_tree/titlebar.ts diff --git a/styles/src/styleTree/toolbarDropdownMenu.ts b/styles/src/style_tree/toolbar_dropdown_menu.ts similarity index 94% rename from styles/src/styleTree/toolbarDropdownMenu.ts rename to styles/src/style_tree/toolbar_dropdown_menu.ts index 4eff06026b..992631e036 100644 --- a/styles/src/styleTree/toolbarDropdownMenu.ts +++ b/styles/src/style_tree/toolbar_dropdown_menu.ts @@ -1,7 +1,7 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, text } from "./components" import { interactive, toggleable } from "../element" -export default function dropdownMenu(colorScheme: ColorScheme): any { +export default function dropdown_menu(colorScheme: ColorScheme): any { const layer = colorScheme.middle return { diff --git a/styles/src/styleTree/tooltip.ts b/styles/src/style_tree/tooltip.ts similarity index 93% rename from styles/src/styleTree/tooltip.ts rename to styles/src/style_tree/tooltip.ts index fb896112a9..54daae529e 100644 --- a/styles/src/styleTree/tooltip.ts +++ b/styles/src/style_tree/tooltip.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { background, border, text } from "./components" export default function tooltip(colorScheme: ColorScheme): any { diff --git a/styles/src/styleTree/updateNotification.ts b/styles/src/style_tree/update_notification.ts similarity index 89% rename from styles/src/styleTree/updateNotification.ts rename to styles/src/style_tree/update_notification.ts index bf792ffc7b..c6e6130f54 100644 --- a/styles/src/styleTree/updateNotification.ts +++ b/styles/src/style_tree/update_notification.ts @@ -1,10 +1,10 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { foreground, text } from "./components" import { interactive } from "../element" const headerPadding = 8 -export default function updateNotification(colorScheme: ColorScheme): any { +export default function update_notification(colorScheme: ColorScheme): any { const layer = colorScheme.middle return { message: { diff --git a/styles/src/styleTree/welcome.ts b/styles/src/style_tree/welcome.ts similarity index 98% rename from styles/src/styleTree/welcome.ts rename to styles/src/style_tree/welcome.ts index c64a17b5f6..93f1826740 100644 --- a/styles/src/styleTree/welcome.ts +++ b/styles/src/style_tree/welcome.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { border, diff --git a/styles/src/styleTree/workspace.ts b/styles/src/style_tree/workspace.ts similarity index 94% rename from styles/src/styleTree/workspace.ts rename to styles/src/style_tree/workspace.ts index 5f5da7e47e..48217e89c7 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/style_tree/workspace.ts @@ -1,4 +1,4 @@ -import { ColorScheme } from "../theme/colorScheme" +import { ColorScheme } from "../theme/color_scheme" import { withOpacity } from "../theme/color" import { background, @@ -8,14 +8,14 @@ import { svg, text, } from "./components" -import statusBar from "./statusBar" -import tabBar from "./tabBar" +import statusBar from "./status_bar" +import tabBar from "./tab_bar" import { interactive } from "../element" import { titlebar } from "./titlebar" export default function workspace(colorScheme: ColorScheme): any { const layer = colorScheme.lowest - const isLight = colorScheme.isLight + const is_light = colorScheme.is_light return { background: background(colorScheme.lowest), @@ -25,7 +25,7 @@ export default function workspace(colorScheme: ColorScheme): any { height: 256, }, logo: svg( - withOpacity("#000000", colorScheme.isLight ? 0.6 : 0.8), + withOpacity("#000000", colorScheme.is_light ? 0.6 : 0.8), "icons/logo_96.svg", 256, 256 @@ -33,10 +33,10 @@ export default function workspace(colorScheme: ColorScheme): any { logoShadow: svg( withOpacity( - colorScheme.isLight + colorScheme.is_light ? "#FFFFFF" : colorScheme.lowest.base.default.background, - colorScheme.isLight ? 1 : 0.6 + colorScheme.is_light ? 1 : 0.6 ), "icons/logo_96.svg", 256, @@ -96,7 +96,7 @@ export default function workspace(colorScheme: ColorScheme): any { }, zoomedBackground: { cursor: "Arrow", - background: isLight + background: is_light ? withOpacity(background(colorScheme.lowest), 0.8) : withOpacity(background(colorScheme.highest), 0.6), }, diff --git a/styles/src/theme/colorScheme.ts b/styles/src/theme/color_scheme.ts similarity index 98% rename from styles/src/theme/colorScheme.ts rename to styles/src/theme/color_scheme.ts index ea3b1b9b29..61b459911b 100644 --- a/styles/src/theme/colorScheme.ts +++ b/styles/src/theme/color_scheme.ts @@ -5,12 +5,12 @@ import { ThemeConfig, ThemeAppearance, ThemeConfigInputColors, -} from "./themeConfig" +} from "./theme_config" import { getRamps } from "./ramps" export interface ColorScheme { name: string - isLight: boolean + is_light: boolean lowest: Layer middle: Layer @@ -155,7 +155,7 @@ export function createColorScheme(theme: ThemeConfig): ColorScheme { return { name, - isLight, + is_light: isLight, ramps, diff --git a/styles/src/theme/index.ts b/styles/src/theme/index.ts index 2bf625521c..22287bf669 100644 --- a/styles/src/theme/index.ts +++ b/styles/src/theme/index.ts @@ -1,4 +1,4 @@ -export * from "./colorScheme" +export * from "./color_scheme" export * from "./ramps" export * from "./syntax" -export * from "./themeConfig" +export * from "./theme_config" diff --git a/styles/src/theme/ramps.ts b/styles/src/theme/ramps.ts index de1f8ee0d4..98a73ef5bf 100644 --- a/styles/src/theme/ramps.ts +++ b/styles/src/theme/ramps.ts @@ -1,9 +1,9 @@ import chroma, { Color, Scale } from "chroma-js" -import { RampSet } from "./colorScheme" +import { RampSet } from "./color_scheme" import { ThemeConfigInputColors, ThemeConfigInputColorsKeys, -} from "./themeConfig" +} from "./theme_config" export function colorRamp(color: Color): Scale { const endColor = color.desaturate(1).brighten(5) diff --git a/styles/src/theme/syntax.ts b/styles/src/theme/syntax.ts index a35013c1e9..5d214abdeb 100644 --- a/styles/src/theme/syntax.ts +++ b/styles/src/theme/syntax.ts @@ -1,6 +1,6 @@ import deepmerge from "deepmerge" import { FontWeight, fontWeights } from "../common" -import { ColorScheme } from "./colorScheme" +import { ColorScheme } from "./color_scheme" import chroma from "chroma-js" export interface SyntaxHighlightStyle { diff --git a/styles/src/theme/themeConfig.ts b/styles/src/theme/theme_config.ts similarity index 100% rename from styles/src/theme/themeConfig.ts rename to styles/src/theme/theme_config.ts diff --git a/styles/src/theme/tokens/colorScheme.ts b/styles/src/theme/tokens/color_scheme.ts similarity index 95% rename from styles/src/theme/tokens/colorScheme.ts rename to styles/src/theme/tokens/color_scheme.ts index bc53ca802a..84e456a6e7 100644 --- a/styles/src/theme/tokens/colorScheme.ts +++ b/styles/src/theme/tokens/color_scheme.ts @@ -9,12 +9,12 @@ import { Shadow, SyntaxHighlightStyle, ThemeSyntax, -} from "../colorScheme" +} from "../color_scheme" import { LayerToken, layerToken } from "./layer" import { PlayersToken, playersToken } from "./players" import { colorToken } from "./token" import { Syntax } from "../syntax" -import editor from "../../styleTree/editor" +import editor from "../../style_tree/editor" interface ColorSchemeTokens { name: SingleOtherToken @@ -85,7 +85,7 @@ export function colorSchemeTokens(colorScheme: ColorScheme): ColorSchemeTokens { }, appearance: { name: "themeAppearance", - value: colorScheme.isLight ? "light" : "dark", + value: colorScheme.is_light ? "light" : "dark", type: TokenTypes.OTHER, }, lowest: layerToken(colorScheme.lowest, "lowest"), diff --git a/styles/src/theme/tokens/layer.ts b/styles/src/theme/tokens/layer.ts index 42a69b5a52..10309e0d2e 100644 --- a/styles/src/theme/tokens/layer.ts +++ b/styles/src/theme/tokens/layer.ts @@ -1,5 +1,5 @@ import { SingleColorToken } from "@tokens-studio/types" -import { Layer, Style, StyleSet } from "../colorScheme" +import { Layer, Style, StyleSet } from "../color_scheme" import { colorToken } from "./token" interface StyleToken { diff --git a/styles/src/theme/tokens/players.ts b/styles/src/theme/tokens/players.ts index 94d05cd827..12f16343e9 100644 --- a/styles/src/theme/tokens/players.ts +++ b/styles/src/theme/tokens/players.ts @@ -1,6 +1,6 @@ import { SingleColorToken } from "@tokens-studio/types" -import { ColorScheme, Players } from "../../common" import { colorToken } from "./token" +import { ColorScheme, Players } from "../color_scheme" export type PlayerToken = Record<"selection" | "cursor", SingleColorToken> diff --git a/styles/src/types/styleTree.ts b/styles/src/types/style_tree.ts similarity index 100% rename from styles/src/types/styleTree.ts rename to styles/src/types/style_tree.ts diff --git a/styles/src/utils/snakeCase.ts b/styles/src/utils/snake_case.ts similarity index 100% rename from styles/src/utils/snakeCase.ts rename to styles/src/utils/snake_case.ts