@typespec/playground 0.5.0-dev.4 → 0.5.0-dev.5

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.
Files changed (45) hide show
  1. package/dist/.storybook/main.d.ts +0 -1
  2. package/dist/.storybook/preview.d.ts +0 -1
  3. package/dist/manifest-CNmB2KUS-CNmB2KUS.js +6 -0
  4. package/dist/react/index.js +102 -57
  5. package/dist/src/browser-host.d.ts +0 -1
  6. package/dist/src/editor-command-bar/editor-command-bar.d.ts +0 -1
  7. package/dist/src/manifest.d.ts +0 -1
  8. package/dist/src/react/context/playground-context.d.ts +0 -1
  9. package/dist/src/react/default-footer.d.ts +0 -1
  10. package/dist/src/react/diagnostic-list/diagnostic-list.d.ts +0 -1
  11. package/dist/src/react/editor.d.ts +0 -1
  12. package/dist/src/react/emitter-dropdown.d.ts +0 -1
  13. package/dist/src/react/file-output/file-output.d.ts +0 -1
  14. package/dist/src/react/footer/footer-item.d.ts +0 -1
  15. package/dist/src/react/footer/footer.d.ts +0 -1
  16. package/dist/src/react/output-tabs/output-tabs.d.ts +0 -1
  17. package/dist/src/react/output-view/file-viewer.d.ts +0 -1
  18. package/dist/src/react/output-view/output-view.d.ts +0 -1
  19. package/dist/src/react/output-view/type-graph-viewer.d.ts +0 -1
  20. package/dist/src/react/playground.d.ts +0 -1
  21. package/dist/src/react/problem-pane/header.d.ts +0 -1
  22. package/dist/src/react/problem-pane/problem-pane.d.ts +0 -1
  23. package/dist/src/react/samples-dropdown.d.ts +0 -1
  24. package/dist/src/react/settings/compiler-settings-dialog-button.d.ts +0 -1
  25. package/dist/src/react/settings/compiler-settings.d.ts +0 -1
  26. package/dist/src/react/settings/emitter-options-form.d.ts +0 -1
  27. package/dist/src/react/settings/linter-form.d.ts +0 -1
  28. package/dist/src/react/standalone.d.ts +0 -1
  29. package/dist/src/react/types.d.ts +0 -1
  30. package/dist/src/react/typespec-editor.d.ts +0 -1
  31. package/dist/src/react/viewers/index.d.ts +0 -1
  32. package/dist/src/react/viewers/swagger-ui.d.ts +0 -1
  33. package/dist/src/services.d.ts +0 -1
  34. package/dist/src/tooling/index.d.ts +0 -1
  35. package/dist/src/tooling/types.d.ts +0 -1
  36. package/dist/src/types.d.ts +0 -1
  37. package/dist/src/vite/index.d.ts +0 -1
  38. package/dist/src/vite/types.d.ts +0 -1
  39. package/dist/stories/footer/footer-item.stories.d.ts +0 -1
  40. package/dist/stories/footer/footer-version-item.stories.d.ts +0 -1
  41. package/dist/stories/footer/footer.stories.d.ts +0 -1
  42. package/dist/stories/playground.stories.d.ts +0 -1
  43. package/dist/vite.config.d.ts +1 -1
  44. package/package.json +29 -35
  45. package/dist/manifest-Cewnx59A-Cewnx59A.js +0 -6
@@ -1,5 +1,4 @@
1
1
  import { StorybookConfig } from '@storybook/react-vite';
2
-
3
2
  declare const config: StorybookConfig;
4
3
  export default config;
5
4
  //# sourceMappingURL=main.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { Preview } from '@storybook/react';
2
-
3
2
  declare const preview: Preview;
4
3
  export default preview;
5
4
  //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1,6 @@
1
+ const manifest = {
2
+ "version": "0.60.1",
3
+ "commit": "66e847c71be174f2c789307a7ccb32306d1ca8ba"
4
+ };
5
+
6
+ export { manifest as default };
@@ -2323,18 +2323,13 @@ function createFileViewer(fileViewers) {
2323
2323
  }
2324
2324
 
