@cantoo/fontkit 2.0.6 → 2.0.7
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/dist/browser-module.d.ts +239 -0
- package/dist/browser.d.ts +239 -0
- package/dist/fontkit.umd.d.ts +239 -0
- package/dist/fontkit.umd.js +22076 -0
- package/dist/fontkit.umd.js.map +7 -0
- package/dist/index.d.ts +239 -0
- package/dist/main.d.ts +239 -0
- package/dist/module.d.ts +239 -0
- package/package.json +20 -5
- package/types/assets.d.ts +13 -0
- package/types/deps.d.ts +83 -0
- package/types/fontkit.d.ts +1324 -0
- package/types/index.d.ts +239 -0
- package/types/restructure.d.ts +354 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cantoo/fontkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "An advanced font engine for Node and the browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opentype",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"trie:indic": "node src/opentype/shapers/gen-indic.js",
|
|
19
19
|
"tries": "npm run trie:data && npm run trie:use && npm run trie:indic",
|
|
20
20
|
"build:packages": "node scripts/build-unicode-packages.js",
|
|
21
|
-
"build": "
|
|
21
|
+
"build:types": "node scripts/build-types.js",
|
|
22
|
+
"build:umd": "node scripts/build-umd.js",
|
|
23
|
+
"build": "npm run build:packages && tsup && npm run build:umd && npm run build:types",
|
|
22
24
|
"prebuild": "node --input-type=module -e \"import fs from 'node:fs'; if (!fs.existsSync('src/opentype/shapers/data.trie')) { console.error('Missing trie files. Run: npm run tries'); process.exit(1); }\"",
|
|
23
25
|
"lint": "eslint .",
|
|
24
26
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
@@ -33,15 +35,27 @@
|
|
|
33
35
|
"node-module": "dist/module.mjs",
|
|
34
36
|
"browser": "dist/browser.cjs",
|
|
35
37
|
"module": "dist/browser-module.mjs",
|
|
38
|
+
"unpkg": "dist/fontkit.umd.js",
|
|
39
|
+
"jsdelivr": "dist/fontkit.umd.js",
|
|
40
|
+
"types": "dist/index.d.ts",
|
|
36
41
|
"source": "src/index.js",
|
|
37
42
|
"exports": {
|
|
38
43
|
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
39
45
|
"node": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
40
47
|
"import": "./dist/module.mjs",
|
|
41
48
|
"require": "./dist/main.cjs"
|
|
42
49
|
},
|
|
43
|
-
"import":
|
|
44
|
-
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
52
|
+
"default": "./dist/browser-module.mjs"
|
|
53
|
+
},
|
|
54
|
+
"require": {
|
|
55
|
+
"types": "./dist/index.d.ts",
|
|
56
|
+
"default": "./dist/browser.cjs"
|
|
57
|
+
},
|
|
58
|
+
"default": "./dist/browser-module.mjs"
|
|
45
59
|
},
|
|
46
60
|
"./unicode-trie": {
|
|
47
61
|
"import": "./src/packages/unicode-trie/dist/index.mjs",
|
|
@@ -59,7 +73,8 @@
|
|
|
59
73
|
},
|
|
60
74
|
"files": [
|
|
61
75
|
"src",
|
|
62
|
-
"dist"
|
|
76
|
+
"dist",
|
|
77
|
+
"types"
|
|
63
78
|
],
|
|
64
79
|
"author": "Devon Govett <devongovett@gmail.com>",
|
|
65
80
|
"license": "MIT",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `.trie` assets are loaded as base64 strings (see tsup `loader: { '.trie': 'base64' }`
|
|
3
|
+
* and vitest `trie-base64` plugin), then passed to `decodeBase64`.
|
|
4
|
+
*/
|
|
5
|
+
declare module '*.trie' {
|
|
6
|
+
const data: string;
|
|
7
|
+
export default data;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module '*.json' {
|
|
11
|
+
const value: unknown;
|
|
12
|
+
export default value;
|
|
13
|
+
}
|
package/types/deps.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Node Buffer surface used by unicode-trie / unicode-properties.
|
|
3
|
+
* Avoids pulling the full `@types/node` lib into checkJs.
|
|
4
|
+
*/
|
|
5
|
+
interface Buffer extends Uint8Array {
|
|
6
|
+
readUInt32LE(offset?: number): number;
|
|
7
|
+
readUInt32BE(offset?: number): number;
|
|
8
|
+
writeUInt32LE(value: number, offset?: number): number;
|
|
9
|
+
writeUInt32BE(value: number, offset?: number): number;
|
|
10
|
+
slice(start?: number, end?: number): Buffer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const Buffer: {
|
|
14
|
+
alloc(size: number, fill?: string | number | Uint8Array, encoding?: string): Buffer;
|
|
15
|
+
from(arrayBuffer: ArrayBufferLike, byteOffset?: number, length?: number): Buffer;
|
|
16
|
+
from(data: Uint8Array | readonly number[]): Buffer;
|
|
17
|
+
from(str: string, encoding?: string): Buffer;
|
|
18
|
+
isBuffer(obj: unknown): obj is Buffer;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare module 'brotli/decompress.js' {
|
|
22
|
+
/**
|
|
23
|
+
* Decompress a brotli-compressed buffer.
|
|
24
|
+
* @param buffer Compressed input
|
|
25
|
+
* @param outputSize Expected decompressed size
|
|
26
|
+
*/
|
|
27
|
+
export default function decompress(buffer: Uint8Array, outputSize?: number): Uint8Array | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module 'clone' {
|
|
31
|
+
/**
|
|
32
|
+
* Deep-clone a value.
|
|
33
|
+
*/
|
|
34
|
+
export default function cloneDeep<T>(value: T): T;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare module 'dfa' {
|
|
38
|
+
/**
|
|
39
|
+
* Compiled DFA payload (from `dfa/compile`). Matches runtime `node_modules/dfa`:
|
|
40
|
+
* `{ stateTable, accepting, tags }` — not a named `{ start, states }` graph.
|
|
41
|
+
*
|
|
42
|
+
* Callers may pass a wider object that also carries app data (e.g. USE
|
|
43
|
+
* `categories` / `decompositions`); only these three fields are read.
|
|
44
|
+
*/
|
|
45
|
+
export interface StateMachineDefinition {
|
|
46
|
+
stateTable: number[][];
|
|
47
|
+
accepting: boolean[];
|
|
48
|
+
tags: string[][];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Match yield: `[startIndex, endIndex, tags]` (inclusive end). */
|
|
52
|
+
export type StateMachineMatch = [start: number, end: number, tags: string[]];
|
|
53
|
+
|
|
54
|
+
export default class StateMachine {
|
|
55
|
+
stateTable: number[][];
|
|
56
|
+
accepting: boolean[];
|
|
57
|
+
tags: string[][];
|
|
58
|
+
constructor(definition: StateMachineDefinition);
|
|
59
|
+
/**
|
|
60
|
+
* Iterable matches over an indexed sequence (`length` + numeric index).
|
|
61
|
+
* Strings and number arrays both work at runtime.
|
|
62
|
+
* Indic/USE pass numeric category arrays; other callers may pass strings.
|
|
63
|
+
*/
|
|
64
|
+
match(input: ArrayLike<string | number>): Iterable<StateMachineMatch>;
|
|
65
|
+
apply(
|
|
66
|
+
input: ArrayLike<string | number>,
|
|
67
|
+
actions: Record<
|
|
68
|
+
string,
|
|
69
|
+
(start: number, end: number, slice: ArrayLike<string | number>) => void
|
|
70
|
+
>
|
|
71
|
+
): void;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare module 'fast-deep-equal' {
|
|
76
|
+
export default function equal(a: unknown, b: unknown): boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare module 'fflate' {
|
|
80
|
+
export function inflateSync(data: Uint8Array, opts?: { out?: Uint8Array }): Uint8Array;
|
|
81
|
+
export function unzlibSync(data: Uint8Array, opts?: { out?: Uint8Array }): Uint8Array;
|
|
82
|
+
export function deflateSync(data: Uint8Array, opts?: { level?: number }): Uint8Array;
|
|
83
|
+
}
|