jsafa-pdf 0.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.
@@ -0,0 +1,27 @@
1
+ /** Text flow direction of a single visual run. */
2
+ export type Direction = 'ltr' | 'rtl';
3
+ /** A rectangle in CSS pixel space, relative to the viewport. */
4
+ export interface Rect {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ }
10
+ /**
11
+ * A single visually-contiguous run of text, as the browser actually laid it out.
12
+ *
13
+ * A run never spans a line break, and never spans a bidi direction change — so
14
+ * `text` can be shaped and painted as one unit at `rect`.
15
+ */
16
+ export interface TextRun {
17
+ /** Logical-order source text for this run. */
18
+ text: string;
19
+ /** Where the browser put it, in CSS px. */
20
+ rect: Rect;
21
+ /** Visual direction, derived from how the glyph rects advance. */
22
+ direction: Direction;
23
+ /** Index of the line box within the originating text node, 0-based. */
24
+ line: number;
25
+ /** The element whose computed style governs this run. */
26
+ source: Element;
27
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "jsafa-pdf",
3
+ "version": "0.1.1",
4
+ "description": "Client-side HTML/CSS to PDF with real, selectable text. No server, no rasterization.",
5
+ "type": "module",
6
+ "main": "./dist/jsafa-pdf.umd.js",
7
+ "module": "./dist/jsafa-pdf.js",
8
+ "types": "./dist/index.d.ts",
9
+ "unpkg": "./dist/jsafa-pdf.umd.js",
10
+ "jsdelivr": "./dist/jsafa-pdf.umd.js",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/jsafa-pdf.js",
15
+ "require": "./dist/jsafa-pdf.umd.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "author": "Safwan Murad",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Safwan-Murad/jsafa-pdf.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/Safwan-Murad/jsafa-pdf/issues"
28
+ },
29
+ "homepage": "https://github.com/Safwan-Murad/jsafa-pdf#readme",
30
+ "scripts": {
31
+ "build": "vite build && tsc --emitDeclarationOnly",
32
+ "// prepublishOnly": "dist/ is gitignored, so a fresh clone would otherwise publish a stale or empty package",
33
+ "prepublishOnly": "npm run typecheck && npm run build",
34
+ "dev": "vite",
35
+ "example": "node scripts/serve.mjs",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest",
38
+ "typecheck": "tsc --noEmit"
39
+ },
40
+ "keywords": [
41
+ "pdf",
42
+ "html-to-pdf",
43
+ "client-side",
44
+ "vector",
45
+ "selectable-text",
46
+ "arabic",
47
+ "rtl"
48
+ ],
49
+ "license": "MIT",
50
+ "engines": {
51
+ "node": ">=20"
52
+ },
53
+ "dependencies": {
54
+ "@pdf-lib/fontkit": "^1.1.1",
55
+ "pdf-lib": "^1.17.1"
56
+ },
57
+ "devDependencies": {
58
+ "@vitest/browser": "^4.1.10",
59
+ "@vitest/browser-playwright": "^4.1.10",
60
+ "pdfjs-dist": "^6.1.200",
61
+ "playwright": "^1.62.0",
62
+ "typescript": "^5.4.0",
63
+ "vite": "^6.4.3",
64
+ "vitest": "^4.1.10"
65
+ }
66
+ }