@road-signs/core 0.0.0-stage → 0.1.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.
@@ -0,0 +1,7 @@
1
+ import type { Sign } from './types';
2
+ export type { Sign, SignAssets, ViennaCategory, ViennaSign } from './types';
3
+ export declare const getAllSigns: <T extends Sign>(registry: readonly T[]) => T[];
4
+ export declare const getSign: <T extends Sign>(registry: readonly T[], id: string) => T | undefined;
5
+ export declare const getSignByCode: <T extends Sign>(registry: readonly T[], code: string) => T | undefined;
6
+ export declare const getSignsByCategory: <T extends Sign>(registry: readonly T[], category: T['category']) => T[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5E,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,KAAG,CAAC,EAAmB,CAAC;AAE1F,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,CAAC,GAAG,SAC9C,CAAC;AAEpC,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,QAAQ,MAAM,KAAG,CAAC,GAAG,SAClD,CAAC;AAExC,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,IAAI,YACrC,SAAS,CAAC,EAAE,YACZ,CAAC,CAAC,UAAU,CAAC,KACtB,CAAC,EAAqD,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSignsByCategory = exports.getSignByCode = exports.getSign = exports.getAllSigns = void 0;
4
+ const getAllSigns = (registry) => [...registry];
5
+ exports.getAllSigns = getAllSigns;
6
+ const getSign = (registry, id) => registry.find((s) => s.id === id);
7
+ exports.getSign = getSign;
8
+ const getSignByCode = (registry, code) => registry.find((s) => s.code === code);
9
+ exports.getSignByCode = getSignByCode;
10
+ const getSignsByCategory = (registry, category) => registry.filter((s) => s.category === category);
11
+ exports.getSignsByCategory = getSignsByCategory;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIO,MAAM,WAAW,GAAG,CAAiB,QAAsB,EAAO,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;AAA7E,QAAA,WAAW,GAAX,WAAW,CAAkE;AAEnF,MAAM,OAAO,GAAG,CAAiB,QAAsB,EAAE,EAAU,EAAiB,EAAE,CAC3F,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AADvB,QAAA,OAAO,GAAP,OAAO,CACgB;AAE7B,MAAM,aAAa,GAAG,CAAiB,QAAsB,EAAE,IAAY,EAAiB,EAAE,CACnG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAD3B,QAAA,aAAa,GAAb,aAAa,CACc;AAEjC,MAAM,kBAAkB,GAAG,CAChC,QAAsB,EACtB,QAAuB,EAClB,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAH7C,QAAA,kBAAkB,GAAlB,kBAAkB,CAG2B"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,31 @@
1
+ export interface SignAssets {
2
+ jpg: Record<number, string>;
3
+ png: Record<number, string>;
4
+ /** Relative path to the SVG source file. Absent for PDF-extracted (PNG-only) signs. */
5
+ svg?: string;
6
+ webp: Record<number, string>;
7
+ }
8
+ /**
9
+ * A single road sign. TCategory is narrowed per country package
10
+ * (e.g. USCategory = 'warning' | 'regulatory' | ...).
11
+ */
12
+ export interface Sign<TCategory extends string = string> {
13
+ assets: SignAssets;
14
+ category: TCategory;
15
+ /** Official sign code, e.g. "W1-1" (US), "670" (UK). */
16
+ code: string;
17
+ description: string;
18
+ /** Slug ID, e.g. "w1-1-turn". */
19
+ id: string;
20
+ name: string;
21
+ /** Inline SVG string, SVGO-optimised. Absent for PDF-extracted (PNG-only) signs. */
22
+ svg?: string;
23
+ }
24
+ /**
25
+ * Standard five-category taxonomy shared by Vienna Convention countries.
26
+ * Used by: AT, BE, CH, CZ, DE, DK, ES, FI, FR, GR, HR, HU, IE, IS, IT,
27
+ * LI, LT, LV, ME, MT, NL, NO, PL, PT, RO, RS, SE, SI, SK, TR…
28
+ */
29
+ export type ViennaCategory = 'information' | 'mandatory' | 'priority' | 'prohibitory' | 'warning';
30
+ export type ViennaSign = Sign<ViennaCategory>;
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,uFAAuF;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IACrD,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,WAAW,GACX,UAAU,GACV,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { Sign } from './types';
2
+ export type { Sign, SignAssets, ViennaCategory, ViennaSign } from './types';
3
+ export declare const getAllSigns: <T extends Sign>(registry: readonly T[]) => T[];
4
+ export declare const getSign: <T extends Sign>(registry: readonly T[], id: string) => T | undefined;
5
+ export declare const getSignByCode: <T extends Sign>(registry: readonly T[], code: string) => T | undefined;
6
+ export declare const getSignsByCategory: <T extends Sign>(registry: readonly T[], category: T['category']) => T[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5E,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,KAAG,CAAC,EAAmB,CAAC;AAE1F,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,CAAC,GAAG,SAC9C,CAAC;AAEpC,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,QAAQ,MAAM,KAAG,CAAC,GAAG,SAClD,CAAC;AAExC,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,IAAI,YACrC,SAAS,CAAC,EAAE,YACZ,CAAC,CAAC,UAAU,CAAC,KACtB,CAAC,EAAqD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const getAllSigns = (registry) => [...registry];
2
+ export const getSign = (registry, id) => registry.find((s) => s.id === id);
3
+ export const getSignByCode = (registry, code) => registry.find((s) => s.code === code);
4
+ export const getSignsByCategory = (registry, category) => registry.filter((s) => s.category === category);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAiB,QAAsB,EAAO,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAiB,QAAsB,EAAE,EAAU,EAAiB,EAAE,CAC3F,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAiB,QAAsB,EAAE,IAAY,EAAiB,EAAE,CACnG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,QAAsB,EACtB,QAAuB,EAClB,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,31 @@
1
+ export interface SignAssets {
2
+ jpg: Record<number, string>;
3
+ png: Record<number, string>;
4
+ /** Relative path to the SVG source file. Absent for PDF-extracted (PNG-only) signs. */
5
+ svg?: string;
6
+ webp: Record<number, string>;
7
+ }
8
+ /**
9
+ * A single road sign. TCategory is narrowed per country package
10
+ * (e.g. USCategory = 'warning' | 'regulatory' | ...).
11
+ */
12
+ export interface Sign<TCategory extends string = string> {
13
+ assets: SignAssets;
14
+ category: TCategory;
15
+ /** Official sign code, e.g. "W1-1" (US), "670" (UK). */
16
+ code: string;
17
+ description: string;
18
+ /** Slug ID, e.g. "w1-1-turn". */
19
+ id: string;
20
+ name: string;
21
+ /** Inline SVG string, SVGO-optimised. Absent for PDF-extracted (PNG-only) signs. */
22
+ svg?: string;
23
+ }
24
+ /**
25
+ * Standard five-category taxonomy shared by Vienna Convention countries.
26
+ * Used by: AT, BE, CH, CZ, DE, DK, ES, FI, FR, GR, HR, HU, IE, IS, IT,
27
+ * LI, LT, LV, ME, MT, NL, NO, PL, PT, RO, RS, SE, SI, SK, TR…
28
+ */
29
+ export type ViennaCategory = 'information' | 'mandatory' | 'priority' | 'prohibitory' | 'warning';
30
+ export type ViennaSign = Sign<ViennaCategory>;
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,uFAAuF;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IACrD,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,WAAW,GACX,UAAU,GACV,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@road-signs/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Shared TypeScript types and generic lookup helpers for road sign packages",
5
+ "keywords": [
6
+ "road-signs",
7
+ "svg",
8
+ "typescript"
9
+ ],
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/karlnorling/road-signs",
14
+ "directory": "packages/@road-signs/core"
15
+ },
16
+ "files": [
17
+ "dist/",
18
+ "package.json",
19
+ "README.md"
20
+ ],
21
+ "main": "./dist/cjs/index.js",
22
+ "module": "./dist/esm/index.js",
23
+ "types": "./dist/esm/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./dist/esm/index.js",
27
+ "require": "./dist/cjs/index.js",
28
+ "types": "./dist/esm/index.d.ts"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "compile": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type:'commonjs'})); require('fs').writeFileSync('dist/esm/package.json', JSON.stringify({type:'module'}))\"",
33
+ "test": "jest --passWithNoTests",
34
+ "type-check": "tsc --noEmit -p tsconfig.cjs.json"
35
+ },
36
+ "devDependencies": {
37
+ "@types/jest": "^30.0.0",
38
+ "@typescript/native": "npm:typescript@^7.0.2",
39
+ "jest": "^30.5.2",
40
+ "ts-jest": "^29.4.15",
41
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
42
+ },
43
+ "author": {
44
+ "name": "Karl Norling",
45
+ "url": "https://github.com/karlnorling"
46
+ }
6
47
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.