@stramien/core 0.0.0-stage → 0.13.1
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/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/chunk-GTSSWRW7.js +199 -0
- package/dist/chunk-GTSSWRW7.js.map +1 -0
- package/dist/index.d.ts +1752 -0
- package/dist/index.js +9627 -0
- package/dist/index.js.map +1 -0
- package/dist/locale-text-37JUjoN2.d.ts +161 -0
- package/dist/locales.d.ts +16 -0
- package/dist/locales.js +557 -0
- package/dist/locales.js.map +1 -0
- package/dist/styles.css +2338 -0
- package/package.json +53 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Erik-Jan van Baaren
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @stramien/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Zero-dependency TypeScript data grid engine with built-in virtualized DOM renderer and layered CSS-variable themes (`light`, `dark`, `auto`, `compact`).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @stramien/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import '@stramien/core/styles.css';
|
|
15
|
+
import { createGrid } from '@stramien/core';
|
|
16
|
+
|
|
17
|
+
const grid = createGrid(document.getElementById('grid')!, {
|
|
18
|
+
rowData: rows,
|
|
19
|
+
columnDefs: [
|
|
20
|
+
{ field: 'name', pinned: 'left', filter: 'text', floatingFilter: true },
|
|
21
|
+
{ field: 'salary', dataType: 'number', editable: true, aggFunc: 'avg' },
|
|
22
|
+
],
|
|
23
|
+
globalSearch: true,
|
|
24
|
+
pagination: true,
|
|
25
|
+
pinnedBottomSummary: { labelColId: 'name', label: 'Summary' },
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
See the [Stramien documentation](https://github.com/stramien/stramien#readme) for full API details.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT © 2026 Erik-Jan van Baaren
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// src/i18n/locale-text.ts
|
|
2
|
+
var PLACEHOLDER = /\{(\w+)\}/g;
|
|
3
|
+
function formatLocaleText(template, params) {
|
|
4
|
+
if (!params) return template;
|
|
5
|
+
return template.replace(
|
|
6
|
+
PLACEHOLDER,
|
|
7
|
+
(match, name) => name in params ? String(params[name]) : match
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function plural(singular, pluralForm, countKey = "count", singularFor = ["1"]) {
|
|
11
|
+
return (params) => formatLocaleText(
|
|
12
|
+
singularFor.includes(String(params[countKey])) ? singular : pluralForm,
|
|
13
|
+
params
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
var DEFAULT_LOCALE_TEXT = {
|
|
17
|
+
// Grid
|
|
18
|
+
gridLabel: "Data Grid",
|
|
19
|
+
loading: "Loading\u2026",
|
|
20
|
+
retry: "Retry",
|
|
21
|
+
noRows: "No rows to display",
|
|
22
|
+
noMatchingRows: "No matching rows found",
|
|
23
|
+
loadError: "Failed to load rows from server",
|
|
24
|
+
summaryLabel: "Summary",
|
|
25
|
+
// Toolbar
|
|
26
|
+
searchPlaceholder: "Search all columns\u2026",
|
|
27
|
+
searchLabel: "Search all columns",
|
|
28
|
+
clearSearch: "Clear search",
|
|
29
|
+
clearFilters: "Clear filters",
|
|
30
|
+
columns: "Columns",
|
|
31
|
+
exportCsv: "Export CSV",
|
|
32
|
+
expandAll: "Expand all",
|
|
33
|
+
collapseAll: "Collapse all",
|
|
34
|
+
/** Result count without filters. Placeholders: `{count}`. */
|
|
35
|
+
rowCount: plural("{count} row", "{count} rows"),
|
|
36
|
+
/** Result count while filtered. Placeholders: `{filtered}`, `{total}`. */
|
|
37
|
+
rowCountFiltered: plural(
|
|
38
|
+
"Showing {filtered} of {total} row",
|
|
39
|
+
"Showing {filtered} of {total} rows",
|
|
40
|
+
"total"
|
|
41
|
+
),
|
|
42
|
+
// Header
|
|
43
|
+
selectAllRows: "Select all rows",
|
|
44
|
+
/** Placeholders: `{column}`. */
|
|
45
|
+
filterColumn: "Filter {column}",
|
|
46
|
+
/** Placeholders: `{column}`. */
|
|
47
|
+
columnActions: "Column actions for {column}",
|
|
48
|
+
// Floating filters
|
|
49
|
+
/** Placeholders: `{column}`. */
|
|
50
|
+
floatingFilterPlaceholder: "Filter {column}\u2026",
|
|
51
|
+
floatingNumberFilterHint: "A number, a comparison (<20, <=20, >50, >=50, !=0) or a range (10-20)",
|
|
52
|
+
/** Placeholders: `{column}`. */
|
|
53
|
+
clearColumnFilter: "Clear filter on {column}",
|
|
54
|
+
floatingSetAll: "All",
|
|
55
|
+
/** Placeholders: `{count}`. */
|
|
56
|
+
selectedCount: "{count} selected",
|
|
57
|
+
// Rows and cells
|
|
58
|
+
/** Placeholders: `{index}` (1-based). */
|
|
59
|
+
selectRow: "Select row {index}",
|
|
60
|
+
expandRowDetails: "Expand row details",
|
|
61
|
+
collapseRowDetails: "Collapse row details",
|
|
62
|
+
/** Placeholders: `{id}`. */
|
|
63
|
+
rowDetails: "Details for row {id}",
|
|
64
|
+
/** Placeholders: `{label}`. The `treeToggleLabel` option takes precedence. */
|
|
65
|
+
treeToggle: "Toggle {label}",
|
|
66
|
+
/** Placeholders: `{column}`. */
|
|
67
|
+
editCell: "Edit {column}",
|
|
68
|
+
/** Placeholders: `{error}`. */
|
|
69
|
+
editNotSaved: "Edit not saved: {error}",
|
|
70
|
+
// Pagination
|
|
71
|
+
pageSize: "Page size:",
|
|
72
|
+
rowsPerPage: "Rows per page",
|
|
73
|
+
firstPage: "First page",
|
|
74
|
+
previousPage: "Previous page",
|
|
75
|
+
nextPage: "Next page",
|
|
76
|
+
lastPage: "Last page",
|
|
77
|
+
/** Rows shown on this page. Placeholders: `{start}`, `{end}`, `{total}`. */
|
|
78
|
+
pageRange: "{start}\u2013{end} of {total}",
|
|
79
|
+
/** Placeholders: `{page}`, `{total}`. */
|
|
80
|
+
pageOf: "Page {page} of {total}",
|
|
81
|
+
// Column chooser
|
|
82
|
+
findColumn: "Find column\u2026",
|
|
83
|
+
showAllColumns: "Show all",
|
|
84
|
+
resetLayout: "Reset layout",
|
|
85
|
+
// Column menu
|
|
86
|
+
pinTooNarrow: "The grid is too narrow to pin columns",
|
|
87
|
+
pinLeft: "Pin Left",
|
|
88
|
+
pinRight: "Pin Right",
|
|
89
|
+
noPin: "No Pin",
|
|
90
|
+
autoSizeColumn: "Auto-size Column",
|
|
91
|
+
fitAllColumns: "Fit All Columns",
|
|
92
|
+
hideColumn: "Hide Column",
|
|
93
|
+
/** Row grouping. Placeholders: `{column}`. */
|
|
94
|
+
groupBy: "Group by {column}",
|
|
95
|
+
/** Row grouping. Placeholders: `{column}`. */
|
|
96
|
+
ungroup: "Ungroup {column}",
|
|
97
|
+
/** Column chooser tooltip of a column hidden because the rows are grouped by it. */
|
|
98
|
+
groupHiddenHint: "Hidden while the rows are grouped by this column",
|
|
99
|
+
showHiddenColumns: "Show Hidden Columns",
|
|
100
|
+
/** Placeholders: `{column}`. */
|
|
101
|
+
showColumn: 'Show "{column}"',
|
|
102
|
+
// Filter popover
|
|
103
|
+
/** Placeholders: `{column}`. */
|
|
104
|
+
filterTitle: "Filter: {column}",
|
|
105
|
+
filterContains: "Contains",
|
|
106
|
+
filterNotContains: "Does not contain",
|
|
107
|
+
filterEquals: "Equals",
|
|
108
|
+
filterTextNotEqual: "Does not equal",
|
|
109
|
+
filterNotEqual: "Not equal",
|
|
110
|
+
filterStartsWith: "Starts with",
|
|
111
|
+
filterEndsWith: "Ends with",
|
|
112
|
+
filterBlank: "Blank",
|
|
113
|
+
filterNotBlank: "Not blank",
|
|
114
|
+
filterLessThan: "Less than",
|
|
115
|
+
filterLessThanOrEqual: "Less than or equal",
|
|
116
|
+
filterGreaterThan: "Greater than",
|
|
117
|
+
filterGreaterThanOrEqual: "Greater than or equal",
|
|
118
|
+
filterInRange: "In range",
|
|
119
|
+
filterBefore: "Before",
|
|
120
|
+
filterAfter: "After",
|
|
121
|
+
filterValuePlaceholder: "Filter value\u2026",
|
|
122
|
+
filterFromPlaceholder: "Value\u2026",
|
|
123
|
+
filterToPlaceholder: "To value\u2026",
|
|
124
|
+
searchValues: "Search values\u2026",
|
|
125
|
+
selectAll: "(Select All)",
|
|
126
|
+
/** Label of the empty-value choice in set filters (the filter model keeps `(Blank)`). */
|
|
127
|
+
blankValue: "(Blank)",
|
|
128
|
+
clearFilter: "Clear",
|
|
129
|
+
applyFilter: "Apply",
|
|
130
|
+
// Active filter summaries (floating row)
|
|
131
|
+
/** Placeholders: `{value}`. */
|
|
132
|
+
summaryBefore: "before {value}",
|
|
133
|
+
/** Placeholders: `{value}`. */
|
|
134
|
+
summaryAfter: "after {value}",
|
|
135
|
+
/** Placeholders: `{value}`. */
|
|
136
|
+
summaryNotContains: "not \u201C{value}\u201D",
|
|
137
|
+
summaryFiltered: "Filtered",
|
|
138
|
+
// Screen reader announcements
|
|
139
|
+
copied: "Copied to clipboard",
|
|
140
|
+
copyFailed: "Copy to clipboard failed",
|
|
141
|
+
/** Placeholders: `{query}`, `{count}`. */
|
|
142
|
+
searchMatched: plural(
|
|
143
|
+
'Search "{query}" matched {count} row',
|
|
144
|
+
'Search "{query}" matched {count} rows'
|
|
145
|
+
),
|
|
146
|
+
/** Placeholders: `{count}`. */
|
|
147
|
+
searchCleared: plural(
|
|
148
|
+
"Search cleared, showing {count} row",
|
|
149
|
+
"Search cleared, showing {count} rows"
|
|
150
|
+
),
|
|
151
|
+
/** Placeholders: `{count}`. */
|
|
152
|
+
filterUpdated: plural(
|
|
153
|
+
"Filter updated, {count} matching row",
|
|
154
|
+
"Filter updated, {count} matching rows"
|
|
155
|
+
),
|
|
156
|
+
/** Placeholders: `{count}`. */
|
|
157
|
+
filtersCleared: plural(
|
|
158
|
+
"All filters cleared, showing {count} row",
|
|
159
|
+
"All filters cleared, showing {count} rows"
|
|
160
|
+
),
|
|
161
|
+
/** Placeholders: `{column}`, `{direction}` (`sortAscending` / `sortDescending`), `{count}`. */
|
|
162
|
+
sortedBy: plural(
|
|
163
|
+
"Sorted by {column}, {direction}, {count} row",
|
|
164
|
+
"Sorted by {column}, {direction}, {count} rows"
|
|
165
|
+
),
|
|
166
|
+
sortAscending: "ascending",
|
|
167
|
+
sortDescending: "descending",
|
|
168
|
+
/** Placeholders: `{column}`. */
|
|
169
|
+
sortCleared: "Cleared sort on {column}",
|
|
170
|
+
/** Placeholders: `{label}`. */
|
|
171
|
+
nodeExpanded: "{label} expanded",
|
|
172
|
+
/** Placeholders: `{label}`. */
|
|
173
|
+
nodeCollapsed: "{label} collapsed",
|
|
174
|
+
/** Placeholders: `{count}`. */
|
|
175
|
+
pastedCells: plural("Pasted {count} cell", "Pasted {count} cells"),
|
|
176
|
+
/** Placeholders: `{count}`, `{skipped}`. */
|
|
177
|
+
pastedCellsSkipped: plural(
|
|
178
|
+
"Pasted {count} cell, skipped {skipped}",
|
|
179
|
+
"Pasted {count} cells, skipped {skipped}"
|
|
180
|
+
),
|
|
181
|
+
/** Placeholders: `{rows}`, `{columns}`. */
|
|
182
|
+
cellsSelected: "{rows} by {columns} cells selected",
|
|
183
|
+
expandedAll: "Expanded all tree branches",
|
|
184
|
+
collapsedAll: "Collapsed all tree branches"
|
|
185
|
+
};
|
|
186
|
+
function createTranslator(getOverrides) {
|
|
187
|
+
return (key, params) => {
|
|
188
|
+
const value = getOverrides()?.[key] ?? DEFAULT_LOCALE_TEXT[key];
|
|
189
|
+
return typeof value === "function" ? value(params ?? {}) : formatLocaleText(value, params);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export {
|
|
194
|
+
formatLocaleText,
|
|
195
|
+
plural,
|
|
196
|
+
DEFAULT_LOCALE_TEXT,
|
|
197
|
+
createTranslator
|
|
198
|
+
};
|
|
199
|
+
//# sourceMappingURL=chunk-GTSSWRW7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n/locale-text.ts"],"sourcesContent":["export type LocaleTextParams = Record<string, string | number>;\n\nconst PLACEHOLDER = /\\{(\\w+)\\}/g;\n\n/** Fills `{name}` placeholders; unknown names are left as they are. */\nexport function formatLocaleText(template: string, params?: LocaleTextParams): string {\n if (!params) return template;\n return template.replace(PLACEHOLDER, (match, name: string) =>\n name in params ? String(params[name]) : match,\n );\n}\n\n/**\n * A locale text that picks the singular or plural template by a count placeholder (the grid\n * passes counts already formatted, e.g. `'1'` or `'1,234'`). `singularFor` lists the counts\n * that take the singular form (French also uses it for 0).\n */\nexport function plural(\n singular: string,\n pluralForm: string,\n countKey = 'count',\n singularFor: readonly string[] = ['1'],\n): (params: LocaleTextParams) => string {\n return (params) =>\n formatLocaleText(\n singularFor.includes(String(params[countKey])) ? singular : pluralForm,\n params,\n );\n}\n\n/**\n * Every piece of text the grid shows or announces, in English. Override any of them with the\n * `localeText` grid option. `{name}` placeholders are filled in by the grid; a function value\n * gets the same values as an object. Texts with a count are such functions (`plural()`), so\n * they read `1 row` / `2 rows`.\n */\nexport const DEFAULT_LOCALE_TEXT = {\n // Grid\n gridLabel: 'Data Grid',\n loading: 'Loading…',\n retry: 'Retry',\n noRows: 'No rows to display',\n noMatchingRows: 'No matching rows found',\n loadError: 'Failed to load rows from server',\n summaryLabel: 'Summary',\n\n // Toolbar\n searchPlaceholder: 'Search all columns…',\n searchLabel: 'Search all columns',\n clearSearch: 'Clear search',\n clearFilters: 'Clear filters',\n columns: 'Columns',\n exportCsv: 'Export CSV',\n expandAll: 'Expand all',\n collapseAll: 'Collapse all',\n /** Result count without filters. Placeholders: `{count}`. */\n rowCount: plural('{count} row', '{count} rows'),\n /** Result count while filtered. Placeholders: `{filtered}`, `{total}`. */\n rowCountFiltered: plural(\n 'Showing {filtered} of {total} row',\n 'Showing {filtered} of {total} rows',\n 'total',\n ),\n\n // Header\n selectAllRows: 'Select all rows',\n /** Placeholders: `{column}`. */\n filterColumn: 'Filter {column}',\n /** Placeholders: `{column}`. */\n columnActions: 'Column actions for {column}',\n\n // Floating filters\n /** Placeholders: `{column}`. */\n floatingFilterPlaceholder: 'Filter {column}…',\n floatingNumberFilterHint: 'A number, a comparison (<20, <=20, >50, >=50, !=0) or a range (10-20)',\n /** Placeholders: `{column}`. */\n clearColumnFilter: 'Clear filter on {column}',\n floatingSetAll: 'All',\n /** Placeholders: `{count}`. */\n selectedCount: '{count} selected',\n\n // Rows and cells\n /** Placeholders: `{index}` (1-based). */\n selectRow: 'Select row {index}',\n expandRowDetails: 'Expand row details',\n collapseRowDetails: 'Collapse row details',\n /** Placeholders: `{id}`. */\n rowDetails: 'Details for row {id}',\n /** Placeholders: `{label}`. The `treeToggleLabel` option takes precedence. */\n treeToggle: 'Toggle {label}',\n /** Placeholders: `{column}`. */\n editCell: 'Edit {column}',\n /** Placeholders: `{error}`. */\n editNotSaved: 'Edit not saved: {error}',\n\n // Pagination\n pageSize: 'Page size:',\n rowsPerPage: 'Rows per page',\n firstPage: 'First page',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n lastPage: 'Last page',\n /** Rows shown on this page. Placeholders: `{start}`, `{end}`, `{total}`. */\n pageRange: '{start}–{end} of {total}',\n /** Placeholders: `{page}`, `{total}`. */\n pageOf: 'Page {page} of {total}',\n\n // Column chooser\n findColumn: 'Find column…',\n showAllColumns: 'Show all',\n resetLayout: 'Reset layout',\n\n // Column menu\n pinTooNarrow: 'The grid is too narrow to pin columns',\n pinLeft: 'Pin Left',\n pinRight: 'Pin Right',\n noPin: 'No Pin',\n autoSizeColumn: 'Auto-size Column',\n fitAllColumns: 'Fit All Columns',\n hideColumn: 'Hide Column',\n /** Row grouping. Placeholders: `{column}`. */\n groupBy: 'Group by {column}',\n /** Row grouping. Placeholders: `{column}`. */\n ungroup: 'Ungroup {column}',\n /** Column chooser tooltip of a column hidden because the rows are grouped by it. */\n groupHiddenHint: 'Hidden while the rows are grouped by this column',\n showHiddenColumns: 'Show Hidden Columns',\n /** Placeholders: `{column}`. */\n showColumn: 'Show \"{column}\"',\n\n // Filter popover\n /** Placeholders: `{column}`. */\n filterTitle: 'Filter: {column}',\n filterContains: 'Contains',\n filterNotContains: 'Does not contain',\n filterEquals: 'Equals',\n filterTextNotEqual: 'Does not equal',\n filterNotEqual: 'Not equal',\n filterStartsWith: 'Starts with',\n filterEndsWith: 'Ends with',\n filterBlank: 'Blank',\n filterNotBlank: 'Not blank',\n filterLessThan: 'Less than',\n filterLessThanOrEqual: 'Less than or equal',\n filterGreaterThan: 'Greater than',\n filterGreaterThanOrEqual: 'Greater than or equal',\n filterInRange: 'In range',\n filterBefore: 'Before',\n filterAfter: 'After',\n filterValuePlaceholder: 'Filter value…',\n filterFromPlaceholder: 'Value…',\n filterToPlaceholder: 'To value…',\n searchValues: 'Search values…',\n selectAll: '(Select All)',\n /** Label of the empty-value choice in set filters (the filter model keeps `(Blank)`). */\n blankValue: '(Blank)',\n clearFilter: 'Clear',\n applyFilter: 'Apply',\n\n // Active filter summaries (floating row)\n /** Placeholders: `{value}`. */\n summaryBefore: 'before {value}',\n /** Placeholders: `{value}`. */\n summaryAfter: 'after {value}',\n /** Placeholders: `{value}`. */\n summaryNotContains: 'not “{value}”',\n summaryFiltered: 'Filtered',\n\n // Screen reader announcements\n copied: 'Copied to clipboard',\n copyFailed: 'Copy to clipboard failed',\n /** Placeholders: `{query}`, `{count}`. */\n searchMatched: plural(\n 'Search \"{query}\" matched {count} row',\n 'Search \"{query}\" matched {count} rows',\n ),\n /** Placeholders: `{count}`. */\n searchCleared: plural(\n 'Search cleared, showing {count} row',\n 'Search cleared, showing {count} rows',\n ),\n /** Placeholders: `{count}`. */\n filterUpdated: plural(\n 'Filter updated, {count} matching row',\n 'Filter updated, {count} matching rows',\n ),\n /** Placeholders: `{count}`. */\n filtersCleared: plural(\n 'All filters cleared, showing {count} row',\n 'All filters cleared, showing {count} rows',\n ),\n /** Placeholders: `{column}`, `{direction}` (`sortAscending` / `sortDescending`), `{count}`. */\n sortedBy: plural(\n 'Sorted by {column}, {direction}, {count} row',\n 'Sorted by {column}, {direction}, {count} rows',\n ),\n sortAscending: 'ascending',\n sortDescending: 'descending',\n /** Placeholders: `{column}`. */\n sortCleared: 'Cleared sort on {column}',\n /** Placeholders: `{label}`. */\n nodeExpanded: '{label} expanded',\n /** Placeholders: `{label}`. */\n nodeCollapsed: '{label} collapsed',\n /** Placeholders: `{count}`. */\n pastedCells: plural('Pasted {count} cell', 'Pasted {count} cells'),\n /** Placeholders: `{count}`, `{skipped}`. */\n pastedCellsSkipped: plural(\n 'Pasted {count} cell, skipped {skipped}',\n 'Pasted {count} cells, skipped {skipped}',\n ),\n /** Placeholders: `{rows}`, `{columns}`. */\n cellsSelected: '{rows} by {columns} cells selected',\n expandedAll: 'Expanded all tree branches',\n collapsedAll: 'Collapsed all tree branches',\n} as const;\n\nexport type LocaleTextKey = keyof typeof DEFAULT_LOCALE_TEXT;\n\n/** A translated text: a string with `{name}` placeholders, or a function of the values. */\nexport type LocaleTextValue = string | ((params: LocaleTextParams) => string);\n\n/** A full translation: every key of `DEFAULT_LOCALE_TEXT`. */\nexport type CompleteLocaleText = Record<LocaleTextKey, LocaleTextValue>;\n\n/** Overrides for the grid's built-in text (see `DEFAULT_LOCALE_TEXT` for the keys). */\nexport type LocaleText = Partial<Record<LocaleTextKey, LocaleTextValue>>;\n\nexport type Translate = (key: LocaleTextKey, params?: LocaleTextParams) => string;\n\n/** A translate function reading the current overrides on every call. */\nexport function createTranslator(getOverrides: () => LocaleText | undefined): Translate {\n return (key, params) => {\n const value = getOverrides()?.[key] ?? DEFAULT_LOCALE_TEXT[key];\n return typeof value === 'function'\n ? value(params ?? {})\n : formatLocaleText(value as string, params);\n };\n}\n"],"mappings":";AAEA,IAAM,cAAc;AAGb,SAAS,iBAAiB,UAAkB,QAAmC;AACpF,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,SAAS;AAAA,IAAQ;AAAA,IAAa,CAAC,OAAO,SAC3C,QAAQ,SAAS,OAAO,OAAO,IAAI,CAAC,IAAI;AAAA,EAC1C;AACF;AAOO,SAAS,OACd,UACA,YACA,WAAW,SACX,cAAiC,CAAC,GAAG,GACC;AACtC,SAAO,CAAC,WACN;AAAA,IACE,YAAY,SAAS,OAAO,OAAO,QAAQ,CAAC,CAAC,IAAI,WAAW;AAAA,IAC5D;AAAA,EACF;AACJ;AAQO,IAAM,sBAAsB;AAAA;AAAA,EAEjC,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EAC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