@d3plus/locales 3.0.16 → 3.1.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/package.json CHANGED
@@ -1,18 +1,25 @@
1
1
  {
2
2
  "name": "@d3plus/locales",
3
- "version": "3.0.16",
3
+ "version": "3.1.1",
4
4
  "description": "International localizations for number, date, and UI labels.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "exports": "./es/index.js",
7
+ "types": "./types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./types/index.d.ts",
11
+ "default": "./es/index.js"
12
+ }
13
+ },
8
14
  "browser": "./umd/d3plus-locales.full.js",
9
15
  "engines": {
10
- "node": ">=18"
16
+ "node": ">=20"
11
17
  },
12
18
  "sideEffects": false,
13
19
  "files": [
14
20
  "umd",
15
- "es"
21
+ "es",
22
+ "types"
16
23
  ],
17
24
  "homepage": "https://d3plus.org",
18
25
  "repository": {
@@ -29,8 +36,10 @@
29
36
  ],
30
37
  "scripts": {
31
38
  "build:esm": "node ../../scripts/build-esm.js",
39
+ "build:types": "tsc",
32
40
  "build:umd": "node ../../scripts/build-umd.js",
33
41
  "dev": "node ../../scripts/dev.js",
34
- "test": "eslint index.js src/**/*.js && eslint --global=it test && mocha 'test/**/*-test.js'"
42
+ "test": "eslint index.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'",
43
+ "test:coverage": "c8 -r text -r lcov --src src mocha 'test/**/*-test.js'"
35
44
  }
36
45
  }
@@ -0,0 +1,7 @@
1
+ export { default as translateLocale } from "./src/dictionaries/translateLocale.js";
2
+ export { default as formatLocale } from "./src/dictionaries/formatLocale.js";
3
+ export { default as locale } from "./src/dictionaries/timeLocale.js";
4
+ export { default as findLocale } from "./src/findLocale.js";
5
+ export type { TranslationStrings } from "./src/dictionaries/translateLocale.js";
6
+ export type { FormatLocaleDefinition } from "./src/dictionaries/formatLocale.js";
7
+ export type { TimeLocaleDefinition } from "./src/dictionaries/timeLocale.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ @namespace {Object} formatLocale
3
+ A set of default locale formatters used when assigning suffixes and currency in numbers.
4
+ */
5
+ export interface FormatLocaleDefinition {
6
+ separator?: string;
7
+ suffixes: string[];
8
+ grouping: number[];
9
+ delimiters: {
10
+ thousands: string;
11
+ decimal: string;
12
+ };
13
+ currency: [string, string];
14
+ }
15
+ declare const formatLocale: Record<string, FormatLocaleDefinition>;
16
+ export default formatLocale;
@@ -0,0 +1,39 @@
1
+ export interface TimeLocaleDefinition {
2
+ dateTime: string;
3
+ date: string;
4
+ time: string;
5
+ quarter: string;
6
+ periods: [string, string];
7
+ days: [string, string, string, string, string, string, string];
8
+ shortDays: [string, string, string, string, string, string, string];
9
+ months: [
10
+ string,
11
+ string,
12
+ string,
13
+ string,
14
+ string,
15
+ string,
16
+ string,
17
+ string,
18
+ string,
19
+ string,
20
+ string,
21
+ string
22
+ ];
23
+ shortMonths: [
24
+ string,
25
+ string,
26
+ string,
27
+ string,
28
+ string,
29
+ string,
30
+ string,
31
+ string,
32
+ string,
33
+ string,
34
+ string,
35
+ string
36
+ ];
37
+ }
38
+ declare const locale: Record<string, TimeLocaleDefinition>;
39
+ export default locale;
@@ -0,0 +1,21 @@
1
+ export interface TranslationStrings {
2
+ and: string;
3
+ Back: string;
4
+ "Click to Expand": string;
5
+ "Click to Hide": string;
6
+ "Click to Highlight": string;
7
+ "Click to Show": string;
8
+ "Click to Show All": string;
9
+ Download: string;
10
+ "Loading Visualization": string;
11
+ more: string;
12
+ "No Data Available": string;
13
+ "Powered by D3plus": string;
14
+ Share: string;
15
+ "Shift+Click to Hide": string;
16
+ "Shift+Click to Highlight": string;
17
+ Total: string;
18
+ Values: string;
19
+ }
20
+ declare const translateLocale: Record<string, TranslationStrings>;
21
+ export default translateLocale;
@@ -0,0 +1,5 @@
1
+ /**
2
+ Converts a 2-letter language code into a full language-region locale string (e.g., "en" to "en-US").
3
+ @param locale A 2-letter language code (e.g., "en", "fr").
4
+ */
5
+ export default function findLocale(locale: string): string;
@@ -0,0 +1,8 @@
1
+ export interface IsoCodeEntry {
2
+ name: string;
3
+ names: string[];
4
+ "iso639-2": string;
5
+ "iso639-1": string | null;
6
+ }
7
+ declare const isoCodes: Record<string, IsoCodeEntry>;
8
+ export default isoCodes;
@@ -0,0 +1,9 @@
1
+ export interface LookupEntry {
2
+ language: string;
3
+ location: string | null;
4
+ id: number;
5
+ tag: string;
6
+ version?: string;
7
+ }
8
+ declare const lookup: Record<string, LookupEntry>;
9
+ export default lookup;