@typespec/playground 0.1.0-alpha.0

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 (134) hide show
  1. package/README.md +64 -0
  2. package/dist/src/browser-host.d.ts +11 -0
  3. package/dist/src/browser-host.d.ts.map +1 -0
  4. package/dist/src/browser-host.js +129 -0
  5. package/dist/src/browser-host.js.map +1 -0
  6. package/dist/src/core.d.ts +7 -0
  7. package/dist/src/core.d.ts.map +1 -0
  8. package/dist/src/core.js +17 -0
  9. package/dist/src/core.js.map +1 -0
  10. package/dist/src/index.d.ts +7 -0
  11. package/dist/src/index.d.ts.map +1 -0
  12. package/dist/src/index.js +6 -0
  13. package/dist/src/index.js.map +1 -0
  14. package/dist/src/manifest.d.ts +3 -0
  15. package/dist/src/manifest.d.ts.map +1 -0
  16. package/dist/src/manifest.js +5 -0
  17. package/dist/src/manifest.js.map +1 -0
  18. package/dist/src/monaco-worker.d.ts +2 -0
  19. package/dist/src/monaco-worker.d.ts.map +1 -0
  20. package/dist/src/monaco-worker.js +18 -0
  21. package/dist/src/monaco-worker.js.map +1 -0
  22. package/dist/src/react/diagnostic-list.d.ts +11 -0
  23. package/dist/src/react/diagnostic-list.d.ts.map +1 -0
  24. package/dist/src/react/diagnostic-list.js +16 -0
  25. package/dist/src/react/diagnostic-list.js.map +1 -0
  26. package/dist/src/react/editor-command-bar.d.ts +19 -0
  27. package/dist/src/react/editor-command-bar.d.ts.map +1 -0
  28. package/dist/src/react/editor-command-bar.js +15 -0
  29. package/dist/src/react/editor-command-bar.js.map +1 -0
  30. package/dist/src/react/editor.d.ts +14 -0
  31. package/dist/src/react/editor.d.ts.map +1 -0
  32. package/dist/src/react/editor.js +37 -0
  33. package/dist/src/react/editor.js.map +1 -0
  34. package/dist/src/react/emitter-dropdown.d.ts +8 -0
  35. package/dist/src/react/emitter-dropdown.d.ts.map +1 -0
  36. package/dist/src/react/emitter-dropdown.js +13 -0
  37. package/dist/src/react/emitter-dropdown.js.map +1 -0
  38. package/dist/src/react/error-tab.d.ts +12 -0
  39. package/dist/src/react/error-tab.d.ts.map +1 -0
  40. package/dist/src/react/error-tab.js +20 -0
  41. package/dist/src/react/error-tab.js.map +1 -0
  42. package/dist/src/react/file-output.d.ts +12 -0
  43. package/dist/src/react/file-output.d.ts.map +1 -0
  44. package/dist/src/react/file-output.js +31 -0
  45. package/dist/src/react/file-output.js.map +1 -0
  46. package/dist/src/react/footer.d.ts +3 -0
  47. package/dist/src/react/footer.d.ts.map +1 -0
  48. package/dist/src/react/footer.js +29 -0
  49. package/dist/src/react/footer.js.map +1 -0
  50. package/dist/src/react/hooks.d.ts +15 -0
  51. package/dist/src/react/hooks.d.ts.map +1 -0
  52. package/dist/src/react/hooks.js +50 -0
  53. package/dist/src/react/hooks.js.map +1 -0
  54. package/dist/src/react/index.d.ts +4 -0
  55. package/dist/src/react/index.d.ts.map +1 -0
  56. package/dist/src/react/index.js +4 -0
  57. package/dist/src/react/index.js.map +1 -0
  58. package/dist/src/react/output-tabs.d.ts +19 -0
  59. package/dist/src/react/output-tabs.d.ts.map +1 -0
  60. package/dist/src/react/output-tabs.js +38 -0
  61. package/dist/src/react/output-tabs.js.map +1 -0
  62. package/dist/src/react/output-view.d.ts +9 -0
  63. package/dist/src/react/output-view.d.ts.map +1 -0
  64. package/dist/src/react/output-view.js +99 -0
  65. package/dist/src/react/output-view.js.map +1 -0
  66. package/dist/src/react/playground.d.ts +56 -0
  67. package/dist/src/react/playground.d.ts.map +1 -0
  68. package/dist/src/react/playground.js +186 -0
  69. package/dist/src/react/playground.js.map +1 -0
  70. package/dist/src/react/samples-dropdown.d.ts +9 -0
  71. package/dist/src/react/samples-dropdown.d.ts.map +1 -0
  72. package/dist/src/react/samples-dropdown.js +15 -0
  73. package/dist/src/react/samples-dropdown.js.map +1 -0
  74. package/dist/src/react/settings/compiler-settings.d.ts +11 -0
  75. package/dist/src/react/settings/compiler-settings.d.ts.map +1 -0
  76. package/dist/src/react/settings/compiler-settings.js +42 -0
  77. package/dist/src/react/settings/compiler-settings.js.map +1 -0
  78. package/dist/src/react/settings/emitter-options-form.d.ts +10 -0
  79. package/dist/src/react/settings/emitter-options-form.d.ts.map +1 -0
  80. package/dist/src/react/settings/emitter-options-form.js +39 -0
  81. package/dist/src/react/settings/emitter-options-form.js.map +1 -0
  82. package/dist/src/react/settings/linter-form.d.ts +10 -0
  83. package/dist/src/react/settings/linter-form.d.ts.map +1 -0
  84. package/dist/src/react/settings/linter-form.js +33 -0
  85. package/dist/src/react/settings/linter-form.js.map +1 -0
  86. package/dist/src/react/standalone.d.ts +9 -0
  87. package/dist/src/react/standalone.d.ts.map +1 -0
  88. package/dist/src/react/standalone.js +63 -0
  89. package/dist/src/react/standalone.js.map +1 -0
  90. package/dist/src/react/swagger-ui.d.ts +6 -0
  91. package/dist/src/react/swagger-ui.d.ts.map +1 -0
  92. package/dist/src/react/swagger-ui.js +19 -0
  93. package/dist/src/react/swagger-ui.js.map +1 -0
  94. package/dist/src/react/types.d.ts +26 -0
  95. package/dist/src/react/types.d.ts.map +1 -0
  96. package/dist/src/react/types.js +2 -0
  97. package/dist/src/react/types.js.map +1 -0
  98. package/dist/src/react/typespec-editor.d.ts +12 -0
  99. package/dist/src/react/typespec-editor.d.ts.map +1 -0
  100. package/dist/src/react/typespec-editor.js +30 -0
  101. package/dist/src/react/typespec-editor.js.map +1 -0
  102. package/dist/src/react/viewers.d.ts +3 -0
  103. package/dist/src/react/viewers.d.ts.map +1 -0
  104. package/dist/src/react/viewers.js +8 -0
  105. package/dist/src/react/viewers.js.map +1 -0
  106. package/dist/src/services.d.ts +6 -0
  107. package/dist/src/services.d.ts.map +1 -0
  108. package/dist/src/services.js +323 -0
  109. package/dist/src/services.js.map +1 -0
  110. package/dist/src/state-storage.d.ts +21 -0
  111. package/dist/src/state-storage.d.ts.map +1 -0
  112. package/dist/src/state-storage.js +81 -0
  113. package/dist/src/state-storage.js.map +1 -0
  114. package/dist/src/types.d.ts +11 -0
  115. package/dist/src/types.d.ts.map +1 -0
  116. package/dist/src/types.js +2 -0
  117. package/dist/src/types.js.map +1 -0
  118. package/dist/src/utils.d.ts +8 -0
  119. package/dist/src/utils.d.ts.map +1 -0
  120. package/dist/src/utils.js +14 -0
  121. package/dist/src/utils.js.map +1 -0
  122. package/dist/src/vite/index.d.ts +4 -0
  123. package/dist/src/vite/index.d.ts.map +1 -0
  124. package/dist/src/vite/index.js +92 -0
  125. package/dist/src/vite/index.js.map +1 -0
  126. package/dist/src/vite/types.d.ts +15 -0
  127. package/dist/src/vite/types.d.ts.map +1 -0
  128. package/dist/src/vite/types.js +2 -0
  129. package/dist/src/vite/types.js.map +1 -0
  130. package/dist/vite.config.d.ts +3 -0
  131. package/dist/vite.config.d.ts.map +1 -0
  132. package/dist/vite.config.js +38 -0
  133. package/dist/vite.config.js.map +1 -0
  134. package/package.json +96 -0
