@salty-css/react 0.0.1-alpha.3 → 0.0.1-alpha.300
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 +490 -43
- package/class-name-client.cjs +1 -0
- package/class-name-client.d.ts +7 -0
- package/class-name-client.js +15 -0
- package/class-name.cjs +1 -0
- package/class-name.d.ts +10 -0
- package/class-name.js +20 -0
- package/clsx-C11secjj.cjs +1 -0
- package/clsx-OuTLNxxd.js +16 -0
- package/config.cjs +1 -0
- package/config.d.ts +1 -0
- package/config.js +1 -0
- package/dynamic-styles.cjs +2 -0
- package/dynamic-styles.d.ts +23 -0
- package/dynamic-styles.js +29 -0
- package/element-factory-BPI0pGIH.cjs +1 -0
- package/element-factory-D5vMsSwp.js +56 -0
- package/element-factory.d.ts +3 -0
- package/helpers.cjs +1 -0
- package/helpers.d.ts +1 -0
- package/helpers.js +1 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/keyframes.cjs +1 -0
- package/keyframes.d.ts +1 -0
- package/keyframes.js +1 -0
- package/media.cjs +1 -0
- package/media.d.ts +1 -0
- package/media.js +1 -0
- package/package.json +38 -3
- package/styled-client.cjs +1 -0
- package/styled-client.d.ts +3 -0
- package/styled-client.js +5 -0
- package/styled.cjs +1 -0
- package/styled.d.ts +5 -0
- package/styled.js +13 -0
- package/dist/README.md +0 -107
- package/dist/element-factory-CHdv47Y_.js +0 -52
- package/dist/element-factory-DvBlAL2I.cjs +0 -1
- package/dist/element-factory.d.ts +0 -2
- package/dist/keyframes.cjs +0 -1
- package/dist/keyframes.d.ts +0 -22
- package/dist/keyframes.js +0 -30
- package/dist/media.cjs +0 -1
- package/dist/media.d.ts +0 -71
- package/dist/media.js +0 -81
- package/dist/package.json +0 -42
- package/dist/parse-styles-BRv2UFN0.js +0 -87
- package/dist/parse-styles-PkK9Yzyn.cjs +0 -7
- package/dist/styled-client.cjs +0 -1
- package/dist/styled-client.d.ts +0 -2
- package/dist/styled-client.js +0 -7
- package/dist/styled.cjs +0 -1
- package/dist/styled.d.ts +0 -3
- package/dist/styled.js +0 -60
@@ -0,0 +1,23 @@
|
|
1
|
+
import { BaseStyles } from '@salty-css/core/types';
|
2
|
+
import { HTMLAttributes } from 'react';
|
3
|
+
/**
|
4
|
+
* Create a hash of the dynamic styles that then can be used as scope.
|
5
|
+
*/
|
6
|
+
export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
7
|
+
/**
|
8
|
+
* Add any dynamic styles to your app with a custom scope.
|
9
|
+
* Note: this works only with server components.
|
10
|
+
*/
|
11
|
+
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
12
|
+
type AnyComponent = (...args: any[]) => React.ReactNode;
|
13
|
+
interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
14
|
+
styles?: BaseStyles;
|
15
|
+
scope?: string;
|
16
|
+
as?: string | AnyComponent;
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Add any dynamic styles to your app with a custom scope.
|
20
|
+
* Note: this works only with server components.
|
21
|
+
*/
|
22
|
+
export declare const DynamicStyles: ({ as, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element | null>;
|
23
|
+
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { jsx as s, jsxs as p, Fragment as y } from "react/jsx-runtime";
|
2
|
+
import { parseStyles as u } from "@salty-css/core/parsers";
|
3
|
+
import { resolveDynamicConfigCache as g } from "@salty-css/core/cache/resolve-dynamic-config-cache";
|
4
|
+
import { toHash as d } from "@salty-css/core/util";
|
5
|
+
import { c as h } from "./clsx-OuTLNxxd.js";
|
6
|
+
import { createElement as C } from "react";
|
7
|
+
const w = (t) => d(t), i = async (t, r) => {
|
8
|
+
const n = await g();
|
9
|
+
return (await u(t, r, n)).join(`
|
10
|
+
`);
|
11
|
+
}, E = async ({ as: t, scope: r, styles: n, ...o }) => {
|
12
|
+
if (t) {
|
13
|
+
const c = (a) => typeof t == "string" ? C(t, a) : t(a);
|
14
|
+
if (!n) return /* @__PURE__ */ s(c, { ...o });
|
15
|
+
const e = w(n), l = await i(n, r || `.${e}`), f = { ...o, className: h(e, o.className) };
|
16
|
+
return /* @__PURE__ */ p(y, { children: [
|
17
|
+
/* @__PURE__ */ s("style", { children: l }),
|
18
|
+
/* @__PURE__ */ s(c, { ...f })
|
19
|
+
] });
|
20
|
+
}
|
21
|
+
if (!n) return null;
|
22
|
+
const m = await i(n, r);
|
23
|
+
return /* @__PURE__ */ s("style", { children: m });
|
24
|
+
};
|
25
|
+
export {
|
26
|
+
E as DynamicStyles,
|
27
|
+
w as getDynamicStylesClassName,
|
28
|
+
i as getDynamicStylesCss
|
29
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const S=require("react"),C=require("./clsx-C11secjj.cjs"),N=require("@salty-css/core/util"),F=require("@salty-css/core/parsers"),R=["passProps"],v=(E,y="",t={},m)=>{const K=({extend:l=E,element:h=t.element,className:O="",children:$,passProps:f=t.passProps,_vks:c=new Set,...a},w)=>{const s={passProps:f};t.attr&&Object.assign(s,t.attr),m&&Object.assign(s,m),t.defaultProps&&Object.assign(a,t.defaultProps),a&&Object.assign(s,a);const o=new Set([...y.split(" "),...O.split(" ")]),d=typeof l=="function"||typeof l=="object",r=d&&"isStyled"in l,j=d?l:h||l;if(!j)throw new Error("No element provided");const u=s.style||{};s.style||(s.style=u),Object.entries(u).forEach(([e,i])=>{const n=F.parseVariableTokens(i);n&&(u[e]=n.transformed)}),t.propValueKeys&&t.propValueKeys.forEach(e=>{const i=`css-${e}`,n=a[i];if(n===void 0)return;const q=`--props-${N.dashCase(e)}`;u[q]=n,c&&c.add(i)}),t.variantKeys&&t.variantKeys.forEach(e=>{const[i,n]=e.split("=");a[i]!==void 0?(o.add(`${i}-${a[i]}`),c&&c.add(i)):n!==void 0&&o.add(`${i}-${n}`)}),c&&(!d||!r)?c.forEach(e=>{if(!f)return delete s[e];if(f!==!0&&!f.includes(e))return delete s[e]}):r&&Object.assign(s,{_vks:c}),r||R.forEach(e=>delete s[e]);const V=C.clsx(...o);return S.createElement(j,{element:d?h:void 0,className:V,ref:w,...s},$)},b=S.forwardRef(K);return Object.assign(b,{isStyled:!0,className:y,toString:()=>`.${t.hash}`}),b};exports.elementFactory=v;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { forwardRef as V, createElement as C } from "react";
|
2
|
+
import { c as N } from "./clsx-OuTLNxxd.js";
|
3
|
+
import { dashCase as R } from "@salty-css/core/util";
|
4
|
+
import { parseVariableTokens as p } from "@salty-css/core/parsers";
|
5
|
+
const q = ["passProps"], B = (S, m = "", t = {}, y) => {
|
6
|
+
const b = V(({
|
7
|
+
extend: c = S,
|
8
|
+
element: h = t.element,
|
9
|
+
className: E = "",
|
10
|
+
children: K,
|
11
|
+
passProps: l = t.passProps,
|
12
|
+
_vks: n = /* @__PURE__ */ new Set(),
|
13
|
+
...a
|
14
|
+
}, O) => {
|
15
|
+
const s = { passProps: l };
|
16
|
+
t.attr && Object.assign(s, t.attr), y && Object.assign(s, y), t.defaultProps && Object.assign(a, t.defaultProps), a && Object.assign(s, a);
|
17
|
+
const r = /* @__PURE__ */ new Set([...m.split(" "), ...E.split(" ")]), o = typeof c == "function" || typeof c == "object", u = o && "isStyled" in c, j = o ? c : h || c;
|
18
|
+
if (!j) throw new Error("No element provided");
|
19
|
+
const d = s.style || {};
|
20
|
+
s.style || (s.style = d), Object.entries(d).forEach(([e, i]) => {
|
21
|
+
const f = p(i);
|
22
|
+
f && (d[e] = f.transformed);
|
23
|
+
}), t.propValueKeys && t.propValueKeys.forEach((e) => {
|
24
|
+
const i = `css-${e}`, f = a[i];
|
25
|
+
if (f === void 0) return;
|
26
|
+
const w = `--props-${R(e)}`;
|
27
|
+
d[w] = f, n && n.add(i);
|
28
|
+
}), t.variantKeys && t.variantKeys.forEach((e) => {
|
29
|
+
const [i, f] = e.split("=");
|
30
|
+
a[i] !== void 0 ? (r.add(`${i}-${a[i]}`), n && n.add(i)) : f !== void 0 && r.add(`${i}-${f}`);
|
31
|
+
}), n && (!o || !u) ? n.forEach((e) => {
|
32
|
+
if (!l) return delete s[e];
|
33
|
+
if (l !== !0 && !l.includes(e))
|
34
|
+
return delete s[e];
|
35
|
+
}) : u && Object.assign(s, { _vks: n }), u || q.forEach((e) => delete s[e]);
|
36
|
+
const $ = N(...r);
|
37
|
+
return C(
|
38
|
+
j,
|
39
|
+
{
|
40
|
+
element: o ? h : void 0,
|
41
|
+
className: $,
|
42
|
+
ref: O,
|
43
|
+
...s
|
44
|
+
},
|
45
|
+
K
|
46
|
+
);
|
47
|
+
});
|
48
|
+
return Object.assign(b, {
|
49
|
+
isStyled: !0,
|
50
|
+
className: m,
|
51
|
+
toString: () => `.${t.hash}`
|
52
|
+
}), b;
|
53
|
+
};
|
54
|
+
export {
|
55
|
+
B as e
|
56
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { StyledComponentProps, Tag } from '@salty-css/core/types';
|
2
|
+
import { StyledGeneratorClientProps } from '@salty-css/core/generators';
|
3
|
+
export declare const elementFactory: (tagName: Tag<any>, _className?: string, _generatorProps?: StyledGeneratorClientProps, _additionalProps?: Record<PropertyKey, any>) => import('react').ForwardRefExoticComponent<Omit<StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
|
package/helpers.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/helpers");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
package/helpers.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@salty-css/core/helpers';
|
package/helpers.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@salty-css/core/helpers";
|
package/index.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
package/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@salty-css/core/css';
|
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@salty-css/core/css";
|
package/keyframes.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css/keyframes");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
package/keyframes.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@salty-css/core/css/keyframes';
|
package/keyframes.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@salty-css/core/css/keyframes";
|
package/media.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css/media");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
package/media.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@salty-css/core/css/media';
|
package/media.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@salty-css/core/css/media";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/react",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.300",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -10,18 +10,28 @@
|
|
10
10
|
"publishConfig": {
|
11
11
|
"access": "public"
|
12
12
|
},
|
13
|
-
"
|
13
|
+
"description": "React library for Salty CSS",
|
14
|
+
"homepage": "https://salty-css.dev/",
|
15
|
+
"repository": {
|
16
|
+
"type": "git",
|
17
|
+
"url": "git+https://github.com/margarita-form/salty-css.git"
|
18
|
+
},
|
14
19
|
"bugs": {
|
15
20
|
"url": "https://github.com/margarita-form/salty-css/issues"
|
16
21
|
},
|
17
22
|
"files": [
|
18
|
-
"
|
23
|
+
"**/*",
|
19
24
|
"!**/*.tsbuildinfo"
|
20
25
|
],
|
21
26
|
"nx": {
|
27
|
+
"sourceRoot": "libs/react/src",
|
22
28
|
"name": "react"
|
23
29
|
},
|
24
30
|
"exports": {
|
31
|
+
".": {
|
32
|
+
"import": "./index.js",
|
33
|
+
"require": "./index.cjs"
|
34
|
+
},
|
25
35
|
"./styled": {
|
26
36
|
"import": "./styled.js",
|
27
37
|
"require": "./styled.cjs"
|
@@ -30,6 +40,14 @@
|
|
30
40
|
"import": "./styled-client.js",
|
31
41
|
"require": "./styled-client.cjs"
|
32
42
|
},
|
43
|
+
"./class-name": {
|
44
|
+
"import": "./class-name.js",
|
45
|
+
"require": "./class-name.cjs"
|
46
|
+
},
|
47
|
+
"./class-name-client": {
|
48
|
+
"import": "./class-name-client.js",
|
49
|
+
"require": "./class-name-client.cjs"
|
50
|
+
},
|
33
51
|
"./keyframes": {
|
34
52
|
"import": "./keyframes.js",
|
35
53
|
"require": "./keyframes.cjs"
|
@@ -37,6 +55,23 @@
|
|
37
55
|
"./media": {
|
38
56
|
"import": "./media.js",
|
39
57
|
"require": "./media.cjs"
|
58
|
+
},
|
59
|
+
"./config": {
|
60
|
+
"import": "./config.js",
|
61
|
+
"require": "./config.cjs"
|
62
|
+
},
|
63
|
+
"./helpers": {
|
64
|
+
"import": "./helpers.js",
|
65
|
+
"require": "./helpers.cjs"
|
66
|
+
},
|
67
|
+
"./dynamic-styles": {
|
68
|
+
"import": "./dynamic-styles.js",
|
69
|
+
"require": "./dynamic-styles.cjs"
|
40
70
|
}
|
71
|
+
},
|
72
|
+
"dependencies": {
|
73
|
+
"@salty-css/core": "^0.0.1-alpha.300",
|
74
|
+
"clsx": ">=2.x",
|
75
|
+
"react": ">=19.x || >=18.3.x"
|
41
76
|
}
|
42
77
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-BPI0pGIH.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { StyledGeneratorClientProps } from '@salty-css/core/generators';
|
2
|
+
import { Tag } from '@salty-css/core/types';
|
3
|
+
export declare const styledClient: (tagName: Tag<any>, className: string, generatorProps: StyledGeneratorClientProps) => import('react').ForwardRefExoticComponent<Omit<import('@salty-css/core/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
|
package/styled-client.js
ADDED
package/styled.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@salty-css/core/generators"),s=require("./element-factory-BPI0pGIH.cjs"),c=(t,r)=>{const e=new o.StyledGenerator(t,r),n=s.elementFactory(t,e.cssClassName,e.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(n,{generator:e}),n};exports.styled=c;
|
package/styled.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
import { AllHTMLAttributes, JSX, ReactNode } from 'react';
|
2
|
+
import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, ValueProps, Merge } from '@salty-css/core/types';
|
3
|
+
export declare const styled: <const PROPS extends StyledComponentProps, const TAG extends Tag<Required<PROPS>>, const STYLE_PARAMS extends StyledParams>(tagName: TAG, params: STYLE_PARAMS) => ((props: CreateElementProps & (TAG extends string ? {
|
4
|
+
ref?: any;
|
5
|
+
} : object) & Merge<ParentComponentProps<TAG> | VariantProps<STYLE_PARAMS>> & ValueProps & Omit<TAG extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[TAG] : TAG extends string ? AllHTMLAttributes<HTMLElement> : object, keyof CreateElementProps>) => ReactNode) & string;
|
package/styled.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { StyledGenerator as r } from "@salty-css/core/generators";
|
2
|
+
import { e as s } from "./element-factory-D5vMsSwp.js";
|
3
|
+
const i = (t, o) => {
|
4
|
+
const e = new r(t, o), n = s(t, e.cssClassName, e.clientProps, {
|
5
|
+
"data-unoptimized-client-component": !0
|
6
|
+
});
|
7
|
+
return Object.assign(n, {
|
8
|
+
generator: e
|
9
|
+
}), n;
|
10
|
+
};
|
11
|
+
export {
|
12
|
+
i as styled
|
13
|
+
};
|
package/dist/README.md
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
# Salty Css
|
2
|
-
|
3
|
-
## Basic usage example with Button
|
4
|
-
|
5
|
-
### Initial requirements
|
6
|
-
|
7
|
-
1. Add `saltyPlugin` to vite or webpack config from `@salty-css/vite` or `@salty-css/webpack`
|
8
|
-
2. Create `salty-config.ts` to the root of your project
|
9
|
-
3. Import global styles to any regular .css file from `saltygen/index.css` (does not exist during first run, cli command coming later)
|
10
|
-
4. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
|
11
|
-
|
12
|
-
### Code examples
|
13
|
-
|
14
|
-
**Salty config**
|
15
|
-
|
16
|
-
```tsx
|
17
|
-
import { defineConfig } from '@salty-css/core/config';
|
18
|
-
|
19
|
-
export const config = defineConfig({
|
20
|
-
variables: {
|
21
|
-
colors: {
|
22
|
-
brand: '#111',
|
23
|
-
highlight: 'yellow',
|
24
|
-
},
|
25
|
-
},
|
26
|
-
global: {
|
27
|
-
html: {
|
28
|
-
backgroundColor: '#f8f8f8',
|
29
|
-
},
|
30
|
-
},
|
31
|
-
});
|
32
|
-
```
|
33
|
-
|
34
|
-
**Your React component file**
|
35
|
-
|
36
|
-
```tsx
|
37
|
-
import { Wrapper } from '../components/wrapper/wrapper.css';
|
38
|
-
import { Button } from '../components/button/button.css';
|
39
|
-
|
40
|
-
export const IndexPage = () => {
|
41
|
-
return (
|
42
|
-
<Wrapper>
|
43
|
-
<Button variant="solid" onClick={() => alert('It is a button.')}>
|
44
|
-
Outlined
|
45
|
-
</Button>
|
46
|
-
</Wrapper>
|
47
|
-
);
|
48
|
-
};
|
49
|
-
```
|
50
|
-
|
51
|
-
**Wrapper** (`components/wrapper/wrapper.css.ts`)
|
52
|
-
|
53
|
-
```tsx
|
54
|
-
import { styled } from '@salty-css/react/styled';
|
55
|
-
|
56
|
-
export const Wrapper = styled('div', {
|
57
|
-
display: 'block',
|
58
|
-
padding: '2vw',
|
59
|
-
});
|
60
|
-
```
|
61
|
-
|
62
|
-
**Button** (`components/button/button.css.ts`)
|
63
|
-
|
64
|
-
```tsx
|
65
|
-
import { styled } from '@salty-css/react/styled';
|
66
|
-
|
67
|
-
export const Button = styled('button', {
|
68
|
-
display: 'block',
|
69
|
-
padding: `0.6em 1.2em`,
|
70
|
-
border: '1px solid currentColor',
|
71
|
-
background: 'transparent',
|
72
|
-
color: 'currentColor/40',
|
73
|
-
cursor: 'pointer',
|
74
|
-
transition: '200ms',
|
75
|
-
textDecoration: 'none',
|
76
|
-
'&:hover': {
|
77
|
-
background: 'black',
|
78
|
-
borderColor: 'black',
|
79
|
-
color: 'white',
|
80
|
-
},
|
81
|
-
'&:disabled': {
|
82
|
-
opacity: 0.25,
|
83
|
-
pointerEvents: 'none',
|
84
|
-
},
|
85
|
-
variants: {
|
86
|
-
variant: {
|
87
|
-
outlined: {
|
88
|
-
// same as default styles
|
89
|
-
},
|
90
|
-
solid: {
|
91
|
-
'&:not(:hover)': {
|
92
|
-
background: 'black',
|
93
|
-
borderColor: 'black',
|
94
|
-
color: 'white',
|
95
|
-
},
|
96
|
-
'&:hover': {
|
97
|
-
background: 'transparent',
|
98
|
-
borderColor: 'currentColor',
|
99
|
-
color: 'currentColor',
|
100
|
-
},
|
101
|
-
},
|
102
|
-
},
|
103
|
-
},
|
104
|
-
});
|
105
|
-
```
|
106
|
-
|
107
|
-
More examples coming soon
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { createElement as w } from "react";
|
2
|
-
function j(t) {
|
3
|
-
var n, s, e = "";
|
4
|
-
if (typeof t == "string" || typeof t == "number") e += t;
|
5
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
6
|
-
var i = t.length;
|
7
|
-
for (n = 0; n < i; n++) t[n] && (s = j(t[n])) && (e && (e += " "), e += s);
|
8
|
-
} else for (s in t) t[s] && (e && (e += " "), e += s);
|
9
|
-
return e;
|
10
|
-
}
|
11
|
-
function O() {
|
12
|
-
for (var t, n, s = 0, e = "", i = arguments.length; s < i; s++) (t = arguments[s]) && (n = j(t)) && (e && (e += " "), e += n);
|
13
|
-
return e;
|
14
|
-
}
|
15
|
-
const C = ["passVariantProps"], A = (t, n, s, e, i) => {
|
16
|
-
const m = ({
|
17
|
-
extend: c = t,
|
18
|
-
element: g = s,
|
19
|
-
className: p = "",
|
20
|
-
children: E,
|
21
|
-
passVariantProps: S,
|
22
|
-
_vks: f = /* @__PURE__ */ new Set(),
|
23
|
-
...d
|
24
|
-
}) => {
|
25
|
-
const o = { passVariantProps: S };
|
26
|
-
d && Object.assign(o, d), i && Object.assign(o, i);
|
27
|
-
const u = new Set(p.split(" ")), l = typeof c == "function", y = l && "isStyled" in c, b = l ? c : g || c;
|
28
|
-
if (!b) throw new Error("No element provided");
|
29
|
-
e && e.forEach((a) => {
|
30
|
-
const [r, h] = a.split("=");
|
31
|
-
d[r] !== void 0 ? (u.add(`${r}-${d[r]}`), l ? f && f.add(r) : delete o[r]) : h !== void 0 && u.add(`${r}-${h}`);
|
32
|
-
}), f && (!l || !y && !S) ? f.forEach((a) => delete o[a]) : y && Object.assign(o, { _vks: f }), y || C.forEach((a) => delete o[a]);
|
33
|
-
const $ = O(n, ...u);
|
34
|
-
return w(
|
35
|
-
b,
|
36
|
-
{
|
37
|
-
element: l ? g : void 0,
|
38
|
-
className: $,
|
39
|
-
...o
|
40
|
-
},
|
41
|
-
E
|
42
|
-
);
|
43
|
-
};
|
44
|
-
return Object.assign(m, {
|
45
|
-
isStyled: !0,
|
46
|
-
className: n,
|
47
|
-
toString: () => `.${n}`
|
48
|
-
}), m;
|
49
|
-
};
|
50
|
-
export {
|
51
|
-
A as e
|
52
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const w=require("react");function j(t){var n,s,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(s=j(t[n]))&&(e&&(e+=" "),e+=s)}else for(s in t)t[s]&&(e&&(e+=" "),e+=s);return e}function O(){for(var t,n,s=0,e="",o=arguments.length;s<o;s++)(t=arguments[s])&&(n=j(t))&&(e&&(e+=" "),e+=n);return e}const C=["passVariantProps"],V=(t,n,s,e,o)=>{const g=({extend:a=t,element:m=s,className:E="",children:$,passVariantProps:S,_vks:c=new Set,...d})=>{const i={passVariantProps:S};d&&Object.assign(i,d),o&&Object.assign(i,o);const u=new Set(E.split(" ")),f=typeof a=="function",y=f&&"isStyled"in a,b=f?a:m||a;if(!b)throw new Error("No element provided");e&&e.forEach(l=>{const[r,h]=l.split("=");d[r]!==void 0?(u.add(`${r}-${d[r]}`),f?c&&c.add(r):delete i[r]):h!==void 0&&u.add(`${r}-${h}`)}),c&&(!f||!y&&!S)?c.forEach(l=>delete i[l]):y&&Object.assign(i,{_vks:c}),y||C.forEach(l=>delete i[l]);const p=O(n,...u);return w.createElement(b,{element:f?m:void 0,className:p,...i},$)};return Object.assign(g,{isStyled:!0,className:n,toString:()=>`.${n}`}),g};exports.elementFactory=V;
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import { StyledComponentProps, Tag } from '../../core/src/types';
|
2
|
-
export declare const elementFactory: (tagName: Tag<any>, _className: string, _element?: string, _variantKeys?: string[], _additionalProps?: Record<PropertyKey, any>) => ({ extend, element, className, children, passVariantProps, _vks, ...props }: StyledComponentProps) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
|
package/dist/keyframes.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./parse-styles-PkK9Yzyn.cjs"),b=({animationName:u,params:l,appendInitialStyles:m,...t})=>{const s=u||c.toHash(t),n=(r={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:d="forwards",playState:p="running"}={...l,...r},$=`${s} ${e} ${o} ${a} ${i} ${S} ${d} ${p}`;if(!m)return $;const g=c.parseStyles(t.from||t["0%"],"");return`${$};${g}`},y=Object.entries(t).reduce((r,[e,o])=>{const a=c.parseStyles(o,""),i=typeof e=="number"?`${e}%`:e;return`${r}${i}{${a}}`},""),f=`@keyframes ${s} {${y}}`;return Object.assign(n,{toString:n,isKeyframes:!0,animationName:s,css:f,keyframes:t}),n};exports.keyframes=b;
|
package/dist/keyframes.d.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import { CssStyles, StyleValue } from '../../core/src/types';
|
2
|
-
type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
|
3
|
-
type Keyframes = {
|
4
|
-
[key in KeyframeKeys]: CssStyles;
|
5
|
-
};
|
6
|
-
interface KeyframesConfig {
|
7
|
-
animationName?: string;
|
8
|
-
appendInitialStyles?: boolean;
|
9
|
-
params?: KeyframesParams;
|
10
|
-
}
|
11
|
-
interface KeyframesParams {
|
12
|
-
duration?: string;
|
13
|
-
delay?: string;
|
14
|
-
iterationCount?: string | number;
|
15
|
-
easing?: StyleValue<'animationTimingFunction'>;
|
16
|
-
direction?: StyleValue<'animationDirection'>;
|
17
|
-
fillMode?: StyleValue<'animationFillMode'>;
|
18
|
-
playState?: StyleValue<'animationPlayState'>;
|
19
|
-
}
|
20
|
-
type KeyframesProps = Keyframes & KeyframesConfig;
|
21
|
-
export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => string;
|
22
|
-
export {};
|
package/dist/keyframes.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
import { t as b, p as c } from "./parse-styles-BRv2UFN0.js";
|
2
|
-
const C = ({ animationName: m, params: u, appendInitialStyles: f, ...t }) => {
|
3
|
-
const s = m || b(t), e = (r = {}) => {
|
4
|
-
const {
|
5
|
-
duration: n = "500ms",
|
6
|
-
easing: o = "ease-in-out",
|
7
|
-
delay: a = "0s",
|
8
|
-
iterationCount: i = "1",
|
9
|
-
direction: d = "normal",
|
10
|
-
fillMode: y = "forwards",
|
11
|
-
playState: S = "running"
|
12
|
-
} = { ...u, ...r }, $ = `${s} ${n} ${o} ${a} ${i} ${d} ${y} ${S}`;
|
13
|
-
if (!f) return $;
|
14
|
-
const g = c(t.from || t["0%"], "");
|
15
|
-
return `${$};${g}`;
|
16
|
-
}, l = Object.entries(t).reduce((r, [n, o]) => {
|
17
|
-
const a = c(o, ""), i = typeof n == "number" ? `${n}%` : n;
|
18
|
-
return `${r}${i}{${a}}`;
|
19
|
-
}, ""), p = `@keyframes ${s} {${l}}`;
|
20
|
-
return Object.assign(e, {
|
21
|
-
toString: e,
|
22
|
-
isKeyframes: !0,
|
23
|
-
animationName: s,
|
24
|
-
css: p,
|
25
|
-
keyframes: t
|
26
|
-
}), e;
|
27
|
-
};
|
28
|
-
export {
|
29
|
-
C as keyframes
|
30
|
-
};
|
package/dist/media.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{constructor(e="@media"){this.base=e,this.next=t=>{const s=new String(t);return Object.assign(s,{get and(){return new n(`${t} and`)},get or(){return new n(`${t},`)}}),s}}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-width: ${t})`;return this.next(s)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-width: ${t})`;return this.next(s)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-height: ${t})`;return this.next(s)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-height: ${t})`;return this.next(s)}get portrait(){const e=`${this.base} (orientation: portrait)`;return this.next(e)}get landscape(){const e=`${this.base} (orientation: landscape)`;return this.next(e)}prefersColorScheme(e){const t=`${this.base} (prefers-color-scheme: ${e})`;return this.next(t)}get dark(){return this.prefersColorScheme("dark")}get light(){return this.prefersColorScheme("light")}get print(){const e=`${this.base} print`;return this.next(e)}get screen(){const e=`${this.base} screen`;return this.next(e)}get speech(){const e=`${this.base} speech`;return this.next(e)}get all(){const e=`${this.base} all`;return this.next(e)}get not(){const e=`${this.base} not`;return this.next(e)}get reducedMotion(){const e=`${this.base} (prefers-reduced-motion: reduce)`;return this.next(e)}}const r=new n;exports.MediaQueryFactory=n;exports.media=r;
|
package/dist/media.d.ts
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
import { OrNumber, OrString } from '../../core/src/types/util-types';
|
2
|
-
export declare class MediaQueryFactory {
|
3
|
-
private base;
|
4
|
-
constructor(base?: string);
|
5
|
-
private next;
|
6
|
-
custom(value: string): string & {
|
7
|
-
and: MediaQueryFactory;
|
8
|
-
or: MediaQueryFactory;
|
9
|
-
};
|
10
|
-
minWidth(width: OrString | OrNumber): string & {
|
11
|
-
and: MediaQueryFactory;
|
12
|
-
or: MediaQueryFactory;
|
13
|
-
};
|
14
|
-
maxWidth(width: OrString | OrNumber): string & {
|
15
|
-
and: MediaQueryFactory;
|
16
|
-
or: MediaQueryFactory;
|
17
|
-
};
|
18
|
-
minHeight(height: OrString | OrNumber): string & {
|
19
|
-
and: MediaQueryFactory;
|
20
|
-
or: MediaQueryFactory;
|
21
|
-
};
|
22
|
-
maxHeight(height: OrString | OrNumber): string & {
|
23
|
-
and: MediaQueryFactory;
|
24
|
-
or: MediaQueryFactory;
|
25
|
-
};
|
26
|
-
get portrait(): string & {
|
27
|
-
and: MediaQueryFactory;
|
28
|
-
or: MediaQueryFactory;
|
29
|
-
};
|
30
|
-
get landscape(): string & {
|
31
|
-
and: MediaQueryFactory;
|
32
|
-
or: MediaQueryFactory;
|
33
|
-
};
|
34
|
-
prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
|
35
|
-
and: MediaQueryFactory;
|
36
|
-
or: MediaQueryFactory;
|
37
|
-
};
|
38
|
-
get dark(): string & {
|
39
|
-
and: MediaQueryFactory;
|
40
|
-
or: MediaQueryFactory;
|
41
|
-
};
|
42
|
-
get light(): string & {
|
43
|
-
and: MediaQueryFactory;
|
44
|
-
or: MediaQueryFactory;
|
45
|
-
};
|
46
|
-
get print(): string & {
|
47
|
-
and: MediaQueryFactory;
|
48
|
-
or: MediaQueryFactory;
|
49
|
-
};
|
50
|
-
get screen(): string & {
|
51
|
-
and: MediaQueryFactory;
|
52
|
-
or: MediaQueryFactory;
|
53
|
-
};
|
54
|
-
get speech(): string & {
|
55
|
-
and: MediaQueryFactory;
|
56
|
-
or: MediaQueryFactory;
|
57
|
-
};
|
58
|
-
get all(): string & {
|
59
|
-
and: MediaQueryFactory;
|
60
|
-
or: MediaQueryFactory;
|
61
|
-
};
|
62
|
-
get not(): string & {
|
63
|
-
and: MediaQueryFactory;
|
64
|
-
or: MediaQueryFactory;
|
65
|
-
};
|
66
|
-
get reducedMotion(): string & {
|
67
|
-
and: MediaQueryFactory;
|
68
|
-
or: MediaQueryFactory;
|
69
|
-
};
|
70
|
-
}
|
71
|
-
export declare const media: MediaQueryFactory;
|