@ogxjs/core 0.1.2 → 0.3.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/dist/cache/hash.d.ts +66 -0
- package/dist/cache/hash.d.ts.map +1 -0
- package/dist/cache/hash.js +161 -0
- package/dist/cache/index.d.ts +10 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +12 -0
- package/dist/cache/lru.d.ts +122 -0
- package/dist/cache/lru.d.ts.map +1 -0
- package/dist/cache/lru.js +269 -0
- package/dist/cache/snapshot.d.ts +116 -0
- package/dist/cache/snapshot.d.ts.map +1 -0
- package/dist/cache/snapshot.js +204 -0
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +2 -2
- package/dist/css.d.ts +19 -6
- package/dist/css.d.ts.map +1 -1
- package/dist/font-registry.d.ts +15 -0
- package/dist/font-registry.d.ts.map +1 -1
- package/dist/font-registry.js +19 -0
- package/dist/fonts.d.ts +21 -0
- package/dist/fonts.d.ts.map +1 -1
- package/dist/fonts.js +33 -0
- package/dist/index.d.ts +18 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -10
- package/dist/ogx.js +13 -13
- package/dist/perf/index.d.ts +8 -0
- package/dist/perf/index.d.ts.map +1 -0
- package/dist/perf/index.js +7 -0
- package/dist/perf/timing.d.ts +160 -0
- package/dist/perf/timing.d.ts.map +1 -0
- package/dist/perf/timing.js +305 -0
- package/dist/presets/blog.js +1 -1
- package/dist/presets/docs.d.ts +2 -0
- package/dist/presets/docs.d.ts.map +1 -1
- package/dist/presets/docs.js +26 -23
- package/dist/presets/minimal.d.ts +2 -0
- package/dist/presets/minimal.d.ts.map +1 -1
- package/dist/presets/minimal.js +8 -16
- package/dist/presets/social.d.ts +2 -0
- package/dist/presets/social.d.ts.map +1 -1
- package/dist/presets/social.js +28 -18
- package/dist/render-png.d.ts.map +1 -1
- package/dist/render-png.js +9 -1
- package/dist/render-svg.d.ts.map +1 -1
- package/dist/render-svg.js +11 -1
- package/dist/tailwind/class-cache.d.ts +141 -0
- package/dist/tailwind/class-cache.d.ts.map +1 -0
- package/dist/tailwind/class-cache.js +212 -0
- package/dist/tailwind/index.d.ts +14 -1
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +15 -1
- package/dist/tailwind/lookup-tables.d.ts +30 -0
- package/dist/tailwind/lookup-tables.d.ts.map +1 -0
- package/dist/tailwind/lookup-tables.js +427 -0
- package/dist/tailwind/parser-v2.d.ts +54 -0
- package/dist/tailwind/parser-v2.d.ts.map +1 -0
- package/dist/tailwind/parser-v2.js +250 -0
- package/dist/tailwind/parser.d.ts +1 -0
- package/dist/tailwind/parser.d.ts.map +1 -1
- package/dist/tailwind/parser.js +1 -0
- package/dist/tailwind/prefix-handlers.d.ts +68 -0
- package/dist/tailwind/prefix-handlers.d.ts.map +1 -0
- package/dist/tailwind/prefix-handlers.js +931 -0
- package/package.json +18 -5
- package/dist/fonts/inter/inter-300.ttf +0 -0
- package/dist/fonts/inter/inter-400.ttf +0 -0
- package/dist/fonts/inter/inter-500.ttf +0 -0
- package/dist/fonts/inter/inter-600.ttf +0 -0
- package/dist/fonts/inter/inter-700.ttf +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ogxjs/core - Snapshot Cache v2
|
|
3
|
+
* High-performance image cache with LRU eviction
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Refactored cache system for v0.2.0 "Turbo":
|
|
7
|
+
* - Uses fast sync hash (FNV-1a/xxHash) instead of SHA-256
|
|
8
|
+
* - LRU eviction instead of simple Map
|
|
9
|
+
* - Optional TTL support
|
|
10
|
+
* - Memory bounded
|
|
11
|
+
*
|
|
12
|
+
* @version 0.2.0 "Turbo"
|
|
13
|
+
*/
|
|
14
|
+
import { type LRUCacheStats } from "./lru";
|
|
15
|
+
export interface SnapshotCacheOptions {
|
|
16
|
+
/** Maximum number of cached images (default: 500) */
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
/** Time-to-live in milliseconds (default: 0 = no expiration) */
|
|
19
|
+
ttl?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SnapshotCacheStats extends LRUCacheStats {
|
|
22
|
+
/** Memory estimate in bytes */
|
|
23
|
+
memoryEstimate: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Cache for generated OG images
|
|
27
|
+
*
|
|
28
|
+
* Uses LRU eviction to bound memory usage.
|
|
29
|
+
* Keys are generated from config objects using fast hash.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const cache = new SnapshotCacheV2({ maxSize: 100, ttl: 60000 });
|
|
34
|
+
*
|
|
35
|
+
* const hash = cache.getHash(config);
|
|
36
|
+
* if (!cache.has(hash)) {
|
|
37
|
+
* const image = await render(element);
|
|
38
|
+
* cache.set(hash, image);
|
|
39
|
+
* }
|
|
40
|
+
* return cache.get(hash);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class SnapshotCacheV2 {
|
|
44
|
+
private cache;
|
|
45
|
+
private memoryEstimate;
|
|
46
|
+
constructor(options?: SnapshotCacheOptions);
|
|
47
|
+
/**
|
|
48
|
+
* Generate a hash key for a configuration object
|
|
49
|
+
* Uses fast sync hash (no await needed)
|
|
50
|
+
*/
|
|
51
|
+
getHash(config: unknown): string;
|
|
52
|
+
/**
|
|
53
|
+
* Get a cached image by hash
|
|
54
|
+
*/
|
|
55
|
+
get(hash: string): Uint8Array | string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a hash exists in cache
|
|
58
|
+
*/
|
|
59
|
+
has(hash: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Store an image in cache
|
|
62
|
+
*/
|
|
63
|
+
set(hash: string, data: Uint8Array | string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Delete a cached image
|
|
66
|
+
*/
|
|
67
|
+
delete(hash: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Clear the entire cache
|
|
70
|
+
*/
|
|
71
|
+
clear(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Get cache size
|
|
74
|
+
*/
|
|
75
|
+
get size(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Get cache statistics
|
|
78
|
+
*/
|
|
79
|
+
get stats(): SnapshotCacheStats;
|
|
80
|
+
/**
|
|
81
|
+
* Prune expired entries
|
|
82
|
+
*/
|
|
83
|
+
prune(): number;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use getHash() instead (sync, no await needed)
|
|
86
|
+
*/
|
|
87
|
+
getHashAsync(config: unknown): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Set cache TTL
|
|
90
|
+
* Note: Only affects new entries, not existing ones
|
|
91
|
+
*/
|
|
92
|
+
setTTL(_milliseconds: number): void;
|
|
93
|
+
}
|
|
94
|
+
export declare function getSnapshotCache(): SnapshotCacheV2;
|
|
95
|
+
/**
|
|
96
|
+
* Configure the global cache instance
|
|
97
|
+
* Must be called before any cache operations
|
|
98
|
+
*/
|
|
99
|
+
export declare function configureSnapshotCache(options: SnapshotCacheOptions): void;
|
|
100
|
+
/**
|
|
101
|
+
* Legacy export for backward compatibility
|
|
102
|
+
*/
|
|
103
|
+
export declare const snapshotCache: {
|
|
104
|
+
readonly instance: SnapshotCacheV2;
|
|
105
|
+
getHash(config: unknown): string;
|
|
106
|
+
getHashAsync(config: unknown): Promise<string>;
|
|
107
|
+
get(hash: string): Uint8Array | string | undefined;
|
|
108
|
+
has(hash: string): boolean;
|
|
109
|
+
set(hash: string, data: Uint8Array | string): void;
|
|
110
|
+
delete(hash: string): boolean;
|
|
111
|
+
clear(): void;
|
|
112
|
+
readonly size: number;
|
|
113
|
+
readonly stats: SnapshotCacheStats;
|
|
114
|
+
setTTL(ms: number): void;
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AAe,CAQlD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAE1E;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;oBAKT,OAAO,GAAG,MAAM;yBAIL,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;cAI1C,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS;cAIxC,MAAM,GAAG,OAAO;cAIhB,MAAM,QAAQ,UAAU,GAAG,MAAM,GAAG,IAAI;iBAIrC,MAAM,GAAG,OAAO;aAIpB,IAAI;mBAID,MAAM;oBAIL,kBAAkB;eAIpB,MAAM,GAAG,IAAI;CAGxB,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ogxjs/core - Snapshot Cache v2
|
|
3
|
+
* High-performance image cache with LRU eviction
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Refactored cache system for v0.2.0 "Turbo":
|
|
7
|
+
* - Uses fast sync hash (FNV-1a/xxHash) instead of SHA-256
|
|
8
|
+
* - LRU eviction instead of simple Map
|
|
9
|
+
* - Optional TTL support
|
|
10
|
+
* - Memory bounded
|
|
11
|
+
*
|
|
12
|
+
* @version 0.2.0 "Turbo"
|
|
13
|
+
*/
|
|
14
|
+
import { hashObject } from "./hash";
|
|
15
|
+
import { LRUCache } from "./lru";
|
|
16
|
+
// SNAPSHOT CACHE CLASS
|
|
17
|
+
/**
|
|
18
|
+
* Cache for generated OG images
|
|
19
|
+
*
|
|
20
|
+
* Uses LRU eviction to bound memory usage.
|
|
21
|
+
* Keys are generated from config objects using fast hash.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const cache = new SnapshotCacheV2({ maxSize: 100, ttl: 60000 });
|
|
26
|
+
*
|
|
27
|
+
* const hash = cache.getHash(config);
|
|
28
|
+
* if (!cache.has(hash)) {
|
|
29
|
+
* const image = await render(element);
|
|
30
|
+
* cache.set(hash, image);
|
|
31
|
+
* }
|
|
32
|
+
* return cache.get(hash);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export class SnapshotCacheV2 {
|
|
36
|
+
cache;
|
|
37
|
+
memoryEstimate = 0;
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.cache = new LRUCache({
|
|
40
|
+
maxSize: options.maxSize ?? 500,
|
|
41
|
+
ttl: options.ttl ?? 0,
|
|
42
|
+
onEvict: (_key, value) => {
|
|
43
|
+
// Update memory estimate on eviction
|
|
44
|
+
if (value instanceof Uint8Array) {
|
|
45
|
+
this.memoryEstimate -= value.byteLength;
|
|
46
|
+
}
|
|
47
|
+
else if (typeof value === "string") {
|
|
48
|
+
this.memoryEstimate -= value.length * 2; // UTF-16
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Generate a hash key for a configuration object
|
|
55
|
+
* Uses fast sync hash (no await needed)
|
|
56
|
+
*/
|
|
57
|
+
getHash(config) {
|
|
58
|
+
return hashObject(config);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get a cached image by hash
|
|
62
|
+
*/
|
|
63
|
+
get(hash) {
|
|
64
|
+
return this.cache.get(hash);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if a hash exists in cache
|
|
68
|
+
*/
|
|
69
|
+
has(hash) {
|
|
70
|
+
return this.cache.has(hash);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Store an image in cache
|
|
74
|
+
*/
|
|
75
|
+
set(hash, data) {
|
|
76
|
+
// Update memory estimate
|
|
77
|
+
if (data instanceof Uint8Array) {
|
|
78
|
+
this.memoryEstimate += data.byteLength;
|
|
79
|
+
}
|
|
80
|
+
else if (typeof data === "string") {
|
|
81
|
+
this.memoryEstimate += data.length * 2;
|
|
82
|
+
}
|
|
83
|
+
this.cache.set(hash, data);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Delete a cached image
|
|
87
|
+
*/
|
|
88
|
+
delete(hash) {
|
|
89
|
+
const existing = this.cache.get(hash);
|
|
90
|
+
if (existing) {
|
|
91
|
+
if (existing instanceof Uint8Array) {
|
|
92
|
+
this.memoryEstimate -= existing.byteLength;
|
|
93
|
+
}
|
|
94
|
+
else if (typeof existing === "string") {
|
|
95
|
+
this.memoryEstimate -= existing.length * 2;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return this.cache.delete(hash);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Clear the entire cache
|
|
102
|
+
*/
|
|
103
|
+
clear() {
|
|
104
|
+
this.cache.clear();
|
|
105
|
+
this.memoryEstimate = 0;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get cache size
|
|
109
|
+
*/
|
|
110
|
+
get size() {
|
|
111
|
+
return this.cache.size;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get cache statistics
|
|
115
|
+
*/
|
|
116
|
+
get stats() {
|
|
117
|
+
return {
|
|
118
|
+
...this.cache.stats,
|
|
119
|
+
memoryEstimate: this.memoryEstimate,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Prune expired entries
|
|
124
|
+
*/
|
|
125
|
+
prune() {
|
|
126
|
+
return this.cache.prune();
|
|
127
|
+
}
|
|
128
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
129
|
+
// LEGACY COMPATIBILITY
|
|
130
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated Use getHash() instead (sync, no await needed)
|
|
133
|
+
*/
|
|
134
|
+
async getHashAsync(config) {
|
|
135
|
+
return this.getHash(config);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Set cache TTL
|
|
139
|
+
* Note: Only affects new entries, not existing ones
|
|
140
|
+
*/
|
|
141
|
+
setTTL(_milliseconds) {
|
|
142
|
+
console.warn("SnapshotCacheV2.setTTL() is deprecated. Pass ttl in constructor options.");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// SINGLETON INSTANCE
|
|
146
|
+
/**
|
|
147
|
+
* Global singleton cache instance
|
|
148
|
+
* Configured with sensible defaults
|
|
149
|
+
*/
|
|
150
|
+
let _instance = null;
|
|
151
|
+
export function getSnapshotCache() {
|
|
152
|
+
if (!_instance) {
|
|
153
|
+
_instance = new SnapshotCacheV2({
|
|
154
|
+
maxSize: 500,
|
|
155
|
+
ttl: 0, // No expiration by default
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return _instance;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Configure the global cache instance
|
|
162
|
+
* Must be called before any cache operations
|
|
163
|
+
*/
|
|
164
|
+
export function configureSnapshotCache(options) {
|
|
165
|
+
_instance = new SnapshotCacheV2(options);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Legacy export for backward compatibility
|
|
169
|
+
*/
|
|
170
|
+
export const snapshotCache = {
|
|
171
|
+
get instance() {
|
|
172
|
+
return getSnapshotCache();
|
|
173
|
+
},
|
|
174
|
+
getHash(config) {
|
|
175
|
+
return getSnapshotCache().getHash(config);
|
|
176
|
+
},
|
|
177
|
+
async getHashAsync(config) {
|
|
178
|
+
return getSnapshotCache().getHash(config);
|
|
179
|
+
},
|
|
180
|
+
get(hash) {
|
|
181
|
+
return getSnapshotCache().get(hash);
|
|
182
|
+
},
|
|
183
|
+
has(hash) {
|
|
184
|
+
return getSnapshotCache().has(hash);
|
|
185
|
+
},
|
|
186
|
+
set(hash, data) {
|
|
187
|
+
getSnapshotCache().set(hash, data);
|
|
188
|
+
},
|
|
189
|
+
delete(hash) {
|
|
190
|
+
return getSnapshotCache().delete(hash);
|
|
191
|
+
},
|
|
192
|
+
clear() {
|
|
193
|
+
getSnapshotCache().clear();
|
|
194
|
+
},
|
|
195
|
+
get size() {
|
|
196
|
+
return getSnapshotCache().size;
|
|
197
|
+
},
|
|
198
|
+
get stats() {
|
|
199
|
+
return getSnapshotCache().stats;
|
|
200
|
+
},
|
|
201
|
+
setTTL(ms) {
|
|
202
|
+
getSnapshotCache().setTTL(ms);
|
|
203
|
+
},
|
|
204
|
+
};
|
package/dist/cache.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare class SnapshotCache {
|
|
|
21
21
|
*/
|
|
22
22
|
getHashAsync(config: any): Promise<string>;
|
|
23
23
|
/**
|
|
24
|
-
* Calculate a hash for a configuration object (sync
|
|
24
|
+
* Calculate a hash for a configuration object (sync)
|
|
25
25
|
* Uses djb2 algorithm - fast but has higher collision probability
|
|
26
|
-
*
|
|
26
|
+
* Note: Cache v2 uses FNV-1a (fnv1a/fastHash) for better performance
|
|
27
27
|
*/
|
|
28
28
|
getHash(config: any): string;
|
|
29
29
|
/**
|
package/dist/cache.js
CHANGED
|
@@ -50,9 +50,9 @@ export class SnapshotCache {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Calculate a hash for a configuration object (sync
|
|
53
|
+
* Calculate a hash for a configuration object (sync)
|
|
54
54
|
* Uses djb2 algorithm - fast but has higher collision probability
|
|
55
|
-
*
|
|
55
|
+
* Note: Cache v2 uses FNV-1a (fnv1a/fastHash) for better performance
|
|
56
56
|
*/
|
|
57
57
|
getHash(config) {
|
|
58
58
|
const str = this.serializeConfig(config);
|
package/dist/css.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* This is a subset of React.CSSProperties optimized for OG image generation
|
|
4
4
|
*/
|
|
5
5
|
export interface CSSProperties {
|
|
6
|
-
display?: "flex" | "none";
|
|
7
|
-
position?: "relative" | "absolute";
|
|
6
|
+
display?: "flex" | "none" | "block" | "inline" | "inline-flex" | "inline-block";
|
|
7
|
+
position?: "relative" | "absolute" | "fixed" | "static" | "sticky";
|
|
8
8
|
flexDirection?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
9
9
|
flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
10
10
|
flexGrow?: number;
|
|
11
11
|
flexShrink?: number;
|
|
12
12
|
flexBasis?: number | string;
|
|
13
13
|
alignItems?: "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
14
|
-
alignContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "stretch";
|
|
14
|
+
alignContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
15
15
|
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
16
16
|
justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
17
17
|
gap?: number | string;
|
|
@@ -39,7 +39,7 @@ export interface CSSProperties {
|
|
|
39
39
|
left?: number | string;
|
|
40
40
|
border?: string;
|
|
41
41
|
borderWidth?: number | string;
|
|
42
|
-
borderStyle?: "solid" | "dashed";
|
|
42
|
+
borderStyle?: "solid" | "dashed" | "dotted" | "double" | "none";
|
|
43
43
|
borderColor?: string;
|
|
44
44
|
borderTop?: string;
|
|
45
45
|
borderRight?: string;
|
|
@@ -71,13 +71,26 @@ export interface CSSProperties {
|
|
|
71
71
|
whiteSpace?: "normal" | "pre" | "pre-wrap" | "pre-line" | "nowrap";
|
|
72
72
|
wordBreak?: "normal" | "break-all" | "break-word" | "keep-all";
|
|
73
73
|
opacity?: number;
|
|
74
|
-
overflow?: "visible" | "hidden";
|
|
74
|
+
overflow?: "visible" | "hidden" | "auto" | "scroll";
|
|
75
|
+
overflowX?: "visible" | "hidden" | "auto" | "scroll";
|
|
76
|
+
overflowY?: "visible" | "hidden" | "auto" | "scroll";
|
|
75
77
|
boxShadow?: string;
|
|
76
78
|
transform?: string;
|
|
77
79
|
transformOrigin?: string;
|
|
78
|
-
objectFit?: "contain" | "cover" | "none";
|
|
80
|
+
objectFit?: "contain" | "cover" | "none" | "fill" | "scale-down";
|
|
79
81
|
objectPosition?: string;
|
|
80
82
|
filter?: string;
|
|
81
83
|
clipPath?: string;
|
|
84
|
+
zIndex?: number | string;
|
|
85
|
+
aspectRatio?: string;
|
|
86
|
+
justifyItems?: "start" | "end" | "center" | "stretch";
|
|
87
|
+
justifySelf?: "auto" | "start" | "end" | "center" | "stretch";
|
|
88
|
+
pointerEvents?: "none" | "auto";
|
|
89
|
+
userSelect?: "none" | "text" | "all" | "auto";
|
|
90
|
+
borderTopWidth?: number | string;
|
|
91
|
+
borderRightWidth?: number | string;
|
|
92
|
+
borderBottomWidth?: number | string;
|
|
93
|
+
borderLeftWidth?: number | string;
|
|
94
|
+
overflowWrap?: "normal" | "break-word";
|
|
82
95
|
}
|
|
83
96
|
//# sourceMappingURL=css.d.ts.map
|
package/dist/css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAE7B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAE7B,OAAO,CAAC,EACL,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,aAAa,GACb,cAAc,CAAC;IAClB,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnE,aAAa,CAAC,EAAE,KAAK,GAAG,aAAa,GAAG,QAAQ,GAAG,gBAAgB,CAAC;IACpE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,CAA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MAAM,GAAG,MAAM,CAAC;IAGzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IAG9D,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAG9C,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAGlC,YAAY,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CACvC"}
|
package/dist/font-registry.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class FontRegistry {
|
|
|
14
14
|
/**
|
|
15
15
|
* Helper to register Inter fonts with specified weights (local files)
|
|
16
16
|
* Only works in Bun/Node without bundlers
|
|
17
|
+
* @deprecated Use registerInterFromUrl() for universal compatibility. This method will be removed in v1.0.0
|
|
17
18
|
*/
|
|
18
19
|
registerInter(weights?: (300 | 400 | 500 | 600 | 700)[]): Promise<void>;
|
|
19
20
|
/**
|
|
@@ -21,6 +22,20 @@ export declare class FontRegistry {
|
|
|
21
22
|
* Works with all bundlers (Next.js, Vite, etc.)
|
|
22
23
|
*/
|
|
23
24
|
registerInterFromUrl(weights?: (300 | 400 | 500 | 600 | 700)[]): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to register any Google Font by name
|
|
27
|
+
* Works with all bundlers (Next.js, Vite, etc.)
|
|
28
|
+
*/
|
|
29
|
+
registerGoogleFont(fontName: string, weights?: (100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900)[]): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Helper to register a font from a local file
|
|
32
|
+
* Works in Node.js environments (Route Handlers, API routes)
|
|
33
|
+
*/
|
|
34
|
+
registerFontFromFile(path: string, options: {
|
|
35
|
+
name: string;
|
|
36
|
+
weight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
37
|
+
style?: "normal" | "italic";
|
|
38
|
+
}): Promise<void>;
|
|
24
39
|
/**
|
|
25
40
|
* Get all registered fonts
|
|
26
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-registry.d.ts","sourceRoot":"","sources":["../src/font-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;GAEG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI;IAgB/C
|
|
1
|
+
{"version":3,"file":"font-registry.d.ts","sourceRoot":"","sources":["../src/font-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;GAEG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI;IAgB/C;;;;OAIG;IACG,aAAa,CAClB,OAAO,GAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EAAe,GACnD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;OAGG;IACG,oBAAoB,CACzB,OAAO,GAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EAAe,GACnD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;OAGG;IACG,kBAAkB,CACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EAAE,GAC/D,OAAO,CAAC,IAAI,CAAC;IAMhB;;;OAGG;IACG,oBAAoB,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;QAC7D,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;KAC5B,GACC,OAAO,CAAC,IAAI,CAAC;IAMhB;;OAEG;IACH,QAAQ,IAAI,UAAU,EAAE;IAIxB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGb;AAED,eAAO,MAAM,YAAY,cAA6B,CAAC"}
|
package/dist/font-registry.js
CHANGED
|
@@ -28,6 +28,7 @@ export class FontRegistry {
|
|
|
28
28
|
/**
|
|
29
29
|
* Helper to register Inter fonts with specified weights (local files)
|
|
30
30
|
* Only works in Bun/Node without bundlers
|
|
31
|
+
* @deprecated Use registerInterFromUrl() for universal compatibility. This method will be removed in v1.0.0
|
|
31
32
|
*/
|
|
32
33
|
async registerInter(weights = [400, 700]) {
|
|
33
34
|
const { loadInterFont } = await import("./fonts");
|
|
@@ -43,6 +44,24 @@ export class FontRegistry {
|
|
|
43
44
|
const fonts = await Promise.all(weights.map((w) => loadInterFromUrl(w)));
|
|
44
45
|
this.register(fonts);
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Helper to register any Google Font by name
|
|
49
|
+
* Works with all bundlers (Next.js, Vite, etc.)
|
|
50
|
+
*/
|
|
51
|
+
async registerGoogleFont(fontName, weights) {
|
|
52
|
+
const { loadGoogleFont } = await import("./fonts");
|
|
53
|
+
const fonts = await loadGoogleFont(fontName, weights);
|
|
54
|
+
this.register(fonts);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Helper to register a font from a local file
|
|
58
|
+
* Works in Node.js environments (Route Handlers, API routes)
|
|
59
|
+
*/
|
|
60
|
+
async registerFontFromFile(path, options) {
|
|
61
|
+
const { loadFontFromFile } = await import("./fonts");
|
|
62
|
+
const font = await loadFontFromFile(path, options);
|
|
63
|
+
this.register(font);
|
|
64
|
+
}
|
|
46
65
|
/**
|
|
47
66
|
* Get all registered fonts
|
|
48
67
|
*/
|
package/dist/fonts.d.ts
CHANGED
|
@@ -26,6 +26,27 @@ export declare function loadInterFromUrl(weight?: 300 | 400 | 500 | 600 | 700):
|
|
|
26
26
|
* Load Inter font from local file
|
|
27
27
|
* Only works in Bun/Node without bundlers
|
|
28
28
|
* Supports weights: 300 (Light), 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
|
|
29
|
+
* @deprecated Use loadInterFromUrl() for universal compatibility. This function will be removed in v1.0.0
|
|
29
30
|
*/
|
|
30
31
|
export declare function loadInterFont(weight?: 300 | 400 | 500 | 600 | 700): Promise<FontConfig>;
|
|
32
|
+
/**
|
|
33
|
+
* Load any Google Font by name with specified weights
|
|
34
|
+
* Uses Bunny Fonts CDN (privacy-friendly Google Fonts mirror)
|
|
35
|
+
* @param fontName - Name of the Google Font (e.g., 'Roboto', 'Poppins', 'Playfair Display')
|
|
36
|
+
* @param weights - Array of font weights to load (default: [400, 700])
|
|
37
|
+
* @returns Promise resolving to array of FontConfig objects
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadGoogleFont(fontName: string, weights?: (100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900)[]): Promise<FontConfig[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Load a font from a local file path
|
|
42
|
+
* Useful for loading custom fonts or integrating with next/font/local
|
|
43
|
+
* @param path - Path to the font file (relative or absolute)
|
|
44
|
+
* @param options - Font configuration options
|
|
45
|
+
* @returns Promise resolving to FontConfig object
|
|
46
|
+
*/
|
|
47
|
+
export declare function loadFontFromFile(path: string, options: {
|
|
48
|
+
name: string;
|
|
49
|
+
weight?: FontConfig["weight"];
|
|
50
|
+
style?: FontConfig["style"];
|
|
51
|
+
}): Promise<FontConfig>;
|
|
31
52
|
//# sourceMappingURL=fonts.d.ts.map
|
package/dist/fonts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../src/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAajE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACpC,GAAG,EAAE,MAAM,EACX,SAAS,SAAQ,GACf,OAAO,CAAC,WAAW,CAAC,CAoCtB;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;CAAO,GAC1E,UAAU,CAOZ;AAWD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,GAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAS,GACvC,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED
|
|
1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AE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC5B,GACC,OAAO,CAAC,UAAU,CAAC,CAMrB"}
|
package/dist/fonts.js
CHANGED
|
@@ -80,6 +80,7 @@ export async function loadInterFromUrl(weight = 400) {
|
|
|
80
80
|
* Load Inter font from local file
|
|
81
81
|
* Only works in Bun/Node without bundlers
|
|
82
82
|
* Supports weights: 300 (Light), 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
|
|
83
|
+
* @deprecated Use loadInterFromUrl() for universal compatibility. This function will be removed in v1.0.0
|
|
83
84
|
*/
|
|
84
85
|
export async function loadInterFont(weight = 400) {
|
|
85
86
|
if (typeof globalThis !== "undefined" &&
|
|
@@ -108,3 +109,35 @@ export async function loadInterFont(weight = 400) {
|
|
|
108
109
|
const data = await loadFont(path);
|
|
109
110
|
return createFont("Inter", data, { weight });
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Load any Google Font by name with specified weights
|
|
114
|
+
* Uses Bunny Fonts CDN (privacy-friendly Google Fonts mirror)
|
|
115
|
+
* @param fontName - Name of the Google Font (e.g., 'Roboto', 'Poppins', 'Playfair Display')
|
|
116
|
+
* @param weights - Array of font weights to load (default: [400, 700])
|
|
117
|
+
* @returns Promise resolving to array of FontConfig objects
|
|
118
|
+
*/
|
|
119
|
+
export async function loadGoogleFont(fontName, weights = [400, 700]) {
|
|
120
|
+
// Normalize font name for URL (replace spaces with hyphens, lowercase)
|
|
121
|
+
const urlFontName = fontName.toLowerCase().replace(/\s+/g, "-");
|
|
122
|
+
const fontConfigs = await Promise.all(weights.map(async (weight) => {
|
|
123
|
+
// Use Bunny Fonts CDN (privacy-friendly alternative to Google Fonts)
|
|
124
|
+
const url = `https://fonts.bunny.net/${urlFontName}/files/${urlFontName}-latin-${weight}-normal.woff`;
|
|
125
|
+
const data = await loadFontFromUrl(url);
|
|
126
|
+
return createFont(fontName, data, { weight });
|
|
127
|
+
}));
|
|
128
|
+
return fontConfigs;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Load a font from a local file path
|
|
132
|
+
* Useful for loading custom fonts or integrating with next/font/local
|
|
133
|
+
* @param path - Path to the font file (relative or absolute)
|
|
134
|
+
* @param options - Font configuration options
|
|
135
|
+
* @returns Promise resolving to FontConfig object
|
|
136
|
+
*/
|
|
137
|
+
export async function loadFontFromFile(path, options) {
|
|
138
|
+
const data = await loadFont(path);
|
|
139
|
+
return createFont(options.name, data, {
|
|
140
|
+
weight: options.weight,
|
|
141
|
+
style: options.style,
|
|
142
|
+
});
|
|
143
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ogxjs/core - High-performance OG Image Generator
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Generate beautiful Open Graph images using Tailwind CSS classes.
|
|
6
|
+
* Built for Node.js, Bun, and Deno.
|
|
7
|
+
*
|
|
8
|
+
* @version 0.3.0 "Universal Fonts"
|
|
9
|
+
* @see https://ogx-three.vercel.app
|
|
10
|
+
*/
|
|
1
11
|
export { absolute, badge, card, div, fluent, footer, grid, h, h1, h2, header, img, imgFromUrl, main, p, row, spacer, span, stack, svgFromContent, unsafe_img, validateImageUrl, } from "./builder";
|
|
2
|
-
export {
|
|
12
|
+
export type { LRUCacheOptions, LRUCacheStats, SnapshotCacheOptions, SnapshotCacheStats, } from "./cache/index";
|
|
13
|
+
export { configureSnapshotCache, fastHash, fnv1a, getSnapshotCache, hashObject, LRUCache, snapshotCache, } from "./cache/index";
|
|
3
14
|
export type { CSSProperties } from "./css";
|
|
4
15
|
export { fontRegistry } from "./font-registry";
|
|
5
|
-
export { createFont, loadFont, loadFontFromUrl, loadInterFont, loadInterFromUrl, } from "./fonts";
|
|
16
|
+
export { createFont, loadFont, loadFontFromFile, loadFontFromUrl, loadGoogleFont, loadInterFont, loadInterFromUrl, } from "./fonts";
|
|
6
17
|
export { ogx, ogxToSVG } from "./ogx";
|
|
18
|
+
export type { TimingAggregate, TimingEntry, TimingReport } from "./perf";
|
|
19
|
+
export { benchmark, benchmarkSync, quickTime, quickTimeSync, Timer, timing, } from "./perf";
|
|
7
20
|
export type { BlogPresetProps, DocsPresetProps, MinimalPresetProps, SocialPresetProps, } from "./presets";
|
|
8
21
|
export { blogPreset, docsPreset, minimalPreset, presets, socialPreset, } from "./presets";
|
|
9
22
|
export { render } from "./render-png";
|
|
10
23
|
export { renderToSVG } from "./render-svg";
|
|
11
|
-
export {
|
|
24
|
+
export type { CacheStats, GradientState, ParseContext } from "./tailwind";
|
|
25
|
+
export { clearAllCaches, getCacheStats, isStaticClass, parseTailwind, parseTailwindBatch, STATIC_CLASSES, } from "./tailwind";
|
|
12
26
|
export type { Platform } from "./targets";
|
|
13
27
|
export { getPlatformDimensions } from "./targets";
|
|
14
|
-
export type { FontConfig, OGXBaseConfig, OGXChildren, OGXConfig, OGXElement, OGXElementProps, Preset, PresetName, PresetProps, RenderOptions, } from "./types";
|
|
28
|
+
export type { FontConfig, OGXBaseConfig, OGXChildren, OGXConfig, OGXElement, OGXElementProps, Preset, PresetName, PresetProps, RenderOptions, ThemeConfig, } from "./types";
|
|
15
29
|
export { loadAsset, toDataUri } from "./utils/assets";
|
|
16
30
|
export type { FitTextOptions } from "./utils/text";
|
|
17
31
|
export { calculateFittingFontSize } from "./utils/text";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACN,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,EACN,IAAI,EACJ,CAAC,EACD,EAAE,EACF,EAAE,EAC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