@dialpad/dialtone-css 9.4.0 → 9.6.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.
@@ -350,7 +350,7 @@ const MIGRATIONS = [
350
350
  {
351
351
  id: 'typography',
352
352
  name: 'Typography Utilities to DtText',
353
- description: 'Replace legacy typography utility classes (d-headline--*, d-body--*, d-label--*, d-code--md, d-fw-*, d-fc-*, d-lh-*, d-truncate, d-ta-*) with the <dt-text> component.',
353
+ description: 'Replace legacy typography utility classes (d-headline--*, d-body--*, d-label--*, d-code--md, d-fw-*, d-fc-*, d-lh-*, d-truncate, d-ta-*, d-ff-mono) with <dt-text> variant and modifier props.',
354
354
  category: 'opt-in',
355
355
  type: 'standalone',
356
356
  scriptDir: 'dialtone_migrate_typography',
@@ -499,7 +499,7 @@ Examples:
499
499
  npx dialtone-migrate --only typography,text-variant --dry-run --cwd ./src
500
500
 
501
501
  Combined dry-run stages inspect current files; they do not simulate earlier writes.
502
- After applying typography, preview text-variant separately for newly created pairs.
502
+ Typography emits variant directly; text-variant converts existing DtText kind + size pairs.
503
503
  Health-check and text-variant skip nested Git repositories; target each explicitly with --cwd.
504
504
  `);
505
505
  }
@@ -244,22 +244,39 @@ describe('--health-check', () => {
244
244
 
245
245
 
246
246
  describe('text-variant stage', () => {
247
- it('detects real pairs, protects overrides, preserves dry-run and rescans after typography', () => {
247
+ it('typography emits variants alone, text-variant converts authored pairs, dry-run writes nothing', () => {
248
248
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'dlt-text-variant-'));
249
249
  const file = path.join(tmp, 'App.vue');
250
+ const page = path.join(tmp, 'page.html');
250
251
  const run = (...flags) => execFileSync(process.execPath, [cli, '--cwd', tmp, ...flags], { encoding: 'utf8', env: gitEnv });
251
- const source = '<template><p class="d-body--md">Copy</p><DtText :kind="\'label\'" :size="200">Label</DtText><dt-text kind="body" size="sm" variant="body-md" /></template>';
252
+ const read = () => [fs.readFileSync(file, 'utf8'), fs.readFileSync(page, 'utf8')];
253
+ // A composed class for typography (plus a marker and an import it would add), an
254
+ // authored legacy pair for text-variant, and an explicit variant beside a raw size.
255
+ const source = '<script setup>\n</script>\n<template><p class="d-body--md">Copy</p><p class="d-headline--eyebrow">Eyebrow</p><DtText :kind="\'label\'" :size="200">Label</DtText><dt-text kind="body" size="sm" variant="body-md" /></template>';
256
+ const html = '<p class="d-label--sm-plain">Label</p>\n';
252
257
  try {
253
258
  fs.writeFileSync(file, source);
259
+ fs.writeFileSync(page, html);
254
260
  assert.match(run('--health-check'), /\[PENDING\].*Text Kind and Size to Variant \(text-variant\)/);
255
- assert.match(run('--only', 'text-variant', '--dry-run'), /1 eligible, 1 existing-variant elements unchanged, 0 manual review/);
256
- assert.equal(fs.readFileSync(file, 'utf8'), source);
257
- assert.deepEqual(fs.readdirSync(tmp), ['App.vue']);
261
+ assert.match(run('--only', 'typography,text-variant', '--dry-run'), /1 eligible, 1 existing-variant elements unchanged, 0 manual review/);
262
+ assert.deepEqual(read(), [source, html]);
263
+ assert.deepEqual(fs.readdirSync(tmp).sort(), ['App.vue', 'page.html']);
264
+
265
+ run('--only', 'typography', '--yes');
266
+ const [typography, typographyPage] = read();
267
+ assert.match(typography, /<dt-text as="p" variant="body-md">Copy<\/dt-text>/);
268
+ assert.match(typography, /<!-- dt-text-migrate: review --><p class="d-headline--eyebrow">/);
269
+ assert.match(typography, /import \{ DtText \} from/);
270
+ assert.match(typography, /<DtText :kind="'label'" :size="200">/, 'typography leaves authored pairs to text-variant');
271
+ assert.equal(typographyPage, '<dt-text as="p" variant="label-xs" strength="normal">Label</dt-text>\n');
272
+
273
+ // Fresh typography output and the explicit variant count as existing variants.
274
+ assert.match(run('--only', 'text-variant', '--yes'), /1 eligible, 3 existing-variant elements unchanged, 0 manual review/);
275
+ assert.deepEqual(read(), [typography.replace(`:kind="'label'" :size="200"`, 'variant="label-sm"'), typographyPage]);
276
+
277
+ const applied = read();
258
278
  run('--only', 'typography,text-variant', '--yes');
259
- const output = fs.readFileSync(file, 'utf8');
260
- assert.match(output, /as="p" variant="body-md"/);
261
- assert.match(output, /variant="label-sm"/);
262
- assert.match(output, /kind="body" size="sm" variant="body-md"/);
279
+ assert.deepEqual(read(), applied, 'reruns change nothing');
263
280
  assert.match(run('--health-check'), /\[DONE\].*Text Kind and Size to Variant \(text-variant\)/);
264
281
  } finally {
265
282
  fs.rmSync(tmp, { recursive: true, force: true });