@gitlab/ui 86.12.0 → 86.12.1

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [86.12.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v86.12.0...v86.12.1) (2024-07-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Properly handle multi-class tailwind migration ([7131ebb](https://gitlab.com/gitlab-org/gitlab-ui/commit/7131ebb48501d1ac962c1b64d7fb45fc07f6fc37))
7
+
1
8
  # [86.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v86.11.1...v86.12.0) (2024-07-16)
2
9
 
3
10
 
@@ -183679,9 +183679,15 @@ var _23 = function() {
183679
183679
  }();
183680
183680
  var lne = { html: rn7("html", gc3, { staticAttrs: ["class"] }), glimmer: rn7("glimmer", oY, { staticAttrs: ["class"] }), lwc: rn7("lwc", gc3, { staticAttrs: ["class"] }), angular: rn7("angular", gc3, { staticAttrs: ["class"], dynamicAttrs: ["[ngClass]"] }), vue: rn7("vue", gc3, { staticAttrs: ["class"], dynamicAttrs: [":class", "v-bind:class"] }), css: rn7("css", Sv), scss: rn7("scss", Sv), less: rn7("less", Sv), babel: rn7("babel", Ls8, { staticAttrs: ["class", "className"] }), "babel-flow": rn7("babel-flow", Ls8, { staticAttrs: ["class", "className"] }), flow: rn7("flow", Ls8, { staticAttrs: ["class", "className"] }), typescript: rn7("typescript", Ls8, { staticAttrs: ["class", "className"] }), "babel-ts": rn7("babel-ts", Ls8, { staticAttrs: ["class", "className"] }), acorn: rn7("acorn", Ls8, { staticAttrs: ["class", "className"] }), meriyah: rn7("meriyah", Ls8, { staticAttrs: ["class", "className"] }), __js_expression: rn7("__js_expression", Ls8, { staticAttrs: ["class", "className"] }), ...si5.parsers.svelte ? { svelte: rn7("svelte", vc3, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.astro ? { astro: rn7("astro", I23, { staticAttrs: ["class", "className"], dynamicAttrs: ["class:list", "className"] }) } : {}, ...si5.parsers.astroExpressionParser ? { astroExpressionParser: rn7("astroExpressionParser", Ls8, { staticAttrs: ["class"], dynamicAttrs: ["class:list"] }) } : {}, ...si5.parsers.marko ? { marko: rn7("marko", cY2, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.melody ? { melody: rn7("melody", O23, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.pug ? { pug: rn7("pug", pY, { staticAttrs: ["class"] }) } : {}, ...si5.parsers["liquid-html"] ? { "liquid-html": rn7("liquid-html", lY, { staticAttrs: ["class"] }) } : {} };
183681
183681
 
183682
- // bin/lib/tailwind_equivalents.js
183682
+ // bin/lib/tailwind_equivalents.mjs
183683
183683
  var tailwindEquivalents = {
183684
+ /**
183685
+ * These classes are mapping to multi-classes...
183686
+ */
183684
183687
  "gl-sr-only-focusable": "gl-sr-only focus:gl-not-sr-only",
183688
+ "gl--flex-center": "gl-flex gl-items-center gl-justify-center",
183689
+ "gl-flex-flow-row-wrap": "gl-flex-row gl-flex-wrap",
183690
+ // Normal replacements below
183685
183691
  "gl-spin": "gl-animate-spin",
183686
183692
  "gl-animate-skeleton-loader": null,
183687
183693
  "gl-hover-bg-transparent": "hover:gl-bg-transparent",
@@ -183797,7 +183803,6 @@ var tailwindEquivalents = {
183797
183803
  "gl-hover-text-blue-800": "hover:gl-text-blue-800",
183798
183804
  "gl-hover-text-blue-800!": "hover:!gl-text-blue-800",
183799
183805
  "gl-text-red-500!": "!gl-text-red-500",
183800
- "gl--flex-center": "gl-flex gl-items-center gl-justify-center",
183801
183806
  "gl-focus--focus": "focus:gl-focus",
183802
183807
  "gl-cursor-default!": "!gl-cursor-default",
183803
183808
  "gl-hover-cursor-pointer": "hover:gl-cursor-pointer",
@@ -183904,7 +183909,6 @@ var tailwindEquivalents = {
183904
183909
  "gl-flex-basis-half": "gl-basis-1/2",
183905
183910
  "gl-flex-basis-full": "gl-basis-full",
183906
183911
  "gl-flex-basis-full!": "!gl-basis-full",
183907
- "gl-flex-flow-row-wrap": "gl-flex-row gl-flex-wrap",
183908
183912
  "gl-justify-content-center": "gl-justify-center",
183909
183913
  "gl-justify-content-end": "gl-justify-end",
183910
183914
  "gl-justify-content-end!": "!gl-justify-end",
@@ -184208,6 +184212,21 @@ var tailwindEquivalents = {
184208
184212
  "gl-visibility-hidden": "gl-invisible",
184209
184213
  "gl-z-index-200": "gl-z-200",
184210
184214
  "gl-z-index-9999!": "!gl-z-9999",
184215
+ /*
184216
+ Items below have been found by analysing the following projects
184217
+ - jh fork of GitLab
184218
+ - https://gitlab-org.gitlab.io/frontend/playground/gitlab-code-scanner
184219
+ - https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/switchboard/
184220
+ - https://gitlab.com/gitlab-org/customers-gitlab-com/
184221
+ - https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin
184222
+ - https://gitlab.com/gitlab-org/frontend/pajamas-adoption-scanner
184223
+ - https://gitlab.com/gitlab-org/frontend/playground/vue-compat-scanner
184224
+ - https://gitlab.com/gitlab-org/gitlab-docs/
184225
+ - https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com
184226
+ - https://gitlab.com/gitlab-org/gitlab-vscode-extension/
184227
+ - https://gitlab.com/gitlab-org/status-page
184228
+ - https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo
184229
+ */
184211
184230
  "gl-active-bg-t-gray-a-08": "active:gl-bg-alpha-dark-8",
184212
184231
  "gl-inset-border-b-1-gray-200": "gl-shadow-inner-b-1-gray-100",
184213
184232
  "gl-justify-content-center!": "!gl-justify-center",
@@ -184235,18 +184254,87 @@ var tailwindEquivalents = {
184235
184254
  "gl-z-index-1": "gl-z-1",
184236
184255
  "gl-z-index-2": "gl-z-2",
184237
184256
  "gl-z-index-3": "gl-z-3",
184238
- "gl-z-index-4": "gl-z-4"
184257
+ "gl-z-index-4": "gl-z-4",
184258
+ "gl-bg-data-viz-green-700!": "!gl-bg-data-viz-green-700",
184259
+ "gl-bg-data-viz-magenta-950!": "!gl-bg-data-viz-magenta-950",
184260
+ "gl-inset-border-1-red-300": "gl-shadow-inner-1-red-300",
184261
+ "gl-inset-border-1-red-500": "gl-shadow-inner-1-red-500",
184262
+ "gl-column-gap-3": "gl-gap-x-3"
184239
184263
  };
184240
184264
 
184265
+ // bin/lib/tailwind_migrations.mjs
184266
+ function legacyClassToImportant(klass) {
184267
+ return klass.endsWith("!") ? klass : `${klass}!`;
184268
+ }
184269
+ function tailwindClassToImportant(klass) {
184270
+ if (klass.includes(" ")) {
184271
+ return klass.split(" ").map((k9) => tailwindClassToImportant(k9)).join(" ");
184272
+ }
184273
+ if (klass.includes("!gl-")) {
184274
+ return klass;
184275
+ } else {
184276
+ return klass.replace(/(^|:)(-?gl-)/, "$1!$2");
184277
+ }
184278
+ }
184279
+ function filterOutNonStringValues(rawMigrations) {
184280
+ return Object.entries(rawMigrations).filter(([, to4]) => typeof to4 === "string");
184281
+ }
184282
+ function addImportantVariants(rawMigrations) {
184283
+ const map2 = rawMigrations.reduce((acc, [from, to4]) => {
184284
+ acc.set(from, to4);
184285
+ if (to4.includes(" ")) {
184286
+ acc.set("\\." + from, "." + to4.replace(/ /g, "."));
184287
+ }
184288
+ const importantFrom = legacyClassToImportant(from);
184289
+ if (!Object.hasOwn(rawMigrations, importantFrom)) {
184290
+ const importantTo = tailwindClassToImportant(to4);
184291
+ acc.set(importantFrom, importantTo);
184292
+ if (to4.includes(" ")) {
184293
+ acc.set("\\." + importantFrom, "." + importantTo.replace(/ /g, "."));
184294
+ }
184295
+ }
184296
+ return acc;
184297
+ }, /* @__PURE__ */ new Map());
184298
+ return Array.from(map2.entries()).map(([from, to4]) => ({ from, to: to4 }));
184299
+ }
184300
+ function addFromRegExps(rawMigrations) {
184301
+ const classChars = ["-", "\\w", "!", ":"].join("|");
184302
+ return rawMigrations.map((migration) => ({
184303
+ ...migration,
184304
+ fromRegExp: new RegExp(`(?<!${classChars})${migration.from}(?!${classChars})`, "g")
184305
+ }));
184306
+ }
184307
+ function sortMigrations(unsortedMigrations) {
184308
+ return unsortedMigrations.slice().sort((a3, b6) => {
184309
+ if (a3.from.length < b6.from.length)
184310
+ return 1;
184311
+ if (a3.from.length > b6.from.length)
184312
+ return -1;
184313
+ return 0;
184314
+ });
184315
+ }
184316
+ async function parseMigrations(obj) {
184317
+ try {
184318
+ return sortMigrations(addFromRegExps(addImportantVariants(filterOutNonStringValues(obj))));
184319
+ } catch (error) {
184320
+ console.error(error.message);
184321
+ return [];
184322
+ }
184323
+ }
184324
+ function runMigrations(contents, migrationsToDo) {
184325
+ let newContents = contents;
184326
+ for (const { fromRegExp, to: to4 } of migrationsToDo) {
184327
+ newContents = newContents.replaceAll(fromRegExp, to4);
184328
+ }
184329
+ return newContents;
184330
+ }
184331
+
184241
184332
  // bin/migrate_custom_utils_to_tw.mjs
184242
184333
  function createRewriter(config, migrationsToDo) {
184243
184334
  const { tailwindConfig, dryRun } = config;
184244
184335
  return async function rewrite(file) {
184245
184336
  const contents = await readFile3(file, { encoding: "utf8" });
184246
- let newContents = contents;
184247
- for (const { fromRegExp, to: to4 } of migrationsToDo) {
184248
- newContents = newContents.replaceAll(fromRegExp, to4);
184249
- }
184337
+ let newContents = runMigrations(contents, migrationsToDo);
184250
184338
  if (contents === newContents) {
184251
184339
  console.warn(`No changes to ${file}`);
184252
184340
  return;
@@ -184315,50 +184403,6 @@ function validateMigrations(processedMigrations) {
184315
184403
  }
184316
184404
  return true;
184317
184405
  }
184318
- function legacyClassToImportant(klass) {
184319
- return klass.endsWith("!") ? klass : `${klass}!`;
184320
- }
184321
- function tailwindClassToImportant(klass) {
184322
- return klass.includes("!gl-") ? klass : klass.replace(/(^|:)(-?gl-)/, "$1!$2");
184323
- }
184324
- function filterOutNonStringValues(rawMigrations) {
184325
- return Object.entries(rawMigrations).filter(([, to4]) => typeof to4 === "string");
184326
- }
184327
- function addImportantVariants(rawMigrations) {
184328
- const map2 = rawMigrations.reduce((acc, [from, to4]) => {
184329
- acc.set(from, to4);
184330
- const importantFrom = legacyClassToImportant(from);
184331
- if (!Object.hasOwn(rawMigrations, importantFrom)) {
184332
- acc.set(importantFrom, tailwindClassToImportant(to4));
184333
- }
184334
- return acc;
184335
- }, /* @__PURE__ */ new Map());
184336
- return Array.from(map2.entries()).map(([from, to4]) => ({ from, to: to4 }));
184337
- }
184338
- function addFromRegExps(rawMigrations) {
184339
- const classChars = ["-", "\\w", "!", ":"].join("|");
184340
- return rawMigrations.map((migration) => ({
184341
- ...migration,
184342
- fromRegExp: new RegExp(`(?<!${classChars})${migration.from}(?!${classChars})`, "g")
184343
- }));
184344
- }
184345
- function sortMigrations(unsortedMigrations) {
184346
- return unsortedMigrations.slice().sort((a3, b6) => {
184347
- if (a3.from.length < b6.from.length)
184348
- return 1;
184349
- if (a3.from.length > b6.from.length)
184350
- return -1;
184351
- return 0;
184352
- });
184353
- }
184354
- async function parseMigrations(obj) {
184355
- try {
184356
- return sortMigrations(addFromRegExps(addImportantVariants(filterOutNonStringValues(obj))));
184357
- } catch (error) {
184358
- console.error(error.message);
184359
- return [];
184360
- }
184361
- }
184362
184406
  async function getFilesAndDirectories(directories, dryRun) {
184363
184407
  const directoriesPattern = directories.length === 0 ? process.cwd() : directories.length === 1 ? directories[0] : `{${directories.join(",")}}`;
184364
184408
  const extensions = ["haml", "rb", "vue", "js", "snap", "html"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "86.12.0",
3
+ "version": "86.12.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",