@typespec/playground 0.3.0 → 0.4.0-dev.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.
- package/dist/react/index.js +18 -9
- package/dist/src/react/output-view/output-view.d.ts.map +1 -1
- package/dist/style.css +10 -6
- package/package.json +15 -13
package/dist/react/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createContext, useContext, memo, useCallback, useMemo, useRef, useEffect, useState, useId as useId$1 } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { mergeClasses, Popover, PopoverTrigger, PopoverSurface, Title3, Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell, Select, useId, Label, RadioGroup, Radio, Input, Switch, Checkbox, Divider, Dialog, DialogTrigger, ToolbarButton, DialogSurface, DialogBody, DialogTitle, DialogContent, Toolbar, Tooltip, Link, TabList, Tab, tokens, useToastController, Toast, ToastTitle, ToastBody, Toaster, FluentProvider, webLightTheme } from '@fluentui/react-components';
|
|
3
|
+
import { mergeClasses, Popover, PopoverTrigger, PopoverSurface, Title3, Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell, Select, useId, Label, RadioGroup, Radio, Input, Switch, Checkbox, Divider, Dialog, DialogTrigger, ToolbarButton, DialogSurface, DialogBody, DialogTitle, DialogContent, Toolbar, Tooltip, Link, TabList, Tab, tokens, Button, useToastController, Toast, ToastTitle, ToastBody, Toaster, FluentProvider, webLightTheme } from '@fluentui/react-components';
|
|
4
4
|
import debounce from 'debounce';
|
|
5
5
|
import { Uri, editor, MarkerSeverity, KeyMod, KeyCode } from 'monaco-editor';
|
|
6
6
|
import { CompletionItemTag } from 'vscode-languageserver';
|
|
7
7
|
import { Settings24Regular, Save16Regular, Broom16Filled, Bug16Regular, FolderListRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
|
|
8
8
|
import { g as getMonacoRange, a as createUrlStateStorage, c as createBrowserHost, r as registerMonacoLanguage } from '../state-storage-BjOULkS3.js';
|
|
9
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
9
10
|
import { ColorProvider, TypeSpecProgramViewer } from '@typespec/html-program-viewer';
|
|
10
11
|
import { getSourceLocation } from '@typespec/compiler';
|
|
11
12
|
import { createRoot } from 'react-dom/client';
|
|
@@ -608,12 +609,13 @@ const OutputTabs = ({
|
|
|
608
609
|
};
|
|
609
610
|
|
|
610
611
|
const style$5 = {
|
|
611
|
-
"output-view": "_output-
|
|
612
|
-
"file-viewer": "_file-
|
|
613
|
-
"output-content": "_output-
|
|
614
|
-
"file-viewer-content": "_file-viewer-
|
|
615
|
-
"type-graph-viewer": "_type-graph-
|
|
616
|
-
"viewer-tabs-container": "_viewer-tabs-
|
|
612
|
+
"output-view": "_output-view_omce4_1",
|
|
613
|
+
"file-viewer": "_file-viewer_omce4_6",
|
|
614
|
+
"output-content": "_output-content_omce4_12",
|
|
615
|
+
"file-viewer-content": "_file-viewer-content_omce4_16",
|
|
616
|
+
"type-graph-viewer": "_type-graph-viewer_omce4_21",
|
|
617
|
+
"viewer-tabs-container": "_viewer-tabs-container_omce4_26",
|
|
618
|
+
"viewer-error": "_viewer-error_omce4_30"
|
|
617
619
|
};
|
|
618
620
|
|
|
619
621
|
const FileViewerComponent = ({
|
|
@@ -730,13 +732,13 @@ const OutputViewInternal = ({ compilationResult, viewers, editorOptions }) => {
|
|
|
730
732
|
return viewers.programViewers[selected];
|
|
731
733
|
}, [viewers.programViewers, selected]);
|
|
732
734
|
return /* @__PURE__ */ jsxs("div", { className: style$5["output-view"], children: [
|
|
733
|
-
/* @__PURE__ */ jsx("div", { className: style$5["output-content"], children: /* @__PURE__ */ jsx(
|
|
735
|
+
/* @__PURE__ */ jsx("div", { className: style$5["output-content"], children: /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender, children: /* @__PURE__ */ jsx(
|
|
734
736
|
viewer.render,
|
|
735
737
|
{
|
|
736
738
|
program: compilationResult.program,
|
|
737
739
|
outputFiles: compilationResult.outputFiles
|
|
738
740
|
}
|
|
739
|
-
) }),
|
|
741
|
+
) }) }),
|
|
740
742
|
/* @__PURE__ */ jsx("div", { className: style$5["viewer-tabs-container"], children: /* @__PURE__ */ jsx(
|
|
741
743
|
TabList,
|
|
742
744
|
{
|
|
@@ -752,6 +754,13 @@ const OutputViewInternal = ({ compilationResult, viewers, editorOptions }) => {
|
|
|
752
754
|
) })
|
|
753
755
|
] });
|
|
754
756
|
};
|
|
757
|
+
function fallbackRender({ error, resetErrorBoundary }) {
|
|
758
|
+
return /* @__PURE__ */ jsxs("div", { role: "alert", className: style$5["viewer-error"], children: [
|
|
759
|
+
/* @__PURE__ */ jsx("h2", { children: "Something went wrong:" }),
|
|
760
|
+
/* @__PURE__ */ jsx("div", { style: { color: "red" }, children: error.toString() }),
|
|
761
|
+
/* @__PURE__ */ jsx(Button, { onClick: resetErrorBoundary, children: "Try again" })
|
|
762
|
+
] });
|
|
763
|
+
}
|
|
755
764
|
|
|
756
765
|
const layout = "_layout_l03ni_1";
|
|
757
766
|
const style$4 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-view.d.ts","sourceRoot":"","sources":["../../../../src/react/output-view/output-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"output-view.d.ts","sourceRoot":"","sources":["../../../../src/react/output-view/output-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAiB,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMpG,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC/C,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAoBzD,CAAC"}
|
package/dist/style.css
CHANGED
|
@@ -80,34 +80,38 @@
|
|
|
80
80
|
._tab--selected_1x6x2_18 {
|
|
81
81
|
background-color: var(--colorNeutralBackground5) !important;
|
|
82
82
|
}
|
|
83
|
-
._output-
|
|
83
|
+
._output-view_omce4_1 {
|
|
84
84
|
display: flex;
|
|
85
85
|
flex-direction: row;
|
|
86
86
|
height: 100%;
|
|
87
87
|
}
|
|
88
|
-
._file-
|
|
88
|
+
._file-viewer_omce4_6 {
|
|
89
89
|
display: flex;
|
|
90
90
|
flex-direction: column;
|
|
91
91
|
height: 100%;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
._output-
|
|
94
|
+
._output-content_omce4_12 {
|
|
95
95
|
flex: 1;
|
|
96
96
|
min-width: 0;
|
|
97
97
|
}
|
|
98
|
-
._file-viewer-
|
|
98
|
+
._file-viewer-content_omce4_16 {
|
|
99
99
|
flex: 1;
|
|
100
100
|
min-height: 0;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
._type-graph-
|
|
103
|
+
._type-graph-viewer_omce4_21 {
|
|
104
104
|
height: 100%;
|
|
105
105
|
overflow-y: auto;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
._viewer-tabs-
|
|
108
|
+
._viewer-tabs-container_omce4_26 {
|
|
109
109
|
background-color: var(--colorNeutralBackground3);
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
._viewer-error_omce4_30 {
|
|
113
|
+
padding: 20px;
|
|
114
|
+
}
|
|
111
115
|
._layout_l03ni_1 {
|
|
112
116
|
display: flex;
|
|
113
117
|
flex-direction: column;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/playground",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-dev.1",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec playground UI components.",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -57,24 +57,25 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@fluentui/react-components": "~9.52.0",
|
|
59
59
|
"@fluentui/react-icons": "^2.0.240",
|
|
60
|
+
"@typespec/bundler": "~0.1.4 || >=0.2.0-dev <0.2.0",
|
|
61
|
+
"@typespec/compiler": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
62
|
+
"@typespec/html-program-viewer": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
63
|
+
"@typespec/http": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
64
|
+
"@typespec/openapi": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
65
|
+
"@typespec/openapi3": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
66
|
+
"@typespec/protobuf": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
67
|
+
"@typespec/rest": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
68
|
+
"@typespec/versioning": "~0.57.0 || >=0.58.0-dev <0.58.0",
|
|
60
69
|
"clsx": "^2.1.1",
|
|
61
70
|
"debounce": "~2.0.0",
|
|
62
71
|
"lzutf8": "0.6.3",
|
|
63
72
|
"monaco-editor": "~0.46.0",
|
|
64
73
|
"react": "~18.3.1",
|
|
65
74
|
"react-dom": "~18.3.1",
|
|
75
|
+
"react-error-boundary": "^4.0.13",
|
|
66
76
|
"swagger-ui-dist": "^5.17.10",
|
|
67
77
|
"vscode-languageserver": "~9.0.1",
|
|
68
|
-
"vscode-languageserver-textdocument": "~1.0.11"
|
|
69
|
-
"@typespec/bundler": "~0.1.4",
|
|
70
|
-
"@typespec/compiler": "~0.57.0",
|
|
71
|
-
"@typespec/html-program-viewer": "~0.57.0",
|
|
72
|
-
"@typespec/http": "~0.57.0",
|
|
73
|
-
"@typespec/openapi": "~0.57.0",
|
|
74
|
-
"@typespec/protobuf": "~0.57.0",
|
|
75
|
-
"@typespec/openapi3": "~0.57.0",
|
|
76
|
-
"@typespec/rest": "~0.57.0",
|
|
77
|
-
"@typespec/versioning": "~0.57.0"
|
|
78
|
+
"vscode-languageserver-textdocument": "~1.0.11"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@babel/core": "^7.24.5",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"@types/react": "~18.3.2",
|
|
91
92
|
"@types/react-dom": "~18.3.0",
|
|
92
93
|
"@types/swagger-ui-dist": "~3.30.4",
|
|
94
|
+
"@typespec/bundler": "~0.1.4 || >=0.2.0-dev <0.2.0",
|
|
93
95
|
"@vitejs/plugin-react": "~4.2.1",
|
|
94
96
|
"c8": "^9.1.0",
|
|
95
97
|
"cross-env": "~7.0.3",
|
|
@@ -98,9 +100,9 @@
|
|
|
98
100
|
"typescript": "~5.4.5",
|
|
99
101
|
"vite": "^5.2.11",
|
|
100
102
|
"vite-plugin-checker": "^0.6.4",
|
|
101
|
-
"vite-plugin-dts": "^3.9.1"
|
|
102
|
-
"@typespec/bundler": "~0.1.4"
|
|
103
|
+
"vite-plugin-dts": "^3.9.1"
|
|
103
104
|
},
|
|
105
|
+
"peerDependencies": {},
|
|
104
106
|
"scripts": {
|
|
105
107
|
"clean": "rimraf ./dist ./dist-dev ./temp ./typespecContents.json",
|
|
106
108
|
"build": "vite build",
|