inferred-types 0.52.3 → 0.52.5

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 (62) hide show
  1. package/dist/constants/Tailwind.d.ts +56 -7
  2. package/dist/constants/Tailwind.d.ts.map +1 -1
  3. package/dist/constants/Tailwind.js +67 -7
  4. package/dist/constants/tsconfig.tsbuildinfo +1 -1
  5. package/dist/index.cjs +148 -26
  6. package/dist/index.js +130 -26
  7. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  8. package/dist/runtime/datetime/asDate.d.ts +1 -1
  9. package/dist/runtime/datetime/asDate.d.ts.map +1 -1
  10. package/dist/runtime/datetime/asDate.js +1 -1
  11. package/dist/runtime/datetime/getDay.d.ts.map +1 -1
  12. package/dist/runtime/datetime/getDay.js +3 -0
  13. package/dist/runtime/datetime/getDaysBetween.d.ts.map +1 -1
  14. package/dist/runtime/datetime/getDaysBetween.js +3 -0
  15. package/dist/runtime/datetime/getWeekNumber.d.ts.map +1 -1
  16. package/dist/runtime/datetime/getWeekNumber.js +3 -0
  17. package/dist/runtime/datetime/isLeapYear.d.ts.map +1 -1
  18. package/dist/runtime/datetime/isLeapYear.js +4 -1
  19. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  20. package/dist/runtime/type-conversion/index.d.ts +1 -0
  21. package/dist/runtime/type-conversion/index.d.ts.map +1 -1
  22. package/dist/runtime/type-conversion/index.js +1 -0
  23. package/dist/runtime/type-conversion/tw-conversion.d.ts +13 -0
  24. package/dist/runtime/type-conversion/tw-conversion.d.ts.map +1 -0
  25. package/dist/runtime/type-conversion/tw-conversion.js +20 -0
  26. package/dist/runtime/type-guards/date-time/isThisWeek.d.ts.map +1 -1
  27. package/dist/runtime/type-guards/date-time/isThisWeek.js +2 -5
  28. package/dist/runtime/type-guards/date-time/isThisYear.d.ts +10 -1
  29. package/dist/runtime/type-guards/date-time/isThisYear.d.ts.map +1 -1
  30. package/dist/runtime/type-guards/date-time/isThisYear.js +17 -23
  31. package/dist/runtime/type-guards/date-time/isTomorrow.d.ts +1 -1
  32. package/dist/runtime/type-guards/date-time/isTomorrow.js +1 -1
  33. package/dist/runtime/type-guards/date-time/isYesterday.d.ts +2 -2
  34. package/dist/runtime/type-guards/date-time/isYesterday.d.ts.map +1 -1
  35. package/dist/runtime/type-guards/date-time/isYesterday.js +1 -1
  36. package/dist/runtime/type-guards/index.d.ts +1 -0
  37. package/dist/runtime/type-guards/index.d.ts.map +1 -1
  38. package/dist/runtime/type-guards/index.js +1 -0
  39. package/dist/runtime/type-guards/tw/index.d.ts +2 -0
  40. package/dist/runtime/type-guards/tw/index.d.ts.map +1 -0
  41. package/dist/runtime/type-guards/tw/index.js +1 -0
  42. package/dist/runtime/type-guards/tw/tw-color.d.ts +79 -0
  43. package/dist/runtime/type-guards/tw/tw-color.d.ts.map +1 -0
  44. package/dist/runtime/type-guards/tw/tw-color.js +105 -0
  45. package/dist/types/string-literals/character-sets/css/sizing.d.ts +4 -4
  46. package/dist/types/string-literals/character-sets/css/sizing.d.ts.map +1 -1
  47. package/dist/types/string-literals/character-sets/tw/TwColor.d.ts +27 -7
  48. package/dist/types/string-literals/character-sets/tw/TwColor.d.ts.map +1 -1
  49. package/dist/types/string-literals/character-sets/tw/TwModifer.d.ts +23 -0
  50. package/dist/types/string-literals/character-sets/tw/TwModifer.d.ts.map +1 -0
  51. package/dist/types/string-literals/character-sets/tw/TwModifer.js +1 -0
  52. package/dist/types/string-literals/character-sets/tw/TwSize.d.ts +8 -0
  53. package/dist/types/string-literals/character-sets/tw/TwSize.d.ts.map +1 -0
  54. package/dist/types/string-literals/character-sets/tw/TwSize.js +1 -0
  55. package/dist/types/string-literals/character-sets/tw/TwTarget.d.ts +56 -0
  56. package/dist/types/string-literals/character-sets/tw/TwTarget.d.ts.map +1 -0
  57. package/dist/types/string-literals/character-sets/tw/TwTarget.js +1 -0
  58. package/dist/types/string-literals/character-sets/tw/index.d.ts +4 -0
  59. package/dist/types/string-literals/character-sets/tw/index.d.ts.map +1 -1
  60. package/dist/types/string-literals/character-sets/tw/index.js +4 -0
  61. package/dist/types/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +1 -1
