This commit is contained in:
Nate Butler
2023-06-28 16:28:46 -04:00
parent 0b900f4faf
commit e30ad9109c
10 changed files with 2858 additions and 39 deletions
+33
View File
@@ -0,0 +1,33 @@
module.exports = {
plugins: ["import"],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
}
}
},
rules: {
"import/no-restricted-paths": [
warn,
{
zones: [
{
"target": "./src/types/*",
"from": "./src",
"except": [
"./src/types/index.ts"
]
}
]
}
]
}
}
+2723 -6
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -35,6 +35,11 @@
"tabWidth": 4
},
"devDependencies": {
"@vitest/coverage-v8": "^0.32.0"
"@typescript-eslint/parser": "^5.60.1",
"@vitest/coverage-v8": "^0.32.0",
"eslint": "^8.43.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"typescript": "^5.1.5"
}
}
+2 -1
View File
@@ -1,7 +1,8 @@
import { ColorScheme } from "../theme/colorScheme"
import { StyleTree } from "../types"
import { background } from "./components"
export default function sharedScreen(colorScheme: ColorScheme) {
export default function sharedScreen(colorScheme: ColorScheme): StyleTree.SharedScreen {
let layer = colorScheme.highest
return {
background: background(layer),
+32 -31
View File
@@ -1,6 +1,7 @@
import { ColorScheme } from "../theme/colorScheme"
import { StyleTree } from "../types"
export default function terminal(colorScheme: ColorScheme) {
export default function terminal(theme: ColorScheme): StyleTree.TerminalStyle {
/**
* Colors are controlled per-cell in the terminal grid.
* Cells can be set to any of these more 'theme-capable' colors
@@ -9,44 +10,44 @@ export default function terminal(colorScheme: ColorScheme) {
* https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
*/
return {
black: colorScheme.ramps.neutral(0).hex(),
red: colorScheme.ramps.red(0.5).hex(),
green: colorScheme.ramps.green(0.5).hex(),
yellow: colorScheme.ramps.yellow(0.5).hex(),
blue: colorScheme.ramps.blue(0.5).hex(),
magenta: colorScheme.ramps.magenta(0.5).hex(),
cyan: colorScheme.ramps.cyan(0.5).hex(),
white: colorScheme.ramps.neutral(1).hex(),
brightBlack: colorScheme.ramps.neutral(0.4).hex(),
brightRed: colorScheme.ramps.red(0.25).hex(),
brightGreen: colorScheme.ramps.green(0.25).hex(),
brightYellow: colorScheme.ramps.yellow(0.25).hex(),
brightBlue: colorScheme.ramps.blue(0.25).hex(),
brightMagenta: colorScheme.ramps.magenta(0.25).hex(),
brightCyan: colorScheme.ramps.cyan(0.25).hex(),
brightWhite: colorScheme.ramps.neutral(1).hex(),
black: theme.ramps.neutral(0).hex(),
red: theme.ramps.red(0.5).hex(),
green: theme.ramps.green(0.5).hex(),
yellow: theme.ramps.yellow(0.5).hex(),
blue: theme.ramps.blue(0.5).hex(),
magenta: theme.ramps.magenta(0.5).hex(),
cyan: theme.ramps.cyan(0.5).hex(),
white: theme.ramps.neutral(1).hex(),
bright_black: theme.ramps.neutral(0.4).hex(),
bright_red: theme.ramps.red(0.25).hex(),
bright_green: theme.ramps.green(0.25).hex(),
bright_yellow: theme.ramps.yellow(0.25).hex(),
bright_blue: theme.ramps.blue(0.25).hex(),
bright_magenta: theme.ramps.magenta(0.25).hex(),
bright_cyan: theme.ramps.cyan(0.25).hex(),
bright_white: theme.ramps.neutral(1).hex(),
/**
* Default color for characters
*/
foreground: colorScheme.ramps.neutral(1).hex(),
foreground: theme.ramps.neutral(1).hex(),
/**
* Default color for the rectangle background of a cell
*/
background: colorScheme.ramps.neutral(0).hex(),
modalBackground: colorScheme.ramps.neutral(0.1).hex(),
background: theme.ramps.neutral(0).hex(),
modal_background: theme.ramps.neutral(0.1).hex(),
/**
* Default color for the cursor
*/
cursor: colorScheme.players[0].cursor,
dimBlack: colorScheme.ramps.neutral(1).hex(),
dimRed: colorScheme.ramps.red(0.75).hex(),
dimGreen: colorScheme.ramps.green(0.75).hex(),
dimYellow: colorScheme.ramps.yellow(0.75).hex(),
dimBlue: colorScheme.ramps.blue(0.75).hex(),
dimMagenta: colorScheme.ramps.magenta(0.75).hex(),
dimCyan: colorScheme.ramps.cyan(0.75).hex(),
dimWhite: colorScheme.ramps.neutral(0.6).hex(),
brightForeground: colorScheme.ramps.neutral(1).hex(),
dimForeground: colorScheme.ramps.neutral(0).hex(),
cursor: theme.players[0].cursor,
dim_black: theme.ramps.neutral(1).hex(),
dim_red: theme.ramps.red(0.75).hex(),
dim_green: theme.ramps.green(0.75).hex(),
dim_yellow: theme.ramps.yellow(0.75).hex(),
dim_blue: theme.ramps.blue(0.75).hex(),
dim_magenta: theme.ramps.magenta(0.75).hex(),
dim_cyan: theme.ramps.cyan(0.75).hex(),
dim_white: theme.ramps.neutral(0.6).hex(),
bright_foreground: theme.ramps.neutral(1).hex(),
dim_foreground: theme.ramps.neutral(0).hex(),
}
}
+4
View File
@@ -0,0 +1,4 @@
import { Clean } from "./util";
import * as zed from './zed'
export type Text = Clean<zed.TextStyle>
+5
View File
@@ -0,0 +1,5 @@
import * as StyleTree from './styleTree'
import * as Property from './property'
import * as Element from './element'
export { StyleTree, Property, Element }
+9
View File
@@ -0,0 +1,9 @@
import { Clean } from './util'
import * as zed from './zed'
export type Color = zed.Color
export type CursorStyle = zed.CursorStyle
export type FontStyle = zed.Style
export type Border = Clean<zed.Border>
export type Margin = Clean<zed.Margin>
export type Padding = Clean<zed.Padding>
+29
View File
@@ -0,0 +1,29 @@
import { Clean } from './util'
import * as zed from './zed'
export type AssistantStyle = Readonly<Clean<zed.AssistantStyle>>;
export type CommandPalette = Readonly<Clean<zed.CommandPalette>>;
export type ContactFinder = Readonly<Clean<zed.ContactFinder>>;
export type ContactList = Readonly<Clean<zed.ContactList>>;
export type ContactNotification = Readonly<Clean<zed.ContactNotification>>;
export type ContactsPopover = Readonly<Clean<zed.ContactsPopover>>;
export type ContextMenu = Readonly<Clean<zed.ContextMenu>>;
export type Copilot = Readonly<Clean<zed.Copilot>>;
export type Editor = Readonly<Clean<zed.Editor>>;
export type FeedbackStyle = Readonly<Clean<zed.FeedbackStyle>>;
export type IncomingCallNotification = Readonly<Clean<zed.IncomingCallNotification>>;
export type ThemeMeta = Readonly<Clean<zed.ThemeMeta>>;
export type Picker = Readonly<Clean<zed.Picker>>;
export type ProjectDiagnostics = Readonly<Clean<zed.ProjectDiagnostics>>;
export type ProjectPanel = Readonly<Clean<zed.ProjectPanel>>;
export type ProjectSharedNotification = Readonly<Clean<zed.ProjectSharedNotification>>;
export type Search = Readonly<Clean<zed.Search>>;
export type SharedScreen = Readonly<Clean<zed.ContainerStyle>>;
export type MessageNotification = Readonly<Clean<zed.MessageNotification>>;
export type TerminalStyle = Readonly<Clean<zed.TerminalStyle>>;
export type UserMenu = Readonly<Clean<zed.UserMenu>>;
export type DropdownMenu = Readonly<Clean<zed.DropdownMenu>>;
export type TooltipStyle = Readonly<Clean<zed.TooltipStyle>>;
export type UpdateNotification = Readonly<Clean<zed.UpdateNotification>>;
export type WelcomeStyle = Readonly<Clean<zed.WelcomeStyle>>;
export type Workspace = Readonly<Clean<zed.Workspace>>;
+15
View File
@@ -0,0 +1,15 @@
export type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
/**
* Clean removes the [k: string]: unknown property from an object,
* and Prettifies it, providing better hover information for the type
*/
export type Clean<T> = {
[K in keyof T as string extends K ? never : K]: T[K];
}
export type DeepClean<T> = {
[K in keyof T as string extends K ? never : K]: T[K] extends object ? DeepClean<T[K]> : T[K];
}