@navita/types 0.0.11 → 3.0.0-next.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.
Files changed (2) hide show
  1. package/index.d.ts +25 -32
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,64 +1,57 @@
1
- import { AtRule, Properties, SimplePseudos, AdvancedPseudos } from 'csstype';
1
+ import { AdvancedPseudos, AtRule, Properties, SimplePseudos } from "csstype";
2
2
 
3
+ //#region src/index.d.ts
3
4
  type ImportMap = {
4
- callee: string;
5
- source: string;
5
+ callee: string;
6
+ source: string;
6
7
  }[];
7
8
  type RawCSSVarFunction = `--${string}`;
8
9
  type CSSVarFunction = `var(--${string})` | `var(--${string}, ${string | number})`;
9
10
  type Contract = {
10
- [key: string]: CSSVarFunction | null | Contract;
11
+ [key: string]: CSSVarFunction | null | Contract;
11
12
  };
12
13
  type Primitive = string | boolean | number | null | undefined;
13
- type MapLeafNodes<Obj, LeafType> = {
14
- [Prop in keyof Obj]: Obj[Prop] extends Primitive ? LeafType : Obj[Prop] extends Record<string | number, any> ? MapLeafNodes<Obj[Prop], LeafType> : never;
15
- };
14
+ type MapLeafNodes<Obj, LeafType> = { [Prop in keyof Obj]: Obj[Prop] extends Primitive ? LeafType : Obj[Prop] extends Record<string | number, unknown> ? MapLeafNodes<Obj[Prop], LeafType> : never };
16
15
  type NullableTokens = {
17
- [key: string]: string | number | NullableTokens | null;
16
+ [key: string]: string | number | NullableTokens | null;
18
17
  };
19
18
  type Tokens = {
20
- [key: string]: string | number | Tokens;
19
+ [key: string]: string | number | Tokens;
21
20
  };
22
21
  type ThemeVars<ThemeContract extends NullableTokens> = MapLeafNodes<ThemeContract, CSSVarFunction>;
23
- type GlobalFontFaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>;
24
- type FontFaceRule = Omit<GlobalFontFaceRule, 'fontFamily'>;
22
+ type GlobalFontFaceRule = Omit<AtRule.FontFaceFallback, "src"> & Required<Pick<AtRule.FontFaceFallback, "src">>;
23
+ type FontFaceRule = Omit<GlobalFontFaceRule, "fontFamily">;
25
24
  interface ContainerProperties {
26
- container?: string;
27
- containerType?: 'size' | 'inline-size' | (string & {});
28
- containerName?: string;
25
+ container?: string;
26
+ containerType?: "size" | "inline-size" | (string & {});
27
+ containerName?: string;
29
28
  }
30
29
  type CSSTypeProperties = Properties<number | (string & {})> & ContainerProperties;
31
- type CSSProperties = {
32
- [Property in keyof CSSTypeProperties]: CSSTypeProperties[Property] | CSSVarFunction | RawCSSVarFunction;
33
- };
30
+ type CSSProperties = { [Property in keyof CSSTypeProperties]: CSSTypeProperties[Property] | CSSVarFunction | RawCSSVarFunction };
34
31
  interface CSSKeyframes {
35
- [time: string]: CSSProperties;
32
+ [time: string]: CSSProperties;
36
33
  }
37
34
  interface MediaQueries<StyleType> {
38
- [string: `@media${string}`]: StyleType;
35
+ [string: `@media${string}`]: StyleType;
39
36
  }
40
37
  interface FeatureQueries<StyleType> {
41
- [string: `@supports${string}`]: StyleType;
38
+ [string: `@supports${string}`]: StyleType;
42
39
  }
43
40
  interface ContainerQueries<StyleType> {
44
- [string: `@container${string}`]: StyleType;
41
+ [string: `@container${string}`]: StyleType;
45
42
  }
46
43
  type WithQueries<StyleType> = MediaQueries<StyleType & FeatureQueries<StyleType & ContainerQueries<StyleType>> & ContainerQueries<StyleType & FeatureQueries<StyleType>>> & FeatureQueries<StyleType & MediaQueries<StyleType & ContainerQueries<StyleType>> & ContainerQueries<StyleType & MediaQueries<StyleType>>> & ContainerQueries<StyleType & MediaQueries<StyleType & FeatureQueries<StyleType>> & FeatureQueries<StyleType & MediaQueries<StyleType>>>;
47
44
  interface WithDirectDescendants<StyleType> {
48
- [string: `>${string}`]: StyleType;
45
+ [string: `>${string}`]: StyleType;
49
46
  }
50
47
  interface WithNestedSelectors<StyleRule> {
51
- [string: `&${string}`]: StyleRule;
48
+ [string: `&${string}`]: StyleRule;
52
49
  }
53
- type WithSimplePseudoSelectors<StyleType> = {
54
- [key in `${SimplePseudos}${string}`]?: StyleType;
55
- };
56
- type WithAdvancedPseudoSelectors<StyleType> = {
57
- [key in `${AdvancedPseudos}${string}`]?: StyleType;
58
- };
50
+ type WithSimplePseudoSelectors<StyleType> = { [key in `${SimplePseudos}${string}`]?: StyleType };
51
+ type WithAdvancedPseudoSelectors<StyleType> = { [key in `${AdvancedPseudos}${string}`]?: StyleType };
59
52
  interface StyleRule extends CSSProperties, WithQueries<StyleRule>, WithSimplePseudoSelectors<StyleRule>, WithAdvancedPseudoSelectors<StyleRule>, WithDirectDescendants<StyleRule>, WithNestedSelectors<StyleRule> {
60
- [string: `--${string}`]: string | number;
53
+ [string: `--${string}`]: string | number;
61
54
  }
62
55
  type GlobalStyleRule = StyleRule;
63
-
64
- export { CSSKeyframes, CSSProperties, CSSVarFunction, Contract, FontFaceRule, GlobalFontFaceRule, GlobalStyleRule, ImportMap, MapLeafNodes, NullableTokens, RawCSSVarFunction, StyleRule, ThemeVars, Tokens, WithQueries };
56
+ //#endregion
57
+ export { CSSKeyframes, CSSProperties, CSSVarFunction, Contract, FontFaceRule, GlobalFontFaceRule, GlobalStyleRule, ImportMap, MapLeafNodes, NullableTokens, RawCSSVarFunction, StyleRule, ThemeVars, Tokens, WithQueries };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navita/types",
3
- "version": "0.0.11",
3
+ "version": "3.0.0-next.0",
4
4
  "description": "Shared types for Navita packages",
5
5
  "keywords": [
6
6
  "types",