2325
2325
  function _extends() {
2326
- _extends = Object.assign ? Object.assign.bind() : function (target) {
2327
- for (var i = 1; i < arguments.length; i++) {
2328
- var source = arguments[i];
2329
- for (var key in source) {
2330
- if (Object.prototype.hasOwnProperty.call(source, key)) {
2331
- target[key] = source[key];
2332
- }
2333
- }
2326
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
2327
+ for (var e = 1; e < arguments.length; e++) {
2328
+ var t = arguments[e];
2329
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
2334
2330
  }
2335
- return target;
2336
- };
2337
- return _extends.apply(this, arguments);
2331
+ return n;
2332
+ }, _extends.apply(null, arguments);
2338
2333
  }
2339
2334
 
2340
2335
  var reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];
@@ -2360,7 +2355,7 @@ var mappedKeys = {
2360
2355
  ControlRight: 'ctrl'
2361
2356
  };
2362
2357
  function mapKey(key) {
2363
- return (mappedKeys[key] || key).trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
2358
+ return (key && mappedKeys[key] || key || '').trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');
2364
2359
  }
2365
2360
  function isHotkeyModifier(key) {
2366
2361
  return reservedModifierKeywords.includes(key);
@@ -2600,7 +2595,9 @@ var stopPropagation = function stopPropagation(e) {
2600
2595
  };
2601
2596
  var useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2602
2597
  function useHotkeys(keys, callback, options, dependencies) {
2603
- var ref = useRef(null);
2598
+ var _useState = useState(null),
2599
+ ref = _useState[0],
2600
+ setRef = _useState[1];
2604
2601
  var hasTriggeredRef = useRef(false);
2605
2602
  var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
2606
2603
  var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;
@@ -2630,9 +2627,9 @@ function useHotkeys(keys, callback, options, dependencies) {
2630
2627
  }
2631
2628
  // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
2632
2629
  // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.
2633
- if (ref.current !== null) {
2634
- var rootNode = ref.current.getRootNode();
2635
- if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref.current && !ref.current.contains(rootNode.activeElement)) {
2630
+ if (ref !== null) {
2631
+ var rootNode = ref.getRootNode();
2632
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref && !ref.contains(rootNode.activeElement)) {
2636
2633
  stopPropagation(e);
2637
2634
  return;
2638
2635
  }
@@ -2684,7 +2681,7 @@ function useHotkeys(keys, callback, options, dependencies) {
2684
2681
  listener(event, true);
2685
2682
  }
2686
2683
  };
2687
- var domNode = ref.current || (_options == null ? void 0 : _options.document) || document;
2684
+ var domNode = ref || (_options == null ? void 0 : _options.document) || document;
2688
2685
  // @ts-ignore
2689
2686
  domNode.addEventListener('keyup', handleKeyUp);
2690
2687
  // @ts-ignore
@@ -2705,8 +2702,8 @@ function useHotkeys(keys, callback, options, dependencies) {
2705
2702
  });
2706
2703
  }
2707
2704
  };
2708
- }, [_keys, memoisedOptions, enabledScopes]);
2709
- return ref;
2705
+ }, [ref, _keys, memoisedOptions, enabledScopes]);
2706
+ return setRef;
2710
2707
  }
2711
2708
 
