@happlyui/cli 0.2.0 → 0.3.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/dist/index.js +976 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -187194,19 +187194,20 @@ function resolveAlias(alias, config) {
187194
187194
  }
187195
187195
  return alias;
187196
187196
  }
187197
- function getComponentPath(componentName, componentType, config) {
187197
+ function getComponentPath(componentName, componentType, config, fileName) {
187198
187198
  const ext = config.tsx ? ".tsx" : ".jsx";
187199
187199
  const srcPrefix = config.srcDir ? "src/" : "";
187200
+ const finalFileName = fileName || `${componentName}${ext}`;
187200
187201
  switch (componentType) {
187201
187202
  case "registry:ui":
187202
187203
  case "registry:component":
187203
- return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
187204
+ return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), finalFileName);
187204
187205
  case "registry:hook":
187205
- return path2.join(srcPrefix + (config.aliases.hooks || "@/hooks").replace("@/", ""), `${componentName}${ext}`);
187206
+ return path2.join(srcPrefix + (config.aliases.hooks || "@/hooks").replace("@/", ""), finalFileName);
187206
187207
  case "registry:lib":
187207
- return path2.join(srcPrefix + (config.aliases.lib || "@/lib").replace("@/", ""), `${componentName}${ext}`);
187208
+ return path2.join(srcPrefix + (config.aliases.lib || "@/lib").replace("@/", ""), finalFileName);
187208
187209
  default:
187209
- return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
187210
+ return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), finalFileName);
187210
187211
  }
187211
187212
  }
