@stamcat/craftsman 0.0.55 → 0.0.58

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/Utilities.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import { formatTime as e, getAmPmLabels as t, getUnitLabel as n, is24HourFormat as r, isEmpty as i, validateEmail as a } from "./src/utilities/validations.esm.js";
2
- export { e as formatTime, t as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, i as isEmpty, a as validateEmail };
1
+ import { formatTime as e, getAmPmLabels as t, getUnitLabel as n, is24HourFormat as r, isEmpty as i, toCssString as a, validateEmail as o } from "./src/utilities/validations.esm.js";
2
+ export { e as formatTime, t as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, i as isEmpty, a as toCssString, o as validateEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.55",
3
+ "version": "0.0.58",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- import { Breakpoint, LayoutWidthsType } from '../../utilities/types';
1
+ import { Breakpoint, LayoutWidthsType, SerializedStyles } from '../../utilities/types';
2
2
  export declare const widths: Record<LayoutWidthsType, string>;
3
3
  export declare const media: {
4
4
  readonly mobile: string;
@@ -14,4 +14,4 @@ export declare const media: {
14
14
  readonly desktopOnly: string;
15
15
  };
16
16
  export declare const width: (w: LayoutWidthsType, multiplier?: number, px?: boolean) => string;
17
- export declare const breakpoint: (bp: Breakpoint, styles: string) => string;
17
+ export declare const breakpoint: (bp: Breakpoint, styles: string | SerializedStyles) => string;
@@ -1,47 +1,48 @@
1
- import { LayoutWidthsSchema as e } from "../../utilities/types.esm.js";
2
- import { defaultWidths as t } from "./constants.esm.js";
1
+ import { toCssString as e } from "../../utilities/validations.esm.js";
2
+ import { LayoutWidthsSchema as t } from "../../utilities/types.esm.js";
3
+ import { defaultWidths as n } from "./constants.esm.js";
3
4
  //#region src/styles/utilities/layout.ts
4
- var n = Object.fromEntries(e.options.map((e) => [e, `var(--w-${e}, ${t[e]}px)`])), r = {
5
+ var r = Object.fromEntries(t.options.map((e) => [e, `var(--w-${e}, ${n[e]}px)`])), i = {
5
6
  get mobile() {
6
7
  return "(min-width: 0px)";
7
8
  },
8
9
  get mobileMax() {
9
- return `(max-width: ${t.mobileMax}px)`;
10
+ return `(max-width: ${n.mobileMax}px)`;
10
11
  },
11
12
  get tablet() {
12
- return `(min-width: ${t.tablet}px)`;
13
+ return `(min-width: ${n.tablet}px)`;
13
14
  },
14
15
  get tabletMax() {
15
- return `(max-width: ${t.tabletMax}px)`;
16
+ return `(max-width: ${n.tabletMax}px)`;
16
17
  },
17
18
  get desktop() {
18
- return `(min-width: ${t.desktop}px)`;
19
+ return `(min-width: ${n.desktop}px)`;
19
20
  },
20
21
  get desktopMax() {
21
- return `(max-width: ${t.desktopMax}px)`;
22
+ return `(max-width: ${n.desktopMax}px)`;
22
23
  },
23
24
  get extDesktop() {
24
- return `(min-width: ${t.extDesktop}px)`;
25
+ return `(min-width: ${n.extDesktop}px)`;
25
26
  },
26
27
  get mobileOnly() {
27
- return `(min-width: 0px) and (max-width: ${t.mobileMax}px)`;
28
+ return `(min-width: 0px) and (max-width: ${n.mobileMax}px)`;
28
29
  },
29
30
  get tabletOnly() {
30
- return `(min-width: ${t.tablet}px) and (max-width: ${t.tabletMax}px)`;
31
+ return `(min-width: ${n.tablet}px) and (max-width: ${n.tabletMax}px)`;
31
32
  },
32
33
  get mobileTablet() {
33
- return `(min-width: 0px) and (max-width: ${t.tabletMax}px)`;
34
+ return `(min-width: 0px) and (max-width: ${n.tabletMax}px)`;
34
35
  },
35
36
  get desktopOnly() {
36
- return `(min-width: ${t.desktop}px) and (max-width: ${t.desktopMax}px)`;
37
+ return `(min-width: ${n.desktop}px) and (max-width: ${n.desktopMax}px)`;
37
38
  }
38
- }, i = (e, t = 1, r = !0) => {
39
- let i = n[e];
39
+ }, a = (e, t = 1, n = !0) => {
40
+ let i = r[e];
40
41
  if (e === "column") {
41
- let e = t - 1, a = `calc((${i} * ${t}) + (${n.gutter} * ${e}))`;
42
- return r ? a : `calc(((${i} / 1px) * ${t}) + ((${n.gutter} / 1px) * ${e}))`;
42
+ let e = t - 1, a = `calc((${i} * ${t}) + (${r.gutter} * ${e}))`;
43
+ return n ? a : `calc(((${i} / 1px) * ${t}) + ((${r.gutter} / 1px) * ${e}))`;
43
44
  }
44
- return r ? t === 1 ? i : `calc(${i} * ${t})` : t === 1 ? `calc(${i} / 1px)` : `calc((${i} / 1px) * ${t})`;
45
- }, a = (e, t) => `@media ${r[e]} { ${String(t)} }`;
45
+ return n ? t === 1 ? i : `calc(${i} * ${t})` : t === 1 ? `calc(${i} / 1px)` : `calc((${i} / 1px) * ${t})`;
46
+ }, o = (t, n) => `@media ${i[t]} { ${e(n)} }`;
46
47
  //#endregion
47
- export { a as breakpoint, r as media, i as width, n as widths };
48
+ export { o as breakpoint, i as media, a as width, r as widths };
@@ -26,7 +26,6 @@ export declare const BreakpointSchema: z.ZodEnum<{
26
26
  desktopOnly: "desktopOnly";
27
27
  }>;
28
28
  export declare const LayoutWidthsSchema: z.ZodEnum<{
29
- text: "text";
30
29
  gutter: "gutter";
31
30
  column: "column";
32
31
  tablet: "tablet";
@@ -35,6 +34,7 @@ export declare const LayoutWidthsSchema: z.ZodEnum<{
35
34
  mobileMax: "mobileMax";
36
35
  tabletMax: "tabletMax";
37
36
  desktopMax: "desktopMax";
37
+ text: "text";
38
38
  }>;
39
39
  export type BaseWidth = z.infer<typeof BaseWidthSchema>;
40
40
  export type ScreenWidth = z.infer<typeof ScreenWidthSchema>;
@@ -44,6 +44,11 @@ export type LayoutWidthsType = z.infer<typeof LayoutWidthsSchema>;
44
44
  export type Width = Record<LayoutWidthsType, number>;
45
45
  export type Colors = Record<string, string>;
46
46
  export type ColorType = "rgba" | "hex";
47
+ export type SerializedStyles = {
48
+ name: string;
49
+ styles: string;
50
+ next?: SerializedStyles;
51
+ };
47
52
  export declare const zTextInputExclusions: z.ZodEnum<{
48
53
  checkbox: "checkbox";
49
54
  radio: "radio";
@@ -52,25 +57,25 @@ export type TextInputExclusions = z.infer<typeof zTextInputExclusions>;
52
57
  export declare const zTextInputTypes: readonly ["color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week", "radio", "checkbox"];
53
58
  export declare const zTextInputType: z.ZodEnum<{
54
59
  number: "number";
55
- search: "search";
56
- month: "month";
57
- time: "time";
58
- image: "image";
59
60
  text: "text";
60
- hidden: "hidden";
61
- color: "color";
62
61
  checkbox: "checkbox";
63
62
  radio: "radio";
64
- tel: "tel";
65
- url: "url";
66
- email: "email";
63
+ color: "color";
67
64
  date: "date";
68
- submit: "submit";
69
- reset: "reset";
70
65
  "datetime-local": "datetime-local";
66
+ email: "email";
71
67
  file: "file";
68
+ hidden: "hidden";
69
+ image: "image";
70
+ month: "month";
72
71
  password: "password";
73
72
  range: "range";
73
+ reset: "reset";
74
+ search: "search";
75
+ submit: "submit";
76
+ tel: "tel";
77
+ time: "time";
78
+ url: "url";
74
79
  week: "week";
75
80
  }>;
76
81
  export type TextInputType = z.infer<typeof zTextInputType>;
@@ -111,7 +116,6 @@ export declare const ButtonType: z.ZodEnum<{
111
116
  }>;
112
117
  export type ButtonType = z.infer<typeof ButtonType>;
113
118
  export declare const TextTags: z.ZodEnum<{
114
- div: "div";
115
119
  h1: "h1";
116
120
  h2: "h2";
117
121
  h3: "h3";
@@ -119,21 +123,22 @@ export declare const TextTags: z.ZodEnum<{
119
123
  h5: "h5";
120
124
  p: "p";
121
125
  span: "span";
126
+ div: "div";
122
127
  }>;
123
128
  export type TextTags = z.infer<typeof TextTags>;
124
129
  export declare const TextType: z.ZodEnum<{
125
- caption: "caption";
126
- heading: "heading";
127
130
  display: "display";
131
+ heading: "heading";
128
132
  paragraph: "paragraph";
133
+ caption: "caption";
129
134
  "small-title": "small-title";
130
135
  }>;
131
136
  export type TextType = z.infer<typeof TextType>;
132
137
  export declare const TextSize: z.ZodEnum<{
133
- small: "small";
134
138
  xlarge: "xlarge";
135
139
  large: "large";
136
140
  medium: "medium";
141
+ small: "small";
137
142
  xsmall: "xsmall";
138
143
  }>;
139
144
  export type TextSize = z.infer<typeof TextSize>;
@@ -143,10 +148,10 @@ export declare const CarouselPageType: z.ZodEnum<{
143
148
  }>;
144
149
  export type CarouselPageType = z.infer<typeof CarouselPageType>;
145
150
  export declare const NoticeType: z.ZodEnum<{
146
- none: "none";
147
151
  help: "help";
148
152
  info: "info";
149
153
  success: "success";
150
154
  error: "error";
155
+ none: "none";
151
156
  }>;
152
157
  export type NoticeType = z.infer<typeof NoticeType>;
@@ -1,7 +1,9 @@
1
1
  import { DateTimePickerProps } from 'react-datetime-picker';
2
+ import { SerializedStyles } from './types';
2
3
  export declare function isEmpty(value: unknown): boolean;
3
4
  export declare function validateEmail(value: string): boolean;
4
5
  export declare const getUnitLabel: (locale: Intl.LocalesArgument, unit: Intl.NumberFormatOptions["unit"], override?: string) => string;
5
6
  export declare const is24HourFormat: (locale: Intl.LocalesArgument) => boolean;
6
7
  export declare const getAmPmLabels: (locale: Intl.LocalesArgument) => [string, string];
7
8
  export declare const formatTime: (value: DateTimePickerProps["value"], locale: Intl.LocalesArgument) => string;
9
+ export declare const toCssString: (styles: string | SerializedStyles) => string;
@@ -22,6 +22,11 @@ var n = (e, t, n) => n ?? new Intl.NumberFormat(e, {
22
22
  hour: "2-digit",
23
23
  minute: "2-digit",
24
24
  hour12: !1
25
- }).format(e) : "--:--";
25
+ }).format(e) : "--:--", o = (e) => {
26
+ if (typeof e == "string") return String(e);
27
+ let t = "", n = e;
28
+ for (; n;) t = n.styles + t, n = n.next;
29
+ return t;
30
+ };
26
31
  //#endregion
27
- export { a as formatTime, i as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, e as isEmpty, t as validateEmail };
32
+ export { a as formatTime, i as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, e as isEmpty, o as toCssString, t as validateEmail };