satori 0.33.4 → 0.34.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.
@@ -1,3 +1,5 @@
1
+ import { a as WebGLCanvasRenderer } from './canvas-afafb49b.js';
2
+
1
3
  /**
2
4
  * @file
3
5
  * HTML elements and CSS properties that Satori supports.
@@ -362,6 +364,11 @@ interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
362
364
  interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
363
365
  height?: number | string | undefined;
364
366
  width?: number | string | undefined;
367
+ /**
368
+ * Experimental, Satori-specific: draws the canvas content with WebGL2. Only
369
+ * rendered by `satori/experimental`, with its `createWebGLContext` option.
370
+ */
371
+ webgl?: WebGLCanvasRenderer | undefined;
365
372
  }
366
373
  interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
367
374
  span?: number | undefined;
@@ -0,0 +1,175 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ declare const code: {
4
+ readonly 'ja-JP': RegExp;
5
+ readonly 'ko-KR': RegExp;
6
+ readonly 'zh-CN': RegExp;
7
+ readonly 'zh-TW': RegExp;
8
+ readonly 'zh-HK': RegExp;
9
+ readonly 'th-TH': RegExp;
10
+ readonly 'bn-IN': RegExp;
11
+ readonly 'ar-AR': RegExp;
12
+ readonly 'ta-IN': RegExp;
13
+ readonly 'ml-IN': RegExp;
14
+ readonly 'he-IL': RegExp;
15
+ readonly 'te-IN': RegExp;
16
+ readonly devanagari: RegExp;
17
+ readonly kannada: RegExp;
18
+ };
19
+ type Locale = keyof typeof code;
20
+
21
+ /**
22
+ * This class handles everything related to fonts.
23
+ */
24
+
25
+ type Weight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
26
+ type FontStyle = 'normal' | 'italic';
27
+ interface FontOptions {
28
+ data: Buffer | ArrayBuffer;
29
+ name: string;
30
+ weight?: Weight;
31
+ style?: FontStyle;
32
+ lang?: string;
33
+ }
34
+
35
+ declare type Style = {
36
+ [key: string]: string[] | string | number | boolean | Style;
37
+ };
38
+ declare type NotImplemented = (...args: any) => unknown;
39
+ declare type AddedUtilities = Record<string, Style | string>;
40
+ declare type PluginFunction = (obj: {
41
+ addUtilities(utilities: AddedUtilities): unknown;
42
+ /**
43
+ * @deprecated not supported in @jaredh159/twrn
44
+ */
45
+ addComponents: NotImplemented;
46
+ /**
47
+ * @deprecated not supported in @jaredh159/twrn
48
+ */
49
+ addBase: NotImplemented;
50
+ /**
51
+ * @deprecated not supported in @jaredh159/twrn
52
+ */
53
+ addVariant: NotImplemented;
54
+ /**
55
+ * @deprecated not supported in @jaredh159/twrn
56
+ */
57
+ e: NotImplemented;
58
+ /**
59
+ * @deprecated not supported in @jaredh159/twrn
60
+ */
61
+ prefix: NotImplemented;
62
+ /**
63
+ * @deprecated not supported in @jaredh159/twrn
64
+ */
65
+ theme: NotImplemented;
66
+ /**
67
+ * @deprecated not supported in @jaredh159/twrn
68
+ */
69
+ variants: NotImplemented;
70
+ /**
71
+ * @deprecated not supported in @jaredh159/twrn
72
+ */
73
+ config: NotImplemented;
74
+ /**
75
+ * @deprecated not supported in @jaredh159/twrn
76
+ */
77
+ corePlugins: NotImplemented;
78
+ /**
79
+ * @deprecated not supported in @jaredh159/twrn
80
+ */
81
+ matchUtilities: NotImplemented;
82
+ /**
83
+ * @deprecated not supported in @jaredh159/twrn
84
+ */
85
+ postcss: unknown;
86
+ }) => unknown;
87
+
88
+ declare type TwFontSize = string | [string, string] | [string, {
89
+ lineHeight?: string;
90
+ letterSpacing?: string;
91
+ }];
92
+ declare type TwScreen = string | {
93
+ max?: string;
94
+ min?: string;
95
+ };
96
+ declare type TwColors<K extends keyof any = string, V = string> = {
97
+ [key: string]: V | TwColors<K, V>;
98
+ };
99
+ interface TwTheme {
100
+ fontSize?: Record<string, TwFontSize>;
101
+ lineHeight?: Record<string, string>;
102
+ spacing?: Record<string, string>;
103
+ padding?: Record<string, string>;
104
+ margin?: Record<string, string>;
105
+ inset?: Record<string, string>;
106
+ height?: Record<string, string>;
107
+ width?: Record<string, string>;
108
+ maxWidth?: Record<string, string>;
109
+ maxHeight?: Record<string, string>;
110
+ minWidth?: Record<string, string>;
111
+ minHeight?: Record<string, string>;
112
+ letterSpacing?: Record<string, string>;
113
+ borderWidth?: Record<string, string>;
114
+ borderRadius?: Record<string, string>;
115
+ screens?: Record<string, TwScreen>;
116
+ opacity?: Record<string, number | string>;
117
+ flex?: Record<string, string>;
118
+ flexGrow?: Record<string, number | string>;
119
+ flexShrink?: Record<string, number | string>;
120
+ fontWeight?: Record<string, number | string>;
121
+ fontFamily?: Record<string, string | string[]>;
122
+ zIndex?: Record<string, number | string>;
123
+ colors?: TwColors;
124
+ backgroundColor?: TwColors;
125
+ borderColor?: TwColors;
126
+ textColor?: TwColors;
127
+ extend?: Omit<TwTheme, 'extend'>;
128
+ }
129
+ interface TwConfig {
130
+ theme?: TwTheme;
131
+ plugins?: Array<{
132
+ handler: PluginFunction;
133
+ }>;
134
+ }
135
+
136
+ type InitInput = string | Request | URL | Response | BufferSource | Buffer | WebAssembly.Module | Promise<Response | BufferSource | Buffer | WebAssembly.Module>;
137
+
138
+ declare function init(input: InitInput): Promise<void>;
139
+
140
+ /**
141
+ * This module is used to calculate the layout of the current sub-tree.
142
+ */
143
+
144
+ interface SatoriNode {
145
+ left: number;
146
+ top: number;
147
+ width: number;
148
+ height: number;
149
+ type: string;
150
+ key?: string | number;
151
+ props: Record<string, any>;
152
+ textContent?: string;
153
+ }
154
+
155
+ type SatoriOptions = ({
156
+ width: number;
157
+ height: number;
158
+ } | {
159
+ width: number;
160
+ } | {
161
+ height: number;
162
+ }) & {
163
+ fonts: FontOptions[];
164
+ embedFont?: boolean;
165
+ debug?: boolean;
166
+ graphemeImages?: Record<string, string>;
167
+ loadAdditionalAsset?: (languageCode: string, segment: string) => Promise<string | Array<FontOptions>>;
168
+ tailwindConfig?: TwConfig;
169
+ onNodeDetected?: (node: SatoriNode) => void;
170
+ pointScaleFactor?: number;
171
+ };
172
+
173
+ declare const satori: (element: ReactNode, options: SatoriOptions) => Promise<string>;
174
+
175
+ export { FontOptions as F, Locale as L, SatoriOptions as S, Weight as W, FontStyle as a, SatoriNode as b, init as i, satori as s };