@hypergood/css-core 0.0.4 → 0.1.1

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/dist/index.cjs CHANGED
@@ -22,7 +22,9 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  css: () => css,
24
24
  keyframes: () => keyframes,
25
- mergeClassNames: () => mergeClassNames
25
+ mergeClassNames: () => mergeClassNames,
26
+ styled: () => styled,
27
+ variants: () => variants
26
28
  });
27
29
  module.exports = __toCommonJS(index_exports);
28
30
 
@@ -33,6 +35,12 @@ function css(styleObject) {
33
35
  function keyframes(styleObject) {
34
36
  throw new Error("RAHHH");
35
37
  }
38
+ function styled(component, styleObject) {
39
+ throw new Error("RAHHH");
40
+ }
41
+ function variants(variantsObject) {
42
+ throw new Error("RAHHH");
43
+ }
36
44
  function mergeClassNames(classNames) {
37
45
  let cleanNames = classNames.filter((element) => typeof element === "string").join(" ").split(/\s+/);
38
46
  let classMap = /* @__PURE__ */ Object.create(null);
@@ -49,6 +57,8 @@ function mergeClassNames(classNames) {
49
57
  0 && (module.exports = {
50
58
  css,
51
59
  keyframes,
52
- mergeClassNames
60
+ mergeClassNames,
61
+ styled,
62
+ variants
53
63
  });
54
64
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/runtime.ts"],"sourcesContent":["export * from \"./runtime.js\";\n","export function css(styleObject: any): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function keyframes(styleObject: any): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function mergeClassNames(\n classNames: Array<string | boolean | null | undefined>,\n): string {\n let cleanNames = classNames\n .filter((element) => typeof element === \"string\")\n .join(\" \")\n .split(/\\s+/);\n\n let classMap = Object.create(null) as Record<string, string>;\n for (let className of cleanNames) {\n if (className.startsWith(\"x\") && className.includes(\"-\")) {\n classMap[className.split(\"-\")[0]!] = className;\n } else {\n classMap[className] = className;\n }\n }\n\n return Object.values(classMap).join(\" \");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,IAAI,aAA0B;AAC5C,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,UAAU,aAA0B;AAClD,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,gBACd,YACQ;AACR,MAAI,aAAa,WACd,OAAO,CAAC,YAAY,OAAO,YAAY,QAAQ,EAC/C,KAAK,GAAG,EACR,MAAM,KAAK;AAEd,MAAI,WAAW,uBAAO,OAAO,IAAI;AACjC,WAAS,aAAa,YAAY;AAChC,QAAI,UAAU,WAAW,GAAG,KAAK,UAAU,SAAS,GAAG,GAAG;AACxD,eAAS,UAAU,MAAM,GAAG,EAAE,CAAC,CAAE,IAAI;AAAA,IACvC,OAAO;AACL,eAAS,SAAS,IAAI;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,QAAQ,EAAE,KAAK,GAAG;AACzC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/runtime.ts"],"sourcesContent":["export * from \"./runtime.js\";\n","import type { CSSProperties } from \"./css-properties.js\";\n\nexport type {\n CSSProp,\n CSSProperties,\n CSSPropItem,\n CSSValue,\n} from \"./css-properties.js\";\n\n/**\n * The style object accepted by `styled()`: top-level CSS properties plus the\n * optional `variants` and `defaultVariants` keys.\n */\nexport type StyledStyleObject = CSSProperties & {\n variants?: Record<string, Record<string, CSSProperties>>;\n defaultVariants?: Record<string, string | number | boolean>;\n};\n\nexport function css(styleObject: CSSProperties): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function keyframes(styleObject: Record<string, CSSProperties>): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function styled(component: any, styleObject: StyledStyleObject): any {\n throw new Error(\"RAHHH\");\n}\n\nexport function variants<\n T extends Record<string, Record<string, CSSProperties>>,\n>(variantsObject: T): { [K in keyof T]: string } {\n throw new Error(\"RAHHH\");\n}\n\nexport function mergeClassNames(\n classNames: Array<string | boolean | null | undefined>,\n): string {\n let cleanNames = classNames\n .filter((element) => typeof element === \"string\")\n .join(\" \")\n .split(/\\s+/);\n\n let classMap = Object.create(null) as Record<string, string>;\n for (let className of cleanNames) {\n if (className.startsWith(\"x\") && className.includes(\"-\")) {\n classMap[className.split(\"-\")[0]!] = className;\n } else {\n classMap[className] = className;\n }\n }\n\n return Object.values(classMap).join(\" \");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkBO,SAAS,IAAI,aAAoC;AACtD,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,UAAU,aAAoD;AAC5E,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,OAAO,WAAgB,aAAqC;AAC1E,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,SAEd,gBAA+C;AAC/C,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,gBACd,YACQ;AACR,MAAI,aAAa,WACd,OAAO,CAAC,YAAY,OAAO,YAAY,QAAQ,EAC/C,KAAK,GAAG,EACR,MAAM,KAAK;AAEd,MAAI,WAAW,uBAAO,OAAO,IAAI;AACjC,WAAS,aAAa,YAAY;AAChC,QAAI,UAAU,WAAW,GAAG,KAAK,UAAU,SAAS,GAAG,GAAG;AACxD,eAAS,UAAU,MAAM,GAAG,EAAE,CAAC,CAAE,IAAI;AAAA,IACvC,OAAO;AACL,eAAS,SAAS,IAAI;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,QAAQ,EAAE,KAAK,GAAG;AACzC;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,29 @@
1
- declare function css(styleObject: any): string;
2
- declare function keyframes(styleObject: any): string;
1
+ import * as CSS from 'csstype';
2
+
3
+ type CSSValue = string | number | Array<string | number> | CSSProperties;
4
+ type KnownCSSValue<K extends keyof CSS.Properties> = CSS.Properties[K] | number | Array<string | number> | CSSProperties;
5
+ type CSSProperties = {
6
+ [K in keyof CSS.Properties]?: KnownCSSValue<K>;
7
+ } & {
8
+ [key: string]: CSSValue;
9
+ };
10
+ type CSSPropItem = string | boolean | CSSProperties | null | undefined;
11
+ type CSSProp = CSSPropItem | CSSPropItem[];
12
+
13
+ /**
14
+ * The style object accepted by `styled()`: top-level CSS properties plus the
15
+ * optional `variants` and `defaultVariants` keys.
16
+ */
17
+ type StyledStyleObject = CSSProperties & {
18
+ variants?: Record<string, Record<string, CSSProperties>>;
19
+ defaultVariants?: Record<string, string | number | boolean>;
20
+ };
21
+ declare function css(styleObject: CSSProperties): string;
22
+ declare function keyframes(styleObject: Record<string, CSSProperties>): string;
23
+ declare function styled(component: any, styleObject: StyledStyleObject): any;
24
+ declare function variants<T extends Record<string, Record<string, CSSProperties>>>(variantsObject: T): {
25
+ [K in keyof T]: string;
26
+ };
3
27
  declare function mergeClassNames(classNames: Array<string | boolean | null | undefined>): string;
4
28
 
5
- export { css, keyframes, mergeClassNames };
29
+ export { type CSSProp, type CSSPropItem, type CSSProperties, type CSSValue, type StyledStyleObject, css, keyframes, mergeClassNames, styled, variants };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,29 @@
1
- declare function css(styleObject: any): string;
2
- declare function keyframes(styleObject: any): string;
1
+ import * as CSS from 'csstype';
2
+
3
+ type CSSValue = string | number | Array<string | number> | CSSProperties;
4
+ type KnownCSSValue<K extends keyof CSS.Properties> = CSS.Properties[K] | number | Array<string | number> | CSSProperties;
5
+ type CSSProperties = {
6
+ [K in keyof CSS.Properties]?: KnownCSSValue<K>;
7
+ } & {
8
+ [key: string]: CSSValue;
9
+ };
10
+ type CSSPropItem = string | boolean | CSSProperties | null | undefined;
11
+ type CSSProp = CSSPropItem | CSSPropItem[];
12
+
13
+ /**
14
+ * The style object accepted by `styled()`: top-level CSS properties plus the
15
+ * optional `variants` and `defaultVariants` keys.
16
+ */
17
+ type StyledStyleObject = CSSProperties & {
18
+ variants?: Record<string, Record<string, CSSProperties>>;
19
+ defaultVariants?: Record<string, string | number | boolean>;
20
+ };
21
+ declare function css(styleObject: CSSProperties): string;
22
+ declare function keyframes(styleObject: Record<string, CSSProperties>): string;
23
+ declare function styled(component: any, styleObject: StyledStyleObject): any;
24
+ declare function variants<T extends Record<string, Record<string, CSSProperties>>>(variantsObject: T): {
25
+ [K in keyof T]: string;
26
+ };
3
27
  declare function mergeClassNames(classNames: Array<string | boolean | null | undefined>): string;
4
28
 
5
- export { css, keyframes, mergeClassNames };
29
+ export { type CSSProp, type CSSPropItem, type CSSProperties, type CSSValue, type StyledStyleObject, css, keyframes, mergeClassNames, styled, variants };
package/dist/index.js CHANGED
@@ -5,6 +5,12 @@ function css(styleObject) {
5
5
  function keyframes(styleObject) {
6
6
  throw new Error("RAHHH");
7
7
  }
8
+ function styled(component, styleObject) {
9
+ throw new Error("RAHHH");
10
+ }
11
+ function variants(variantsObject) {
12
+ throw new Error("RAHHH");
13
+ }
8
14
  function mergeClassNames(classNames) {
9
15
  let cleanNames = classNames.filter((element) => typeof element === "string").join(" ").split(/\s+/);
10
16
  let classMap = /* @__PURE__ */ Object.create(null);
@@ -20,6 +26,8 @@ function mergeClassNames(classNames) {
20
26
  export {
21
27
  css,
22
28
  keyframes,
23
- mergeClassNames
29
+ mergeClassNames,
30
+ styled,
31
+ variants
24
32
  };
25
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/runtime.ts"],"sourcesContent":["export function css(styleObject: any): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function keyframes(styleObject: any): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function mergeClassNames(\n classNames: Array<string | boolean | null | undefined>,\n): string {\n let cleanNames = classNames\n .filter((element) => typeof element === \"string\")\n .join(\" \")\n .split(/\\s+/);\n\n let classMap = Object.create(null) as Record<string, string>;\n for (let className of cleanNames) {\n if (className.startsWith(\"x\") && className.includes(\"-\")) {\n classMap[className.split(\"-\")[0]!] = className;\n } else {\n classMap[className] = className;\n }\n }\n\n return Object.values(classMap).join(\" \");\n}\n"],"mappings":";AAAO,SAAS,IAAI,aAA0B;AAC5C,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,UAAU,aAA0B;AAClD,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,gBACd,YACQ;AACR,MAAI,aAAa,WACd,OAAO,CAAC,YAAY,OAAO,YAAY,QAAQ,EAC/C,KAAK,GAAG,EACR,MAAM,KAAK;AAEd,MAAI,WAAW,uBAAO,OAAO,IAAI;AACjC,WAAS,aAAa,YAAY;AAChC,QAAI,UAAU,WAAW,GAAG,KAAK,UAAU,SAAS,GAAG,GAAG;AACxD,eAAS,UAAU,MAAM,GAAG,EAAE,CAAC,CAAE,IAAI;AAAA,IACvC,OAAO;AACL,eAAS,SAAS,IAAI;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,QAAQ,EAAE,KAAK,GAAG;AACzC;","names":[]}
1
+ {"version":3,"sources":["../src/runtime.ts"],"sourcesContent":["import type { CSSProperties } from \"./css-properties.js\";\n\nexport type {\n CSSProp,\n CSSProperties,\n CSSPropItem,\n CSSValue,\n} from \"./css-properties.js\";\n\n/**\n * The style object accepted by `styled()`: top-level CSS properties plus the\n * optional `variants` and `defaultVariants` keys.\n */\nexport type StyledStyleObject = CSSProperties & {\n variants?: Record<string, Record<string, CSSProperties>>;\n defaultVariants?: Record<string, string | number | boolean>;\n};\n\nexport function css(styleObject: CSSProperties): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function keyframes(styleObject: Record<string, CSSProperties>): string {\n throw new Error(\"RAHHH\");\n}\n\nexport function styled(component: any, styleObject: StyledStyleObject): any {\n throw new Error(\"RAHHH\");\n}\n\nexport function variants<\n T extends Record<string, Record<string, CSSProperties>>,\n>(variantsObject: T): { [K in keyof T]: string } {\n throw new Error(\"RAHHH\");\n}\n\nexport function mergeClassNames(\n classNames: Array<string | boolean | null | undefined>,\n): string {\n let cleanNames = classNames\n .filter((element) => typeof element === \"string\")\n .join(\" \")\n .split(/\\s+/);\n\n let classMap = Object.create(null) as Record<string, string>;\n for (let className of cleanNames) {\n if (className.startsWith(\"x\") && className.includes(\"-\")) {\n classMap[className.split(\"-\")[0]!] = className;\n } else {\n classMap[className] = className;\n }\n }\n\n return Object.values(classMap).join(\" \");\n}\n"],"mappings":";AAkBO,SAAS,IAAI,aAAoC;AACtD,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,UAAU,aAAoD;AAC5E,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,OAAO,WAAgB,aAAqC;AAC1E,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,SAEd,gBAA+C;AAC/C,QAAM,IAAI,MAAM,OAAO;AACzB;AAEO,SAAS,gBACd,YACQ;AACR,MAAI,aAAa,WACd,OAAO,CAAC,YAAY,OAAO,YAAY,QAAQ,EAC/C,KAAK,GAAG,EACR,MAAM,KAAK;AAEd,MAAI,WAAW,uBAAO,OAAO,IAAI;AACjC,WAAS,aAAa,YAAY;AAChC,QAAI,UAAU,WAAW,GAAG,KAAK,UAAU,SAAS,GAAG,GAAG;AACxD,eAAS,UAAU,MAAM,GAAG,EAAE,CAAC,CAAE,IAAI;AAAA,IACvC,OAAO;AACL,eAAS,SAAS,IAAI;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,QAAQ,EAAE,KAAK,GAAG;AACzC;","names":[]}