@@ -0,0 +1,11 @@
1
+ import { CompilerOptions } from "@typespec/compiler";
2
+ import { FunctionComponent } from "react";
3
+ import { PlaygroundTspLibrary } from "../types.js";
4
+ export type CompilerSettingsProps = {
5
+ libraries: PlaygroundTspLibrary[];
6
+ selectedEmitter: string;
7
+ options: CompilerOptions;
8
+ onOptionsChanged: (options: CompilerOptions) => void;
9
+ };
10
+ export declare const CompilerSettings: FunctionComponent<CompilerSettingsProps>;
11
+ //# sourceMappingURL=compiler-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-settings.d.ts","sourceRoot":"","sources":["../../../../src/react/settings/compiler-settings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkC,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAkB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,CA8CrE,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import { EmitterOptionsForm } from "./emitter-options-form.js";
4
+ import { LinterForm } from "./linter-form.js";
5
+ export const CompilerSettings = ({ selectedEmitter, libraries, options, onOptionsChanged, }) => {
6
+ var _a, _b;
7
+ const emitterOptionsChanged = useCallback((emitterOptions) => {
8
+ onOptionsChanged({
9
+ ...options,
10
+ options: emitterOptions,
11
+ });
12
+ }, [options]);
13
+ const library = useTypeSpecLibrary(selectedEmitter);
14
+ const linterRuleSet = (_a = options.linterRuleSet) !== null && _a !== void 0 ? _a : {};
15
+ const linterRuleSetChanged = useCallback((linterRuleSet) => {
16
+ onOptionsChanged({
17
+ ...options,
18
+ linterRuleSet,
19
+ });
20
+ }, [options]);
21
+ return (_jsxs("div", { css: { padding: 10 }, children: [_jsx("h2", { children: "Settings" }), _jsxs(_Fragment, { children: ["Emitter: ", selectedEmitter] }), _jsx("h3", { children: "Options" }), library && (_jsx(EmitterOptionsForm, { library: library, options: (_b = options.options) !== null && _b !== void 0 ? _b : {}, optionsChanged: emitterOptionsChanged })), _jsx("h3", { children: "Linter" }), _jsx(LinterForm, { libraries: libraries, linterRuleSet: linterRuleSet, onLinterRuleSetChanged: linterRuleSetChanged })] }));
22
+ };
23
+ function useTypeSpecLibrary(name) {
24
+ const [lib, setLib] = useState();
25
+ useEffect(() => {
26
+ setLib(undefined);
27
+ import(/* @vite-ignore */ name)
28
+ .then((module) => {
29
+ if (module.$lib === undefined) {
30
+ // eslint-disable-next-line no-console
31
+ console.error(`Couldn't load library ${name} missing $lib export`);
32
+ }
33
+ setLib(module.$lib);
34
+ })
35
+ .catch((e) => {
36
+ // eslint-disable-next-line no-console
37
+ console.error("Failed to load library", name);
38
+ });
39
+ }, [name]);
40
+ return lib;
41
+ }
42
+ //# sourceMappingURL=compiler-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-settings.js","sourceRoot":"","sources":["../../../../src/react/settings/compiler-settings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAqB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAS9C,MAAM,CAAC,MAAM,gBAAgB,GAA6C,CAAC,EACzE,eAAe,EACf,SAAS,EACT,OAAO,EACP,gBAAgB,GACjB,EAAE,EAAE;;IACH,MAAM,qBAAqB,GAAG,WAAW,CACvC,CAAC,cAA8B,EAAE,EAAE;QACjC,gBAAgB,CAAC;YACf,GAAG,OAAO;YACV,OAAO,EAAE,cAAc;SACxB,CAAC,CAAC;IACL,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IACF,MAAM,OAAO,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACpD,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,CAAC;IAClD,MAAM,oBAAoB,GAAG,WAAW,CACtC,CAAC,aAA4B,EAAE,EAAE;QAC/B,gBAAgB,CAAC;YACf,GAAG,OAAO;YACV,aAAa;SACd,CAAC,CAAC;IACL,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IACF,OAAO,CACL,eAAK,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,aACvB,oCAAiB,EACjB,2CAAY,eAAe,IAAI,EAC/B,mCAAgB,EACf,OAAO,IAAI,CACV,KAAC,kBAAkB,IACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAC9B,cAAc,EAAE,qBAAqB,GACrC,CACH,EACD,kCAAe,EACf,KAAC,UAAU,IACT,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,sBAAsB,EAAE,oBAAoB,GAC5C,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,kBAAkB,CAAC,IAAY;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,EAAwB,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,SAAS,CAAC,CAAC;QAClB,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC;aAC5B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;gBAC7B,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,yBAAyB,IAAI,sBAAsB,CAAC,CAAC;aACpE;YACD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { TypeSpecLibrary } from "@typespec/compiler";
2
+ import { FunctionComponent } from "react";
3
+ import { EmitterOptions } from "../types.js";
4
+ export interface EmitterOptionsFormProps {
5
+ library: TypeSpecLibrary<any>;
6
+ options: EmitterOptions;
7
+ optionsChanged: (options: EmitterOptions) => void;
8
+ }
9
+ export declare const EmitterOptionsForm: FunctionComponent<EmitterOptionsFormProps>;
10
+ //# sourceMappingURL=emitter-options-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter-options-form.d.ts","sourceRoot":"","sources":["../../../../src/react/settings/emitter-options-form.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,EAAE,cAAc,CAAC;IACxB,cAAc,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACnD;AACD,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,CAuCzE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Input, Label, Radio, RadioGroup, Switch, useId, } from "@fluentui/react-components";
3
+ import { useCallback, useMemo } from "react";
4
+ export const EmitterOptionsForm = ({ library, options, optionsChanged, }) => {
5
+ var _a, _b;
6
+ const emitterOptionsSchema = (_b = (_a = library.emitter) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.properties;
7
+ if (emitterOptionsSchema === undefined) {
8
+ return _jsx(_Fragment, { children: "\"No options\"" });
9
+ }
10
+ const entries = Object.entries(emitterOptionsSchema);
11
+ const handleChange = useCallback(({ name, value }) => {
12
+ optionsChanged({
13
+ ...options,
14
+ [library.name]: {
15
+ ...options[library.name],
16
+ [name]: value,
17
+ },
18
+ });
19
+ }, [options, optionsChanged]);
20
+ return (_jsx("div", { children: entries.map(([key, value]) => {
21
+ var _a;
22
+ return (_jsx("div", { css: { margin: "16px 0" }, children: _jsx(JsonSchemaPropertyInput, { emitterOptions: (_a = options[library.name]) !== null && _a !== void 0 ? _a : {}, name: key, prop: value, onChange: handleChange }) }, key));
23
+ }) }));
24
+ };
25
+ const JsonSchemaPropertyInput = ({ emitterOptions, name, prop, onChange, }) => {
26
+ var _a;
27
+ const prettyName = useMemo(() => name[0].toUpperCase() + name.slice(1).replace(/-/g, " "), [name]);
28
+ const inputId = useId("input");
29
+ const value = (_a = emitterOptions[name]) !== null && _a !== void 0 ? _a : prop.default;
30
+ const handleChange = useCallback((_, data) => onChange({ name, value: "value" in data ? data.value : data.checked }), [onChange]);
31
+ switch (prop.type) {
32
+ case "boolean":
33
+ return _jsx(Switch, { label: prettyName, checked: value, onChange: handleChange });
34
+ case "string":
35
+ default:
36
+ return (_jsxs("div", { children: [_jsx("div", { children: _jsx(Label, { htmlFor: inputId, title: name, children: prettyName }) }), _jsx("div", { children: prop.enum ? (_jsx(RadioGroup, { layout: "horizontal", id: inputId, value: value, onChange: handleChange, children: prop.enum.map((x) => (_jsx(Radio, { value: x, label: x }, x))) })) : (_jsx(Input, { id: inputId, value: value, onChange: handleChange })) })] }));
37
+ }
38
+ };
39
+ //# sourceMappingURL=emitter-options-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter-options-form.js","sourceRoot":"","sources":["../../../../src/react/settings/emitter-options-form.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import { LinterRuleSet } from "@typespec/compiler";
2
+ import { FunctionComponent } from "react";
3
+ import { PlaygroundTspLibrary } from "../types.js";
4
+ export interface LinterFormProps {
5
+ libraries: PlaygroundTspLibrary[];
6
+ linterRuleSet: LinterRuleSet;
7
+ onLinterRuleSetChanged: (options: LinterRuleSet) => void;
8
+ }
9
+ export declare const LinterForm: FunctionComponent<LinterFormProps>;
10
+ //# sourceMappingURL=linter-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linter-form.d.ts","sourceRoot":"","sources":["../../../../src/react/settings/linter-form.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAe,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,sBAAsB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;CAC1D;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAuCzD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { Checkbox } from "@fluentui/react-components";
3
+ import { useCallback } from "react";
4
+ export const LinterForm = ({ libraries, linterRuleSet, onLinterRuleSetChanged, }) => {
5
+ const rulesets = libraries.flatMap((lib) => {
6
+ var _a, _b, _c;
7
+ return Object.keys((_c = (_b = (_a = lib.definition) === null || _a === void 0 ? void 0 : _a.linter) === null || _b === void 0 ? void 0 : _b.ruleSets) !== null && _c !== void 0 ? _c : {}).map((x) => `${lib.name}/${x}`);
8
+ });
9
+ if (rulesets.length === 0) {
10
+ return _jsx(_Fragment, { children: "No ruleset available" });
11
+ }
12
+ const handleChange = (ruleSet, checked) => {
13
+ var _a;
14
+ const ruleSets = (_a = linterRuleSet.extends) !== null && _a !== void 0 ? _a : [];
15
+ const updatedRuleSets = checked
16
+ ? [...ruleSets, ruleSet]
17
+ : ruleSets.filter((x) => x !== ruleSet);
18
+ onLinterRuleSetChanged({
19
+ extends: updatedRuleSets,
20
+ });
21
+ };
22
+ return (_jsx(_Fragment, { children: rulesets.map((ruleSet) => {
23
+ var _a;
24
+ return (_jsx(RuleSetCheckbox, { ruleSet: ruleSet, checked: (_a = linterRuleSet.extends) === null || _a === void 0 ? void 0 : _a.includes(ruleSet), onChange: handleChange }, ruleSet));
25
+ }) }));
26
+ };
27
+ const RuleSetCheckbox = ({ ruleSet, checked, onChange }) => {
28
+ const handleChange = useCallback((_, data) => {
29
+ onChange(ruleSet, !!data.checked);
30
+ }, [ruleSet, checked, onChange]);
31
+ return _jsx(Checkbox, { label: ruleSet, checked: checked, onChange: handleChange });
32
+ };
33
+ //# sourceMappingURL=linter-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linter-form.js","sourceRoot":"","sources":["../../../../src/react/settings/linter-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAqB,WAAW,EAAE,MAAM,OAAO,CAAC;AASvD,MAAM,CAAC,MAAM,UAAU,GAAuC,CAAC,EAC7D,SAAS,EACT,aAAa,EACb,sBAAsB,GACvB,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;QACzC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAA,MAAA,MAAA,GAAG,CAAC,UAAU,0CAAE,MAAM,0CAAE,QAAQ,mCAAI,EAAE,CAAC,CAAC,GAAG,CAC5D,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,EAAE,CACb,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,qDAAyB,CAAC;KAClC;IAED,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,OAAgB,EAAE,EAAE;;QAC1D,MAAM,QAAQ,GAAG,MAAA,aAAa,CAAC,OAAO,mCAAI,EAAE,CAAC;QAE7C,MAAM,eAAe,GAAG,OAAO;YAC7B,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC;YACxB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QAE1C,sBAAsB,CAAC;YACrB,OAAO,EAAE,eAAe;SACzB,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CACL,4BACG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;;YACxB,OAAO,CACL,KAAC,eAAe,IAEd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,0CAAE,QAAQ,CAAC,OAAO,CAAC,EACjD,QAAQ,EAAE,YAAY,IAHjB,OAAO,CAIZ,CACH,CAAC;QACJ,CAAC,CAAC,GACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAOF,MAAM,eAAe,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAmB,EAAE,EAAE;IAC1E,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,CAAM,EAAE,IAA0B,EAAE,EAAE;QACrC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAC7B,CAAC;IACF,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAI,CAAC;AAChF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { StateStorage } from "../state-storage.js";
2
+ import { PlaygroundProps, PlaygroundSaveData } from "./playground.js";
3
+ export interface ReactPlaygroundConfig extends Partial<PlaygroundProps> {
4
+ libraries: string[];
5
+ }
6
+ export declare function createReactPlayground(config: ReactPlaygroundConfig): Promise<import("@emotion/react/jsx-runtime").JSX.Element>;
7
+ export declare function renderReactPlayground(config: ReactPlaygroundConfig): Promise<void>;
8
+ export declare function createStandalonePlaygroundStateStorage(): StateStorage<PlaygroundSaveData>;
9
+ //# sourceMappingURL=standalone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/react/standalone.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAyB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAc,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAElF,MAAM,WAAW,qBAAsB,SAAQ,OAAO,CAAC,eAAe,CAAC;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,6DAgCxE;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,iBAKxE;AAED,wBAAgB,sCAAsC,IAAI,YAAY,CAAC,kBAAkB,CAAC,CA0BzF"}
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { FluentProvider, webLightTheme } from "@fluentui/react-components";
3
+ import { createRoot } from "react-dom/client";
4
+ import { createBrowserHost } from "../browser-host.js";
5
+ import { registerMonacoDefaultWorkers } from "../monaco-worker.js";
6
+ import { registerMonacoLanguage } from "../services.js";
7
+ import { createUrlStateStorage } from "../state-storage.js";
8
+ import { Playground } from "./playground.js";
9
+ export async function createReactPlayground(config) {
10
+ var _a;
11
+ const host = await createBrowserHost(config.libraries);
12
+ await registerMonacoLanguage(host);
13
+ registerMonacoDefaultWorkers();
14
+ const stateStorage = createStandalonePlaygroundStateStorage();
15
+ const initialState = stateStorage.load();
16
+ const options = {
17
+ ...config,
18
+ host,
19
+ libraries: config.libraries,
20
+ defaultContent: initialState.content,
21
+ defaultEmitter: (_a = initialState.emitter) !== null && _a !== void 0 ? _a : config.defaultEmitter,
22
+ defaultCompilerOptions: initialState.options,
23
+ defaultSampleName: initialState.sampleName,
24
+ onSave: (value) => {
25
+ stateStorage.save(value);
26
+ void navigator.clipboard.writeText(window.location.toString());
27
+ },
28
+ };
29
+ const App = () => {
30
+ return (_jsx(FluentProvider, { theme: webLightTheme, children: _jsx("div", { css: { height: "100vh" }, children: _jsx(Playground, { ...options }) }) }));
31
+ };
32
+ return _jsx(App, {});
33
+ }
34
+ export async function renderReactPlayground(config) {
35
+ const app = await createReactPlayground(config);
36
+ const root = createRoot(document.getElementById("root"));
37
+ root.render(app);
38
+ }
39
+ export function createStandalonePlaygroundStateStorage() {
40
+ const stateStorage = createUrlStateStorage({
41
+ content: {
42
+ queryParam: "c",
43
+ compress: "lz-base64",
44
+ },
45
+ emitter: {
46
+ queryParam: "e",
47
+ },
48
+ options: {
49
+ type: "object",
50
+ queryParam: "options",
51
+ },
52
+ sampleName: {
53
+ queryParam: "sample",
54
+ },
55
+ });
56
+ return {
57
+ load: stateStorage.load,
58
+ save(data) {
59
+ stateStorage.save(data.sampleName ? { sampleName: data.sampleName, options: data.options } : data);
60
+ },
61
+ };
62
+ }
63
+ //# sourceMappingURL=standalone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../src/react/standalone.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAgB,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAuC,MAAM,iBAAiB,CAAC;AAMlF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAA6B;;IACvE,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACnC,4BAA4B,EAAE,CAAC;IAE/B,MAAM,YAAY,GAAG,sCAAsC,EAAE,CAAC;IAC9D,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,OAAO,GAAoB;QAC/B,GAAG,MAAM;QACT,IAAI;QACJ,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,cAAc,EAAE,YAAY,CAAC,OAAO;QACpC,cAAc,EAAE,MAAA,YAAY,CAAC,OAAO,mCAAI,MAAM,CAAC,cAAc;QAC7D,sBAAsB,EAAE,YAAY,CAAC,OAAO;QAC5C,iBAAiB,EAAE,YAAY,CAAC,UAAU;QAC1C,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,KAAK,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC;KACF,CAAC;IAEF,MAAM,GAAG,GAAsB,GAAG,EAAE;QAClC,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,aAAa,YAClC,cAAK,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC3B,KAAC,UAAU,OAAK,OAAO,GAAI,GACvB,GACS,CAClB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,KAAC,GAAG,KAAG,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAA6B;IACvE,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,sCAAsC;IACpD,MAAM,YAAY,GAAG,qBAAqB,CAAqB;QAC7D,OAAO,EAAE;YACP,UAAU,EAAE,GAAG;YACf,QAAQ,EAAE,WAAW;SACtB;QACD,OAAO,EAAE;YACP,UAAU,EAAE,GAAG;SAChB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,SAAS;SACtB;QACD,UAAU,EAAE;YACV,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,IAAI,CAAC,IAAwB;YAC3B,YAAY,CAAC,IAAI,CACf,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAChF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { FunctionComponent } from "react";
2
+ export interface SwaggerUIProps {
3
+ spec: string;
4
+ }
5
+ export declare const SwaggerUI: FunctionComponent<SwaggerUIProps>;
6
+ //# sourceMappingURL=swagger-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger-ui.d.ts","sourceRoot":"","sources":["../../../src/react/swagger-ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAwBvD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ export const SwaggerUI = (props) => {
4
+ const [swaggerUI, setSwaggerUILib] = useState(undefined);
5
+ useEffect(() => {
6
+ void import("swagger-ui-react").then((lib) => {
7
+ setSwaggerUILib({ swaggerUIComp: lib.default });
8
+ });
9
+ }, [setSwaggerUILib]);
10
+ if (swaggerUI === undefined) {
11
+ return null;
12
+ }
13
+ return (_jsx("div", { css: {
14
+ width: "100%",
15
+ height: "100%",
16
+ overflow: "auto",
17
+ }, children: _jsx(swaggerUI.swaggerUIComp, { spec: props.spec }) }));
18
+ };
19
+ //# sourceMappingURL=swagger-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger-ui.js","sourceRoot":"","sources":["../../../src/react/swagger-ui.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM/D,MAAM,CAAC,MAAM,SAAS,GAAsC,CAAC,KAAK,EAAE,EAAE;IACpE,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,QAAQ,CAE3C,SAAS,CAAC,CAAC;IACb,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3C,eAAe,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,OAAc,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,cACE,GAAG,EAAE;YACH,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,MAAM;SACjB,YAED,KAAC,SAAS,CAAC,aAAa,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI,GACzC,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Program, TypeSpecLibrary } from "@typespec/compiler";
2
+ import { ReactElement } from "react";
3
+ export type CompilationCrashed = {
4
+ readonly internalCompilerError: any;
5
+ };
6
+ export type CompileResult = {
7
+ readonly program: Program;
8
+ readonly outputFiles: string[];
9
+ };
10
+ export type CompilationState = CompileResult | CompilationCrashed;
11
+ export type EmitterOptions = Record<string, Record<string, unknown>>;
12
+ export interface FileOutputViewer {
13
+ key: string;
14
+ label: string;
15
+ render: (props: ViewerProps) => ReactElement<any, any> | null;
16
+ }
17
+ export interface ViewerProps {
18
+ filename: string;
19
+ content: string;
20
+ }
21
+ export interface PlaygroundTspLibrary {
22
+ name: string;
23
+ isEmitter: boolean;
24
+ definition?: TypeSpecLibrary<any>;
25
+ }
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { editor } from "monaco-editor";
2
+ import { FunctionComponent } from "react";
3
+ export interface TypeSpecEditorProps {
4
+ model: editor.IModel;
5
+ actions?: editor.IActionDescriptor[];
6
+ }
7
+ export declare const TypeSpecEditor: FunctionComponent<TypeSpecEditorProps>;
8
+ export declare const OutputEditor: FunctionComponent<{
9
+ filename: string;
10
+ value: string;
11
+ }>;
12
+ //# sourceMappingURL=typespec-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typespec-editor.d.ts","sourceRoot":"","sources":["../../../src/react/typespec-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CAWjE,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiB/E,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { Editor, useMonacoModel } from "./editor.js";
3
+ export const TypeSpecEditor = (props) => {
4
+ const options = {
5
+ "semanticHighlighting.enabled": true,
6
+ automaticLayout: true,
7
+ tabSize: 2,
8
+ minimap: {
9
+ enabled: false,
10
+ },
11
+ };
12
+ // Add shortcuts
13
+ return _jsx(Editor, { model: props.model, actions: props.actions, options: options });
14
+ };
15
+ export const OutputEditor = ({ filename, value, }) => {
16
+ if (filename === "") {
17
+ return null;
18
+ }
19
+ const options = {
20
+ readOnly: true,
21
+ automaticLayout: true,
22
+ minimap: {
23
+ enabled: false,
24
+ },
25
+ };
26
+ const model = useMonacoModel(filename);
27
+ model.setValue(value);
28
+ return _jsx(Editor, { model: model, options: options });
29
+ };
30
+ //# sourceMappingURL=typespec-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typespec-editor.js","sourceRoot":"","sources":["../../../src/react/typespec-editor.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOrD,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,KAAK,EAAE,EAAE;IAC9E,MAAM,OAAO,GAAgD;QAC3D,8BAA8B,EAAE,IAAI;QACpC,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;SACf;KACF,CAAC;IACF,gBAAgB;IAChB,OAAO,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAW,CAAC;AACzF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAA2D,CAAC,EACnF,QAAQ,EACR,KAAK,GACN,EAAE,EAAE;IACH,IAAI,QAAQ,KAAK,EAAE,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,OAAO,GAAgD;QAC3D,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;SACf;KACF,CAAC;IACF,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAW,CAAC;AAC3D,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FileOutputViewer } from "./types.js";
2
+ export declare const SwaggerUIViewer: FileOutputViewer;
3
+ //# sourceMappingURL=viewers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewers.d.ts","sourceRoot":"","sources":["../../../src/react/viewers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,eAAe,EAAE,gBAI7B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { SwaggerUI } from "./swagger-ui.js";
3
+ export const SwaggerUIViewer = {
4
+ key: "swaggerUI",
5
+ label: "Swagger UI",
6
+ render: ({ content }) => _jsx(SwaggerUI, { spec: content }),
7
+ };
8
+ //# sourceMappingURL=viewers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewers.js","sourceRoot":"","sources":["../../../src/react/viewers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,CAAC,EAAE,OAAO,EAAe,EAAE,EAAE,CAAC,KAAC,SAAS,IAAC,IAAI,EAAE,OAAO,GAAI;CACnE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { DiagnosticTarget, NoTarget } from "@typespec/compiler";
2
+ import { editor } from "monaco-editor";
3
+ import { BrowserHost } from "./browser-host.js";
4
+ export declare function registerMonacoLanguage(host: BrowserHost): Promise<void>;
5
+ export declare function getMarkerLocation(typespecCompiler: typeof import("@typespec/compiler"), target: DiagnosticTarget | typeof NoTarget): Pick<editor.IMarkerData, "startLineNumber" | "startColumn" | "endLineNumber" | "endColumn">;
6
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,QAAQ,EAGT,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAoChD,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,iBAiT7D;AAED,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,cAAc,oBAAoB,CAAC,EACrD,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,GACzC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,GAAG,aAAa,GAAG,eAAe,GAAG,WAAW,CAAC,CAkB7F"}