@@ -15,4 +15,5 @@ export * from "./csv";
15
15
  export * from "./lookupCountry";
16
16
  export * from "./json";
17
17
  export * from "./stripParenthesis";
18
+ export * from "./tw-conversion";
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
@@ -15,3 +15,4 @@ export * from "./csv";
15
15
  export * from "./lookupCountry";
16
16
  export * from "./json";
17
17
  export * from "./stripParenthesis";
18
+ export * from "./tw-conversion";
@@ -0,0 +1,13 @@
1
+ import { TwModifier } from "inferred-types/types";
2
+ /**
3
+ * Extracts all the modifiers found on the passed in string and
4
+ * removes them.
5
+ *
6
+ * **Related:** `getTailwindModifiers`
7
+ */
8
+ export declare const removeTailwindModifiers: (val: string) => string;
9
+ /**
10
+ * Extracts an array of Tailwind Modifiers found at the start of a Tailwind string.
11
+ */
12
+ export declare const getTailwindModifiers: (val: string) => TwModifier[];
13
+ //# sourceMappingURL=tw-conversion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tw-conversion.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-conversion/tw-conversion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAKlD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,MAIrD,CAAA;AAGD;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAS,MAAM,KAAG,UAAU,EAI5D,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { TW_MODIFIERS } from "inferred-types/constants";
2
+ import { isTailwindModifier } from "inferred-types/runtime";
3
+ const MODS = TW_MODIFIERS.map(i => `${i}:`);
4
+ /**
5
+ * Extracts all the modifiers found on the passed in string and
6
+ * removes them.
7
+ *
8
+ * **Related:** `getTailwindModifiers`
9
+ */
10
+ export const removeTailwindModifiers = (val) => {
11
+ return MODS.some(i => val.startsWith(i))
12
+ ? removeTailwindModifiers(val.replace(MODS.find(i => val.startsWith(i)), ""))
13
+ : val;
14
+ };
15
+ /**
16
+ * Extracts an array of Tailwind Modifiers found at the start of a Tailwind string.
17
+ */
18
+ export const getTailwindModifiers = (val) => {
19
+ return val.split(":").filter(i => isTailwindModifier(i));
20
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"isThisWeek.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isThisWeek.ts"],"names":[],"mappings":"AAEA;;;;;;;EAOE;AACF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QACzE,CAAC,KACN,OAYF,CAAC"}
1
+ {"version":3,"file":"isThisWeek.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isThisWeek.ts"],"names":[],"mappings":"AAEA;;;;;;;EAOE;AACF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QACzE,CAAC,KACN,OAWF,CAAC"}
@@ -8,11 +8,8 @@ import { asDate, getWeekNumber } from "inferred-types/runtime";
8
8
  * Luxon DateTime objects, and Moment.js objects.
9
9
  */
