grid / Exports
grid
Type Aliases
Arrow
Ƭ Arrow: Object
Arrow
Type declaration
| Name | Type | Description |
|---|---|---|
direction | ArrowDir | Direction of the arrow |
position | Vec | Position of the arrow relative to the cell |
Defined in
ArrowDir
Ƭ ArrowDir: "right" | "down" | "rightdown" | "downright" | "none"
Arrow directions
Defined in
Bounds
Ƭ Bounds: Object
Bounds of a word within a cell
Type declaration
| Name | Type | Description |
|---|---|---|
cells | Cell[] | All the cells of the word |
end | Vec | End position of the word |
length | number | Length of the word |
start | Vec | Start position of the word |
Defined in
Cell
Ƭ Cell: Object
Type declaration
| Name | Type | Description |
|---|---|---|
arrows | ArrowDir[] | Arrows of the cell |
definition | boolean | wether the cell is a definition cell |
highlighted | boolean | wether the cell is highlighted or not (editor) |
spaceH | boolean | Wether there is a space on Horizontal direction |
spaceV | boolean | Wether there is a space on Vertical direction |
suggestion | string | Suggestion for the cell (editor) |
text | string | Text of the cell (definition and not definition) |
x | number | X position of the cell |
y | number | Y position of the cell |
Defined in
DeepPartial
Ƭ DeepPartial<T>: T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T
Type parameters
| Name |
|---|
T |
Defined in
DefGrid
Ƭ DefGrid: boolean[][]
Defined in
Direction
Ƭ Direction: "horizontal" | "vertical"
Defined in
Format
Ƭ Format: Object
Format for printing
Type declaration
| Name | Type | Description |
|---|---|---|
dpi | number | dots per pixels (unused) |
height | number | Height of the paper(cm) |
margin | { bottom: number ; left: number ; right: number ; top: number } | Margin of the paper (cm) |
margin.bottom | number | - |
margin.left | number | - |
margin.right | number | - |
margin.top | number | - |
orientation | string | Orientation of the paper (portrait or landscape) |
width | number | Width of the paper(cm) |
Defined in
GridOptions
Ƭ GridOptions: Object
Grid options defines the style of the grid
Type declaration
| Name | Type | Description |
|---|---|---|
arrow | { color: string ; size: number } | Arrow style |
arrow.color | string | - |
arrow.size | number | - |
definition | TextSyle<number> & { backgroundColor: string } | Definition style |
grid | { borderColor: string ; borderSize: number ; cellSize: number ; outerBorderColor: string ; outerBorderSize: number ; spaceSize: number } | Grid style |
grid.borderColor | string | Color of the lines |
grid.borderSize | number | Size of the lines |
grid.cellSize | number | Size of the cell |
grid.outerBorderColor | string | Color of the outer border |
grid.outerBorderSize | number | Size of the outer border |
grid.spaceSize | number | width of the line showind spaceV and spaceH |
id | string | Id of the Options(db) |
name | string | Name of the Options |
paper | Format | Format for printing |
Defined in
GridState
Ƭ GridState: Object
JSON format of the grid Used to serialize and deserialize the grid
Type declaration
| Name | Type |
|---|---|
cells | Cell[][] |
cols | number |
comment | string |
created | number |
id | string |
optionsId | string |
rows | number |
title | string |
Defined in
Lookup
Ƭ Lookup<T>: Object
Type parameters
| Name |
|---|
T |
Index signature
▪ [key: number | string]: T
Defined in
SolutionOptions
Ƭ SolutionOptions: GridOptions & { grids: { cols: number ; gridN: TextSyle ; rows: number } ; isSolution: true ; size: TextSyle ; words: TextSyle & { tolerance: number } }
Options for the solution
Defined in
Vec
Ƭ Vec: Object
Type declaration
| Name | Type |
|---|---|
x | number |
y | number |
Defined in
WordAndPosition
Ƭ WordAndPosition: Object
Type declaration
| Name | Type |
|---|---|
direction | Direction |
start | Vec |
word | string |
Defined in
Variables
DPI_TO_PIXEL
• Const DPI_TO_PIXEL: 25.4
Defined in
arrowDirs
• Const arrowDirs: string[][]
Defined in
defaultOptions
• Const defaultOptions: GridOptions
Defined in
defaultSolutionOptions
• Const defaultSolutionOptions: SolutionOptions
Defined in
nullCell
• Const nullCell: Cell
Null cell Used to represent a cell that is not in the grid
Defined in
Functions
arrowPositions
▸ arrowPositions(cell): { x: number = 1; y: number }[]
From a definition cell, returns the position of the arrows
Parameters
| Name | Type |
|---|---|
cell | Cell |
Returns
{ x: number = 1; y: number }[]
Defined in
borderWidth
▸ borderWidth(options): number
Parameters
| Name | Type |
|---|---|
options | GridOptions |
Returns
number
Defined in
cellAndBorderWidth
▸ cellAndBorderWidth(options): number
Returns the width of a cell and its border
Parameters
| Name | Type |
|---|---|
options | GridOptions |
Returns
number
Defined in
cellWidth
▸ cellWidth(options): number
Parameters
| Name | Type |
|---|---|
options | GridOptions |
Returns
number
Defined in
duplicate
▸ duplicate(options): Object
Parameters
| Name | Type |
|---|---|
options | GridOptions |
Returns
Object
| Name | Type | Description |
|---|---|---|
arrow | { color: string ; size: number } | Arrow style |
arrow.color | string | - |
arrow.size | number | - |
definition | TextSyle<number> & { backgroundColor: string } | Definition style |
grid | { borderColor: string ; borderSize: number ; cellSize: number ; outerBorderColor: string ; outerBorderSize: number ; spaceSize: number } | Grid style |
grid.borderColor | string | Color of the lines |
grid.borderSize | number | Size of the lines |
grid.cellSize | number | Size of the cell |
grid.outerBorderColor | string | Color of the outer border |
grid.outerBorderSize | number | Size of the outer border |
grid.spaceSize | number | width of the line showind spaceV and spaceH |
id | string | - |
name | string | Name of the Options |
paper | Format | Format for printing |
Defined in
format
▸ format(num, unit): string
From an array of [value, unit] returns a string like 10cm
Parameters
| Name | Type | Description |
|---|---|---|
num | number | value |
unit | string | unit |
Returns
string
the formatted string
Defined in
getAllWords
▸ getAllWords(grids): Set<string>
From a list of grids, returns all the words
Parameters
| Name | Type |
|---|---|
grids | Grid[] |
Returns
Set<string>
Defined in
getLines
▸ getLines(cell): string[]
From a definition cell, returns the lines of text
Parameters
| Name | Type |
|---|---|
cell | Cell |
Returns
string[]
Defined in
getWords
▸ getWords(grid): Object
From a grid, returns all the words and their positions
Parameters
| Name | Type |
|---|---|
grid | Grid |
Returns
Object
| Name | Type |
|---|---|
words | Set<string> |
wordsAndBounds | WordAndPosition[] |
Defined in
gridHeight
▸ gridHeight(grid, options): number
Returns the height of the grid (without outer border)
Parameters
| Name | Type |
|---|---|
grid | Grid |
options | GridOptions |
Returns
number
Defined in
gridTotalHeight
▸ gridTotalHeight(grid, options): number
Returns the total height of the grid (with outer border)
Parameters
| Name | Type |
|---|---|
grid | Grid |
options | GridOptions |
Returns
number
Defined in
gridTotalWidth
▸ gridTotalWidth(grid, options): number
Returns the total width of the grid (with outer border)
Parameters
| Name | Type |
|---|---|
grid | Grid |
options | GridOptions |
Returns
number
Defined in
gridWidth
▸ gridWidth(grid, options): number
Returns the width of the grid (without outer border)
Parameters
| Name | Type |
|---|---|
grid | Grid |
options | GridOptions |
Returns
number
Defined in
isSplited
▸ isSplited(cell): boolean
Checks that a definition cell is splited or not
Parameters
| Name | Type | Description |
|---|---|---|
cell | Cell | cell to check |
Returns
boolean
wether the cell is splited or not
Defined in
newOptions
▸ newOptions(): Object
Returns
Object
| Name | Type | Description |
|---|---|---|
arrow | { color: string ; size: number } | Arrow style |
arrow.color | string | - |
arrow.size | number | - |
definition | TextSyle<number> & { backgroundColor: string } | Definition style |
grid | { borderColor: string ; borderSize: number ; cellSize: number ; outerBorderColor: string ; outerBorderSize: number ; spaceSize: number } | Grid style |
grid.borderColor | string | Color of the lines |
grid.borderSize | number | Size of the lines |
grid.cellSize | number | Size of the cell |
grid.outerBorderColor | string | Color of the outer border |
grid.outerBorderSize | number | Size of the outer border |
grid.spaceSize | number | width of the line showind spaceV and spaceH |
id | string | - |
name | string | Name of the Options |
paper | Format | Format for printing |
Defined in
outerBorderWidth
▸ outerBorderWidth(options): number
Parameters
| Name | Type |
|---|---|
options | GridOptions |
Returns
number
Defined in
parse
▸ parse(str): [number, string]
From a string like 10cm returns [10.cm]
Parameters
| Name | Type | Description |
|---|---|---|
str | string | input string |
Returns
[number, string]
[value, unit]
Defined in
splitIndex
▸ splitIndex(cell): number
From a definition cell, returns where is the split
Parameters
| Name | Type |
|---|---|
cell | Cell |
Returns
number