UNPKG

generaltranslation

Version:

A language toolkit for AI developers

1 lines 1.86 kB
{"version":3,"file":"types.cjs.min.cjs","sources":["../src/types-dir/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the content\n */\nexport type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';\n\n/**\n * A content type representing JSX, ICU, and I18next messages\n */\nexport type Content = JsxChildren | IcuMessage | I18nextMessage;\n\n/**\n * A content type representing JSX elements\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages\n */\nexport type I18nextMessage = string;\n"],"names":["pl","ti","alt","arl","arb","ard"],"mappings":"wCAKkC,CAChCA,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}