@react-pdf/stylesheet 6.0.0 → 6.0.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.
- package/lib/index.d.ts +54 -26
- package/lib/index.js +116 -115
- package/package.json +5 -4
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type Container = {
|
|
|
5
5
|
remBase?: number;
|
|
6
6
|
orientation?: 'landscape' | 'portrait';
|
|
7
7
|
};
|
|
8
|
+
type Percentage = `${string}%`;
|
|
8
9
|
type BorderStyleValue = 'dashed' | 'dotted' | 'solid';
|
|
9
10
|
type BorderShorthandStyle = {
|
|
10
11
|
border?: number | string;
|
|
@@ -40,10 +41,10 @@ type BorderSafeStyle = BorderExpandedStyle & {
|
|
|
40
41
|
borderRightWidth?: number;
|
|
41
42
|
borderBottomWidth?: number;
|
|
42
43
|
borderLeftWidth?: number;
|
|
43
|
-
borderTopLeftRadius?: number;
|
|
44
|
-
borderTopRightRadius?: number;
|
|
45
|
-
borderBottomRightRadius?: number;
|
|
46
|
-
borderBottomLeftRadius?: number;
|
|
44
|
+
borderTopLeftRadius?: number | Percentage;
|
|
45
|
+
borderTopRightRadius?: number | Percentage;
|
|
46
|
+
borderBottomRightRadius?: number | Percentage;
|
|
47
|
+
borderBottomLeftRadius?: number | Percentage;
|
|
47
48
|
};
|
|
48
49
|
type BorderStyle = BorderShorthandStyle & BorderExpandedStyle;
|
|
49
50
|
type FlexboxShorthandStyle = {
|
|
@@ -82,8 +83,8 @@ type GapExpandedStyle = {
|
|
|
82
83
|
columnGap?: number | string;
|
|
83
84
|
};
|
|
84
85
|
type GapSafeStyle = {
|
|
85
|
-
rowGap?: number;
|
|
86
|
-
columnGap?: number;
|
|
86
|
+
rowGap?: number | Percentage;
|
|
87
|
+
columnGap?: number | Percentage;
|
|
87
88
|
};
|
|
88
89
|
type GapStyle = GapShorthandStyle & GapExpandedStyle;
|
|
89
90
|
type PositionShorthandStyle = {
|
|
@@ -99,17 +100,39 @@ type PositionSafeStyle = PositionExpandedStyle & {
|
|
|
99
100
|
objectPositionY?: number;
|
|
100
101
|
};
|
|
101
102
|
type PositioningStyle = PositionShorthandStyle & PositionExpandedStyle;
|
|
103
|
+
type ScaleTransform = {
|
|
104
|
+
operation: 'scale';
|
|
105
|
+
value: [number, number];
|
|
106
|
+
};
|
|
107
|
+
type TranslateTransform = {
|
|
108
|
+
operation: 'translate';
|
|
109
|
+
value: [number, number];
|
|
110
|
+
};
|
|
111
|
+
type RotateTransform = {
|
|
112
|
+
operation: 'rotate';
|
|
113
|
+
value: [number];
|
|
114
|
+
};
|
|
115
|
+
type SkewTransform = {
|
|
116
|
+
operation: 'skew';
|
|
117
|
+
value: [number, number];
|
|
118
|
+
};
|
|
119
|
+
type MatrixTransform = {
|
|
120
|
+
operation: 'matrix';
|
|
121
|
+
value: [number, number, number, number, number, number];
|
|
122
|
+
};
|
|
123
|
+
type Transform = ScaleTransform | TranslateTransform | RotateTransform | SkewTransform | MatrixTransform;
|
|
102
124
|
type TransformShorthandStyle = {
|
|
103
125
|
transformOrigin?: number | string;
|
|
104
126
|
};
|
|
105
127
|
type TransformExpandedStyle = {
|
|
106
128
|
transformOriginX?: number | string;
|
|
107
129
|
transformOriginY?: number | string;
|
|
108
|
-
transform?: string;
|
|
130
|
+
transform?: string | Transform[];
|
|
109
131
|
};
|
|
110
|
-
type TransformSafeStyle = TransformExpandedStyle & {
|
|
111
|
-
transformOriginX?: number;
|
|
112
|
-
transformOriginY?: number;
|
|
132
|
+
type TransformSafeStyle = Omit<TransformExpandedStyle, 'transform'> & {
|
|
133
|
+
transformOriginX?: number | Percentage;
|
|
134
|
+
transformOriginY?: number | Percentage;
|
|
135
|
+
transform?: Transform[];
|
|
113
136
|
};
|
|
114
137
|
type TransformStyle = TransformShorthandStyle & TransformExpandedStyle;
|
|
115
138
|
type Display = 'flex' | 'none';
|
|
@@ -144,18 +167,19 @@ type DimensionStyle = {
|
|
|
144
167
|
};
|
|
145
168
|
type DimensionExpandedStyle = DimensionStyle;
|
|
146
169
|
type DimensionSafeStyle = DimensionExpandedStyle & {
|
|
147
|
-
height?: number;
|
|
148
|
-
maxHeight?: number;
|
|
149
|
-
maxWidth?: number;
|
|
150
|
-
minHeight?: number;
|
|
151
|
-
minWidth?: number;
|
|
152
|
-
width?: number;
|
|
170
|
+
height?: number | Percentage;
|
|
171
|
+
maxHeight?: number | Percentage;
|
|
172
|
+
maxWidth?: number | Percentage;
|
|
173
|
+
minHeight?: number | Percentage;
|
|
174
|
+
minWidth?: number | Percentage;
|
|
175
|
+
width?: number | Percentage;
|
|
153
176
|
};
|
|
154
177
|
type ColorStyle = {
|
|
155
178
|
backgroundColor?: string;
|
|
156
179
|
color?: string;
|
|
157
180
|
opacity?: number | string;
|
|
158
181
|
};
|
|
182
|
+
type ColorExpandedStyle = ColorStyle;
|
|
159
183
|
type ColorSafeStyle = {
|
|
160
184
|
backgroundColor?: string;
|
|
161
185
|
color?: string;
|
|
@@ -166,9 +190,10 @@ type FontWeight = string | number | 'thin' | 'hairline' | 'ultralight' | 'extral
|
|
|
166
190
|
type TextAlign = 'left' | 'right' | 'center' | 'justify';
|
|
167
191
|
type TextDecoration = 'line-through' | 'underline' | 'none' | 'line-through underline' | 'underline line-through';
|
|
168
192
|
type TextDecorationStyle = 'dashed' | 'dotted' | 'solid' | string;
|
|
169
|
-
type TextTransform = 'capitalize' | 'lowercase' | 'uppercase' | 'none';
|
|
193
|
+
type TextTransform = 'capitalize' | 'lowercase' | 'uppercase' | 'upperfirst' | 'none';
|
|
170
194
|
type VerticalAlign = 'sub' | 'super';
|
|
171
195
|
type TextStyle = {
|
|
196
|
+
direction?: 'ltr' | 'rtl';
|
|
172
197
|
fontSize?: number | string;
|
|
173
198
|
fontFamily?: string | string[];
|
|
174
199
|
fontStyle?: FontStyle;
|
|
@@ -204,10 +229,10 @@ type MarginExpandedStyle = {
|
|
|
204
229
|
marginLeft?: number | string;
|
|
205
230
|
};
|
|
206
231
|
type MarginSafeStyle = MarginExpandedStyle & {
|
|
207
|
-
marginTop?: number;
|
|
208
|
-
marginRight?: number;
|
|
209
|
-
marginBottom?: number;
|
|
210
|
-
marginLeft?: number;
|
|
232
|
+
marginTop?: number | Percentage;
|
|
233
|
+
marginRight?: number | Percentage;
|
|
234
|
+
marginBottom?: number | Percentage;
|
|
235
|
+
marginLeft?: number | Percentage;
|
|
211
236
|
};
|
|
212
237
|
type MarginStyle = MarginShorthandStyle & MarginExpandedStyle;
|
|
213
238
|
type PaddingShorthandStyle = {
|
|
@@ -222,10 +247,10 @@ type PaddingExpandedStyle = {
|
|
|
222
247
|
paddingLeft?: number | string;
|
|
223
248
|
};
|
|
224
249
|
type PaddingSafeStyle = PaddingExpandedStyle & {
|
|
225
|
-
paddingTop?: number;
|
|
226
|
-
paddingRight?: number;
|
|
227
|
-
paddingBottom?: number;
|
|
228
|
-
paddingLeft?: number;
|
|
250
|
+
paddingTop?: number | Percentage;
|
|
251
|
+
paddingRight?: number | Percentage;
|
|
252
|
+
paddingBottom?: number | Percentage;
|
|
253
|
+
paddingLeft?: number | Percentage;
|
|
229
254
|
};
|
|
230
255
|
type PaddingStyle = PaddingShorthandStyle & PaddingExpandedStyle;
|
|
231
256
|
interface SvgStyle {
|
|
@@ -243,6 +268,7 @@ interface SvgStyle {
|
|
|
243
268
|
clipPath?: string;
|
|
244
269
|
dominantBaseline?: 'auto' | 'middle' | 'central' | 'hanging' | 'mathematical' | 'text-after-edge' | 'text-before-edge';
|
|
245
270
|
}
|
|
271
|
+
type SvgExpandedStyle = SvgStyle;
|
|
246
272
|
type SvgSafeStyle = SvgStyle & {
|
|
247
273
|
strokeWidth?: number;
|
|
248
274
|
fillOpacity?: number;
|
|
@@ -253,6 +279,8 @@ type MediaQueryStyle = {
|
|
|
253
279
|
[key in `@media${string}`]: BaseStyle;
|
|
254
280
|
};
|
|
255
281
|
type Style = BaseStyle & MediaQueryStyle;
|
|
282
|
+
type StyleKey = keyof BaseStyle;
|
|
283
|
+
type ExpandedStyle = BorderExpandedStyle & ColorExpandedStyle & DimensionExpandedStyle & FlexboxExpandedStyle & GapExpandedStyle & LayoutExpandedStyle & MarginExpandedStyle & PaddingExpandedStyle & PositionExpandedStyle & TextExpandedStyle & TransformExpandedStyle & SvgExpandedStyle;
|
|
256
284
|
type SafeStyle = BorderSafeStyle & ColorSafeStyle & DimensionSafeStyle & FlexboxSafeStyle & GapSafeStyle & LayoutSafeStyle & MarginSafeStyle & PaddingSafeStyle & PositionSafeStyle & TextSafeStyle & TransformSafeStyle & SvgSafeStyle;
|
|
257
285
|
|
|
258
286
|
/**
|
|
@@ -281,4 +309,4 @@ type StyleParam = Style | null | undefined;
|
|
|
281
309
|
*/
|
|
282
310
|
declare const resolveStyles: (container: Container, style: StyleParam | StyleParam[]) => SafeStyle;
|
|
283
311
|
|
|
284
|
-
export { type SafeStyle, type Style, resolveStyles as default, flatten, transformColor };
|
|
312
|
+
export { type AlignContent, type AlignItems, type AlignSelf, type BorderExpandedStyle, type BorderSafeStyle, type BorderShorthandStyle, type BorderStyle, type BorderStyleValue, type ColorExpandedStyle, type ColorSafeStyle, type ColorStyle, type Container, type DimensionExpandedStyle, type DimensionSafeStyle, type DimensionStyle, type Display, type ExpandedStyle, type FlexDirection, type FlexWrap, type FlexboxExpandedStyle, type FlexboxSafeStyle, type FlexboxShorthandStyle, type FlexboxStyle, type FontStyle, type FontWeight, type GapExpandedStyle, type GapSafeStyle, type GapShorthandStyle, type GapStyle, type JustifyContent, type JustifySelf, type LayoutExpandedStyle, type LayoutSafeStyle, type LayoutStyle, type MarginExpandedStyle, type MarginSafeStyle, type MarginShorthandStyle, type MarginStyle, type MatrixTransform, type PaddingExpandedStyle, type PaddingSafeStyle, type PaddingShorthandStyle, type PaddingStyle, type Percentage, type Position, type PositionExpandedStyle, type PositionSafeStyle, type PositionShorthandStyle, type PositioningStyle, type RotateTransform, type SafeStyle, type ScaleTransform, type SkewTransform, type Style, type StyleKey, type SvgExpandedStyle, type SvgSafeStyle, type SvgStyle, type TextAlign, type TextDecoration, type TextDecorationStyle, type TextExpandedStyle, type TextSafeStyle, type TextStyle, type TextTransform, type Transform, type TransformExpandedStyle, type TransformSafeStyle, type TransformShorthandStyle, type TransformStyle, type TranslateTransform, type VerticalAlign, resolveStyles as default, flatten, transformColor };
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compose, castArray, matchPercent } from '@react-pdf/fns';
|
|
1
|
+
import { compose, castArray, parseFloat as parseFloat$1, matchPercent } from '@react-pdf/fns';
|
|
2
2
|
import matchMedia from 'media-engine';
|
|
3
3
|
import hlsToHex from 'hsl-to-hex';
|
|
4
4
|
import colorString from 'color-string';
|
|
@@ -141,7 +141,7 @@ const transformUnit = (container, value) => {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
const processNumberValue = (key, value) => ({
|
|
144
|
-
[key]: parseFloat(value),
|
|
144
|
+
[key]: parseFloat$1(value),
|
|
145
145
|
});
|
|
146
146
|
const processUnitValue = (key, value, container) => ({
|
|
147
147
|
[key]: transformUnit(container, value),
|
|
@@ -233,46 +233,46 @@ const resolveBorderShorthand = (key, value, container) => {
|
|
|
233
233
|
return { [key]: value };
|
|
234
234
|
};
|
|
235
235
|
const handlers$b = {
|
|
236
|
-
border: resolveBorderShorthand,
|
|
237
|
-
borderBottom: resolveBorderShorthand,
|
|
238
|
-
borderBottomColor: processColorValue,
|
|
239
|
-
borderBottomLeftRadius: processUnitValue,
|
|
240
|
-
borderBottomRightRadius: processUnitValue,
|
|
241
|
-
borderBottomStyle: processNoopValue,
|
|
242
|
-
borderBottomWidth: processUnitValue,
|
|
243
|
-
borderColor: resolveBorderShorthand,
|
|
244
|
-
borderLeft: resolveBorderShorthand,
|
|
245
|
-
borderLeftColor: processColorValue,
|
|
246
|
-
borderLeftStyle: processNoopValue,
|
|
247
|
-
borderLeftWidth: processUnitValue,
|
|
248
|
-
borderRadius: resolveBorderShorthand,
|
|
249
|
-
borderRight: resolveBorderShorthand,
|
|
250
|
-
borderRightColor: processColorValue,
|
|
251
|
-
borderRightStyle: processNoopValue,
|
|
252
|
-
borderRightWidth: processUnitValue,
|
|
253
|
-
borderStyle: resolveBorderShorthand,
|
|
254
|
-
borderTop: resolveBorderShorthand,
|
|
255
|
-
borderTopColor: processColorValue,
|
|
256
|
-
borderTopLeftRadius: processUnitValue,
|
|
257
|
-
borderTopRightRadius: processUnitValue,
|
|
258
|
-
borderTopStyle: processNoopValue,
|
|
259
|
-
borderTopWidth: processUnitValue,
|
|
260
|
-
borderWidth: resolveBorderShorthand,
|
|
236
|
+
border: (resolveBorderShorthand),
|
|
237
|
+
borderBottom: (resolveBorderShorthand),
|
|
238
|
+
borderBottomColor: (processColorValue),
|
|
239
|
+
borderBottomLeftRadius: (processUnitValue),
|
|
240
|
+
borderBottomRightRadius: (processUnitValue),
|
|
241
|
+
borderBottomStyle: (processNoopValue),
|
|
242
|
+
borderBottomWidth: (processUnitValue),
|
|
243
|
+
borderColor: (resolveBorderShorthand),
|
|
244
|
+
borderLeft: (resolveBorderShorthand),
|
|
245
|
+
borderLeftColor: (processColorValue),
|
|
246
|
+
borderLeftStyle: (processNoopValue),
|
|
247
|
+
borderLeftWidth: (processUnitValue),
|
|
248
|
+
borderRadius: (resolveBorderShorthand),
|
|
249
|
+
borderRight: (resolveBorderShorthand),
|
|
250
|
+
borderRightColor: (processColorValue),
|
|
251
|
+
borderRightStyle: (processNoopValue),
|
|
252
|
+
borderRightWidth: (processUnitValue),
|
|
253
|
+
borderStyle: (resolveBorderShorthand),
|
|
254
|
+
borderTop: (resolveBorderShorthand),
|
|
255
|
+
borderTopColor: (processColorValue),
|
|
256
|
+
borderTopLeftRadius: (processUnitValue),
|
|
257
|
+
borderTopRightRadius: (processUnitValue),
|
|
258
|
+
borderTopStyle: (processNoopValue),
|
|
259
|
+
borderTopWidth: (processUnitValue),
|
|
260
|
+
borderWidth: (resolveBorderShorthand),
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
const handlers$a = {
|
|
264
|
-
backgroundColor: processColorValue,
|
|
265
|
-
color: processColorValue,
|
|
266
|
-
opacity: processNumberValue,
|
|
264
|
+
backgroundColor: (processColorValue),
|
|
265
|
+
color: (processColorValue),
|
|
266
|
+
opacity: (processNumberValue),
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
const handlers$9 = {
|
|
270
|
-
height: processUnitValue,
|
|
271
|
-
maxHeight: processUnitValue,
|
|
272
|
-
maxWidth: processUnitValue,
|
|
273
|
-
minHeight: processUnitValue,
|
|
274
|
-
minWidth: processUnitValue,
|
|
275
|
-
width: processUnitValue,
|
|
270
|
+
height: (processUnitValue),
|
|
271
|
+
maxHeight: (processUnitValue),
|
|
272
|
+
maxWidth: (processUnitValue),
|
|
273
|
+
minHeight: (processUnitValue),
|
|
274
|
+
minWidth: (processUnitValue),
|
|
275
|
+
width: (processUnitValue),
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/flex#values
|
|
@@ -288,24 +288,24 @@ const processFlexShorthand = (key, value, container) => {
|
|
|
288
288
|
else {
|
|
289
289
|
matches = `${value}`.split(' ');
|
|
290
290
|
}
|
|
291
|
-
const flexGrow =
|
|
292
|
-
const flexShrink =
|
|
291
|
+
const flexGrow = parseFloat$1(matches[0] || defaults[0]);
|
|
292
|
+
const flexShrink = parseFloat$1(matches[1] || defaults[1]);
|
|
293
293
|
const flexBasis = transformUnit(container, matches[2] || defaults[2]);
|
|
294
294
|
return { flexGrow, flexShrink, flexBasis };
|
|
295
295
|
};
|
|
296
296
|
const handlers$8 = {
|
|
297
|
-
alignContent: processNoopValue,
|
|
298
|
-
alignItems: processNoopValue,
|
|
299
|
-
alignSelf: processNoopValue,
|
|
300
|
-
flex: processFlexShorthand,
|
|
301
|
-
flexBasis: processUnitValue,
|
|
302
|
-
flexDirection: processNoopValue,
|
|
303
|
-
flexFlow: processNoopValue,
|
|
304
|
-
flexGrow:
|
|
305
|
-
flexShrink:
|
|
306
|
-
flexWrap: processNoopValue,
|
|
307
|
-
justifyContent: processNoopValue,
|
|
308
|
-
justifySelf: processNoopValue,
|
|
297
|
+
alignContent: (processNoopValue),
|
|
298
|
+
alignItems: (processNoopValue),
|
|
299
|
+
alignSelf: (processNoopValue),
|
|
300
|
+
flex: (processFlexShorthand),
|
|
301
|
+
flexBasis: (processUnitValue),
|
|
302
|
+
flexDirection: (processNoopValue),
|
|
303
|
+
flexFlow: (processNoopValue),
|
|
304
|
+
flexGrow: (processNumberValue),
|
|
305
|
+
flexShrink: (processNumberValue),
|
|
306
|
+
flexWrap: (processNoopValue),
|
|
307
|
+
justifyContent: (processNoopValue),
|
|
308
|
+
justifySelf: (processNoopValue),
|
|
309
309
|
};
|
|
310
310
|
|
|
311
311
|
const processGapShorthand = (key, value, container) => {
|
|
@@ -315,21 +315,21 @@ const processGapShorthand = (key, value, container) => {
|
|
|
315
315
|
return { rowGap, columnGap };
|
|
316
316
|
};
|
|
317
317
|
const handlers$7 = {
|
|
318
|
-
gap: processGapShorthand,
|
|
319
|
-
columnGap: processUnitValue,
|
|
320
|
-
rowGap: processUnitValue,
|
|
318
|
+
gap: (processGapShorthand),
|
|
319
|
+
columnGap: (processUnitValue),
|
|
320
|
+
rowGap: (processUnitValue),
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
const handlers$6 = {
|
|
324
|
-
aspectRatio: processNumberValue,
|
|
325
|
-
bottom: processUnitValue,
|
|
326
|
-
display: processNoopValue,
|
|
327
|
-
left: processUnitValue,
|
|
328
|
-
position: processNoopValue,
|
|
329
|
-
right: processUnitValue,
|
|
330
|
-
top: processUnitValue,
|
|
331
|
-
overflow: processNoopValue,
|
|
332
|
-
zIndex: processNumberValue,
|
|
324
|
+
aspectRatio: (processNumberValue),
|
|
325
|
+
bottom: (processUnitValue),
|
|
326
|
+
display: (processNoopValue),
|
|
327
|
+
left: (processUnitValue),
|
|
328
|
+
position: (processNoopValue),
|
|
329
|
+
right: (processUnitValue),
|
|
330
|
+
top: (processUnitValue),
|
|
331
|
+
overflow: (processNoopValue),
|
|
332
|
+
zIndex: (processNumberValue),
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
const BOX_MODEL_UNITS = 'px,in,mm,cm,pt,%,vw,vh';
|
|
@@ -344,10 +344,10 @@ const logError = (style, value) => {
|
|
|
344
344
|
`);
|
|
345
345
|
};
|
|
346
346
|
/**
|
|
347
|
-
* @param
|
|
348
|
-
* @param
|
|
349
|
-
* @param
|
|
350
|
-
* @param
|
|
347
|
+
* @param options
|
|
348
|
+
* @param [options.expandsTo]
|
|
349
|
+
* @param [options.maxValues]
|
|
350
|
+
* @param [options.autoSupported]
|
|
351
351
|
*/
|
|
352
352
|
const expandBoxModel = ({ expandsTo, maxValues = 1, autoSupported = false, } = {}) => (model, value, container) => {
|
|
353
353
|
const nodes = parse$1(`${value}`);
|
|
@@ -426,13 +426,13 @@ const processMarginSingle = expandBoxModel({
|
|
|
426
426
|
autoSupported: true,
|
|
427
427
|
});
|
|
428
428
|
const handlers$5 = {
|
|
429
|
-
margin: processMargin,
|
|
430
|
-
marginBottom: processMarginSingle,
|
|
431
|
-
marginHorizontal: processMarginHorizontal,
|
|
432
|
-
marginLeft: processMarginSingle,
|
|
433
|
-
marginRight: processMarginSingle,
|
|
434
|
-
marginTop: processMarginSingle,
|
|
435
|
-
marginVertical: processMarginVertical,
|
|
429
|
+
margin: (processMargin),
|
|
430
|
+
marginBottom: (processMarginSingle),
|
|
431
|
+
marginHorizontal: (processMarginHorizontal),
|
|
432
|
+
marginLeft: (processMarginSingle),
|
|
433
|
+
marginRight: (processMarginSingle),
|
|
434
|
+
marginTop: (processMarginSingle),
|
|
435
|
+
marginVertical: (processMarginVertical),
|
|
436
436
|
};
|
|
437
437
|
|
|
438
438
|
const processPadding = expandBoxModel({
|
|
@@ -460,13 +460,13 @@ const processPaddingHorizontal = expandBoxModel({
|
|
|
460
460
|
});
|
|
461
461
|
const processPaddingSingle = expandBoxModel();
|
|
462
462
|
const handlers$4 = {
|
|
463
|
-
padding: processPadding,
|
|
464
|
-
paddingBottom: processPaddingSingle,
|
|
465
|
-
paddingHorizontal: processPaddingHorizontal,
|
|
466
|
-
paddingLeft: processPaddingSingle,
|
|
467
|
-
paddingRight: processPaddingSingle,
|
|
468
|
-
paddingTop: processPaddingSingle,
|
|
469
|
-
paddingVertical: processPaddingVertical,
|
|
463
|
+
padding: (processPadding),
|
|
464
|
+
paddingBottom: (processPaddingSingle),
|
|
465
|
+
paddingHorizontal: (processPaddingHorizontal),
|
|
466
|
+
paddingLeft: (processPaddingSingle),
|
|
467
|
+
paddingRight: (processPaddingSingle),
|
|
468
|
+
paddingTop: (processPaddingSingle),
|
|
469
|
+
paddingVertical: (processPaddingVertical),
|
|
470
470
|
};
|
|
471
471
|
|
|
472
472
|
const offsetKeyword = (value) => {
|
|
@@ -494,10 +494,10 @@ const processObjectPositionValue = (key, value, container) => ({
|
|
|
494
494
|
[key]: offsetKeyword(transformUnit(container, value)),
|
|
495
495
|
});
|
|
496
496
|
const handlers$3 = {
|
|
497
|
-
objectPosition: processObjectPosition,
|
|
498
|
-
objectPositionX: processObjectPositionValue,
|
|
499
|
-
objectPositionY: processObjectPositionValue,
|
|
500
|
-
objectFit: processNoopValue,
|
|
497
|
+
objectPosition: (processObjectPosition),
|
|
498
|
+
objectPositionX: (processObjectPositionValue),
|
|
499
|
+
objectPositionY: (processObjectPositionValue),
|
|
500
|
+
objectFit: (processNoopValue),
|
|
501
501
|
};
|
|
502
502
|
|
|
503
503
|
const castInt = (value) => {
|
|
@@ -553,21 +553,22 @@ const processLineHeight = (key, value, container, styles) => {
|
|
|
553
553
|
};
|
|
554
554
|
};
|
|
555
555
|
const handlers$2 = {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
556
|
+
direction: (processNoopValue),
|
|
557
|
+
fontFamily: (processNoopValue),
|
|
558
|
+
fontSize: (processUnitValue),
|
|
559
|
+
fontStyle: (processNoopValue),
|
|
560
|
+
fontWeight: (processFontWeight),
|
|
561
|
+
letterSpacing: (processUnitValue),
|
|
562
|
+
lineHeight: (processLineHeight),
|
|
563
|
+
maxLines: (processNumberValue),
|
|
564
|
+
textAlign: (processNoopValue),
|
|
565
|
+
textDecoration: (processNoopValue),
|
|
566
|
+
textDecorationColor: (processColorValue),
|
|
567
|
+
textDecorationStyle: (processNoopValue),
|
|
568
|
+
textIndent: (processNoopValue),
|
|
569
|
+
textOverflow: (processNoopValue),
|
|
570
|
+
textTransform: (processNoopValue),
|
|
571
|
+
verticalAlign: (processNoopValue),
|
|
571
572
|
};
|
|
572
573
|
|
|
573
574
|
const matchNumber = (value) => typeof value === 'string' && /^-?\d*\.?\d*$/.test(value);
|
|
@@ -686,25 +687,25 @@ const processTransformOriginValue = (key, value, container) => {
|
|
|
686
687
|
};
|
|
687
688
|
const handlers$1 = {
|
|
688
689
|
transform: processTransform,
|
|
689
|
-
transformOrigin: processTransformOriginShorthand,
|
|
690
|
-
transformOriginX: processTransformOriginValue,
|
|
691
|
-
transformOriginY: processTransformOriginValue,
|
|
690
|
+
transformOrigin: (processTransformOriginShorthand),
|
|
691
|
+
transformOriginX: (processTransformOriginValue),
|
|
692
|
+
transformOriginY: (processTransformOriginValue),
|
|
692
693
|
};
|
|
693
694
|
|
|
694
695
|
const handlers = {
|
|
695
|
-
fill: processColorValue,
|
|
696
|
-
stroke: processColorValue,
|
|
697
|
-
strokeDasharray: processNoopValue,
|
|
698
|
-
strokeWidth: processUnitValue,
|
|
699
|
-
fillOpacity: processNumberValue,
|
|
700
|
-
strokeOpacity: processNumberValue,
|
|
701
|
-
fillRule: processNoopValue,
|
|
702
|
-
textAnchor: processNoopValue,
|
|
703
|
-
strokeLinecap: processNoopValue,
|
|
704
|
-
strokeLinejoin: processNoopValue,
|
|
705
|
-
visibility: processNoopValue,
|
|
706
|
-
clipPath: processNoopValue,
|
|
707
|
-
dominantBaseline: processNoopValue,
|
|
696
|
+
fill: (processColorValue),
|
|
697
|
+
stroke: (processColorValue),
|
|
698
|
+
strokeDasharray: (processNoopValue),
|
|
699
|
+
strokeWidth: (processUnitValue),
|
|
700
|
+
fillOpacity: (processNumberValue),
|
|
701
|
+
strokeOpacity: (processNumberValue),
|
|
702
|
+
fillRule: (processNoopValue),
|
|
703
|
+
textAnchor: (processNoopValue),
|
|
704
|
+
strokeLinecap: (processNoopValue),
|
|
705
|
+
strokeLinejoin: (processNoopValue),
|
|
706
|
+
visibility: (processNoopValue),
|
|
707
|
+
clipPath: (processNoopValue),
|
|
708
|
+
dominantBaseline: (processNoopValue),
|
|
708
709
|
};
|
|
709
710
|
|
|
710
711
|
const shorthands = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-pdf/stylesheet",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A styles engine for Node and the browser",
|
|
6
6
|
"author": "Diego Muracciole <diegomuracciole@gmail.com>",
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "vitest",
|
|
18
18
|
"build": "rimraf ./lib && rollup -c",
|
|
19
|
-
"watch": "rimraf ./lib && rollup -c -w"
|
|
19
|
+
"watch": "rimraf ./lib && rollup -c -w",
|
|
20
|
+
"typecheck": "tsc --noEmit"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@react-pdf/fns": "3.1.
|
|
23
|
-
"@react-pdf/types": "^2.8.
|
|
23
|
+
"@react-pdf/fns": "3.1.2",
|
|
24
|
+
"@react-pdf/types": "^2.8.1",
|
|
24
25
|
"color-string": "^1.9.1",
|
|
25
26
|
"hsl-to-hex": "^1.0.0",
|
|
26
27
|
"media-engine": "^1.0.3",
|