@gitlab/ui 87.3.1 → 87.5.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.
- package/CHANGELOG.md +14 -0
- package/bin/migrate_custom_utils_to_tw.bundled.mjs +83 -31
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +3 -3
- package/src/components/base/new_dropdowns/dropdown_item.scss +9 -0
- package/src/scss/utilities.scss +12 -0
- package/src/scss/utility-mixins/animation.scss +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [87.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.4.0...v87.5.0) (2024-07-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlListboxItem:** Add animation ([a76adcc](https://gitlab.com/gitlab-org/gitlab-ui/commit/a76adcc6cad98ac0228178f79d2f2215aed75d29))
|
|
7
|
+
|
|
8
|
+
# [87.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.3.1...v87.4.0) (2024-07-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* make Tailwind migrations a 2-steps process ([b148f2b](https://gitlab.com/gitlab-org/gitlab-ui/commit/b148f2bae2064f199c285e1d55ec12bc7a651f8d))
|
|
14
|
+
|
|
1
15
|
## [87.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.3.0...v87.3.1) (2024-07-30)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -184331,32 +184331,48 @@ function runMigrations(contents, migrationsToDo) {
|
|
|
184331
184331
|
}
|
|
184332
184332
|
|
|
184333
184333
|
// bin/migrate_custom_utils_to_tw.mjs
|
|
184334
|
-
function
|
|
184335
|
-
|
|
184334
|
+
function isFrontendFile(file) {
|
|
184335
|
+
return file.endsWith(".js") || file.endsWith(".vue");
|
|
184336
|
+
}
|
|
184337
|
+
function isPositiveAnswer(answer) {
|
|
184338
|
+
const a3 = answer.toLowerCase();
|
|
184339
|
+
return ["y", "yes", ""].includes(a3);
|
|
184340
|
+
}
|
|
184341
|
+
function createRewriter(dryRun, migrationsToDo) {
|
|
184336
184342
|
return async function rewrite(file) {
|
|
184337
184343
|
const contents = await readFile3(file, { encoding: "utf8" });
|
|
184338
|
-
|
|
184344
|
+
const newContents = runMigrations(contents, migrationsToDo);
|
|
184339
184345
|
if (contents === newContents) {
|
|
184340
184346
|
console.warn(`No changes to ${file}`);
|
|
184341
|
-
return;
|
|
184347
|
+
return false;
|
|
184342
184348
|
}
|
|
184343
184349
|
if (dryRun) {
|
|
184344
184350
|
console.warn(`Would fix up ${file}`);
|
|
184345
|
-
return;
|
|
184346
|
-
}
|
|
184347
|
-
if (file.endsWith(".js") || file.endsWith(".vue")) {
|
|
184348
|
-
const prettierConfig = await resolveConfig(file) || {};
|
|
184349
|
-
newContents = await format22(newContents, {
|
|
184350
|
-
filepath: file,
|
|
184351
|
-
...prettierConfig,
|
|
184352
|
-
plugins: [dist_exports],
|
|
184353
|
-
tailwindConfig
|
|
184354
|
-
});
|
|
184351
|
+
return false;
|
|
184355
184352
|
}
|
|
184356
184353
|
await writeFile2(file, newContents, { encoding: "utf8" });
|
|
184357
184354
|
console.warn(`Fixed ${file}`);
|
|
184355
|
+
return true;
|
|
184358
184356
|
};
|
|
184359
184357
|
}
|
|
184358
|
+
async function prettify(tailwindConfig, files) {
|
|
184359
|
+
for (const file of files) {
|
|
184360
|
+
const contents = await readFile3(file, { encoding: "utf8" });
|
|
184361
|
+
const prettierConfig = await resolveConfig(file) || {};
|
|
184362
|
+
const newContents = await format22(contents, {
|
|
184363
|
+
filepath: file,
|
|
184364
|
+
...prettierConfig,
|
|
184365
|
+
plugins: [dist_exports],
|
|
184366
|
+
tailwindConfig
|
|
184367
|
+
});
|
|
184368
|
+
if (contents === newContents) {
|
|
184369
|
+
console.warn(`${file} did not need to be prettified`);
|
|
184370
|
+
} else {
|
|
184371
|
+
await writeFile2(file, newContents, { encoding: "utf8" });
|
|
184372
|
+
console.warn(`Prettified ${file}`);
|
|
184373
|
+
}
|
|
184374
|
+
}
|
|
184375
|
+
}
|
|
184360
184376
|
function validateMigrations(processedMigrations) {
|
|
184361
184377
|
const errors = [];
|
|
184362
184378
|
for (const { from, to: to4 } of processedMigrations) {
|
|
@@ -184452,6 +184468,10 @@ function getArgsParser() {
|
|
|
184452
184468
|
describe: "Don't actually update files, but print more info",
|
|
184453
184469
|
type: "boolean",
|
|
184454
184470
|
default: false
|
|
184471
|
+
}).option("single-step-migration", {
|
|
184472
|
+
describe: "Run the migration in a single step. This means that migrated files are prettified with the Tailwind plugin immediately. Leave this disabled to have a chance to commit migrate files before `prettier-plugin-tailwindcss` re-orders classes.",
|
|
184473
|
+
type: "boolean",
|
|
184474
|
+
default: false
|
|
184455
184475
|
}).help("help");
|
|
184456
184476
|
}
|
|
184457
184477
|
async function main() {
|
|
@@ -184470,32 +184490,64 @@ async function main() {
|
|
|
184470
184490
|
console.warn("Will do approximately %d class migrations:", migrations.length);
|
|
184471
184491
|
console.warn(migrations.map((m3) => ` ${m3.from} => ${m3.to}`).join("\n"));
|
|
184472
184492
|
}
|
|
184473
|
-
const rewrite = createRewriter(program, migrations);
|
|
184493
|
+
const rewrite = createRewriter(program.dryRun, migrations);
|
|
184494
|
+
let files = [];
|
|
184474
184495
|
if (program.fromStdin) {
|
|
184475
184496
|
console.warn("Reading files from stdin:");
|
|
184476
184497
|
for await (const file of readline.createInterface({ input: process.stdin })) {
|
|
184477
184498
|
if (file.trim()) {
|
|
184478
|
-
|
|
184499
|
+
files.push(file);
|
|
184479
184500
|
}
|
|
184480
184501
|
}
|
|
184481
|
-
|
|
184482
|
-
|
|
184483
|
-
|
|
184484
|
-
|
|
184485
|
-
program.dryRun
|
|
184486
|
-
);
|
|
184487
|
-
if (program.dryRun) {
|
|
184488
|
-
console.warn(
|
|
184489
|
-
[`Running on %d files across %d directories`, `(using pattern: %s).`].join("\n"),
|
|
184490
|
-
files.length,
|
|
184491
|
-
directories.length,
|
|
184492
|
-
pattern
|
|
184502
|
+
} else {
|
|
184503
|
+
const filesAndDirectories = await getFilesAndDirectories(
|
|
184504
|
+
program.directories ?? [],
|
|
184505
|
+
program.dryRun
|
|
184493
184506
|
);
|
|
184494
|
-
|
|
184495
|
-
|
|
184507
|
+
files = filesAndDirectories.files;
|
|
184508
|
+
const { pattern, directories } = filesAndDirectories;
|
|
184509
|
+
if (program.dryRun) {
|
|
184510
|
+
console.warn(
|
|
184511
|
+
[`Running on %d files across %d directories`, `(using pattern: %s).`].join("\n"),
|
|
184512
|
+
files.length,
|
|
184513
|
+
directories.length,
|
|
184514
|
+
pattern
|
|
184515
|
+
);
|
|
184516
|
+
console.warn("Directories searched:");
|
|
184517
|
+
console.warn(` ${directories.join("\n ")}`);
|
|
184518
|
+
}
|
|
184496
184519
|
}
|
|
184520
|
+
let migratedFilesCount = 0;
|
|
184497
184521
|
for (const file of files) {
|
|
184498
|
-
await rewrite(file)
|
|
184522
|
+
if (await rewrite(file)) {
|
|
184523
|
+
migratedFilesCount += 1;
|
|
184524
|
+
}
|
|
184525
|
+
}
|
|
184526
|
+
if (migratedFilesCount === 0) {
|
|
184527
|
+
console.warn("No files needed to be migrated");
|
|
184528
|
+
return;
|
|
184529
|
+
}
|
|
184530
|
+
const filesToBePrettified = files.filter((file) => isFrontendFile(file));
|
|
184531
|
+
if (filesToBePrettified.length === 0) {
|
|
184532
|
+
console.warn("No files to be prettified");
|
|
184533
|
+
return;
|
|
184534
|
+
}
|
|
184535
|
+
if (!program.singleStepMigration) {
|
|
184536
|
+
const rl5 = readline.createInterface({
|
|
184537
|
+
input: process.stdin,
|
|
184538
|
+
output: process.stdout
|
|
184539
|
+
});
|
|
184540
|
+
const answer = await rl5.question(`
|
|
184541
|
+
Files have been migrated and will now be prettified.
|
|
184542
|
+
Make sure to commit the changes before proceeding if you would like to track
|
|
184543
|
+
the diff before CSS classes get re-ordered by the Tailwind Prettier plugin.
|
|
184544
|
+
Continue? (Y/n) `);
|
|
184545
|
+
rl5.close();
|
|
184546
|
+
if (isPositiveAnswer(answer)) {
|
|
184547
|
+
await prettify(program.tailwindConfig, filesToBePrettified);
|
|
184548
|
+
}
|
|
184549
|
+
} else {
|
|
184550
|
+
await prettify(program.tailwindConfig, filesToBePrettified);
|
|
184499
184551
|
}
|
|
184500
184552
|
}
|
|
184501
184553
|
main();
|