anthropic-fonts 1.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.
package/index.js ADDED
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Anthropic Fonts - NPM Package
3
+ * Production-ready custom font CDN system
4
+ *
5
+ * Usage:
6
+ * const AnthropicFonts = require('anthropic-fonts');
7
+ * // or
8
+ * import AnthropicFonts from 'anthropic-fonts';
9
+ */
10
+
11
+ export default {
12
+ // CDN URLs
13
+ cdn: {
14
+ // Main CSS files
15
+ all: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.css',
16
+ allMin: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.min.css',
17
+ allIE: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all-ie.css',
18
+ advanced: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/advanced.css',
19
+
20
+ // Individual font families
21
+ sans: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicsans.css',
22
+ serif: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicserif.css',
23
+ mono: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicmono.css',
24
+ },
25
+
26
+ // Font families
27
+ fonts: {
28
+ sans: 'Anthropic Sans',
29
+ serif: 'Anthropic Serif',
30
+ mono: 'Anthropic Mono',
31
+ },
32
+
33
+ // Available weights
34
+ weights: {
35
+ sans: [300, 400, 500, 600, 700, 800, 900],
36
+ serif: [300, 400, 500, 600, 700, 800, 900],
37
+ mono: [400],
38
+ },
39
+
40
+ // Generate HTML link tag
41
+ getLinkTag: (variant = 'all') => {
42
+ const urls = {
43
+ all: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.css',
44
+ allMin: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.min.css',
45
+ sans: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicsans.css',
46
+ serif: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicserif.css',
47
+ mono: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicmono.css',
48
+ };
49
+
50
+ const url = urls[variant] || urls.all;
51
+ return `<link rel="stylesheet" href="${url}">`;
52
+ },
53
+
54
+ // Generate CSS import
55
+ getImport: (variant = 'all') => {
56
+ const urls = {
57
+ all: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.css',
58
+ allMin: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.min.css',
59
+ sans: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicsans.css',
60
+ serif: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicserif.css',
61
+ mono: 'https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/anthropicmono.css',
62
+ };
63
+
64
+ const url = urls[variant] || urls.all;
65
+ return `@import url('${url}');`;
66
+ },
67
+
68
+ // Get individual font URL
69
+ getFontUrl: (family = 'sans', weight = 400) => {
70
+ const familyMap = {
71
+ 'sans': 'AnthropicSans',
72
+ 'serif': 'AnthropicSerif',
73
+ 'mono': 'AnthropicMono',
74
+ 'AnthropicSans': 'AnthropicSans',
75
+ 'AnthropicSerif': 'AnthropicSerif',
76
+ 'AnthropicMono': 'AnthropicMono',
77
+ };
78
+
79
+ const fontFamily = familyMap[family];
80
+ if (!fontFamily) {
81
+ throw new Error(`Unknown font family: ${family}. Available: sans, serif, mono`);
82
+ }
83
+
84
+ return `https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/fonts/${fontFamily}@${weight}.woff2`;
85
+ },
86
+
87
+ // Get repository information
88
+ repo: {
89
+ url: 'https://github.com/devchauhann/fonts',
90
+ issues: 'https://github.com/devchauhann/fonts/issues',
91
+ docs: 'https://github.com/devchauhann/fonts#readme',
92
+ },
93
+
94
+ // Version info
95
+ version: '1.1.0',
96
+
97
+ // Get quick setup instructions
98
+ getSetup: () => `
99
+ # Anthropic Fonts - Quick Setup
100
+
101
+ ## Installation
102
+ \`\`\`bash
103
+ npm install anthropic-fonts
104
+ \`\`\`
105
+
106
+ ## Usage
107
+
108
+ ### Option 1: HTML Link
109
+ \`\`\`html
110
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.css">
111
+
112
+ <h1 style="font-family: 'Anthropic Sans'">Hello World</h1>
113
+ \`\`\`
114
+
115
+ ### Option 2: CSS Import
116
+ \`\`\`css
117
+ @import url('https://cdn.jsdelivr.net/gh/devchauhann/fonts@v1.1.0/cdn/v1/css/all.css');
118
+
119
+ body {
120
+ font-family: 'Anthropic Sans', sans-serif;
121
+ }
122
+ \`\`\`
123
+
124
+ ### Option 3: JavaScript
125
+ \`\`\`javascript
126
+ import AnthropicFonts from 'anthropic-fonts';
127
+
128
+ // Get HTML link tag
129
+ document.head.insertAdjacentHTML('beforeend', AnthropicFonts.getLinkTag('all'));
130
+
131
+ // Or use CSS import
132
+ const style = document.createElement('style');
133
+ style.textContent = AnthropicFonts.getImport('sans');
134
+ document.head.appendChild(style);
135
+
136
+ // Get specific font URL
137
+ const sansUrl = AnthropicFonts.getFontUrl('sans', 700);
138
+ console.log(sansUrl);
139
+ \`\`\`
140
+
141
+ ## Font Families
142
+ - **Anthropic Sans** - Clean, modern sans-serif (weights: 300-900)
143
+ - **Anthropic Serif** - Elegant serif typeface (weights: 300-900)
144
+ - **Anthropic Mono** - Monospaced font (weight: 400)
145
+
146
+ ## Documentation
147
+ Visit: ${this.repo.url}
148
+ `,
149
+ };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "anthropic-fonts",
3
+ "version": "1.1.0",
4
+ "description": "Production-ready open-source font CDN system with Anthropic Sans, Serif, and Mono typefaces",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "fonts:process": "node scripts/process-fonts.js",
9
+ "fonts:css": "node scripts/generate-css.js",
10
+ "fonts:validate": "node scripts/validate.js",
11
+ "dev": "node api/server.js",
12
+ "build": "npm run fonts:process && npm run fonts:css",
13
+ "test": "node scripts/validate.js && echo 'All tests passed!'",
14
+ "lint": "echo 'Linting...'",
15
+ "preinstall": "echo 'Installing Anthropic Fonts CDN...'"
16
+ },
17
+ "keywords": [
18
+ "fonts",
19
+ "cdn",
20
+ "web-fonts",
21
+ "woff2",
22
+ "typography",
23
+ "self-hosted",
24
+ "anthropic",
25
+ "typeface",
26
+ "sans-serif",
27
+ "serif",
28
+ "monospace",
29
+ "font-library"
30
+ ],
31
+ "author": "Dev Chauhan",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/devchauhann/fonts.git"
36
+ },
37
+ "homepage": "https://github.com/devchauhann/fonts#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/devchauhann/fonts/issues"
40
+ },
41
+ "files": [
42
+ "index.js",
43
+ "cdn/",
44
+ "docs/",
45
+ "README.md",
46
+ "LICENSE",
47
+ "CHANGELOG.md"
48
+ ],
49
+ "dependencies": {
50
+ "express": "^4.18.2",
51
+ "cors": "^2.8.5",
52
+ "compression": "^1.7.4",
53
+ "dotenv": "^16.3.1",
54
+ "fs-extra": "^11.1.1"
55
+ },
56
+ "devDependencies": {},
57
+ "engines": {
58
+ "node": "=24.14.1",
59
+ "npm": "=11.11.0"
60
+ }
61
+ }