@g9tm/lynxcontrols-foundation 2.5.6 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/catalog/catalog.json +235 -3
- package/catalog/index.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/culture/text.d.ts +2 -0
- package/dist/culture/text.d.ts.map +1 -1
- package/dist/culture/text.js +3 -2
- package/dist/culture/text.js.map +1 -1
- package/dist/services/keys.d.ts +7 -0
- package/dist/services/keys.d.ts.map +1 -1
- package/dist/services/keys.js.map +1 -1
- package/dist/theme/appearance-kit.d.ts +148 -0
- package/dist/theme/appearance-kit.d.ts.map +1 -0
- package/dist/theme/appearance-kit.js +410 -0
- package/dist/theme/appearance-kit.js.map +1 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -0
- package/docs/api.md +29 -0
- package/package.json +1 -1
package/dist/culture/text.js
CHANGED
|
@@ -69,9 +69,10 @@ function groupWhileTyping(raw, caret = raw.length, options = {}) {
|
|
|
69
69
|
if (kept && i < caret) before++;
|
|
70
70
|
}
|
|
71
71
|
let [int = '', frac] = digits.split('.');
|
|
72
|
-
|
|
72
|
+
const grouping = false !== options.grouping;
|
|
73
|
+
if (grouping) int = int.replace(/^0+(?=\d)/, '');
|
|
73
74
|
if (void 0 !== frac) frac = frac.slice(0, decimals);
|
|
74
|
-
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
75
|
+
const grouped = grouping ? int.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : int;
|
|
75
76
|
const asciiText = `${negative ? '-' : ''}${grouped}${point ? `.${null != frac ? frac : ''}` : ''}`;
|
|
76
77
|
let pos = 0;
|
|
77
78
|
let seen = 0;
|
package/dist/culture/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"culture/text.js","sources":["../../src/culture/text.ts"],"sourcesContent":["// Text helpers every app re-wrote (SAC core/text.ts, Riskara core/text.ts, ShopManager core/text.ts, G9Hub intl): search\n// keys that match Persian however it was typed, numbers grouped while the person types (caret kept), compact money,\n// signed percentages that survive right-to-left text, bidi isolation and phone numbers.\nimport { type G9NumberingSystem, normalizeToAscii, toNativeDigits } from './digits';\nimport { formatNumber, getNumberSymbols } from './numbers';\n\n/** Arabic letter forms typed on Arabic keyboards → the Persian forms (ي ك ى ة ۀ), plus Arabic-Indic digits → Persian. */\nconst LETTERS: ReadonlyArray<readonly [RegExp, string]> = [\n [/[يى]/g, 'ی'],\n [/ك/g, 'ک'],\n [/ۀ/g, 'ه'],\n [/ة/g, 'ه'],\n [/[أإٱآ]/g, 'ا'],\n [/ؤ/g, 'و'],\n];\n// Harakat, tatweel, and the ZWNJ / bidi marks that make identical-looking words differ.\nconst MARKS = /[ً-ٰٟـ---]/g;\n\n/** Unifies how Persian is written: Arabic letter forms → Persian, digits → ASCII, marks removed, spaces collapsed. */\nexport function normalizeText(input: string | null | undefined): string {\n let s = normalizeToAscii(input ?? '');\n for (const [re, to] of LETTERS) s = s.replace(re, to);\n return s.replace(MARKS, '').replace(/\\s+/g, ' ').trim();\n}\n\n/** A key to compare for search: {@link normalizeText}, lower-cased, ZWNJ-split words joined (`میروم` = `میروم`). */\nexport function searchKey(input: string | null | undefined): string {\n return normalizeText(input).toLowerCase();\n}\n\n/** True when every word of `query` appears in `text` (any order, any spelling variant `normalizeText` unifies). */\nexport function matchesSearch(text: string | null | undefined, query: string | null | undefined): boolean {\n const words = searchKey(query).split(' ').filter(Boolean);\n if (words.length === 0) return true;\n const hay = searchKey(text);\n return words.every((w) => hay.includes(w));\n}\n\n/** The result of {@link groupWhileTyping}. */\nexport interface G9TypedNumber {\n /** The text to show (grouped, in the requested digits). */\n readonly text: string;\n /** Where the caret goes in `text`. */\n readonly caret: number;\n /** The value, or null when the text is empty or only a sign. */\n readonly value: number | null;\n}\n\n/**\n * Regroups a number while it is typed and keeps the caret after the same digit (SAC `groupTyped`): typing `1234567`\n * shows `1,234,567` (or `۱٬۲۳۴٬۵۶۷`), and the caret does not jump to the end when a digit is inserted in the middle.\n * Accepts any digits and separators the person types; `decimals` 0 refuses a decimal point.\n */\nexport function groupWhileTyping(\n raw: string,\n caret: number = raw.length,\n options: {\n readonly numberingSystem?: G9NumberingSystem;\n readonly decimals?: number;\n readonly allowNegative?: boolean;\n } = {},\n): G9TypedNumber {\n const system = options.numberingSystem ?? 'latin';\n const sym = getNumberSymbols(system);\n const decimals = options.decimals ?? 0;\n // how many significant characters (digits, the decimal point, a minus) stand before the caret\n const ascii = normalizeToAscii(raw);\n const isDecimal = (ch: string) => ch === '.' || ch === '٫' || ch === '/' || (ch === ',' && false);\n let before = 0;\n let digits = '';\n let point = false;\n let negative = false;\n for (let i = 0; i < ascii.length; i++) {\n const ch = ascii[i] as string;\n let kept = false;\n if (ch >= '0' && ch <= '9') {\n digits += ch;\n kept = true;\n } else if (isDecimal(ch) && decimals > 0 && !point) {\n digits += '.';\n point = true;\n kept = true;\n } else if ((ch === '-' || ch === '−') && options.allowNegative && digits.length === 0 && !negative) {\n negative = true;\n kept = true;\n }\n if (kept && i < caret) before++;\n }\n let [int = '', frac] = digits.split('.');\n int = int.replace(/^0+(?=\\d)/, '');\n if (frac !== undefined) frac = frac.slice(0, decimals);\n const grouped = int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n const asciiText = `${negative ? '-' : ''}${grouped}${point ? `.${frac ?? ''}` : ''}`;\n // place the caret after the same number of significant characters\n let pos = 0;\n let seen = 0;\n while (pos < asciiText.length && seen < before) {\n if (asciiText[pos] !== ',') seen++;\n pos++;\n }\n const value = int === '' && !frac ? null : Number(`${negative ? '-' : ''}${int || '0'}${frac ? `.${frac}` : ''}`);\n const text =\n system === 'latin'\n ? asciiText\n : toNativeDigits(asciiText.replace(/,/g, sym.group).replace('.', sym.decimal).replace('-', sym.minus), system);\n // the native minus may be two characters (a bidi mark + the sign): shift the caret by the extra length\n const extra = negative && system !== 'latin' ? sym.minus.length - 1 : 0;\n return { text, caret: pos + (pos > 0 ? extra : 0), value: Number.isFinite(value as number) ? value : null };\n}\n\nconst FA_UNITS: ReadonlyArray<readonly [number, string]> = [\n [1e12, 'هزار میلیارد'],\n [1e9, 'میلیارد'],\n [1e6, 'میلیون'],\n [1e3, 'هزار'],\n];\nconst EN_UNITS: ReadonlyArray<readonly [number, string]> = [\n [1e12, 'T'],\n [1e9, 'B'],\n [1e6, 'M'],\n [1e3, 'K'],\n];\n\n/**\n * A large amount in words people say (Riskara `toman({short})`, SAC `price`): `12_500_000` → `۱۲٫۵ میلیون` (fa) or\n * `12.5M` (en). One fraction digit, dropped when it is zero; amounts under a thousand stay whole.\n */\nexport function formatCompact(\n value: number,\n options: { readonly language?: string; readonly numberingSystem?: G9NumberingSystem; readonly unit?: string } = {},\n): string {\n const fa = (options.language ?? 'en').startsWith('fa');\n const system = options.numberingSystem ?? (fa ? 'persian' : 'latin');\n const abs = Math.abs(value);\n const units = fa ? FA_UNITS : EN_UNITS;\n const hit = units.find(([n]) => abs >= n);\n const n = hit ? value / hit[0] : value;\n const body = formatNumber(n, { numberingSystem: system, maximumFractionDigits: hit ? 1 : 0, useGrouping: true });\n const unit = hit ? (fa ? ` ${hit[1]}` : hit[1]) : '';\n return `${body}${unit}${options.unit ? ` ${options.unit}` : ''}`;\n}\n\n/**\n * A weighed quantity (ShopManager `QtyText` / `kg`): kilograms to one decimal, dropped when whole, grouped, in the\n * culture's digits — `2.5` → `۲٫۵ کیلوگرم` (fa, long) / `۲٫۵ کیلو` (fa, short) / `2.5 kg` (en). Under a kilogram,\n * `grams: true` writes grams instead (`0.35` → `۳۵۰ گرم` / `350 g`).\n */\nexport function formatWeight(\n kilograms: number,\n options: {\n readonly language?: string;\n readonly numberingSystem?: G9NumberingSystem;\n readonly short?: boolean;\n readonly grams?: boolean;\n readonly decimals?: number;\n } = {},\n): string {\n const fa = (options.language ?? 'en').startsWith('fa');\n const system = options.numberingSystem ?? (fa ? 'persian' : 'latin');\n if (options.grams && Math.abs(kilograms) < 1 && kilograms !== 0) {\n const g = formatNumber(Math.round(kilograms * 1000), { numberingSystem: system, maximumFractionDigits: 0 });\n return fa ? `${g} گرم` : `${g} g`;\n }\n const body = formatNumber(kilograms, { numberingSystem: system, maximumFractionDigits: options.decimals ?? 1 });\n return fa ? `${body} ${options.short ? 'کیلو' : 'کیلوگرم'}` : `${body} kg`;\n}\n\nconst B64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n/** Standard base64 of bytes (PrimJS has neither `btoa` nor `Buffer`): data URIs of generated images. */\nexport function bytesToBase64(bytes: Uint8Array): string {\n const parts: string[] = [];\n let line = '';\n for (let i = 0; i < bytes.length; i += 3) {\n const a = bytes[i] as number;\n const b = i + 1 < bytes.length ? (bytes[i + 1] as number) : 0;\n const c = i + 2 < bytes.length ? (bytes[i + 2] as number) : 0;\n const n = (a << 16) | (b << 8) | c;\n line += B64.charAt((n >> 18) & 63) + B64.charAt((n >> 12) & 63);\n line += i + 1 < bytes.length ? B64.charAt((n >> 6) & 63) : '=';\n line += i + 2 < bytes.length ? B64.charAt(n & 63) : '=';\n // join in pieces: one string grown by += for 40 KB is slow on an interpreter\n if (line.length >= 4096) {\n parts.push(line);\n line = '';\n }\n }\n parts.push(line);\n return parts.join('');\n}\n\n/** Left-to-right isolate (FSI…PDI would guess; LRI forces): keeps `+12.5%` and phone numbers whole inside RTL text. */\nexport const isolateLtr = (text: string): string => `${text}`;\n/** Right-to-left isolate. */\nexport const isolateRtl = (text: string): string => `${text}`;\n/** First-strong isolate: the direction of the text's first letter. */\nexport const isolate = (text: string): string => `${text}`;\n\n/**\n * A change as a signed percentage, always with its sign and isolated so RTL text never moves the sign to the wrong end\n * (Riskara `pct`, SAC `Delta`): `0.125` → `+12.5%`; `formatSignedPercent(-3, { fromFraction: false })` → `−3%`.\n */\nexport function formatSignedPercent(\n value: number,\n options: {\n readonly decimals?: number;\n readonly numberingSystem?: G9NumberingSystem;\n readonly fromFraction?: boolean;\n } = {},\n): string {\n const v = options.fromFraction === false ? value : value * 100;\n const decimals = options.decimals ?? 1;\n const rounded = Number(v.toFixed(decimals));\n const sign = rounded > 0 ? '+' : rounded < 0 ? '−' : '';\n const body = formatNumber(Math.abs(rounded), {\n numberingSystem: options.numberingSystem ?? 'latin',\n maximumFractionDigits: decimals,\n useGrouping: true,\n });\n const percent = options.numberingSystem && options.numberingSystem !== 'latin' ? '٪' : '%';\n return isolateLtr(`${sign}${body}${percent}`);\n}\n\n/**\n * A phone number in E.164 (`+989121234567`), or null. Accepts any digits, spaces, dashes, a leading 0, 00 or +, and the\n * national form; `country` gives the calling code for national numbers (default Iran, 98).\n */\nexport function normalizePhone(\n input: string | null | undefined,\n country: { readonly code: string; readonly nationalLength: number } = { code: '98', nationalLength: 10 },\n): string | null {\n const ascii = normalizeToAscii(input ?? '').replace(/[\\s\\-().]/g, '');\n if (!/^\\+?\\d+$/.test(ascii)) return null;\n let digits = ascii.startsWith('+') ? ascii.slice(1) : ascii.startsWith('00') ? ascii.slice(2) : ascii;\n if (!ascii.startsWith('+') && !ascii.startsWith('00')) {\n if (digits.startsWith('0')) digits = digits.slice(1);\n if (digits.length === country.nationalLength) digits = country.code + digits;\n }\n if (digits.startsWith(country.code) && digits.length !== country.code.length + country.nationalLength) return null;\n return digits.length >= 8 && digits.length <= 15 ? `+${digits}` : null;\n}\n"],"names":["LETTERS","MARKS","normalizeText","input","s","normalizeToAscii","re","to","searchKey","matchesSearch","text","query","words","Boolean","hay","w","groupWhileTyping","raw","caret","options","_options_numberingSystem","_options_decimals","system","sym","getNumberSymbols","decimals","ascii","isDecimal","ch","before","digits","point","negative","i","kept","int","frac","undefined","grouped","asciiText","pos","seen","value","Number","toNativeDigits","extra","FA_UNITS","EN_UNITS","formatCompact","_options_language","fa","abs","Math","units","hit","n","body","formatNumber","unit","formatWeight","kilograms","g","B64","bytesToBase64","bytes","parts","line","a","b","c","isolateLtr","isolateRtl","isolate","formatSignedPercent","v","rounded","sign","percent","normalizePhone","country"],"mappings":";;AAOA,MAAMA,UAAoD;IACxD;QAAC;QAAS;KAAI;IACd;QAAC;QAAM;KAAI;IACX;QAAC;QAAM;KAAI;IACX;QAAC;QAAM;KAAI;IACX;QAAC;QAAW;KAAI;IAChB;QAAC;QAAM;KAAI;CACZ;AAED,MAAMC,QAAQ;AAGP,SAASC,cAAcC,KAAgC;IAC5D,IAAIC,IAAIC,iBAAiBF,QAAAA,QAAAA,QAAS;IAClC,KAAK,MAAM,CAACG,IAAIC,GAAG,IAAIP,QAASI,IAAIA,EAAE,OAAO,CAACE,IAAIC;IAClD,OAAOH,EAAE,OAAO,CAACH,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;AACvD;AAGO,SAASO,UAAUL,KAAgC;IACxD,OAAOD,cAAcC,OAAO,WAAW;AACzC;AAGO,SAASM,cAAcC,IAA+B,EAAEC,KAAgC;IAC7F,MAAMC,QAAQJ,UAAUG,OAAO,KAAK,CAAC,KAAK,MAAM,CAACE;IACjD,IAAID,AAAiB,MAAjBA,MAAM,MAAM,EAAQ,OAAO;IAC/B,MAAME,MAAMN,UAAUE;IACtB,OAAOE,MAAM,KAAK,CAAC,CAACG,IAAMD,IAAI,QAAQ,CAACC;AACzC;AAiBO,SAASC,iBACdC,GAAW,EACXC,QAAgBD,IAAI,MAAM,EAC1BE,UAII,CAAC,CAAC;QAESC,0BAEEC;IAFjB,MAAMC,SAAS,QAAAF,CAAAA,2BAAAA,QAAQ,eAAe,AAAD,IAAtBA,2BAA2B;IAC1C,MAAMG,MAAMC,iBAAiBF;IAC7B,MAAMG,WAAW,QAAAJ,CAAAA,oBAAAA,QAAQ,QAAQ,AAAD,IAAfA,oBAAoB;IAErC,MAAMK,QAAQrB,iBAAiBY;IAC/B,MAAMU,YAAY,CAACC,KAAeA,AAAO,QAAPA,MAAcA,AAAO,QAAPA,MAAcA,AAAO,QAAPA,MAAeA,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AAU;QAC3C,iBAAiB,QAAAvD,CAAAA,2BAAAA,QAAQ,eAAe,AAAD,IAAtBA,2BAA2B;QAC5C,uBAAuBK;QACvB,aAAa;IACf;IACA,MAAMoD,UAAU1D,QAAQ,eAAe,IAAIA,AAA4B,YAA5BA,QAAQ,eAAe,GAAe,MAAM;IACvF,OAAOmD,WAAW,GAAGM,OAAOpB,OAAOqB,SAAS;AAC9C;AAMO,SAASC,eACd3E,KAAgC,EAChC4E,UAAsE;IAAE,MAAM;IAAM,gBAAgB;AAAG,CAAC;IAExG,MAAMrD,QAAQrB,iBAAiBF,QAAAA,QAAAA,QAAS,IAAI,OAAO,CAAC,cAAc;IAClE,IAAI,CAAC,WAAW,IAAI,CAACuB,QAAQ,OAAO;IACpC,IAAII,SAASJ,MAAM,UAAU,CAAC,OAAOA,MAAM,KAAK,CAAC,KAAKA,MAAM,UAAU,CAAC,QAAQA,MAAM,KAAK,CAAC,KAAKA;IAChG,IAAI,CAACA,MAAM,UAAU,CAAC,QAAQ,CAACA,MAAM,UAAU,CAAC,OAAO;QACrD,IAAII,OAAO,UAAU,CAAC,MAAMA,SAASA,OAAO,KAAK,CAAC;QAClD,IAAIA,OAAO,MAAM,KAAKiD,QAAQ,cAAc,EAAEjD,SAASiD,QAAQ,IAAI,GAAGjD;IACxE;IACA,IAAIA,OAAO,UAAU,CAACiD,QAAQ,IAAI,KAAKjD,OAAO,MAAM,KAAKiD,QAAQ,IAAI,CAAC,MAAM,GAAGA,QAAQ,cAAc,EAAE,OAAO;IAC9G,OAAOjD,OAAO,MAAM,IAAI,KAAKA,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,EAAEA,QAAQ,GAAG;AACpE"}
|
|
1
|
+
{"version":3,"file":"culture/text.js","sources":["../../src/culture/text.ts"],"sourcesContent":["// Text helpers every app re-wrote (SAC core/text.ts, Riskara core/text.ts, ShopManager core/text.ts, G9Hub intl): search\n// keys that match Persian however it was typed, numbers grouped while the person types (caret kept), compact money,\n// signed percentages that survive right-to-left text, bidi isolation and phone numbers.\nimport { type G9NumberingSystem, normalizeToAscii, toNativeDigits } from './digits';\nimport { formatNumber, getNumberSymbols } from './numbers';\n\n/** Arabic letter forms typed on Arabic keyboards → the Persian forms (ي ك ى ة ۀ), plus Arabic-Indic digits → Persian. */\nconst LETTERS: ReadonlyArray<readonly [RegExp, string]> = [\n [/[يى]/g, 'ی'],\n [/ك/g, 'ک'],\n [/ۀ/g, 'ه'],\n [/ة/g, 'ه'],\n [/[أإٱآ]/g, 'ا'],\n [/ؤ/g, 'و'],\n];\n// Harakat, tatweel, and the ZWNJ / bidi marks that make identical-looking words differ.\nconst MARKS = /[ً-ٰٟـ---]/g;\n\n/** Unifies how Persian is written: Arabic letter forms → Persian, digits → ASCII, marks removed, spaces collapsed. */\nexport function normalizeText(input: string | null | undefined): string {\n let s = normalizeToAscii(input ?? '');\n for (const [re, to] of LETTERS) s = s.replace(re, to);\n return s.replace(MARKS, '').replace(/\\s+/g, ' ').trim();\n}\n\n/** A key to compare for search: {@link normalizeText}, lower-cased, ZWNJ-split words joined (`میروم` = `میروم`). */\nexport function searchKey(input: string | null | undefined): string {\n return normalizeText(input).toLowerCase();\n}\n\n/** True when every word of `query` appears in `text` (any order, any spelling variant `normalizeText` unifies). */\nexport function matchesSearch(text: string | null | undefined, query: string | null | undefined): boolean {\n const words = searchKey(query).split(' ').filter(Boolean);\n if (words.length === 0) return true;\n const hay = searchKey(text);\n return words.every((w) => hay.includes(w));\n}\n\n/** The result of {@link groupWhileTyping}. */\nexport interface G9TypedNumber {\n /** The text to show (grouped, in the requested digits). */\n readonly text: string;\n /** Where the caret goes in `text`. */\n readonly caret: number;\n /** The value, or null when the text is empty or only a sign. */\n readonly value: number | null;\n}\n\n/**\n * Regroups a number while it is typed and keeps the caret after the same digit (SAC `groupTyped`): typing `1234567`\n * shows `1,234,567` (or `۱٬۲۳۴٬۵۶۷`), and the caret does not jump to the end when a digit is inserted in the middle.\n * Accepts any digits and separators the person types; `decimals` 0 refuses a decimal point.\n */\nexport function groupWhileTyping(\n raw: string,\n caret: number = raw.length,\n options: {\n readonly numberingSystem?: G9NumberingSystem;\n readonly decimals?: number;\n readonly allowNegative?: boolean;\n /** Thousands separators while typing. Default true; false for identifiers (a port, a code; 2.5.8). */\n readonly grouping?: boolean;\n } = {},\n): G9TypedNumber {\n const system = options.numberingSystem ?? 'latin';\n const sym = getNumberSymbols(system);\n const decimals = options.decimals ?? 0;\n // how many significant characters (digits, the decimal point, a minus) stand before the caret\n const ascii = normalizeToAscii(raw);\n const isDecimal = (ch: string) => ch === '.' || ch === '٫' || ch === '/' || (ch === ',' && false);\n let before = 0;\n let digits = '';\n let point = false;\n let negative = false;\n for (let i = 0; i < ascii.length; i++) {\n const ch = ascii[i] as string;\n let kept = false;\n if (ch >= '0' && ch <= '9') {\n digits += ch;\n kept = true;\n } else if (isDecimal(ch) && decimals > 0 && !point) {\n digits += '.';\n point = true;\n kept = true;\n } else if ((ch === '-' || ch === '−') && options.allowNegative && digits.length === 0 && !negative) {\n negative = true;\n kept = true;\n }\n if (kept && i < caret) before++;\n }\n let [int = '', frac] = digits.split('.');\n const grouping = options.grouping !== false;\n // an identifier keeps what was typed (its leading zeros too); an amount drops them\n if (grouping) int = int.replace(/^0+(?=\\d)/, '');\n if (frac !== undefined) frac = frac.slice(0, decimals);\n const grouped = grouping ? int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',') : int;\n const asciiText = `${negative ? '-' : ''}${grouped}${point ? `.${frac ?? ''}` : ''}`;\n // place the caret after the same number of significant characters\n let pos = 0;\n let seen = 0;\n while (pos < asciiText.length && seen < before) {\n if (asciiText[pos] !== ',') seen++;\n pos++;\n }\n const value = int === '' && !frac ? null : Number(`${negative ? '-' : ''}${int || '0'}${frac ? `.${frac}` : ''}`);\n const text =\n system === 'latin'\n ? asciiText\n : toNativeDigits(asciiText.replace(/,/g, sym.group).replace('.', sym.decimal).replace('-', sym.minus), system);\n // the native minus may be two characters (a bidi mark + the sign): shift the caret by the extra length\n const extra = negative && system !== 'latin' ? sym.minus.length - 1 : 0;\n return { text, caret: pos + (pos > 0 ? extra : 0), value: Number.isFinite(value as number) ? value : null };\n}\n\nconst FA_UNITS: ReadonlyArray<readonly [number, string]> = [\n [1e12, 'هزار میلیارد'],\n [1e9, 'میلیارد'],\n [1e6, 'میلیون'],\n [1e3, 'هزار'],\n];\nconst EN_UNITS: ReadonlyArray<readonly [number, string]> = [\n [1e12, 'T'],\n [1e9, 'B'],\n [1e6, 'M'],\n [1e3, 'K'],\n];\n\n/**\n * A large amount in words people say (Riskara `toman({short})`, SAC `price`): `12_500_000` → `۱۲٫۵ میلیون` (fa) or\n * `12.5M` (en). One fraction digit, dropped when it is zero; amounts under a thousand stay whole.\n */\nexport function formatCompact(\n value: number,\n options: { readonly language?: string; readonly numberingSystem?: G9NumberingSystem; readonly unit?: string } = {},\n): string {\n const fa = (options.language ?? 'en').startsWith('fa');\n const system = options.numberingSystem ?? (fa ? 'persian' : 'latin');\n const abs = Math.abs(value);\n const units = fa ? FA_UNITS : EN_UNITS;\n const hit = units.find(([n]) => abs >= n);\n const n = hit ? value / hit[0] : value;\n const body = formatNumber(n, { numberingSystem: system, maximumFractionDigits: hit ? 1 : 0, useGrouping: true });\n const unit = hit ? (fa ? ` ${hit[1]}` : hit[1]) : '';\n return `${body}${unit}${options.unit ? ` ${options.unit}` : ''}`;\n}\n\n/**\n * A weighed quantity (ShopManager `QtyText` / `kg`): kilograms to one decimal, dropped when whole, grouped, in the\n * culture's digits — `2.5` → `۲٫۵ کیلوگرم` (fa, long) / `۲٫۵ کیلو` (fa, short) / `2.5 kg` (en). Under a kilogram,\n * `grams: true` writes grams instead (`0.35` → `۳۵۰ گرم` / `350 g`).\n */\nexport function formatWeight(\n kilograms: number,\n options: {\n readonly language?: string;\n readonly numberingSystem?: G9NumberingSystem;\n readonly short?: boolean;\n readonly grams?: boolean;\n readonly decimals?: number;\n } = {},\n): string {\n const fa = (options.language ?? 'en').startsWith('fa');\n const system = options.numberingSystem ?? (fa ? 'persian' : 'latin');\n if (options.grams && Math.abs(kilograms) < 1 && kilograms !== 0) {\n const g = formatNumber(Math.round(kilograms * 1000), { numberingSystem: system, maximumFractionDigits: 0 });\n return fa ? `${g} گرم` : `${g} g`;\n }\n const body = formatNumber(kilograms, { numberingSystem: system, maximumFractionDigits: options.decimals ?? 1 });\n return fa ? `${body} ${options.short ? 'کیلو' : 'کیلوگرم'}` : `${body} kg`;\n}\n\nconst B64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n/** Standard base64 of bytes (PrimJS has neither `btoa` nor `Buffer`): data URIs of generated images. */\nexport function bytesToBase64(bytes: Uint8Array): string {\n const parts: string[] = [];\n let line = '';\n for (let i = 0; i < bytes.length; i += 3) {\n const a = bytes[i] as number;\n const b = i + 1 < bytes.length ? (bytes[i + 1] as number) : 0;\n const c = i + 2 < bytes.length ? (bytes[i + 2] as number) : 0;\n const n = (a << 16) | (b << 8) | c;\n line += B64.charAt((n >> 18) & 63) + B64.charAt((n >> 12) & 63);\n line += i + 1 < bytes.length ? B64.charAt((n >> 6) & 63) : '=';\n line += i + 2 < bytes.length ? B64.charAt(n & 63) : '=';\n // join in pieces: one string grown by += for 40 KB is slow on an interpreter\n if (line.length >= 4096) {\n parts.push(line);\n line = '';\n }\n }\n parts.push(line);\n return parts.join('');\n}\n\n/** Left-to-right isolate (FSI…PDI would guess; LRI forces): keeps `+12.5%` and phone numbers whole inside RTL text. */\nexport const isolateLtr = (text: string): string => `${text}`;\n/** Right-to-left isolate. */\nexport const isolateRtl = (text: string): string => `${text}`;\n/** First-strong isolate: the direction of the text's first letter. */\nexport const isolate = (text: string): string => `${text}`;\n\n/**\n * A change as a signed percentage, always with its sign and isolated so RTL text never moves the sign to the wrong end\n * (Riskara `pct`, SAC `Delta`): `0.125` → `+12.5%`; `formatSignedPercent(-3, { fromFraction: false })` → `−3%`.\n */\nexport function formatSignedPercent(\n value: number,\n options: {\n readonly decimals?: number;\n readonly numberingSystem?: G9NumberingSystem;\n readonly fromFraction?: boolean;\n } = {},\n): string {\n const v = options.fromFraction === false ? value : value * 100;\n const decimals = options.decimals ?? 1;\n const rounded = Number(v.toFixed(decimals));\n const sign = rounded > 0 ? '+' : rounded < 0 ? '−' : '';\n const body = formatNumber(Math.abs(rounded), {\n numberingSystem: options.numberingSystem ?? 'latin',\n maximumFractionDigits: decimals,\n useGrouping: true,\n });\n const percent = options.numberingSystem && options.numberingSystem !== 'latin' ? '٪' : '%';\n return isolateLtr(`${sign}${body}${percent}`);\n}\n\n/**\n * A phone number in E.164 (`+989121234567`), or null. Accepts any digits, spaces, dashes, a leading 0, 00 or +, and the\n * national form; `country` gives the calling code for national numbers (default Iran, 98).\n */\nexport function normalizePhone(\n input: string | null | undefined,\n country: { readonly code: string; readonly nationalLength: number } = { code: '98', nationalLength: 10 },\n): string | null {\n const ascii = normalizeToAscii(input ?? '').replace(/[\\s\\-().]/g, '');\n if (!/^\\+?\\d+$/.test(ascii)) return null;\n let digits = ascii.startsWith('+') ? ascii.slice(1) : ascii.startsWith('00') ? ascii.slice(2) : ascii;\n if (!ascii.startsWith('+') && !ascii.startsWith('00')) {\n if (digits.startsWith('0')) digits = digits.slice(1);\n if (digits.length === country.nationalLength) digits = country.code + digits;\n }\n if (digits.startsWith(country.code) && digits.length !== country.code.length + country.nationalLength) return null;\n return digits.length >= 8 && digits.length <= 15 ? `+${digits}` : null;\n}\n"],"names":["LETTERS","MARKS","normalizeText","input","s","normalizeToAscii","re","to","searchKey","matchesSearch","text","query","words","Boolean","hay","w","groupWhileTyping","raw","caret","options","_options_numberingSystem","_options_decimals","system","sym","getNumberSymbols","decimals","ascii","isDecimal","ch","before","digits","point","negative","i","kept","int","frac","grouping","undefined","grouped","asciiText","pos","seen","value","Number","toNativeDigits","extra","FA_UNITS","EN_UNITS","formatCompact","_options_language","fa","abs","Math","units","hit","n","body","formatNumber","unit","formatWeight","kilograms","g","B64","bytesToBase64","bytes","parts","line","a","b","c","isolateLtr","isolateRtl","isolate","formatSignedPercent","v","rounded","sign","percent","normalizePhone","country"],"mappings":";;AAOA,MAAMA,UAAoD;IACxD;QAAC;QAAS;KAAI;IACd;QAAC;QAAM;KAAI;IACX;QAAC;QAAM;KAAI;IACX;QAAC;QAAM;KAAI;IACX;QAAC;QAAW;KAAI;IAChB;QAAC;QAAM;KAAI;CACZ;AAED,MAAMC,QAAQ;AAGP,SAASC,cAAcC,KAAgC;IAC5D,IAAIC,IAAIC,iBAAiBF,QAAAA,QAAAA,QAAS;IAClC,KAAK,MAAM,CAACG,IAAIC,GAAG,IAAIP,QAASI,IAAIA,EAAE,OAAO,CAACE,IAAIC;IAClD,OAAOH,EAAE,OAAO,CAACH,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;AACvD;AAGO,SAASO,UAAUL,KAAgC;IACxD,OAAOD,cAAcC,OAAO,WAAW;AACzC;AAGO,SAASM,cAAcC,IAA+B,EAAEC,KAAgC;IAC7F,MAAMC,QAAQJ,UAAUG,OAAO,KAAK,CAAC,KAAK,MAAM,CAACE;IACjD,IAAID,AAAiB,MAAjBA,MAAM,MAAM,EAAQ,OAAO;IAC/B,MAAME,MAAMN,UAAUE;IACtB,OAAOE,MAAM,KAAK,CAAC,CAACG,IAAMD,IAAI,QAAQ,CAACC;AACzC;AAiBO,SAASC,iBACdC,GAAW,EACXC,QAAgBD,IAAI,MAAM,EAC1BE,UAMI,CAAC,CAAC;QAESC,0BAEEC;IAFjB,MAAMC,SAAS,QAAAF,CAAAA,2BAAAA,QAAQ,eAAe,AAAD,IAAtBA,2BAA2B;IAC1C,MAAMG,MAAMC,iBAAiBF;IAC7B,MAAMG,WAAW,QAAAJ,CAAAA,oBAAAA,QAAQ,QAAQ,AAAD,IAAfA,oBAAoB;IAErC,MAAMK,QAAQrB,iBAAiBY;IAC/B,MAAMU,YAAY,CAACC,KAAeA,AAAO,QAAPA,MAAcA,AAAO,QAAPA,MAAcA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at?: boolean;
|
|
14
14
|
/** Came from inside a text field (`g9fieldkey`). */
|
|
15
15
|
readonly field?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The field's text when the key was pressed, for a host that takes it with the key (`takeText`: a composer's send key
|
|
18
|
+
* reads and clears the field in the same keydown, so the page never sees a half-typed state; G9Hub, 2.5.8).
|
|
19
|
+
*/
|
|
20
|
+
readonly text?: string;
|
|
21
|
+
/** The field's element id, when the host knows it (which composer the send key came from). */
|
|
22
|
+
readonly fieldId?: string;
|
|
16
23
|
}
|
|
17
24
|
/** A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). */
|
|
18
25
|
export interface G9KeyCombo {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/services/keys.ts"],"names":[],"mappings":"AAMA,wEAAwE;AACxE,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,wGAAwG;AACxG,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/services/keys.ts"],"names":[],"mappings":"AAMA,wEAAwE;AACxE,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,wGAAwG;AACxG,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,0F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EAAE,GAAG,GAAE,MAAM,MAAiB;gBAKlG,UAAU,GAAG,MAAM,GAAG,IAAI;;EAuBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services/keys.js","sources":["../../src/services/keys.ts"],"sourcesContent":["// Keyboard shortcuts on hosts with a keyboard (Lynx for Web, Lynxtron, a tablet with a keyboard). Lynx has no keydown\n// event on the page, so the host forwards keys as global events (SAC: `g9key` / `g9fieldkey` from the web host; G9Hub:\n// hotkey.ts): `g9key` for keys outside text fields, `g9fieldkey` for the few that matter inside one (Escape, Mod+K,\n// Mod+Enter). This module is the platform-free part: the event names, the key shape, combo parsing and matching, and\n// key sequences (`g` then `i`). The hook that listens lives in `@g9tm/lynxcontrols/commands`.\n\n/** Global event a host sends for a key pressed outside a text field. */\nexport const g9KeyEventName = 'g9key';\n/** Global event for a key pressed inside a text field (hosts forward only Escape and modified keys). */\nexport const g9FieldKeyEventName = 'g9fieldkey';\n\n/** A key as hosts send it: `key` is a DOM key name (`'ArrowLeft'`, `'Escape'`, `'k'`). */\nexport interface G9KeyEvent {\n readonly key: string;\n readonly ctrl?: boolean;\n readonly shift?: boolean;\n readonly alt?: boolean;\n /** Cmd on macOS. */\n readonly meta?: boolean;\n readonly repeat?: boolean;\n /** Came from inside a text field (`g9fieldkey`). */\n readonly field?: boolean;\n}\n\n/** A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). */\nexport interface G9KeyCombo {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly shift: boolean;\n readonly alt: boolean;\n}\n\nconst ALIASES: Readonly<Record<string, string>> = {\n esc: 'escape',\n return: 'enter',\n del: 'delete',\n space: ' ',\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n plus: '+',\n};\n\n/** Parses `'Mod+K'`, `'ctrl+shift+p'`, `'Escape'`, `'?'`. Case-insensitive; the last part is the key. */\nexport function parseCombo(combo: string): G9KeyCombo {\n const parts = combo.split('+').map((p) => p.trim().toLowerCase());\n // \"Mod++\" means the plus key\n if (combo.endsWith('++')) parts.splice(parts.length - 2, 2, '+');\n const key = parts.pop() ?? '';\n return {\n key: ALIASES[key] ?? key,\n mod: parts.includes('mod'),\n ctrl: parts.includes('ctrl'),\n shift: parts.includes('shift'),\n alt: parts.includes('alt') || parts.includes('option'),\n };\n}\n\n/** True when `event` is `combo` (`platform: 'mac'` maps Mod to Meta). */\nexport function matchesCombo(\n event: G9KeyEvent,\n combo: string | G9KeyCombo,\n platform: 'mac' | 'other' = 'other',\n): boolean {\n const c = typeof combo === 'string' ? parseCombo(combo) : combo;\n const key = event.key.toLowerCase();\n if (key !== c.key && !(c.key.length === 1 && key === c.key)) return false;\n const modDown = platform === 'mac' ? Boolean(event.meta) : Boolean(event.ctrl);\n if (c.mod !== modDown && !(c.ctrl && !c.mod)) return false;\n if (c.ctrl && !event.ctrl) return false;\n if (!c.mod && !c.ctrl && (event.ctrl || event.meta)) return false;\n // shift is part of a printed character ('?' is Shift+/): only require it when the combo says so\n if (c.shift && !event.shift) return false;\n if (c.alt !== Boolean(event.alt)) return false;\n return true;\n}\n\n/** How a combo reads on a key cap (`'Mod+K'` → `'Ctrl K'` / `'⌘ K'`). */\nexport function comboLabel(combo: string, platform: 'mac' | 'other' = 'other'): string {\n const c = parseCombo(combo);\n const parts: string[] = [];\n if (c.mod) parts.push(platform === 'mac' ? '⌘' : 'Ctrl');\n if (c.ctrl) parts.push(platform === 'mac' ? '⌃' : 'Ctrl');\n if (c.alt) parts.push(platform === 'mac' ? '⌥' : 'Alt');\n if (c.shift) parts.push(platform === 'mac' ? '⇧' : 'Shift');\n const named: Record<string, string> = {\n escape: 'Esc',\n enter: '↵',\n arrowup: '↑',\n arrowdown: '↓',\n arrowleft: '←',\n arrowright: '→',\n ' ': 'Space',\n delete: 'Del',\n backspace: '⌫',\n tab: 'Tab',\n };\n parts.push(named[c.key] ?? (c.key.length === 1 ? c.key.toUpperCase() : c.key));\n return parts.join(' ');\n}\n\n/**\n * Key sequences (`'g i'`: g then i within `timeoutMs`, G9Hub's \"go to\" shortcuts). Feed every key; it answers the\n * sequence completed by this key, or null.\n */\nexport function createSequenceMatcher(sequences: readonly string[], timeoutMs = 1200, now: () => number = Date.now) {\n const parsed = sequences.map((s) => ({ source: s, keys: s.trim().toLowerCase().split(/\\s+/) }));\n let buffer: string[] = [];\n let last = 0;\n return {\n feed(event: G9KeyEvent): string | null {\n if (event.ctrl || event.meta || event.alt || event.field) {\n buffer = [];\n return null;\n }\n const t = now();\n if (t - last > timeoutMs) buffer = [];\n last = t;\n buffer.push(event.key.toLowerCase());\n if (buffer.length > 4) buffer = buffer.slice(-4);\n for (const seq of parsed) {\n const tail = buffer.slice(-seq.keys.length);\n if (tail.length === seq.keys.length && tail.every((k, i) => k === seq.keys[i])) {\n buffer = [];\n return seq.source;\n }\n }\n return null;\n },\n reset() {\n buffer = [];\n },\n };\n}\n"],"names":["g9KeyEventName","g9FieldKeyEventName","ALIASES","parseCombo","combo","_parts_pop","_ALIASES_key","parts","p","key","matchesCombo","event","platform","c","modDown","Boolean","comboLabel","_named_c_key","named","createSequenceMatcher","sequences","timeoutMs","now","Date","parsed","s","buffer","last","t","seq","tail","k","i"],"mappings":"AAOO,MAAMA,iBAAiB;AAEvB,MAAMC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"services/keys.js","sources":["../../src/services/keys.ts"],"sourcesContent":["// Keyboard shortcuts on hosts with a keyboard (Lynx for Web, Lynxtron, a tablet with a keyboard). Lynx has no keydown\n// event on the page, so the host forwards keys as global events (SAC: `g9key` / `g9fieldkey` from the web host; G9Hub:\n// hotkey.ts): `g9key` for keys outside text fields, `g9fieldkey` for the few that matter inside one (Escape, Mod+K,\n// Mod+Enter). This module is the platform-free part: the event names, the key shape, combo parsing and matching, and\n// key sequences (`g` then `i`). The hook that listens lives in `@g9tm/lynxcontrols/commands`.\n\n/** Global event a host sends for a key pressed outside a text field. */\nexport const g9KeyEventName = 'g9key';\n/** Global event for a key pressed inside a text field (hosts forward only Escape and modified keys). */\nexport const g9FieldKeyEventName = 'g9fieldkey';\n\n/** A key as hosts send it: `key` is a DOM key name (`'ArrowLeft'`, `'Escape'`, `'k'`). */\nexport interface G9KeyEvent {\n readonly key: string;\n readonly ctrl?: boolean;\n readonly shift?: boolean;\n readonly alt?: boolean;\n /** Cmd on macOS. */\n readonly meta?: boolean;\n readonly repeat?: boolean;\n /** Came from inside a text field (`g9fieldkey`). */\n readonly field?: boolean;\n /**\n * The field's text when the key was pressed, for a host that takes it with the key (`takeText`: a composer's send key\n * reads and clears the field in the same keydown, so the page never sees a half-typed state; G9Hub, 2.5.8).\n */\n readonly text?: string;\n /** The field's element id, when the host knows it (which composer the send key came from). */\n readonly fieldId?: string;\n}\n\n/** A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). */\nexport interface G9KeyCombo {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly shift: boolean;\n readonly alt: boolean;\n}\n\nconst ALIASES: Readonly<Record<string, string>> = {\n esc: 'escape',\n return: 'enter',\n del: 'delete',\n space: ' ',\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n plus: '+',\n};\n\n/** Parses `'Mod+K'`, `'ctrl+shift+p'`, `'Escape'`, `'?'`. Case-insensitive; the last part is the key. */\nexport function parseCombo(combo: string): G9KeyCombo {\n const parts = combo.split('+').map((p) => p.trim().toLowerCase());\n // \"Mod++\" means the plus key\n if (combo.endsWith('++')) parts.splice(parts.length - 2, 2, '+');\n const key = parts.pop() ?? '';\n return {\n key: ALIASES[key] ?? key,\n mod: parts.includes('mod'),\n ctrl: parts.includes('ctrl'),\n shift: parts.includes('shift'),\n alt: parts.includes('alt') || parts.includes('option'),\n };\n}\n\n/** True when `event` is `combo` (`platform: 'mac'` maps Mod to Meta). */\nexport function matchesCombo(\n event: G9KeyEvent,\n combo: string | G9KeyCombo,\n platform: 'mac' | 'other' = 'other',\n): boolean {\n const c = typeof combo === 'string' ? parseCombo(combo) : combo;\n const key = event.key.toLowerCase();\n if (key !== c.key && !(c.key.length === 1 && key === c.key)) return false;\n const modDown = platform === 'mac' ? Boolean(event.meta) : Boolean(event.ctrl);\n if (c.mod !== modDown && !(c.ctrl && !c.mod)) return false;\n if (c.ctrl && !event.ctrl) return false;\n if (!c.mod && !c.ctrl && (event.ctrl || event.meta)) return false;\n // shift is part of a printed character ('?' is Shift+/): only require it when the combo says so\n if (c.shift && !event.shift) return false;\n if (c.alt !== Boolean(event.alt)) return false;\n return true;\n}\n\n/** How a combo reads on a key cap (`'Mod+K'` → `'Ctrl K'` / `'⌘ K'`). */\nexport function comboLabel(combo: string, platform: 'mac' | 'other' = 'other'): string {\n const c = parseCombo(combo);\n const parts: string[] = [];\n if (c.mod) parts.push(platform === 'mac' ? '⌘' : 'Ctrl');\n if (c.ctrl) parts.push(platform === 'mac' ? '⌃' : 'Ctrl');\n if (c.alt) parts.push(platform === 'mac' ? '⌥' : 'Alt');\n if (c.shift) parts.push(platform === 'mac' ? '⇧' : 'Shift');\n const named: Record<string, string> = {\n escape: 'Esc',\n enter: '↵',\n arrowup: '↑',\n arrowdown: '↓',\n arrowleft: '←',\n arrowright: '→',\n ' ': 'Space',\n delete: 'Del',\n backspace: '⌫',\n tab: 'Tab',\n };\n parts.push(named[c.key] ?? (c.key.length === 1 ? c.key.toUpperCase() : c.key));\n return parts.join(' ');\n}\n\n/**\n * Key sequences (`'g i'`: g then i within `timeoutMs`, G9Hub's \"go to\" shortcuts). Feed every key; it answers the\n * sequence completed by this key, or null.\n */\nexport function createSequenceMatcher(sequences: readonly string[], timeoutMs = 1200, now: () => number = Date.now) {\n const parsed = sequences.map((s) => ({ source: s, keys: s.trim().toLowerCase().split(/\\s+/) }));\n let buffer: string[] = [];\n let last = 0;\n return {\n feed(event: G9KeyEvent): string | null {\n if (event.ctrl || event.meta || event.alt || event.field) {\n buffer = [];\n return null;\n }\n const t = now();\n if (t - last > timeoutMs) buffer = [];\n last = t;\n buffer.push(event.key.toLowerCase());\n if (buffer.length > 4) buffer = buffer.slice(-4);\n for (const seq of parsed) {\n const tail = buffer.slice(-seq.keys.length);\n if (tail.length === seq.keys.length && tail.every((k, i) => k === seq.keys[i])) {\n buffer = [];\n return seq.source;\n }\n }\n return null;\n },\n reset() {\n buffer = [];\n },\n };\n}\n"],"names":["g9KeyEventName","g9FieldKeyEventName","ALIASES","parseCombo","combo","_parts_pop","_ALIASES_key","parts","p","key","matchesCombo","event","platform","c","modDown","Boolean","comboLabel","_named_c_key","named","createSequenceMatcher","sequences","timeoutMs","now","Date","parsed","s","buffer","last","t","seq","tail","k","i"],"mappings":"AAOO,MAAMA,iBAAiB;AAEvB,MAAMC,sBAAsB;AA+BnC,MAAMC,UAA4C;IAChD,KAAK;IACL,QAAQ;IACR,KAAK;IACL,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;AACR;AAGO,SAASC,WAAWC,KAAa;QAI1BC,YAELC;IALP,MAAMC,QAAQH,MAAM,KAAK,CAAC,KAAK,GAAG,CAAC,CAACI,IAAMA,EAAE,IAAI,GAAG,WAAW;IAE9D,IAAIJ,MAAM,QAAQ,CAAC,OAAOG,MAAM,MAAM,CAACA,MAAM,MAAM,GAAG,GAAG,GAAG;IAC5D,MAAME,MAAM,QAAAJ,CAAAA,aAAAA,MAAM,GAAG,EAAC,IAAVA,aAAe;IAC3B,OAAO;QACL,KAAK,QAAAC,CAAAA,eAAAA,OAAO,CAACG,IAAI,AAAD,IAAXH,eAAgBG;QACrB,KAAKF,MAAM,QAAQ,CAAC;QACpB,MAAMA,MAAM,QAAQ,CAAC;QACrB,OAAOA,MAAM,QAAQ,CAAC;QACtB,KAAKA,MAAM,QAAQ,CAAC,UAAUA,MAAM,QAAQ,CAAC;IAC/C;AACF;AAGO,SAASG,aACdC,KAAiB,EACjBP,KAA0B,EAC1BQ,WAA4B,OAAO;IAEnC,MAA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ACb;IACF;AACF"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { G9PaletteValues } from '../tokens/generated/palettes.js';
|
|
2
|
+
import { type G9Density, type G9TypeRole, type G9TypeRoleName } from '../tokens/shape.js';
|
|
3
|
+
import { type G9ThemeDefinition } from './appearance.js';
|
|
4
|
+
import type { G9ColorScheme } from './theme.js';
|
|
5
|
+
/** The tokens an app (a messenger) adds to the library palette. */
|
|
6
|
+
export declare const g9AppTokenNames: readonly ["hover", "press", "field", "skeleton", "accent-soft", "accent-glow", "accent-gradient", "text-on-accent", "glass", "glass-border", "bubble-mine", "bubble-mine-text", "bubble-mine-meta", "bubble-other", "bubble-other-text", "bubble-other-border", "highlight", "link", "selection", "focus-ring", "online", "away", "busy"];
|
|
7
|
+
/** The name of an app token (`hover`, `bubble-mine`…). */
|
|
8
|
+
export type G9AppTokenName = (typeof g9AppTokenNames)[number];
|
|
9
|
+
/** Options of {@link g9AppTokens}. */
|
|
10
|
+
export interface G9AppTokenOptions {
|
|
11
|
+
/** The person's accent (`#rrggbb`) over the theme's primary; null / invalid: the theme's own. */
|
|
12
|
+
readonly accent?: string | null;
|
|
13
|
+
/** Values the app (or a theme) sets itself. */
|
|
14
|
+
readonly overrides?: Partial<Record<G9AppTokenName, string>>;
|
|
15
|
+
}
|
|
16
|
+
/** The app tokens for a palette and scheme: plain colours (and one gradient), never variables. */
|
|
17
|
+
export declare function g9AppTokens(theme: {
|
|
18
|
+
readonly palette: G9PaletteValues;
|
|
19
|
+
readonly scheme: G9ColorScheme;
|
|
20
|
+
}, options?: G9AppTokenOptions): Readonly<Record<G9AppTokenName, string>>;
|
|
21
|
+
/** The app tokens as CSS variables (`--g9-hover`…; `prefix` default `g9-`), for G9Provider's `themeExtras`. */
|
|
22
|
+
export declare function g9AppTokenVariables(theme: {
|
|
23
|
+
readonly palette: G9PaletteValues;
|
|
24
|
+
readonly scheme: G9ColorScheme;
|
|
25
|
+
}, options?: G9AppTokenOptions, prefix?: string): Readonly<Record<string, string>>;
|
|
26
|
+
/**
|
|
27
|
+
* Only well-formed tokens of `allowed` names (a leading `--g9-` is dropped first), from a theme that came from outside
|
|
28
|
+
* (the server, a file): values that cannot break out of a declaration, and pictures only as inline `data:` images.
|
|
29
|
+
*/
|
|
30
|
+
export declare function g9SanitizeTokens(input: Readonly<Record<string, unknown>> | null | undefined, allowed: readonly string[]): Record<string, string>;
|
|
31
|
+
/** A text size step. */
|
|
32
|
+
export type G9FontScale = 'small' | 'normal' | 'large' | 'larger';
|
|
33
|
+
/** Whether effects are on, off, or decided by the device. */
|
|
34
|
+
export type G9EffectsMode = 'auto' | 'on' | 'off';
|
|
35
|
+
/** What a person chose on Settings → Appearance (kept per device by the app). */
|
|
36
|
+
export interface G9AppearanceSettings {
|
|
37
|
+
/** A theme id, or `system`: follow the device between `light` and `dark`. */
|
|
38
|
+
readonly theme: string;
|
|
39
|
+
readonly light: string;
|
|
40
|
+
readonly dark: string;
|
|
41
|
+
/** `#rrggbb`, or null for the theme's own. */
|
|
42
|
+
readonly accent: string | null;
|
|
43
|
+
/** A wallpaper id; `theme` keeps the theme's own. */
|
|
44
|
+
readonly wallpaper: string;
|
|
45
|
+
readonly fontScale: G9FontScale;
|
|
46
|
+
/** `auto`: off on low-end devices and when the system asks for reduced motion. */
|
|
47
|
+
readonly effects: G9EffectsMode;
|
|
48
|
+
readonly density: G9Density;
|
|
49
|
+
}
|
|
50
|
+
/** The settings of a new install. */
|
|
51
|
+
export declare const g9DefaultAppearance: G9AppearanceSettings;
|
|
52
|
+
/** Stored settings read back loosely: every unknown or broken field takes its default. */
|
|
53
|
+
export declare function g9NormalizeAppearance(raw: unknown, defaults?: G9AppearanceSettings): G9AppearanceSettings;
|
|
54
|
+
/** Text size factors. */
|
|
55
|
+
export declare const g9FontScaleFactors: Readonly<Record<G9FontScale, number>>;
|
|
56
|
+
/** The type scale at a text size (sizes and line heights rounded), for G9Provider's `shape.type`. */
|
|
57
|
+
export declare function g9ScaledType(scale: G9FontScale | number, base?: {
|
|
58
|
+
readonly [K in G9TypeRoleName]: G9TypeRole;
|
|
59
|
+
}): {
|
|
60
|
+
readonly [K in G9TypeRoleName]: G9TypeRole;
|
|
61
|
+
};
|
|
62
|
+
/** Whether effects (blur, glow, motion flourishes) are on. */
|
|
63
|
+
export declare function g9EffectsEnabled(mode: G9EffectsMode, device?: {
|
|
64
|
+
readonly reducedMotion?: boolean;
|
|
65
|
+
readonly lowEnd?: boolean;
|
|
66
|
+
}): boolean;
|
|
67
|
+
/** The theme id in force: the chosen one, or the light / dark one for the device's scheme when following it. */
|
|
68
|
+
export declare function g9ActiveThemeId(settings: G9AppearanceSettings, systemScheme: G9ColorScheme): string;
|
|
69
|
+
/** The themes a person can pick, by source. */
|
|
70
|
+
export interface G9ThemeRegistrySnapshot {
|
|
71
|
+
readonly themes: readonly G9ThemeDefinition[];
|
|
72
|
+
readonly revision: number;
|
|
73
|
+
}
|
|
74
|
+
/** Options of {@link createG9ThemeRegistry}. */
|
|
75
|
+
export interface G9ThemeRegistryOptions {
|
|
76
|
+
/** Default {@link g9BuiltInThemes}. */
|
|
77
|
+
readonly builtins?: readonly G9ThemeDefinition[];
|
|
78
|
+
/** The person's own themes as the app stored them (read before the first paint). */
|
|
79
|
+
readonly personal?: readonly G9ThemeDefinition[];
|
|
80
|
+
/** Saves the personal list (the device's preferences). */
|
|
81
|
+
readonly savePersonal?: (themes: readonly G9ThemeDefinition[]) => void;
|
|
82
|
+
/** The most personal themes kept. Default 12. */
|
|
83
|
+
readonly maxPersonal?: number;
|
|
84
|
+
}
|
|
85
|
+
/** Every theme: built in, the organisation's, the person's own (a store an appearance page reads). */
|
|
86
|
+
export interface G9ThemeRegistry {
|
|
87
|
+
get(): G9ThemeRegistrySnapshot;
|
|
88
|
+
subscribe(listener: () => void): () => void;
|
|
89
|
+
/** A theme by id, or null. */
|
|
90
|
+
find(id: string): G9ThemeDefinition | null;
|
|
91
|
+
/** A theme by id; one that disappeared (an admin deleted it) falls back to the first built-in theme. */
|
|
92
|
+
themeOrDefault(id: string): G9ThemeDefinition;
|
|
93
|
+
/** Replaces the organisation's themes (from the server; each read loosely, broken ones dropped). */
|
|
94
|
+
setOrgThemes(inputs: readonly unknown[]): void;
|
|
95
|
+
/** Adds or replaces a personal theme (the newest first; past the limit the oldest go). */
|
|
96
|
+
savePersonal(theme: G9ThemeDefinition): void;
|
|
97
|
+
removePersonal(id: string): void;
|
|
98
|
+
readonly personal: () => readonly G9ThemeDefinition[];
|
|
99
|
+
}
|
|
100
|
+
/** A theme from the server or a file, read loosely (a newer server never breaks the client); null when broken. */
|
|
101
|
+
export declare function g9ThemeFromInput(input: unknown, source: G9ThemeDefinition['source']): G9ThemeDefinition | null;
|
|
102
|
+
/** Creates a theme registry. */
|
|
103
|
+
export declare function createG9ThemeRegistry(options?: G9ThemeRegistryOptions): G9ThemeRegistry;
|
|
104
|
+
/** How a personal theme's surfaces are tinted. */
|
|
105
|
+
export type G9SurfaceTone = 'neutral' | 'cool' | 'warm' | 'tinted';
|
|
106
|
+
/** What the personal theme editor edits. */
|
|
107
|
+
export interface G9PersonalThemeDraft {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
readonly name: string;
|
|
110
|
+
/** The theme it starts from. */
|
|
111
|
+
readonly base: G9ThemeDefinition;
|
|
112
|
+
/** `#rrggbb`. */
|
|
113
|
+
readonly accent: string;
|
|
114
|
+
readonly surfaces: G9SurfaceTone;
|
|
115
|
+
/** A wallpaper id, or `theme`. */
|
|
116
|
+
readonly wallpaper: string;
|
|
117
|
+
/** Light or dark (default the base's own mode, else light). */
|
|
118
|
+
readonly scheme?: G9ColorScheme;
|
|
119
|
+
}
|
|
120
|
+
/** A fresh personal id (`me:…`). */
|
|
121
|
+
export declare function g9NewPersonalThemeId(random?: () => number): string;
|
|
122
|
+
/** A draft starting from `base`. */
|
|
123
|
+
export declare function g9PersonalDraft(base: G9ThemeDefinition, name: string, id?: string): G9PersonalThemeDraft;
|
|
124
|
+
/**
|
|
125
|
+
* The theme a draft describes: the base's recipe with the draft's accent, its surfaces tinted (cool, warm, or by the
|
|
126
|
+
* accent) through overrides measured on `palettes` (the base's palettes for the accent: `recipePalettes(...)`).
|
|
127
|
+
*/
|
|
128
|
+
export declare function g9BuildPersonalTheme(draft: G9PersonalThemeDraft, palettes: {
|
|
129
|
+
readonly light: G9PaletteValues;
|
|
130
|
+
readonly dark: G9PaletteValues;
|
|
131
|
+
}): G9ThemeDefinition;
|
|
132
|
+
/** A file name for a theme export (letters, digits, dashes; any script). */
|
|
133
|
+
export declare function g9ThemeFileName(name: string): string;
|
|
134
|
+
/** A chat wallpaper: layers drawn behind a thread, from the palette so it follows the theme and accent. */
|
|
135
|
+
export interface G9Wallpaper {
|
|
136
|
+
readonly id: string;
|
|
137
|
+
readonly name: Readonly<Record<string, string>>;
|
|
138
|
+
/** The background for a palette and scheme: a colour and optional gradient layers (Lynx `background-image`). */
|
|
139
|
+
paint(palette: G9PaletteValues, scheme: G9ColorScheme): {
|
|
140
|
+
readonly color: string;
|
|
141
|
+
readonly image?: string;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** Wallpapers drawn with gradients only (no pictures, no network). */
|
|
145
|
+
export declare const g9Wallpapers: readonly G9Wallpaper[];
|
|
146
|
+
/** A wallpaper by id (from `list`, default {@link g9Wallpapers}), or null. */
|
|
147
|
+
export declare function g9Wallpaper(id: string, list?: readonly G9Wallpaper[]): G9Wallpaper | null;
|
|
148
|
+
//# sourceMappingURL=appearance-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance-kit.d.ts","sourceRoot":"","sources":["../../src/theme/appearance-kit.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,KAAK,iBAAiB,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