187212
187213
  async function ensureDir(dirPath) {
@@ -187239,9 +187240,9 @@ __export(exports_registry, {
187239
187240
  componentExistsInRegistry: () => componentExistsInRegistry,
187240
187241
  collectDependencies: () => collectDependencies
187241
187242
  });
187242
- import { existsSync as existsSync4 } from "fs";
187243
- import { readFile as readFile4 } from "fs/promises";
187244
- import path4 from "path";
187243
+ import { existsSync as existsSync5 } from "fs";
187244
+ import { readFile as readFile5 } from "fs/promises";
187245
+ import path5 from "path";
187245
187246
  function getRegistryUrl(config) {
187246
187247
  return config?.registry || REGISTRY_URL;
187247
187248
  }
@@ -187251,10 +187252,10 @@ function isLocalRegistry(registry) {
187251
187252
  async function fetchOrRead(url) {
187252
187253
  if (isLocalRegistry(url)) {
187253
187254
  const localPath = url.replace("file://", "");
187254
- if (!existsSync4(localPath)) {
187255
+ if (!existsSync5(localPath)) {
187255
187256
  throw new Error(`Local registry file not found: ${localPath}`);
187256
187257
  }
187257
- const content = await readFile4(localPath, "utf-8");
187258
+ const content = await readFile5(localPath, "utf-8");
187258
187259
  return JSON.parse(content);
187259
187260
  }
187260
187261
  const response = await fetch(url);
@@ -187265,18 +187266,32 @@ async function fetchOrRead(url) {
187265
187266
  }
187266
187267
  async function fetchRegistryIndex(config) {
187267
187268
  const baseUrl = getRegistryUrl(config);
187268
- const url = isLocalRegistry(baseUrl) ? path4.join(baseUrl.replace("file://", ""), "registry.json") : `${baseUrl}/registry.json`;
187269
+ const url = isLocalRegistry(baseUrl) ? path5.join(baseUrl.replace("file://", ""), "registry.json") : `${baseUrl}/registry.json`;
187269
187270
  return fetchOrRead(url);
187270
187271
  }
187272
+ async function fetchOrReadRaw(url) {
187273
+ if (isLocalRegistry(url)) {
187274
+ const localPath = url.replace("file://", "");
187275
+ if (!existsSync5(localPath)) {
187276
+ throw new Error(`Local file not found: ${localPath}`);
187277
+ }
187278
+ return readFile5(localPath, "utf-8");
187279
+ }
187280
+ const response = await fetch(url);
187281
+ if (!response.ok) {
187282
+ throw new Error(`Failed to fetch: ${response.statusText}`);
187283
+ }
187284
+ return response.text();
187285
+ }
187271
187286
  async function fetchRegistryItem(name, config) {
187272
187287
  const baseUrl = getRegistryUrl(config);
187273
187288
  const isLocal = isLocalRegistry(baseUrl);
187274
187289
  const cleanBaseUrl = baseUrl.replace("file://", "");
187275
187290
  const paths = isLocal ? [
187276
- path4.join(cleanBaseUrl, "ui", `${name}.json`),
187277
- path4.join(cleanBaseUrl, "hooks", `${name}.json`),
187278
- path4.join(cleanBaseUrl, "lib", `${name}.json`),
187279
- path4.join(cleanBaseUrl, `${name}.json`)
187291
+ path5.join(cleanBaseUrl, "ui", `${name}.json`),
187292
+ path5.join(cleanBaseUrl, "hooks", `${name}.json`),
187293
+ path5.join(cleanBaseUrl, "lib", `${name}.json`),
187294
+ path5.join(cleanBaseUrl, `${name}.json`)
187280
187295
  ] : [
187281
187296
  `${baseUrl}/ui/${name}.json`,
187282
187297
  `${baseUrl}/hooks/${name}.json`,
@@ -187286,6 +187301,12 @@ async function fetchRegistryItem(name, config) {
187286
187301
  for (const url of paths) {
187287
187302
  try {
187288
187303
  const item = await fetchOrRead(url);
187304
+ await Promise.all(item.files.map(async (file) => {
187305
+ if (!file.content) {
187306
+ const fileUrl = isLocal ? path5.join(cleanBaseUrl, file.path) : `${baseUrl}/${file.path}`;
187307
+ file.content = await fetchOrReadRaw(fileUrl);
187308
+ }
187309
+ }));
187289
187310
  return item;
187290
187311
  } catch {
187291
187312
  continue;
@@ -188668,9 +188689,9 @@ function ora(options) {
188668
188689
  }
188669
188690
 
188670
188691
  // src/commands/init.ts
188671
- import path3 from "path";
188672
- import { existsSync as existsSync3 } from "fs";
188673
- import { readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
188692
+ import path4 from "path";
188693
+ import { existsSync as existsSync4 } from "fs";
188694
+ import { readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
188674
188695
 
188675
188696
  // src/utils/logger.ts
188676
188697
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -188943,6 +188964,909 @@ function getInstallCommand(packageManager, packages, dev) {
188943
188964
  }
188944
188965
  }
188945
188966
 
188967
+ // src/utils/transformers/tailwind.ts
188968
+ import { readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
188969
+ import path3 from "path";
188970
+ import { existsSync as existsSync3 } from "fs";
188971
+
188972
+ // src/utils/templates/tokens.ts
188973
+ var texts = {
188974
+ "title-h1": [
188975
+ "3.5rem",
188976
+ {
188977
+ lineHeight: "4rem",
188978
+ letterSpacing: "-0.01em",
188979
+ fontWeight: "500"
188980
+ }
188981
+ ],
188982
+ "title-h2": [
188983
+ "3rem",
188984
+ {
188985
+ lineHeight: "3.5rem",
188986
+ letterSpacing: "-0.01em",
188987
+ fontWeight: "500"
188988
+ }
188989
+ ],
188990
+ "title-h3": [
188991
+ "2.5rem",
188992
+ {
188993
+ lineHeight: "3rem",
188994
+ letterSpacing: "-0.01em",
188995
+ fontWeight: "500"
188996
+ }
188997
+ ],
188998
+ "title-h4": [
188999
+ "2rem",
189000
+ {
189001
+ lineHeight: "2.5rem",
189002
+ letterSpacing: "-0.005em",
189003
+ fontWeight: "500"
189004
+ }
189005
+ ],
189006
+ "title-h5": [
189007
+ "1.5rem",
189008
+ {
189009
+ lineHeight: "2rem",
189010
+ letterSpacing: "0em",
189011
+ fontWeight: "500"
189012
+ }
189013
+ ],
189014
+ "title-h6": [
189015
+ "1.25rem",
189016
+ {
189017
+ lineHeight: "1.75rem",
189018
+ letterSpacing: "0em",
189019
+ fontWeight: "500"
189020
+ }
189021
+ ],
189022
+ "label-xl": [
189023
+ "1.5rem",
189024
+ {
189025
+ lineHeight: "2rem",
189026
+ letterSpacing: "-0.015em",
189027
+ fontWeight: "500"
189028
+ }
189029
+ ],
189030
+ "label-lg": [
189031
+ "1.125rem",
189032
+ {
189033
+ lineHeight: "1.5rem",
189034
+ letterSpacing: "-0.015em",
189035
+ fontWeight: "500"
189036
+ }
189037
+ ],
189038
+ "label-md": [
189039
+ "1rem",
189040
+ {
189041
+ lineHeight: "1.5rem",
189042
+ letterSpacing: "-0.011em",
189043
+ fontWeight: "500"
189044
+ }
189045
+ ],
189046
+ "label-sm": [
189047
+ ".875rem",
189048
+ {
189049
+ lineHeight: "1.25rem",
189050
+ letterSpacing: "-0.006em",
189051
+ fontWeight: "500"
189052
+ }
189053
+ ],
189054
+ "label-xs": [
189055
+ ".75rem",
189056
+ {
189057
+ lineHeight: "1rem",
189058
+ letterSpacing: "0em",
189059
+ fontWeight: "500"
189060
+ }
189061
+ ],
189062
+ "paragraph-xl": [
189063
+ "1.5rem",
189064
+ {
189065
+ lineHeight: "2rem",
189066
+ letterSpacing: "-0.015em",
189067
+ fontWeight: "400"
189068
+ }
189069
+ ],
189070
+ "paragraph-lg": [
189071
+ "1.125rem",
189072
+ {
189073
+ lineHeight: "1.5rem",
189074
+ letterSpacing: "-0.015em",
189075
+ fontWeight: "400"
189076
+ }
189077
+ ],
189078
+ "paragraph-md": [
189079
+ "1rem",
189080
+ {
189081
+ lineHeight: "1.5rem",
189082
+ letterSpacing: "-0.011em",
189083
+ fontWeight: "400"
189084
+ }
189085
+ ],
189086
+ "paragraph-sm": [
189087
+ ".875rem",
189088
+ {
189089
+ lineHeight: "1.25rem",
189090
+ letterSpacing: "-0.006em",
189091
+ fontWeight: "400"
189092
+ }
189093
+ ],
189094
+ "paragraph-xs": [
189095
+ ".75rem",
189096
+ {
189097
+ lineHeight: "1rem",
189098
+ letterSpacing: "0em",
189099
+ fontWeight: "400"
189100
+ }
189101
+ ],
189102
+ "paragraph-xxs": [
189103
+ ".688rem",
189104
+ {
189105
+ lineHeight: ".75rem",
189106
+ letterSpacing: "-0.007rem",
189107
+ fontWeight: "500"
189108
+ }
189109
+ ],
189110
+ "subheading-md": [
189111
+ "1rem",
189112
+ {
189113
+ lineHeight: "1.5rem",
189114
+ letterSpacing: "0.06em",
189115
+ fontWeight: "500"
189116
+ }
189117
+ ],
189118
+ "subheading-sm": [
189119
+ ".875rem",
189120
+ {
189121
+ lineHeight: "1.25rem",
189122
+ letterSpacing: "0.06em",
189123
+ fontWeight: "500"
189124
+ }
189125
+ ],
189126
+ "subheading-xs": [
189127
+ ".75rem",
189128
+ {
189129
+ lineHeight: "1rem",
189130
+ letterSpacing: "0.04em",
189131
+ fontWeight: "500"
189132
+ }
189133
+ ],
189134
+ "subheading-2xs": [
189135
+ ".6875rem",
189136
+ {
189137
+ lineHeight: ".75rem",
189138
+ letterSpacing: "0.02em",
189139
+ fontWeight: "500"
189140
+ }
189141
+ ],
189142
+ "doc-label": [
189143
+ "1.125rem",
189144
+ {
189145
+ lineHeight: "2rem",
189146
+ letterSpacing: "-0.015em",
189147
+ fontWeight: "500"
189148
+ }
189149
+ ],
189150
+ "doc-paragraph": [
189151
+ "1.125rem",
189152
+ {
189153
+ lineHeight: "2rem",
189154
+ letterSpacing: "-0.015em",
189155
+ fontWeight: "400"
189156
+ }
189157
+ ],
189158
+ inherit: "inherit"
189159
+ };
189160
+ var shadows = {
189161
+ "regular-xs": "0 1px 2px 0 #0a0d1408",
189162
+ "regular-sm": "0 2px 4px #1b1c1d0a",
189163
+ "regular-md": "0 16px 32px -12px #0e121b1a",
189164
+ "regular-deep": "0 0 0 1px rgba(14, 18, 27, 0.04), 0 1px 1px 0.5px rgba(14, 18, 27, 0.04), 0 3px 3px -1.5px rgba(14, 18, 27, 0.02), 0 6px 6px -3px rgba(14, 18, 27, 0.04), 0 12px 12px -6px rgba(14, 18, 27, 0.04), 0 24px 24px -12px rgba(14, 18, 27, 0.04), 0 48px 48px -24px rgba(14, 18, 27, 0.04), 0 -1px 1px -0.5px rgba(14, 18, 27, 0.06) inset",
189165
+ "toggle-switch": "0 6px 10px 0 rgba(14, 18, 27, 0.06), 0 2px 4px 0 rgba(14, 18, 27, 0.03)",
189166
+ "fancy-buttons-stroke": "0 1px 3px 0 rgba(14, 18, 27, 0.12), 0 0 0 1px var(--stroke-soft-200, #E1E4EA)",
189167
+ "button-primary-focus": [
189168
+ '0 0 0 2px theme("colors.ds.white-0")',
189169
+ '0 0 0 4px theme("colors.ds.primary-alpha-10")'
189170
+ ].join(", "),
189171
+ "button-important-focus": [
189172
+ '0 0 0 2px theme("colors.ds.white-0")',
189173
+ '0 0 0 4px theme("colors.ds.alpha.neutral[16]")'
189174
+ ].join(", "),
189175
+ "button-error-focus": [
189176
+ '0 0 0 2px theme("colors.ds.white-0")',
189177
+ '0 0 0 4px theme("colors.ds.error-alpha-10")'
189178
+ ].join(", ")
189179
+ };
189180
+ var borderRadii = {
189181
+ lg: "var(--radius)",
189182
+ md: "calc(var(--radius) - 2px)",
189183
+ sm: "calc(var(--radius) - 4px)",
189184
+ "8": "0.5rem",
189185
+ "10": ".625rem",
189186
+ "12": "0.75rem",
189187
+ "16": "1rem",
189188
+ "20": "1.25rem"
189189
+ };
189190
+ var colors = {
189191
+ primaryColor: "rgb(var(--primary-color-rgb) / <alpha-value>)",
189192
+ primaryColorText: "var(--primary-color-text)",
189193
+ secondaryColor: "var(--secondary-color)",
189194
+ secondaryColorText: "var(--secondary-color-text)",
189195
+ primaryBase: "#335CFF",
189196
+ turquoise: "#2aceb6",
189197
+ glitter: "#e4e9fe",
189198
+ clarity: {
189199
+ "0.1": "#484854",
189200
+ 0: "#575759",
189201
+ 1: "#7F7F82",
189202
+ 2: "#95A0BC",
189203
+ 3: "#B1B1C4",
189204
+ "3.5": "#CFCFD4",
189205
+ "3.75": "#D9D9E2",
189206
+ 4: "#E6E6EC",
189207
+ 5: "#F9FAFB",
189208
+ black: "#2f2f30",
189209
+ blue: {
189210
+ 0: "#595782",
189211
+ 25: "#F8F9FF",
189212
+ 40: "#E6E6EC",
189213
+ 50: "#E6ECFF"
189214
+ },
189215
+ bg: "#f5f6ff",
189216
+ bg2: "#F7F7FC",
189217
+ cyan: "#13B6E7",
189218
+ gray: "#9292A1",
189219
+ verified: "#1393E7",
189220
+ green: "#2AAF3C",
189221
+ pink: "#DD438E",
189222
+ purple: "#4A4DEE",
189223
+ red: "#FF472E",
189224
+ yellow: "#E9A91E",
189225
+ orange: "#FF8447"
189226
+ },
189227
+ ds: {
189228
+ "static-black": "var(--color-static-black)",
189229
+ "static-white": "var(--color-static-white)",
189230
+ "strong-950": "var(--color-text-strong-950)",
189231
+ "sub-600": "var(--color-text-sub-600)",
189232
+ "soft-400": "var(--color-text-soft-400)",
189233
+ "disabled-300": "var(--color-text-disabled-300)",
189234
+ "surface-800": "var(--color-bg-surface-800)",
189235
+ "sub-300": "var(--color-bg-sub-300)",
189236
+ "soft-200": "var(--color-bg-soft-200)",
189237
+ "weak-50": "var(--color-bg-weak-50)",
189238
+ "white-0": "var(--color-bg-white-0)",
189239
+ "stroke-strong-950": "var(--color-stroke-strong-950)",
189240
+ "stroke-sub-300": "var(--color-stroke-sub-300)",
189241
+ "stroke-soft-200": "var(--color-stroke-soft-200)",
189242
+ "stroke-white-0": "var(--color-stroke-white-0)",
189243
+ "primary-dark": "var(--color-primary-dark)",
189244
+ "primary-darker": "var(--color-primary-darker)",
189245
+ "primary-base": "var(--color-primary-base)",
189246
+ "primary-light": "var(--color-primary-light)",
189247
+ "primary-lighter": "var(--color-primary-lighter)",
189248
+ "primary-alpha-24": "var(--color-primary-alpha-24)",
189249
+ "primary-alpha-20": "var(--color-primary-alpha-20)",
189250
+ "primary-alpha-16": "var(--color-primary-alpha-16)",
189251
+ "primary-alpha-10": "var(--color-primary-alpha-10)",
189252
+ "faded-dark": "var(--color-faded-dark)",
189253
+ "faded-base": "var(--color-faded-base)",
189254
+ "faded-light": "var(--color-faded-light)",
189255
+ "faded-lighter": "var(--color-faded-lighter)",
189256
+ "information-dark": "var(--color-information-dark)",
189257
+ "information-base": "var(--color-information-base)",
189258
+ "information-light": "var(--color-information-light)",
189259
+ "information-lighter": "var(--color-information-lighter)",
189260
+ "warning-dark": "var(--color-warning-dark)",
189261
+ "warning-base": "var(--color-warning-base)",
189262
+ "warning-light": "var(--color-warning-light)",
189263
+ "warning-lighter": "var(--color-warning-lighter)",
189264
+ "error-darker": "var(--color-error-darker)",
189265
+ "error-dark": "var(--color-error-dark)",
189266
+ "error-base": "var(--color-error-base)",
189267
+ "error-light": "var(--color-error-light)",
189268
+ "error-lighter": "var(--color-error-lighter)",
189269
+ "error-alpha-10": "var(--color-error-alpha-10)",
189270
+ "success-dark": "var(--color-success-dark)",
189271
+ "success-base": "var(--color-success-base)",
189272
+ "success-light": "var(--color-success-light)",
189273
+ "success-lighter": "var(--color-success-lighter)",
189274
+ "away-dark": "var(--color-away-dark)",
189275
+ "away-base": "var(--color-away-base)",
189276
+ "away-light": "var(--color-away-light)",
189277
+ "away-lighter": "var(--color-away-lighter)",
189278
+ "feature-dark": "var(--color-feature-dark)",
189279
+ "feature-base": "var(--color-feature-base)",
189280
+ "feature-light": "var(--color-feature-light)",
189281
+ "feature-lighter": "var(--color-feature-lighter)",
189282
+ "verified-dark": "var(--color-verified-dark)",
189283
+ "verified-base": "var(--color-verified-base)",
189284
+ "verified-light": "var(--color-verified-light)",
189285
+ "verified-lighter": "var(--color-verified-lighter)",
189286
+ "highlighted-dark": "var(--color-highlighted-dark)",
189287
+ "highlighted-base": "var(--color-highlighted-base)",
189288
+ "highlighted-light": "var(--color-highlighted-light)",
189289
+ "highlighted-lighter": "var(--color-highlighted-lighter)",
189290
+ "stable-dark": "var(--color-stable-dark)",
189291
+ "stable-base": "var(--color-stable-base)",
189292
+ "stable-light": "var(--color-stable-light)",
189293
+ "stable-lighter": "var(--color-stable-lighter)",
189294
+ primary: {
189295
+ 50: "var(--color-primary-50)",
189296
+ 100: "var(--color-primary-100)",
189297
+ 200: "var(--color-primary-200)",
189298
+ 300: "var(--color-primary-300)",
189299
+ 400: "var(--color-primary-400)",
189300
+ 500: "var(--color-primary-500)",
189301
+ 600: "var(--color-primary-600)",
189302
+ 700: "var(--color-primary-700)",
189303
+ 800: "var(--color-primary-800)",
189304
+ 900: "var(--color-primary-900)",
189305
+ 950: "var(--color-primary-950)"
189306
+ },
189307
+ neutral: {
189308
+ 0: "#FFFFFF",
189309
+ 50: "#F5F7FA",
189310
+ 100: "#F2F5F8",
189311
+ 200: "#E1E4EA",
189312
+ 300: "#CACFD8",
189313
+ 400: "#99A0AE",
189314
+ 500: "#717784",
189315
+ 600: "#525866",
189316
+ 700: "#2B303B",
189317
+ 800: "#222530",
189318
+ 900: "#181B25",
189319
+ 950: "#0E121B"
189320
+ },
189321
+ blue: {
189322
+ 50: "#EBF1FF",
189323
+ 100: "#D5E2FF",
189324
+ 200: "#C0D5FF",
189325
+ 300: "#97BAFF",
189326
+ 400: "#6895FF",
189327
+ 500: "#335CFF",
189328
+ 600: "#3559E9",
189329
+ 700: "#2547D0",
189330
+ 800: "#1F3BAD",
189331
+ 900: "#182F8B",
189332
+ 950: "#122368"
189333
+ },
189334
+ orange: {
189335
+ 50: "#FFF3EB",
189336
+ 100: "#FFE6D5",
189337
+ 200: "#FFD9C0",
189338
+ 300: "#FFC197",
189339
+ 400: "#FFA468",
189340
+ 500: "#FF9147",
189341
+ 600: "#E97D35",
189342
+ 700: "#D06925",
189343
+ 800: "#AD581F",
189344
+ 900: "#8B4618",
189345
+ 950: "#683412"
189346
+ },
189347
+ red: {
189348
+ 50: "#FFEBEC",
189349
+ 100: "#FFD5D8",
189350
+ 200: "#FFC0C5",
189351
+ 300: "#FF97A0",
189352
+ 400: "#FF6875",
189353
+ 500: "#FB3748",
189354
+ 600: "#E93544",
189355
+ 700: "#D02533",
189356
+ 800: "#AD1F2B",
189357
+ 900: "#8B1822",
189358
+ 950: "#681219"
189359
+ },
189360
+ green: {
189361
+ 50: "#E0FAEC",
189362
+ 100: "#D0FBE9",
189363
+ 200: "#C2F5DA",
189364
+ 300: "#84EBB4",
189365
+ 400: "#3EE089",
189366
+ 500: "#1FC16B",
189367
+ 600: "#1DAF61",
189368
+ 700: "#178C4E",
189369
+ 800: "#1A7544",
189370
+ 900: "#16643B",
189371
+ 950: "#0B4627"
189372
+ },
189373
+ yellow: {
189374
+ 50: "#FFF4D6",
189375
+ 100: "#FFEFCC",
189376
+ 200: "#FFECC0",
189377
+ 300: "#FFE097",
189378
+ 400: "#FFD268",
189379
+ 500: "#F6B51E",
189380
+ 600: "#E6A819",
189381
+ 700: "#C99A2C",
189382
+ 800: "#A78025",
189383
+ 900: "#86661D",
189384
+ 950: "#624C18"
189385
+ },
189386
+ purple: {
189387
+ 50: "#EFEBFF",
189388
+ 100: "#DCD5FF",
189389
+ 200: "#CAC0FF",
189390
+ 300: "#A897FF",
189391
+ 400: "#8C71F6",
189392
+ 500: "#7D52F4",
189393
+ 600: "#693EE0",
189394
+ 700: "#5B2CC9",
189395
+ 800: "#4C25A7",
189396
+ 900: "#3D1D86",
189397
+ 950: "#351A75"
189398
+ },
189399
+ sky: {
189400
+ 50: "#EBF8FF",
189401
+ 100: "#D5F1FF",
189402
+ 200: "#C0EAFF",
189403
+ 300: "#97DCFF",
189404
+ 400: "#68CDFF",
189405
+ 500: "#47C2FF",
189406
+ 600: "#35ADE9",
189407
+ 700: "#2597D0",
189408
+ 800: "#1F7EAD",
189409
+ 900: "#18658B",
189410
+ 950: "#124B68"
189411
+ },
189412
+ pink: {
189413
+ 50: "#FFEBF4",
189414
+ 100: "#FFD5EA",
189415
+ 200: "#FFC0DF",
189416
+ 300: "#FF97CB",
189417
+ 400: "#FF68B3",
189418
+ 500: "#FB4BA3",
189419
+ 600: "#E9358F",
189420
+ 700: "#D0257A",
189421
+ 800: "#AD1F66",
189422
+ 900: "#8B1852",
189423
+ 950: "#68123D"
189424
+ },
189425
+ teal: {
189426
+ 50: "#E4FBF8",
189427
+ 100: "#D0FBF5",
189428
+ 200: "#C2F5EE",
189429
+ 300: "#84EBDD",
189430
+ 400: "#3FDEC9",
189431
+ 500: "#22D3BB",
189432
+ 600: "#1DAF9C",
189433
+ 700: "#178C7D",
189434
+ 800: "#1A7569",
189435
+ 900: "#16645A",
189436
+ 950: "#0B463E"
189437
+ },
189438
+ alpha: {
189439
+ neutral: {
189440
+ 24: "rgba(153, 160, 174, 0.24)",
189441
+ 16: "rgba(153, 160, 174, 0.16)",
189442
+ 10: "rgba(153, 160, 174, 0.10)"
189443
+ },
189444
+ blue: {
189445
+ 24: "rgba(71, 108, 255, 0.24)",
189446
+ 16: "rgba(71, 108, 255, 0.16)",
189447
+ 10: "rgba(71, 108, 255, 0.10)"
189448
+ },
189449
+ orange: {
189450
+ 24: "rgba(255, 145, 71, 0.24)",
189451
+ 16: "rgba(255, 145, 71, 0.16)",
189452
+ 10: "rgba(255, 145, 71, 0.10)"
189453
+ },
189454
+ red: {
189455
+ 24: "rgba(251, 55, 72, 0.24)",
189456
+ 16: "rgba(251, 55, 72, 0.16)",
189457
+ 10: "rgba(251, 55, 72, 0.10)"
189458
+ },
189459
+ green: {
189460
+ 24: "rgba(31, 193, 107, 0.24)",
189461
+ 16: "rgba(31, 193, 107, 0.16)",
189462
+ 10: "rgba(31, 193, 107, 0.10)"
189463
+ },
189464
+ yellow: {
189465
+ 24: "rgba(251, 198, 75, 0.24)",
189466
+ 16: "rgba(251, 198, 75, 0.16)",
189467
+ 10: "rgba(251, 198, 75, 0.10)"
189468
+ },
189469
+ purple: {
189470
+ 24: "rgba(120, 77, 239, 0.24)",
189471
+ 16: "rgba(120, 77, 239, 0.16)",
189472
+ 10: "rgba(120, 77, 239, 0.10)"
189473
+ },
189474
+ sky: {
189475
+ 24: "rgba(71, 194, 255, 0.24)",
189476
+ 16: "rgba(71, 194, 255, 0.16)",
189477
+ 10: "rgba(71, 194, 255, 0.10)"
189478
+ },
189479
+ pink: {
189480
+ 24: "rgba(251, 75, 163, 0.24)",
189481
+ 16: "rgba(251, 75, 163, 0.16)",
189482
+ 10: "rgba(251, 75, 163, 0.10)"
189483
+ },
189484
+ teal: {
189485
+ 24: "rgba(34, 211, 187, 0.24)",
189486
+ 16: "rgba(34, 211, 187, 0.16)",
189487
+ 10: "rgba(34, 211, 187, 0.10)"
189488
+ },
189489
+ black: {
189490
+ 24: "rgba(0, 0, 0, 0.24)",
189491
+ 16: "rgba(0, 0, 0, 0.16)",
189492
+ 10: "rgba(0, 0, 0, 0.10)"
189493
+ }
189494
+ },
189495
+ white: {
189496
+ 16: "rgba(255, 255, 255, 0.16)"
189497
+ }
189498
+ },
189499
+ overlay: {
189500
+ DEFAULT: "rgb(var(--color-overlay))"
189501
+ }
189502
+ };
189503
+ var semanticMappings = {
189504
+ "static-black": "#171717",
189505
+ "static-white": "var(--color-neutral-0)",
189506
+ "text-strong-950": "var(--color-neutral-950)",
189507
+ "text-sub-600": "var(--color-neutral-600)",
189508
+ "text-soft-400": "var(--color-neutral-400)",
189509
+ "text-disabled-300": "var(--color-neutral-300)",
189510
+ "text-white-0": "var(--color-neutral-0)",
189511
+ overlay: "0 0 0 / 0.75",
189512
+ "bg-strong-950": "var(--color-neutral-950)",
189513
+ "bg-surface-800": "var(--color-neutral-800)",
189514
+ "bg-sub-300": "var(--color-neutral-300)",
189515
+ "bg-soft-200": "var(--color-neutral-200)",
189516
+ "bg-weak-50": "var(--color-neutral-50)",
189517
+ "bg-white-0": "var(--color-neutral-0)",
189518
+ "stroke-strong-950": "var(--color-neutral-950)",
189519
+ "stroke-sub-300": "var(--color-neutral-300)",
189520
+ "stroke-soft-200": "var(--color-neutral-200)",
189521
+ "stroke-white-0": "var(--color-neutral-0)",
189522
+ "primary-darker": "var(--color-blue-800)",
189523
+ "primary-dark": "var(--color-blue-700)",
189524
+ "primary-base": "var(--color-blue-500)",
189525
+ "primary-light": "var(--color-blue-200)",
189526
+ "primary-lighter": "var(--color-blue-100)",
189527
+ "primary-alpha-24": "var(--color-blue-alpha-24)",
189528
+ "primary-alpha-20": "var(--color-blue-alpha-20)",
189529
+ "primary-alpha-16": "var(--color-blue-alpha-16)",
189530
+ "primary-alpha-10": "var(--color-blue-alpha-10)",
189531
+ "primary-50": "var(--color-blue-50)",
189532
+ "primary-100": "var(--color-blue-100)",
189533
+ "primary-200": "var(--color-blue-200)",
189534
+ "primary-300": "var(--color-blue-300)",
189535
+ "primary-400": "var(--color-blue-400)",
189536
+ "primary-500": "var(--color-blue-500)",
189537
+ "primary-600": "var(--color-blue-600)",
189538
+ "primary-700": "var(--color-blue-700)",
189539
+ "primary-800": "var(--color-blue-800)",
189540
+ "primary-900": "var(--color-blue-900)",
189541
+ "primary-950": "var(--color-blue-950)",
189542
+ "faded-dark": "var(--color-neutral-800)",
189543
+ "faded-base": "var(--color-neutral-500)",
189544
+ "faded-light": "var(--color-neutral-200)",
189545
+ "faded-lighter": "var(--color-neutral-100)",
189546
+ "information-dark": "var(--color-blue-950)",
189547
+ "information-base": "var(--color-blue-500)",
189548
+ "information-light": "var(--color-blue-200)",
189549
+ "information-lighter": "var(--color-blue-50)",
189550
+ "warning-dark": "var(--color-yellow-950)",
189551
+ "warning-base": "var(--color-yellow-500)",
189552
+ "warning-light": "var(--color-yellow-200)",
189553
+ "warning-lighter": "var(--color-yellow-50)",
189554
+ "error-darker": "var(--color-red-950)",
189555
+ "error-dark": "var(--color-red-700)",
189556
+ "error-base": "var(--color-red-500)",
189557
+ "error-light": "var(--color-red-200)",
189558
+ "error-lighter": "var(--color-red-50)",
189559
+ "error-alpha-10": "var(--color-red-alpha-10)",
189560
+ "success-dark": "var(--color-green-950)",
189561
+ "success-base": "var(--color-green-500)",
189562
+ "success-light": "var(--color-green-200)",
189563
+ "success-lighter": "var(--color-green-50)",
189564
+ "away-dark": "var(--color-yellow-950)",
189565
+ "away-base": "var(--color-yellow-500)",
189566
+ "away-light": "var(--color-yellow-200)",
189567
+ "away-lighter": "var(--color-yellow-50)",
189568
+ "feature-dark": "var(--color-purple-950)",
189569
+ "feature-base": "var(--color-purple-500)",
189570
+ "feature-light": "var(--color-purple-200)",
189571
+ "feature-lighter": "var(--color-purple-50)",
189572
+ "verified-dark": "var(--color-sky-950)",
189573
+ "verified-base": "var(--color-sky-500)",
189574
+ "verified-light": "var(--color-sky-200)",
189575
+ "verified-lighter": "var(--color-sky-50)",
189576
+ "highlighted-dark": "var(--color-pink-950)",
189577
+ "highlighted-base": "var(--color-pink-500)",
189578
+ "highlighted-light": "var(--color-pink-200)",
189579
+ "highlighted-lighter": "var(--color-pink-50)",
189580
+ "stable-dark": "var(--color-teal-950)",
189581
+ "stable-base": "var(--color-teal-500)",
189582
+ "stable-light": "var(--color-teal-200)",
189583
+ "stable-lighter": "var(--color-teal-50)"
189584
+ };
189585
+ var baseSemanticColors = {
189586
+ background: "hsl(var(--background))",
189587
+ foreground: "hsl(var(--foreground))",
189588
+ card: {
189589
+ DEFAULT: "hsl(var(--card))",
189590
+ foreground: "hsl(var(--card-foreground))"
189591
+ },
189592
+ popover: {
189593
+ DEFAULT: "hsl(var(--popover))",
189594
+ foreground: "hsl(var(--popover-foreground))"
189595
+ },
189596
+ primary: {
189597
+ DEFAULT: "hsl(var(--primary))",
189598
+ foreground: "hsl(var(--primary-foreground))"
189599
+ },
189600
+ secondary: {
189601
+ DEFAULT: "hsl(var(--secondary))",
189602
+ foreground: "hsl(var(--secondary-foreground))"
189603
+ },
189604
+ muted: {
189605
+ DEFAULT: "hsl(var(--muted))",
189606
+ foreground: "hsl(var(--muted-foreground))"
189607
+ },
189608
+ accent: {
189609
+ DEFAULT: "hsl(var(--accent))",
189610
+ foreground: "hsl(var(--accent-foreground))"
189611
+ },
189612
+ destructive: {
189613
+ DEFAULT: "hsl(var(--destructive))",
189614
+ foreground: "hsl(var(--destructive-foreground))"
189615
+ },
189616
+ border: "hsl(var(--border))",
189617
+ input: "hsl(var(--input))",
189618
+ ring: "hsl(var(--ring))"
189619
+ };
189620
+ var fontFamilies = {
189621
+ thunder: [
189622
+ "var(--font-thunder)",
189623
+ "var(--font-inter)",
189624
+ "ui-sans-serif",
189625
+ "system-ui",
189626
+ "sans-serif",
189627
+ '"Apple Color Emoji"',
189628
+ '"Segoe UI Emoji"',
189629
+ '"Segoe UI Symbol"',
189630
+ '"Noto Color Emoji"'
189631
+ ],
189632
+ sans: [
189633
+ "var(--font-inter)",
189634
+ "ui-sans-serif",
189635
+ "system-ui",
189636
+ "sans-serif",
189637
+ '"Apple Color Emoji"',
189638
+ '"Segoe UI Emoji"',
189639
+ '"Segoe UI Symbol"',
189640
+ '"Noto Color Emoji"'
189641
+ ],
189642
+ ubuntu: ["var(--font-ubuntu)"],
189643
+ inter: ["var(--font-inter)", "sans-serif"],
189644
+ poppins: ["Poppins", "sans-serif"]
189645
+ };
189646
+ var backgroundImage = {
189647
+ "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
189648
+ "gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))"
189649
+ };
189650
+ var screens = {
189651
+ xs: "480px",
189652
+ "1200px": "1200px",
189653
+ "3xl": "1920px",
189654
+ "4xl": "2560px",
189655
+ tall: { raw: "(min-height: 910px)" }
189656
+ };
189657
+ var keyframes = {
189658
+ "accordion-down": {
189659
+ from: { height: "0" },
189660
+ to: { height: "var(--radix-accordion-content-height)" }
189661
+ },
189662
+ "accordion-up": {
189663
+ from: { height: "var(--radix-accordion-content-height)" },
189664
+ to: { height: "0" }
189665
+ },
189666
+ "spin-smooth": {
189667
+ "0%": { transform: "rotate(0deg)" },
189668
+ "100%": { transform: "rotate(360deg)" }
189669
+ },
189670
+ "copy-success": {
189671
+ "0%": { transform: "scale(0.5)", opacity: "0" },
189672
+ "50%": { transform: "scale(1.2)" },
189673
+ "100%": { transform: "scale(1)", opacity: "1" }
189674
+ }
189675
+ };
189676
+ var animations = {
189677
+ "accordion-down": "accordion-down 0.2s ease-out",
189678
+ "accordion-up": "accordion-up 0.2s ease-out",
189679
+ "spin-smooth": "spin-smooth 1s linear infinite",
189680
+ "copy-success": "copy-success 0.3s ease-out forwards"
189681
+ };
189682
+
189683
+ // src/utils/transformers/tailwind.ts
189684
+ async function updateTailwindConfig(cwd, config, tailwindVersion) {
189685
+ if (tailwindVersion === 4) {
189686
+ await updateCssV4(cwd, config);
189687
+ } else {
189688
+ await updateConfigV3(cwd, config);
189689
+ await updateCssV3(cwd, config);
189690
+ }
189691
+ }
189692
+ function generateCssVariables() {
189693
+ const vars = [];
189694
+ const ds = colors.ds || {};
189695
+ Object.entries(ds).forEach(([key, value]) => {
189696
+ if (key === "primary")
189697
+ return;
189698
+ if (typeof value === "object" && value !== null) {
189699
+ const palette = value;
189700
+ Object.entries(palette).forEach(([shade, colorValue]) => {
189701
+ if (typeof colorValue === "string" && !colorValue.startsWith("var(")) {
189702
+ vars.push(` --color-${key}-${shade}: ${colorValue};`);
189703
+ }
189704
+ });
189705
+ }
189706
+ });
189707
+ Object.entries(semanticMappings).forEach(([key, value]) => {
189708
+ vars.push(` --color-${key}: ${value};`);
189709
+ });
189710
+ return `:root {
189711
+ ${vars.join(`
189712
+ `)}
189713
+ }
189714
+ `;
189715
+ }
189716
+ function generateThemeBlock() {
189717
+ const lines = [];
189718
+ Object.entries(texts).forEach(([key, value]) => {
189719
+ const [fontSize, options] = value;
189720
+ lines.push(` --text-${key}: ${fontSize};`);
189721
+ if (options.lineHeight)
189722
+ lines.push(` --text-${key}--line-height: ${options.lineHeight};`);
189723
+ if (options.letterSpacing)
189724
+ lines.push(` --text-${key}--letter-spacing: ${options.letterSpacing};`);
189725
+ if (options.fontWeight)
189726
+ lines.push(` --text-${key}--font-weight: ${options.fontWeight};`);
189727
+ });
189728
+ Object.entries(shadows).forEach(([key, value]) => {
189729
+ lines.push(` --shadow-${key}: ${value};`);
189730
+ });
189731
+ Object.entries(borderRadii).forEach(([key, value]) => {
189732
+ lines.push(` --radius-${key}: ${value};`);
189733
+ });
189734
+ const ds = colors.ds || {};
189735
+ const flattenDs = (obj, prefix) => {
189736
+ Object.entries(obj).forEach(([key, value]) => {
189737
+ if (typeof value === "object" && value !== null) {
189738
+ flattenDs(value, `${prefix}-${key}`);
189739
+ } else if (typeof value === "string") {
189740
+ lines.push(` --color-${prefix}-${key}: ${value};`);
189741
+ }
189742
+ });
189743
+ };
189744
+ flattenDs(ds, "ds");
189745
+ return `@theme {
189746
+ ${lines.join(`
189747
+ `)}
189748
+ }
189749
+ `;
189750
+ }
189751
+ async function updateCssV4(cwd, config) {
189752
+ const cssPath = path3.join(cwd, config.tailwind.css);
189753
+ if (!existsSync3(path3.dirname(cssPath)))
189754
+ return;
189755
+ let content = "";
189756
+ if (existsSync3(cssPath)) {
189757
+ content = await readFile3(cssPath, "utf-8");
189758
+ }
189759
+ const themeBlock = generateThemeBlock();
189760
+ const varsBlock = generateCssVariables();
189761
+ if (!content.includes("@import")) {
189762
+ content = `@import "tailwindcss";
189763
+
189764
+ ${content}`;
189765
+ }
189766
+ if (!content.includes("--color-ds-primary-dark:")) {
189767
+ content += `
189768
+
189769
+ ${themeBlock}`;
189770
+ }
189771
+ if (!content.includes("--color-primary-500:")) {
189772
+ content += `
189773
+
189774
+ ${varsBlock}`;
189775
+ }
189776
+ await writeFile2(cssPath, content, "utf-8");
189777
+ logger.success(`Updated ${config.tailwind.css} with Happly tokens (v4)`);
189778
+ }
189779
+ async function updateCssV3(cwd, config) {
189780
+ const cssPath = path3.join(cwd, config.tailwind.css);
189781
+ if (!existsSync3(cssPath))
189782
+ return;
189783
+ let content = await readFile3(cssPath, "utf-8");
189784
+ const varsBlock = generateCssVariables();
189785
+ if (!content.includes("--color-primary-500:")) {
189786
+ content += `
189787
+
189788
+ ${varsBlock}`;
189789
+ await writeFile2(cssPath, content, "utf-8");
189790
+ logger.success(`Updated ${config.tailwind.css} with CSS variables`);
189791
+ }
189792
+ }
189793
+ async function updateConfigV3(cwd, config) {
189794
+ const configPath = path3.join(cwd, config.tailwind.config);
189795
+ if (!existsSync3(configPath)) {
189796
+ logger.warn(`Tailwind config file not found at ${configPath}`);
189797
+ return;
189798
+ }
189799
+ let content = await readFile3(configPath, "utf-8");
189800
+ if (content.includes("ds:")) {
189801
+ logger.info("Tailwind config already has 'ds' colors. Skipping update.");
189802
+ return;
189803
+ }
189804
+ const extendContent = generateV3ExtendObject();
189805
+ const extendRegex = /extend:\s*\{/;
189806
+ if (extendRegex.test(content)) {
189807
+ content = content.replace(extendRegex, (match) => `${match}
189808
+ ${extendContent},`);
189809
+ await writeFile2(configPath, content, "utf-8");
189810
+ logger.success(`Updated ${config.tailwind.config} with Happly tokens`);
189811
+ } else {
189812
+ const themeRegex = /theme:\s*\{/;
189813
+ if (themeRegex.test(content)) {
189814
+ content = content.replace(themeRegex, (match) => `${match}
189815
+ extend: {
189816
+ ${extendContent}
189817
+ },`);
189818
+ await writeFile2(configPath, content, "utf-8");
189819
+ logger.success(`Updated ${config.tailwind.config} with Happly tokens (new extend block)`);
189820
+ } else {
189821
+ logger.warn(`Could not update ${config.tailwind.config}. Please add Happly tokens manually.`);
189822
+ }
189823
+ }
189824
+ }
189825
+ function generateV3ExtendObject() {
189826
+ const allColors = {
189827
+ ...colors,
189828
+ ...baseSemanticColors
189829
+ };
189830
+ const colorsJson = JSON.stringify(allColors, null, 6).slice(2, -2);
189831
+ const colorsStr = ` colors: {
189832
+ ${colorsJson}
189833
+ }`;
189834
+ const fontSizeJson = JSON.stringify(texts, null, 6).slice(2, -2);
189835
+ const fontSizeStr = ` fontSize: {
189836
+ ${fontSizeJson}
189837
+ }`;
189838
+ const shadowJson = JSON.stringify(shadows, null, 6).slice(2, -2);
189839
+ const shadowStr = ` boxShadow: {
189840
+ ${shadowJson}
189841
+ }`;
189842
+ const radiusJson = JSON.stringify(borderRadii, null, 6).slice(2, -2);
189843
+ const radiusStr = ` borderRadius: {
189844
+ ${radiusJson}
189845
+ }`;
189846
+ return [
189847
+ colorsStr,
189848
+ fontSizeStr,
189849
+ shadowStr,
189850
+ radiusStr,
189851
+ ` fontFamily: {
189852
+ ${JSON.stringify(fontFamilies, null, 6).slice(2, -2)}
189853
+ }`,
189854
+ ` backgroundImage: {
189855
+ ${JSON.stringify(backgroundImage, null, 6).slice(2, -2)}
189856
+ }`,
189857
+ ` screens: {
189858
+ ${JSON.stringify(screens, null, 6).slice(2, -2)}
189859
+ }`,
189860
+ ` keyframes: {
189861
+ ${JSON.stringify(keyframes, null, 6).slice(2, -2)}
189862
+ }`,
189863
+ ` animation: {
189864
+ ${JSON.stringify(animations, null, 6).slice(2, -2)}
189865
+ }`
189866
+ ].join(`,
189867
+ `);
189868
+ }
189869
+
188946
189870
  // src/utils/env.ts
188947
189871
  function isNonInteractive() {
188948
189872
  if (isAIAgent()) {
@@ -189232,24 +190156,32 @@ async function init(options) {
189232
190156
  await writeComponentFile(cwd, `${utilsPath}${utilsExt}`, utilsContent);
189233
190157
  writeSpinner.text = `Created ${utilsPath}${utilsExt}`;
189234
190158
  const cssPath = config.tailwind.css;
189235
- const fullCssPath = path3.join(cwd, cssPath);
190159
+ const fullCssPath = path4.join(cwd, cssPath);
189236
190160
  const cssTemplate = projectInfo.tailwindVersion === 4 ? CSS_TEMPLATE_V4 : CSS_TEMPLATE_V3;
189237
- if (!existsSync3(fullCssPath)) {
190161
+ if (!existsSync4(fullCssPath)) {
189238
190162
  await writeComponentFile(cwd, cssPath, cssTemplate);
189239
190163
  writeSpinner.text = `Created ${cssPath}`;
189240
190164
  } else {
189241
- const existingCss = await readFile3(fullCssPath, "utf-8");
190165
+ const existingCss = await readFile4(fullCssPath, "utf-8");
189242
190166
  if (!existingCss.includes("--background:")) {
189243
190167
  if (projectInfo.tailwindVersion === 4 && existingCss.includes('@import "tailwindcss"')) {
189244
190168
  const updatedCss = existingCss.replace('@import "tailwindcss";', cssTemplate);
189245
- await writeFile2(fullCssPath, updatedCss, "utf-8");
190169
+ await writeFile3(fullCssPath, updatedCss, "utf-8");
189246
190170
  } else {
189247
- await writeFile2(fullCssPath, cssTemplate + `
190171
+ if (existingCss.includes("@tailwind base")) {
190172
+ const templateWithoutDirectives = cssTemplate.replace(/@tailwind\s+(base|components|utilities);\n?/g, "");
190173
+ await writeFile3(fullCssPath, existingCss + `
190174
+ ` + templateWithoutDirectives, "utf-8");
190175
+ } else {
190176
+ await writeFile3(fullCssPath, cssTemplate + `
189248
190177
  ` + existingCss, "utf-8");
190178
+ }
189249
190179
  }
189250
190180
  writeSpinner.text = `Updated ${cssPath}`;
189251
190181
  }
189252
190182
  }
190183
+ writeSpinner.text = "Applying Happly UI design tokens...";
190184
+ await updateTailwindConfig(cwd, config, projectInfo.tailwindVersion);
189253
190185
  writeSpinner.succeed("Configuration written successfully");
189254
190186
  } catch (error) {
189255
190187
  writeSpinner.fail("Failed to write configuration");
@@ -189320,6 +190252,7 @@ function createConfig(projectInfo, responses) {
189320
190252
 
189321
190253
  // src/commands/add.ts
189322
190254
  var import_prompts2 = __toESM(require_prompts3(), 1);
190255
+ import path6 from "path";
189323
190256
  init_config();
189324
190257
  init_registry();
189325
190258
 
@@ -189381,20 +190314,20 @@ async function add(components, options) {
189381
190314
  }
189382
190315
  const projectInfo = await detectProject(cwd);
189383
190316
  if (options.all) {
189384
- const spinner = ora("Fetching available components...").start();
190317
+ const spinner2 = ora("Fetching available components...").start();
189385
190318
  try {
189386
190319
  components = await getAvailableComponents(config);
189387
- spinner.succeed(`Found ${components.length} components`);
190320
+ spinner2.succeed(`Found ${components.length} components`);
189388
190321
  } catch (error) {
189389
- spinner.fail("Failed to fetch components list");
190322
+ spinner2.fail("Failed to fetch components list");
189390
190323
  throw error;
189391
190324
  }
189392
190325
  }
189393
190326
  if (components.length === 0) {
189394
- const spinner = ora("Fetching available components...").start();
190327
+ const spinner2 = ora("Fetching available components...").start();
189395
190328
  try {
189396
190329
  const available = await getAvailableComponents(config);
189397
- spinner.stop();
190330
+ spinner2.stop();
189398
190331
  const { selected } = await import_prompts2.default({
189399
190332
  type: "multiselect",
189400
190333
  name: "selected",
@@ -189411,7 +190344,7 @@ async function add(components, options) {
189411
190344
  }
189412
190345
  components = selected;
189413
190346
  } catch (error) {
189414
- spinner.fail("Failed to fetch components");
190347
+ spinner2.fail("Failed to fetch components");
189415
190348
  throw error;
189416
190349
  }
189417
190350
  }
@@ -189433,7 +190366,9 @@ async function add(components, options) {
189433
190366
  const existingFiles = [];
189434
190367
  for (const item of items) {
189435
190368
  for (const file of item.files) {
189436
- const targetPath = getComponentPath(item.name, item.type, config);
190369
+ const fileType = file.type || item.type;
190370
+ const fileName = path6.basename(file.path);
190371
+ const targetPath = getComponentPath(item.name, fileType, config, fileName);
189437
190372
  if (componentExists(cwd, targetPath)) {
189438
190373
  existingFiles.push(targetPath);
189439
190374
  }
@@ -189459,7 +190394,9 @@ async function add(components, options) {
189459
190394
  try {
189460
190395
  for (const item of items) {
189461
190396
  for (const file of item.files) {
189462
- const targetPath = getComponentPath(item.name, item.type, config);
190397
+ const fileType = file.type || item.type;
190398
+ const fileName = path6.basename(file.path);
190399
+ const targetPath = getComponentPath(item.name, fileType, config, fileName);
189463
190400
  const transformedContent = transformComponent(file, config);
189464
190401
  await writeComponentFile(cwd, targetPath, transformedContent);
189465
190402
  writtenFiles.push(targetPath);
@@ -189496,6 +190433,14 @@ async function add(components, options) {
189496
190433
  logger.warn(`Please install manually: ${devDependencies.join(" ")}`);
189497
190434
  }
189498
190435
  }
190436
+ const spinner = ora("Updating Tailwind configuration...").start();
190437
+ try {
190438
+ await updateTailwindConfig(cwd, config, projectInfo.tailwindVersion);
190439
+ spinner.succeed("Tailwind configuration updated");
190440
+ } catch (error) {
190441
+ spinner.fail("Failed to update Tailwind configuration");
190442
+ logger.warn("Please ensure your tailwind.config.ts includes Happly UI tokens.");
190443
+ }
189499
190444
  logger.break();
189500
190445
  logger.success("Components installed successfully!");
189501
190446
  logger.break();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happlyui/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Add HapplyUI components to your project",
5
5
  "type": "module",
6
6
  "bin": {