@typespec/playground 0.11.1 → 0.11.3

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createBrowserHost, r as registerMonacoLanguage } from './services-DIQbQBoU.js';
1
+ export { c as createBrowserHost, r as registerMonacoLanguage } from './services-BTSPLy3C.js';
2
2
  export { createUrlStateStorage } from './state-storage.js';
3
3
 
4
4
  function registerMonacoDefaultWorkersForVite() {
@@ -7,7 +7,7 @@ import { $ } from '@typespec/compiler/typekit';
7
7
  import { Settings24Regular, Save16Regular, Broom16Filled, Bug16Regular, FolderListRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
8
8
  import debounce from 'debounce';
9
9
  import { CompletionItemTag } from 'vscode-languageserver';
10
- import { a as resolveVirtualPath, p as printDebugInfo, d as debugGlobals, g as getMonacoRange, c as createBrowserHost, r as registerMonacoLanguage } from '../services-DIQbQBoU.js';
10
+ import { a as resolveVirtualPath, p as printDebugInfo, d as debugGlobals, g as getMonacoRange, c as createBrowserHost, r as registerMonacoLanguage } from '../services-BTSPLy3C.js';
11
11
  import { ErrorBoundary } from 'react-error-boundary';
12
12
  import { TypeGraph } from '@typespec/html-program-viewer/react';
13
13
  import '@typespec/html-program-viewer/style.css';
@@ -1,7 +1,7 @@
1
1
  import { resolvePath, getSourceFileKindFromExt, createSourceFile, TypeSpecLanguageConfiguration } from '@typespec/compiler';
2
2
  import * as monaco from 'monaco-editor';
3
3
  import * as lsp from 'vscode-languageserver';
4
- import { DiagnosticSeverity, FormattingOptions, DocumentHighlightKind } from 'vscode-languageserver';
4
+ import { DiagnosticSeverity, Range, FormattingOptions, DocumentHighlightKind } from 'vscode-languageserver';
5
5
  import { TextDocument } from 'vscode-languageserver-textdocument';
6
6
 
7
7
  function printDebugInfo() {
@@ -196,7 +196,7 @@ async function createBrowserHost(libsToLoad, importOptions = {}) {
196
196
  });
197
197
  }
198
198
 
199
- function range(range2) {
199
+ function range$1(range2) {
200
200
  return {
201
201
  startColumn: range2.start.character + 1,
202
202
  startLineNumber: range2.start.line + 1,
@@ -216,7 +216,7 @@ function textEdits(edit) {
216
216
  }
217
217
  function textEdit(edit) {
218
218
  return {
219
- range: range(edit.range),
219
+ range: range$1(edit.range),
220
220
  text: edit.newText
221
221
  };
222
222
  }
@@ -237,7 +237,7 @@ function command(command2) {
237
237
  arguments: command2.arguments
238
238
  };
239
239
  }
240
- function severity(severity2) {
240
+ function severity$1(severity2) {
241
241
  switch (severity2) {
242
242
  case DiagnosticSeverity.Error:
243
243
  return monaco.MarkerSeverity.Error;
@@ -251,7 +251,7 @@ function severity(severity2) {
251
251
  }
252
252
  function diagnostic(diagnostic2) {
253
253
  return {
254
- severity: diagnostic2.severity ? severity(diagnostic2.severity) : monaco.MarkerSeverity.Error,
254
+ severity: diagnostic2.severity ? severity$1(diagnostic2.severity) : monaco.MarkerSeverity.Error,
255
255
  message: diagnostic2.message,
256
256
  code: diagnostic2.code?.toString(),
257
257
  source: diagnostic2.source,
@@ -270,7 +270,7 @@ function codeAction(action) {
270
270
  };
271
271
  }
272
272
  const LspToMonaco = {
273
- range,
273
+ range: range$1,
274
274
  foldingRange,
275
275
  textEdits,
276
276
  textEdit,
@@ -279,6 +279,68 @@ const LspToMonaco = {
279
279
  command
280
280
  };
281
281
 
282
+ function textDocumentForModel(model) {
283
+ return TextDocument.create(
284
+ model.uri.toString(),
285
+ "typespec",
286
+ model.getVersionId(),
287
+ model.getValue()
288
+ );
289
+ }
290
+ function position(pos) {
291
+ return {
292
+ line: pos.lineNumber - 1,
293
+ character: pos.column - 1
294
+ };
295
+ }
296
+ function range(range2) {
297
+ return Range.create(
298
+ {
299
+ line: range2.startLineNumber - 1,
300
+ character: range2.startColumn - 1
301
+ },
302
+ {
303
+ line: range2.endLineNumber - 1,
304
+ character: range2.endColumn - 1
305
+ }
306
+ );
307
+ }
308
+ function severity(severity2) {
309
+ switch (severity2) {
310
+ case monaco.MarkerSeverity.Error:
311
+ return DiagnosticSeverity.Error;
312
+ case monaco.MarkerSeverity.Warning:
313
+ return DiagnosticSeverity.Warning;
314
+ case monaco.MarkerSeverity.Hint:
315
+ return DiagnosticSeverity.Hint;
316
+ case monaco.MarkerSeverity.Info:
317
+ return DiagnosticSeverity.Information;
318
+ }
319
+ }
320
+ function markerToDiagnostic(marker) {
321
+ return {
322
+ severity: marker.severity ? severity(marker.severity) : DiagnosticSeverity.Error,
323
+ range: range(marker),
324
+ message: marker.message,
325
+ code: typeof marker.code === "string" ? marker.code : marker.code?.value,
326
+ source: marker.source,
327
+ data: marker.relatedInformation
328
+ };
329
+ }
330
+ function codeActionContext(context) {
331
+ return {
332
+ only: context.only ? [context.only] : void 0,
333
+ triggerKind: context.trigger,
334
+ diagnostics: context.markers.map(markerToDiagnostic)
335
+ };
336
+ }
337
+ const MonacoToLsp = {
338
+ textDocumentForModel,
339
+ position,
340
+ range,
341
+ codeActionContext
342
+ };
343
+
282
344
  function getIndentAction(value) {
283
345
  switch (value) {
284
346
  case "none":
@@ -318,7 +380,7 @@ async function registerMonacoLanguage(host) {
318
380
  compilerHost: host,
319
381
  getOpenDocumentByURL(url) {
320
382
  const model = monaco.editor.getModel(monaco.Uri.parse(url));
321
- return model ? textDocumentForModel(model) : void 0;
383
+ return model ? MonacoToLsp.textDocumentForModel(model) : void 0;
322
384
  },
323
385
  sendDiagnostics() {
324
386
  },
@@ -351,17 +413,20 @@ async function registerMonacoLanguage(host) {
351
413
  rootUri: "inmemory://"
352
414
  });
353
415
  serverLib.initialized({});
354
- function textDocumentForModel(model) {
355
- return TextDocument.create(
356
- model.uri.toString(),
357
- "typespec",
358
- model.getVersionId(),
359
- model.getValue()
360
- );
416
+ monaco.editor.onDidCreateModel((model) => {
417
+ if (model.getLanguageId() !== "typespec") return;
418
+ model.onDidChangeContent(async (changes) => {
419
+ serverLib.checkChange(monacoToLspChangeEvent(model));
420
+ });
421
+ });
422
+ function monacoToLspChangeEvent(model) {
423
+ return {
424
+ document: MonacoToLsp.textDocumentForModel(model)
425
+ };
361
426
  }
362
427
  function lspDocumentArgs(model) {
363
428
  return {
364
- textDocument: textDocumentForModel(model)
429
+ textDocument: MonacoToLsp.textDocumentForModel(model)
365
430
  };
366
431
  }
367
432
  function lspArgs(model, pos) {
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmC9C,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,iBAgU7D;AAED,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,cAAc,oBAAoB,CAAC,EACrD,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,GACzC,MAAM,CAAC,MAAM,CAkBf"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAMxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmC9C,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,iBAsU7D;AAED,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,cAAc,oBAAoB,CAAC,EACrD,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,GACzC,MAAM,CAAC,MAAM,CAkBf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/playground",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec playground UI components.",
6
6
  "homepage": "https://typespec.io",
@@ -59,50 +59,50 @@
59
59
  "!dist/test/**"
60
60
  ],
61
61
  "dependencies": {
62
- "@fluentui/react-components": "~9.70.0",
62
+ "@fluentui/react-components": "~9.72.3",
63
63
  "@fluentui/react-icons": "^2.0.292",
64
64
  "clsx": "^2.1.1",
65
- "debounce": "~2.2.0",
65
+ "debounce": "~3.0.0",
66
66
  "lzutf8": "0.6.3",
67
- "monaco-editor": "~0.53.0",
67
+ "monaco-editor": "~0.55.0",
68
68
  "react": "~18.3.1",
69
69
  "react-dom": "~18.3.1",
70
70
  "react-error-boundary": "^6.0.0",
71
71
  "swagger-ui-dist": "^5.20.1",
72
72
  "vscode-languageserver": "~9.0.1",
73
73
  "vscode-languageserver-textdocument": "~1.0.12",
74
- "@typespec/bundler": "^0.4.4",
75
- "@typespec/html-program-viewer": "^0.75.0",
76
- "@typespec/compiler": "^1.5.0",
77
- "@typespec/http": "^1.5.0",
78
- "@typespec/openapi": "^1.5.0",
79
- "@typespec/openapi3": "^1.5.0",
80
- "@typespec/protobuf": "^0.75.0",
81
- "@typespec/rest": "^0.75.0",
82
- "@typespec/versioning": "^0.75.0"
74
+ "@typespec/bundler": "^0.4.6",
75
+ "@typespec/compiler": "^1.7.0",
76
+ "@typespec/http": "^1.7.0",
77
+ "@typespec/openapi": "^1.7.0",
78
+ "@typespec/html-program-viewer": "^0.77.0",
79
+ "@typespec/openapi3": "^1.7.0",
80
+ "@typespec/protobuf": "^0.77.0",
81
+ "@typespec/rest": "^0.77.0",
82
+ "@typespec/versioning": "^0.77.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@babel/core": "^7.26.10",
86
86
  "@playwright/test": "^1.51.1",
87
- "@storybook/cli": "^9.0.12",
88
- "@storybook/react-vite": "^9.0.12",
87
+ "@storybook/cli": "^10.0.8",
88
+ "@storybook/react-vite": "^10.0.8",
89
89
  "@types/debounce": "~1.2.4",
90
- "@types/node": "~24.3.0",
91
- "@types/react": "~18.3.11",
92
- "@types/react-dom": "~18.3.0",
90
+ "@types/node": "~24.10.1",
91
+ "@types/react": "~19.2.2",
92
+ "@types/react-dom": "~19.2.2",
93
93
  "@types/swagger-ui-dist": "~3.30.5",
94
- "@vitejs/plugin-react": "~5.0.2",
94
+ "@vitejs/plugin-react": "~5.1.0",
95
95
  "c8": "^10.1.3",
96
- "cross-env": "~10.0.0",
96
+ "cross-env": "~10.1.0",
97
97
  "es-module-shims": "~2.6.0",
98
- "rimraf": "~6.0.1",
99
- "storybook": "^9.0.12",
98
+ "rimraf": "~6.1.2",
99
+ "storybook": "^10.0.8",
100
100
  "typescript": "~5.9.2",
101
101
  "vite": "^7.0.5",
102
- "vite-plugin-checker": "^0.10.1",
102
+ "vite-plugin-checker": "^0.11.0",
103
103
  "vite-plugin-dts": "4.5.4",
104
- "@typespec/react-components": "^0.57.0",
105
- "@typespec/bundler": "^0.4.4"
104
+ "@typespec/bundler": "^0.4.6",
105
+ "@typespec/react-components": "^0.57.0"
106
106
  },
107
107
  "scripts": {
108
108
  "clean": "rimraf ./dist ./dist-dev ./temp ./typespecContents.json",