myoperator-ui 0.0.33 → 0.0.35

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 +69 -53
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -903,6 +903,17 @@ var CSS_VARIABLES_V3 = `@tailwind base;
903
903
  @tailwind components;
904
904
  @tailwind utilities;
905
905
 
906
+ /* Reset Bootstrap button styles for myOperator UI components */
907
+ @layer components {
908
+ .inline-flex[class*="rounded"],
909
+ button.bg-\\[\\#343E55\\],
910
+ button.bg-\\[\\#E8EAED\\],
911
+ button.bg-transparent {
912
+ border: none;
913
+ box-shadow: none;
914
+ }
915
+ }
916
+
906
917
  @layer base {
907
918
  :root {
908
919
  --background: 0 0% 100%;
@@ -1072,6 +1083,38 @@ async function init() {
1072
1083
  console.log(chalk2.blue(" \u2139 Bootstrap detected - will configure Tailwind to avoid conflicts\n"));
1073
1084
  }
1074
1085
  }
1086
+ const detectGlobalCss = async () => {
1087
+ const cssOptions = [
1088
+ "src/index.css",
1089
+ "src/styles/globals.css",
1090
+ "src/styles/index.css",
1091
+ "src/app/globals.css",
1092
+ "app/globals.css",
1093
+ "styles/globals.css"
1094
+ ];
1095
+ for (const css of cssOptions) {
1096
+ if (await fs2.pathExists(path2.join(cwd, css))) {
1097
+ return css;
1098
+ }
1099
+ }
1100
+ return "src/index.css";
1101
+ };
1102
+ const detectTailwindConfig = async () => {
1103
+ const configOptions = [
1104
+ "tailwind.config.js",
1105
+ "tailwind.config.ts",
1106
+ "tailwind.config.mjs",
1107
+ "tailwind.config.cjs"
1108
+ ];
1109
+ for (const config of configOptions) {
1110
+ if (await fs2.pathExists(path2.join(cwd, config))) {
1111
+ return config;
1112
+ }
1113
+ }
1114
+ return "tailwind.config.js";
1115
+ };
1116
+ const detectedCss = await detectGlobalCss();
1117
+ const detectedTailwindConfig = await detectTailwindConfig();
1075
1118
  const response = await prompts2([
1076
1119
  {
1077
1120
  type: "select",
@@ -1082,55 +1125,29 @@ async function init() {
1082
1125
  { title: "Tailwind CSS v3", value: "v3" }
1083
1126
  ],
1084
1127
  initial: 0
1085
- },
1086
- {
1087
- type: "text",
1088
- name: "componentsPath",
1089
- message: "Where would you like to install components?",
1090
- initial: "src/components/ui"
1091
- },
1092
- {
1093
- type: "text",
1094
- name: "utilsPath",
1095
- message: "Where is your utils file?",
1096
- initial: "src/lib/utils.ts"
1097
- },
1098
- {
1099
- type: (prev, values) => values.tailwindVersion === "v3" ? "text" : null,
1100
- name: "tailwindConfig",
1101
- message: "Where is your tailwind.config.js?",
1102
- initial: "tailwind.config.js"
1103
- },
1104
- {
1105
- type: "text",
1106
- name: "globalCss",
1107
- message: "Where is your global CSS file?",
1108
- initial: "src/index.css"
1109
- },
1110
- {
1111
- // Only show for Bootstrap + v3 projects (v4 uses @source directive in CSS)
1112
- type: (prev, values) => hasBootstrap && values.tailwindVersion === "v3" ? "confirm" : null,
1113
- name: "scopeTailwind",
1114
- message: "Scope Tailwind to only components/ui? (recommended for Bootstrap projects)",
1115
- initial: true
1116
1128
  }
1117
1129
  ]);
1130
+ const componentsPath = "src/components/ui";
1131
+ const utilsPath = "src/lib/utils.ts";
1132
+ const tailwindConfig = detectedTailwindConfig;
1133
+ const globalCss = detectedCss;
1134
+ const scopeTailwind = hasBootstrap;
1118
1135
  const spinner = ora2("Initializing project...").start();
1119
1136
  try {
1120
1137
  const config = {
1121
1138
  ...DEFAULT_CONFIG,
1122
1139
  tailwind: {
1123
1140
  ...DEFAULT_CONFIG.tailwind,
1124
- config: response.tailwindConfig || "tailwind.config.js",
1125
- css: response.globalCss
1141
+ config: tailwindConfig,
1142
+ css: globalCss
1126
1143
  },
1127
1144
  aliases: {
1128
1145
  ...DEFAULT_CONFIG.aliases,
1129
- ui: `@/${response.componentsPath.replace("src/", "")}`
1146
+ ui: `@/${componentsPath.replace("src/", "")}`
1130
1147
  }
1131
1148
  };
1132
1149
  await fs2.writeJson(configPath, config, { spaces: 2 });
1133
- const utilsPath = path2.join(cwd, response.utilsPath);
1150
+ const utilsFullPath = path2.join(cwd, utilsPath);
1134
1151
  const cnUtilsContent = `import { type ClassValue, clsx } from "clsx"
1135
1152
  import { twMerge } from "tailwind-merge"
1136
1153
 
