@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.
Files changed (51) hide show
  1. package/README.md +23 -19
  2. package/bin/bin-util.d.ts +2 -0
  3. package/bin/index.cjs +22 -0
  4. package/bin/index.d.ts +2 -0
  5. package/bin/index.js +5800 -0
  6. package/bin/logger.d.ts +1 -0
  7. package/bin/prettier.d.ts +1 -0
  8. package/compiler/index.cjs +11 -0
  9. package/compiler/index.d.ts +16 -0
  10. package/compiler/index.js +174 -0
  11. package/config/config-types.d.ts +59 -0
  12. package/config/define-config.d.ts +2 -0
  13. package/config/index.cjs +1 -0
  14. package/config/index.d.ts +2 -0
  15. package/config/index.js +4 -0
  16. package/css/index.cjs +1 -0
  17. package/css/index.d.ts +1 -0
  18. package/css/index.js +4 -0
  19. package/dash-case-DKzpenwY.cjs +1 -0
  20. package/dash-case-DMQMcCO6.js +19 -0
  21. package/generator/index.cjs +1 -0
  22. package/generator/index.d.ts +1 -0
  23. package/generator/index.js +61 -0
  24. package/generator/parse-modifiers.d.ts +3 -0
  25. package/generator/parse-styles.d.ts +2 -0
  26. package/generator/parse-templates.d.ts +2 -0
  27. package/generator/parse-tokens.d.ts +2 -0
  28. package/generator/parser-types.d.ts +4 -0
  29. package/generator/style-generator.d.ts +28 -0
  30. package/index-84Wroia-.cjs +1 -0
  31. package/index-D_732b92.js +4 -0
  32. package/package.json +34 -20
  33. package/parse-templates-D4p3pgQR.js +92 -0
  34. package/parse-templates-W0YfTmOT.cjs +8 -0
  35. package/pascal-case-BQpR5PdN.js +6 -0
  36. package/pascal-case-iWoaJWwT.cjs +1 -0
  37. package/react-styled-file-CGVf5n1B.js +11 -0
  38. package/react-styled-file-Dkubsz-U.cjs +8 -0
  39. package/salty.config-BupieCfE.cjs +6 -0
  40. package/salty.config-D9ANEDiH.js +9 -0
  41. package/types/index.cjs +1 -0
  42. package/types/index.d.ts +63 -0
  43. package/types/index.js +1 -0
  44. package/types/util-types.d.ts +13 -0
  45. package/util/camel-case.d.ts +1 -0
  46. package/util/dash-case.d.ts +1 -0
  47. package/util/index.cjs +1 -0
  48. package/util/index.d.ts +4 -0
  49. package/util/index.js +11 -0
  50. package/util/pascal-case.d.ts +1 -0
  51. package/util/to-hash.d.ts +4 -0
@@ -0,0 +1,6 @@
1
+ function p(e) {
2
+ return e ? typeof e != "string" ? p(String(e)) : e.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (a) => a[1].toUpperCase()).replace(/^[a-z]/, (a) => a.toUpperCase()) : "";
3
+ }
4
+ export {
5
+ p
6
+ };
@@ -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,11 @@
1
+ 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
+ })`;
9
+ export {
10
+ e as default
11
+ };
@@ -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;
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=`import { defineConfig } from '@salty-css/core/config';
2
+
3
+ export const config = defineConfig({
4
+ // Add your custom config here
5
+ });
6
+ `;exports.default=o;
@@ -0,0 +1,9 @@
1
+ const n = `import { defineConfig } from '@salty-css/core/config';
2
+
3
+ export const config = defineConfig({
4
+ // Add your custom config here
5
+ });
6
+ `;
7
+ export {
8
+ n as default
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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;
@@ -0,0 +1,4 @@
1
+ export * from './camel-case';
2
+ export * from './dash-case';
3
+ export * from './pascal-case';
4
+ export * from './to-hash';
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;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Create unique hash string from any value
3
+ */
4
+ export declare const toHash: (value: unknown, length?: number) => string;