Skip to content

Commit

Permalink
Merge pull request #21 from MarvNC/update-schemas
Browse files Browse the repository at this point in the history
Update Types for Schemas
  • Loading branch information
MarvNC authored Jul 7, 2024
2 parents cb8b906 + ab12a4f commit 197afa6
Show file tree
Hide file tree
Showing 3 changed files with 227 additions and 5 deletions.
191 changes: 191 additions & 0 deletions src/types/IsoLanguageCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/**
* ISO language code (ISO 639-1 where possible, ISO 639-3 otherwise).
*/
export type IsoLanguageCode =
| 'aa'
| 'ab'
| 'ae'
| 'af'
| 'ak'
| 'am'
| 'an'
| 'ar'
| 'as'
| 'av'
| 'ay'
| 'az'
| 'az'
| 'ba'
| 'be'
| 'bg'
| 'bh'
| 'bi'
| 'bm'
| 'bn'
| 'bo'
| 'br'
| 'bs'
| 'ca'
| 'ce'
| 'ch'
| 'co'
| 'cr'
| 'cs'
| 'cu'
| 'cv'
| 'cy'
| 'da'
| 'de'
| 'dv'
| 'dz'
| 'ee'
| 'el'
| 'en'
| 'eo'
| 'es'
| 'et'
| 'eu'
| 'fa'
| 'ff'
| 'fi'
| 'fj'
| 'fo'
| 'fr'
| 'fy'
| 'ga'
| 'gd'
| 'gl'
| 'gn'
| 'grc'
| 'gu'
| 'gv'
| 'ha'
| 'he'
| 'hi'
| 'ho'
| 'hr'
| 'ht'
| 'hu'
| 'hy'
| 'hz'
| 'ia'
| 'id'
| 'ie'
| 'ig'
| 'ii'
| 'ik'
| 'io'
| 'is'
| 'it'
| 'iu'
| 'ja'
| 'jv'
| 'ka'
| 'kg'
| 'ki'
| 'kj'
| 'kk'
| 'kl'
| 'km'
| 'kn'
| 'ko'
| 'kr'
| 'ks'
| 'ku'
| 'kv'
| 'kw'
| 'ky'
| 'la'
| 'lb'
| 'lg'
| 'li'
| 'ln'
| 'lo'
| 'lt'
| 'lu'
| 'lv'
| 'mg'
| 'mh'
| 'mi'
| 'mk'
| 'ml'
| 'mn'
| 'mr'
| 'ms'
| 'mt'
| 'my'
| 'na'
| 'nb'
| 'nd'
| 'ne'
| 'ng'
| 'nl'
| 'nn'
| 'no'
| 'nr'
| 'nv'
| 'ny'
| 'oc'
| 'oj'
| 'om'
| 'or'
| 'os'
| 'pa'
| 'pi'
| 'pl'
| 'ps'
| 'pt'
| 'qu'
| 'rm'
| 'rn'
| 'ro'
| 'ru'
| 'rw'
| 'sa'
| 'sc'
| 'sd'
| 'se'
| 'sg'
| 'sh'
| 'si'
| 'sk'
| 'sl'
| 'sm'
| 'sn'
| 'so'
| 'sq'
| 'sr'
| 'ss'
| 'st'
| 'su'
| 'sv'
| 'sw'
| 'ta'
| 'te'
| 'tg'
| 'th'
| 'ti'
| 'tk'
| 'tl'
| 'tn'
| 'to'
| 'tr'
| 'ts'
| 'tt'
| 'tw'
| 'ty'
| 'ug'
| 'uk'
| 'ur'
| 'uz'
| 've'
| 'vi'
| 'vo'
| 'wa'
| 'wo'
| 'xh'
| 'yi'
| 'yo'
| 'za'
| 'zh'
| 'zu';
36 changes: 32 additions & 4 deletions src/types/yomitan/dictionaryindex.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
import { IsoLanguageCode } from '../IsoLanguageCode';

/**
* Information about a single tag.
*/
type TagInfo = {
category?: string;
order?: number;
notes?: string;
score?: number;
};

/**
* Represents the structure of a dictionary index file.
*/
type DictionaryIndexType = {
/** Title of the dictionary. */
title: string;
/** Revision of the dictionary. This value is only used for displaying information. */
revision: string;
/** Whether or not this dictionary contains sequencing information for related terms. */
sequenced?: boolean;
/** Format of data found in the JSON data files. */
format?: 1 | 2 | 3;
author: string;
/** Creator of the dictionary. */
author?: string;
/** URL for the source of the dictionary. */
url?: string;
description: string;
attribution: string;
/** Description of the dictionary data. */
description?: string;
/** Attribution information for the dictionary data. */
attribution?: string;
/** Language of the terms in the dictionary. */
sourceLanguage?: IsoLanguageCode;
/** Main language of the definitions in the dictionary. */
targetLanguage?: IsoLanguageCode;
/** Frequency mode of the dictionary. */
frequencyMode?: 'occurrence-based' | 'rank-based';
};

export type { DictionaryIndexType };
export type { DictionaryIndexType, IsoLanguageCode, TagInfo };
5 changes: 4 additions & 1 deletion src/types/yomitan/termbank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type StructuredContentStyle = {
fontWeight?: 'normal' | 'bold';
fontSize?: string;
color?: string;
background?: string;
backgroundColor?: string;
textDecorationLine?:
| 'none'
Expand All @@ -50,6 +51,7 @@ type StructuredContentStyle = {
borderStyle?: string;
borderRadius?: string;
borderWidth?: string;
clipPath?: string;
verticalAlign?:
| 'baseline'
| 'sub'
Expand All @@ -68,6 +70,7 @@ type StructuredContentStyle = {
| 'justify'
| 'justify-all'
| 'match-parent';
textEmphasis?: string;
textShadow?: string;
margin?: string;
marginTop?: number | string;
Expand Down Expand Up @@ -108,7 +111,7 @@ type StructuredContentNode =
lang?: string;
}
| {
tag: 'span' | 'div' | 'ol' | 'ul' | 'li';
tag: 'span' | 'div' | 'ol' | 'ul' | 'li' | 'details' | 'summary';
content?: StructuredContentNode;
data?: StructuredContentData;
style?: StructuredContentStyle;
Expand Down

0 comments on commit 197afa6

Please sign in to comment.