silva-ui 1.2.0 → 1.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/README.md +11 -0
- package/dist/library/previews/index.html +1 -1
- package/dist/library/silva-ui.js +524 -446
- package/dist/types/core/projection.d.ts +16 -0
- package/dist/types/core/sprinkles.css.d.ts +10 -0
- package/dist/types/core/types.d.ts +2 -2
- package/dist/types/core/utils.d.ts +3 -1
- package/dist/types/index.d.ts +3 -1
- package/package.json +46 -46
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A semantic size token calibrated at a 1000px-wide viewport.
|
|
3
|
+
*
|
|
4
|
+
* `$2.4` resolves to `24px` at 1000px, `12px` at 500px, and `48px` at
|
|
5
|
+
* 2000px. The value stays linear rather than stepping between breakpoints.
|
|
6
|
+
*/
|
|
7
|
+
export type ProjectionToken = `$${number}`;
|
|
8
|
+
/** True when a value is a valid non-negative projection token such as `$24`. */
|
|
9
|
+
export declare function isProjectionToken(value: unknown): value is ProjectionToken;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves `$n` to a viewport-relative CSS value.
|
|
12
|
+
*
|
|
13
|
+
* `n` is one tenth of the token's pixel size at the 1000px reference viewport.
|
|
14
|
+
* Since one viewport-width unit is 10px there, `$n` is equivalently `n vw`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function projectionTokenToCss(token: ProjectionToken): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProjectionToken } from './projection';
|
|
1
2
|
export declare const tokens: {
|
|
2
3
|
space: {
|
|
3
4
|
none: string;
|
|
@@ -949,3 +950,12 @@ export declare const sprinkles: ((props: {
|
|
|
949
950
|
properties: Set<"alignItems" | "alignSelf" | "backgroundColor" | "bg" | "borderColor" | "borderRadius" | "borderStyle" | "borderWidth" | "bottom" | "color" | "cursor" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontSize" | "fontWeight" | "gap" | "h" | "height" | "justifyContent" | "left" | "letterSpacing" | "lineHeight" | "m" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "mb" | "minHeight" | "minWidth" | "ml" | "mr" | "mt" | "mx" | "my" | "objectFit" | "opacity" | "overflow" | "overflowX" | "overflowY" | "p" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pb" | "pl" | "pointerEvents" | "position" | "pr" | "pt" | "px" | "py" | "right" | "textAlign" | "textDecoration" | "textTransform" | "top" | "userSelect" | "visibility" | "w" | "whiteSpace" | "width" | "wordBreak" | "zIndex">;
|
|
950
951
|
};
|
|
951
952
|
export type Sprinkles = Parameters<typeof sprinkles>[0];
|
|
953
|
+
/**
|
|
954
|
+
* Sprinkles properties that also accept a fluid projection token such as
|
|
955
|
+
* `$2.4`. The numeric part is one tenth of its pixel value at the 1000px reference viewport.
|
|
956
|
+
*/
|
|
957
|
+
export type ProjectionProperty = 'gap' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight' | 'width' | 'height' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'fontSize' | 'borderRadius' | 'top' | 'right' | 'bottom' | 'left' | 'p' | 'px' | 'py' | 'pt' | 'pb' | 'pl' | 'pr' | 'm' | 'mx' | 'my' | 'mt' | 'mb' | 'ml' | 'mr' | 'w' | 'h';
|
|
958
|
+
/** Sprinkles extended with dynamic, linearly projected numeric size tokens. */
|
|
959
|
+
export type ProjectionSprinkles = Omit<Sprinkles, ProjectionProperty> & {
|
|
960
|
+
[Property in ProjectionProperty]?: Sprinkles[Property] | ProjectionToken;
|
|
961
|
+
};
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* We keep JSX/framework types minimal and use `children?: any`
|
|
5
5
|
* so the library works with Hono JSX, Preact, or plain string rendering.
|
|
6
6
|
*/
|
|
7
|
-
import type { Sprinkles } from './sprinkles.css';
|
|
7
|
+
import type { ProjectionSprinkles, Sprinkles } from './sprinkles.css';
|
|
8
8
|
import type { AnimationName } from './visuals.css';
|
|
9
9
|
import type { GradientName } from './gradients';
|
|
10
10
|
/** Props common to every silva-ui primitive. */
|
|
11
|
-
export type BaseProps = Omit<
|
|
11
|
+
export type BaseProps = Omit<ProjectionSprinkles, 'backgroundColor' | 'color'> & {
|
|
12
12
|
/** Named gradients work with `backgroundColor` and `color` in addition to theme color tokens. */
|
|
13
13
|
backgroundColor?: Sprinkles['backgroundColor'] | GradientName;
|
|
14
14
|
color?: Sprinkles['color'] | GradientName;
|
|
@@ -3,7 +3,9 @@ import { type Sprinkles } from './sprinkles.css';
|
|
|
3
3
|
* Split a props object into sprinkles props and the remaining "rest" props.
|
|
4
4
|
*
|
|
5
5
|
* This lets components accept both sprinkles tokens *and* arbitrary HTML
|
|
6
|
-
* attributes without manually destructuring every sprinkles key.
|
|
6
|
+
* attributes without manually destructuring every sprinkles key. Projection
|
|
7
|
+
* tokens are converted to inline fluid CSS because `$n` is intentionally an
|
|
8
|
+
* open numeric scale, rather than a generated list of atomic classes.
|
|
7
9
|
*/
|
|
8
10
|
export declare function splitSprinklesProps<T extends Record<string, unknown>>(props: T): {
|
|
9
11
|
sprinklesProps: Sprinkles;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { sprinkles, tokens } from './core/sprinkles.css';
|
|
2
|
-
export type { Sprinkles } from './core/sprinkles.css';
|
|
2
|
+
export type { ProjectionProperty, ProjectionSprinkles, Sprinkles } from './core/sprinkles.css';
|
|
3
|
+
export { isProjectionToken, projectionTokenToCss } from './core/projection';
|
|
4
|
+
export type { ProjectionToken } from './core/projection';
|
|
3
5
|
export { cls, splitSprinklesProps, toSprinklesClass } from './core/utils';
|
|
4
6
|
export { gradientToCss } from './core/gradient';
|
|
5
7
|
export type { Gradient, GradientColor } from './core/gradient';
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silva-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A Hono JSX UI component library with framework-neutral styling and Tamagui-inspired theming.",
|
|
5
5
|
"main": "./dist/library/silva-ui.js",
|
|
6
6
|
"module": "./dist/library/silva-ui.js",
|
|
7
7
|
"types": "./dist/types/index.d.ts",
|
|
8
8
|
"style": "./dist/library/silva-ui.css",
|
|
9
9
|
"exports": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/library/silva-ui.js",
|
|
13
|
+
"default": "./dist/library/silva-ui.js"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": {
|
|
16
|
+
"types": "./style.css.d.ts",
|
|
17
|
+
"default": "./dist/library/silva-ui.css"
|
|
18
|
+
}
|
|
19
19
|
},
|
|
20
20
|
"sideEffects": [
|
|
21
|
-
|
|
21
|
+
"**/*.css"
|
|
22
22
|
],
|
|
23
23
|
"files": [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
"dist/library",
|
|
25
|
+
"dist/types",
|
|
26
|
+
"style.css.d.ts",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"build:library": "vite build --config vite.library.config.ts",
|
|
34
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
35
|
+
"build:package": "npm run build:library && npm run build:types",
|
|
36
|
+
"profile:library": "vite build --config vite.library.config.ts --profile",
|
|
37
|
+
"pack:check": "npm run build:package && npm pack --dry-run",
|
|
38
|
+
"preview": "vite preview",
|
|
39
|
+
"typecheck": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
"ui",
|
|
43
|
+
"ui-components",
|
|
44
|
+
"component-library",
|
|
45
|
+
"design-system",
|
|
46
|
+
"hono",
|
|
47
|
+
"hono-jsx",
|
|
48
|
+
"jsx",
|
|
49
|
+
"typescript",
|
|
50
|
+
"vanilla-extract",
|
|
51
|
+
"sprinkles",
|
|
52
|
+
"theming",
|
|
53
|
+
"accessible"
|
|
54
54
|
],
|
|
55
55
|
"author": "BlackSilva",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"type": "module",
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
|
|
59
|
+
"hono": "^4.13.13"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
"@vanilla-extract/css": "^1.21.3",
|
|
63
|
+
"@vanilla-extract/sprinkles": "^1.7.1",
|
|
64
|
+
"@vanilla-extract/vite-plugin": "^5.2.6",
|
|
65
|
+
"hono": "^4.13.13",
|
|
66
|
+
"typescript": "^7.0.2",
|
|
67
|
+
"vite": "^8.3.4"
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/black-silva/silva-ui.git"
|
|
72
72
|
}
|
|
73
73
|
}
|