@typespec/playground 0.9.0-dev.3 → 0.9.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.
- package/dist/.storybook/preview.d.ts +1 -1
- package/dist/.storybook/preview.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +256 -85
- package/dist/{services-CXtSSQdQ.js → services-BOARIFqT.js} +1 -1
- package/dist/src/react/editor.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -0
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/output-view/output-view.d.ts +16 -0
- package/dist/src/react/output-view/output-view.d.ts.map +1 -1
- package/dist/src/react/output-view/type-graph-viewer.d.ts.map +1 -1
- package/dist/src/react/playground.d.ts +60 -25
- package/dist/src/react/playground.d.ts.map +1 -1
- package/dist/src/react/standalone.d.ts.map +1 -1
- package/dist/src/react/types.d.ts +4 -0
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/src/react/use-playground-state.d.ts +53 -0
- package/dist/src/react/use-playground-state.d.ts.map +1 -0
- package/dist/stories/footer/footer-item.stories.d.ts +1 -1
- package/dist/stories/footer/footer-item.stories.d.ts.map +1 -1
- package/dist/stories/footer/footer-version-item.stories.d.ts +1 -1
- package/dist/stories/footer/footer-version-item.stories.d.ts.map +1 -1
- package/dist/stories/footer/footer.stories.d.ts +1 -1
- package/dist/stories/footer/footer.stories.d.ts.map +1 -1
- package/dist/stories/playground.stories.d.ts +1 -1
- package/dist/stories/playground.stories.d.ts.map +1 -1
- package/package.json +22 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../.storybook/preview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../.storybook/preview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,QAAA,MAAM,OAAO,EAAE,OAUd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as createBrowserHost, r as registerMonacoLanguage } from './services-
|
|
1
|
+
export { c as createBrowserHost, r as registerMonacoLanguage } from './services-BOARIFqT.js';
|
|
2
2
|
export { createUrlStateStorage } from './state-storage.js';
|
|
3
3
|
|
|
4
4
|
function registerMonacoDefaultWorkersForVite() {
|
package/dist/react/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { mergeClasses, Popover, PopoverTrigger, PopoverSurface, Title3, Table, T
|
|
|
5
5
|
import { Settings24Regular, Save16Regular, Broom16Filled, Bug16Regular, FolderListRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
|
|
6
6
|
import debounce from 'debounce';
|
|
7
7
|
import { CompletionItemTag } from 'vscode-languageserver';
|
|
8
|
-
import { a as resolveVirtualPath, g as getMonacoRange, c as createBrowserHost, r as registerMonacoLanguage } from '../services-
|
|
8
|
+
import { a as resolveVirtualPath, g as getMonacoRange, c as createBrowserHost, r as registerMonacoLanguage } from '../services-BOARIFqT.js';
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { TypeGraph } from '@typespec/html-program-viewer/react';
|
|
11
11
|
import '@typespec/html-program-viewer/style.css';
|
|
@@ -30,6 +30,7 @@ const Editor = ({ model, options, actions, onMount }) => {
|
|
|
30
30
|
editorRef.current = editor.create(editorContainerRef.current, {
|
|
31
31
|
model,
|
|
32
32
|
automaticLayout: true,
|
|
33
|
+
fixedOverflowWidgets: true,
|
|
33
34
|
...options
|
|
34
35
|
});
|
|
35
36
|
onMount?.({ editor: editorRef.current });
|
|
@@ -2392,8 +2393,29 @@ function createFileViewer(fileViewers) {
|
|
|
2392
2393
|
};
|
|
2393
2394
|
}
|
|
2394
2395
|
|
|
2395
|
-
const TypeGraphViewerComponent = ({
|
|
2396
|
-
|
|
2396
|
+
const TypeGraphViewerComponent = ({
|
|
2397
|
+
program,
|
|
2398
|
+
viewerState,
|
|
2399
|
+
onViewerStateChange
|
|
2400
|
+
}) => {
|
|
2401
|
+
const currentPath = viewerState?.["type-graph:path"] || "";
|
|
2402
|
+
const handleNavigationChange = useCallback(
|
|
2403
|
+
(path) => {
|
|
2404
|
+
onViewerStateChange?.({
|
|
2405
|
+
...viewerState,
|
|
2406
|
+
"type-graph:path": path
|
|
2407
|
+
});
|
|
2408
|
+
},
|
|
2409
|
+
[viewerState, onViewerStateChange]
|
|
2410
|
+
);
|
|
2411
|
+
return /* @__PURE__ */ jsx("div", { className: style$4["type-graph-viewer"], children: /* @__PURE__ */ jsx(
|
|
2412
|
+
TypeGraph,
|
|
2413
|
+
{
|
|
2414
|
+
program,
|
|
2415
|
+
currentPath,
|
|
2416
|
+
onNavigationChange: handleNavigationChange
|
|
2417
|
+
}
|
|
2418
|
+
) });
|
|
2397
2419
|
};
|
|
2398
2420
|
const TypeGraphViewer = {
|
|
2399
2421
|
key: "type-graph",
|
|
@@ -2406,7 +2428,10 @@ const OutputView = ({
|
|
|
2406
2428
|
compilationState,
|
|
2407
2429
|
viewers,
|
|
2408
2430
|
fileViewers,
|
|
2409
|
-
|
|
2431
|
+
selectedViewer,
|
|
2432
|
+
onViewerChange,
|
|
2433
|
+
viewerState,
|
|
2434
|
+
onViewerStateChange
|
|
2410
2435
|
}) => {
|
|
2411
2436
|
const resolvedViewers = useMemo(
|
|
2412
2437
|
() => resolveViewers(viewers, fileViewers),
|
|
@@ -2423,7 +2448,10 @@ const OutputView = ({
|
|
|
2423
2448
|
{
|
|
2424
2449
|
compilationResult: compilationState,
|
|
2425
2450
|
viewers: resolvedViewers,
|
|
2426
|
-
|
|
2451
|
+
selectedViewer,
|
|
2452
|
+
onViewerChange,
|
|
2453
|
+
viewerState,
|
|
2454
|
+
onViewerStateChange
|
|
2427
2455
|
}
|
|
2428
2456
|
);
|
|
2429
2457
|
};
|
|
@@ -2440,12 +2468,24 @@ function resolveViewers(viewers, fileViewers) {
|
|
|
2440
2468
|
}
|
|
2441
2469
|
return output;
|
|
2442
2470
|
}
|
|
2443
|
-
const OutputViewInternal = ({
|
|
2471
|
+
const OutputViewInternal = ({
|
|
2472
|
+
compilationResult,
|
|
2473
|
+
viewers,
|
|
2474
|
+
selectedViewer,
|
|
2475
|
+
onViewerChange,
|
|
2476
|
+
viewerState,
|
|
2477
|
+
onViewerStateChange
|
|
2478
|
+
}) => {
|
|
2444
2479
|
const viewerList = Object.values(viewers.programViewers);
|
|
2445
|
-
const [
|
|
2480
|
+
const [internalSelected, setInternalSelected] = useState(viewerList[0].key);
|
|
2481
|
+
const selected = selectedViewer ?? internalSelected;
|
|
2446
2482
|
const onTabSelect = useCallback(
|
|
2447
|
-
(_, data) =>
|
|
2448
|
-
|
|
2483
|
+
(_, data) => {
|
|
2484
|
+
const newSelection = data.value;
|
|
2485
|
+
setInternalSelected(newSelection);
|
|
2486
|
+
onViewerChange?.(newSelection);
|
|
2487
|
+
},
|
|
2488
|
+
[onViewerChange]
|
|
2449
2489
|
);
|
|
2450
2490
|
const viewer = useMemo(() => {
|
|
2451
2491
|
return viewers.programViewers[selected];
|
|
@@ -2455,7 +2495,9 @@ const OutputViewInternal = ({ compilationResult, viewers, editorOptions }) => {
|
|
|
2455
2495
|
viewer.render,
|
|
2456
2496
|
{
|
|
2457
2497
|
program: compilationResult.program,
|
|
2458
|
-
outputFiles: compilationResult.outputFiles
|
|
2498
|
+
outputFiles: compilationResult.outputFiles,
|
|
2499
|
+
viewerState,
|
|
2500
|
+
onViewerStateChange
|
|
2459
2501
|
}
|
|
2460
2502
|
) }) }),
|
|
2461
2503
|
/* @__PURE__ */ jsx("div", { className: style$4["viewer-tabs-container"], children: /* @__PURE__ */ jsx(
|
|
@@ -2669,41 +2711,159 @@ const ProblemPaneContent = ({
|
|
|
2669
2711
|
return diagnostics.length === 0 ? /* @__PURE__ */ jsx("div", { className: style["no-problems"], children: " No problems" }) : /* @__PURE__ */ jsx(DiagnosticList, { diagnostics, onDiagnosticSelected });
|
|
2670
2712
|
};
|
|
2671
2713
|
|
|
2714
|
+
function usePlaygroundState({
|
|
2715
|
+
libraries,
|
|
2716
|
+
samples,
|
|
2717
|
+
playgroundState: controlledPlaygroundState,
|
|
2718
|
+
defaultPlaygroundState,
|
|
2719
|
+
onPlaygroundStateChange,
|
|
2720
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2721
|
+
defaultEmitter,
|
|
2722
|
+
defaultContent
|
|
2723
|
+
}) {
|
|
2724
|
+
const effectiveDefaultState = useMemo(() => {
|
|
2725
|
+
const baseDefault = defaultPlaygroundState ?? {};
|
|
2726
|
+
if (!baseDefault.emitter) {
|
|
2727
|
+
if (defaultEmitter) {
|
|
2728
|
+
return { ...baseDefault, emitter: defaultEmitter, content: defaultContent };
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
return { ...baseDefault, content: baseDefault.content ?? defaultContent };
|
|
2732
|
+
}, [defaultPlaygroundState, defaultEmitter, libraries, defaultContent]);
|
|
2733
|
+
const [playgroundState, setPlaygroundState] = useControllableValue(
|
|
2734
|
+
controlledPlaygroundState,
|
|
2735
|
+
effectiveDefaultState,
|
|
2736
|
+
onPlaygroundStateChange
|
|
2737
|
+
);
|
|
2738
|
+
const selectedEmitter = playgroundState.emitter;
|
|
2739
|
+
const compilerOptions = useMemo(
|
|
2740
|
+
() => playgroundState.compilerOptions ?? {},
|
|
2741
|
+
[playgroundState.compilerOptions]
|
|
2742
|
+
);
|
|
2743
|
+
const selectedSampleName = playgroundState.sampleName ?? "";
|
|
2744
|
+
const selectedViewer = playgroundState.selectedViewer;
|
|
2745
|
+
const content = playgroundState.content ?? "";
|
|
2746
|
+
const updateState = useCallback(
|
|
2747
|
+
(updates) => {
|
|
2748
|
+
setPlaygroundState({ ...playgroundState, ...updates });
|
|
2749
|
+
},
|
|
2750
|
+
[playgroundState, setPlaygroundState]
|
|
2751
|
+
);
|
|
2752
|
+
const onSelectedEmitterChange = useCallback(
|
|
2753
|
+
(emitter) => updateState({ emitter }),
|
|
2754
|
+
[updateState]
|
|
2755
|
+
);
|
|
2756
|
+
const onCompilerOptionsChange = useCallback(
|
|
2757
|
+
(compilerOptions2) => updateState({ compilerOptions: compilerOptions2 }),
|
|
2758
|
+
[updateState]
|
|
2759
|
+
);
|
|
2760
|
+
const onSelectedSampleNameChange = useCallback(
|
|
2761
|
+
(sampleName) => updateState({ sampleName }),
|
|
2762
|
+
[updateState]
|
|
2763
|
+
);
|
|
2764
|
+
const onSelectedViewerChange = useCallback(
|
|
2765
|
+
(selectedViewer2) => updateState({ selectedViewer: selectedViewer2 }),
|
|
2766
|
+
[updateState]
|
|
2767
|
+
);
|
|
2768
|
+
const onViewerStateChange = useCallback(
|
|
2769
|
+
(viewerState) => updateState({ viewerState }),
|
|
2770
|
+
[updateState]
|
|
2771
|
+
);
|
|
2772
|
+
const onContentChange = useCallback((content2) => updateState({ content: content2 }), [updateState]);
|
|
2773
|
+
const lastProcessedSample = useRef("");
|
|
2774
|
+
useEffect(() => {
|
|
2775
|
+
if (selectedSampleName && samples && selectedSampleName !== lastProcessedSample.current) {
|
|
2776
|
+
const config = samples[selectedSampleName];
|
|
2777
|
+
if (config?.content) {
|
|
2778
|
+
lastProcessedSample.current = selectedSampleName;
|
|
2779
|
+
const updates = { content: config.content };
|
|
2780
|
+
if (config.preferredEmitter) {
|
|
2781
|
+
updates.emitter = config.preferredEmitter;
|
|
2782
|
+
}
|
|
2783
|
+
if (config.compilerOptions) {
|
|
2784
|
+
updates.compilerOptions = config.compilerOptions;
|
|
2785
|
+
}
|
|
2786
|
+
updateState(updates);
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
}, [selectedSampleName, samples, updateState]);
|
|
2790
|
+
return {
|
|
2791
|
+
// State values
|
|
2792
|
+
selectedEmitter,
|
|
2793
|
+
compilerOptions,
|
|
2794
|
+
selectedSampleName,
|
|
2795
|
+
selectedViewer,
|
|
2796
|
+
viewerState: playgroundState.viewerState ?? {},
|
|
2797
|
+
content,
|
|
2798
|
+
// State setters
|
|
2799
|
+
onSelectedEmitterChange,
|
|
2800
|
+
onCompilerOptionsChange,
|
|
2801
|
+
onSelectedSampleNameChange,
|
|
2802
|
+
onSelectedViewerChange,
|
|
2803
|
+
onViewerStateChange,
|
|
2804
|
+
onContentChange,
|
|
2805
|
+
// Full state management
|
|
2806
|
+
playgroundState,
|
|
2807
|
+
setPlaygroundState
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2672
2811
|
const Playground = (props) => {
|
|
2673
2812
|
const { host, onSave } = props;
|
|
2674
2813
|
const editorRef = useRef(void 0);
|
|
2675
2814
|
useEffect(() => {
|
|
2676
2815
|
editor.setTheme(props.editorOptions?.theme ?? "typespec");
|
|
2677
2816
|
}, [props.editorOptions?.theme]);
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
props.
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
props.
|
|
2685
|
-
props.
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2817
|
+
const typespecModel = useMonacoModel("inmemory://test/main.tsp", "typespec");
|
|
2818
|
+
const [compilationState, setCompilationState] = useState(void 0);
|
|
2819
|
+
const state = usePlaygroundState({
|
|
2820
|
+
libraries: props.libraries,
|
|
2821
|
+
samples: props.samples,
|
|
2822
|
+
playgroundState: props.playgroundState,
|
|
2823
|
+
defaultPlaygroundState: props.defaultPlaygroundState,
|
|
2824
|
+
onPlaygroundStateChange: props.onPlaygroundStateChange,
|
|
2825
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2826
|
+
defaultEmitter: props.defaultEmitter,
|
|
2827
|
+
defaultContent: props.defaultContent
|
|
2828
|
+
});
|
|
2829
|
+
const {
|
|
2830
|
+
selectedEmitter,
|
|
2831
|
+
compilerOptions,
|
|
2832
|
+
selectedSampleName,
|
|
2833
|
+
selectedViewer,
|
|
2834
|
+
viewerState,
|
|
2835
|
+
content,
|
|
2836
|
+
onSelectedEmitterChange,
|
|
2837
|
+
onCompilerOptionsChange,
|
|
2838
|
+
onSelectedSampleNameChange,
|
|
2839
|
+
onSelectedViewerChange,
|
|
2840
|
+
onViewerStateChange,
|
|
2841
|
+
onContentChange
|
|
2842
|
+
} = state;
|
|
2843
|
+
useEffect(() => {
|
|
2844
|
+
if (typespecModel.getValue() !== (content ?? "")) {
|
|
2845
|
+
typespecModel.setValue(content ?? "");
|
|
2846
|
+
}
|
|
2847
|
+
}, [content, typespecModel]);
|
|
2848
|
+
useEffect(() => {
|
|
2849
|
+
const disposable = typespecModel.onDidChangeContent(() => {
|
|
2850
|
+
const newContent = typespecModel.getValue();
|
|
2851
|
+
if (newContent !== content) {
|
|
2852
|
+
onContentChange(newContent);
|
|
2853
|
+
}
|
|
2854
|
+
});
|
|
2855
|
+
return () => disposable.dispose();
|
|
2856
|
+
}, [typespecModel, content, onContentChange]);
|
|
2694
2857
|
const isSampleUntouched = useMemo(() => {
|
|
2695
2858
|
return Boolean(selectedSampleName && content === props.samples?.[selectedSampleName]?.content);
|
|
2696
2859
|
}, [content, selectedSampleName, props.samples]);
|
|
2697
|
-
const typespecModel = useMonacoModel("inmemory://test/main.tsp", "typespec");
|
|
2698
|
-
const [compilationState, setCompilationState] = useState(void 0);
|
|
2699
2860
|
const doCompile = useCallback(async () => {
|
|
2700
|
-
const
|
|
2701
|
-
setContent(content2);
|
|
2861
|
+
const currentContent = typespecModel.getValue();
|
|
2702
2862
|
const typespecCompiler = host.compiler;
|
|
2703
|
-
const
|
|
2704
|
-
setCompilationState(
|
|
2705
|
-
if ("program" in
|
|
2706
|
-
const markers =
|
|
2863
|
+
const state2 = await compile(host, currentContent, selectedEmitter, compilerOptions);
|
|
2864
|
+
setCompilationState(state2);
|
|
2865
|
+
if ("program" in state2) {
|
|
2866
|
+
const markers = state2.program.diagnostics.map((diag) => ({
|
|
2707
2867
|
...getMonacoRange(typespecCompiler, diag.target),
|
|
2708
2868
|
message: diag.message,
|
|
2709
2869
|
severity: diag.severity === "error" ? MarkerSeverity.Error : MarkerSeverity.Warning,
|
|
@@ -2713,38 +2873,7 @@ const Playground = (props) => {
|
|
|
2713
2873
|
} else {
|
|
2714
2874
|
editor.setModelMarkers(typespecModel, "owner", []);
|
|
2715
2875
|
}
|
|
2716
|
-
}, [host, selectedEmitter, compilerOptions, typespecModel
|
|
2717
|
-
const updateTypeSpec = useCallback(
|
|
2718
|
-
(value) => {
|
|
2719
|
-
if (typespecModel.getValue() !== value) {
|
|
2720
|
-
typespecModel.setValue(value);
|
|
2721
|
-
}
|
|
2722
|
-
},
|
|
2723
|
-
[typespecModel]
|
|
2724
|
-
);
|
|
2725
|
-
useEffect(() => {
|
|
2726
|
-
updateTypeSpec(props.defaultContent ?? "");
|
|
2727
|
-
}, [props.defaultContent, updateTypeSpec]);
|
|
2728
|
-
useEffect(() => {
|
|
2729
|
-
if (selectedSampleName && props.samples) {
|
|
2730
|
-
const config = props.samples[selectedSampleName];
|
|
2731
|
-
if (config.content) {
|
|
2732
|
-
updateTypeSpec(config.content);
|
|
2733
|
-
if (config.preferredEmitter) {
|
|
2734
|
-
onSelectedEmitterChange(config.preferredEmitter);
|
|
2735
|
-
}
|
|
2736
|
-
if (config.compilerOptions) {
|
|
2737
|
-
onCompilerOptionsChange(config.compilerOptions);
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2741
|
-
}, [
|
|
2742
|
-
updateTypeSpec,
|
|
2743
|
-
selectedSampleName,
|
|
2744
|
-
props.samples,
|
|
2745
|
-
onSelectedEmitterChange,
|
|
2746
|
-
onCompilerOptionsChange
|
|
2747
|
-
]);
|
|
2876
|
+
}, [host, selectedEmitter, compilerOptions, typespecModel]);
|
|
2748
2877
|
useEffect(() => {
|
|
2749
2878
|
const debouncer = debounce(() => doCompile(), 200);
|
|
2750
2879
|
const disposable = typespecModel.onDidChangeContent(debouncer);
|
|
@@ -2759,19 +2888,23 @@ const Playground = (props) => {
|
|
|
2759
2888
|
const saveCode = useCallback(() => {
|
|
2760
2889
|
if (onSave) {
|
|
2761
2890
|
onSave({
|
|
2762
|
-
content:
|
|
2891
|
+
content: content ?? "",
|
|
2763
2892
|
emitter: selectedEmitter,
|
|
2764
|
-
|
|
2765
|
-
sampleName: isSampleUntouched ? selectedSampleName : void 0
|
|
2893
|
+
compilerOptions,
|
|
2894
|
+
sampleName: isSampleUntouched ? selectedSampleName : void 0,
|
|
2895
|
+
selectedViewer,
|
|
2896
|
+
viewerState
|
|
2766
2897
|
});
|
|
2767
2898
|
}
|
|
2768
2899
|
}, [
|
|
2769
|
-
|
|
2900
|
+
content,
|
|
2770
2901
|
onSave,
|
|
2771
2902
|
selectedEmitter,
|
|
2772
2903
|
compilerOptions,
|
|
2773
2904
|
selectedSampleName,
|
|
2774
|
-
isSampleUntouched
|
|
2905
|
+
isSampleUntouched,
|
|
2906
|
+
selectedViewer,
|
|
2907
|
+
viewerState
|
|
2775
2908
|
]);
|
|
2776
2909
|
const formatCode = useCallback(() => {
|
|
2777
2910
|
void editorRef.current?.getAction("editor.action.formatDocument")?.run();
|
|
@@ -2817,10 +2950,10 @@ const Playground = (props) => {
|
|
|
2817
2950
|
host,
|
|
2818
2951
|
setContent: (val) => {
|
|
2819
2952
|
typespecModel.setValue(val);
|
|
2820
|
-
|
|
2953
|
+
onContentChange(val);
|
|
2821
2954
|
}
|
|
2822
2955
|
};
|
|
2823
|
-
}, [host,
|
|
2956
|
+
}, [host, typespecModel, onContentChange]);
|
|
2824
2957
|
return /* @__PURE__ */ jsx(PlaygroundContextProvider, { value: playgroundContext, children: /* @__PURE__ */ jsxs("div", { className: style$3["layout"], children: [
|
|
2825
2958
|
/* @__PURE__ */ jsxs(SplitPane, { sizes: verticalPaneSizes, onChange: onVerticalPaneSizeChange, split: "horizontal", children: [
|
|
2826
2959
|
/* @__PURE__ */ jsx(Pane, { children: /* @__PURE__ */ jsxs(SplitPane, { initialSizes: ["50%", "50%"], children: [
|
|
@@ -2859,7 +2992,11 @@ const Playground = (props) => {
|
|
|
2859
2992
|
compilationState,
|
|
2860
2993
|
editorOptions: props.editorOptions,
|
|
2861
2994
|
viewers: props.viewers,
|
|
2862
|
-
fileViewers: props.emitterViewers?.[selectedEmitter]
|
|
2995
|
+
fileViewers: selectedEmitter ? props.emitterViewers?.[selectedEmitter] : void 0,
|
|
2996
|
+
selectedViewer,
|
|
2997
|
+
onViewerChange: onSelectedViewerChange,
|
|
2998
|
+
viewerState,
|
|
2999
|
+
onViewerStateChange
|
|
2863
3000
|
}
|
|
2864
3001
|
) })
|
|
2865
3002
|
] }) }),
|
|
@@ -2952,12 +3089,20 @@ const StandalonePlayground = (config) => {
|
|
|
2952
3089
|
const context = useStandalonePlaygroundContext(config);
|
|
2953
3090
|
const toasterId = useId$1();
|
|
2954
3091
|
const { dispatchToast } = useToastController(toasterId);
|
|
2955
|
-
const
|
|
3092
|
+
const [lastSavedData, setLastSavedData] = useState(null);
|
|
3093
|
+
const saveToStorage = useCallback(
|
|
2956
3094
|
(value) => {
|
|
2957
3095
|
if (!context) {
|
|
2958
3096
|
return;
|
|
2959
3097
|
}
|
|
2960
3098
|
context.stateStorage.save(value);
|
|
3099
|
+
setLastSavedData(value);
|
|
3100
|
+
},
|
|
3101
|
+
[context]
|
|
3102
|
+
);
|
|
3103
|
+
const onSave = useCallback(
|
|
3104
|
+
(value) => {
|
|
3105
|
+
saveToStorage(value);
|
|
2961
3106
|
void navigator.clipboard.writeText(window.location.toString());
|
|
2962
3107
|
dispatchToast(
|
|
2963
3108
|
/* @__PURE__ */ jsxs(Toast, { children: [
|
|
@@ -2967,18 +3112,36 @@ const StandalonePlayground = (config) => {
|
|
|
2967
3112
|
{ intent: "success" }
|
|
2968
3113
|
);
|
|
2969
3114
|
},
|
|
2970
|
-
[dispatchToast,
|
|
3115
|
+
[dispatchToast, saveToStorage]
|
|
3116
|
+
);
|
|
3117
|
+
const onPlaygroundStateChange = useCallback(
|
|
3118
|
+
(newState) => {
|
|
3119
|
+
const saveData = {
|
|
3120
|
+
content: lastSavedData?.content || "",
|
|
3121
|
+
emitter: newState.emitter || "",
|
|
3122
|
+
compilerOptions: newState.compilerOptions,
|
|
3123
|
+
sampleName: newState.sampleName,
|
|
3124
|
+
selectedViewer: newState.selectedViewer,
|
|
3125
|
+
viewerState: newState.viewerState
|
|
3126
|
+
};
|
|
3127
|
+
saveToStorage(saveData);
|
|
3128
|
+
},
|
|
3129
|
+
[lastSavedData?.content, saveToStorage]
|
|
2971
3130
|
);
|
|
2972
3131
|
const fixedOptions = useMemo(
|
|
2973
3132
|
() => context && {
|
|
2974
3133
|
host: context.host,
|
|
2975
3134
|
libraries: config.libraries,
|
|
2976
3135
|
defaultContent: context.initialState.content,
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
3136
|
+
defaultPlaygroundState: {
|
|
3137
|
+
emitter: context.initialState.emitter ?? config.defaultPlaygroundState?.emitter,
|
|
3138
|
+
compilerOptions: context.initialState.compilerOptions ?? config.defaultPlaygroundState?.compilerOptions,
|
|
3139
|
+
sampleName: context.initialState.sampleName ?? config.defaultPlaygroundState?.sampleName,
|
|
3140
|
+
selectedViewer: context.initialState.selectedViewer ?? config.defaultPlaygroundState?.selectedViewer,
|
|
3141
|
+
viewerState: context.initialState.viewerState ?? config.defaultPlaygroundState?.viewerState
|
|
3142
|
+
}
|
|
2980
3143
|
},
|
|
2981
|
-
[config.
|
|
3144
|
+
[config.defaultPlaygroundState, config.libraries, context]
|
|
2982
3145
|
);
|
|
2983
3146
|
if (context === void 0 || fixedOptions === void 0) {
|
|
2984
3147
|
return config.fallback;
|
|
@@ -2986,11 +3149,12 @@ const StandalonePlayground = (config) => {
|
|
|
2986
3149
|
const options = {
|
|
2987
3150
|
...config,
|
|
2988
3151
|
...fixedOptions,
|
|
2989
|
-
onSave
|
|
3152
|
+
onSave,
|
|
3153
|
+
onPlaygroundStateChange
|
|
2990
3154
|
};
|
|
2991
3155
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2992
3156
|
/* @__PURE__ */ jsx(Toaster, { toasterId }),
|
|
2993
|
-
|
|
3157
|
+
/* @__PURE__ */ jsx(Playground, { ...options })
|
|
2994
3158
|
] });
|
|
2995
3159
|
};
|
|
2996
3160
|
async function createReactPlayground(config) {
|
|
@@ -3012,12 +3176,19 @@ function createStandalonePlaygroundStateStorage() {
|
|
|
3012
3176
|
emitter: {
|
|
3013
3177
|
queryParam: "e"
|
|
3014
3178
|
},
|
|
3015
|
-
|
|
3179
|
+
compilerOptions: {
|
|
3016
3180
|
type: "object",
|
|
3017
3181
|
queryParam: "options"
|
|
3018
3182
|
},
|
|
3019
3183
|
sampleName: {
|
|
3020
3184
|
queryParam: "sample"
|
|
3185
|
+
},
|
|
3186
|
+
selectedViewer: {
|
|
3187
|
+
queryParam: "v"
|
|
3188
|
+
},
|
|
3189
|
+
viewerState: {
|
|
3190
|
+
type: "object",
|
|
3191
|
+
queryParam: "vs"
|
|
3021
3192
|
}
|
|
3022
3193
|
});
|
|
3023
3194
|
return {
|
|
@@ -3025,10 +3196,10 @@ function createStandalonePlaygroundStateStorage() {
|
|
|
3025
3196
|
resolveSearchParams: stateStorage.resolveSearchParams,
|
|
3026
3197
|
save(data) {
|
|
3027
3198
|
stateStorage.save(
|
|
3028
|
-
data.sampleName ? {
|
|
3199
|
+
data.sampleName ? { ...data, content: void 0, emitter: void 0, sampleName: data.sampleName } : data
|
|
3029
3200
|
);
|
|
3030
3201
|
}
|
|
3031
3202
|
};
|
|
3032
3203
|
}
|
|
3033
3204
|
|
|
3034
|
-
export { Editor, Footer, FooterItem, FooterVersionItem, Playground, StandalonePlayground, createReactPlayground, createStandalonePlaygroundStateStorage, renderReactPlayground, useMonacoModel, usePlaygroundContext };
|
|
3205
|
+
export { Editor, Footer, FooterItem, FooterVersionItem, Playground, StandalonePlayground, createReactPlayground, createStandalonePlaygroundStateStorage, renderReactPlayground, useMonacoModel, usePlaygroundContext, usePlaygroundState };
|
|
@@ -555,7 +555,7 @@ async function registerMonacoLanguage(host) {
|
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
557
|
function getMonacoRange(typespecCompiler, target) {
|
|
558
|
-
const loc = typespecCompiler.getSourceLocation(target);
|
|
558
|
+
const loc = typespecCompiler.getSourceLocation(target, { locateId: true });
|
|
559
559
|
if (loc === void 0 || loc.file.path !== "/test/main.tsp") {
|
|
560
560
|
return {
|
|
561
561
|
startLineNumber: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/react/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAoB,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC,oCAAoC,CAAC;IACrD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,qBAAqB,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/react/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAoB,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC,oCAAoC,CAAC;IACrD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,qBAAqB,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAwCjD,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAK5E"}
|
|
@@ -5,4 +5,5 @@ export { Playground } from './playground.js';
|
|
|
5
5
|
export type { PlaygroundProps, PlaygroundSaveData } from './playground.js';
|
|
6
6
|
export { StandalonePlayground, createReactPlayground, createStandalonePlaygroundStateStorage, renderReactPlayground, } from './standalone.js';
|
|
7
7
|
export type * from './types.js';
|
|
8
|
+
export { usePlaygroundState, type PlaygroundState } from './use-playground-state.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,mBAAmB,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -9,6 +9,22 @@ export interface OutputViewProps {
|
|
|
9
9
|
*/
|
|
10
10
|
viewers?: ProgramViewer[];
|
|
11
11
|
fileViewers?: FileOutputViewer[];
|
|
12
|
+
/**
|
|
13
|
+
* The currently selected viewer key.
|
|
14
|
+
*/
|
|
15
|
+
selectedViewer?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Callback when the selected viewer changes.
|
|
18
|
+
*/
|
|
19
|
+
onViewerChange?: (viewerKey: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Current viewer state for viewers that have internal state.
|
|
22
|
+
*/
|
|
23
|
+
viewerState?: Record<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when viewer state changes.
|
|
26
|
+
*/
|
|
27
|
+
onViewerStateChange?: (state: Record<string, any>) => void;
|
|
12
28
|
}
|
|
13
29
|
export declare const OutputView: FunctionComponent<OutputViewProps>;
|
|
14
30
|
//# sourceMappingURL=output-view.d.ts.map
|
|
@@ -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;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;
|
|
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;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CA8BzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-graph-viewer.d.ts","sourceRoot":"","sources":["../../../../src/react/output-view/type-graph-viewer.tsx"],"names":[],"mappings":"AAEA,OAAO,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"type-graph-viewer.d.ts","sourceRoot":"","sources":["../../../../src/react/output-view/type-graph-viewer.tsx"],"names":[],"mappings":"AAEA,OAAO,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAgCpE,eAAO,MAAM,eAAe,EAAE,aAK7B,CAAC"}
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import { CompilerOptions } from '@typespec/compiler';
|
|
2
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
3
2
|
import { BrowserHost, PlaygroundSample } from '../types.js';
|
|
4
3
|
import { FileOutputViewer, ProgramViewer } from './types.js';
|
|
4
|
+
import { PlaygroundState } from './use-playground-state.js';
|
|
5
|
+
export type { PlaygroundState };
|
|
5
6
|
export interface PlaygroundProps {
|
|
6
7
|
host: BrowserHost;
|
|
7
|
-
/** Default
|
|
8
|
+
/** Default content if leaving this unmanaged. */
|
|
8
9
|
defaultContent?: string;
|
|
9
10
|
/** List of available libraries */
|
|
10
11
|
readonly libraries: readonly string[];
|
|
11
|
-
/** Emitter to use */
|
|
12
|
-
emitter?: string;
|
|
13
|
-
/** Default emitter if leaving this unmanaged. */
|
|
14
|
-
defaultEmitter?: string;
|
|
15
|
-
/** Callback when emitter change */
|
|
16
|
-
onEmitterChange?: (emitter: string) => void;
|
|
17
|
-
/** Emitter options */
|
|
18
|
-
compilerOptions?: CompilerOptions;
|
|
19
|
-
/** Default emitter options if leaving this unmanaged. */
|
|
20
|
-
defaultCompilerOptions?: CompilerOptions;
|
|
21
|
-
/** Callback when emitter options change */
|
|
22
|
-
onCompilerOptionsChange?: (emitter: CompilerOptions) => void;
|
|
23
12
|
/** Samples available */
|
|
24
13
|
samples?: Record<string, PlaygroundSample>;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
/** Default
|
|
28
|
-
|
|
29
|
-
/** Callback when
|
|
30
|
-
|
|
14
|
+
/** Playground state (controlled) */
|
|
15
|
+
playgroundState?: PlaygroundState;
|
|
16
|
+
/** Default playground state if leaving this unmanaged */
|
|
17
|
+
defaultPlaygroundState?: PlaygroundState;
|
|
18
|
+
/** Callback when playground state changes */
|
|
19
|
+
onPlaygroundStateChange?: (state: PlaygroundState) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Default emitter to use if not provided in defaultPlaygroundState.
|
|
22
|
+
* @deprecated Use defaultPlaygroundState.emitter instead
|
|
23
|
+
*/
|
|
24
|
+
defaultEmitter?: string;
|
|
31
25
|
onFileBug?: () => void;
|
|
32
26
|
/** Additional buttons to show up in the command bar */
|
|
33
27
|
commandBarButtons?: ReactNode;
|
|
@@ -47,19 +41,60 @@ export interface PlaygroundProps {
|
|
|
47
41
|
export interface PlaygroundEditorsOptions {
|
|
48
42
|
theme?: string;
|
|
49
43
|
}
|
|
50
|
-
export interface PlaygroundSaveData {
|
|
44
|
+
export interface PlaygroundSaveData extends PlaygroundState {
|
|
51
45
|
/** Current content of the playground. */
|
|
52
46
|
content: string;
|
|
53
47
|
/** Emitter name. */
|
|
54
48
|
emitter: string;
|
|
55
|
-
/** Emitter options. */
|
|
56
|
-
options?: CompilerOptions;
|
|
57
|
-
/** If a sample is selected and the content hasn't changed since. */
|
|
58
|
-
sampleName?: string;
|
|
59
49
|
}
|
|
60
50
|
export interface PlaygroundLinks {
|
|
61
51
|
/** Link to documentation */
|
|
62
52
|
documentationUrl?: string;
|
|
63
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Playground component for TypeSpec with consolidated state management.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const [playgroundState, setPlaygroundState] = useState<PlaygroundState>({
|
|
60
|
+
* emitter: 'openapi3',
|
|
61
|
+
* compilerOptions: {},
|
|
62
|
+
* sampleName: 'basic',
|
|
63
|
+
* selectedViewer: 'openapi',
|
|
64
|
+
* viewerState: {}
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* <Playground
|
|
68
|
+
* host={host}
|
|
69
|
+
* playgroundState={playgroundState}
|
|
70
|
+
* onPlaygroundStateChange={setPlaygroundState}
|
|
71
|
+
* samples={samples}
|
|
72
|
+
* viewers={viewers}
|
|
73
|
+
* />
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* For uncontrolled usage, use defaultPlaygroundState:
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Playground
|
|
79
|
+
* host={host}
|
|
80
|
+
* defaultPlaygroundState={{
|
|
81
|
+
* emitter: 'openapi3',
|
|
82
|
+
* compilerOptions: {},
|
|
83
|
+
* }}
|
|
84
|
+
* samples={samples}
|
|
85
|
+
* viewers={viewers}
|
|
86
|
+
* />
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* For backward compatibility, you can also use the deprecated defaultEmitter prop:
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <Playground
|
|
92
|
+
* host={host}
|
|
93
|
+
* defaultEmitter="openapi3"
|
|
94
|
+
* samples={samples}
|
|
95
|
+
* viewers={viewers}
|
|
96
|
+
* />
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
64
99
|
export declare const Playground: FunctionComponent<PlaygroundProps>;
|
|
65
100
|
//# sourceMappingURL=playground.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../../src/react/playground.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../../src/react/playground.tsx"],"names":[],"mappings":"AAEA,OAAO,sCAAsC,CAAC;AAG9C,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAOjE,OAAO,KAAK,EAAoB,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpF,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGrF,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAElB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,kCAAkC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtC,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE3C,oCAAoC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,yDAAyD;IACzD,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,6CAA6C;IAC7C,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAE3D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAE9B,uBAAuB;IACvB,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,kDAAkD;IAClD,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAE1B,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAEpD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAE7C,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAuOzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/react/standalone.tsx"],"names":[],"mappings":"AASA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/react/standalone.tsx"],"names":[],"mappings":"AASA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,OAAO,CAAC,eAAe,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAC7C,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAyBD,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,qBAAqB,CAuFzE,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,oDAExE;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,iBASxE;AAED,wBAAgB,sCAAsC,IAAI,eAAe,CAAC,kBAAkB,CAAC,CAoC5F"}
|
|
@@ -13,6 +13,10 @@ export interface OutputViewerProps {
|
|
|
13
13
|
readonly program: Program;
|
|
14
14
|
/** Files emitted */
|
|
15
15
|
readonly outputFiles: string[];
|
|
16
|
+
/** Current viewer state (for viewers that have internal state) */
|
|
17
|
+
readonly viewerState?: Record<string, any>;
|
|
18
|
+
/** Callback to update viewer state */
|
|
19
|
+
readonly onViewerStateChange?: (state: Record<string, any>) => void;
|
|
16
20
|
}
|
|
17
21
|
export interface ProgramViewer {
|
|
18
22
|
readonly key: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,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,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oBAAoB;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,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,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oBAAoB;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3C,sCAAsC;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CACrE;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,SAAS,GAAG,IAAI,CAAC;CACrE;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CompilerOptions } from '@typespec/compiler';
|
|
2
|
+
import { PlaygroundSample } from '../types.js';
|
|
3
|
+
export interface PlaygroundState {
|
|
4
|
+
/** Emitter to use */
|
|
5
|
+
emitter?: string;
|
|
6
|
+
/** Emitter options */
|
|
7
|
+
compilerOptions?: CompilerOptions;
|
|
8
|
+
/** Sample to use */
|
|
9
|
+
sampleName?: string;
|
|
10
|
+
/** Selected viewer */
|
|
11
|
+
selectedViewer?: string;
|
|
12
|
+
/** Internal state of viewers */
|
|
13
|
+
viewerState?: Record<string, any>;
|
|
14
|
+
/** TypeSpec content */
|
|
15
|
+
content?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UsePlaygroundStateProps {
|
|
18
|
+
/** List of available libraries */
|
|
19
|
+
readonly libraries: readonly string[];
|
|
20
|
+
/** Samples available */
|
|
21
|
+
samples?: Record<string, PlaygroundSample>;
|
|
22
|
+
/** Playground state (controlled) */
|
|
23
|
+
playgroundState?: PlaygroundState;
|
|
24
|
+
/** Default playground state if leaving this unmanaged */
|
|
25
|
+
defaultPlaygroundState?: PlaygroundState;
|
|
26
|
+
/** Callback when playground state changes */
|
|
27
|
+
onPlaygroundStateChange?: (state: PlaygroundState) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Default emitter to use if not provided in defaultPlaygroundState.
|
|
30
|
+
* @deprecated Use defaultPlaygroundState.emitter instead
|
|
31
|
+
*/
|
|
32
|
+
defaultEmitter?: string;
|
|
33
|
+
/** Default content if not provided in defaultPlaygroundState */
|
|
34
|
+
defaultContent?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PlaygroundStateResult {
|
|
37
|
+
selectedEmitter: string;
|
|
38
|
+
compilerOptions: CompilerOptions;
|
|
39
|
+
selectedSampleName: string;
|
|
40
|
+
selectedViewer?: string;
|
|
41
|
+
viewerState: Record<string, any>;
|
|
42
|
+
content: string;
|
|
43
|
+
onSelectedEmitterChange: (emitter: string) => void;
|
|
44
|
+
onCompilerOptionsChange: (compilerOptions: CompilerOptions) => void;
|
|
45
|
+
onSelectedSampleNameChange: (sampleName: string) => void;
|
|
46
|
+
onSelectedViewerChange: (selectedViewer: string) => void;
|
|
47
|
+
onViewerStateChange: (viewerState: Record<string, any>) => void;
|
|
48
|
+
onContentChange: (content: string) => void;
|
|
49
|
+
playgroundState: PlaygroundState;
|
|
50
|
+
setPlaygroundState: (state: PlaygroundState) => void;
|
|
51
|
+
}
|
|
52
|
+
export declare function usePlaygroundState({ libraries, samples, playgroundState: controlledPlaygroundState, defaultPlaygroundState, onPlaygroundStateChange, defaultEmitter, defaultContent, }: UsePlaygroundStateProps): PlaygroundStateResult;
|
|
53
|
+
//# sourceMappingURL=use-playground-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-playground-state.d.ts","sourceRoot":"","sources":["../../../src/react/use-playground-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtC,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE3C,oCAAoC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,yDAAyD;IACzD,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,6CAA6C;IAC7C,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAE3D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IAEpC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAGhB,uBAAuB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,uBAAuB,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,IAAI,CAAC;IACpE,0BAA0B,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,sBAAsB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChE,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAG3C,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,OAAO,EACP,eAAe,EAAE,yBAAyB,EAC1C,sBAAsB,EACtB,uBAAuB,EAEvB,cAAc,EACd,cAAc,GACf,EAAE,uBAAuB,GAAG,qBAAqB,CA0GjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer-item.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer-item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"footer-item.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer-item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAU,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAUjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer-version-item.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer-version-item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"footer-version-item.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer-version-item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAEL,iBAAiB,EAElB,MAAM,iCAAiC,CAAC;AAoBzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAUxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhD,eAAO,MAAM,QAAQ,EAAE,KAGtB,CAAC;AAaF,eAAO,MAAM,YAAY,EAAE,KAI1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"footer.stories.d.ts","sourceRoot":"","sources":["../../../stories/footer/footer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,MAAM,EAAiC,MAAM,iCAAiC,CAAC;AAoBxF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAU7B,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAShC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.stories.d.ts","sourceRoot":"","sources":["../../stories/playground.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"playground.stories.d.ts","sourceRoot":"","sources":["../../stories/playground.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQxD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAIjC,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAqBF,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/playground",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.5",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec playground UI components.",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -59,24 +59,24 @@
|
|
|
59
59
|
"!dist/test/**"
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@fluentui/react-components": "~9.
|
|
62
|
+
"@fluentui/react-components": "~9.66.1",
|
|
63
63
|
"@fluentui/react-icons": "^2.0.292",
|
|
64
|
-
"@typespec/bundler": "^0.
|
|
65
|
-
"@typespec/compiler": "^
|
|
66
|
-
"@typespec/html-program-viewer": "^0.
|
|
67
|
-
"@typespec/http": "^
|
|
68
|
-
"@typespec/openapi": "^
|
|
69
|
-
"@typespec/openapi3": "^
|
|
70
|
-
"@typespec/protobuf": "^0.
|
|
71
|
-
"@typespec/rest": "^0.
|
|
72
|
-
"@typespec/versioning": "^0.
|
|
64
|
+
"@typespec/bundler": "^0.4.1 || >=0.5.0-dev <0.5.0",
|
|
65
|
+
"@typespec/compiler": "^1.1.0",
|
|
66
|
+
"@typespec/html-program-viewer": "^0.71.0 || >=0.72.0-dev <0.72.0",
|
|
67
|
+
"@typespec/http": "^1.1.0",
|
|
68
|
+
"@typespec/openapi": "^1.1.0",
|
|
69
|
+
"@typespec/openapi3": "^1.1.0",
|
|
70
|
+
"@typespec/protobuf": "^0.71.0 || >=0.72.0-dev <0.72.0",
|
|
71
|
+
"@typespec/rest": "^0.71.0 || >=0.72.0-dev <0.72.0",
|
|
72
|
+
"@typespec/versioning": "^0.71.0 || >=0.72.0-dev <0.72.0",
|
|
73
73
|
"clsx": "^2.1.1",
|
|
74
74
|
"debounce": "~2.2.0",
|
|
75
75
|
"lzutf8": "0.6.3",
|
|
76
76
|
"monaco-editor": "~0.52.2",
|
|
77
77
|
"react": "~18.3.1",
|
|
78
78
|
"react-dom": "~18.3.1",
|
|
79
|
-
"react-error-boundary": "^
|
|
79
|
+
"react-error-boundary": "^6.0.0",
|
|
80
80
|
"swagger-ui-dist": "^5.20.1",
|
|
81
81
|
"vscode-languageserver": "~9.0.1",
|
|
82
82
|
"vscode-languageserver-textdocument": "~1.0.12"
|
|
@@ -84,27 +84,24 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/core": "^7.26.10",
|
|
86
86
|
"@playwright/test": "^1.51.1",
|
|
87
|
-
"@storybook/
|
|
88
|
-
"@storybook/
|
|
89
|
-
"@storybook/react": "^8.6.7",
|
|
90
|
-
"@storybook/react-vite": "^8.6.7",
|
|
91
|
-
"@storybook/test": "^8.6.7",
|
|
92
|
-
"@storybook/types": "^8.6.7",
|
|
87
|
+
"@storybook/cli": "^9.0.12",
|
|
88
|
+
"@storybook/react-vite": "^9.0.12",
|
|
93
89
|
"@types/debounce": "~1.2.4",
|
|
94
|
-
"@types/node": "~
|
|
90
|
+
"@types/node": "~24.0.3",
|
|
95
91
|
"@types/react": "~18.3.11",
|
|
96
92
|
"@types/react-dom": "~18.3.0",
|
|
97
93
|
"@types/swagger-ui-dist": "~3.30.5",
|
|
98
|
-
"@typespec/bundler": "^0.
|
|
99
|
-
"@vitejs/plugin-react": "~4.
|
|
94
|
+
"@typespec/bundler": "^0.4.1 || >=0.5.0-dev <0.5.0",
|
|
95
|
+
"@vitejs/plugin-react": "~4.4.1",
|
|
100
96
|
"c8": "^10.1.3",
|
|
101
97
|
"cross-env": "~7.0.3",
|
|
102
|
-
"es-module-shims": "~2.0
|
|
98
|
+
"es-module-shims": "~2.6.0",
|
|
103
99
|
"rimraf": "~6.0.1",
|
|
100
|
+
"storybook": "^9.0.12",
|
|
104
101
|
"typescript": "~5.8.2",
|
|
105
|
-
"vite": "^6.2.
|
|
102
|
+
"vite": "^6.2.7",
|
|
106
103
|
"vite-plugin-checker": "^0.9.1",
|
|
107
|
-
"vite-plugin-dts": "4.5.
|
|
104
|
+
"vite-plugin-dts": "4.5.4",
|
|
108
105
|
"@typespec/react-components": "^0.57.0"
|
|
109
106
|
},
|
|
110
107
|
"peerDependencies": {},
|
|
@@ -113,7 +110,7 @@
|
|
|
113
110
|
"build": "vite build",
|
|
114
111
|
"watch": "vite build --watch",
|
|
115
112
|
"storybook": "sb dev",
|
|
116
|
-
"build:
|
|
113
|
+
"build:storybook": "sb build",
|
|
117
114
|
"preview": "pnpm build && vite preview",
|
|
118
115
|
"start": "vite",
|
|
119
116
|
"test": "echo 'no tests'",
|