@typespec/playground 0.14.0-dev.1 → 0.14.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import require$$0, { createContext, useContext, memo, useCallback, useRef, useEffect, useMemo, useState, useId } from 'react';
1
+ import require$$0, { createContext, useContext, memo, useCallback, useRef, useEffect, useMemo, useState, useId, Fragment as Fragment$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, tokens, Card, Text, Tooltip, ToolbarButton, OverlayDrawer, DrawerHeader, DrawerHeaderTitle, Button, DrawerBody, Toolbar, Link, useId as useId$1, Label, Checkbox, RadioGroup, Radio, Input, Switch, Subtitle2, TabList, Tab, 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, Toolbar, Menu, MenuTrigger, Tooltip, ToolbarButton, MenuPopover, MenuList, MenuDivider, MenuItem, tokens, Card, Text, OverlayDrawer, DrawerHeader, DrawerHeaderTitle, Button, DrawerBody, useId as useId$1, Label, Checkbox, RadioGroup, Radio, Input, Switch, Subtitle2, TabList, Tab, useToastController, Toast, ToastTitle, ToastBody, Toaster, FluentProvider, webLightTheme } from '@fluentui/react-components';
4
4
  import { getSourceLocation } from '@typespec/compiler';
5
5
  import { editor, Uri, MarkerSeverity, KeyMod, KeyCode } from 'monaco-editor';
6
6
  import { $ } from '@typespec/compiler/typekit';
