atomsystem 0.1.16 → 0.1.18

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.
@@ -1,160 +0,0 @@
1
- import type { Config } from "tailwindcss";
2
-
3
- export default {
4
- content: [
5
- "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6
- "./components/**/*.{js,ts,jsx,tsx,mdx}",
7
- "./app/**/*.{js,ts,jsx,tsx,mdx}",
8
- ],
9
-
10
- plugins: [],
11
- theme: {
12
- extend: {
13
- colors: {
14
- "primary": "var(--brand-primary)",
15
- "danger": "var(--system-danger)",
16
- "fill-wrapper": "var(--fill-wrapper)",
17
- "fill-card": "var(--fill-card)",
18
- "fill-group": "var(--fill-info)",
19
- "fill-border": "var(--fill-border)",
20
- "text-standard": "var(--text-standard)",
21
- "text-sub": "var(--text-sub)",
22
- "text-reverse": "var(--text-reverse)",
23
- "text-sub-reverse": "var(--text-sub-reverse)",
24
- "input-background-standard": "var(--input-background-standard)",
25
- "input-background-disabled": "var(--input-background-disabled)",
26
- "input-background-value": "var(--input-background-value)",
27
- "input-background-success": "var(--input-background-success)",
28
- "input-background-error": "var(--input-background-error)",
29
- "input-border-standard": "var(--input-border-standard)",
30
- "input-border-focus": "var(--input-border-focus)",
31
- "input-border-success": "var(--input-border-success)",
32
- "input-border-error": "var(--input-border-error)",
33
- "input-text-value": "var(--input-text-value)",
34
- "input-text-placeholder": "var(--input-text-placeholder)",
35
- "input-text-success": "var(--input-text-success)",
36
- "input-text-error": "var(--input-text-error)",
37
- "button-text":"var(--button-text)",
38
- "button-primary-standard":"var(--button-primary-standard-background)",
39
- "button-primary-hover":"var(--button-primary-hover-background)",
40
- "button-primary-disabled":"var(--button-primary-disabled-background)",
41
- "button-secondary-standard":"var(--button-secondary-standard-background)",
42
- "button-secondary-hover":"var(--button-secondary-hover-background)",
43
- "button-secondary-disabled":"var(--button-secondary-disabled-background)",
44
- "button-success-standard":"var(--button-success-standard-background)",
45
- "button-success-hover":"var(--button-success-hover-background)",
46
- "button-success-disabled":"var(--button-success-disabled-background)",
47
- "button-danger-standard":"var(--button-danger-standard-background)",
48
- "button-danger-hover":"var(--button-danger-hover-background)",
49
- "button-danger-disabled":"var(--button-danger-disabled-background)",
50
- "button-gray-standard":"var(--button-gray-standard-background)",
51
- "button-gray-hover":"var(--button-gray-hover-background)",
52
- "button-gray-disabled":"var(--button-gray-disabled-background)",
53
- },
54
- fontSize: {
55
- // Desktop
56
- h1: [
57
- "var(--desktop-h1-font-size)",
58
- {
59
- lineHeight: "calc(var(--desktop-h1-line-height) * 1px)",
60
- fontWeight: "var(--desktop-h1-font-weight)",
61
- },
62
- ],
63
- h2: [
64
- "var(--desktop-h2-font-size)",
65
- {
66
- lineHeight: "calc(var(--desktop-h2-line-height) * 1px)",
67
- fontWeight: "var(--desktop-h2-font-weight)",
68
- },
69
- ],
70
- h3: [
71
- "var(--desktop-h3-font-size)",
72
- {
73
- lineHeight: "calc(var(--desktop-h3-line-height) * 1px)",
74
- fontWeight: "var(--desktop-h3-font-weight)",
75
- },
76
- ],
77
- h4: [
78
- "var(--desktop-h4-font-size)",
79
- {
80
- lineHeight: "calc(var(--desktop-h4-line-height) * 1px)",
81
- fontWeight: "var(--desktop-h4-font-weight)",
82
- },
83
- ],
84
- h5: [
85
- "var(--desktop-h5-font-size)",
86
- {
87
- lineHeight: "calc(var(--desktop-h5-line-height) * 1px)",
88
- fontWeight: "var(--desktop-h5-font-weight)",
89
- },
90
- ],
91
- h6: [
92
- "var(--desktop-h6-font-size)",
93
- {
94
- lineHeight: "calc(var(--desktop-h6-line-height) * 1px)",
95
- fontWeight: "var(--desktop-h6-font-weight)",
96
- },
97
- ],
98
-
99
- // Mobile
100
- mobileH1: [
101
- "var(--mobile-h1-font-size)",
102
- {
103
- lineHeight: "calc(var(--mobile-h1-line-height) * 1px)",
104
- fontWeight: "var(--mobile-h1-font-weight)",
105
- },
106
- ],
107
- mobileH2: [
108
- "var(--mobile-h2-font-size)",
109
- {
110
- lineHeight: "calc(var(--mobile-h2-line-height) * 1px)",
111
- fontWeight: "var(--mobile-h2-font-weight)",
112
- },
113
- ],
114
- mobileH3: [
115
- "var(--mobile-h3-font-size)",
116
- {
117
- lineHeight: "calc(var(--mobile-h3-line-height) * 1px)",
118
- fontWeight: "var(--mobile-h3-font-weight)",
119
- },
120
- ],
121
- mobileH4: [
122
- "var(--mobile-h4-font-size)",
123
- {
124
- lineHeight: "calc(var(--mobile-h4-line-height) * 1px)",
125
- fontWeight: "var(--mobile-h4-font-weight)",
126
- },
127
- ],
128
- mobileH5: [
129
- "var(--mobile-h5-font-size)",
130
- {
131
- lineHeight: "calc(var(--mobile-h5-line-height) * 1px)",
132
- fontWeight: "var(--mobile-h5-font-weight)",
133
- },
134
- ],
135
- mobileH6: [
136
- "var(--mobile-h6-font-size)",
137
- {
138
- lineHeight: "calc(var(--mobile-h6-line-height) * 1px)",
139
- fontWeight: "var(--mobile-h6-font-weight)",
140
- },
141
- ],
142
- },
143
- borderRadius: {
144
- "common": "var(--rounded-common)",
145
- "none": "var(--rounded-none)",
146
- "xs": "var(--rounded-xs)",
147
- "sm": "var(--rounded-sm)",
148
- "md": "var(--rounded-md)",
149
- "lg": "var(--rounded-lg)",
150
- "full": "var(--rounded-full)",
151
- "input-rounded": "var(--input-rounded)"
152
-
153
- },
154
- fontFamily: {
155
- "main": ["var(--main-title)"],
156
- "body": ["var(--desktop-body-base-font-family)"],
157
- },
158
- },
159
- },
160
- } satisfies Config;
@@ -1,87 +0,0 @@
1
- import StyleDictionary from "style-dictionary";
2
- import { register } from "@tokens-studio/sd-transforms";
3
-
4
- import { readFileSync, writeFileSync } from "fs";
5
-
6
- import path from "path";
7
-
8
- register(StyleDictionary);
9
-
10
- // 원본 token.json 파일 읽기
11
- const tokenFile = readFileSync("token.json", "utf8");
12
- const tokenData = JSON.parse(tokenFile);
13
- // console.log(tokenData);
14
-
15
- // css 파일 빌드 후 통합하여 global.css에 제공하는 함수
16
- const processCss = async (tokenSetOrder) => {
17
- let globalCSS = "";
18
-
19
- let globalItems = readFileSync(
20
- path.join(process.cwd(), "build", `global.variables.css`),
21
- "utf8"
22
- )
23
- .replace(":root {", "")
24
- .replace(/}\s*$/, "") // 마지막 } 제거;
25
- .split(";") // 세미콜론 기준으로 나눔
26
- .map((item) => item.trim()) // 양 끝 공백 제거
27
- .filter(Boolean); //빈 값 제거
28
-
29
- tokenSetOrder.forEach((tokenValue) => {
30
- const filePath = path.join(
31
- process.cwd(),
32
- "build",
33
- `${tokenValue}.variables.css`
34
- );
35
-
36
- try {
37
- let items = readFileSync(filePath, "utf8")
38
- .replace(":root {", "")
39
- .replace(/}\s*$/, "") // 마지막 } 제거;
40
- .split(";") // 세미콜론 기준으로 나눔
41
- .map((item) => item.trim()) // 양 끝 공백 제거
42
- .filter(Boolean); //빈 값 제거
43
-
44
- const uniqueItems = items.filter((item) => !globalItems.includes(item));
45
-
46
- // 각 토큰별 css를 구조에 맞게 추가
47
- globalCSS += `
48
-
49
- .${tokenValue} {
50
- ${uniqueItems.join(";")}
51
- }
52
- `;
53
- } catch (error) {
54
- console.log(`파일 읽기 실패:${filePath}`, error);
55
- }
56
- });
57
-
58
- // tailwind 지시어와 통합
59
-
60
- const combinedCSS = `
61
- @tailwind base;
62
- @tailwind components;
63
- @tailwind utilities;
64
-
65
- @layer base{
66
- :root{
67
- ${globalItems.join(";")}
68
- }
69
- }
70
-
71
- ${globalCSS}
72
- `;
73
-
74
- // 결과를 app/globals.css에 저장
75
- writeFileSync(
76
- path.join(process.cwd(), "app", "globals.css"),
77
- combinedCSS,
78
- "utf8"
79
- );
80
- console.log("global.css 파일이 성공적으로 생성되었습니다.");
81
- };
82
-
83
- try {
84
- processCss(tokenData.$metadata.tokenSetOrder);
85
- } catch (error) {
86
- console.error("css파일 통합 처리중 오류가 발생했습니다:", error);
87
- }
@@ -1,81 +0,0 @@
1
- import StyleDictionary from "style-dictionary";
2
- import { register } from "@tokens-studio/sd-transforms";
3
- import { expandTypesMap } from "@tokens-studio/sd-transforms";
4
-
5
- import { readFileSync, writeFileSync, rmSync, mkdirSync } from "fs";
6
- import { existsSync } from "fs";
7
-
8
- register(StyleDictionary);
9
-
10
- // 원본 token.json 파일 읽기
11
- const tokenFile = readFileSync("token.json", "utf8");
12
- const tokenData = JSON.parse(tokenFile);
13
- // console.log(tokenData);
14
-
15
- // build 디렉토리가 없으면 생성
16
- const buildDir = "build/";
17
- if (existsSync(buildDir)) {
18
- rmSync(buildDir, { recursive: true, force: true });
19
- }
20
- mkdirSync(buildDir);
21
-
22
- const buildTokens = async () => {
23
- // tokenSetOrder 배열에서 각 항목에 대해 파일 생성
24
- tokenData.$metadata.tokenSetOrder.forEach((tokenSet) => {
25
- const fileName = `tokens/token/${tokenSet}.json`;
26
-
27
- // 각 토큰셋의 데이터를 가져옴
28
- const originalTokens = tokenData[tokenSet] || {};
29
- const globalTokens = tokenData["global"] || {};
30
- const cleanedTokens = { ...globalTokens }; // 초기값으로 globalTokens 추가
31
-
32
- // console.log(originalTokens);
33
- // console.log(globalTokens);
34
-
35
- // 최상위 그룹을 제외한 나머지 데이터 처리
36
- Object.entries(originalTokens).forEach(([groupKey, groupValue]) => {
37
- if (groupKey === tokenSet) {
38
- return; // 최상위 그룹 스킵
39
- }
40
-
41
- if (groupValue && typeof groupValue === "object") {
42
- cleanedTokens[groupKey] = groupValue;
43
- }
44
- });
45
-
46
- // 각 토큰 파일 생성
47
- writeFileSync(fileName, JSON.stringify(cleanedTokens, null, 2), "utf8");
48
- console.log(`${fileName} 파일이 생성되었습니다.`);
49
-
50
- // StyleDictionary 인스턴스 생성 및 빌드
51
- const sdTransfer = new StyleDictionary({
52
- source: [fileName],
53
- preprocessors: ["tokens-studio"],
54
- expand: {
55
- typesMap: expandTypesMap,
56
- },
57
- platforms: {
58
- css: {
59
- transformGroup: "tokens-studio",
60
- transforms: ["ts/size/px", "ts/opacity", "name/kebab"],
61
- buildPath: buildDir,
62
- files: [
63
- {
64
- destination: `${tokenSet}.variables.css`,
65
- format: "css/variables",
66
- },
67
- ],
68
- },
69
- },
70
- });
71
-
72
- sdTransfer.cleanAllPlatforms(); // 기존 빌드 삭제
73
- sdTransfer.buildAllPlatforms(); // 빌드 실행
74
- });
75
- };
76
-
77
- try {
78
- buildTokens();
79
- } catch (error) {
80
- console.error("토크파일 처리중 오류가 발생했습니다:", error);
81
- }