@uxf/ui 1.0.0-beta.87 → 1.0.0-beta.89
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/_private-utils/get-provider-config.js +4 -0
- package/config/icons-config.d.ts +1 -1
- package/config/icons-config.js +1 -1
- package/config/icons.d.ts +14 -14
- package/config/icons.js +14 -14
- package/context/context.d.ts +3 -0
- package/context/use-component-context.d.ts +1 -1
- package/css/raster-image.css +5 -0
- package/image-gallery/components/gallery.js +2 -1
- package/image-gallery/image-gallery.stories.js +3 -2
- package/image-gallery/types.d.ts +2 -2
- package/package.json +8 -7
- package/raster-image/raster-image.d.ts +21 -7
- package/raster-image/raster-image.js +22 -8
- package/raster-image/raster-image.stories.d.ts +24 -1
- package/raster-image/raster-image.stories.js +2 -2
- package/scripts/generate-tw-tokens.js +94 -0
- package/tw-tokens/tw-box-shadow.d.ts +11 -0
- package/tw-tokens/tw-box-shadow.js +14 -0
- package/tw-tokens/tw-colors.d.ts +328 -0
- package/tw-tokens/tw-colors.js +331 -0
- package/tw-tokens/tw-containers.d.ts +8 -0
- package/tw-tokens/tw-containers.js +11 -0
- package/tw-tokens/tw-font-size.d.ts +42 -0
- package/tw-tokens/tw-font-size.js +19 -0
- package/tw-tokens/tw-font-weight.d.ts +12 -0
- package/tw-tokens/tw-font-weight.js +15 -0
- package/tw-tokens/tw-line-height.d.ts +17 -0
- package/tw-tokens/tw-line-height.js +20 -0
- package/tw-tokens/tw-screens.d.ts +8 -0
- package/tw-tokens/tw-screens.js +11 -0
- package/tw-tokens/tw-spacing.d.ts +39 -0
- package/tw-tokens/tw-spacing.js +42 -0
- package/tw-tokens/tw-z-index.d.ts +19 -0
- package/tw-tokens/tw-z-index.js +22 -0
- package/utils/image.d.ts +18 -8
- package/utils/image.js +92 -18
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProviderConfig = void 0;
|
|
4
4
|
const icons_1 = require("../config/icons");
|
|
5
|
+
const tw_screens_1 = require("../tw-tokens/tw-screens");
|
|
5
6
|
const getProviderConfig = () => ({
|
|
6
7
|
icon: { spriteFilePath: "/icons-generated/_icon-sprite.svg", iconsConfig: icons_1.ICONS },
|
|
8
|
+
rasterImage: {
|
|
9
|
+
breakpoints: tw_screens_1.twScreens,
|
|
10
|
+
},
|
|
7
11
|
});
|
|
8
12
|
exports.getProviderConfig = getProviderConfig;
|
package/config/icons-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ICONS_VERSION = "
|
|
1
|
+
export declare const ICONS_VERSION = "1672407658495";
|
|
2
2
|
export declare const ICON_SPRITE = "/.storybook/static-assets/icons-generated/_icon-sprite.svg";
|
package/config/icons-config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ICON_SPRITE = exports.ICONS_VERSION = void 0;
|
|
4
|
-
exports.ICONS_VERSION = "
|
|
4
|
+
exports.ICONS_VERSION = "1672407658495";
|
|
5
5
|
exports.ICON_SPRITE = "/.storybook/static-assets/icons-generated/_icon-sprite.svg";
|
package/config/icons.d.ts
CHANGED
|
@@ -59,19 +59,19 @@ export declare const ICONS: {
|
|
|
59
59
|
export declare type IconsType = keyof typeof ICONS;
|
|
60
60
|
declare module "@uxf/ui/icon/theme" {
|
|
61
61
|
interface IconsSet {
|
|
62
|
-
calendar: true;
|
|
63
|
-
camera: true;
|
|
64
|
-
caretDown: true;
|
|
65
|
-
clock: true;
|
|
66
|
-
bars: true;
|
|
67
|
-
check: true;
|
|
68
|
-
chevronDown: true;
|
|
69
|
-
chevronLeft: true;
|
|
70
|
-
chevronsLeft: true;
|
|
71
|
-
chevronRight: true;
|
|
72
|
-
chevronsRight: true;
|
|
73
|
-
chevronUp: true;
|
|
74
|
-
user: true;
|
|
75
|
-
xmarkLarge: true;
|
|
62
|
+
"calendar": true;
|
|
63
|
+
"camera": true;
|
|
64
|
+
"caretDown": true;
|
|
65
|
+
"clock": true;
|
|
66
|
+
"bars": true;
|
|
67
|
+
"check": true;
|
|
68
|
+
"chevronDown": true;
|
|
69
|
+
"chevronLeft": true;
|
|
70
|
+
"chevronsLeft": true;
|
|
71
|
+
"chevronRight": true;
|
|
72
|
+
"chevronsRight": true;
|
|
73
|
+
"chevronUp": true;
|
|
74
|
+
"user": true;
|
|
75
|
+
"xmarkLarge": true;
|
|
76
76
|
}
|
|
77
77
|
}
|
package/config/icons.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ICONS = void 0;
|
|
5
5
|
exports.ICONS = {
|
|
6
|
-
calendar: { w: 448, h: 512 },
|
|
7
|
-
camera: { w: 512, h: 512 },
|
|
8
|
-
caretDown: { w: 320, h: 512 },
|
|
9
|
-
clock: { w: 512, h: 512 },
|
|
10
|
-
bars: { w: 448, h: 512 },
|
|
11
|
-
check: { w: 512, h: 512 },
|
|
12
|
-
chevronDown: { w: 512, h: 512 },
|
|
13
|
-
chevronLeft: { w: 384, h: 512 },
|
|
14
|
-
chevronsLeft: { w: 512, h: 512 },
|
|
15
|
-
chevronRight: { w: 384, h: 512 },
|
|
16
|
-
chevronsRight: { w: 512, h: 512 },
|
|
17
|
-
chevronUp: { w: 512, h: 512 },
|
|
18
|
-
user: { w: 448, h: 512 },
|
|
19
|
-
xmarkLarge: { w: 448, h: 512 },
|
|
6
|
+
"calendar": { w: 448, h: 512 },
|
|
7
|
+
"camera": { w: 512, h: 512 },
|
|
8
|
+
"caretDown": { w: 320, h: 512 },
|
|
9
|
+
"clock": { w: 512, h: 512 },
|
|
10
|
+
"bars": { w: 448, h: 512 },
|
|
11
|
+
"check": { w: 512, h: 512 },
|
|
12
|
+
"chevronDown": { w: 512, h: 512 },
|
|
13
|
+
"chevronLeft": { w: 384, h: 512 },
|
|
14
|
+
"chevronsLeft": { w: 512, h: 512 },
|
|
15
|
+
"chevronRight": { w: 384, h: 512 },
|
|
16
|
+
"chevronsRight": { w: 512, h: 512 },
|
|
17
|
+
"chevronUp": { w: 512, h: 512 },
|
|
18
|
+
"user": { w: 448, h: 512 },
|
|
19
|
+
"xmarkLarge": { w: 448, h: 512 },
|
|
20
20
|
};
|
package/context/context.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { UiContextType } from "./context";
|
|
2
2
|
export declare type UiContextComponent = keyof UiContextType;
|
|
3
|
-
export declare const useComponentContext: <T extends
|
|
3
|
+
export declare const useComponentContext: <T extends keyof UiContextType>(componentName: T) => UiContextType[T];
|
package/css/raster-image.css
CHANGED
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const image_1 = require("../../utils/image");
|
|
29
30
|
const close_button_1 = __importDefault(require("./close-button"));
|
|
30
31
|
const previous_button_1 = __importDefault(require("./previous-button"));
|
|
31
32
|
const next_button_1 = __importDefault(require("./next-button"));
|
|
@@ -66,6 +67,6 @@ function Gallery(props) {
|
|
|
66
67
|
react_1.default.createElement("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-between p-2" },
|
|
67
68
|
react_1.default.createElement(previous_button_1.default, { onClick: props.onPrevious }),
|
|
68
69
|
react_1.default.createElement(next_button_1.default, { onClick: props.onNext })))),
|
|
69
|
-
react_1.default.createElement("div", { className: "row mx-auto flex space-x-2 p-4" }, props.images.map((image, index) => (react_1.default.createElement(dot_1.default, { key:
|
|
70
|
+
react_1.default.createElement("div", { className: "row mx-auto flex space-x-2 p-4" }, props.images.map((image, index) => (react_1.default.createElement(dot_1.default, { key: (0, image_1.getImgUniqueIdentifier)(image.src) || index, active: index === props.imageIndex }))))));
|
|
70
71
|
}
|
|
71
72
|
exports.default = Gallery;
|
|
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const image_1 = require("../utils/image");
|
|
9
|
+
const image_2 = __importDefault(require("./image"));
|
|
8
10
|
const image_gallery_1 = __importDefault(require("./image-gallery"));
|
|
9
|
-
const image_1 = __importDefault(require("./image"));
|
|
10
11
|
exports.default = {
|
|
11
12
|
title: "Lab/ImageGallery",
|
|
12
13
|
component: image_gallery_1.default,
|
|
@@ -21,6 +22,6 @@ const images = [
|
|
|
21
22
|
];
|
|
22
23
|
function Default() {
|
|
23
24
|
return (react_1.default.createElement(image_gallery_1.default, null,
|
|
24
|
-
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((src) => (react_1.default.createElement(
|
|
25
|
+
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((src, index) => (react_1.default.createElement(image_2.default, { key: (0, image_1.getImgUniqueIdentifier)(src) || index, src: src, className: "h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105" }))))));
|
|
25
26
|
}
|
|
26
27
|
exports.Default = Default;
|
package/image-gallery/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.89",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
"author": "UX Fans s.r.o",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@floating-ui/react-dom": "^1.
|
|
17
|
-
"@headlessui/react": "^1.7.
|
|
18
|
-
"@uxf/core": "^
|
|
19
|
-
"@uxf/
|
|
20
|
-
"
|
|
16
|
+
"@floating-ui/react-dom": "^1.1.0",
|
|
17
|
+
"@headlessui/react": "^1.7.7",
|
|
18
|
+
"@uxf/core": "^4.1.2",
|
|
19
|
+
"@uxf/datepicker": "^1.2.0",
|
|
20
|
+
"@uxf/styles": "^2.1.1",
|
|
21
|
+
"dayjs": "^1.11.7",
|
|
21
22
|
"jump.js": "^1.0.2"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/jump.js": "^1.0.4",
|
|
25
|
-
"@uxf/icons-generator": "^1.
|
|
26
|
+
"@uxf/icons-generator": "^1.3.0"
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ImageSource, ResizerImageProps } from "@uxf/core/utils/resizer";
|
|
2
|
+
import { FC, ImgHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { Quality } from "../utils/image";
|
|
3
4
|
declare type ImgProps = ImgHTMLAttributes<HTMLImageElement>;
|
|
4
|
-
|
|
5
|
+
declare type Props = {
|
|
5
6
|
alt: string;
|
|
7
|
+
breakpoints?: Record<string, string>;
|
|
6
8
|
className?: string;
|
|
7
|
-
|
|
9
|
+
heights?: number[];
|
|
8
10
|
imgClassName?: string;
|
|
9
11
|
loading?: ImgProps["loading"];
|
|
10
12
|
mode?: "contain" | "cover" | "responsive";
|
|
13
|
+
noImageContent?: ReactNode;
|
|
14
|
+
options?: Omit<ResizerImageProps, "quality" | "toFormat">;
|
|
15
|
+
quality?: Quality;
|
|
11
16
|
role?: ImgProps["role"];
|
|
12
|
-
src
|
|
17
|
+
src: ImageSource | null | undefined;
|
|
18
|
+
widths?: number[];
|
|
19
|
+
} & ({
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
} | {
|
|
23
|
+
width?: never;
|
|
24
|
+
height: number;
|
|
25
|
+
} | {
|
|
13
26
|
width: number;
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
height?: never;
|
|
28
|
+
});
|
|
29
|
+
export declare const RasterImage: FC<Props>;
|
|
16
30
|
export {};
|
|
@@ -7,15 +7,29 @@ exports.RasterImage = void 0;
|
|
|
7
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
8
|
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const context_1 = require("../context");
|
|
10
11
|
const image_1 = require("../utils/image");
|
|
11
12
|
const RasterImage = (props) => {
|
|
12
|
-
var _a, _b;
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
+
const componentContext = (0, context_1.useComponentContext)("rasterImage");
|
|
15
|
+
const className = [
|
|
16
|
+
props.mode === "contain" && "uxf-raster-image--contain",
|
|
17
|
+
props.mode === "cover" && "uxf-raster-image--cover",
|
|
18
|
+
props.className,
|
|
19
|
+
];
|
|
20
|
+
const breakpoints = ["0em", ...Object.values((_a = props.breakpoints) !== null && _a !== void 0 ? _a : componentContext.breakpoints)];
|
|
21
|
+
const resizerSrc = (0, resizer_1.resizerImageUrl)(props.src, (_b = props.width) !== null && _b !== void 0 ? _b : "auto", (_c = props.height) !== null && _c !== void 0 ? _c : "auto", {
|
|
22
|
+
...((_d = props.options) !== null && _d !== void 0 ? _d : {}),
|
|
23
|
+
quality: (0, image_1.getImgQuality)(props.quality, "original"),
|
|
24
|
+
});
|
|
25
|
+
if (!resizerSrc) {
|
|
26
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-raster-image uxf-raster-image--no-image", ...className) }, props.noImageContent));
|
|
27
|
+
}
|
|
28
|
+
return (react_1.default.createElement("picture", { className: (0, cx_1.cx)("uxf-raster-image", ...className) }, (_f = (_e = props.widths) === null || _e === void 0 ? void 0 : _e.map((w, i) => i < breakpoints.length && (react_1.default.createElement(image_1.ImgSources, { breakpointIndex: i, breakpoints: breakpoints, height: props.heights && props.heights[i]
|
|
29
|
+
? props.heights[i]
|
|
30
|
+
: props.width && props.height
|
|
31
|
+
? Math.ceil((props.height / props.width) * w)
|
|
32
|
+
: "auto", key: w, options: props.options, quality: props.quality, src: props.src, width: w }))).reverse()) !== null && _f !== void 0 ? _f : (react_1.default.createElement(image_1.ImgSources, { height: (_g = props.height) !== null && _g !== void 0 ? _g : "auto", options: props.options, quality: props.quality, src: props.src, width: (_h = props.width) !== null && _h !== void 0 ? _h : "auto" })),
|
|
33
|
+
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)("uxf-raster-image__img", props.mode === "contain" && "uxf-raster-image__img--contain", props.mode === "cover" && "uxf-raster-image__img--cover", props.imgClassName), height: props.height, loading: props.loading, src: resizerSrc, width: props.width })));
|
|
19
34
|
};
|
|
20
35
|
exports.RasterImage = RasterImage;
|
|
21
|
-
exports.RasterImage.displayName = "RasterImage";
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: React.FC<
|
|
4
|
+
component: React.FC<{
|
|
5
|
+
alt: string;
|
|
6
|
+
breakpoints?: Record<string, string> | undefined;
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
heights?: number[] | undefined;
|
|
9
|
+
imgClassName?: string | undefined;
|
|
10
|
+
loading?: "eager" | "lazy" | undefined;
|
|
11
|
+
mode?: "contain" | "cover" | "responsive" | undefined;
|
|
12
|
+
noImageContent?: React.ReactNode;
|
|
13
|
+
options?: Omit<import("@uxf/core/utils/resizer").ResizerImageProps, "quality" | "toFormat"> | undefined;
|
|
14
|
+
quality?: import("../utils/image").Quality | undefined;
|
|
15
|
+
role?: React.AriaRole | undefined;
|
|
16
|
+
src: import("@uxf/core/utils/resizer").ImageSource | null | undefined;
|
|
17
|
+
widths?: number[] | undefined;
|
|
18
|
+
} & ({
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
} | {
|
|
22
|
+
width?: undefined;
|
|
23
|
+
height: number;
|
|
24
|
+
} | {
|
|
25
|
+
width: number;
|
|
26
|
+
height?: undefined;
|
|
27
|
+
})>;
|
|
5
28
|
};
|
|
6
29
|
export default _default;
|
|
7
30
|
export declare function Default(): JSX.Element;
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
|
-
const index_1 = require("./index");
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const index_1 = require("./index");
|
|
9
9
|
exports.default = {
|
|
10
10
|
title: "UI/RasterImage",
|
|
11
11
|
component: index_1.RasterImage,
|
|
12
12
|
};
|
|
13
13
|
function Default() {
|
|
14
14
|
return (react_1.default.createElement("div", { className: "space-y-2" },
|
|
15
|
-
react_1.default.createElement(index_1.RasterImage, { alt: "Alt text", height: 100, width: 300, mode: "cover" })));
|
|
15
|
+
react_1.default.createElement(index_1.RasterImage, { alt: "Alt text", height: 100, width: 300, mode: "cover", src: undefined })));
|
|
16
16
|
}
|
|
17
17
|
exports.Default = Default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const resolveConfig = require("tailwindcss/resolveConfig");
|
|
5
|
+
const prettier = require("prettier");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
function camelToSnakeCase(str) {
|
|
9
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function capitalizeFirstLetter(str) {
|
|
13
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function resolveProperty(property, theme) {
|
|
17
|
+
const entry = theme[property];
|
|
18
|
+
|
|
19
|
+
if (typeof entry === "undefined") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const propertyValue = JSON.stringify(entry);
|
|
24
|
+
const propertyKey = capitalizeFirstLetter(property);
|
|
25
|
+
|
|
26
|
+
return `
|
|
27
|
+
// this file is generated automatically, do not change anything manually in the contents of this file
|
|
28
|
+
|
|
29
|
+
export const tw${propertyKey} = ${propertyValue};
|
|
30
|
+
|
|
31
|
+
export type Tw${propertyKey} = typeof tw${propertyKey};
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const TW_TOKENS = [
|
|
36
|
+
"boxShadow",
|
|
37
|
+
"colors",
|
|
38
|
+
"containers",
|
|
39
|
+
"fontSize",
|
|
40
|
+
"fontWeight",
|
|
41
|
+
"letterSpacings",
|
|
42
|
+
"lineHeight",
|
|
43
|
+
"screens",
|
|
44
|
+
"spacing",
|
|
45
|
+
"zIndex",
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
let error = false;
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const mode = process.argv.filter((c) => c.includes("--mode="))[0]?.split("=")[1];
|
|
52
|
+
const twConfig = process.argv.filter((c) => c.includes("--twConfig="))[0]?.split("=")[1];
|
|
53
|
+
const outputPath = process.argv.filter((c) => c.includes("--outputPath="))[0]?.split("=")[1];
|
|
54
|
+
|
|
55
|
+
if (!twConfig) {
|
|
56
|
+
throw Error(`Provide valid path to tailwind config. Use "--twConfig" argument.`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!outputPath) {
|
|
60
|
+
throw Error(`Provide valid output path to tailwind tokens. Use "--outputPath" argument.`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const loadedTwConfig = resolveConfig(require(path.resolve(process.cwd(), twConfig)));
|
|
64
|
+
|
|
65
|
+
TW_TOKENS.forEach((property) => {
|
|
66
|
+
const result = resolveProperty(property, loadedTwConfig.theme) || "";
|
|
67
|
+
|
|
68
|
+
const filePath = path.resolve(process.cwd(), `${outputPath}tw-${camelToSnakeCase(property)}.ts`);
|
|
69
|
+
|
|
70
|
+
if (!result && mode !== "check" && fs.existsSync(filePath)) {
|
|
71
|
+
fs.rmSync(filePath);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const newContent = prettier.format(result, {
|
|
75
|
+
parser: "babel",
|
|
76
|
+
tabWidth: 4,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
if (mode === "check") {
|
|
80
|
+
const oldContent = fs.existsSync(filePath) ? fs.readFileSync(filePath).toString() : "";
|
|
81
|
+
|
|
82
|
+
if (newContent !== oldContent) {
|
|
83
|
+
throw new Error("Generated tailwind tokens doesn't match with current tailwind config.");
|
|
84
|
+
}
|
|
85
|
+
} else if (newContent) {
|
|
86
|
+
fs.writeFileSync(filePath, newContent, "utf-8");
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.error(err.message);
|
|
91
|
+
error = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
process.exit(error ? 1 : 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file is generated automatically, do not change anything manually in the contents of this file
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.twBoxShadow = void 0;
|
|
5
|
+
exports.twBoxShadow = {
|
|
6
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
7
|
+
DEFAULT: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
8
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
9
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
10
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
11
|
+
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
|
|
12
|
+
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",
|
|
13
|
+
none: "none",
|
|
14
|
+
};
|