10
10
  export const isThisWeek = (date) => {
11
- let targetDate;
12
- try {
13
- targetDate = asDate(date);
14
- }
15
- catch {
11
+ let targetDate = asDate(date);
12
+ if (!targetDate) {
16
13
  return false;
17
14
  }
18
15
  const currentWeek = getWeekNumber();
@@ -1,6 +1,15 @@
1
1
  /**
2
- * Type guard which validates that the passed in `val` is a date or date-time
2
+ * A validation -- not typeguard -- on whether the passed in `val` is a date or date-time
3
3
  * representation and that it's year is the same as the current year.
4
+ *
5
+ * Types correctly handled are:
6
+ *
7
+ * - **JS Date** object
8
+ * - **ISO Date** or **ISO Datetime**
9
+ * - a number representing a **epoch** timestamp (in seconds, not miliseconds)
10
+ * - **MomentJS** and **Luxon** datetime objects
11
+ *
12
+ * **Note:** an invalidate date/datetime passed in will always resolve to `false`
4
13
  */
5
14
  export declare const isThisYear: (val: unknown) => boolean;
6
15
  //# sourceMappingURL=isThisYear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isThisYear.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isThisYear.ts"],"names":[],"mappings":"AAKA;;;EAGE;AACF,eAAO,MAAM,UAAU,QAChB,OAAO,KACX,OAkCF,CAAC"}
1
+ {"version":3,"file":"isThisYear.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isThisYear.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;EAYE;AACF,eAAO,MAAM,UAAU,QAChB,OAAO,KACX,OAcF,CAAC"}
@@ -1,33 +1,27 @@
1
- import { isMoment } from "./isMoment";
2
- import { isLuxonDateTime } from "./isLuxonDateTime";
1
+ import { asDate, isNumber, isObject, isString } from "inferred-types/runtime";
3
2
  /**
4
- * Type guard which validates that the passed in `val` is a date or date-time
3
+ * A validation -- not typeguard -- on whether the passed in `val` is a date or date-time
5
4
  * representation and that it's year is the same as the current year.
5
+ *
6
+ * Types correctly handled are:
7
+ *
8
+ * - **JS Date** object
9
+ * - **ISO Date** or **ISO Datetime**
10
+ * - a number representing a **epoch** timestamp (in seconds, not miliseconds)
11
+ * - **MomentJS** and **Luxon** datetime objects
12
+ *
13
+ * **Note:** an invalidate date/datetime passed in will always resolve to `false`
6
14
  */
7
15
  export const isThisYear = (val) => {
8
16
  // Get current year
9
17
  const currentYear = new Date().getFullYear();
10
- if (val instanceof Date) {
11
- return val.getFullYear() === currentYear;
12
- }
13
- if (isMoment(val)) {
14
- return val.year() === currentYear;
15
- }
16
- if (isLuxonDateTime(val)) {
17
- return val.year === currentYear;
18
- }
19
- // Handle ISO 8601 strings
20
- if (typeof val === "string") {
21
- // Match for full ISO 8601 date (YYYY-MM-DD) or datetime (YYYY-MM-DDThh:mm:ssZ) format
22
- const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
23
- if (!isoDateRegex.test(val)) {
24
- return false;
18
+ if (isObject(val) || isNumber(val) || isString(val)) {
19
+ const date = asDate(val);
20
+ if (date) {
21
+ return date.getFullYear() === currentYear;
25
22
  }
26
- // Extract year from valid ISO string
27
- const yearMatch = val.match(/^(\d{4})/);
28
- if (yearMatch) {
29
- const year = parseInt(yearMatch[1], 10);
30
- return year === currentYear;
23
+ else {
24
+ return false;
31
25
  }
32
26
  }
33
27
  return false;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * **isTomorrow`(val)`**
3
- * A type guard which validates whether the passed in value _represents_ tomorrow's date
3
+ * A boolean test which validates whether the passed in value _represents_ tomorrow's date
4
4
  * as either a:
5
5
  *
6
6
  * - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string, or
@@ -2,7 +2,7 @@ import { getTomorrow, isDate, isLuxonDateTime } from "inferred-types/runtime";
2
2
  import { isIsoExplicitDate, isMoment, isString, stripAfter } from "inferred-types/runtime";
3
3
  /**
4
4
  * **isTomorrow`(val)`**
5
- * A type guard which validates whether the passed in value _represents_ tomorrow's date
5
+ * A boolean test which validates whether the passed in value _represents_ tomorrow's date
6
6
  * as either a:
7
7
  *
8
8
  * - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string, or
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * **isYesterday`(val)`**
3
- * A type guard which validates whether the passed in value _represents_ yesterday's date
3
+ * A boolean test whether on whether the passed in value _represents_ yesterday's date
4
4
  * as either a:
5
5
  *
6
6
  * - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string, or
7
7
  * - [Moment.js](https://momentjs.com/docs/#/displaying/) DateTime object, or
8
8
  * - [Luxon](https://moment.github.io/luxon/#/?id=luxon) DateTime object
9
9
  */
10
- export declare const isYesterday: <T>(test: T) => boolean;
10
+ export declare const isYesterday: (test: unknown) => boolean;
11
11
  //# sourceMappingURL=isYesterday.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isYesterday.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isYesterday.ts"],"names":[],"mappings":"AAIA;;;;;;;;EAQE;AACF,eAAO,MAAM,WAAW,GAAI,CAAC,QACrB,CAAC,KACN,OAeF,CAAC"}
1
+ {"version":3,"file":"isYesterday.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isYesterday.ts"],"names":[],"mappings":"AAIA;;;;;;;;EAQE;AACF,eAAO,MAAM,WAAW,SAChB,OAAO,KACZ,OAeF,CAAC"}
@@ -2,7 +2,7 @@ import { getYesterday, isDate, isLuxonDateTime } from "inferred-types/runtime";
2
2
  import { isIsoExplicitDate, isMoment, isString, stripAfter } from "inferred-types/runtime";
3
3
  /**
4
4
  * **isYesterday`(val)`**
5
- * A type guard which validates whether the passed in value _represents_ yesterday's date
5
+ * A boolean test whether on whether the passed in value _represents_ yesterday's date
6
6
  * as either a:
7
7
  *
8
8
  * - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date string, or
@@ -57,4 +57,5 @@ export * from "./geo/index";
57
57
  export * from "./metrics/index";
58
58
  export * from "./urls/index";
59
59
  export * from "./date-time/index";
60
+ export * from "./tw/index";
60
61
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CA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AC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
@@ -57,3 +57,4 @@ export * from "./geo/index";
57
57
  export * from "./metrics/index";
58
58
  export * from "./urls/index";
59
59
  export * from "./date-time/index";
60
+ export * from "./tw/index";
@@ -0,0 +1,2 @@
1
+ export * from "./tw-color";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/tw/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1 @@
1
+ export * from "./tw-color";
@@ -0,0 +1,79 @@
1
+ import { Opt, TwColor, TwColorOptionalOpacity, TwColorTarget, TwColorWithLuminosity, TwColorWithLuminosityOpacity, TwModifier, TwTarget__Color, TwTarget__Color__Light } from "inferred-types/types";
2
+ /**
3
+ * **isTailwindColor**`(val)`
4
+ *
5
+ * A type guard which validates whether the `val` passed in is a
6
+ * [Tailwind](https://tailwindcss.com/docs/customizing-colors)
7
+ * color (e.g., `blue`, `sky`, `slate`, etc.).
8
+ *
9
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosityAndOpacity`
10
+ */
11
+ export declare const isTailwindColorName: (val: unknown) => val is TwColor;
12
+ /**
13
+ * **isTailwindColorWithLuminosity**`(val)`
14
+ *
15
+ * A type guard which validates whether the `val` passed in is a [Tailwind](https://tailwindcss.com/docs/customizing-colors)
16
+ * color with luminosity string (e.g., `blue-300`, `purple-900`).
17
+ *
18
+ * - this also allows the colors `white` and `black` which are mapped to a luminosity level
19
+ * but do not have variant luminosities
20
+ *
21
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosityAndOpacity`
22
+ */
23
+ export declare const isTailwindColorWithLuminosity: (val: unknown) => val is TwColorWithLuminosity;
24
+ /**
25
+ * **isTailwindColorWithLuminosityAndOpacity**`(val)`
26
+ *
27
+ * A type guard which validates whether the `val` passed in is a [Tailwind](https://tailwindcss.com/docs/customizing-colors)
28
+ * color string with both **luminosity** and **opacity** expressed (e.g., `blue-300/40`, `purple-900/75`).
29
+ *
30
+ * - this also allows the colors `white` and `black` which are mapped to a luminosity level
31
+ * but do not have variant luminosities
32
+ *
33
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosity`, `isTailwindColorName`
34
+ */
35
+ export declare const isTailwindColorWithLuminosityAndOpacity: (val: unknown) => val is TwColorWithLuminosityOpacity;
36
+ /**
37
+ * **isTailwindColor**`(val)`
38
+ *
39
+ * A type guard which validates whether the `val` passed in is a
40
+ * "fully qualified" [Tailwind](https://tailwindcss.com/docs/customizing-colors)
41
+ * color string.
42
+ *
43
+ * - All color string must include a luminosity value except `white` and `black`
44
+ * - You may _optionally_ add an opacity value.
45
+ * - Examples:
46
+ * - `blue-500`
47
+ * - `white`
48
+ * - `black/50`
49
+ * - `red-700/25`
50
+ *
51
+ * **Related:** `isTailwindColorWithLuminosityAndOpacity`, `isTailwindColorWithLuminosity`, `isTargetedTailwindColor`
52
+ */
53
+ export declare const isTailwindColor: (val: unknown) => val is TwColorOptionalOpacity;
54
+ /**
55
+ * Type guard which validates that `val` is a `TwModifier` (e.g., "dark", "focus", etc.).
56
+ */
57
+ export declare const isTailwindModifier: (val: unknown) => val is TwModifier;
58
+ /**
59
+ * A type guard which validates that `val` is a viable "target" for a Tailwind
60
+ * color string (e.g., "bg", "text", "border", etc.).
61
+ */
62
+ export declare const isTailwindColorTarget: (val: unknown) => val is TwColorTarget;
63
+ type FullTailwindColorClass<TAllow extends readonly TwModifier[] | readonly [true]> = TAllow["length"] extends 0 ? TwTarget__Color : TAllow["length"] extends 1 ? TAllow[0] extends TwModifier ? `${Opt<TAllow[0]>}:${TwTarget__Color}` : `${Opt<`${string}:`>}${TwTarget__Color__Light}` : TAllow["length"] extends 2 ? TAllow[0] extends TwModifier ? TAllow[1] extends TwModifier ? `${TAllow[0]}:${TAllow[1]}:${TwTarget__Color__Light}` | `${TAllow[1]}:${TAllow[0]}:${TwTarget__Color__Light}` | `${TAllow[0]}:${TwTarget__Color__Light}` | `${TAllow[1]}:${TwTarget__Color__Light}` | TwTarget__Color__Light : never : never : `${Opt<`${string}:`>}${TwTarget__Color}`;
64
+ /**
65
+ * A type guard which validates that `val` is a fully qualified Tailwind class which:
66
+ *
67
+ * - targets a valid source (e.g., "bg", "text", etc.)
68
+ * - has a valid color and luminosity (and optionally an opacity)
69
+ * - and if any _modifiers_ were at start of string they are part of the
70
+ * those authorized by the the `allowedModifiers` string
71
+ *
72
+ * **Note:** if `allowedModifiers` is set with a single value of `true` then all known modifiers
73
+ * are allowed.
74
+ *
75
+ * **Related:** `isTailwindColor`, `isTailwindColorTarget`, `isTailwindModifier`
76
+ */
77
+ export declare const isTailwindColorClass: <TAllow extends readonly TwModifier[] | readonly [true]>(val: unknown, ...allowedModifiers: TAllow) => val is FullTailwindColorClass<TAllow>;
78
+ export {};
79
+ //# sourceMappingURL=tw-color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tw-color.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/tw/tw-color.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,GAAG,EACH,OAAO,EACP,sBAAsB,EACtB,aAAa,EACb,qBAAqB,EACrB,4BAA4B,EAC5B,UAAU,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,QACzB,OAAO,KACX,GAAG,IAAI,OAET,CAAA;AAGD;;;;;;;;;;GAUG;AACH,eAAO,MAA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AAG,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,eAAe,EAAE,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,OAEjD,OAAO,uBACS,MAAM,KAC1B,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAgBtC,CAAA"}
@@ -0,0 +1,105 @@
1
+ import { TW_COLOR_TARGETS, TW_HUE, TW_LUMINOSITY, TW_MODIFIERS } from "inferred-types/constants";
2
+ import { getTailwindModifiers, isNumberLike, isString, removeTailwindModifiers, retainAfter, } from "inferred-types/runtime";
3
+ /**
4
+ * **isTailwindColor**`(val)`
5
+ *
6
+ * A type guard which validates whether the `val` passed in is a
7
+ * [Tailwind](https://tailwindcss.com/docs/customizing-colors)
8
+ * color (e.g., `blue`, `sky`, `slate`, etc.).
9
+ *
10
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosityAndOpacity`
11
+ */
12
+ export const isTailwindColorName = (val) => {
13
+ return isString(val) && Object.keys(TW_HUE).includes(val);
14
+ };
15
+ /**
16
+ * **isTailwindColorWithLuminosity**`(val)`
17
+ *
18
+ * A type guard which validates whether the `val` passed in is a [Tailwind](https://tailwindcss.com/docs/customizing-colors)
19
+ * color with luminosity string (e.g., `blue-300`, `purple-900`).
20
+ *
21
+ * - this also allows the colors `white` and `black` which are mapped to a luminosity level
22
+ * but do not have variant luminosities
23
+ *
24
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosityAndOpacity`
25
+ */
26
+ export const isTailwindColorWithLuminosity = (val) => {
27
+ return isString(val) && isTailwindColorName(val.split("-")[0]) && (!["white", "black"].includes(val.split("-")[0]) || val.split("-").length === 1) && (!val.includes("-") || Object.keys(TW_LUMINOSITY).includes(retainAfter(val, "-")));
28
+ };
29
+ /**
30
+ * **isTailwindColorWithLuminosityAndOpacity**`(val)`
31
+ *
32
+ * A type guard which validates whether the `val` passed in is a [Tailwind](https://tailwindcss.com/docs/customizing-colors)
33
+ * color string with both **luminosity** and **opacity** expressed (e.g., `blue-300/40`, `purple-900/75`).
34
+ *
35
+ * - this also allows the colors `white` and `black` which are mapped to a luminosity level
36
+ * but do not have variant luminosities
37
+ *
38
+ * **Related:** `isTailwindColor`, `isTailwindColorWithLuminosity`, `isTailwindColorName`
39
+ */
40
+ export const isTailwindColorWithLuminosityAndOpacity = (val) => {
41
+ return isString(val) &&
42
+ val.includes("/") &&
43
+ isTailwindColorWithLuminosity(val.split("/")[0]) &&
44
+ isNumberLike(val.split("/")[1]) &&
45
+ ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
46
+ };
47
+ /**
48
+ * **isTailwindColor**`(val)`
49
+ *
50
+ * A type guard which validates whether the `val` passed in is a
51
+ * "fully qualified" [Tailwind](https://tailwindcss.com/docs/customizing-colors)
52
+ * color string.
53
+ *
54
+ * - All color string must include a luminosity value except `white` and `black`
55
+ * - You may _optionally_ add an opacity value.
56
+ * - Examples:
57
+ * - `blue-500`
58
+ * - `white`
59
+ * - `black/50`
60
+ * - `red-700/25`
61
+ *
62
+ * **Related:** `isTailwindColorWithLuminosityAndOpacity`, `isTailwindColorWithLuminosity`, `isTargetedTailwindColor`
63
+ */
64
+ export const isTailwindColor = (val) => {
65
+ return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
66
+ };
67
+ /**
68
+ * Type guard which validates that `val` is a `TwModifier` (e.g., "dark", "focus", etc.).
69
+ */
70
+ export const isTailwindModifier = (val) => {
71
+ return isString(val) && TW_MODIFIERS.some(i => val === i);
72
+ };
73
+ /**
74
+ * A type guard which validates that `val` is a viable "target" for a Tailwind
75
+ * color string (e.g., "bg", "text", "border", etc.).
76
+ */
77
+ export const isTailwindColorTarget = (val) => {
78
+ return isString(val) && TW_COLOR_TARGETS.includes(val);
79
+ };
80
+ /**
81
+ * A type guard which validates that `val` is a fully qualified Tailwind class which:
82
+ *
83
+ * - targets a valid source (e.g., "bg", "text", etc.)
84
+ * - has a valid color and luminosity (and optionally an opacity)
85
+ * - and if any _modifiers_ were at start of string they are part of the
86
+ * those authorized by the the `allowedModifiers` string
87
+ *
88
+ * **Note:** if `allowedModifiers` is set with a single value of `true` then all known modifiers
89
+ * are allowed.
90
+ *
91
+ * **Related:** `isTailwindColor`, `isTailwindColorTarget`, `isTailwindModifier`
92
+ */
93
+ export const isTailwindColorClass = (val, ...allowedModifiers) => {
94
+ if (isString(val)) {
95
+ const mods = getTailwindModifiers(val);
96
+ const targetted = removeTailwindModifiers(val);
97
+ const target = targetted.split("-")[0];
98
+ const color = targetted.split("-").slice(1).join("-");
99
+ return isTailwindColorTarget(target) &&
100
+ isTailwindColor(color) &&
101
+ (allowedModifiers[0] === true ||
102
+ mods.every(i => allowedModifiers.includes(i)));
103
+ }
104
+ return false;
105
+ };
@@ -1,11 +1,12 @@
1
1
  export type SizingUnits = `px` | `em` | `rem` | `ch` | `vh` | `svh` | `dvh` | `lvh` | `vw` | `lvw` | `svw` | `dvw` | `fr`;
2
- type VariableSizing = `var(${string})${SizingUnits}` | `var(${string})` | `calc(${string})${SizingUnits}` | `calc(${string})` | `min(${string})${SizingUnits}` | `min(${string})` | `max(${string})${SizingUnits}` | `max(${string})` | `minmax(${string})${SizingUnits}` | `minmax(${string})`;
2
+ export type CssSizingFunction = `var(${string})${SizingUnits}` | `var(${string})` | `calc(${string})${SizingUnits}` | `calc(${string})` | `min(${string})${SizingUnits}` | `min(${string})` | `max(${string})${SizingUnits}` | `max(${string})` | `minmax(${string})${SizingUnits}` | `minmax(${string})`;
3
+ export type CssNamedSizes = "initial" | "intrinsic" | "fit-content" | "auto" | "min-content" | "max-content";
3
4
  /**
4
5
  * A strong type for allowed CSS sizing options.
5
6
  *
6
7
  * **Related:** `CssSizingLight`
7
8
  */
8
- export type CssSizing = `${number}${SizingUnits}` | `${number}%` | VariableSizing;
9
+ export type CssSizing = `${number}${SizingUnits}` | `${number}%` | CssSizingFunction | CssNamedSizes;
9
10
  /**
10
11
  * A strong type for allowed CSS sizing options.
11
12
  *
@@ -14,6 +15,5 @@ export type CssSizing = `${number}${SizingUnits}` | `${number}%` | VariableSizin
14
15
  * - this reduces complexity considerably while fiitting most use cases as you can still have
15
16
  * CSS variables like `var(--foobar)` in this type.
16
17
  */
17
- export type CssSizingLight = `${number}${SizingUnits}` | `${number}%`;
18
- export {};
18
+ export type CssSizingLight = `${number}${SizingUnits}` | `${number}%` | CssNamedSizes;
19
19
  //# sourceMappingURL=sizing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/css/sizing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACrB,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,CAAC;AAEP,KAAK,cAAc,GACjB,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,QAAQ,MAAM,IAAI,WAAW,EAAE,GAC/B,QAAQ,MAAM,GAAG,GACjB,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,UAAU,MAAM,IAAI,WAAW,EAAE,GACjC,UAAU,MAAM,GAAG,CAAC;AAGtB;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,cAAc,CAAC;AAGlF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,CAAC"}
1
+ {"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/css/sizing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACrB,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,CAAC;AAEP,MAAM,MAAM,iBAAiB,GAC3B,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,QAAQ,MAAM,IAAI,WAAW,EAAE,GAC/B,QAAQ,MAAM,GAAG,GACjB,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,OAAO,MAAM,IAAI,WAAW,EAAE,GAC9B,OAAO,MAAM,GAAG,GAChB,UAAU,MAAM,IAAI,WAAW,EAAE,GACjC,UAAU,MAAM,GAAG,CAAC;AAEtB,MAAM,MAAM,aAAa,GACvB,SAAS,GACT,WAAW,GACX,aAAa,GACb,MAAM,GACN,aAAa,GACb,aAAa,CAAC;AAEhB;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,iBAAiB,GAAG,aAAa,CAAC;AAGrG;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,aAAa,CAAC"}
@@ -1,15 +1,15 @@
1
- import { TW_CHROMA, TW_HUE, TW_LUMINOSITY } from "inferred-types/constants";
2
- import { Mutable } from "inferred-types/types";
1
+ import { TW_CHROMA, TW_COLOR_TARGETS, TW_HUE, TW_HUE_NEUTRAL, TW_HUE_VIBRANT, TW_LUMINOSITY } from "inferred-types/constants";
2
+ import { IsStringLiteral, Join, Mutable, Opt, TwModifier } from "inferred-types/types";
3
3
  /**
4
4
  * The [TailwindCSS](https://tailwindcss.com/docs/customizing-colors)
5
5
  * named colors which represent variations of grayscale/neutral colors.
6
6
  */
7
- export type TwNeutralColor = "slate" | "gray" | "zinc" | "neutral" | "stone";
7
+ export type TwNeutralColor = keyof typeof TW_HUE_NEUTRAL;
8
8
  /**
9
9
  * the _vibrant_ [TailwindCSS](https://tailwindcss.com/docs/customizing-colors)
10
10
  * named colors.
11
11
  */
12
- export type TwVibrantColor = "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
12
+ export type TwVibrantColor = keyof typeof TW_HUE_VIBRANT;
13
13
  export type TwStaticColor = "white" | "black";
14
14
  /**
15
15
  * all [TailwindCSS](https://tailwindcss.com/docs/customizing-colors)
@@ -20,7 +20,7 @@ export type TwStaticColor = "white" | "black";
20
20
  */
21
21
  export type TwColor = TwNeutralColor | TwVibrantColor | TwStaticColor;
22
22
  /**
23
- * all of the [TailwindCSS](https://tailwindcss.com/docs/customizing-colors)
23
+ * All of the [TailwindCSS](https://tailwindcss.com/docs/customizing-colors)
24
24
  * luminosity levels.
25
25
  */
26
26
  export type TwLuminosity = "50" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | "950";
@@ -43,12 +43,12 @@ export type TwColorWithLuminosity = `${TwNeutralColor}-${TwLuminosity}` | `${TwV
43
43
  */
44
44
  export type TwColorWithLuminosityOpacity = `${TwColorWithLuminosity}/${number}`;
45
45
  /**
46
- * **TwColorOption**
46
+ * **TwColorOptionalOpacity**
47
47
  *
48
48
  * A [TailwindCSS](https://tailwindcss.com/docs/customizing-colors) color
49
49
  * option which requires luminosity but optionally can include opacity too
50
50
  */
51
- export type TwColorOption = TwColorWithLuminosity | TwColorWithLuminosityOpacity;
51
+ export type TwColorOptionalOpacity = `${TwColorWithLuminosity}${Opt<`/${number}`>}`;
52
52
  export type TwLuminosityLookup = Mutable<typeof TW_LUMINOSITY>;
53
53
  export type TwLumi50 = typeof TW_LUMINOSITY["50"];
54
54
  export type TwLumi100 = typeof TW_LUMINOSITY["100"];
@@ -81,4 +81,24 @@ export type TwChroma800 = typeof TW_CHROMA["800"];
81
81
  export type TwChroma900 = typeof TW_CHROMA["900"];
82
82
  export type TwChroma950 = typeof TW_CHROMA["950"];
83
83
  export type TwHue = Mutable<typeof TW_HUE>;
84
+ /**
85
+ * **TwColorTarget**
86
+ *
87
+ * Prefixes that Tailwind provides which can be used in targeting aspects of
88
+ * the HTMLElement which take color information.
89
+ */
90
+ export type TwColorTarget = typeof TW_COLOR_TARGETS[number];
91
+ type _TwModifiers<TText extends string, TCaptured extends readonly string[] = []> = TText extends `${infer M extends TwModifier}:${infer REST}` ? _TwModifiers<REST, [
92
+ ...TCaptured,
93
+ M
94
+ ]> : TCaptured["length"] extends 0 ? "" : `${Join<TCaptured, ":">}:`;
95
+ /**
96
+ * **TwModifiers**
97
+ *
98
+ * Given a string, this type utility will find `TwMondifer` substrings at the
99
+ * the start of the string and return them as a string with the remaining string
100
+ * removed.
101
+ */
102
+ export type TwModifiers<T> = T extends string ? IsStringLiteral<T> extends true ? _TwModifiers<T> : Opt<`${string}:`> : "";
103
+ export {};
84
104
  //# sourceMappingURL=TwColor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TwColor.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/tw/TwColor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C;;;GAGG;AACH,MAAM,MAAM,cAAc,GACxB,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,cAAc,GACxB,KAAK,GACL,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAA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,"file":"TwColor.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/tw/TwColor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,IAAI,EACJ,OAAO,EACP,GAAG,EACH,UAAU,EACX,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,cAAc,GAAG,aAAa,CAAC;AAGtE;;;GAGG;AACH,MAAM,MAAM,YAAY,GACtB,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAER;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC/B,GAAG,cAAc,IAAI,YAAY,EAAE,GACnC,GAAG,cAAc,IAAI,YAAY,EAAE,GACnC,aAAa,CAAC;AAEhB;;;;;;;GAOG;AACH,MAAM,MAAM,4BAA4B,GAAG,GAAG,qBAAqB,IAAI,MAAM,EAAE,CAAA;AAG/E;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,qBAAqB,GAAG,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC,EAAE,CAAC;AAGpF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;AAC/D,MAAM,MAAM,QAAQ,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAClD,MAAM,MAAM,SAAS,G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C,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAGlD,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,MAAM,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE5D,KAAK,YAAY,CACf,KAAK,SAAS,MAAM,EACpB,SAAS,SAAS,SAAS,MAAM,EAAE,GAAG,EAAE,IACtC,KAAK,SAAS,GAAG,MAAM,CAAC,SAAS,UAAU,IAAI,MAAM,IAAI,EAAE,GAC7D,YAAY,CACV,IAAI,EACJ;IAAC,GAAG,SAAS;IAAE,CAAC;CAAC,CAClB,GACD,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC3B,EAAE,GACD,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CACrB,CAAC,IACC,CAAC,SAAS,MAAM,GAClB,eAAe,CAAC,CAAC,CAAC,SAAS,IAAI,GAC7B,YAAY,CAAC,CAAC,CAAC,GACf,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GACnB,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { TW_MODIFIERS_CORE, TW_MODIFIERS_ORDER, TW_MODIFIERS_RELN } from "inferred-types/constants";
2
+ import { TwSizeResponsive } from "./TwSize";
3
+ import { Replace } from "inferred-types/types";
4
+ /**
5
+ * The _core_ state modifiers which are used frequently in
6
+ */
7
+ export type TwModifier__Core = typeof TW_MODIFIERS_CORE[number];
8
+ /**
9
+ * Tailwind state modifiers which select on the _order_ of an item in the list
10
+ */
11
+ export type TwModifier__Order = typeof TW_MODIFIERS_ORDER[number];
12
+ /**
13
+ * Tailwind state modifiers which select on a relationship to another node (peer, child, etc.)
14
+ */
15
+ export type TwModifier__Reln = Replace<typeof TW_MODIFIERS_RELN[number], `{{string}}`, `${string}`>;
16
+ export type TwModifier__Size = TwSizeResponsive;
17
+ /**
18
+ * Tailwind state modifiers
19
+ *
20
+ * **Related:** `TwState__Core`, `TwState__Order`, `TwState__Reln`, `TwPrefix`
21
+ */
22
+ export type TwModifier<T extends string = never> = TwModifier__Core | TwModifier__Order | TwModifier__Reln | TwModifier__Size | T;
23
+ //# sourceMappingURL=TwModifer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwModifer.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/tw/TwModifer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAGlE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAEpG,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,IAAI,gBAAgB,GACjE,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TW_MODIFIERS_SIZING } from "inferred-types/constants";
2
+ /**
3
+ * **TwSizeResponsive**`<[T]>`
4
+ *
5
+ * The valid size targets you can use for Tailwind's responsive layout utilities.
6
+ */
7
+ export type TwSizeResponsive<T extends string = never> = typeof TW_MODIFIERS_SIZING[number] | T;
8
+ //# sourceMappingURL=TwSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwSize.d.ts","sourceRoot":"","sources":["../../../../../src/types/string-literals/character-sets/tw/TwSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,IAAI,OAAO,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC"}