@maz-ui/upgrade 5.0.0-beta.4 → 5.0.0-beta.44

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/README.md CHANGED
@@ -8,7 +8,7 @@ from your todo list, then walk through the rest of the
8
8
  need a human eye (theme `foundation.radius` reshape, `MazIcon` API,
9
9
  `MazBadge` numeric sizes, `MazChart` `update-mode`).
10
10
 
11
- The companion [`@maz-ui/mcp`](https://maz-ui.com/guide/mcp) server lets your
11
+ The companion [`@maz-ui/mcp`](https://maz-ui.com/ecosystem/mcp) server lets your
12
12
  AI assistant read the migration guide and apply the manual steps with full
13
13
  context.
14
14
 
@@ -156,6 +156,20 @@ ambiguous (`variant=`, `color="background"`) are rewritten **only inside
156
156
  | `active-color="background"` | `active-color="surface"` |
157
157
  | `rounded-size="base"` | `rounded-size="md"` |
158
158
  | `.--has-left-icon` / `.--has-right-icon` (CSS selectors) | `.--has-start-icon` / `.--has-end-icon` |
159
+ | `<MazAvatar size="2rem">` (static CSS unit) | `<MazAvatar size="6rem">` (value ×3, render preserved) |
160
+ | `<MazPullToRefresh :on-click="x">` | `<MazPullToRefresh :on-refresh="x">` |
161
+
162
+ The `MazAvatar` rewrite targets only `<MazAvatar>` / `<maz-avatar>` opening
163
+ tags. v5 fixed the avatar size scale (a CSS-unit `size` no longer renders 3x
164
+ too large), so the numeric value is multiplied by 3 to keep the exact same
165
+ render. Every CSS unit is supported. `MazSize` keywords (`mini`..`xl`) and
166
+ bound `:size="…"` expressions are left untouched - the latter is reported as
167
+ a warning at the end of the run.
168
+
169
+ The `MazPullToRefresh` rewrite targets only `<MazPullToRefresh>` /
170
+ `<maz-pull-to-refresh>` opening tags. v5 renamed the callback prop `on-click`
171
+ to `on-refresh` (both kebab-case and camelCase, bound or static), so native
172
+ click handlers and the `onClick` prop of other components are never touched.
159
173
 
160
174
  ### `css`
161
175
 
@@ -270,7 +284,7 @@ Next: see https://maz-ui.com/guide/migration-v5 for the manual steps
270
284
  ## What it does NOT do
271
285
 
272
286
  Some changes need a human (or your AI assistant via the
273
- [`@maz-ui/mcp`](https://maz-ui.com/guide/mcp) server) — see the
287
+ [`@maz-ui/mcp`](https://maz-ui.com/ecosystem/mcp) server) — see the
274
288
  [migration guide](https://maz-ui.com/guide/migration-v5) for the full
275
289
  context:
276
290
 
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import { resolve, dirname } from 'node:path';
5
5
  import process from 'node:process';
6
6
  import { logger } from '@maz-ui/node';
7
7
  import { globby } from 'globby';
8
- import { A as ALL_GROUPS, h as hasFoundationRadius, t as transformFile, a as hasMazUiRootImport } from './shared/upgrade.DtUNapPx.mjs';
8
+ import { A as ALL_GROUPS, h as hasFoundationRadius, a as hasMazAvatarBoundSize, t as transformFile, b as hasMazUiRootImport } from './shared/upgrade.D2ElTTw5.mjs';
9
9
 
10
10
  const DEFAULT_IGNORES = [
11
11
  "**/node_modules/**",
@@ -94,7 +94,8 @@ Transform groups:
94
94
  also added to package.json next to maz-ui.
95
95
  props left-icon/right-icon \u2192 start-icon/end-icon (props, slots,
96
96
  #icon-left/#icon-right, --has-*-icon classes), footer-align,
97
- variant, color="background", active-color, rounded-size="base"
97
+ variant, color="background", active-color, rounded-size="base",
98
+ MazAvatar static size unit x3 (scale fix, render preserved)
98
99
  css --maz-background \u2192 --maz-surface, --maz-border \u2192 --maz-divider,
99
100
  hsl(var(--maz-X)) collapse (incl. alpha \u2192 color-mix)
100
101
  config Nuxt injectMainCss \u2192 injectCss, theme strategy 'hybrid' \u2192 'runtime',
@@ -187,6 +188,7 @@ async function processSourceFiles(opts, cwd, packageJsonFiles) {
187
188
  let changed = 0;
188
189
  let needsUtilsDep = false;
189
190
  const radiusFiles = [];
191
+ const avatarSizeFiles = [];
190
192
  for (const root of opts.roots) {
191
193
  const absoluteRoot = resolve(cwd, root);
192
194
  const files = await globby(
@@ -215,13 +217,15 @@ async function processSourceFiles(opts, cwd, packageJsonFiles) {
215
217
  needsUtilsDep = true;
216
218
  if (hasFoundationRadius(before))
217
219
  radiusFiles.push(file);
220
+ if (hasMazAvatarBoundSize(before))
221
+ avatarSizeFiles.push(file);
218
222
  if (after === before)
219
223
  continue;
220
224
  changed += 1;
221
225
  reportAndWrite(file, after, opts, cwd);
222
226
  }
223
227
  }
224
- return { scanned, changed, needsUtilsDep, radiusFiles };
228
+ return { scanned, changed, needsUtilsDep, radiusFiles, avatarSizeFiles };
225
229
  }
226
230
  function processPackageJsonFiles(files, opts, cwd, needsUtilsDep) {
227
231
  let scanned = 0;
@@ -260,6 +264,14 @@ Scanned ${scanned} files, ${prefix} ${changed}.`);
260
264
  logger.log(` - ${file.replace(cwdPrefix, "")}`);
261
265
  logger.log(` \u2192 Move the value to scales.rounded.md (other rounded keys are now derived from it via calc).`);
262
266
  }
267
+ if (sources.avatarSizeFiles.length > 0) {
268
+ const cwdPrefix = `${cwd}/`;
269
+ logger.log(`
270
+ \u26A0 MazAvatar bound :size detected in ${sources.avatarSizeFiles.length} file(s) - manual check required:`);
271
+ for (const file of sources.avatarSizeFiles)
272
+ logger.log(` - ${file.replace(cwdPrefix, "")}`);
273
+ logger.log(` \u2192 The size scale was fixed (no more x3). Multiply the CSS unit value by 3 to keep the same render, or use a MazSize keyword. Static size="<unit>" values were already rewritten.`);
274
+ }
263
275
  logger.log(`
264
276
  Next: see https://maz-ui.com/guide/migration-v5 for the manual steps`);
265
277
  logger.log(`(foundation.radius \u2192 scales.rounded.md, MazIcon API, MazBadge sizes, MazChart update-mode).`);
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { A as ALL_GROUPS, b as transformConfig, c as transformCssVars, d as transformDeps, t as transformFile, e as transformHslVar, f as transformImports, g as transformPresetColors, i as transformProps } from './shared/upgrade.DtUNapPx.mjs';
1
+ export { A as ALL_GROUPS, c as transformConfig, d as transformCssVars, e as transformDeps, t as transformFile, f as transformHslVar, g as transformImports, i as transformPresetColors, j as transformProps } from './shared/upgrade.D2ElTTw5.mjs';
@@ -29,8 +29,32 @@ function transformProps(content) {
29
29
  out = out.replace(ACTIVE_COLOR_BG, (_, p, s) => `${p}surface${s}`);
30
30
  out = out.replace(HAS_ICON_CLASS, (_, dir) => `.--has-${flipDirection(dir)}-icon`);
31
31
  out = out.replace(MAZ_OPEN_TAG, (tag) => tag.replace(VARIANT_LR, (_, p, dir, s) => `${p}${flipDirection(dir)}${s}`).replace(COLOR_BG, (_, p, s) => `${p}surface${s}`));
32
+ out = transformAvatarSize(out);
33
+ out = transformPullToRefresh(out);
32
34
  return out;
33
35
  }
36
+ const MAZ_PULL_TO_REFRESH_OPEN_TAG = /<(?:MazPullToRefresh|maz-pull-to-refresh)\b[^>]*>/g;
37
+ const PULL_TO_REFRESH_ON_CLICK_KEBAB = /(\s:?)on-click\b/g;
38
+ const PULL_TO_REFRESH_ON_CLICK_CAMEL = /(\s:?)onClick\b/g;
39
+ function transformPullToRefresh(content) {
40
+ return content.replace(MAZ_PULL_TO_REFRESH_OPEN_TAG, (tag) => tag.replace(PULL_TO_REFRESH_ON_CLICK_KEBAB, (_, prefix) => `${prefix}on-refresh`).replace(PULL_TO_REFRESH_ON_CLICK_CAMEL, (_, prefix) => `${prefix}onRefresh`));
41
+ }
42
+ const MAZ_AVATAR_OPEN_TAG = /<(?:MazAvatar|maz-avatar)\b[^>]*>/g;
43
+ const AVATAR_SIZE_UNIT = /(?<![:\w-])(size\s*=\s*(["']))(\d+(?:\.\d+)?|\.\d+)([a-z%]+)\2/gi;
44
+ function tripleLength(value) {
45
+ return String(Number.parseFloat((Number.parseFloat(value) * 3).toFixed(4)));
46
+ }
47
+ function transformAvatarSize(content) {
48
+ return content.replace(MAZ_AVATAR_OPEN_TAG, (tag) => tag.replace(AVATAR_SIZE_UNIT, (_, prefix, quote, num, unit) => `${prefix}${tripleLength(num)}${unit}${quote}`));
49
+ }
50
+ const AVATAR_BOUND_SIZE = /(?:^|\s)(?::|v-bind:)size\s*=/;
51
+ function hasMazAvatarBoundSize(content) {
52
+ for (const match of content.matchAll(MAZ_AVATAR_OPEN_TAG)) {
53
+ if (AVATAR_BOUND_SIZE.test(match[0]))
54
+ return true;
55
+ }
56
+ return false;
57
+ }
34
58
  const MAZ_BACKGROUND = /--maz-background(?:(?![-\w])|(?=-(?:foreground|\d)))/g;
35
59
  const MAZ_BORDER_COLOR = /--maz-border(?:(?![-\w])|(?=-(?:foreground|\d)))/g;
36
60
  const MAZ_VAR = String.raw`var\(--(?:maz|m)-[\w-]+\)`;
@@ -44,7 +68,7 @@ function transformHslVar(content) {
44
68
  }
45
69
  const NUXT_INJECT_MAIN_CSS = /\binjectMainCss\b/g;
46
70
  const STRATEGY_HYBRID = /(\bstrategy\s*:\s*['"])hybrid(['"])/g;
47
- const DEPRECATED_THEME_OPTIONS = /^[^\S\n]*(?:injectCriticalCSS|injectFullCSS|injectAllCSSOnServer)\s*:[^,\n]*,?[^\S\n]*\n?/gm;
71
+ const DEPRECATED_THEME_OPTIONS = /^[ \t]*(?:injectCriticalCSS|injectFullCSS|injectAllCSSOnServer)\s*:[^,\n]*,?[^\S\n]*\n?/gm;
48
72
  function transformConfig(content) {
49
73
  return content.replace(NUXT_INJECT_MAIN_CSS, "injectCss").replace(STRATEGY_HYBRID, (_, p, s) => `${p}runtime${s}`).replace(DEPRECATED_THEME_OPTIONS, "");
50
74
  }
@@ -169,4 +193,4 @@ function transformFile(filename, content, options = {}) {
169
193
  return out;
170
194
  }
171
195
 
172
- export { ALL_GROUPS as A, hasMazUiRootImport as a, transformConfig as b, transformCssVars as c, transformDeps as d, transformHslVar as e, transformImports as f, transformPresetColors as g, hasFoundationRadius as h, transformProps as i, transformFile as t };
196
+ export { ALL_GROUPS as A, hasMazAvatarBoundSize as a, hasMazUiRootImport as b, transformConfig as c, transformCssVars as d, transformDeps as e, transformHslVar as f, transformImports as g, hasFoundationRadius as h, transformPresetColors as i, transformProps as j, transformFile as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maz-ui/upgrade",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.4",
4
+ "version": "5.0.0-beta.44",
5
5
  "description": "Automated source rewrites for migrating a project from Maz-UI v4 to v5.",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
@@ -23,7 +23,8 @@
23
23
  "exports": {
24
24
  ".": {
25
25
  "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs"
26
+ "import": "./dist/index.mjs",
27
+ "default": "./dist/index.mjs"
27
28
  }
28
29
  },
29
30
  "main": "./dist/index.mjs",
@@ -40,15 +41,12 @@
40
41
  "node": ">=20.19.0"
41
42
  },
42
43
  "dependencies": {
43
- "globby": "^16.2.0",
44
- "@maz-ui/node": "5.0.0-beta.4"
44
+ "@maz-ui/node": "5.0.0-beta.44",
45
+ "globby": "^16.2.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@types/node": "^25.6.0",
48
- "typescript": "^5.9.3",
49
- "unbuild": "^3.6.1",
50
- "vitest": "4.1.5",
51
- "@maz-ui/eslint-config": "5.0.0-beta.4"
48
+ "@maz-ui/eslint-config": "5.0.0-beta.44",
49
+ "unbuild": "^3.6.1"
52
50
  },
53
51
  "lint-staged": {
54
52
  "*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"