@react-hive/honey-style 2.0.0 → 2.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-style",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "react",
@@ -1,115 +0,0 @@
1
- import * as CSS from 'csstype';
2
- export type HoneyCSSClassName = string | undefined;
3
- /**
4
- * Represents a hexadecimal color value.
5
- *
6
- * Examples:
7
- * - `'#ffffff'`
8
- * - `'#123abc'`
9
- * - `'#000'`
10
- */
11
- export type HoneyHEXColor = `#${string}`;
12
- /**
13
- * Represents any valid CSS color, either a named color (like `'red'`, `'blue'`)
14
- * or a hexadecimal color code (like `'#ff0000'`).
15
- */
16
- export type HoneyCSSColor = HoneyHEXColor | CSS.DataType.NamedColor | CSS.Globals;
17
- /**
18
- * Represents absolute CSS dimension units.
19
- *
20
- * These units are fixed in physical measurements.
21
- *
22
- * - `'px'` — pixels
23
- * - `'cm'` — centimeters
24
- * - `'mm'` — millimeters
25
- * - `'in'` — inches
26
- * - `'pt'` — points
27
- * - `'pc'` — picas
28
- */
29
- type HoneyCSSAbsoluteDimensionUnit = 'px' | 'cm' | 'mm' | 'in' | 'pt' | 'pc';
30
- /**
31
- * Represents relative CSS dimension units.
32
- *
33
- * These units scale depending on the context.
34
- *
35
- * - `'em'` — relative to the font-size of the element
36
- * - `'rem'` — relative to the font-size of the root element
37
- * - `'%'` — percentage of the parent element
38
- * - `'vh'` — 1% of the viewport height
39
- * - `'vw'` — 1% of the viewport width
40
- * - `'vmin'` — 1% of the smaller dimension of the viewport
41
- * - `'vmax'` — 1% of the larger dimension of the viewport
42
- */
43
- type HoneyCSSRelativeDimensionUnit = 'em' | 'rem' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax';
44
- /**
45
- * Represents any valid CSS dimension unit, including both absolute and relative types.
46
- */
47
- export type HoneyCSSDimensionUnit = HoneyCSSAbsoluteDimensionUnit | HoneyCSSRelativeDimensionUnit;
48
- /**
49
- * Represents a numeric CSS dimension value with an optional specific unit.
50
- *
51
- * This type can represent:
52
- * - A value with a specific CSS unit, such as `'8px'`, `'1.5rem'`, or `'100%'`.
53
- * - The special value `'auto'` commonly used for flexible layout values.
54
- *
55
- * @template Unit - The CSS unit to use (e.g., `'px'`, `'em'`, `'rem'`).
56
- */
57
- export type HoneyCSSDimensionValue<Unit extends HoneyCSSDimensionUnit = HoneyCSSDimensionUnit> = `${number}${Unit}` | 'auto';
58
- /**
59
- * Represents a tuple of 2 to 4 values using standard CSS shorthand conventions.
60
- *
61
- * This type models how properties like `margin`, `padding`, `gap`, and `borderRadius`
62
- * can accept multiple values to control different sides or axes.
63
- *
64
- * Value interpretation follows CSS shorthand behavior:
65
- * - `[T, T]` → [top & bottom, left & right]
66
- * - `[T, T, T]` → [top, left & right, bottom]
67
- * - `[T, T, T, T]` → [top, right, bottom, left]
68
- *
69
- * @template T - The type of each spacing value (e.g., number, string, or token).
70
- */
71
- export type HoneyCSSShorthandTuple<T> = [T, T] | [T, T, T] | [T, T, T, T];
72
- /**
73
- * Converts a tuple of spacing values into a valid CSS shorthand string using a consistent unit.
74
- *
75
- * Acts as a type-level converter that transforms 2–4 spacing values (e.g., `[8, 12]`) into a space-separated
76
- * CSS string (e.g., `'8px 12px'`), suitable for shorthand-compatible properties like `margin`, `padding`, or `gap`.
77
- *
78
- * This type enforces unit consistency across all values and is useful for generating precise, typed spacing strings.
79
- *
80
- * Example outputs:
81
- * - `'8px 12px'` for `[8, 12]`
82
- * - `'1rem 2rem 1.5rem'` for `[1, 2, 1.5]`
83
- * - `'4px 8px 12px 16px'` for `[4, 8, 12, 16]`
84
- *
85
- * @template Tuple - A tuple of 2 to 4 values to be converted into a CSS shorthand string.
86
- * @template Unit - The CSS unit to apply to each value (e.g., `'px'`, `'rem'`, `'%'`).
87
- */
88
- export type HoneyCSSShorthandDimensionOutput<Tuple extends HoneyCSSShorthandTuple<unknown>, Unit extends HoneyCSSDimensionUnit> = Tuple extends [unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Tuple extends [unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : Tuple extends [unknown, unknown, unknown, unknown] ? `${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>} ${HoneyCSSDimensionValue<Unit>}` : never;
89
- /**
90
- * Represents a CSS layout value that can be a single value or a shorthand array of values.
91
- *
92
- * Useful for properties like `margin`, `padding`, or `borderRadius`, which allow:
93
- * - A single value (applied to all sides)
94
- * - A tuple of 2–4 values using standard CSS shorthand behavior
95
- *
96
- * Examples:
97
- * - `'8px'`
98
- * - `['8px', '12px']`
99
- * - `['8px', '12px', '16px', '20px']`
100
- *
101
- * @template T - The type of each individual value.
102
- */
103
- export type HoneyCSSMultiValue<T> = T | HoneyCSSShorthandTuple<T>;
104
- /**
105
- * Represents a spacing value used in layout-related CSS properties.
106
- *
107
- * Can be:
108
- * - A single numeric value (e.g., `8`)
109
- * - A single dimension string (e.g., `'1rem'`)
110
- * - A shorthand array of 2–4 values (e.g., `[8, 12]` or `['1rem', '2rem', '1.5rem']`)
111
- *
112
- * Commonly used for properties like `margin`, `padding`, `gap`, etc.
113
- */
114
- export type HoneyCSSSpacingValue = HoneyCSSMultiValue<number | HoneyCSSDimensionValue>;
115
- export {};
File without changes
File without changes