@typespec/html-program-viewer 0.61.0-dev.0 → 0.61.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.
package/dist/emitter.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { EmitContext, JSONSchemaType, Program } from '@typespec/compiler';
2
-
3
2
  export interface HtmlProgramViewerOptions {
4
3
  /**
5
4
  * Override compiler output-dir
@@ -0,0 +1,6 @@
1
+ const manifest = {
2
+ "version": "0.60.1",
3
+ "commit": "b1753b66a2131c078d831419d81b5afcded00bff"
4
+ };
5
+
6
+ export { manifest as default };
@@ -1,6 +1,5 @@
1
1
  import { Type } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
-
4
3
  export declare const Mono: ({ children, className }: {
5
4
  children: any;
6
5
  className?: string;
@@ -25445,6 +25445,7 @@ function applyReviver(reviver, obj, key, val) {
25445
25445
  for (let i = 0, len = val.length; i < len; ++i) {
25446
25446
  const v0 = val[i];
25447
25447
  const v1 = applyReviver(reviver, val, String(i), v0);
25448
+ // eslint-disable-next-line @typescript-eslint/no-array-delete
25448
25449
  if (v1 === undefined)
25449
25450
  delete val[i];
25450
25451
  else if (v1 !== v0)
@@ -25878,7 +25879,6 @@ class Collection extends NodeBase {
25878
25879
  }
25879
25880
  }
25880
25881
  }
25881
- Collection.maxFlowStringSingleLineLength = 60;
25882
25882
 
25883
25883
  /**
25884
25884
  * Stringifies a comment.
@@ -25910,6 +25910,8 @@ const FOLD_QUOTED = 'quoted';
25910
25910
  function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
25911
25911
  if (!lineWidth || lineWidth < 0)
25912
25912
  return text;
25913
+ if (lineWidth < minContentWidth)
25914
+ minContentWidth = 0;
25913
25915
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
25914
25916
  if (text.length <= endStep)
25915
25917
  return text;
@@ -26630,8 +26632,6 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
26630
26632
 
26631
26633
  function warn(logLevel, warning) {
26632
26634
  if (logLevel === 'debug' || logLevel === 'warn') {
26633
- // https://github.com/typescript-eslint/typescript-eslint/issues/7478
26634
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
26635
26635
  if (typeof process !== 'undefined' && process.emitWarning)
26636
26636
  process.emitWarning(warning);
26637
26637
  else
@@ -27604,7 +27604,7 @@ let manifest;
27604
27604
  try {
27605
27605
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
27606
27606
  // @ts-ignore
27607
- manifest = (await import('../manifest-CGbgVYyS.js')).default;
27607
+ manifest = (await import('../manifest-DdB77jqz.js')).default;
27608
27608
  }
27609
27609
  catch {
27610
27610
  const name = "../dist/manifest.js";
@@ -29242,7 +29242,7 @@ function parse$1(original) {
29242
29242
  let sign = 1;
29243
29243
  let n;
29244
29244
  let exp;
29245
- let decimal;
29245
+ let decimal = undefined;
29246
29246
  if (stringValue[0] === "-") {
29247
29247
  start = 1;
29248
29248
  sign = -1;
@@ -29278,6 +29278,7 @@ function parse$1(original) {
29278
29278
  }
29279
29279
  exp += Number(stringValue.slice(i + 1));
29280
29280
  stringValue = stringValue.slice(start, i);
29281
+ decimal = Math.max(stringValue.length - exp, 0);
29281
29282
  }
29282
29283
  else if (exp === undefined) {
29283
29284
  // Integer.
@@ -29291,11 +29292,24 @@ function parse$1(original) {
29291
29292
  while (stringValue[end - 1] === "0" && end > adjustedPointIndex) {
29292
29293
  end--;
29293
29294
  }
29295
+ // Only if there is 0 before the decimal point, keeps checking how many 0 there is after it and update the exponent accordingly.
29296
+ if (start === adjustedPointIndex + 1) {
29297
+ let cur = adjustedPointIndex;
29298
+ while (stringValue[cur] === "0" && cur < end) {
29299
+ cur++;
29300
+ exp--;
29301
+ }
29302
+ }
29294
29303
  try {
29295
29304
  stringValue = stringValue.slice(0, end);
29296
29305
  stringValue = stringValue + "0".repeat(Math.max(exp - stringValue.length, 0)); // add remaining zeros for cases like 3e30
29297
29306
  n = BigInt(stringValue);
29298
- decimal = n === 0n ? 0 : Math.max(stringValue.length - exp, 0);
29307
+ if (n === 0n) {
29308
+ decimal = 0;
29309
+ }
29310
+ else if (decimal === undefined) {
29311
+ decimal = Math.max(stringValue.length - Math.max(exp, 0), 0);
29312
+ }
29299
29313
  }
29300
29314
  catch {
29301
29315
  throw new InvalidNumericError(`Invalid numeric value: ${original}`);
@@ -29308,7 +29322,7 @@ function stringify(value) {
29308
29322
  return "0";
29309
29323
  const n = value.n.toString();
29310
29324
  const sign = value.s === -1 ? "-" : "";
29311
- const int = value.e === 0 ? "0" : n.slice(0, value.e);
29325
+ const int = value.e <= 0 ? "0" : n.slice(0, value.e);
29312
29326
  const decimal = value.e < n.length ? "." + n.slice(value.e).padStart(value.d, "0") : "";
29313
29327
  return sign + int + decimal;
29314
29328
  }
@@ -1,6 +1,5 @@
1
1
  import { Entity, Type } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
-
4
3
  interface InspectTypeProps {
5
4
  readonly entity: Entity;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { Type } from '@typespec/compiler';
2
2
  import { FC } from 'react';
3
-
4
3
  export declare const TypeDataTable: FC<{
5
4
  type: Type;
6
5
  }>;
@@ -1,5 +1,4 @@
1
1
  import { FC } from 'react';
2
-
3
2
  export interface JsValueProps {
4
3
  readonly value: any;
5
4
  }
@@ -1,5 +1,4 @@
1
1
  import { FC } from 'react';
2
-
3
2
  export declare const DefaultNodeRenderer: ({ path, name, data, isNonenumerable }: NodeRendererProps) => import("react/jsx-runtime").JSX.Element;
4
3
  export interface ObjectInspectorProps {
5
4
  readonly data: any;
@@ -1,5 +1,4 @@
1
1
  import { FC, ReactNode } from 'react';
2
-
3
2
  export interface ObjectLabelProps {
4
3
  readonly name: any;
5
4
  readonly isNonenumerable?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { FC } from 'react';
2
-
3
2
  export interface ObjectNameProps {
4
3
  readonly name: any;
5
4
  readonly dimmed?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { FC } from 'react';
2
-
3
2
  /**
4
3
  * A preview of the object
5
4
  */
@@ -1,4 +1,3 @@
1
1
  import { FC } from 'react';
2
-
3
2
  export declare const ObjectRootLabel: FC<any>;
4
3
  //# sourceMappingURL=object-root-label.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { TreeNavigator, TypeGraphListNode } from '../use-tree-navigation.js';
2
-
3
2
  export interface ListTypeViewProps {
4
3
  readonly nav: TreeNavigator;
5
4
  readonly node: TypeGraphListNode;
@@ -1,5 +1,4 @@
1
1
  import { Program } from '@typespec/compiler';
2
-
3
2
  export declare const ProgramProvider: import('react').Provider<Program | undefined>;
4
3
  export declare function useProgram(): Program;
5
4
  //# sourceMappingURL=program-context.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { TypeGraphNode } from './use-tree-navigation.js';
2
-
3
2
  export interface TreeNavigationProps {
4
3
  }
5
4
  export declare const TreeNavigation: (_: TreeNavigationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { Type } from '@typespec/compiler';
2
-
3
2
  export type EntityPropertyConfig = "parent" | "nested" | "ref" | "value" | "skip";
4
3
  export declare const TypeConfig: TypeGraphConfig;
5
4
  type PropsToDefine<T extends Type> = Exclude<keyof T, HiddenPropsType | keyof typeof CommonPropsConfig>;
@@ -1,6 +1,5 @@
1
1
  import { Program } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
-
4
3
  export declare function renderProgram(program: Program): string;
5
4
  export interface TypeGraphProps {
6
5
  readonly program: Program;
@@ -1,5 +1,4 @@
1
1
  import { TreeNavigator, TypeGraphTypeNode } from '../use-tree-navigation.js';
2
-
3
2
  export interface TypeNodeViewProps {
4
3
  readonly nav: TreeNavigator;
5
4
  readonly node: TypeGraphTypeNode;
@@ -1,6 +1,5 @@
1
1
  import { Program, Type } from '@typespec/compiler';
2
2
  import { ReactNode } from 'react';
3
-
4
3
  export interface TypeGraphNodeBase {
5
4
  readonly id: string;
6
5
  readonly name: string;
@@ -1,4 +1,3 @@
1
1
  import { TypeSpecTestLibrary } from '@typespec/compiler/testing';
2
-
3
2
  export declare const ProgramViewerTestLibrary: TypeSpecTestLibrary;
4
3
  //# sourceMappingURL=index.d.ts.map
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Type, Union } from '@typespec/compiler';
2
-
3
2
  export type NamedType = Type & {
4
3
  name: string;
5
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/html-program-viewer",
3
- "version": "0.61.0-dev.0",
3
+ "version": "0.61.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",
@@ -23,7 +23,6 @@
23
23
  "default": "./dist/emitter/index.js"
24
24
  },
25
25
  "./react": {
26
- "development": "./src/react/index.ts",
27
26
  "types": "./dist/react/index.d.ts",
28
27
  "default": "./dist/react/index.js"
29
28
  },
@@ -37,35 +36,35 @@
37
36
  "!dist/test/**"
38
37
  ],
39
38
  "peerDependencies": {
40
- "@typespec/compiler": "~0.60.0 || >=0.61.0-dev <0.61.0"
39
+ "@typespec/compiler": "~0.60.1 || >=0.61.0-dev <0.61.0"
41
40
  },
42
41
  "dependencies": {
43
- "@fluentui/react-components": "~9.54.5",
44
- "@fluentui/react-icons": "^2.0.249",
45
- "@fluentui/react-list-preview": "^0.3.1",
42
+ "@fluentui/react-components": "~9.54.15",
43
+ "@fluentui/react-icons": "^2.0.258",
44
+ "@fluentui/react-list-preview": "^0.3.6",
46
45
  "react": "~18.3.1",
47
46
  "react-dom": "~18.3.1",
48
- "react-hotkeys-hook": "^4.5.0"
47
+ "react-hotkeys-hook": "^4.5.1"
49
48
  },
50
49
  "devDependencies": {
51
- "@babel/core": "^7.24.9",
50
+ "@babel/core": "^7.25.2",
52
51
  "@testing-library/dom": "^10.4.0",
53
- "@testing-library/jest-dom": "^6.4.7",
54
- "@testing-library/react": "^16.0.0",
55
- "@types/node": "~18.11.19",
56
- "@types/react": "~18.3.3",
52
+ "@testing-library/jest-dom": "^6.5.0",
53
+ "@testing-library/react": "^16.0.1",
54
+ "@types/node": "~22.5.4",
55
+ "@types/react": "~18.3.5",
57
56
  "@types/react-dom": "~18.3.0",
58
- "@typespec/compiler": "~0.60.0 || >=0.61.0-dev <0.61.0",
57
+ "@typespec/compiler": "~0.60.1 || >=0.61.0-dev <0.61.0",
59
58
  "@vitejs/plugin-react": "~4.3.1",
60
- "@vitest/coverage-v8": "^2.0.4",
61
- "@vitest/ui": "^2.0.4",
59
+ "@vitest/coverage-v8": "^2.1.0",
60
+ "@vitest/ui": "^2.1.0",
62
61
  "c8": "^10.1.2",
63
62
  "rimraf": "~6.0.1",
64
- "typescript": "~5.5.4",
65
- "vite": "^5.3.4",
66
- "vite-plugin-checker": "^0.7.2",
67
- "vite-plugin-dts": "4.0.0-beta.1",
68
- "vitest": "^2.0.4",
63
+ "typescript": "~5.6.2",
64
+ "vite": "^5.4.4",
65
+ "vite-plugin-checker": "^0.8.0",
66
+ "vite-plugin-dts": "4.2.1",
67
+ "vitest": "^2.1.0",
69
68
  "@typespec/react-components": "~0.57.0"
70
69
  },
71
70
  "scripts": {
@@ -1,6 +0,0 @@
1
- const manifest = {
2
- "version": "0.60.0",
3
- "commit": "0be9e8f22bb587db69bf1fc5e73effef1e2364a5"
4
- };
5
-
6
- export { manifest as default };