2712
2709
  /**
@@ -10076,42 +10073,70 @@ function isHTMLElement(target) {
10076
10073
  * @returns single merged tabster attribute
10077
10074
  */ const useMergedTabsterAttributes_unstable = (...attributes)=>{
10078
10075
  'use no memo';
10079
- const stringAttributes = attributes.map((attribute)=>attribute[TABSTER_ATTRIBUTE_NAME]).filter(Boolean);
10080
- return React.useMemo(()=>{
10081
- let attribute = stringAttributes[0];
10082
- attributes.shift();
10083
- for (const attr of stringAttributes){
10084
- attribute = mergeAttributes(attribute, attr);
10076
+ const stringAttributes = attributes.reduce((acc, curr)=>{
10077
+ if (curr[TABSTER_ATTRIBUTE_NAME]) {
10078
+ acc.push(curr[TABSTER_ATTRIBUTE_NAME]);
10085
10079
  }
10086
- return {
10087
- [TABSTER_ATTRIBUTE_NAME]: attribute
10088
- };
10080
+ return acc;
10081
+ }, []);
10082
+ if (process.env.NODE_ENV !== 'production') {
10083
+ // ignoring rules of hooks because this is a condition based on the environment
10084
+ // it's safe to ignore the rule
10085
+ // eslint-disable-next-line react-hooks/rules-of-hooks
10086
+ useWarnIfUnstableAttributes(stringAttributes);
10087
+ }
10088
+ return React.useMemo(()=>({
10089
+ [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
10090
+ }), // disable exhaustive-deps because we want to memoize the result of the reduction
10091
+ // this is safe because the collection of attributes is not expected to change at runtime
10089
10092
  // eslint-disable-next-line react-hooks/exhaustive-deps
10090
- }, stringAttributes);
10093
+ stringAttributes);
10091
10094
  };
10092
- function mergeAttributes(a, b) {
10093
- if (!b) {
10094
- return a;
10095
- }
10096
- let aParsed = {};
10097
- let bParsed = {};
10098
- if (a) {
10099
- try {
10100
- aParsed = JSON.parse(a);
10101
- // eslint-disable-next-line no-empty
10102
- } catch {}
10095
+ /**
10096
+ * Merges two JSON strings into one.
10097
+ */ const mergeJSONStrings = (a, b)=>JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));
10098
+ /**
10099
+ * Tries to parse a JSON string and returns an object.
10100
+ * If the JSON string is invalid, an empty object is returned.
10101
+ */ const safelyParseJSON = (json)=>{
10102
+ try {
10103
+ return JSON.parse(json);
10104
+ } catch {
10105
+ return {};
10103
10106
  }
10104
- if (b) {
10105
- try {
10106
- bParsed = JSON.parse(b);
10107
- // eslint-disable-next-line no-empty
10108
- } catch {}
10107
+ };
10108
+ /**
10109
+ * Helper hook that ensures that the attributes passed to the hook are stable.
10110
+ * This is necessary because the attributes are expected to not change at runtime.
10111
+ *
10112
+ * This hook will console.warn if the attributes change at runtime.
10113
+ */ const useWarnIfUnstableAttributes = (attributes)=>{
10114
+ 'use no memo';
10115
+ const initialAttributesRef = React.useRef(attributes);
10116
+ let isStable = initialAttributesRef.current.length === attributes.length;
10117
+ if (initialAttributesRef.current !== attributes && isStable) {
10118
+ for(let i = 0; i < attributes.length; i++){
10119
+ if (initialAttributesRef.current[i] !== attributes[i]) {
10120
+ isStable = false;
10121
+ break;
10122
+ }
10123
+ }
10109
10124
  }
10110
- return JSON.stringify({
10111
- ...aParsed,
10112
- ...bParsed
10113
- });
10114
- }
10125
+ React.useEffect(()=>{
10126
+ if (!isStable) {
10127
+ const error = new Error();
10128
+ // eslint-disable-next-line no-console
10129
+ console.warn(/** #__DE-INDENT__ */ `
10130
+ @fluentui/react-tabster [useMergedTabsterAttributes]:
10131
+ The attributes passed to the hook changed at runtime.
10132
+ This might lead to unexpected behavior, please ensure that the attributes are stable.
10133
+ ${error.stack}
10134
+ `);
10135
+ }
10136
+ }, [
10137
+ isStable
10138
+ ]);
10139
+ };
10115
10140
 
10116
10141
  /**
10117
10142
  * @internal
@@ -12808,7 +12833,7 @@ const renderCheckbox_unstable = (state)=>{
12808
12833
  children: [
12809
12834
  /*#__PURE__*/ jsx(state.input, {}),
12810
12835
  state.labelPosition === 'before' && state.label && /*#__PURE__*/ jsx(state.label, {}),
12811
- /*#__PURE__*/ jsx(state.indicator, {}),
12836
+ state.indicator && /*#__PURE__*/ jsx(state.indicator, {}),
12812
12837
  state.labelPosition === 'after' && state.label && /*#__PURE__*/ jsx(state.label, {})
12813
12838
  ]
12814
12839
  });
