Skip to content

Commit

Permalink
feat: decompose types into reusable parts and combine as appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
klown committed Mar 12, 2024
1 parent 13b87f7 commit 2e4c520
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/ActionBmwCodeCell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { VNode } from "preact";
import { html } from "htm/preact";
import { BlissSymbolCellType } from "./index.d";
import { BlissSymbolInfoType, LayoutInfoType } from "./index.d";
import { BlissSymbol } from "./BlissSymbol";
import { usePaletteState } from "./GlobalData";
import { generateGridStyle, speak } from "./GlobalUtils";
Expand All @@ -20,7 +20,7 @@ import "./ActionBmwCodeCell.scss";

type ActionBmwCodeCellPropsType = {
id: string,
options: BlissSymbolCellType
options: BlissSymbolInfoType & LayoutInfoType
};

export function ActionBmwCodeCell (props: ActionBmwCodeCellPropsType): VNode {
Expand Down
1 change: 0 additions & 1 deletion src/ActionBranchToPaletteCell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { BlissSymbol } from "./BlissSymbol";
import { speak } from "./GlobalUtils";
import "./ActionBranchToPaletteCell.scss";

// TODO: this is identical to `ActionBmwCodeCellPropsType`. Should it be?
type ActionBranchToPalettePropsType = {
id: string,
options: BlissSymbolCellType
Expand Down
6 changes: 4 additions & 2 deletions src/CommandClearEncoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { VNode } from "preact";
import { html } from "htm/preact";
import { BlissSymbol } from "./BlissSymbol";
import { usePaletteState } from "./GlobalData";
import { BlissSymbolCellType } from "./index.d";
import { BlissSymbolInfoType, LayoutInfoType } from "./index.d";
import { generateGridStyle, speak } from "./GlobalUtils";

type CommandClearEncodingProps = {
id: string,
options: BlissSymbolCellType
options: BlissSymbolInfoType & LayoutInfoType & {
ariaControls: string
}
}

export function CommandClearEncoding (props: CommandClearEncodingProps): VNode {
Expand Down
6 changes: 4 additions & 2 deletions src/CommandDelLastEncoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { VNode } from "preact";
import { html } from "htm/preact";
import { BlissSymbol } from "./BlissSymbol";
import { usePaletteState } from "./GlobalData";
import { BlissSymbolCellType } from "./index.d";
import { BlissSymbolInfoType, LayoutInfoType } from "./index.d";
import { generateGridStyle, speak } from "./GlobalUtils";

type CommandDelLastEncodingProps = {
id: string,
options: BlissSymbolCellType
options: BlissSymbolInfoType & LayoutInfoType & {
ariaControls: string
}
}

export function CommandDelLastEncoding (props: CommandDelLastEncodingProps): VNode {
Expand Down
5 changes: 2 additions & 3 deletions src/CommandGoBackCell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@

import { render, VNode } from "preact";
import { html } from "htm/preact";
import { BlissSymbolCellType } from "./index.d";
import { BlissSymbolInfoType, LayoutInfoType } from "./index.d";
import { adaptivePaletteGlobals } from "./GlobalData";
import { importPaletteFromJsonFile } from "./GlobalUtils";
import { Palette } from "./Palette";
import { BlissSymbol } from "./BlissSymbol";
import { speak } from "./GlobalUtils";
import "./ActionBmwCodeCell.scss";

// TODO: this is identical to `ActionBmwCodeCellPropsType`. Should it be?
type CommandGoBackCellPropsType = {
id: string,
options: BlissSymbolCellType
options: BlissSymbolInfoType & LayoutInfoType
};

/*
Expand Down
34 changes: 17 additions & 17 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@

export type BciAvIdType = number | (string|number)[];

export type BlissSymbolCellType = {
label: string,
columnStart: number,
columnSpan: number,
rowStart: number,
rowSpan: number,
bciAvId: BciAvIdType,
branchTo?: string,
ariaControls?: string
export type BlissSymbolInfoType = {
label: string,
bciAvId: BciAvIdType
}
export type LayoutInfoType = {
columnStart: number,
columnSpan: number,
rowStart: number,
rowSpan: number,
};

export type ContentBmwEncodingType = {
columnStart: number,
columnSpan: number,
rowStart: number,
rowSpan: number,
export type BranchToInfoType = {
branchTo: string,
ariaControls?: string
};

export type BlissSymbolCellType = LayoutInfoType & BranchToInfoType & BlissSymbolInfoType;

export type JsonPaletteType = {
name: string,
cells: {
Expand All @@ -39,10 +39,10 @@ export type JsonPaletteType = {
}
};

export type EncodingType = {
export type ContentBmwEncodingType = LayoutInfoType;

export type EncodingType = BlissSymbolInfoType & {
id: string,
label: string,
bciAvId: BciAvIdType
};

export type PaletteFileMapType = {
Expand Down

0 comments on commit 2e4c520

Please sign in to comment.