@gitkraken/core-gitlens 0.47.0 → 0.48.0
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/CHANGELOG.md +11 -1
- package/dist/git-cli/providers/branches.js +8 -4
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +0 -20
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +0 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
- package/dist/plus/integrations/reads/drains.d.ts +0 -1
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/date.js +10 -1
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/keys/keymapDispatcher.d.ts +12 -0
- package/dist/utils/keys/keymapDispatcher.js +33 -1
- package/dist/utils/keys/keymapDispatcher.js.map +1 -1
- package/dist/utils/pausedOperation.js +48 -16
- package/dist/utils/pausedOperation.js.map +1 -1
- package/dist/utils/plural.d.ts +1 -0
- package/dist/utils/plural.js +7 -2
- package/dist/utils/plural.js.map +1 -1
- package/dist/utils/wheel.d.ts +8 -0
- package/dist/utils/wheel.js +12 -0
- package/dist/utils/wheel.js.map +1 -0
- package/package.json +1 -1
package/dist/utils/plural.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { getNumericFormat } from "./date.js";
|
|
2
2
|
//#region ../utils/src/plural.ts
|
|
3
|
+
let pluralLocale;
|
|
3
4
|
let pluralRules;
|
|
4
5
|
/** Sets the UI locale used to categorize counts. `undefined` resets to the default (see {@link getPluralCategory}). */
|
|
5
6
|
function setPluralLocale(locale) {
|
|
6
|
-
|
|
7
|
+
pluralLocale = locale || void 0;
|
|
8
|
+
pluralRules = pluralLocale != null ? new Intl.PluralRules(pluralLocale) : void 0;
|
|
9
|
+
}
|
|
10
|
+
function getPluralLocale() {
|
|
11
|
+
return pluralLocale;
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* Returns the CLDR plural category for `count` in the current UI locale. Until {@link setPluralLocale} is
|
|
@@ -131,6 +136,6 @@ function formatPlural(template, args = []) {
|
|
|
131
136
|
return resolve(template, normalizeArgs(args));
|
|
132
137
|
}
|
|
133
138
|
//#endregion
|
|
134
|
-
export { formatPlural, getPluralCategory, setPluralLocale };
|
|
139
|
+
export { formatPlural, getPluralCategory, getPluralLocale, setPluralLocale };
|
|
135
140
|
|
|
136
141
|
//# sourceMappingURL=plural.js.map
|
package/dist/utils/plural.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plural.js","names":[],"sources":["../../../utils/src/plural.ts"],"sourcesContent":["import { getNumericFormat } from './date.js';\n\n/*\n * Plural forms for localized count messages.\n *\n * `formatPlural` resolves a translated template that may contain one or more ICU-style plural blocks:\n *\n * {selector, plural, branch{...} branch{...} ...}\n *\n * `selector` names an argument (a positional index such as `0`, or a property name such as `count`).\n * Each `branch` is one of the six CLDR plural categories (`zero`, `one`, `two`, `few`, `many`, `other`)\n * or an exact match `=N`. An `other` branch is required. Blocks may appear anywhere in the template, more\n * than once, and a branch body may itself contain another block (nested arbitrarily) as well as plain\n * `{placeholder}` references, including to its own block's selector. This module must not import\n * `vscode` or `@vscode/l10n` — it stays pure so the same helper works in the extension host, webviews and\n * packages. This grammar is re-implemented (not imported) by `scripts/localization.mjs`'s\n * `parsePluralBlocks`, since that validator is a plain `.mjs` script and cannot import this module — keep\n * the two in sync if the grammar changes.\n */\n\nlet pluralRules: Intl.PluralRules | undefined;\n\n/** Sets the UI locale used to categorize counts. `undefined` resets to the default (see {@link getPluralCategory}). */\nexport function setPluralLocale(locale: string | undefined): void {\n\tpluralRules = locale ? new Intl.PluralRules(locale) : undefined;\n}\n\n/**\n * Returns the CLDR plural category for `count` in the current UI locale. Until {@link setPluralLocale} is\n * called, the document language is used when there is a document (a host that only configures\n * `@vscode/l10n`, such as an external consumer of the graph packages, still gets its language's rules),\n * else English.\n */\nexport function getPluralCategory(count: number): Intl.LDMLPluralRule {\n\tpluralRules ??= new Intl.PluralRules(\n\t\t(typeof document !== 'undefined' ? document.documentElement.lang : undefined) || 'en',\n\t);\n\treturn pluralRules.select(count);\n}\n\ninterface PluralBlock {\n\t/** Index of the block's opening `{` in the text it was found in. */\n\treadonly start: number;\n\t/** Index just past the block's closing `}` in the text it was found in. */\n\treadonly end: number;\n\treadonly selector: string;\n\treadonly branches: ReadonlyMap<string, string>;\n\treadonly otherBranch: string;\n}\n\nclass MalformedPluralBlockError extends Error {}\n\nconst pluralBlockStart = /\\{\\s*([^{}\\s,][^{},]*?)\\s*,\\s*plural\\s*,/;\n\n/**\n * Finds the first top-level ICU-style plural block anywhere in `text`.\n *\n * Returns `undefined` when no `{selector, plural, ...}` prefix is present at all — plain text with no\n * block. Throws `MalformedPluralBlockError` when that prefix is present but the block cannot be parsed\n * (unbalanced braces, or no `other` branch); callers must catch this. Does not look inside a branch body\n * for a nested block — callers that need nested blocks resolved recurse on the branch body themselves.\n */\nfunction findPluralBlock(text: string): PluralBlock | undefined {\n\tconst match = pluralBlockStart.exec(text);\n\tif (match == null) return undefined;\n\n\tconst selector = match[1];\n\tconst branches = new Map<string, string>();\n\tlet index = match.index + match[0].length;\n\n\tfor (;;) {\n\t\twhile (index < text.length && /\\s/.test(text[index])) {\n\t\t\tindex++;\n\t\t}\n\n\t\tif (text[index] === '}') {\n\t\t\tconst otherBranch = branches.get('other');\n\t\t\tif (otherBranch == null) throw new MalformedPluralBlockError(`plural block without an \"other\" branch`);\n\n\t\t\treturn {\n\t\t\t\tstart: match.index,\n\t\t\t\tend: index + 1,\n\t\t\t\tselector: selector,\n\t\t\t\tbranches: branches,\n\t\t\t\totherBranch: otherBranch,\n\t\t\t};\n\t\t}\n\n\t\tconst braceIndex = text.indexOf('{', index);\n\t\tif (braceIndex === -1) throw new MalformedPluralBlockError('unterminated plural block');\n\n\t\tconst name = text.slice(index, braceIndex).trim();\n\t\tif (!name) throw new MalformedPluralBlockError('unterminated plural block');\n\n\t\tlet depth = 1;\n\t\tlet i = braceIndex + 1;\n\t\twhile (i < text.length && depth > 0) {\n\t\t\tif (text[i] === '{') {\n\t\t\t\tdepth++;\n\t\t\t} else if (text[i] === '}') {\n\t\t\t\tdepth--;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tif (depth !== 0) throw new MalformedPluralBlockError('unbalanced braces in plural block');\n\n\t\tbranches.set(name, text.slice(braceIndex + 1, i - 1));\n\t\tindex = i;\n\t}\n}\n\nconst warned = new Set<string>();\n\nfunction warnOnce(key: string, message: string): void {\n\tif (warned.has(key)) return;\n\n\twarned.add(key);\n\tconsole.warn(message);\n}\n\n// Templates are catalog literals, so the distinct texts parsed over a session are few and are parsed\n// again on every render (graph rows, tooltips, tree nodes); a malformed text is warned about only once\n// because it is only ever parsed once.\nconst parsedBlocks = new Map<string, PluralBlock | undefined>();\n\nfunction findBlockOrWarn(text: string): PluralBlock | undefined {\n\tif (parsedBlocks.has(text)) return parsedBlocks.get(text);\n\n\tlet block: PluralBlock | undefined;\n\ttry {\n\t\tblock = findPluralBlock(text);\n\t} catch (ex) {\n\t\tif (!(ex instanceof MalformedPluralBlockError)) throw ex;\n\n\t\tconsole.warn(`formatPlural: malformed plural block in \"${text}\"; leaving it untouched`);\n\t}\n\n\tparsedBlocks.set(text, block);\n\treturn block;\n}\n\n/** Picks a branch for `block`: an exact `=N` match wins, then the CLDR category, then `other`. A\n * non-number (or missing) selector value is a caller mistake — it always resolves to `other`, warned\n * once per distinct block. */\nfunction selectBranch(block: PluralBlock, values: Record<string, unknown>, raw: string): string {\n\tconst value = values[block.selector];\n\tif (typeof value === 'number') {\n\t\treturn block.branches.get(`=${value}`) ?? block.branches.get(getPluralCategory(value)) ?? block.otherBranch;\n\t}\n\n\twarnOnce(raw, `formatPlural: selector \"${block.selector}\" is not a number; using the \"other\" branch`);\n\treturn block.otherBranch;\n}\n\nfunction toDisplayString(value: unknown): string {\n\tif (typeof value === 'number') return getNumericFormat()(value);\n\tif (typeof value === 'string') return value;\n\tif (typeof value === 'boolean' || typeof value === 'bigint') return String(value);\n\n\t// Not a value formatPlural() is documented to take (a count or a name) — render something rather\n\t// than crash on an object without a meaningful `toString()`.\n\treturn JSON.stringify(value) ?? '';\n}\n\nconst placeholderRegex = /\\{([^}]+)\\}/g;\n\nfunction substitutePlaceholders(text: string, values: Record<string, unknown>): string {\n\tif (!text) return text;\n\n\treturn text.replace(placeholderRegex, (match: string, key: string) => {\n\t\tconst value = values[key];\n\t\treturn value == null ? match : toDisplayString(value);\n\t});\n}\n\nfunction normalizeArgs(args: Record<string, unknown> | readonly unknown[]): Record<string, unknown> {\n\tif (Array.isArray(args)) return Object.fromEntries(args.map((value, index) => [String(index), value]));\n\n\treturn args as Record<string, unknown>;\n}\n\nfunction resolve(template: string, values: Record<string, unknown>): string {\n\tlet result = '';\n\tlet rest = template;\n\n\tfor (;;) {\n\t\tconst block = findBlockOrWarn(rest);\n\t\tif (block == null) break;\n\n\t\tresult += substitutePlaceholders(rest.slice(0, block.start), values);\n\t\tresult += resolve(selectBranch(block, values, rest.slice(block.start, block.end)), values);\n\t\trest = rest.slice(block.end);\n\t}\n\n\tresult += substitutePlaceholders(rest, values);\n\treturn result;\n}\n\n/**\n * Renders a localized template that may contain one or more ICU-style plural blocks (see the module\n * comment for the grammar). Every block is resolved for the current UI locale, including any nested\n * inside a chosen branch; plain `{placeholder}` text outside of and inside blocks is then substituted —\n * positional args map to `{0}`, `{1}`, …, an object's properties map by name, and an unknown placeholder\n * is left as-is. A numeric value is formatted with the date-locale number formatter, matching what count\n * messages have always formatted their counts with; anything else is stringified.\n */\nexport function formatPlural(template: string, args: Record<string, unknown> | readonly unknown[] = []): string {\n\treturn resolve(template, normalizeArgs(args));\n}\n"],"mappings":";;AAoBA,IAAI;;AAGJ,SAAgB,gBAAgB,QAAkC;CACjE,cAAc,SAAS,IAAI,KAAK,YAAY,MAAM,IAAI,KAAA;AACvD;;;;;;;AAQA,SAAgB,kBAAkB,OAAoC;CACrE,gBAAgB,IAAI,KAAK,aACvB,OAAO,aAAa,cAAc,SAAS,gBAAgB,OAAO,KAAA,MAAc,IAClF;CACA,OAAO,YAAY,OAAO,KAAK;AAChC;AAYA,IAAM,4BAAN,cAAwC,MAAM,CAAC;AAE/C,MAAM,mBAAmB;;;;;;;;;AAUzB,SAAS,gBAAgB,MAAuC;CAC/D,MAAM,QAAQ,iBAAiB,KAAK,IAAI;CACxC,IAAI,SAAS,MAAM,OAAO,KAAA;CAE1B,MAAM,WAAW,MAAM;CACvB,MAAM,2BAAW,IAAI,IAAoB;CACzC,IAAI,QAAQ,MAAM,QAAQ,MAAM,EAAE,CAAC;CAEnC,SAAS;EACR,OAAO,QAAQ,KAAK,UAAU,KAAK,KAAK,KAAK,MAAM,GAClD;EAGD,IAAI,KAAK,WAAW,KAAK;GACxB,MAAM,cAAc,SAAS,IAAI,OAAO;GACxC,IAAI,eAAe,MAAM,MAAM,IAAI,0BAA0B,wCAAwC;GAErG,OAAO;IACN,OAAO,MAAM;IACb,KAAK,QAAQ;IACH;IACA;IACG;GACd;EACD;EAEA,MAAM,aAAa,KAAK,QAAQ,KAAK,KAAK;EAC1C,IAAI,eAAe,IAAI,MAAM,IAAI,0BAA0B,2BAA2B;EAEtF,MAAM,OAAO,KAAK,MAAM,OAAO,UAAU,CAAC,CAAC,KAAK;EAChD,IAAI,CAAC,MAAM,MAAM,IAAI,0BAA0B,2B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AAO,OAAO,KAAK;CAIhF,OAAO,KAAK,UAAU,KAAK,KAAK;AACjC;AAEA,MAAM,mBAAmB;AAEzB,SAAS,uBAAuB,MAAc,QAAyC;CACtF,IAAI,CAAC,MAAM,OAAO;CAElB,OAAO,KAAK,QAAQ,mBAAmB,OAAe,QAAgB;EACrE,MAAM,QAAQ,OAAO;EACrB,OAAO,SAAS,OAAO,QAAQ,gBAAgB,KAAK;CACrD,CAAC;AACF;AAEA,SAAS,cAAc,MAA6E;CACnG,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,OAAO,YAAY,KAAK,KAAK,OAAO,UAAU,CAAC,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC;CAErG,OAAO;AACR;AAEA,SAAS,QAAQ,UAAkB,QAAyC;CAC3E,IAAI,SAAS;CACb,IAAI,OAAO;CAEX,SAAS;EACR,MAAM,QAAQ,gBAAgB,IAAI;EAClC,IAAI,SAAS,MAAM;EAEnB,UAAU,uBAAuB,KAAK,MAAM,GAAG,MAAM,KAAK,GAAG,MAAM;EACnE,UAAU,QAAQ,aAAa,OAAO,QAAQ,KAAK,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM;EACzF,OAAO,KAAK,MAAM,MAAM,GAAG;CAC5B;CAEA,UAAU,uBAAuB,MAAM,MAAM;CAC7C,OAAO;AACR;;;;;;;;;AAUA,SAAgB,aAAa,UAAkB,OAAqD,CAAC,GAAW;CAC/G,OAAO,QAAQ,UAAU,cAAc,IAAI,CAAC;AAC7C"}
|
|
1
|
+
{"version":3,"file":"plural.js","names":[],"sources":["../../../utils/src/plural.ts"],"sourcesContent":["import { getNumericFormat } from './date.js';\n\n/*\n * Plural forms for localized count messages.\n *\n * `formatPlural` resolves a translated template that may contain one or more ICU-style plural blocks:\n *\n * {selector, plural, branch{...} branch{...} ...}\n *\n * `selector` names an argument (a positional index such as `0`, or a property name such as `count`).\n * Each `branch` is one of the six CLDR plural categories (`zero`, `one`, `two`, `few`, `many`, `other`)\n * or an exact match `=N`. An `other` branch is required. Blocks may appear anywhere in the template, more\n * than once, and a branch body may itself contain another block (nested arbitrarily) as well as plain\n * `{placeholder}` references, including to its own block's selector. This module must not import\n * `vscode` or `@vscode/l10n` — it stays pure so the same helper works in the extension host, webviews and\n * packages. This grammar is re-implemented (not imported) by `scripts/localization.mjs`'s\n * `parsePluralBlocks`, since that validator is a plain `.mjs` script and cannot import this module — keep\n * the two in sync if the grammar changes.\n */\n\nlet pluralLocale: string | undefined;\nlet pluralRules: Intl.PluralRules | undefined;\n\n/** Sets the UI locale used to categorize counts. `undefined` resets to the default (see {@link getPluralCategory}). */\nexport function setPluralLocale(locale: string | undefined): void {\n\tpluralLocale = locale || undefined;\n\tpluralRules = pluralLocale != null ? new Intl.PluralRules(pluralLocale) : undefined;\n}\n\nexport function getPluralLocale(): string | undefined {\n\treturn pluralLocale;\n}\n\n/**\n * Returns the CLDR plural category for `count` in the current UI locale. Until {@link setPluralLocale} is\n * called, the document language is used when there is a document (a host that only configures\n * `@vscode/l10n`, such as an external consumer of the graph packages, still gets its language's rules),\n * else English.\n */\nexport function getPluralCategory(count: number): Intl.LDMLPluralRule {\n\tpluralRules ??= new Intl.PluralRules(\n\t\t(typeof document !== 'undefined' ? document.documentElement.lang : undefined) || 'en',\n\t);\n\treturn pluralRules.select(count);\n}\n\ninterface PluralBlock {\n\t/** Index of the block's opening `{` in the text it was found in. */\n\treadonly start: number;\n\t/** Index just past the block's closing `}` in the text it was found in. */\n\treadonly end: number;\n\treadonly selector: string;\n\treadonly branches: ReadonlyMap<string, string>;\n\treadonly otherBranch: string;\n}\n\nclass MalformedPluralBlockError extends Error {}\n\nconst pluralBlockStart = /\\{\\s*([^{}\\s,][^{},]*?)\\s*,\\s*plural\\s*,/;\n\n/**\n * Finds the first top-level ICU-style plural block anywhere in `text`.\n *\n * Returns `undefined` when no `{selector, plural, ...}` prefix is present at all — plain text with no\n * block. Throws `MalformedPluralBlockError` when that prefix is present but the block cannot be parsed\n * (unbalanced braces, or no `other` branch); callers must catch this. Does not look inside a branch body\n * for a nested block — callers that need nested blocks resolved recurse on the branch body themselves.\n */\nfunction findPluralBlock(text: string): PluralBlock | undefined {\n\tconst match = pluralBlockStart.exec(text);\n\tif (match == null) return undefined;\n\n\tconst selector = match[1];\n\tconst branches = new Map<string, string>();\n\tlet index = match.index + match[0].length;\n\n\tfor (;;) {\n\t\twhile (index < text.length && /\\s/.test(text[index])) {\n\t\t\tindex++;\n\t\t}\n\n\t\tif (text[index] === '}') {\n\t\t\tconst otherBranch = branches.get('other');\n\t\t\tif (otherBranch == null) throw new MalformedPluralBlockError(`plural block without an \"other\" branch`);\n\n\t\t\treturn {\n\t\t\t\tstart: match.index,\n\t\t\t\tend: index + 1,\n\t\t\t\tselector: selector,\n\t\t\t\tbranches: branches,\n\t\t\t\totherBranch: otherBranch,\n\t\t\t};\n\t\t}\n\n\t\tconst braceIndex = text.indexOf('{', index);\n\t\tif (braceIndex === -1) throw new MalformedPluralBlockError('unterminated plural block');\n\n\t\tconst name = text.slice(index, braceIndex).trim();\n\t\tif (!name) throw new MalformedPluralBlockError('unterminated plural block');\n\n\t\tlet depth = 1;\n\t\tlet i = braceIndex + 1;\n\t\twhile (i < text.length && depth > 0) {\n\t\t\tif (text[i] === '{') {\n\t\t\t\tdepth++;\n\t\t\t} else if (text[i] === '}') {\n\t\t\t\tdepth--;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tif (depth !== 0) throw new MalformedPluralBlockError('unbalanced braces in plural block');\n\n\t\tbranches.set(name, text.slice(braceIndex + 1, i - 1));\n\t\tindex = i;\n\t}\n}\n\nconst warned = new Set<string>();\n\nfunction warnOnce(key: string, message: string): void {\n\tif (warned.has(key)) return;\n\n\twarned.add(key);\n\tconsole.warn(message);\n}\n\n// Templates are catalog literals, so the distinct texts parsed over a session are few and are parsed\n// again on every render (graph rows, tooltips, tree nodes); a malformed text is warned about only once\n// because it is only ever parsed once.\nconst parsedBlocks = new Map<string, PluralBlock | undefined>();\n\nfunction findBlockOrWarn(text: string): PluralBlock | undefined {\n\tif (parsedBlocks.has(text)) return parsedBlocks.get(text);\n\n\tlet block: PluralBlock | undefined;\n\ttry {\n\t\tblock = findPluralBlock(text);\n\t} catch (ex) {\n\t\tif (!(ex instanceof MalformedPluralBlockError)) throw ex;\n\n\t\tconsole.warn(`formatPlural: malformed plural block in \"${text}\"; leaving it untouched`);\n\t}\n\n\tparsedBlocks.set(text, block);\n\treturn block;\n}\n\n/** Picks a branch for `block`: an exact `=N` match wins, then the CLDR category, then `other`. A\n * non-number (or missing) selector value is a caller mistake — it always resolves to `other`, warned\n * once per distinct block. */\nfunction selectBranch(block: PluralBlock, values: Record<string, unknown>, raw: string): string {\n\tconst value = values[block.selector];\n\tif (typeof value === 'number') {\n\t\treturn block.branches.get(`=${value}`) ?? block.branches.get(getPluralCategory(value)) ?? block.otherBranch;\n\t}\n\n\twarnOnce(raw, `formatPlural: selector \"${block.selector}\" is not a number; using the \"other\" branch`);\n\treturn block.otherBranch;\n}\n\nfunction toDisplayString(value: unknown): string {\n\tif (typeof value === 'number') return getNumericFormat()(value);\n\tif (typeof value === 'string') return value;\n\tif (typeof value === 'boolean' || typeof value === 'bigint') return String(value);\n\n\t// Not a value formatPlural() is documented to take (a count or a name) — render something rather\n\t// than crash on an object without a meaningful `toString()`.\n\treturn JSON.stringify(value) ?? '';\n}\n\nconst placeholderRegex = /\\{([^}]+)\\}/g;\n\nfunction substitutePlaceholders(text: string, values: Record<string, unknown>): string {\n\tif (!text) return text;\n\n\treturn text.replace(placeholderRegex, (match: string, key: string) => {\n\t\tconst value = values[key];\n\t\treturn value == null ? match : toDisplayString(value);\n\t});\n}\n\nfunction normalizeArgs(args: Record<string, unknown> | readonly unknown[]): Record<string, unknown> {\n\tif (Array.isArray(args)) return Object.fromEntries(args.map((value, index) => [String(index), value]));\n\n\treturn args as Record<string, unknown>;\n}\n\nfunction resolve(template: string, values: Record<string, unknown>): string {\n\tlet result = '';\n\tlet rest = template;\n\n\tfor (;;) {\n\t\tconst block = findBlockOrWarn(rest);\n\t\tif (block == null) break;\n\n\t\tresult += substitutePlaceholders(rest.slice(0, block.start), values);\n\t\tresult += resolve(selectBranch(block, values, rest.slice(block.start, block.end)), values);\n\t\trest = rest.slice(block.end);\n\t}\n\n\tresult += substitutePlaceholders(rest, values);\n\treturn result;\n}\n\n/**\n * Renders a localized template that may contain one or more ICU-style plural blocks (see the module\n * comment for the grammar). Every block is resolved for the current UI locale, including any nested\n * inside a chosen branch; plain `{placeholder}` text outside of and inside blocks is then substituted —\n * positional args map to `{0}`, `{1}`, …, an object's properties map by name, and an unknown placeholder\n * is left as-is. A numeric value is formatted with the date-locale number formatter, matching what count\n * messages have always formatted their counts with; anything else is stringified.\n */\nexport function formatPlural(template: string, args: Record<string, unknown> | readonly unknown[] = []): string {\n\treturn resolve(template, normalizeArgs(args));\n}\n"],"mappings":";;AAoBA,IAAI;AACJ,IAAI;;AAGJ,SAAgB,gBAAgB,QAAkC;CACjE,eAAe,UAAU,KAAA;CACzB,cAAc,gBAAgB,OAAO,IAAI,KAAK,YAAY,YAAY,IAAI,KAAA;AAC3E;AAEA,SAAgB,kBAAsC;CACrD,OAAO;AACR;;;;;;;AAQA,SAAgB,kBAAkB,OAAoC;CACrE,gBAAgB,IAAI,KAAK,aACvB,OAAO,aAAa,cAAc,SAAS,gBAAgB,OAAO,KAAA,MAAc,IAClF;CACA,OAAO,YAAY,OAAO,KAAK;AAChC;AAYA,IAAM,4BAAN,cAAwC,MAAM,CAAC;AAE/C,MAAM,mBAAmB;;;;;;;;;AAUzB,SAAS,gBAAgB,MAAuC;CAC/D,MAAM,QAAQ,iBAAiB,KAAK,IAAI;CACxC,IAAI,SAAS,MAAM,OAAO,KAAA;CAE1B,MAAM,WAAW,MAAM;CACvB,MAAM,2BAAW,IAAI,IAAoB;CACzC,IAAI,QAAQ,MAAM,QAAQ,MAAM,EAAE,CAAC;CAEnC,SAAS;EACR,OAAO,QAAQ,KAAK,UA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MAAM,MAAM;CAC7C,OAAO;AACR;;;;;;;;;AAUA,SAAgB,aAAa,UAAkB,OAAqD,CAAC,GAAW;CAC/G,OAAO,QAAQ,UAAU,cAAc,IAAI,CAAC;AAC7C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region ../utils/src/wheel.d.ts
|
|
2
|
+
/** CSS pixels per wheel "line" (`DOM_DELTA_LINE`) — the browser's default line-scroll step. */
|
|
3
|
+
export declare const wheelLineHeightPx = 16;
|
|
4
|
+
/** Normalizes a `WheelEvent` delta to CSS pixels. `pageExtentPx` is the viewport extent along the
|
|
5
|
+
* scrolled axis, used only for the (rare) `DOM_DELTA_PAGE` mode. */
|
|
6
|
+
export declare function normalizeWheelDelta(deltaMode: number, delta: number, pageExtentPx: number): number;
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=wheel.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../utils/src/wheel.ts
|
|
2
|
+
/** CSS pixels per wheel "line" (`DOM_DELTA_LINE`) — the browser's default line-scroll step. */
|
|
3
|
+
const wheelLineHeightPx = 16;
|
|
4
|
+
/** Normalizes a `WheelEvent` delta to CSS pixels. `pageExtentPx` is the viewport extent along the
|
|
5
|
+
* scrolled axis, used only for the (rare) `DOM_DELTA_PAGE` mode. */
|
|
6
|
+
function normalizeWheelDelta(deltaMode, delta, pageExtentPx) {
|
|
7
|
+
return deltaMode === WheelEvent.DOM_DELTA_LINE ? delta * 16 : deltaMode === WheelEvent.DOM_DELTA_PAGE ? delta * pageExtentPx : delta;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { normalizeWheelDelta, wheelLineHeightPx };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=wheel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wheel.js","names":[],"sources":["../../../utils/src/wheel.ts"],"sourcesContent":["// Browsers report wheel deltas in three units (pixels / lines / pages); these convert the non-pixel\n// modes to pixels so callers can apply the delta without caring about the wheel source.\n\n/** CSS pixels per wheel \"line\" (`DOM_DELTA_LINE`) — the browser's default line-scroll step. */\nexport const wheelLineHeightPx = 16;\n\n/** Normalizes a `WheelEvent` delta to CSS pixels. `pageExtentPx` is the viewport extent along the\n * scrolled axis, used only for the (rare) `DOM_DELTA_PAGE` mode. */\nexport function normalizeWheelDelta(deltaMode: number, delta: number, pageExtentPx: number): number {\n\treturn deltaMode === WheelEvent.DOM_DELTA_LINE\n\t\t? delta * wheelLineHeightPx\n\t\t: deltaMode === WheelEvent.DOM_DELTA_PAGE\n\t\t\t? delta * pageExtentPx\n\t\t\t: delta;\n}\n"],"mappings":";;AAIA,MAAa,oBAAoB;;;AAIjC,SAAgB,oBAAoB,WAAmB,OAAe,cAA8B;CACnG,OAAO,cAAc,WAAW,iBAC7B,QAAA,KACA,cAAc,WAAW,iBACxB,QAAQ,eACR;AACL"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/core-gitlens",
|
|
3
3
|
"description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.48.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|