7
- import { ChevronDownRegular, ChevronRightRegular, DocumentBulletList24Regular, Dismiss24Regular, Save16Regular, Broom16Filled, Bug16Regular, SettingsRegular, FolderRegular, DocumentRegular, FolderListRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
7
+ import { ChevronDownRegular, ChevronRightRegular, MoreHorizontal24Filled, DocumentBulletList24Regular, Dismiss24Regular, Checkmark16Regular, Bug16Regular, Save16Regular, Broom16Filled, SettingsRegular, FolderRegular, DocumentRegular, FolderListRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
8
8
  import debounce from 'debounce';
9
9
  import { CompletionItemTag } from 'vscode-languageserver';
10
10
  import { a as resolveVirtualPath, p as printDebugInfo, d as debugGlobals, g as getMonacoRange, u as updateDiagnosticsForCodeFixes, c as createBrowserHost, r as registerMonacoLanguage } from '../services-Z619RuQS.js';
@@ -27,7 +27,7 @@ function usePlaygroundContext() {
27
27
 
28
28
  const list = "_list_wrnwm_1";
29
29
  const item$1 = "_item_wrnwm_4";
30
- const style$h = {
30
+ const style$i = {
31
31
  list: list,
32
32
  item: item$1,
33
33
  "item--error": "_item--error_wrnwm_15",
@@ -47,9 +47,9 @@ const DiagnosticList = ({
47
47
  [onDiagnosticSelected]
48
48
  );
49
49
  if (diagnostics.length === 0) {
50
- return /* @__PURE__ */ jsx("div", { className: style$h["list"], children: "No errors" });
50
+ return /* @__PURE__ */ jsx("div", { className: style$i["list"], children: "No errors" });
51
51
  }
52
- return /* @__PURE__ */ jsx("div", { className: style$h["list"], children: diagnostics.map((x, i) => {
52
+ return /* @__PURE__ */ jsx("div", { className: style$i["list"], children: diagnostics.map((x, i) => {
53
53
  return /* @__PURE__ */ jsx(DiagnosticItem, { diagnostic: x, onItemSelected: handleItemSelected }, i);
54
54
  }) });
55
55
  };
@@ -57,19 +57,19 @@ const DiagnosticItem = ({ diagnostic, onItemSelected }) => {
57
57
  const handleClick = useCallback(() => {
58
58
  onItemSelected(diagnostic);
59
59
  }, [diagnostic, onItemSelected]);
60
- return /* @__PURE__ */ jsxs("div", { tabIndex: 0, className: style$h["item"], onClick: handleClick, children: [
60
+ return /* @__PURE__ */ jsxs("div", { tabIndex: 0, className: style$i["item"], onClick: handleClick, children: [
61
61
  /* @__PURE__ */ jsx(
62
62
  "div",
63
63
  {
64
64
  className: mergeClasses(
65
- (style$h[diagnostic.severity === "error" ? "item--error" : "item--warning"])
65
+ (style$i[diagnostic.severity === "error" ? "item--error" : "item--warning"])
66
66
  ),
67
67
  children: diagnostic.severity
68
68
  }
69
69
  ),
70
- /* @__PURE__ */ jsx("div", { className: style$h["item-code"], children: diagnostic.code }),
71
- /* @__PURE__ */ jsx("div", { className: style$h["item-message"], children: diagnostic.message }),
72
- /* @__PURE__ */ jsx("div", { className: style$h["item-loc"], children: /* @__PURE__ */ jsx(DiagnosticTargetLink, { target: diagnostic.target }) })
70
+ /* @__PURE__ */ jsx("div", { className: style$i["item-code"], children: diagnostic.code }),
71
+ /* @__PURE__ */ jsx("div", { className: style$i["item-message"], children: diagnostic.message }),
72
+ /* @__PURE__ */ jsx("div", { className: style$i["item-loc"], children: /* @__PURE__ */ jsx(DiagnosticTargetLink, { target: diagnostic.target }) })
73
73
  ] });
74
74
  };
75
75
  const DiagnosticTargetLink = memo(({ target }) => {
@@ -134,18 +134,18 @@ function useMonacoModel(uri, language) {
134
134
  }
135
135
 
136
136
  const footer = "_footer_e6dic_1";
137
- const style$g = {
137
+ const style$h = {
138
138
  footer: footer,
139
139
  "footer-item": "_footer-item_e6dic_9"
140
140
  };
141
141
 
142
142
  const FooterItem = ({ children, link, className }) => {
143
- const resolvedClassName = mergeClasses(style$g["footer-item"], className);
143
+ const resolvedClassName = mergeClasses(style$h["footer-item"], className);
144
144
  return link ? /* @__PURE__ */ jsx("a", { className: resolvedClassName, href: link, target: "_blank", rel: "noopener noreferrer", children }) : /* @__PURE__ */ jsx("div", { className: resolvedClassName, children });
145
145
  };
146
146
 
147
147
  const button = "_button_1c15n_4";
148
- const style$f = {
148
+ const style$g = {
149
149
  "version-item": "_version-item_1c15n_1",
150
150
  button: button
151
151
  };
@@ -154,8 +154,8 @@ const FooterVersionItem = memo(({ versionSelector }) => {
154
154
  const { host } = usePlaygroundContext();
155
155
  const latest = versionSelector?.latest;
156
156
  const selected = versionSelector?.selected ?? host.compiler.MANIFEST.version;
157
- return /* @__PURE__ */ jsx(FooterItem, { className: style$f["version-item"], children: /* @__PURE__ */ jsxs(Popover, { children: [
158
- /* @__PURE__ */ jsx(PopoverTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsxs("div", { className: style$f["button"], children: [
157
+ return /* @__PURE__ */ jsx(FooterItem, { className: style$g["version-item"], children: /* @__PURE__ */ jsxs(Popover, { children: [
158
+ /* @__PURE__ */ jsx(PopoverTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsxs("div", { className: style$g["button"], children: [
159
159
  /* @__PURE__ */ jsx("span", { children: "Version " }),
160
160
  /* @__PURE__ */ jsx("span", { children: selected }),
161
161
  /* @__PURE__ */ jsx("span", { children: latest ? latest === selected ? " (latest)" : " (old)" : "" })
@@ -201,7 +201,7 @@ const VersionSelector = memo(({ versions, selected, latest, onChange }) => {
201
201
  });
202
202
 
203
203
  const Footer = ({ className, children }) => {
204
- return /* @__PURE__ */ jsx("div", { className: mergeClasses(style$g.footer, className), children });
204
+ return /* @__PURE__ */ jsx("div", { className: mergeClasses(style$h.footer, className), children });
205
205
  };
206
206
 
207
207
  function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) {
@@ -1008,7 +1008,7 @@ const focus = "_focus_16t0l_18";
1008
1008
  const active = "_active_16t0l_22";
1009
1009
  const caret = "_caret_16t0l_26";
1010
1010
  const icon = "_icon_16t0l_33";
1011
- const style$e = {
1011
+ const style$f = {
1012
1012
  tree: tree,
1013
1013
  "tree-row": "_tree-row_16t0l_4",
1014
1014
  focus: focus,
@@ -1027,9 +1027,9 @@ function TreeViewRow({ id, row, active, focussed, activate, icon: Icon }) {
1027
1027
  role: "treeitem",
1028
1028
  style: { paddingLeft },
1029
1029
  className: mergeClasses(
1030
- style$e["tree-row"],
1031
- active && style$e["active"],
1032
- focussed && style$e["focus"]
1030
+ style$f["tree-row"],
1031
+ active && style$f["active"],
1032
+ focussed && style$f["focus"]
1033
1033
  ),
1034
1034
  "aria-selected": active,
1035
1035
  "aria-expanded": row.expanded,
@@ -1037,8 +1037,8 @@ function TreeViewRow({ id, row, active, focussed, activate, icon: Icon }) {
1037
1037
  "aria-level": row.depth,
1038
1038
  onClick,
1039
1039
  children: [
1040
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: style$e["caret"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Caret, { row }) }),
1041
- Icon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: style$e["icon"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { node: row.item }) }),
1040
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: style$f["caret"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Caret, { row }) }),
1041
+ Icon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: style$f["icon"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { node: row.item }) }),
1042
1042
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "label", title: row.item.name, children: row.item.name })
1043
1043
  ]
1044
1044
  }
@@ -1138,7 +1138,7 @@ function Tree({
1138
1138
  "div",
1139
1139
  {
1140
1140
  id,
1141
- className: style$e["tree"],
1141
+ className: style$f["tree"],
1142
1142
  tabIndex: 0,
1143
1143
  role: "tree",
1144
1144
  onKeyDown: handleKeyDown,
@@ -1241,6 +1241,80 @@ const EmitterDropdown = ({
1241
1241
  );
1242
1242
  };
1243
1243
 
1244
+ const bar = "_bar_1gurd_1";
1245
+ const divider = "_divider_1gurd_5";
1246
+ const style$e = {
1247
+ bar: bar,
1248
+ divider: divider
1249
+ };
1250
+
1251
+ const ResponsiveCommandBar = ({
1252
+ items,
1253
+ isMobile
1254
+ }) => {
1255
+ const pinnedItems = items.filter((i) => i.pinned);
1256
+ const overflowItems = items.filter((i) => !i.pinned);
1257
+ const leftItems = items.filter((i) => (i.align ?? "left") === "left");
1258
+ const rightItems = items.filter((i) => i.align === "right");
1259
+ const leftOverflow = overflowItems.filter((i) => (i.align ?? "left") === "left");
1260
+ const rightOverflow = overflowItems.filter((i) => i.align === "right");
1261
+ return /* @__PURE__ */ jsxs("div", { className: style$e["bar"], children: [
1262
+ /* @__PURE__ */ jsx(Toolbar, { children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
1263
+ pinnedItems.map((item) => /* @__PURE__ */ jsx(ToolbarItemRenderer, { item }, item.id)),
1264
+ overflowItems.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
1265
+ /* @__PURE__ */ jsx("div", { className: style$e["divider"] }),
1266
+ /* @__PURE__ */ jsxs(Menu, { children: [
1267
+ /* @__PURE__ */ jsx(MenuTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(Tooltip, { content: "More actions", relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(
1268
+ ToolbarButton,
1269
+ {
1270
+ "aria-label": "More actions",
1271
+ icon: /* @__PURE__ */ jsx(MoreHorizontal24Filled, {}),
1272
+ appearance: "subtle"
1273
+ }
1274
+ ) }) }),
1275
+ /* @__PURE__ */ jsx(MenuPopover, { children: /* @__PURE__ */ jsxs(MenuList, { children: [
1276
+ leftOverflow.map((item) => /* @__PURE__ */ jsx(MenuItemRenderer, { item }, item.id)),
1277
+ leftOverflow.length > 0 && rightOverflow.length > 0 && /* @__PURE__ */ jsx(MenuDivider, {}),
1278
+ rightOverflow.map((item) => /* @__PURE__ */ jsx(MenuItemRenderer, { item }, item.id))
1279
+ ] }) })
1280
+ ] })
1281
+ ] })
1282
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1283
+ leftItems.map((item) => /* @__PURE__ */ jsx(ToolbarItemRenderer, { item }, item.id)),
1284
+ rightItems.length > 0 && /* @__PURE__ */ jsx("div", { className: style$e["divider"] }),
1285
+ rightItems.map((item) => /* @__PURE__ */ jsx(ToolbarItemRenderer, { item }, item.id))
1286
+ ] }) }),
1287
+ items.map((item) => item.content && /* @__PURE__ */ jsx(Fragment$1, { children: item.content }, item.id))
1288
+ ] });
1289
+ };
1290
+ const ToolbarItemRenderer = ({ item }) => {
1291
+ if (item.toolbarItem) return /* @__PURE__ */ jsx(Fragment, { children: item.toolbarItem });
1292
+ if (item.children) {
1293
+ return /* @__PURE__ */ jsxs(Menu, { children: [
1294
+ /* @__PURE__ */ jsx(MenuTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(Tooltip, { content: item.label, relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(ToolbarButton, { appearance: "subtle", "aria-label": item.label, icon: item.icon }) }) }),
1295
+ /* @__PURE__ */ jsx(MenuPopover, { children: /* @__PURE__ */ jsx(MenuList, { children: item.children.map((child) => /* @__PURE__ */ jsx(MenuItem, { icon: child.icon, onClick: child.onClick, children: child.label }, child.id)) }) })
1296
+ ] });
1297
+ }
1298
+ return /* @__PURE__ */ jsx(Tooltip, { content: item.label, relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(
1299
+ ToolbarButton,
1300
+ {
1301
+ "aria-label": item.label,
1302
+ icon: item.icon,
1303
+ onClick: item.onClick
1304
+ }
1305
+ ) });
1306
+ };
1307
+ const MenuItemRenderer = ({ item }) => {
1308
+ if (item.menuItem) return /* @__PURE__ */ jsx(Fragment, { children: item.menuItem });
1309
+ if (item.children) {
1310
+ return /* @__PURE__ */ jsxs(Menu, { openOnHover: false, children: [
1311
+ /* @__PURE__ */ jsx(MenuTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(MenuItem, { icon: item.icon, children: item.label }) }),
1312
+ /* @__PURE__ */ jsx(MenuPopover, { children: /* @__PURE__ */ jsx(MenuList, { children: item.children.map((child) => /* @__PURE__ */ jsx(MenuItem, { icon: child.icon, onClick: child.onClick, children: child.label }, child.id)) }) })
1313
+ ] });
1314
+ }
1315
+ return /* @__PURE__ */ jsx(MenuItem, { icon: item.icon, onClick: item.onClick, children: item.label });
1316
+ };
1317
+
1244
1318
  const style$d = {
1245
1319
  "samples-grid": "_samples-grid_1dkte_1",
1246
1320
  "sample-card": "_sample-card_1dkte_8",
@@ -1359,18 +1433,52 @@ const SampleCard = ({ name, sample, onSelect }) => {
1359
1433
  );
1360
1434
  };
1361
1435
 
1362
- const SamplesDrawerTrigger = ({
1436
+ const SamplesDrawerOverlay = ({
1363
1437
  samples,
1364
- onSelectedSampleNameChange
1438
+ onSelectedSampleNameChange,
1439
+ open,
1440
+ onOpenChange
1365
1441
  }) => {
1366
- const [isOpen, setIsOpen] = useState(false);
1367
1442
  const handleSampleSelect = useCallback(
1368
1443
  (sampleName) => {
1369
1444
  onSelectedSampleNameChange(sampleName);
1370
- setIsOpen(false);
1445
+ onOpenChange(false);
1371
1446
  },
1372
- [onSelectedSampleNameChange]
1447
+ [onSelectedSampleNameChange, onOpenChange]
1373
1448
  );
1449
+ return /* @__PURE__ */ jsxs(
1450
+ OverlayDrawer,
1451
+ {
1452
+ open,
1453
+ onOpenChange: (_, data) => onOpenChange(data.open),
1454
+ position: "end",
1455
+ size: "large",
1456
+ children: [
1457
+ /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(
1458
+ DrawerHeaderTitle,
1459
+ {
1460
+ action: /* @__PURE__ */ jsx(
1461
+ Button,
1462
+ {
1463
+ appearance: "subtle",
1464
+ "aria-label": "Close",
1465
+ icon: /* @__PURE__ */ jsx(Dismiss24Regular, {}),
1466
+ onClick: () => onOpenChange(false)
1467
+ }
1468
+ ),
1469
+ children: "Sample Gallery"
1470
+ }
1471
+ ) }),
1472
+ /* @__PURE__ */ jsx(DrawerBody, { children: /* @__PURE__ */ jsx("div", { className: style$d["samples-grid"], children: Object.entries(samples).map(([name, sample]) => /* @__PURE__ */ jsx(SampleCard, { name, sample, onSelect: handleSampleSelect }, name)) }) })
1473
+ ]
1474
+ }
1475
+ );
1476
+ };
1477
+ const SamplesDrawerTrigger = ({
1478
+ samples,
1479
+ onSelectedSampleNameChange
1480
+ }) => {
1481
+ const [isOpen, setIsOpen] = useState(false);
1374
1482
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1375
1483
  /* @__PURE__ */ jsx(Tooltip, { content: "Browse samples", relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(
1376
1484
  ToolbarButton,
@@ -1381,104 +1489,143 @@ const SamplesDrawerTrigger = ({
1381
1489
  children: "Samples"
1382
1490
  }
1383
1491
  ) }),
1384
- /* @__PURE__ */ jsxs(
1385
- OverlayDrawer,
1492
+ /* @__PURE__ */ jsx(
1493
+ SamplesDrawerOverlay,
1386
1494
  {
1495
+ samples,
1496
+ onSelectedSampleNameChange,
1387
1497
  open: isOpen,
1388
- onOpenChange: (_, data) => setIsOpen(data.open),
1389
- position: "end",
1390
- size: "large",
1391
- children: [
1392
- /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(
1393
- DrawerHeaderTitle,
1394
- {
1395
- action: /* @__PURE__ */ jsx(
1396
- Button,
1397
- {
1398
- appearance: "subtle",
1399
- "aria-label": "Close",
1400
- icon: /* @__PURE__ */ jsx(Dismiss24Regular, {}),
1401
- onClick: () => setIsOpen(false)
1402
- }
1403
- ),
1404
- children: "Sample Gallery"
1405
- }
1406
- ) }),
1407
- /* @__PURE__ */ jsx(DrawerBody, { children: /* @__PURE__ */ jsx("div", { className: style$d["samples-grid"], children: Object.entries(samples).map(([name, sample]) => /* @__PURE__ */ jsx(SampleCard, { name, sample, onSelect: handleSampleSelect }, name)) }) })
1408
- ]
1498
+ onOpenChange: setIsOpen
1409
1499
  }
1410
1500
  )
1411
1501
  ] });
1412
1502
  };
1413
1503
 
1414
- const bar = "_bar_15c2c_1";
1415
- const divider = "_divider_15c2c_5";
1416
- const spacer = "_spacer_15c2c_9";
1417
- const style$c = {
1418
- bar: bar,
1419
- divider: divider,
1420
- spacer: spacer
1421
- };
1504
+ const MobileBreakpoint = 768;
1505
+ function useIsMobile() {
1506
+ const query = `(max-width: ${MobileBreakpoint}px)`;
1507
+ const getMatch = useCallback(() => {
1508
+ return typeof window !== "undefined" ? window.matchMedia(query).matches : false;
1509
+ }, [query]);
1510
+ const [isMobile, setIsMobile] = useState(getMatch);
1511
+ useEffect(() => {
1512
+ const mql = window.matchMedia(query);
1513
+ const handler = (e) => setIsMobile(e.matches);
1514
+ mql.addEventListener("change", handler);
1515
+ setIsMobile(mql.matches);
1516
+ return () => mql.removeEventListener("change", handler);
1517
+ }, [query]);
1518
+ return isMobile;
1519
+ }
1422
1520
 
1423
- const EditorCommandBar = ({
1424
- documentationUrl,
1425
- saveCode,
1426
- formatCode,
1427
- fileBug,
1428
- host,
1429
- selectedEmitter,
1430
- onSelectedEmitterChange,
1431
- samples,
1432
- selectedSampleName,
1433
- onSelectedSampleNameChange,
1434
- commandBarButtons
1435
- }) => {
1436
- const documentation = documentationUrl ? /* @__PURE__ */ jsx("label", { children: /* @__PURE__ */ jsx(Link, { href: documentationUrl, target: "_blank", children: "Docs" }) }) : void 0;
1437
- const bugButton = fileBug ? /* @__PURE__ */ jsx(FileBugButton, { onClick: fileBug }) : void 0;
1521
+ const EditorCommandBar = (props) => {
1522
+ const {
1523
+ saveCode,
1524
+ formatCode,
1525
+ fileBug,
1526
+ host,
1527
+ selectedEmitter,
1528
+ onSelectedEmitterChange,
1529
+ samples,
1530
+ onSelectedSampleNameChange,
1531
+ commandBarItems: externalItems
1532
+ } = props;
1533
+ const isMobile = useIsMobile();
1534
+ const [samplesDrawerOpen, setSamplesDrawerOpen] = useState(false);
1438
1535
  const emitters = useMemo(
1439
1536
  () => Object.values(host.libraries).filter((x) => x.isEmitter).map((x) => x.name),
1440
1537
  [host.libraries]
1441
1538
  );
1442
- return /* @__PURE__ */ jsx("div", { className: style$c["bar"], children: /* @__PURE__ */ jsxs(Toolbar, { children: [
1443
- /* @__PURE__ */ jsx(Tooltip, { content: "Save", relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(ToolbarButton, { "aria-label": "Save", icon: /* @__PURE__ */ jsx(Save16Regular, {}), onClick: saveCode }) }),
1444
- /* @__PURE__ */ jsx(Tooltip, { content: "Format", relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(ToolbarButton, { "aria-label": "Format", icon: /* @__PURE__ */ jsx(Broom16Filled, {}), onClick: formatCode }) }),
1445
- samples && /* @__PURE__ */ jsxs(Fragment, { children: [
1446
- /* @__PURE__ */ jsx(
1447
- SamplesDrawerTrigger,
1539
+ const handleFileBug = useCallback(() => {
1540
+ if (fileBug) void fileBug();
1541
+ }, [fileBug]);
1542
+ const items = useMemo(() => {
1543
+ const result = [
1544
+ {
1545
+ id: "save",
1546
+ label: "Save",
1547
+ icon: /* @__PURE__ */ jsx(Save16Regular, {}),
1548
+ onClick: saveCode,
1549
+ pinned: true
1550
+ },
1551
+ {
1552
+ id: "format",
1553
+ label: "Format",
1554
+ icon: /* @__PURE__ */ jsx(Broom16Filled, {}),
1555
+ onClick: formatCode,
1556
+ pinned: true
1557
+ }
1558
+ ];
1559
+ if (samples) {
1560
+ result.push({
1561
+ id: "samples",
1562
+ label: "Browse Samples",
1563
+ icon: /* @__PURE__ */ jsx(DocumentBulletList24Regular, {}),
1564
+ onClick: () => setSamplesDrawerOpen(true),
1565
+ toolbarItem: /* @__PURE__ */ jsx(
1566
+ SamplesDrawerTrigger,
1567
+ {
1568
+ samples,
1569
+ onSelectedSampleNameChange
1570
+ }
1571
+ )
1572
+ });
1573
+ }
1574
+ result.push({
1575
+ id: "emitter",
1576
+ label: "Emitter",
1577
+ toolbarItem: /* @__PURE__ */ jsx(
1578
+ EmitterDropdown,
1448
1579
  {
1449
- samples,
1450
- onSelectedSampleNameChange
1580
+ emitters,
1581
+ selectedEmitter,
1582
+ onSelectedEmitterChange
1451
1583
  }
1452
1584
  ),
1453
- /* @__PURE__ */ jsx("div", { className: style$c["spacer"] })
1454
- ] }),
1455
- /* @__PURE__ */ jsx(
1456
- EmitterDropdown,
1585
+ children: emitters.map((emitter) => ({
1586
+ id: `emitter-${emitter}`,
1587
+ label: emitter,
1588
+ icon: emitter === selectedEmitter ? /* @__PURE__ */ jsx(Checkmark16Regular, {}) : void 0,
1589
+ onClick: () => onSelectedEmitterChange(emitter)
1590
+ }))
1591
+ });
1592
+ if (externalItems) {
1593
+ result.push(...externalItems);
1594
+ }
1595
+ if (fileBug) {
1596
+ result.push({
1597
+ id: "file-bug",
1598
+ label: "File Bug",
1599
+ align: "right",
1600
+ icon: /* @__PURE__ */ jsx(Bug16Regular, {}),
1601
+ onClick: handleFileBug
1602
+ });
1603
+ }
1604
+ return result;
1605
+ }, [
1606
+ saveCode,
1607
+ formatCode,
1608
+ samples,
1609
+ onSelectedSampleNameChange,
1610
+ emitters,
1611
+ selectedEmitter,
1612
+ onSelectedEmitterChange,
1613
+ externalItems,
1614
+ fileBug,
1615
+ handleFileBug
1616
+ ]);
1617
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1618
+ /* @__PURE__ */ jsx(ResponsiveCommandBar, { items, isMobile }),
1619
+ isMobile && samples && /* @__PURE__ */ jsx(
1620
+ SamplesDrawerOverlay,
1457
1621
  {
1458
- emitters,
1459
- onSelectedEmitterChange,
1460
- selectedEmitter
1622
+ samples,
1623
+ onSelectedSampleNameChange,
1624
+ open: samplesDrawerOpen,
1625
+ onOpenChange: setSamplesDrawerOpen
1461
1626
  }
1462
- ),
1463
- documentation && /* @__PURE__ */ jsxs(Fragment, { children: [
1464
- /* @__PURE__ */ jsx("div", { className: style$c["spacer"] }),
1465
- documentation
1466
- ] }),
1467
- /* @__PURE__ */ jsx("div", { className: style$c["divider"] }),
1468
- commandBarButtons,
1469
- bugButton
1470
- ] }) });
1471
- };
1472
- const FileBugButton = ({ onClick }) => {
1473
- return /* @__PURE__ */ jsx(Tooltip, { content: "File Bug Report", relationship: "description", withArrow: true, children: /* @__PURE__ */ jsx(
1474
- ToolbarButton,
1475
- {
1476
- appearance: "subtle",
1477
- "aria-label": "File Bug Report",
1478
- icon: /* @__PURE__ */ jsx(Bug16Regular, {}),
1479
- onClick
1480
- }
1481
- ) });
1627
+ )
1628
+ ] });
1482
1629
  };
1483
1630
 
1484
1631
  const DefaultFooter = () => {
@@ -1522,7 +1669,7 @@ const settings = "_settings_1yvpj_1";
1522
1669
  const section = "_section_1yvpj_7";
1523
1670
  const field = "_field_1yvpj_23";
1524
1671
  const empty = "_empty_1yvpj_33";
1525
- const style$b = {
1672
+ const style$c = {
1526
1673
  settings: settings,
1527
1674
  section: section,
1528
1675
  "section-title": "_section-title_1yvpj_19",
@@ -1533,7 +1680,7 @@ const style$b = {
1533
1680
  const form = "_form_w9o1o_1";
1534
1681
  const item = "_item_w9o1o_7";
1535
1682
  const description = "_description_w9o1o_13";
1536
- const style$a = {
1683
+ const style$b = {
1537
1684
  form: form,
1538
1685
  item: item,
1539
1686
  description: description,
@@ -1562,9 +1709,9 @@ const EmitterOptionsForm = ({
1562
1709
  return /* @__PURE__ */ jsx(Text, { size: 200, children: "No options available" });
1563
1710
  }
1564
1711
  const entries = Object.entries(emitterOptionsSchema);
1565
- return /* @__PURE__ */ jsx("div", { className: style$a["form"], children: entries.map(([key, value]) => {
1712
+ return /* @__PURE__ */ jsx("div", { className: style$b["form"], children: entries.map(([key, value]) => {
1566
1713
  const resolved = value.oneOf ? resolveOneOfProperty(value) : value;
1567
- return /* @__PURE__ */ jsx("div", { className: style$a["form-item"], children: resolved.type === "array" ? /* @__PURE__ */ jsx(
1714
+ return /* @__PURE__ */ jsx("div", { className: style$b["form-item"], children: resolved.type === "array" ? /* @__PURE__ */ jsx(
1568
1715
  JsonSchemaArrayPropertyInput,
1569
1716
  {
1570
1717
  emitterOptions: options[library.name] ?? {},
@@ -1626,7 +1773,7 @@ const JsonSchemaArrayPropertyInput = ({
1626
1773
  return JsonSchemaPropertyInput({ emitterOptions, name, prop: itemsSchema, onChange });
1627
1774
  }
1628
1775
  const itemsEnum = itemsSchema.enum;
1629
- return /* @__PURE__ */ jsxs("div", { className: style$a["item"], children: [
1776
+ return /* @__PURE__ */ jsxs("div", { className: style$b["item"], children: [
1630
1777
  /* @__PURE__ */ jsx(Label, { htmlFor: inputId, title: name, children: prettyName }),
1631
1778
  itemsEnum.map((x) => /* @__PURE__ */ jsx(
1632
1779
  Checkbox,
@@ -1658,24 +1805,24 @@ const JsonSchemaPropertyInput = ({
1658
1805
  );
1659
1806
  switch (prop.type) {
1660
1807
  case "boolean":
1661
- return /* @__PURE__ */ jsxs("div", { className: style$a["item"], children: [
1808
+ return /* @__PURE__ */ jsxs("div", { className: style$b["item"], children: [
1662
1809
  /* @__PURE__ */ jsx(
1663
1810
  Switch,
1664
1811
  {
1665
- className: style$a["switch"],
1812
+ className: style$b["switch"],
1666
1813
  label: prettyName,
1667
1814
  labelPosition: "above",
1668
1815
  checked: value,
1669
1816
  onChange: handleChange
1670
1817
  }
1671
1818
  ),
1672
- prop.description && /* @__PURE__ */ jsx(Text, { size: 200, className: style$a["description"], children: prop.description })
1819
+ prop.description && /* @__PURE__ */ jsx(Text, { size: 200, className: style$b["description"], children: prop.description })
1673
1820
  ] });
1674
1821
  case "string":
1675
1822
  default:
1676
- return /* @__PURE__ */ jsxs("div", { className: style$a["item"], children: [
1823
+ return /* @__PURE__ */ jsxs("div", { className: style$b["item"], children: [
1677
1824
  /* @__PURE__ */ jsx(Label, { htmlFor: inputId, title: name, children: prettyName }),
1678
- prop.description && /* @__PURE__ */ jsx(Text, { size: 200, className: style$a["description"], children: prop.description }),
1825
+ prop.description && /* @__PURE__ */ jsx(Text, { size: 200, className: style$b["description"], children: prop.description }),
1679
1826
  prop.enum ? /* @__PURE__ */ jsx(RadioGroup, { layout: "horizontal", id: inputId, value, onChange: handleChange, children: prop.enum.map((x) => /* @__PURE__ */ jsx(Radio, { value: x, label: x }, x)) }) : /* @__PURE__ */ jsx(Input, { id: inputId, value, onChange: handleChange })
1680
1827
  ] });
1681
1828
  }
@@ -1759,10 +1906,10 @@ const CompilerSettings = ({
1759
1906
  },
1760
1907
  [onSelectedEmitterChange]
1761
1908
  );
1762
- return /* @__PURE__ */ jsxs("div", { className: style$b["settings"], children: [
1763
- /* @__PURE__ */ jsxs("section", { className: style$b["section"], children: [
1764
- /* @__PURE__ */ jsx(Subtitle2, { className: style$b["section-title"], children: "Emitter" }),
1765
- /* @__PURE__ */ jsxs("div", { className: style$b["field"], children: [
1909
+ return /* @__PURE__ */ jsxs("div", { className: style$c["settings"], children: [
1910
+ /* @__PURE__ */ jsxs("section", { className: style$c["section"], children: [
1911
+ /* @__PURE__ */ jsx(Subtitle2, { className: style$c["section-title"], children: "Emitter" }),
1912
+ /* @__PURE__ */ jsxs("div", { className: style$c["field"], children: [
1766
1913
  /* @__PURE__ */ jsx(Label, { children: "Select emitter" }),
1767
1914
  /* @__PURE__ */ jsxs(
1768
1915
  Select,
@@ -1778,8 +1925,8 @@ const CompilerSettings = ({
1778
1925
  )
1779
1926
  ] })
1780
1927
  ] }),
1781
- /* @__PURE__ */ jsxs("section", { className: style$b["section"], children: [
1782
- /* @__PURE__ */ jsx(Subtitle2, { className: style$b["section-title"], children: "Emitter options" }),
1928
+ /* @__PURE__ */ jsxs("section", { className: style$c["section"], children: [
1929
+ /* @__PURE__ */ jsx(Subtitle2, { className: style$c["section-title"], children: "Emitter options" }),
1783
1930
  library ? /* @__PURE__ */ jsx(
1784
1931
  EmitterOptionsForm,
1785
1932
  {
@@ -1787,10 +1934,10 @@ const CompilerSettings = ({
1787
1934
  options: options.options ?? {},
1788
1935
  optionsChanged: emitterOptionsChanged
1789
1936
  }
1790
- ) : /* @__PURE__ */ jsx(Text, { size: 200, className: style$b["empty"], children: "No emitter selected" })
1937
+ ) : /* @__PURE__ */ jsx(Text, { size: 200, className: style$c["empty"], children: "No emitter selected" })
1791
1938
  ] }),
1792
- /* @__PURE__ */ jsxs("section", { className: style$b["section"], children: [
1793
- /* @__PURE__ */ jsx(Subtitle2, { className: style$b["section-title"], children: "Linter rules" }),
1939
+ /* @__PURE__ */ jsxs("section", { className: style$c["section"], children: [
1940
+ /* @__PURE__ */ jsx(Subtitle2, { className: style$c["section-title"], children: "Linter rules" }),
1794
1941
  /* @__PURE__ */ jsx(
1795
1942
  LinterForm,
1796
1943
  {
@@ -1803,7 +1950,7 @@ const CompilerSettings = ({
1803
1950
  ] });
1804
1951
  };
1805
1952
 
1806
- const style$9 = {
1953
+ const style$a = {
1807
1954
  "config-panel": "_config-panel_cffut_1",
1808
1955
  "config-toggle": "_config-toggle_cffut_8",
1809
1956
  "config-content": "_config-content_cffut_17",
@@ -1898,12 +2045,12 @@ const ConfigPanel = ({
1898
2045
  },
1899
2046
  [selectedEmitter, compilerOptions, yamlModel]
1900
2047
  );
1901
- return /* @__PURE__ */ jsxs("div", { className: style$9["config-panel"], children: [
1902
- /* @__PURE__ */ jsx("div", { className: style$9["config-toggle"], children: /* @__PURE__ */ jsxs(TabList, { size: "small", selectedValue: mode, onTabSelect: handleModeChange, children: [
2048
+ return /* @__PURE__ */ jsxs("div", { className: style$a["config-panel"], children: [
2049
+ /* @__PURE__ */ jsx("div", { className: style$a["config-toggle"], children: /* @__PURE__ */ jsxs(TabList, { size: "small", selectedValue: mode, onTabSelect: handleModeChange, children: [
1903
2050
  /* @__PURE__ */ jsx(Tab, { value: "form", children: "Visual" }),
1904
2051
  /* @__PURE__ */ jsx(Tab, { value: "yaml", children: "Yaml" })
1905
2052
  ] }) }),
1906
- /* @__PURE__ */ jsx("div", { className: style$9["config-content"], children: mode === "form" ? /* @__PURE__ */ jsx("div", { className: style$9["form-content"], children: /* @__PURE__ */ jsx(
2053
+ /* @__PURE__ */ jsx("div", { className: style$a["config-content"], children: mode === "form" ? /* @__PURE__ */ jsx("div", { className: style$a["form-content"], children: /* @__PURE__ */ jsx(
1907
2054
  CompilerSettings,
1908
2055
  {
1909
2056
  host,
@@ -1916,7 +2063,7 @@ const ConfigPanel = ({
1916
2063
  ] });
1917
2064
  };
1918
2065
 
1919
- const style$8 = {
2066
+ const style$9 = {
1920
2067
  "editor-panel": "_editor-panel_k9ax7_1",
1921
2068
  "panel-tabs-container": "_panel-tabs-container_k9ax7_7",
1922
2069
  "panel-content": "_panel-content_k9ax7_11"
@@ -1958,12 +2105,12 @@ const EditorPanel = ({
1958
2105
  const onTabSelect = useCallback((_, data) => {
1959
2106
  setSelectedTab(data.value);
1960
2107
  }, []);
1961
- return /* @__PURE__ */ jsxs("div", { className: style$8["editor-panel"], children: [
1962
- /* @__PURE__ */ jsx("div", { className: style$8["panel-tabs-container"], children: /* @__PURE__ */ jsxs(TabList, { vertical: true, size: "large", selectedValue: selectedTab, onTabSelect, children: [
2108
+ return /* @__PURE__ */ jsxs("div", { className: style$9["editor-panel"], children: [
2109
+ /* @__PURE__ */ jsx("div", { className: style$9["panel-tabs-container"], children: /* @__PURE__ */ jsxs(TabList, { vertical: true, size: "large", selectedValue: selectedTab, onTabSelect, children: [
1963
2110
  /* @__PURE__ */ jsx(Tab, { value: "tsp", children: /* @__PURE__ */ jsx("span", { title: "TypeSpec", children: /* @__PURE__ */ jsx(TypeSpecIcon, {}) }) }),
1964
2111
  /* @__PURE__ */ jsx(Tab, { value: "cfg", children: /* @__PURE__ */ jsx("span", { title: "Config", children: /* @__PURE__ */ jsx(SettingsRegular, {}) }) })
1965
2112
  ] }) }),
1966
- /* @__PURE__ */ jsxs("div", { className: style$8["panel-content"], children: [
2113
+ /* @__PURE__ */ jsxs("div", { className: style$9["panel-content"], children: [
1967
2114
  commandBar,
1968
2115
  selectedTab === "tsp" ? /* @__PURE__ */ jsx(
1969
2116
  TypeSpecEditor,
@@ -1992,7 +2139,7 @@ const breadcrumb = "_breadcrumb_15sw5_1";
1992
2139
  const segment = "_segment_15sw5_15";
1993
2140
  const separator = "_separator_15sw5_20";
1994
2141
  const current = "_current_15sw5_25";
1995
- const style$7 = {
2142
+ const style$8 = {
1996
2143
  breadcrumb: breadcrumb,
1997
2144
  segment: segment,
1998
2145
  separator: separator,
@@ -2004,13 +2151,13 @@ const FileBreadcrumb = ({ path }) => {
2004
2151
  return null;
2005
2152
  }
2006
2153
  const segments = path.split("/");
2007
- return /* @__PURE__ */ jsx("div", { className: style$7["breadcrumb"], children: segments.map((segment, index) => /* @__PURE__ */ jsxs("span", { className: style$7["segment"], children: [
2008
- index > 0 && /* @__PURE__ */ jsx("span", { className: style$7["separator"], children: "/" }),
2009
- /* @__PURE__ */ jsx("span", { className: index === segments.length - 1 ? style$7["current"] : void 0, children: segment })
2154
+ return /* @__PURE__ */ jsx("div", { className: style$8["breadcrumb"], children: segments.map((segment, index) => /* @__PURE__ */ jsxs("span", { className: style$8["segment"], children: [
2155
+ index > 0 && /* @__PURE__ */ jsx("span", { className: style$8["separator"], children: "/" }),
2156
+ /* @__PURE__ */ jsx("span", { className: index === segments.length - 1 ? style$8["current"] : void 0, children: segment })
2010
2157
  ] }, index)) });
2011
2158
  };
2012
2159
 
2013
- const style$6 = {
2160
+ const style$7 = {
2014
2161
  "file-output": "_file-output_jzw6j_1",
2015
2162
  "viewer-selector": "_viewer-selector_jzw6j_5"
2016
2163
  };
@@ -2036,8 +2183,8 @@ const FileOutput = ({ filename, content, viewers }) => {
2036
2183
  } else if (keys.length === 1) {
2037
2184
  return resolvedViewers[keys[0]].render({ filename, content });
2038
2185
  }
2039
- return /* @__PURE__ */ jsxs("div", { className: style$6["file-output"], children: [
2040
- /* @__PURE__ */ jsx("div", { className: style$6["viewer-selector"], children: /* @__PURE__ */ jsx(Select, { value: selected, onChange: handleSelected, "aria-label": "Select viewer", children: Object.values(resolvedViewers).map(({ key, label }) => /* @__PURE__ */ jsx("option", { value: key, children: label }, key)) }) }),
2186
+ return /* @__PURE__ */ jsxs("div", { className: style$7["file-output"], children: [
2187
+ /* @__PURE__ */ jsx("div", { className: style$7["viewer-selector"], children: /* @__PURE__ */ jsx(Select, { value: selected, onChange: handleSelected, "aria-label": "Select viewer", children: Object.values(resolvedViewers).map(({ key, label }) => /* @__PURE__ */ jsx("option", { value: key, children: label }, key)) }) }),
2041
2188
  selectedRender && selectedRender({ filename, content })
2042
2189
  ] });
2043
2190
  };
@@ -2047,7 +2194,7 @@ const RawFileViewer = {
2047
2194
  render: ({ filename, content }) => /* @__PURE__ */ jsx(OutputEditor, { filename, value: content })
2048
2195
  };
2049
2196
 
2050
- const style$5 = {
2197
+ const style$6 = {
2051
2198
  "file-tree": "_file-tree_m3if7_1"
2052
2199
  };
2053
2200
 
@@ -2119,7 +2266,7 @@ const FileTreeExplorer = ({
2119
2266
  onSelect
2120
2267
  }) => {
2121
2268
  const tree = useMemo(() => buildTree(files), [files]);
2122
- return /* @__PURE__ */ jsx("div", { className: style$5["file-tree"], children: /* @__PURE__ */ jsx(
2269
+ return /* @__PURE__ */ jsx("div", { className: style$6["file-tree"], children: /* @__PURE__ */ jsx(
2123
2270
  Tree,
2124
2271
  {
2125
2272
  tree,
@@ -2133,7 +2280,7 @@ const FileTreeExplorer = ({
2133
2280
 
2134
2281
  const tabs = "_tabs_1x6x2_1";
2135
2282
  const tab = "_tab_1x6x2_1";
2136
- const style$4 = {
2283
+ const style$5 = {
2137
2284
  tabs: tabs,
2138
2285
  tab: tab,
2139
2286
  "tab--selected": "_tab--selected_1x6x2_18"
@@ -2150,12 +2297,12 @@ const OutputTabs = ({
2150
2297
  },
2151
2298
  [onSelect]
2152
2299
  );
2153
- return /* @__PURE__ */ jsx(TabList, { selectedValue: selected, onTabSelect, className: style$4["tabs"], children: filenames.map((filename) => {
2300
+ return /* @__PURE__ */ jsx(TabList, { selectedValue: selected, onTabSelect, className: style$5["tabs"], children: filenames.map((filename) => {
2154
2301
  return /* @__PURE__ */ jsx(
2155
2302
  Tab,
2156
2303
  {
2157
2304
  value: filename,
2158
- className: mergeClasses(style$4["tab"], filename === selected && style$4["tab--selected"]),
2305
+ className: mergeClasses(style$5["tab"], filename === selected && style$5["tab--selected"]),
2159
2306
  children: filename
2160
2307
  },
2161
2308
  filename
@@ -2163,7 +2310,7 @@ const OutputTabs = ({
2163
2310
  }) });
2164
2311
  };
2165
2312
 
2166
- const style$3 = {
2313
+ const style$4 = {
2167
2314
  "output-view": "_output-view_eeqi3_1",
2168
2315
  "file-viewer": "_file-viewer_eeqi3_6",
2169
2316
  "output-content": "_output-content_eeqi3_12",
@@ -2215,7 +2362,7 @@ const FileViewerComponent = ({
2215
2362
  return /* @__PURE__ */ jsx(Fragment, { children: "No files emitted." });
2216
2363
  }
2217
2364
  if (showFileTree) {
2218
- return /* @__PURE__ */ jsx("div", { className: style$3["file-viewer"], children: /* @__PURE__ */ jsxs(SplitPane, { initialSizes: ["220px", void 0], children: [
2365
+ return /* @__PURE__ */ jsx("div", { className: style$4["file-viewer"], children: /* @__PURE__ */ jsxs(SplitPane, { initialSizes: ["220px", void 0], children: [
2219
2366
  /* @__PURE__ */ jsx(Pane, { minSize: 120, maxSize: 400, children: /* @__PURE__ */ jsx(
2220
2367
  FileTreeExplorer,
2221
2368
  {
@@ -2224,15 +2371,15 @@ const FileViewerComponent = ({
2224
2371
  onSelect: handleFileSelection
2225
2372
  }
2226
2373
  ) }),
2227
- /* @__PURE__ */ jsx(Pane, { children: /* @__PURE__ */ jsxs("div", { className: style$3["file-viewer-content-with-breadcrumb"], children: [
2374
+ /* @__PURE__ */ jsx(Pane, { children: /* @__PURE__ */ jsxs("div", { className: style$4["file-viewer-content-with-breadcrumb"], children: [
2228
2375
  /* @__PURE__ */ jsx(FileBreadcrumb, { path: filename }),
2229
- /* @__PURE__ */ jsx("div", { className: style$3["file-viewer-content"], children: /* @__PURE__ */ jsx(FileOutput, { filename, content, viewers: fileViewers }) })
2376
+ /* @__PURE__ */ jsx("div", { className: style$4["file-viewer-content"], children: /* @__PURE__ */ jsx(FileOutput, { filename, content, viewers: fileViewers }) })
2230
2377
  ] }) })
2231
2378
  ] }) });
2232
2379
  }
2233
- return /* @__PURE__ */ jsxs("div", { className: style$3["file-viewer"], children: [
2380
+ return /* @__PURE__ */ jsxs("div", { className: style$4["file-viewer"], children: [
2234
2381
  /* @__PURE__ */ jsx(OutputTabs, { filenames: outputFiles, selected: filename, onSelect: handleFileSelection }),
2235
- /* @__PURE__ */ jsx("div", { className: style$3["file-viewer-content"], children: /* @__PURE__ */ jsx(FileOutput, { filename, content, viewers: fileViewers }) })
2382
+ /* @__PURE__ */ jsx("div", { className: style$4["file-viewer-content"], children: /* @__PURE__ */ jsx(FileOutput, { filename, content, viewers: fileViewers }) })
2236
2383
  ] });
2237
2384
  };
2238
2385
  function createFileViewer(fileViewers) {
@@ -2262,7 +2409,7 @@ const TypeGraphViewerComponent = ({
2262
2409
  },
2263
2410
  [viewerState, onViewerStateChange]
2264
2411
  );
2265
- return /* @__PURE__ */ jsx("div", { className: style$3["type-graph-viewer"], children: /* @__PURE__ */ jsx(
2412
+ return /* @__PURE__ */ jsx("div", { className: style$4["type-graph-viewer"], children: /* @__PURE__ */ jsx(
2266
2413
  TypeGraph,
2267
2414
  {
2268
2415
  program,
@@ -2344,8 +2491,8 @@ const OutputViewInternal = ({
2344
2491
  const viewer = useMemo(() => {
2345
2492
  return viewers.programViewers[selected];
2346
2493
  }, [viewers.programViewers, selected]);
2347
- return /* @__PURE__ */ jsxs("div", { className: style$3["output-view"], children: [
2348
- /* @__PURE__ */ jsx("div", { className: style$3["output-content"], children: /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender, children: /* @__PURE__ */ jsx(
2494
+ return /* @__PURE__ */ jsxs("div", { className: style$4["output-view"], children: [
2495
+ /* @__PURE__ */ jsx("div", { className: style$4["output-content"], children: /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender, children: /* @__PURE__ */ jsx(
2349
2496
  viewer.render,
2350
2497
  {
2351
2498
  program: compilationResult.program,
@@ -2354,37 +2501,38 @@ const OutputViewInternal = ({
2354
2501
  onViewerStateChange
2355
2502
  }
2356
2503
  ) }) }),
2357
- /* @__PURE__ */ jsx("div", { className: style$3["viewer-tabs-container"], children: /* @__PURE__ */ jsx(
2504
+ /* @__PURE__ */ jsx("div", { className: style$4["viewer-tabs-container"], children: /* @__PURE__ */ jsx(
2358
2505
  TabList,
2359
2506
  {
2360
2507
  vertical: true,
2361
2508
  size: "large",
2362
2509
  selectedValue: selected,
2363
2510
  onTabSelect,
2364
- className: style$3["viewer-tabs"],
2511
+ className: style$4["viewer-tabs"],
2365
2512
  children: viewerList.map((viewer2) => {
2366
- return /* @__PURE__ */ jsx(Tab, { value: viewer2.key, className: style$3["viewer-tab"], children: /* @__PURE__ */ jsx("span", { title: viewer2.label, children: viewer2.icon }) }, viewer2.key);
2513
+ return /* @__PURE__ */ jsx(Tab, { value: viewer2.key, className: style$4["viewer-tab"], children: /* @__PURE__ */ jsx("span", { title: viewer2.label, children: viewer2.icon }) }, viewer2.key);
2367
2514
  })
2368
2515
  }
2369
2516
  ) })
2370
2517
  ] });
2371
2518
  };
2372
2519
  function fallbackRender({ error, resetErrorBoundary }) {
2373
- return /* @__PURE__ */ jsxs("div", { role: "alert", className: style$3["viewer-error"], children: [
2520
+ return /* @__PURE__ */ jsxs("div", { role: "alert", className: style$4["viewer-error"], children: [
2374
2521
  /* @__PURE__ */ jsx("h2", { children: "Something went wrong:" }),
2375
2522
  /* @__PURE__ */ jsx("div", { style: { color: "red" }, children: String(error) }),
2376
2523
  /* @__PURE__ */ jsx(Button, { onClick: resetErrorBoundary, children: "Try again" })
2377
2524
  ] });
2378
2525
  }
2379
2526
 
2380
- const layout = "_layout_l03ni_1";
2381
- const style$2 = {
2527
+ const layout = "_layout_63onh_1";
2528
+ const style$3 = {
2382
2529
  layout: layout,
2383
- "edit-pane": "_edit-pane_l03ni_9"
2530
+ "edit-pane": "_edit-pane_63onh_9",
2531
+ "single-pane": "_single-pane_63onh_14"
2384
2532
  };
2385
2533
 
2386
2534
  const header = "_header_1qhql_1";
2387
- const style$1 = {
2535
+ const style$2 = {
2388
2536
  header: header,
2389
2537
  "header--error": "_header--error_1qhql_12",
2390
2538
  "error-icon": "_error-icon_1qhql_17",
@@ -2414,13 +2562,13 @@ const ProblemPaneHeader = memo(({ compilationState, ...props }) => {
2414
2562
  const warnings = diagnostics.filter((x) => x.severity === "warning");
2415
2563
  return /* @__PURE__ */ jsxs(Container, { status: errors.length > 0 ? "error" : "warning", ...props, children: [
2416
2564
  errors.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2417
- /* @__PURE__ */ jsx(ErrorCircle16Filled, { className: style$1["error-icon"] }),
2565
+ /* @__PURE__ */ jsx(ErrorCircle16Filled, { className: style$2["error-icon"] }),
2418
2566
  " ",
2419
2567
  errors.length,
2420
2568
  " errors"
2421
2569
  ] }) : null,
2422
2570
  warnings.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2423
- /* @__PURE__ */ jsx(Warning16Filled, { className: style$1["warning-icon"] }),
2571
+ /* @__PURE__ */ jsx(Warning16Filled, { className: style$2["warning-icon"] }),
2424
2572
  " ",
2425
2573
  warnings.length,
2426
2574
  " warnings"
@@ -2434,21 +2582,21 @@ const Container = ({ children, className, status, onClick, collaped }) => {
2434
2582
  role: "button",
2435
2583
  tabIndex: onClick === void 0 ? void 0 : 0,
2436
2584
  className: mergeClasses(
2437
- style$1["header"],
2438
- status === "error" && style$1["header--error"],
2439
- status === "warning" && style$1["header--warning"],
2585
+ style$2["header"],
2586
+ status === "error" && style$2["header--error"],
2587
+ status === "warning" && style$2["header--warning"],
2440
2588
  className
2441
2589
  ),
2442
2590
  onClick,
2443
2591
  onKeyDown: (evt) => (evt.code === "Enter" || evt.code === "Space") && onClick?.(evt),
2444
2592
  children: [
2445
- /* @__PURE__ */ jsx("div", { className: style$1["header-content"], children }),
2593
+ /* @__PURE__ */ jsx("div", { className: style$2["header-content"], children }),
2446
2594
  /* @__PURE__ */ jsx(
2447
2595
  ChevronDown16Regular,
2448
2596
  {
2449
2597
  className: mergeClasses(
2450
- style$1["header-chevron"],
2451
- collaped && style$1["header-chevron--collapsed"]
2598
+ style$2["header-chevron"],
2599
+ collaped && style$2["header-chevron--collapsed"]
2452
2600
  )
2453
2601
  }
2454
2602
  )
@@ -2457,7 +2605,7 @@ const Container = ({ children, className, status, onClick, collaped }) => {
2457
2605
  );
2458
2606
  };
2459
2607
 
2460
- const style = {
2608
+ const style$1 = {
2461
2609
  "problem-pane": "_problem-pane_kxgwp_1",
2462
2610
  "problem-content": "_problem-content_kxgwp_9",
2463
2611
  "no-problems": "_no-problems_kxgwp_12",
@@ -2470,7 +2618,7 @@ const ProblemPane = ({
2470
2618
  onHeaderClick,
2471
2619
  onDiagnosticSelected
2472
2620
  }) => {
2473
- return /* @__PURE__ */ jsxs("div", { className: style["problem-pane"], children: [
2621
+ return /* @__PURE__ */ jsxs("div", { className: style$1["problem-pane"], children: [
2474
2622
  /* @__PURE__ */ jsx(
2475
2623
  ProblemPaneHeader,
2476
2624
  {
@@ -2479,7 +2627,7 @@ const ProblemPane = ({
2479
2627
  collaped: collapsed
2480
2628
  }
2481
2629
  ),
2482
- /* @__PURE__ */ jsx("div", { className: style["problem-content"], "aria-hidden": collapsed, children: /* @__PURE__ */ jsx(
2630
+ /* @__PURE__ */ jsx("div", { className: style$1["problem-content"], "aria-hidden": collapsed, children: /* @__PURE__ */ jsx(
2483
2631
  ProblemPaneContent,
2484
2632
  {
2485
2633
  compilationState,
@@ -2496,10 +2644,10 @@ const ProblemPaneContent = ({
2496
2644
  return /* @__PURE__ */ jsx(Fragment, {});
2497
2645
  }
2498
2646
  if ("internalCompilerError" in compilationState) {
2499
- return /* @__PURE__ */ jsx("pre", { className: style["internal-compiler-error"], children: String(compilationState.internalCompilerError) });
2647
+ return /* @__PURE__ */ jsx("pre", { className: style$1["internal-compiler-error"], children: String(compilationState.internalCompilerError) });
2500
2648
  }
2501
2649
  const diagnostics = compilationState.program.diagnostics;
2502
- return diagnostics.length === 0 ? /* @__PURE__ */ jsx("div", { className: style["no-problems"], children: " No problems" }) : /* @__PURE__ */ jsx(DiagnosticList, { diagnostics, onDiagnosticSelected });
2650
+ return diagnostics.length === 0 ? /* @__PURE__ */ jsx("div", { className: style$1["no-problems"], children: " No problems" }) : /* @__PURE__ */ jsx(DiagnosticList, { diagnostics, onDiagnosticSelected });
2503
2651
  };
2504
2652
 
2505
2653
  function usePlaygroundState({
@@ -2599,6 +2747,42 @@ function usePlaygroundState({
2599
2747
  };
2600
2748
  }
2601
2749
 
2750
+ const style = {
2751
+ "view-toggle-bar": "_view-toggle-bar_1yl8k_1",
2752
+ "view-toggle-tabs": "_view-toggle-tabs_1yl8k_10",
2753
+ "view-toggle-actions": "_view-toggle-actions_1yl8k_14"
2754
+ };
2755
+
2756
+ const ViewToggle = ({
2757
+ viewMode,
2758
+ onViewModeChange,
2759
+ actions
2760
+ }) => {
2761
+ const onTabSelect = useCallback(
2762
+ (_, data) => {
2763
+ onViewModeChange(data.value);
2764
+ },
2765
+ [onViewModeChange]
2766
+ );
2767
+ return /* @__PURE__ */ jsxs("div", { className: style["view-toggle-bar"], children: [
2768
+ /* @__PURE__ */ jsxs(
2769
+ TabList,
2770
+ {
2771
+ size: "small",
2772
+ selectedValue: viewMode,
2773
+ onTabSelect,
2774
+ className: style["view-toggle-tabs"],
2775
+ children: [
2776
+ /* @__PURE__ */ jsx(Tab, { value: "editor", className: style["view-toggle-tab"], children: "TSP" }),
2777
+ /* @__PURE__ */ jsx(Tab, { value: "both", className: style["view-toggle-tab"], children: "Both" }),
2778
+ /* @__PURE__ */ jsx(Tab, { value: "output", className: style["view-toggle-tab"], children: "Output" })
2779
+ ]
2780
+ }
2781
+ ),
2782
+ actions && /* @__PURE__ */ jsx("div", { className: style["view-toggle-actions"], children: actions })
2783
+ ] });
2784
+ };
2785
+
2602
2786
  const Playground = (props) => {
2603
2787
  const { host, onSave } = props;
2604
2788
  const editorRef = useRef(void 0);
@@ -2753,53 +2937,66 @@ const Playground = (props) => {
2753
2937
  }
2754
2938
  };
2755
2939
  }, [host, typespecModel, onContentChange]);
2756
- return /* @__PURE__ */ jsx(PlaygroundContextProvider, { value: playgroundContext, children: /* @__PURE__ */ jsxs("div", { className: style$2["layout"], children: [
2940
+ const isMobile = useIsMobile();
2941
+ const [viewMode, setViewMode] = useState("editor");
2942
+ useEffect(() => {
2943
+ if (!isMobile) {
2944
+ setViewMode("both");
2945
+ } else {
2946
+ setViewMode("editor");
2947
+ }
2948
+ }, [isMobile]);
2949
+ const commandBar = /* @__PURE__ */ jsx(
2950
+ EditorCommandBar,
2951
+ {
2952
+ host,
2953
+ selectedEmitter,
2954
+ onSelectedEmitterChange,
2955
+ samples: props.samples,
2956
+ selectedSampleName,
2957
+ onSelectedSampleNameChange,
2958
+ saveCode,
2959
+ formatCode,
2960
+ fileBug: props.onFileBug ? fileBug : void 0,
2961
+ commandBarItems: props.commandBarItems
2962
+ }
2963
+ );
2964
+ const editorPanel = /* @__PURE__ */ jsx(
2965
+ EditorPanel,
2966
+ {
2967
+ host,
2968
+ model: typespecModel,
2969
+ actions: typespecEditorActions,
2970
+ editorOptions: props.editorOptions,
2971
+ onMount: onTypeSpecEditorMount,
2972
+ selectedEmitter,
2973
+ compilerOptions,
2974
+ onCompilerOptionsChange,
2975
+ onSelectedEmitterChange,
2976
+ commandBar: isMobile ? void 0 : commandBar
2977
+ }
2978
+ );
2979
+ const outputPanel = /* @__PURE__ */ jsx(
2980
+ OutputView,
2981
+ {
2982
+ compilationState,
2983
+ editorOptions: props.editorOptions,
2984
+ viewers: props.viewers,
2985
+ fileViewers: selectedEmitter ? props.emitterViewers?.[selectedEmitter] : void 0,
2986
+ selectedViewer,
2987
+ onViewerChange: onSelectedViewerChange,
2988
+ viewerState,
2989
+ onViewerStateChange
2990
+ }
2991
+ );
2992
+ const mainContent = viewMode === "both" ? /* @__PURE__ */ jsxs(SplitPane, { initialSizes: ["50%", "50%"], children: [
2993
+ /* @__PURE__ */ jsx(Pane, { className: style$3["edit-pane"], children: editorPanel }),
2994
+ /* @__PURE__ */ jsx(Pane, { children: outputPanel })
2995
+ ] }) : viewMode === "editor" ? /* @__PURE__ */ jsx("div", { className: style$3["single-pane"], children: editorPanel }) : /* @__PURE__ */ jsx("div", { className: style$3["single-pane"], children: outputPanel });
2996
+ return /* @__PURE__ */ jsx(PlaygroundContextProvider, { value: playgroundContext, children: /* @__PURE__ */ jsxs("div", { className: style$3["layout"], children: [
2997
+ isMobile && /* @__PURE__ */ jsx(ViewToggle, { viewMode, onViewModeChange: setViewMode, actions: commandBar }),
2757
2998
  /* @__PURE__ */ jsxs(SplitPane, { sizes: verticalPaneSizes, onChange: onVerticalPaneSizeChange, split: "horizontal", children: [
2758
- /* @__PURE__ */ jsx(Pane, { children: /* @__PURE__ */ jsxs(SplitPane, { initialSizes: ["50%", "50%"], children: [
2759
- /* @__PURE__ */ jsx(Pane, { className: style$2["edit-pane"], children: /* @__PURE__ */ jsx(
2760
- EditorPanel,
2761
- {
2762
- host,
2763
- model: typespecModel,
2764
- actions: typespecEditorActions,
2765
- editorOptions: props.editorOptions,
2766
- onMount: onTypeSpecEditorMount,
2767
- selectedEmitter,
2768
- compilerOptions,
2769
- onCompilerOptionsChange,
2770
- onSelectedEmitterChange,
2771
- commandBar: /* @__PURE__ */ jsx(
2772
- EditorCommandBar,
2773
- {
2774
- host,
2775
- selectedEmitter,
2776
- onSelectedEmitterChange,
2777
- samples: props.samples,
2778
- selectedSampleName,
2779
- onSelectedSampleNameChange,
2780
- saveCode,
2781
- formatCode,
2782
- fileBug: props.onFileBug ? fileBug : void 0,
2783
- commandBarButtons: props.commandBarButtons,
2784
- documentationUrl: props.links?.documentationUrl
2785
- }
2786
- )
2787
- }
2788
- ) }),
2789
- /* @__PURE__ */ jsx(Pane, { children: /* @__PURE__ */ jsx(
2790
- OutputView,
2791
- {
2792
- compilationState,
2793
- editorOptions: props.editorOptions,
2794
- viewers: props.viewers,
2795
- fileViewers: selectedEmitter ? props.emitterViewers?.[selectedEmitter] : void 0,
2796
- selectedViewer,
2797
- onViewerChange: onSelectedViewerChange,
2798
- viewerState,
2799
- onViewerStateChange
2800
- }
2801
- ) })
2802
- ] }) }),
2999
+ /* @__PURE__ */ jsx(Pane, { children: mainContent }),
2803
3000
  /* @__PURE__ */ jsx(Pane, { minSize: 30, children: /* @__PURE__ */ jsx(
2804
3001
  ProblemPane,
2805
3002
  {