@@ -1140,12 +1157,12 @@ export function cn(...inputs: ClassValue[]) {
1140
1157
  `;
1141
1158
  let utilsCreated = false;
1142
1159
  let utilsUpdated = false;
1143
- if (!await fs2.pathExists(utilsPath)) {
1144
- await fs2.ensureDir(path2.dirname(utilsPath));
1145
- await fs2.writeFile(utilsPath, cnUtilsContent);
1160
+ if (!await fs2.pathExists(utilsFullPath)) {
1161
+ await fs2.ensureDir(path2.dirname(utilsFullPath));
1162
+ await fs2.writeFile(utilsFullPath, cnUtilsContent);
1146
1163
  utilsCreated = true;
1147
1164
  } else {
1148
- const existingUtils = await fs2.readFile(utilsPath, "utf-8");
1165
+ const existingUtils = await fs2.readFile(utilsFullPath, "utf-8");
1149
1166
  if (!existingUtils.includes("export function cn") && !existingUtils.includes("export const cn")) {
1150
1167
  let updatedContent = existingUtils;
1151
1168
  const hasClsxImport = existingUtils.includes('from "clsx"') || existingUtils.includes("from 'clsx'");
@@ -1168,13 +1185,13 @@ export function cn(...inputs: ClassValue[]) {
1168
1185
  }
1169
1186
  `;
1170
1187
  updatedContent = updatedContent.trimEnd() + "\n" + cnFunction;
1171
- await fs2.writeFile(utilsPath, updatedContent);
1188
+ await fs2.writeFile(utilsFullPath, updatedContent);
1172
1189
  utilsUpdated = true;
1173
1190
  }
1174
1191
  }
1175
- const componentsPath = path2.join(cwd, response.componentsPath);
1176
- await fs2.ensureDir(componentsPath);
1177
- const globalCssPath = path2.join(cwd, response.globalCss);
1192
+ const componentsFullPath = path2.join(cwd, componentsPath);
1193
+ await fs2.ensureDir(componentsFullPath);
1194
+ const globalCssPath = path2.join(cwd, globalCss);
1178
1195
  let cssContent;
1179
1196
  if (response.tailwindVersion === "v4") {
1180
1197
  cssContent = hasBootstrap ? CSS_VARIABLES_V4_BOOTSTRAP : CSS_VARIABLES_V4;
@@ -1195,7 +1212,7 @@ export function cn(...inputs: ClassValue[]) {
1195
1212
  const result = await prompts2({
1196
1213
  type: "confirm",
1197
1214
  name: "updateCss",
1198
- message: `${response.globalCss} exists. Add myOperator UI imports to the top?`,
1215
+ message: `${globalCss} exists. Add myOperator UI imports to the top?`,
1199
1216
  initial: true
1200
1217
  });
1201
1218
  updateCss = result.updateCss;
@@ -1212,9 +1229,8 @@ export function cn(...inputs: ClassValue[]) {
1212
1229
  }
1213
1230
  }
1214
1231
  let tailwindUpdated = false;
1215
- const scopeTailwind = response.scopeTailwind || false;
1216
- if (response.tailwindVersion === "v3" && response.tailwindConfig) {
1217
- const tailwindConfigPath = path2.join(cwd, response.tailwindConfig);
1232
+ if (response.tailwindVersion === "v3" && tailwindConfig) {
1233
+ const tailwindConfigPath = path2.join(cwd, tailwindConfig);
1218
1234
  if (!await fs2.pathExists(tailwindConfigPath)) {
1219
1235
  await fs2.writeFile(tailwindConfigPath, getTailwindConfig(scopeTailwind));
1220
1236
  tailwindUpdated = true;
@@ -1286,18 +1302,18 @@ export function cn(...inputs: ClassValue[]) {
1286
1302
  spinner.succeed("Project initialized successfully!");
1287
1303
  console.log(chalk2.green("\n \u2713 Created components.json"));
1288
1304
  if (utilsCreated) {
1289
- console.log(chalk2.green(` \u2713 Created ${response.utilsPath}`));
1305
+ console.log(chalk2.green(` \u2713 Created ${utilsPath}`));
1290
1306
  } else if (utilsUpdated) {
1291
- console.log(chalk2.green(` \u2713 Added cn() function to ${response.utilsPath}`));
1307
+ console.log(chalk2.green(` \u2713 Added cn() function to ${utilsPath}`));
1292
1308
  } else {
1293
- console.log(chalk2.green(` \u2713 ${response.utilsPath} already has cn() function`));
1309
+ console.log(chalk2.green(` \u2713 ${utilsPath} already has cn() function`));
1294
1310
  }
1295
- console.log(chalk2.green(` \u2713 Created ${response.componentsPath}`));
1311
+ console.log(chalk2.green(` \u2713 Created ${componentsPath}`));
1296
1312
  if (cssUpdated) {
1297
- console.log(chalk2.green(` \u2713 Updated ${response.globalCss} with CSS variables`));
1313
+ console.log(chalk2.green(` \u2713 Updated ${globalCss} with CSS variables`));
1298
1314
  }
1299
1315
  if (tailwindUpdated) {
1300
- console.log(chalk2.green(` \u2713 Updated ${response.tailwindConfig} with theme colors`));
1316
+ console.log(chalk2.green(` \u2713 Updated ${tailwindConfig} with theme colors`));
1301
1317
  if (scopeTailwind) {
1302
1318
  console.log(chalk2.blue(` \u2139 Tailwind scoped to components/ui only (Bootstrap can be used elsewhere)`));
1303
1319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",