@takumi-rs/helpers 0.13.0 → 0.14.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/index.d.ts +87 -20
- package/dist/index.js +1 -1
- package/package.json +12 -10
- package/tsconfig.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type ColorInput = Color | Gradient;
|
|
|
48
48
|
* This corresponds to CSS values that can be specified as pixels, percentages,
|
|
49
49
|
* or the 'auto' keyword for automatic sizing.
|
|
50
50
|
*/
|
|
51
|
-
export type LengthUnit = "auto" | {
|
|
51
|
+
export type LengthUnit = "auto" | "min-content" | "max-content" | {
|
|
52
52
|
"percentage": number;
|
|
53
53
|
} | {
|
|
54
54
|
"rem": number;
|
|
@@ -113,7 +113,7 @@ export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
|
113
113
|
*
|
|
114
114
|
* This enum determines how flex items should wrap within the flex container.
|
|
115
115
|
*/
|
|
116
|
-
export type FlexWrap = "
|
|
116
|
+
export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
|
|
117
117
|
/**
|
|
118
118
|
* Represents font weight as a numeric value.
|
|
119
119
|
*
|
|
@@ -138,7 +138,9 @@ export type GridAutoFlow = "row" | "column" | "row-dense" | "column-dense";
|
|
|
138
138
|
/**
|
|
139
139
|
* Represents a grid placement with serde support
|
|
140
140
|
*/
|
|
141
|
-
export type GridPlacement =
|
|
141
|
+
export type GridPlacement = "auto" | {
|
|
142
|
+
"span": number;
|
|
143
|
+
} | number | string;
|
|
142
144
|
/**
|
|
143
145
|
* Represents a grid line placement with serde support
|
|
144
146
|
*/
|
|
@@ -157,14 +159,14 @@ export type GridLine = {
|
|
|
157
159
|
*/
|
|
158
160
|
export type GridTrackSize = {
|
|
159
161
|
"fr": number;
|
|
160
|
-
} |
|
|
162
|
+
} | LengthUnit;
|
|
161
163
|
/**
|
|
162
164
|
* Defines how flex items are aligned along the main axis.
|
|
163
165
|
*
|
|
164
166
|
* This enum determines how space is distributed between and around flex items
|
|
165
167
|
* along the main axis of the flex container.
|
|
166
168
|
*/
|
|
167
|
-
export type JustifyContent = "start" | "end" | "flex-start" | "flex-end" | "center" | "space-between" | "space-
|
|
169
|
+
export type JustifyContent = "start" | "end" | "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-evenly" | "space-around";
|
|
168
170
|
/**
|
|
169
171
|
* Defines how an image should be resized to fit its container.
|
|
170
172
|
*
|
|
@@ -280,6 +282,14 @@ export type Style = {
|
|
|
280
282
|
* How flex items are aligned along the main axis
|
|
281
283
|
*/
|
|
282
284
|
justify_content?: JustifyContent;
|
|
285
|
+
/**
|
|
286
|
+
* How flex items are aligned along the cross axis when there's extra space
|
|
287
|
+
*/
|
|
288
|
+
align_content?: JustifyContent;
|
|
289
|
+
/**
|
|
290
|
+
* How grid items are aligned along the inline (row) axis
|
|
291
|
+
*/
|
|
292
|
+
justify_items?: AlignItems;
|
|
283
293
|
/**
|
|
284
294
|
* How flex items are aligned along the cross axis
|
|
285
295
|
*/
|
|
@@ -289,7 +299,7 @@ export type Style = {
|
|
|
289
299
|
*/
|
|
290
300
|
flex_wrap: FlexWrap;
|
|
291
301
|
/**
|
|
292
|
-
* The initial size of the flex item
|
|
302
|
+
* The initial size of the flex item before growing or shrinking
|
|
293
303
|
*/
|
|
294
304
|
flex_basis: LengthUnit;
|
|
295
305
|
/**
|
|
@@ -297,19 +307,19 @@ export type Style = {
|
|
|
297
307
|
*/
|
|
298
308
|
position: Position$1;
|
|
299
309
|
/**
|
|
300
|
-
* Spacing between flex items
|
|
310
|
+
* Spacing between flex items or grid tracks
|
|
301
311
|
*/
|
|
302
312
|
gap: Gap;
|
|
303
313
|
/**
|
|
304
|
-
* How much the element should grow relative to other flex items
|
|
314
|
+
* How much the element should grow relative to other flex items (0.0 = no growth)
|
|
305
315
|
*/
|
|
306
316
|
flex_grow: number;
|
|
307
317
|
/**
|
|
308
|
-
* How much the element should shrink relative to other flex items
|
|
318
|
+
* How much the element should shrink relative to other flex items (0.0 = no shrinking)
|
|
309
319
|
*/
|
|
310
320
|
flex_shrink: number;
|
|
311
321
|
/**
|
|
312
|
-
* Width of the element's border
|
|
322
|
+
* Width of the element's border on each side
|
|
313
323
|
*/
|
|
314
324
|
border_width: SidesValue<LengthUnit>;
|
|
315
325
|
/**
|
|
@@ -396,7 +406,60 @@ export type Style = {
|
|
|
396
406
|
* Letter spacing for text rendering
|
|
397
407
|
* Value is measured in EM units
|
|
398
408
|
*/
|
|
399
|
-
letter_spacing?:
|
|
409
|
+
letter_spacing?: LengthUnit;
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* Style properties that can be inherited by child elements.
|
|
413
|
+
*
|
|
414
|
+
* These properties are typically passed down from parent to child elements
|
|
415
|
+
* in the layout hierarchy, such as font settings and colors.
|
|
416
|
+
*/
|
|
417
|
+
export type InheritableStyle = {
|
|
418
|
+
/**
|
|
419
|
+
* How text should be overflowed
|
|
420
|
+
*/
|
|
421
|
+
text_overflow?: TextOverflow;
|
|
422
|
+
/**
|
|
423
|
+
* Color of the element's border
|
|
424
|
+
*/
|
|
425
|
+
border_color?: ColorInput;
|
|
426
|
+
/**
|
|
427
|
+
* Text color for child text elements
|
|
428
|
+
*/
|
|
429
|
+
color?: ColorInput;
|
|
430
|
+
/**
|
|
431
|
+
* Font size in pixels for text rendering
|
|
432
|
+
*/
|
|
433
|
+
font_size?: LengthUnit;
|
|
434
|
+
/**
|
|
435
|
+
* Font family name for text rendering
|
|
436
|
+
*/
|
|
437
|
+
font_family?: string;
|
|
438
|
+
/**
|
|
439
|
+
* Line height multiplier for text spacing
|
|
440
|
+
*/
|
|
441
|
+
line_height?: LengthUnit;
|
|
442
|
+
/**
|
|
443
|
+
* Font weight for text rendering
|
|
444
|
+
*/
|
|
445
|
+
font_weight?: FontWeight;
|
|
446
|
+
/**
|
|
447
|
+
* Maximum number of lines for text before truncation
|
|
448
|
+
*/
|
|
449
|
+
line_clamp?: number;
|
|
450
|
+
/**
|
|
451
|
+
* Corner radius for rounded borders in pixels
|
|
452
|
+
*/
|
|
453
|
+
border_radius?: SidesValue<LengthUnit>;
|
|
454
|
+
/**
|
|
455
|
+
* Text alignment within the element
|
|
456
|
+
*/
|
|
457
|
+
text_align?: TextAlign;
|
|
458
|
+
/**
|
|
459
|
+
* Letter spacing for text rendering
|
|
460
|
+
* Value is measured in EM units
|
|
461
|
+
*/
|
|
462
|
+
letter_spacing?: LengthUnit;
|
|
400
463
|
};
|
|
401
464
|
/**
|
|
402
465
|
* Represents a value that can be a specific length, percentage, or automatic.
|
|
@@ -414,24 +477,27 @@ export type AnyNode = {
|
|
|
414
477
|
type: string;
|
|
415
478
|
[key: string]: JsonValue;
|
|
416
479
|
};
|
|
417
|
-
export type
|
|
418
|
-
export type
|
|
419
|
-
|
|
480
|
+
export type PartialStyle = Partial<Style>;
|
|
481
|
+
export type JsxParsedStyle = {
|
|
482
|
+
[key in keyof Style]: Style[key] | undefined;
|
|
483
|
+
};
|
|
484
|
+
type Node$1 = ContainerNode | TextNode | ImageNode | AnyNode;
|
|
485
|
+
export type ContainerNode = PartialStyle & {
|
|
420
486
|
type: "container";
|
|
421
|
-
children?: Node[];
|
|
487
|
+
children?: Node$1[];
|
|
422
488
|
};
|
|
423
|
-
export type TextNode =
|
|
489
|
+
export type TextNode = PartialStyle & {
|
|
424
490
|
type: "text";
|
|
425
491
|
text: string;
|
|
426
492
|
};
|
|
427
|
-
export type ImageNode =
|
|
493
|
+
export type ImageNode = PartialStyle & {
|
|
428
494
|
type: "image";
|
|
429
495
|
src: string;
|
|
430
496
|
};
|
|
431
497
|
export declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
|
|
432
|
-
export declare function text(text: string, style?:
|
|
433
|
-
export declare function image(src: string, style?:
|
|
434
|
-
export declare function style(style:
|
|
498
|
+
export declare function text(text: string, style?: PartialStyle): TextNode;
|
|
499
|
+
export declare function image(src: string, style?: PartialStyle): ImageNode;
|
|
500
|
+
export declare function style(style: PartialStyle): Partial<Style>;
|
|
435
501
|
/**
|
|
436
502
|
* Convert a number to a percentage struct.
|
|
437
503
|
* @param percentage - The percentage to convert (0.0 - 100.0).
|
|
@@ -462,6 +528,7 @@ export declare function gradient(from: ColorInput, to: ColorInput, angle?: numbe
|
|
|
462
528
|
};
|
|
463
529
|
|
|
464
530
|
export {
|
|
531
|
+
Node$1 as Node,
|
|
465
532
|
Position$1 as Position,
|
|
466
533
|
};
|
|
467
534
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(e){return{type:"container",...e}}function i(e,t){return{...t,type:"text",text:e}}function s(e,t){return{...t,type:"image",src:e}}function a(e){return e}function n(e){return{percentage:e}}function l(e){return{vw:e}}function p(e){return{vh:e}}function h(e){return{em:e}}function m(e){return{rem:e}}function f(e){return{fr:e}}function u(e,t,o=0){return{from:e,to:t,angle:o}}export{l as vw,p as vh,i as text,a as style,m as rem,n as percentage,s as image,u as gradient,f as fr,h as em,r as container};
|
package/package.json
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/helpers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "me@kane.tw",
|
|
6
6
|
"name": "Kane Wang",
|
|
7
7
|
"url": "https://kane.tw"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"package.json",
|
|
12
|
-
"README.md",
|
|
13
|
-
"tsconfig.json"
|
|
14
|
-
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "bun build.ts"
|
|
17
|
-
},
|
|
18
9
|
"repository": {
|
|
19
10
|
"url": "git+https://github.com/kane50613/takumi.git"
|
|
20
11
|
},
|
|
@@ -22,12 +13,23 @@
|
|
|
22
13
|
"@types/bun": "catalog:",
|
|
23
14
|
"@types/react": "^19.1.8",
|
|
24
15
|
"bun-plugin-dts": "^0.3.0",
|
|
16
|
+
"csstype": "^3.1.3",
|
|
17
|
+
"react": "^19.1.0",
|
|
25
18
|
"typescript": "catalog:"
|
|
26
19
|
},
|
|
27
20
|
"exports": {
|
|
28
21
|
"types": "./dist/index.d.ts",
|
|
29
22
|
"default": "./dist/index.js"
|
|
30
23
|
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json",
|
|
27
|
+
"README.md",
|
|
28
|
+
"tsconfig.json"
|
|
29
|
+
],
|
|
31
30
|
"license": "MIT",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "bun build.ts"
|
|
33
|
+
},
|
|
32
34
|
"type": "module"
|
|
33
35
|
}
|