tsgrid-ui 2.6.0 → 2.7.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 +63 -0
- package/dist/tsgrid-ui.css +2 -2
- package/dist/tsgrid-ui.es6.js +60 -46
- package/dist/tsgrid-ui.es6.js.map +1 -1
- package/dist/tsgrid-ui.es6.min.js +30 -30
- package/dist/tsgrid-ui.js +61 -47
- package/dist/tsgrid-ui.min.css +2 -2
- package/dist/tsgrid-ui.min.js +29 -29
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to **TsGrid UI** will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## v2.7.0 — 2026-05-14
|
|
6
|
+
|
|
7
|
+
### Refactor
|
|
8
|
+
|
|
9
|
+
- **`locale()` extraction — `LocaleDeps` deps-injection pattern**: Extracted the `TsUtils.locale()` method body (62 LOC, the largest remaining cluster in `tsutils.ts`) into `_locale()` in `src/tsutils-locale.ts` via a new minimal `LocaleDeps` interface (`{ extend: (target, ...sources) => object; fetch: (url, init?) => Promise<Response> }`). Class method `locale()` becomes a 4-line delegator: `return _locale(locale, keepPhrases, noMerge, this.settings, { extend: this.extend.bind(this), fetch: globalThis.fetch.bind(globalThis) }).then(result => { if (result.settings) this.settings = result.settings; return result.kind === 'load' ? { file: result.file, data: result.data } : undefined })`. Public signature `TsUtils.locale(locale, keepPhrases?, noMerge?): Promise<{ file; data } | void>` is **byte-identical** to v2.6.0. `vi.spyOn(TsUtils.prototype, 'locale')` continues to work (prototype delegator — INV-SPY PASS). Follows the v2.3 `MessageDeps` / v2.6 `DateDeps` canonical patterns. Array-form branch uses **direct `_locale()` recursion** (not delegator round-trip — design OQ-2/D2) to keep the internal call graph leaf-friendly.
|
|
10
|
+
- `LocaleDeps` / `LocaleResult` are **internal** types backing the deps-injection delegation pattern. They are NOT exported through `src/index.ts` barrel (INV-L7-DEPS-INTERNAL PASS; INV-7 byte-identical barrel maintained). Consumers of `TsUtils.locale()` are unaffected.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Object-form `Utils.locale({...})` Promise hang (R-LOC-4 / INV-L7-OBJFIX)**: The v2.6.0 `locale()` body had `if (typeof locale === 'object') { this.settings = this.extend({}, this.settings, TsLocale, locale); return }` — the bare `return` inside the `new Promise((resolve, reject) => {...})` executor neither called `resolve()` nor `reject()`, so the Promise hung **forever** for any object-form input. v2.7.0 replaces the bare `return` with a value-returning path: the extracted `async function _locale()` returns `{ kind: 'merge', settings: mergedSettings }` for the object branch; the delegator unwraps to `undefined` (matching the original public contract for object form). `await Utils.locale({ dateFormat: 'dd.mm.yyyy' })` now resolves within ~1 ms (was: pending forever). Covered by test `T-LOC-1` with `vitest timeout: 1000`.
|
|
15
|
+
|
|
16
|
+
### Tests
|
|
17
|
+
|
|
18
|
+
- Added 10-case safety-net suite for `_locale()` in `test/unit/tsutils-locale.test.ts` committed as Phase 4 RED before extraction (INV-TDD PASS — `c7e64b43` < `dda197ad` < `32538179`):
|
|
19
|
+
- **T-LOC-1** — object-form `_locale({ dateFormat: 'dd.mm.yyyy' })` resolves within 1 s with `{ kind: 'merge', settings.dateFormat: 'dd.mm.yyyy' }` (INV-L7-OBJFIX gate)
|
|
20
|
+
- **T-LOC-2** — 5-char string `'ru-ru'` auto-expanded to `'locale/ru-ru.json'` before `deps.fetch`
|
|
21
|
+
- **T-LOC-3** — Full-path string `'locale/ru-ru.json'` passed verbatim (no double-expansion)
|
|
22
|
+
- **T-LOC-4** — `keepPhrases=true` preserves pre-existing phrase keys in returned settings
|
|
23
|
+
- **T-LOC-5** — `keepPhrases=false` (default) executes the TsLocale-merge branch; documents `R-LOC-V26-PRESERVED` (see Known Issues)
|
|
24
|
+
- **T-LOC-6** — `noMerge=true` returns `{ kind: 'load', file, data }` without including merged settings
|
|
25
|
+
- **T-LOC-7** — Array form `['en-us', 'ru-ru']` triggers N fetch calls and resolves `{ kind: 'void' }` (delegator maps to `undefined`)
|
|
26
|
+
- **T-LOC-8** — `deps.fetch` rejection re-throws and rejects the returned Promise
|
|
27
|
+
- **T-LOC-9** — Design constraint: T-LOC-2..T-LOC-8 pass in jsdom **without** a global `fetch` polyfill (proven by T-LOC-2..T-LOC-8 collectively)
|
|
28
|
+
- **T-LOC-10** — `vi.spyOn(TsUtils, 'locale')` observes exactly one call when `TsUtils.locale('en-us')` is invoked (INV-SPY / INV-L7-DELEGATOR gate)
|
|
29
|
+
- Total Vitest tests: **297/297 GREEN** (v2.6.0 baseline: 288/288).
|
|
30
|
+
|
|
31
|
+
### Bundle
|
|
32
|
+
|
|
33
|
+
Delta vs v2.6.0 baseline:
|
|
34
|
+
|
|
35
|
+
| Artifact | v2.6.0 | v2.7.0 | Δ bytes | Δ % |
|
|
36
|
+
|----------|--------|--------|---------|-----|
|
|
37
|
+
| `dist/tsgrid-ui.js` (CJS) | 946,686 B | 947,274 B | +588 B | +0.0621% |
|
|
38
|
+
| `dist/tsgrid-ui.es6.js` (ESM) | 944,878 B | 945,466 B | +588 B | +0.0622% |
|
|
39
|
+
| `dist/tsgrid-ui.min.js` (CJS min) | 508,954 B | 509,260 B | +306 B | +0.0601% |
|
|
40
|
+
| `dist/tsgrid-ui.es6.min.js` (ESM min) | 507,819 B | 508,125 B | +306 B | +0.0603% |
|
|
41
|
+
| `dist/tsgrid-ui.d.ts` | 94,446 B | 94,446 B | 0 B | 0.0000% |
|
|
42
|
+
| `dist/tsgrid-ui.css` | 246,980 B | 246,980 B | 0 B | 0.0000% |
|
|
43
|
+
| `dist/tsgrid-ui.min.css` | 229,707 B | 229,707 B | 0 B | 0.0000% |
|
|
44
|
+
|
|
45
|
+
All within ±2% gate. PASSED. The JS bundles grew by ~0.06% (the new `_locale` function body + deps wiring); the `d.ts` is **byte-identical** to v2.6.0 (INV-L7-API PASS — `locale(` signature unchanged, `LocaleDeps`/`LocaleResult` declared `@internal` and stripped by tsup `stripInternal: true`). CSS/min.css unchanged (no css edits in v2.7).
|
|
46
|
+
|
|
47
|
+
### BC
|
|
48
|
+
|
|
49
|
+
- `TsUtils.locale(locale, keepPhrases?, noMerge?): Promise<{ file: string; data: unknown } | void>` — signature and (now-resolving) runtime behavior **BYTE-IDENTICAL** to v2.6.0 for all string/array inputs. **Object-form input changes**: previously hung forever (effectively unusable); now resolves with `undefined` after merging. Existing call sites using string/array inputs work unchanged; existing call sites using object-form were necessarily broken (Promise never settled) and now begin working.
|
|
50
|
+
- `src/index.ts` barrel — **byte-identical** to v2.6.0 (INV-7 PASS).
|
|
51
|
+
- `LocaleDeps` / `LocaleResult` — NEW **internal** types. NOT exported through `src/index.ts` barrel (INV-L7-DEPS-INTERNAL PASS). `LocaleResult` declared `/** @internal */` and stripped from the rolled d.ts. `LocaleDeps` is type-only at the delegator call site and does not affect the d.ts surface.
|
|
52
|
+
- SEMVER MINOR. BC verdict: NONE for string/array inputs; BUGFIX for object-form input (R-LOC-4).
|
|
53
|
+
|
|
54
|
+
### Known issues
|
|
55
|
+
|
|
56
|
+
- **R-LOC-2** (deferred from v2.6 — confirmed still present): Array-form input `await Utils.locale(['en-us', 'ru-ru'])` MUTATES the caller's input array (each 5-char code is rewritten in-place to `'locale/xx-xx.json'`). Preserved verbatim in v2.7. Candidate fix in v2.8.
|
|
57
|
+
- **R-LOC-V26-PRESERVED** (newly documented): `keepPhrases=false` branch in v2.6.0 had comment "clear phrases from language before merging" but the implementation `extend({}, settings, TsLocale, { phrases: {} }, data)` does **not** actually clear pre-existing phrase keys — `extend` is deep, and `extend(existingPhrases, {})` is a no-op. Pre-existing phrase keys survive the merge in both v2.6.0 and v2.7.0. v2.7 scope was constrained to **one** behavior change (R-LOC-4 — object-form hang), so this latent behavior is preserved verbatim with `T-LOC-5` documenting the actual semantics. Candidate fix in v2.8.
|
|
58
|
+
- **R-LOC-3** (carry-forward from v2.6): Locale extraction does NOT unblock formatter extraction. The `format()` family still has its own deps-injection requirement; will be tackled separately in v2.8 via a `FormatterDeps` cluster.
|
|
59
|
+
|
|
60
|
+
### Internal
|
|
61
|
+
|
|
62
|
+
- `src/tsutils-locale.ts` is a **leaf module** (INV-L7-LEAF PASS): zero runtime imports from `./tsbase.js` or `./tsutils.js`. Only `import type { TsUISettings } from './tsutils.js'` (erased at emit) and `import { TsLocale } from './tslocale.js'` (zero-dep data leaf). DAG depth unchanged.
|
|
63
|
+
- INV-9 (zero `this.` in extracted function body) PASS.
|
|
64
|
+
- INV-LINT-INV8 canary: `src/tsutils-*.ts` ESLint glob continues to cover the new file (verified by inserting `void arguments.length;` → `pnpm lint` EXIT 1 → revert → EXIT 0).
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
5
68
|
## v2.6.0 — 2026-05-13
|
|
6
69
|
|
|
7
70
|
### Refactor
|
package/dist/tsgrid-ui.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tsgrid-ui 1.0.x (nightly) (5/
|
|
1
|
+
/* tsgrid-ui 1.0.x (nightly) (5/14/2026, 12:09:58 AM) (c) 2014 vitmalina@gmail.com, (c) 2026 DaverSoGT — MIT */
|
|
2
2
|
/**
|
|
3
3
|
* TODO:
|
|
4
4
|
* - remove default styling, only keep tsg-* styles
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
@font-face {
|
|
11
11
|
font-family: "tsgrid-font";
|
|
12
|
-
src: url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAApYAAsAAAAAD0wAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAQQAAAFZdKW6ZY21hcAAAAYgAAACiAAACNBnCLmJnbHlmAAACLAAABd8AAAfo+
|
|
12
|
+
src: url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAApYAAsAAAAAD0wAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAA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W824ZWaGoehuaJX2IdTVVYIyIn/mTD5niST+me2hWeJxtx1EOgjAQRdE+aAuKCizERdUyCrF0mk5JZPdq/PX83FxVqZ9e/TegQg0NA4sGLQ44osMJZ1zQY8Co6hu/jJ/JP63nwFmaT7Y1ivGZRfSUORlaU9k72un63URZL/HOJjkpZBNFvwSdwiY2U2A3WSGX/dwKlbLEhyj1BqYnJNk=") format("woff");
|
|
13
13
|
font-weight: normal;
|
|
14
14
|
font-style: normal;
|
|
15
15
|
}
|
package/dist/tsgrid-ui.es6.js
CHANGED
|
@@ -3007,6 +3007,59 @@ function _date(dateStr, settings, deps) {
|
|
|
3007
3007
|
return '<span title="' + dd1 + " " + time2 + '">' + dsp + "</span>";
|
|
3008
3008
|
}
|
|
3009
3009
|
|
|
3010
|
+
// src/tsutils-locale.ts
|
|
3011
|
+
async function _locale(locale, keepPhrases, noMerge, settings, deps) {
|
|
3012
|
+
if (Array.isArray(locale)) {
|
|
3013
|
+
let mergedSettings = deps.extend({}, settings, { phrases: {} });
|
|
3014
|
+
const localeArr = locale;
|
|
3015
|
+
const proms = [];
|
|
3016
|
+
const files = {};
|
|
3017
|
+
localeArr.forEach((file, ind) => {
|
|
3018
|
+
if (file.length === 5) {
|
|
3019
|
+
file = "locale/" + file.toLowerCase() + ".json";
|
|
3020
|
+
localeArr[ind] = file;
|
|
3021
|
+
}
|
|
3022
|
+
proms.push(_locale(file, true, false, mergedSettings, deps));
|
|
3023
|
+
});
|
|
3024
|
+
const res = await Promise.allSettled(proms);
|
|
3025
|
+
res.forEach((r) => {
|
|
3026
|
+
if (r.status === "fulfilled" && r.value.kind === "load") {
|
|
3027
|
+
files[r.value.file] = r.value.data;
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
localeArr.forEach((file) => {
|
|
3031
|
+
mergedSettings = deps.extend({}, mergedSettings, files[file] ?? {});
|
|
3032
|
+
});
|
|
3033
|
+
return { kind: "void", settings: mergedSettings };
|
|
3034
|
+
}
|
|
3035
|
+
if (!locale) locale = "en-us";
|
|
3036
|
+
if (typeof locale === "object") {
|
|
3037
|
+
const mergedSettings = deps.extend({}, settings, TsLocale, locale);
|
|
3038
|
+
return { kind: "merge", settings: mergedSettings };
|
|
3039
|
+
}
|
|
3040
|
+
let localeStr = locale;
|
|
3041
|
+
if (localeStr.length === 5) {
|
|
3042
|
+
localeStr = "locale/" + localeStr.toLowerCase() + ".json";
|
|
3043
|
+
}
|
|
3044
|
+
try {
|
|
3045
|
+
const res = await deps.fetch(localeStr, { method: "GET" });
|
|
3046
|
+
const data = await res.json();
|
|
3047
|
+
if (noMerge !== true) {
|
|
3048
|
+
if (keepPhrases) {
|
|
3049
|
+
const newSettings = deps.extend({}, settings, data);
|
|
3050
|
+
return { kind: "load", file: localeStr, data, settings: newSettings };
|
|
3051
|
+
} else {
|
|
3052
|
+
const newSettings = deps.extend({}, settings, TsLocale, { phrases: {} }, data);
|
|
3053
|
+
return { kind: "load", file: localeStr, data, settings: newSettings };
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
return { kind: "load", file: localeStr, data };
|
|
3057
|
+
} catch (err) {
|
|
3058
|
+
console.log("ERROR: Cannot load locale " + localeStr);
|
|
3059
|
+
throw err;
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3010
3063
|
// src/tsutils.ts
|
|
3011
3064
|
var query7 = query;
|
|
3012
3065
|
var Utils = class {
|
|
@@ -3490,52 +3543,13 @@ var Utils = class {
|
|
|
3490
3543
|
return this.execTemplate(translation, params);
|
|
3491
3544
|
}
|
|
3492
3545
|
locale(locale, keepPhrases, noMerge) {
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
if (file.length === 5) {
|
|
3501
|
-
file = "locale/" + file.toLowerCase() + ".json";
|
|
3502
|
-
localeArr[ind] = file;
|
|
3503
|
-
}
|
|
3504
|
-
proms.push(this.locale(file, true, false));
|
|
3505
|
-
});
|
|
3506
|
-
Promise.allSettled(proms).then((res) => {
|
|
3507
|
-
res.forEach((r) => {
|
|
3508
|
-
if (r.value) files[r.value.file] = r.value.data;
|
|
3509
|
-
});
|
|
3510
|
-
localeArr.forEach((file) => {
|
|
3511
|
-
this.settings = this.extend({}, this.settings, files[file]);
|
|
3512
|
-
});
|
|
3513
|
-
resolve();
|
|
3514
|
-
});
|
|
3515
|
-
return;
|
|
3516
|
-
}
|
|
3517
|
-
if (!locale) locale = "en-us";
|
|
3518
|
-
if (typeof locale === "object") {
|
|
3519
|
-
this.settings = this.extend({}, this.settings, TsLocale, locale);
|
|
3520
|
-
return;
|
|
3521
|
-
}
|
|
3522
|
-
let localeStr = locale;
|
|
3523
|
-
if (localeStr.length === 5) {
|
|
3524
|
-
localeStr = "locale/" + localeStr.toLowerCase() + ".json";
|
|
3525
|
-
}
|
|
3526
|
-
fetch(localeStr, { method: "GET" }).then((res) => res.json()).then((data) => {
|
|
3527
|
-
if (noMerge !== true) {
|
|
3528
|
-
if (keepPhrases) {
|
|
3529
|
-
this.settings = this.extend({}, this.settings, data);
|
|
3530
|
-
} else {
|
|
3531
|
-
this.settings = this.extend({}, this.settings, TsLocale, { phrases: {} }, data);
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
resolve({ file: localeStr, data });
|
|
3535
|
-
}).catch((err) => {
|
|
3536
|
-
console.log("ERROR: Cannot load locale " + localeStr);
|
|
3537
|
-
reject(err);
|
|
3538
|
-
});
|
|
3546
|
+
const deps = {
|
|
3547
|
+
extend: this.extend.bind(this),
|
|
3548
|
+
fetch: globalThis.fetch.bind(globalThis)
|
|
3549
|
+
};
|
|
3550
|
+
return _locale(locale, keepPhrases, noMerge, this.settings, deps).then((result) => {
|
|
3551
|
+
if (result.settings) this.settings = result.settings;
|
|
3552
|
+
return result.kind === "load" ? { file: result.file, data: result.data } : void 0;
|
|
3539
3553
|
});
|
|
3540
3554
|
}
|
|
3541
3555
|
scrollBarSize() {
|