@cosmicdrift/kumiko-types 0.212.0 → 0.213.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/package.json +1 -1
- package/src/handlers.ts +12 -0
- package/src/screen.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.213.0",
|
|
4
4
|
"description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
package/src/handlers.ts
CHANGED
|
@@ -335,6 +335,11 @@ export type AppContext = SharedContextFields & {
|
|
|
335
335
|
* Sprint-8a Tier-Composition: `effectiveFeatures(ctx._tenantId)`-call
|
|
336
336
|
* in den hook-filter-Stellen. */
|
|
337
337
|
readonly _tenantId?: TenantId;
|
|
338
|
+
/** Boot-configured default locale (BCP-47). Last fallback in ctx.locale's
|
|
339
|
+
* Request-Locale → Boot-Default chain (dispatch-shared.ts) — used when
|
|
340
|
+
* the request carries no X-Locale header and no usable Accept-Language.
|
|
341
|
+
* Absent falls back to "en". */
|
|
342
|
+
readonly defaultLocale?: string;
|
|
338
343
|
};
|
|
339
344
|
|
|
340
345
|
// Handler execution: db (tenant-scoped) + registry guaranteed.
|
|
@@ -561,6 +566,13 @@ export type HandlerContext<TMap extends object = KumikoEventTypeMap> = SharedCon
|
|
|
561
566
|
// back to tenant).
|
|
562
567
|
readonly tz: TzContext;
|
|
563
568
|
|
|
569
|
+
// Resolved request locale (BCP-47): X-Locale header → Accept-Language →
|
|
570
|
+
// the app's boot-configured defaultLocale → "en" (dispatch-shared.ts).
|
|
571
|
+
// Always a concrete tag, never optional — mirrors ctx.tz's Request →
|
|
572
|
+
// Boot-Default fallback chain, so handlers never need to check for
|
|
573
|
+
// absence before using it.
|
|
574
|
+
readonly locale: string;
|
|
575
|
+
|
|
564
576
|
// Resolve every registered r.authClaims() hook against `user` and return
|
|
565
577
|
// the merged claim record (keys auto-prefixed with the feature name). Used
|
|
566
578
|
// by login + switch-tenant write-handlers to populate SessionUser.claims
|
package/src/screen.ts
CHANGED
|
@@ -25,6 +25,14 @@ export type PlatformComponent = {
|
|
|
25
25
|
readonly native?: unknown;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
// Closed set of unit identifiers for `{ format: "unit" }` (no bare `string`
|
|
29
|
+
// per house convention). "m2" has no ECMA-402 sanctioned unit — Intl throws
|
|
30
|
+
// RangeError for "square-meter" — so kumiko-headless's applyFormatSpec
|
|
31
|
+
// formats it as a locale-formatted number with a literal "m²" suffix. The
|
|
32
|
+
// rest map to a CLDR-sanctioned Intl.NumberFormat unit id and get
|
|
33
|
+
// locale-correct pluralization/spacing straight from Intl.
|
|
34
|
+
export type UnitKey = "m2" | "km" | "m" | "kg" | "percent";
|
|
35
|
+
|
|
28
36
|
// Built-in value formatters. Apps extend via module augmentation:
|
|
29
37
|
// declare module "@cosmicdrift/kumiko-framework/engine/types" {
|
|
30
38
|
// interface FieldFormatRegistry { myFormat: { myOption?: string } }
|
|
@@ -47,6 +55,11 @@ export interface FieldFormatRegistry {
|
|
|
47
55
|
number: { readonly locale?: string };
|
|
48
56
|
decimal: { readonly locale?: string };
|
|
49
57
|
bigInt: { readonly locale?: string };
|
|
58
|
+
unit: {
|
|
59
|
+
readonly unit: UnitKey;
|
|
60
|
+
readonly locale?: string;
|
|
61
|
+
readonly unitDisplay?: "long" | "short" | "narrow";
|
|
62
|
+
};
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
// Discriminated union derived from the registry — one variant per key.
|