@@ -31259,8 +31284,13 @@ const diagnostics = {
31259
31284
  unassignable: {
31260
31285
  severity: "error",
31261
31286
  messages: {
31262
- default: paramMessage `Type '${"value"}' is not assignable to type '${"targetType"}'`,
31263
- withDetails: paramMessage `Type '${"sourceType"}' is not assignable to type '${"targetType"}'\n ${"details"}`,
31287
+ default: paramMessage `Type '${"sourceType"}' is not assignable to type '${"targetType"}'`,
31288
+ },
31289
+ },
31290
+ "property-unassignable": {
31291
+ severity: "error",
31292
+ messages: {
31293
+ default: paramMessage `Types of property '${"propName"}' are incompatible`,
31264
31294
  },
31265
31295
  },
31266
31296
  "property-required": {
@@ -38807,7 +38837,7 @@ let manifest;
38807
38837
  try {
38808
38838
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38809
38839
  // @ts-ignore
38810
- manifest = (await import('../manifest-Cewnx59A-Cewnx59A.js')).default;
38840
+ manifest = (await import('../manifest-CNmB2KUS-CNmB2KUS.js')).default;
38811
38841
  }
38812
38842
  catch {
38813
38843
  const name = "../dist/manifest.js";
@@ -40445,7 +40475,7 @@ function parse$1(original) {
40445
40475
  let sign = 1;
40446
40476
  let n;
40447
40477
  let exp;
40448
- let decimal;
40478
+ let decimal = undefined;
40449
40479
  if (stringValue[0] === "-") {
40450
40480
  start = 1;
40451
40481
  sign = -1;
@@ -40481,6 +40511,7 @@ function parse$1(original) {
40481
40511
  }
40482
40512
  exp += Number(stringValue.slice(i + 1));
40483
40513
  stringValue = stringValue.slice(start, i);
40514
+ decimal = Math.max(stringValue.length - exp, 0);
40484
40515
  }
40485
40516
  else if (exp === undefined) {
40486
40517
  // Integer.
@@ -40494,11 +40525,24 @@ function parse$1(original) {
40494
40525
  while (stringValue[end - 1] === "0" && end > adjustedPointIndex) {
40495
40526
  end--;
40496
40527
  }
40528
+ // Only if there is 0 before the decimal point, keeps checking how many 0 there is after it and update the exponent accordingly.
40529
+ if (start === adjustedPointIndex + 1) {
40530
+ let cur = adjustedPointIndex;
40531
+ while (stringValue[cur] === "0" && cur < end) {
40532
+ cur++;
40533
+ exp--;
40534
+ }
40535
+ }
40497
40536
  try {
40498
40537
  stringValue = stringValue.slice(0, end);
40499
40538
  stringValue = stringValue + "0".repeat(Math.max(exp - stringValue.length, 0)); // add remaining zeros for cases like 3e30
40500
40539
  n = BigInt(stringValue);
40501
- decimal = n === 0n ? 0 : Math.max(stringValue.length - exp, 0);
40540
+ if (n === 0n) {
40541
+ decimal = 0;
40542
+ }
40543
+ else if (decimal === undefined) {
40544
+ decimal = Math.max(stringValue.length - Math.max(exp, 0), 0);
40545
+ }
40502
40546
  }
40503
40547
  catch {
40504
40548
  throw new InvalidNumericError(`Invalid numeric value: ${original}`);
@@ -40511,7 +40555,7 @@ function stringify(value) {
40511
40555
  return "0";
40512
40556
  const n = value.n.toString();
40513
40557
  const sign = value.s === -1 ? "-" : "";
40514
- const int = value.e === 0 ? "0" : n.slice(0, value.e);
40558
+ const int = value.e <= 0 ? "0" : n.slice(0, value.e);
40515
40559
  const decimal = value.e < n.length ? "." + n.slice(value.e).padStart(value.d, "0") : "";
40516
40560
  return sign + int + decimal;
40517
40561
  }
@@ -40610,6 +40654,7 @@ var Related;
40610
40654
  Related[Related["true"] = 1] = "true";
40611
40655
  Related[Related["maybe"] = 2] = "maybe";
40612
40656
  })(Related || (Related = {}));
40657
+ // #endregion
40613
40658
 
40614
40659
  var ResolutionKind;
40615
40660
  (function (ResolutionKind) {
@@ -1,6 +1,5 @@
1
1
  import { LibraryImportOptions } from './core.js';
2
2
  import { BrowserHost } from './types.js';
3
-
4
3
  export declare function resolveVirtualPath(path: string, ...paths: string[]): string;
5
4
  /**
6
5
  * Create the browser host from the list of libraries.
@@ -1,7 +1,6 @@
1
1
  import { CompilerOptions } from '@typespec/compiler';
2
2
  import { FunctionComponent, ReactNode } from 'react';
3
3
  import { BrowserHost, PlaygroundSample } from '../types.js';
4
-
5
4
  export interface EditorCommandBarProps {
6
5
  documentationUrl?: string;
7
6
  saveCode: () => Promise<void> | void;
@@ -1,5 +1,4 @@
1
1
  import { PlaygroundConfig } from '../src/vite/types.js';
2
-
3
2
  declare const config: PlaygroundConfig;
4
3
  export default config;
5
4
  //# sourceMappingURL=manifest.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { BrowserHost } from '../../types.js';
2
-
3
2
  export interface PlaygroundContext {
4
3
  readonly host: BrowserHost;
5
4
  readonly setContent: (content: string) => void;
@@ -1,4 +1,3 @@
1
1
  import { FunctionComponent } from 'react';
2
-
3
2
  export declare const DefaultFooter: FunctionComponent;
4
3
  //# sourceMappingURL=default-footer.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { Diagnostic } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
-
4
3
  export interface DiagnosticListProps {
5
4
  readonly diagnostics: readonly Diagnostic[];
6
5
  readonly onDiagnosticSelected?: (diagnostic: Diagnostic) => void;
@@ -1,6 +1,5 @@
1
1
  import { editor } from 'monaco-editor';
2
2
  import { FunctionComponent } from 'react';
3
-
4
3
  export interface EditorProps {
5
4
  model: editor.IModel;
6
5
  actions?: editor.IActionDescriptor[];
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
-
3
2
  export type EmitterDropdownProps = {
4
3
  emitters: string[];
5
4
  selectedEmitter: string;
@@ -1,6 +1,5 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { FileOutputViewer } from '../types.js';
3
-
4
3
  export interface FileOutputProps {
5
4
  readonly filename: string;
6
5
  readonly content: string;
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent, ReactNode } from 'react';
2
-
3
2
  export interface FooterItemProps {
4
3
  className?: string;
5
4
  link?: string;
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent, ReactNode } from 'react';
2
-
3
2
  export interface FooterProps {
4
3
  className?: string;
5
4
  children: ReactNode;
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
-
3
2
  export interface OutputTabsProps {
4
3
  filenames: string[];
5
4
  selected: string;
@@ -1,4 +1,3 @@
1
1
  import { FileOutputViewer, ProgramViewer } from '../types.js';
2
-
3
2
  export declare function createFileViewer(fileViewers: FileOutputViewer[]): ProgramViewer;
4
3
  //# sourceMappingURL=file-viewer.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { PlaygroundEditorsOptions } from '../playground.js';
3
3
  import { CompilationState, FileOutputViewer, ProgramViewer } from '../types.js';
4
-
5
4
  export interface OutputViewProps {
6
5
  compilationState: CompilationState | undefined;
7
6
  editorOptions?: PlaygroundEditorsOptions;
@@ -1,4 +1,3 @@
1
1
  import { ProgramViewer } from '../types.js';
2
-
3
2
  export declare const TypeGraphViewer: ProgramViewer;
4
3
  //# sourceMappingURL=type-graph-viewer.d.ts.map
@@ -2,7 +2,6 @@ import { CompilerOptions } from '@typespec/compiler';
2
2
  import { FunctionComponent, ReactNode } from 'react';
3
3
  import { BrowserHost, PlaygroundSample } from '../types.js';
4
4
  import { FileOutputViewer, ProgramViewer } from './types.js';
5
-
6
5
  export interface PlaygroundProps {
7
6
  host: BrowserHost;
8
7
  /** Default emitter if leaving this unmanaged. */
@@ -1,6 +1,5 @@
1
1
  import { MouseEventHandler } from 'react';
2
2
  import { CompilationState } from '../types.js';
3
-
4
3
  export interface ProblemPaneHeaderProps {
5
4
  compilationState: CompilationState | undefined;
6
5
  onClick?: MouseEventHandler<HTMLDivElement>;
@@ -1,7 +1,6 @@
1
1
  import { Diagnostic } from '@typespec/compiler';
2
2
  import { FunctionComponent, MouseEventHandler } from 'react';
3
3
  import { CompilationState } from '../types.js';
4
-
5
4
  export interface ProblemPaneProps {
6
5
  readonly collapsed: boolean;
7
6
  readonly compilationState: CompilationState | undefined;
@@ -1,6 +1,5 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { PlaygroundSample } from '../types.js';
3
-
4
3
  export interface SamplesDropdownProps {
5
4
  samples: Record<string, PlaygroundSample>;
6
5
  selectedSampleName: string;
@@ -1,5 +1,4 @@
1
1
  import { CompilerOptions } from '@typespec/compiler';
2
-
3
2
  export interface CompilerSettingsDialogButtonProps {
4
3
  selectedEmitter: string;
5
4
  compilerOptions: CompilerOptions;
@@ -1,7 +1,6 @@
1
1
  import { CompilerOptions } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
3
  import { BrowserHost } from '../../types.js';
4
-
5
4
  export interface CompilerSettingsProps {
6
5
  readonly host: BrowserHost;
7
6
  readonly selectedEmitter: string;
@@ -1,7 +1,6 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { PlaygroundTspLibrary } from '../../types.js';
3
3
  import { EmitterOptions } from '../types.js';
4
-
5
4
  export interface EmitterOptionsFormProps {
6
5
  readonly library: PlaygroundTspLibrary;
7
6
  readonly options: EmitterOptions;
@@ -1,7 +1,6 @@
1
1
  import { LinterRuleSet } from '@typespec/compiler';
2
2
  import { FunctionComponent } from 'react';
3
3
  import { PlaygroundTspLibrary } from '../../types.js';
4
-
5
4
  export interface LinterFormProps {
6
5
  libraries: Record<string, PlaygroundTspLibrary>;
7
6
  linterRuleSet: LinterRuleSet;
@@ -2,7 +2,6 @@ import { FunctionComponent, ReactNode } from 'react';
2
2
  import { LibraryImportOptions } from '../core.js';
3
3
  import { UrlStateStorage } from '../state-storage.js';
4
4
  import { PlaygroundProps, PlaygroundSaveData } from './playground.js';
5
-
6
5
  export interface ReactPlaygroundConfig extends Partial<PlaygroundProps> {
7
6
  readonly libraries: readonly string[];
8
7
  readonly importConfig?: LibraryImportOptions;
@@ -1,6 +1,5 @@
1
1
  import { Program } from '@typespec/compiler';
2
2
  import { ReactNode } from 'react';
3
-
4
3
  export type CompilationCrashed = {
5
4
  readonly internalCompilerError: any;
6
5
  };
@@ -2,7 +2,6 @@ import { editor } from 'monaco-editor';
2
2
  import { FunctionComponent } from 'react';
3
3
  import { EditorProps } from './editor.js';
4
4
  import { PlaygroundEditorsOptions } from './playground.js';
5
-
6
5
  export interface TypeSpecEditorProps extends Omit<EditorProps, "options"> {
7
6
  options?: editor.IStandaloneEditorConstructionOptions;
8
7
  }
@@ -1,4 +1,3 @@
1
1
  import { FileOutputViewer } from '../types.js';
2
-
3
2
  export declare const SwaggerUIViewer: FileOutputViewer;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
-
3
2
  export interface SwaggerUIProps {
4
3
  readonly spec: string;
5
4
  }
@@ -1,6 +1,5 @@
1
1
  import { DiagnosticTarget, NoTarget } from '@typespec/compiler';
2
2
  import { BrowserHost } from './types.js';
3
-
4
3
  import * as monaco from "monaco-editor";
5
4
  export declare function registerMonacoLanguage(host: BrowserHost): Promise<void>;
6
5
  export declare function getMonacoRange(typespecCompiler: typeof import("@typespec/compiler"), target: DiagnosticTarget | typeof NoTarget): monaco.IRange;
@@ -1,5 +1,4 @@
1
1
  import { PlaygroundSampleConfig } from './types.js';
2
-
3
2
  /**
4
3
  * @experimental This API is experimental
5
4
  */
@@ -1,4 +1,3 @@
1
1
  import { PlaygroundSample } from '../types.js';
2
-
3
2
  export type PlaygroundSampleConfig = Omit<PlaygroundSample, "content">;
4
3
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { CompilerHost, CompilerOptions, LinterDefinition, NodePackage, TypeSpecLibrary } from '@typespec/compiler';
2
-
3
2
  export interface PlaygroundSample {
4
3
  filename: string;
5
4
  preferredEmitter?: string;
@@ -1,5 +1,4 @@
1
1
  import { UserConfig } from 'vite';
2
2
  import { PlaygroundUserConfig } from './types.js';
3
-
4
3
  export declare function definePlaygroundViteConfig(config: PlaygroundUserConfig): UserConfig;
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { PlaygroundLinks } from '../react/playground.js';
2
2
  import { PlaygroundSampleConfig } from '../tooling/types.js';
3
3
  import { PlaygroundSample } from '../types.js';
4
-
5
4
  export interface PlaygroundUserConfig extends Omit<PlaygroundConfig, "samples"> {
6
5
  /**
7
6
  * If the bundle library plugin should be loaded.
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { FooterItem } from '../../src/react/footer/index.js';
3
-
4
3
  declare const meta: Meta<typeof FooterItem>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof FooterItem>;
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { FooterVersionItem } from '../../src/react/footer/index.js';
3
-
4
3
  declare const meta: Meta<typeof FooterVersionItem>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof FooterVersionItem>;
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { Footer } from '../../src/react/footer/index.js';
3
-
4
3
  declare const meta: Meta<typeof Footer>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof Footer>;
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { Playground } from '../src/react/playground.js';
3
-
4
3
  declare const meta: Meta<typeof Playground>;
5
4
  export default meta;
6
5
  type Story = StoryObj<typeof Playground>;
@@ -1,3 +1,3 @@
1
- declare const _default: any;
1
+ declare const _default: import('vite').UserConfig;
2
2
  export default _default;
3
3
  //# sourceMappingURL=vite.config.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/playground",
3
- "version": "0.5.0-dev.4",
3
+ "version": "0.5.0-dev.5",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec playground UI components.",
6
6
  "homepage": "https://typespec.io",
@@ -20,32 +20,26 @@
20
20
  "main": "dist/src/index.js",
21
21
  "exports": {
22
22
  ".": {
23
- "development": "./src/index.ts",
24
23
  "types": "./dist/src/index.d.ts",
25
24
  "default": "./dist/index.js"
26
25
  },
27
26
  "./vite": {
28
- "development": "./src/vite/index.ts",
29
27
  "types": "./dist/src/vite/index.d.ts",
30
28
  "default": "./dist/vite/index.js"
31
29
  },
32
30
  "./tooling": {
33
- "development": "./src/tooling/index.ts",
34
31
  "types": "./dist/src/tooling/index.d.ts",
35
32
  "default": "./dist/tooling/index.js"
36
33
  },
37
34
  "./manifest": {
38
- "development": "./src/manifest.ts",
39
35
  "types": "./dist/src/manifest.d.ts",
40
36
  "default": "./dist/manifest.js"
41
37
  },
42
38
  "./react": {
43
- "development": "./src/react/index.ts",
44
39
  "types": "./dist/src/react/index.d.ts",
45
40
  "default": "./dist/react/index.js"
46
41
  },
47
42
  "./react/viewers": {
48
- "development": "./src/react/viewers/index.tsx",
49
43
  "types": "./dist/src/react/viewers/index.d.ts",
50
44
  "default": "./dist/react/viewers/index.js"
51
45
  },
@@ -61,19 +55,19 @@
61
55
  "!dist/test/**"
62
56
  ],
63
57
  "dependencies": {
64
- "@fluentui/react-components": "~9.54.5",
65
- "@fluentui/react-icons": "^2.0.249",
66
- "@typespec/bundler": "~0.1.6 || >=0.2.0-dev <0.2.0",
67
- "@typespec/compiler": "~0.59.1 || >=0.60.0-dev <0.60.0",
68
- "@typespec/html-program-viewer": "~0.59.0 || >=0.60.0-dev <0.60.0",
69
- "@typespec/http": "~0.59.1 || >=0.60.0-dev <0.60.0",
70
- "@typespec/openapi": "~0.59.0 || >=0.60.0-dev <0.60.0",
71
- "@typespec/openapi3": "~0.59.1 || >=0.60.0-dev <0.60.0",
72
- "@typespec/protobuf": "~0.59.0 || >=0.60.0-dev <0.60.0",
73
- "@typespec/rest": "~0.59.1 || >=0.60.0-dev <0.60.0",
74
- "@typespec/versioning": "~0.59.0 || >=0.60.0-dev <0.60.0",
58
+ "@fluentui/react-components": "~9.54.15",
59
+ "@fluentui/react-icons": "^2.0.258",
60
+ "@typespec/bundler": "~0.1.7 || >=0.2.0-dev <0.2.0",
61
+ "@typespec/compiler": "~0.60.1 || >=0.61.0-dev <0.61.0",
62
+ "@typespec/html-program-viewer": "~0.60.0 || >=0.61.0-dev <0.61.0",
63
+ "@typespec/http": "~0.60.0 || >=0.61.0-dev <0.61.0",
64
+ "@typespec/openapi": "~0.60.0 || >=0.61.0-dev <0.61.0",
65
+ "@typespec/openapi3": "~0.60.0 || >=0.61.0-dev <0.61.0",
66
+ "@typespec/protobuf": "~0.60.0 || >=0.61.0-dev <0.61.0",
67
+ "@typespec/rest": "~0.60.0 || >=0.61.0-dev <0.61.0",
68
+ "@typespec/versioning": "~0.60.0 || >=0.61.0-dev <0.61.0",
75
69
  "clsx": "^2.1.1",
76
- "debounce": "~2.1.0",
70
+ "debounce": "~2.1.1",
77
71
  "lzutf8": "0.6.3",
78
72
  "monaco-editor": "~0.46.0",
79
73
  "react": "~18.3.1",
@@ -81,32 +75,32 @@
81
75
  "react-error-boundary": "^4.0.13",
82
76
  "swagger-ui-dist": "^5.17.14",
83
77
  "vscode-languageserver": "~9.0.1",
84
- "vscode-languageserver-textdocument": "~1.0.11"
78
+ "vscode-languageserver-textdocument": "~1.0.12"
85
79
  },
86
80
  "devDependencies": {
87
- "@babel/core": "^7.24.9",
88
- "@playwright/test": "^1.45.3",
89
- "@storybook/addon-actions": "^8.2.5",
90
- "@storybook/cli": "^8.2.5",
91
- "@storybook/react": "^8.2.5",
92
- "@storybook/react-vite": "^8.2.5",
93
- "@storybook/test": "^8.2.5",
94
- "@storybook/types": "^8.2.5",
81
+ "@babel/core": "^7.25.2",
82
+ "@playwright/test": "^1.47.0",
83
+ "@storybook/addon-actions": "^8.3.0",
84
+ "@storybook/cli": "^8.3.0",
85
+ "@storybook/react": "^8.3.0",
86
+ "@storybook/react-vite": "^8.3.0",
87
+ "@storybook/test": "^8.3.0",
88
+ "@storybook/types": "^8.3.0",
95
89
  "@types/debounce": "~1.2.4",
96
- "@types/node": "~18.11.19",
97
- "@types/react": "~18.3.3",
90
+ "@types/node": "~22.5.4",
91
+ "@types/react": "~18.3.5",
98
92
  "@types/react-dom": "~18.3.0",
99
93
  "@types/swagger-ui-dist": "~3.30.5",
100
- "@typespec/bundler": "~0.1.6 || >=0.2.0-dev <0.2.0",
94
+ "@typespec/bundler": "~0.1.7 || >=0.2.0-dev <0.2.0",
101
95
  "@vitejs/plugin-react": "~4.3.1",
102
96
  "c8": "^10.1.2",
103
97
  "cross-env": "~7.0.3",
104
98
  "es-module-shims": "~1.10.0",
105
99
  "rimraf": "~6.0.1",
106
- "typescript": "~5.5.4",
107
- "vite": "^5.3.4",
108
- "vite-plugin-checker": "^0.7.2",
109
- "vite-plugin-dts": "4.0.0-beta.1",
100
+ "typescript": "~5.6.2",
101
+ "vite": "^5.4.4",
102
+ "vite-plugin-checker": "^0.8.0",
103
+ "vite-plugin-dts": "4.2.1",
110
104
  "@typespec/react-components": "~0.57.0"
111
105
  },
112
106
  "peerDependencies": {},
@@ -1,6 +0,0 @@
1
- const manifest = {
2
- "version": "0.59.1",
3
- "commit": "1c2154cbda982179c5e5d4950003ae266c3baa47"
4
- };
5
-
6
- export { manifest as default };