@salty-css/core 0.0.1-alpha.2 → 0.0.1-alpha.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +23 -19
- package/bin/bin-util.d.ts +2 -0
- package/bin/index.cjs +22 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +5800 -0
- package/bin/logger.d.ts +1 -0
- package/bin/prettier.d.ts +1 -0
- package/compiler/index.cjs +11 -0
- package/compiler/index.d.ts +16 -0
- package/compiler/index.js +174 -0
- package/config/config-types.d.ts +59 -0
- package/config/define-config.d.ts +2 -0
- package/config/index.cjs +1 -0
- package/config/index.d.ts +2 -0
- package/config/index.js +4 -0
- package/css/index.cjs +1 -0
- package/css/index.d.ts +1 -0
- package/css/index.js +4 -0
- package/dash-case-DKzpenwY.cjs +1 -0
- package/dash-case-DMQMcCO6.js +19 -0
- package/generator/index.cjs +1 -0
- package/generator/index.d.ts +1 -0
- package/generator/index.js +61 -0
- package/generator/parse-modifiers.d.ts +3 -0
- package/generator/parse-styles.d.ts +2 -0
- package/generator/parse-templates.d.ts +2 -0
- package/generator/parse-tokens.d.ts +2 -0
- package/generator/parser-types.d.ts +4 -0
- package/generator/style-generator.d.ts +28 -0
- package/index-84Wroia-.cjs +1 -0
- package/index-D_732b92.js +4 -0
- package/package.json +34 -20
- package/parse-templates-D4p3pgQR.js +92 -0
- package/parse-templates-W0YfTmOT.cjs +8 -0
- package/pascal-case-BQpR5PdN.js +6 -0
- package/pascal-case-iWoaJWwT.cjs +1 -0
- package/react-styled-file-CGVf5n1B.js +11 -0
- package/react-styled-file-Dkubsz-U.cjs +8 -0
- package/salty.config-BupieCfE.cjs +6 -0
- package/salty.config-D9ANEDiH.js +9 -0
- package/types/index.cjs +1 -0
- package/types/index.d.ts +63 -0
- package/types/index.js +1 -0
- package/types/util-types.d.ts +13 -0
- package/util/camel-case.d.ts +1 -0
- package/util/dash-case.d.ts +1 -0
- package/util/index.cjs +1 -0
- package/util/index.d.ts +4 -0
- package/util/index.js +11 -0
- package/util/pascal-case.d.ts +1 -0
- package/util/to-hash.d.ts +4 -0
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[-_]([a-z0-9])/g,a=>a[1].toUpperCase()).replace(/^[a-z]/,a=>a.toUpperCase()):""}exports.pascalCase=r;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { styled } from "@salty-css/react/styled";
|
2
|
+
|
3
|
+
export const <%- name %> = styled('<%- tag %>', {
|
4
|
+
<% if(className) { %>className: '<%- className %>',<% } %>
|
5
|
+
base: {
|
6
|
+
// Add your styles here
|
7
|
+
}
|
8
|
+
})`;exports.default=e;
|
package/types/index.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
package/types/index.d.ts
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
|
2
|
+
import { StyleComponentGenerator } from '../generator';
|
3
|
+
import { OrString } from './util-types';
|
4
|
+
export type CreateElementProps = {
|
5
|
+
extend?: Tag<any>;
|
6
|
+
children?: ReactNode;
|
7
|
+
className?: string;
|
8
|
+
element?: string;
|
9
|
+
passVariantProps?: boolean;
|
10
|
+
style?: any;
|
11
|
+
/** vks = Variant key set */
|
12
|
+
_vks?: Set<string>;
|
13
|
+
};
|
14
|
+
export type StyledComponentProps = Record<string, unknown> & CreateElementProps;
|
15
|
+
type FnComponent<PROPS extends StyledComponentProps> = {
|
16
|
+
(props: PROPS): ReactNode;
|
17
|
+
generator?: StyleComponentGenerator;
|
18
|
+
};
|
19
|
+
export type Tag<PROPS extends StyledComponentProps> = OrString | keyof ReactDOM | FnComponent<PROPS>;
|
20
|
+
export type CompoundVariant = {
|
21
|
+
[key: PropertyKey]: any;
|
22
|
+
css: CssStyles;
|
23
|
+
};
|
24
|
+
type InvalidVariantKeys = keyof AllHTMLAttributes<HTMLElement>;
|
25
|
+
type StyleKeys = keyof Required<AllHTMLAttributes<HTMLElement>>['style'];
|
26
|
+
export type StyleValue<K extends string> = K extends StyleKeys ? Required<AllHTMLAttributes<HTMLElement>>['style'][K] : never;
|
27
|
+
type VariantOptions = {
|
28
|
+
[key in InvalidVariantKeys]?: never;
|
29
|
+
};
|
30
|
+
type Variants = {
|
31
|
+
variants?: VariantOptions & {
|
32
|
+
[key: PropertyKey]: {
|
33
|
+
[key: string]: Styles;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
defaultVariants?: {
|
37
|
+
[key: PropertyKey]: any;
|
38
|
+
};
|
39
|
+
compoundVariants?: CompoundVariant[];
|
40
|
+
};
|
41
|
+
type VariantPropValue<T> = T extends 'true' ? 'true' | true : T;
|
42
|
+
export type VariantProps<STYLES extends StyledParams> = STYLES['variants'] extends undefined ? object : {
|
43
|
+
[K in keyof STYLES['variants']]?: VariantPropValue<keyof STYLES['variants'][K]> | '';
|
44
|
+
};
|
45
|
+
type CssValuePropKey = `props-${string}`;
|
46
|
+
export type ValueProps = {
|
47
|
+
[key: CssValuePropKey]: string;
|
48
|
+
};
|
49
|
+
export type ParentComponentProps<TAG extends Tag<any>> = TAG extends (props: infer P) => ReactNode ? P : unknown;
|
50
|
+
type StylePropertyValue = Record<never, never> & unknown;
|
51
|
+
export type CssStyles = {
|
52
|
+
[key in StyleKeys | OrString]?: StyleValue<key> | StylePropertyValue | PropertyValueToken | CssStyles;
|
53
|
+
};
|
54
|
+
export type Styles = CssStyles & Variants;
|
55
|
+
export interface GeneratorOptions {
|
56
|
+
className?: string;
|
57
|
+
displayName?: string;
|
58
|
+
element?: string;
|
59
|
+
}
|
60
|
+
export interface StyledParams extends GeneratorOptions, Variants {
|
61
|
+
base?: CssStyles;
|
62
|
+
}
|
63
|
+
export {};
|
package/types/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export type CommonRecord<TYPE = unknown> = Record<PropertyKey, TYPE>;
|
2
|
+
export type IsUnion<T, U extends T = T> = T extends unknown ? ([U] extends [T] ? false : true) : false;
|
3
|
+
export type IsSpecifiedString<T> = T extends string ? (string extends T ? false : true) : false;
|
4
|
+
export type NeverObj = Record<never, never>;
|
5
|
+
export type OrAny = any & NeverObj;
|
6
|
+
export type NotFunction = string | number | boolean | object | null | undefined | CommonRecord;
|
7
|
+
export type OrT<T> = T & NeverObj;
|
8
|
+
export type OrString = OrT<string>;
|
9
|
+
export type OrNumber = OrT<number>;
|
10
|
+
export type ReplaceAny<TYPE, WITH = unknown> = TYPE extends any ? WITH : TYPE;
|
11
|
+
export type BothTrue<T, U> = T extends true ? (U extends true ? true : false) : false;
|
12
|
+
export type EitherTrue<T, U> = T extends true ? true : U extends true ? true : false;
|
13
|
+
export type Tail<T extends any[]> = ((...args: T) => any) extends (arg: any, ...rest: infer R) => any ? R : never;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function camelCase(str: PropertyKey): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function dashCase(str: PropertyKey): string;
|
package/util/index.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../dash-case-DKzpenwY.cjs"),t=require("../pascal-case-iWoaJWwT.cjs");function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/\s/g,"-").replace(/-([a-z])/g,r=>r[1].toUpperCase()):""}exports.dashCase=a.dashCase;exports.toHash=a.toHash;exports.pascalCase=t.pascalCase;exports.camelCase=s;
|
package/util/index.d.ts
ADDED
package/util/index.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { d as o, t as s } from "../dash-case-DMQMcCO6.js";
|
2
|
+
import { p as f } from "../pascal-case-BQpR5PdN.js";
|
3
|
+
function r(e) {
|
4
|
+
return e ? typeof e != "string" ? r(String(e)) : e.replace(/\s/g, "-").replace(/-([a-z])/g, (a) => a[1].toUpperCase()) : "";
|
5
|
+
}
|
6
|
+
export {
|
7
|
+
r as camelCase,
|
8
|
+
o as dashCase,
|
9
|
+
f as pascalCase,
|
10
|
+
s as toHash
|
11
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function pascalCase(str: PropertyKey): string;
|