@typespec/html-program-viewer 0.65.0-dev.1 → 0.65.0-dev.2

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.
@@ -353,7 +353,7 @@ function getDebugClassNames(lookupItem, parentLookupItem, parentDebugClassNames,
353
353
  });
354
354
  }
355
355
 
356
- function getAtomicDebugSequenceTree(debugSequenceHash, parentNode) {
356
+ function getDebugTree(debugSequenceHash, parentNode) {
357
357
  const lookupItem = DEFINITION_LOOKUP_TABLE[debugSequenceHash];
358
358
  if (lookupItem === undefined) {
359
359
  return undefined;
@@ -369,7 +369,7 @@ function getAtomicDebugSequenceTree(debugSequenceHash, parentNode) {
369
369
  const childrenSequences = debugData.getChildrenSequences(node.sequenceHash);
370
370
  childrenSequences.reverse() // first process the overriding children that are merged last
371
371
  .forEach(sequence => {
372
- const child = getAtomicDebugSequenceTree(sequence, node);
372
+ const child = getDebugTree(sequence, node);
373
373
  if (child) {
374
374
  node.children.push(child);
375
375
  }
@@ -394,53 +394,6 @@ function getAtomicDebugSequenceTree(debugSequenceHash, parentNode) {
394
394
  return node;
395
395
  }
396
396
 
397
- function getResetDebugSequence(debugSequenceHash) {
398
- const resetClass = DEBUG_RESET_CLASSES[debugSequenceHash];
399
- if (resetClass === undefined) {
400
- return undefined;
401
- }
402
- const debugClassNames = [{
403
- className: debugSequenceHash
404
- }];
405
- const node = {
406
- sequenceHash: debugSequenceHash,
407
- direction: 'ltr',
408
- children: [],
409
- debugClassNames
410
- };
411
- node.rules = {};
412
- node.slot = 'makeResetStyles()';
413
- const [{
414
- className
415
- }] = node.debugClassNames;
416
- const cssRules = debugData.getCSSRules().filter(cssRule => {
417
- return cssRule.includes(`.${className}`);
418
- });
419
- node.rules[className] = cssRules.join('');
420
- return node;
421
- }
422
-
423
- function mergeDebugSequence(atomicClases, resetClassName) {
424
- const debugResultRootAtomic = atomicClases ? getAtomicDebugSequenceTree(atomicClases) : undefined;
425
- const debugResultRootReset = resetClassName ? getResetDebugSequence(resetClassName) : undefined;
426
- if (!debugResultRootAtomic && !debugResultRootReset) {
427
- return undefined;
428
- }
429
- if (!debugResultRootAtomic) {
430
- return debugResultRootReset;
431
- }
432
- if (!debugResultRootReset) {
433
- return debugResultRootAtomic;
434
- }
435
- const debugResultRoot = {
436
- sequenceHash: debugResultRootAtomic.sequenceHash + debugResultRootReset.sequenceHash,
437
- direction: debugResultRootAtomic.direction,
438
- children: [debugResultRootAtomic, debugResultRootReset],
439
- debugClassNames: [...debugResultRootAtomic.debugClassNames, ...debugResultRootReset.debugClassNames]
440
- };
441
- return debugResultRoot;
442
- }
443
-
444
397
  function injectDevTools(document) {
445
398
  const window = document.defaultView;
446
399
  if (!window || window.__GRIFFEL_DEVTOOLS__) {
@@ -448,18 +401,11 @@ function injectDevTools(document) {
448
401
  }
449
402
  const devtools = {
450
403
  getInfo: element => {
451
- let rootDebugSequenceHash;
452
- let rootResetDebugClassName;
453
- for (const className of element.classList) {
454
- if (className.startsWith(SEQUENCE_PREFIX)) {
455
- rootDebugSequenceHash = className;
456
- return;
457
- }
458
- if (DEBUG_RESET_CLASSES[className]) {
459
- rootResetDebugClassName = className;
460
- }
404
+ const rootDebugSequenceHash = Array.from(element.classList).find(className => className.startsWith(SEQUENCE_PREFIX));
405
+ if (rootDebugSequenceHash === undefined) {
406
+ return undefined;
461
407
  }
462
- return mergeDebugSequence(rootDebugSequenceHash, rootResetDebugClassName);
408
+ return getDebugTree(rootDebugSequenceHash);
463
409
  }
464
410
  };
465
411
  Object.defineProperty(window, '__GRIFFEL_DEVTOOLS__', {
@@ -1,6 +1,6 @@
1
1
  const manifest = {
2
2
  "version": "0.64.0",
3
- "commit": "34e32f95aa2a3ccc26b2afad21db11a822a265d6"
3
+ "commit": "dd65f86b4a9adbd78ee76e44510b6090247fd4bd"
4
4
  };
5
5
 
6
6
  export { manifest as default };
@@ -18034,7 +18034,7 @@ let manifest;
18034
18034
  try {
18035
18035
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
18036
18036
  // @ts-ignore
18037
- manifest = (await import('../manifest-BVCtXeEX.js')).default;
18037
+ manifest = (await import('../manifest-BoBSXM5B.js')).default;
18038
18038
  }
18039
18039
  catch {
18040
18040
  const name = "../dist/manifest.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/html-program-viewer",
3
- "version": "0.65.0-dev.1",
3
+ "version": "0.65.0-dev.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting an html view of the program.",
6
6
  "homepage": "https://typespec.io",
@@ -51,12 +51,12 @@
51
51
  "@testing-library/dom": "^10.4.0",
52
52
  "@testing-library/jest-dom": "^6.6.3",
53
53
  "@testing-library/react": "^16.2.0",
54
- "@types/node": "~22.10.7",
54
+ "@types/node": "~22.10.10",
55
55
  "@types/react": "~18.3.11",
56
56
  "@types/react-dom": "~18.3.0",
57
57
  "@typespec/compiler": "~0.64.0 || >=0.65.0-dev <0.65.0",
58
58
  "@vitejs/plugin-react": "~4.3.4",
59
- "@vitest/coverage-v8": "^3.0.3",
59
+ "@vitest/coverage-v8": "^3.0.4",
60
60
  "@vitest/ui": "^3.0.3",
61
61
  "c8": "^10.1.3",
62
62
  "rimraf": "~6.0.1",
@@ -64,7 +64,7 @@
64
64
  "vite": "^6.0.11",
65
65
  "vite-plugin-checker": "^0.8.0",
66
66
  "vite-plugin-dts": "4.5.0",
67
- "vitest": "^3.0.3",
67
+ "vitest": "^3.0.4",
68
68
  "@typespec/react-components": "~0.57.0"
69
69
  },
70
70
  "scripts": {