@typespec/html-program-viewer 0.73.0-dev.2 → 0.73.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.
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0, { useRef, useState, useMemo, useCallback, useEffect, useId, createContext, useContext } from 'react';
|
|
2
|
-
import { mergeClasses, Breadcrumb, BreadcrumbItem, BreadcrumbButton, BreadcrumbDivider, Combobox, Option, Caption1, Card, CardHeader, Text, Divider } from '@fluentui/react-components';
|
|
3
|
-
import { ChevronDownRegular, ChevronRightRegular, AppsListRegular, DatabaseRegular } from '@fluentui/react-icons';
|
|
2
|
+
import { mergeClasses, Breadcrumb, BreadcrumbItem, BreadcrumbButton, BreadcrumbDivider, Combobox, Option, Caption1, Card, CardHeader, Text, Tooltip, Button, tokens, Divider } from '@fluentui/react-components';
|
|
3
|
+
import { ChevronDownRegular, ChevronRightRegular, AppsListRegular, DatabaseRegular, BookmarkFilled, BookmarkRegular } from '@fluentui/react-icons';
|
|
4
4
|
import { useHotkeys } from 'react-hotkeys-hook';
|
|
5
5
|
import { List, ListItem } from '@fluentui/react-list';
|
|
6
6
|
|
|
@@ -34312,7 +34312,7 @@ let manifest;
|
|
|
34312
34312
|
try {
|
|
34313
34313
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34314
34314
|
// @ts-ignore
|
|
34315
|
-
manifest = (await import('../manifest-
|
|
34315
|
+
manifest = (await import('../manifest-B5OFB_6C.js')).default;
|
|
34316
34316
|
}
|
|
34317
34317
|
catch {
|
|
34318
34318
|
const name = "../dist/manifest.js";
|
|
@@ -46441,20 +46441,34 @@ function isTypeSpecType(data) {
|
|
|
46441
46441
|
return typeof data === "object" && data !== null && "entityKind" in data && data.entityKind === "Type" && "kind" in data;
|
|
46442
46442
|
}
|
|
46443
46443
|
|
|
46444
|
-
const main = "
|
|
46445
|
-
const header = "
|
|
46446
|
-
const doc = "
|
|
46444
|
+
const main = "_main_12y74_7";
|
|
46445
|
+
const header = "_header_12y74_11";
|
|
46446
|
+
const doc = "_doc_12y74_35";
|
|
46447
46447
|
const style = {
|
|
46448
|
-
"type-view": "_type-
|
|
46448
|
+
"type-view": "_type-view_12y74_1",
|
|
46449
46449
|
main: main,
|
|
46450
|
-
"header-section": "_header-
|
|
46451
|
-
"inspect-section": "_inspect-
|
|
46450
|
+
"header-section": "_header-section_12y74_11",
|
|
46451
|
+
"inspect-section": "_inspect-section_12y74_15",
|
|
46452
46452
|
header: header,
|
|
46453
|
+
"header-left": "_header-left_12y74_25",
|
|
46454
|
+
"header-spacer": "_header-spacer_12y74_31",
|
|
46453
46455
|
doc: doc
|
|
46454
46456
|
};
|
|
46455
46457
|
|
|
46456
46458
|
const TypeNodeView = ({ node }) => {
|
|
46457
46459
|
const program = useProgram();
|
|
46460
|
+
const [isVarSet, setIsVarSet] = useState(() => Boolean(window.vars?.[node.name]));
|
|
46461
|
+
const handleSaveType = () => setIsVarSet((x) => !x);
|
|
46462
|
+
useEffect(() => {
|
|
46463
|
+
if (isVarSet) {
|
|
46464
|
+
if (!window.vars) window.vars = {};
|
|
46465
|
+
window.vars[node.name] = node.type;
|
|
46466
|
+
} else {
|
|
46467
|
+
if (window.vars) {
|
|
46468
|
+
delete window.vars[node.name];
|
|
46469
|
+
}
|
|
46470
|
+
}
|
|
46471
|
+
}, [node.name, node.type, isVarSet]);
|
|
46458
46472
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: style["type-view"], children: [
|
|
46459
46473
|
/* @__PURE__ */ jsxRuntimeExports$1.jsxs(Card, { className: style["main"], children: [
|
|
46460
46474
|
/* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
@@ -46462,8 +46476,20 @@ const TypeNodeView = ({ node }) => {
|
|
|
46462
46476
|
{
|
|
46463
46477
|
className: style["header-section"],
|
|
46464
46478
|
header: /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: style["header"], children: [
|
|
46465
|
-
/* @__PURE__ */ jsxRuntimeExports$1.
|
|
46466
|
-
|
|
46479
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { className: style["header-left"], children: [
|
|
46480
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(TypeKindTag, { type: node.type }),
|
|
46481
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(Text, { weight: "semibold", size: 500, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(Mono, { children: node.name }) })
|
|
46482
|
+
] }),
|
|
46483
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: style["header-spacer"] }),
|
|
46484
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(Tooltip, { content: `Save as vars.${node.name}`, relationship: "label", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
46485
|
+
Button,
|
|
46486
|
+
{
|
|
46487
|
+
icon: isVarSet ? /* @__PURE__ */ jsxRuntimeExports$1.jsx(BookmarkFilled, { style: { color: tokens.colorBrandBackground } }) : /* @__PURE__ */ jsxRuntimeExports$1.jsx(BookmarkRegular, {}),
|
|
46488
|
+
onClick: handleSaveType,
|
|
46489
|
+
size: "small",
|
|
46490
|
+
appearance: "subtle"
|
|
46491
|
+
}
|
|
46492
|
+
) })
|
|
46467
46493
|
] }),
|
|
46468
46494
|
description: /* @__PURE__ */ jsxRuntimeExports$1.jsx(Caption1, { className: style["doc"], children: getDoc(program, node.type) })
|
|
46469
46495
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeNavigator, TypeGraphTypeNode } from '../use-tree-navigation.js';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
vars?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
2
7
|
export interface TypeNodeViewProps {
|
|
3
8
|
readonly nav: TreeNavigator;
|
|
4
9
|
readonly node: TypeGraphTypeNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-view.d.ts","sourceRoot":"","sources":["../../../src/react/type-view/type-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-view.d.ts","sourceRoot":"","sources":["../../../src/react/type-view/type-view.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGlF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,iBAAiB,4CA+DvD,CAAC"}
|
package/dist/style.css
CHANGED
|
@@ -215,30 +215,40 @@
|
|
|
215
215
|
background-color: var(--colorPaletteBerryForeground2);
|
|
216
216
|
color: white;
|
|
217
217
|
}
|
|
218
|
-
._type-
|
|
218
|
+
._type-view_12y74_1 {
|
|
219
219
|
display: flex;
|
|
220
220
|
flex-direction: column;
|
|
221
221
|
gap: 20px;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
.
|
|
224
|
+
._main_12y74_7 {
|
|
225
225
|
padding: var(--fui-Card--size) 0 !important;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
._header-
|
|
228
|
+
._header-section_12y74_11 {
|
|
229
229
|
padding: 0 var(--fui-Card--size);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
._inspect-
|
|
232
|
+
._inspect-section_12y74_15 {
|
|
233
233
|
padding: 0 var(--fui-Card--size);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
.
|
|
236
|
+
._header_12y74_11 {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
width: 100%;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
._header-left_12y74_25 {
|
|
237
243
|
display: flex;
|
|
238
244
|
align-items: center;
|
|
239
245
|
gap: 10px;
|
|
240
246
|
}
|
|
241
247
|
|
|
242
|
-
.
|
|
248
|
+
._header-spacer_12y74_31 {
|
|
249
|
+
margin-left: auto;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
._doc_12y74_35 {
|
|
243
253
|
color: var(--colorNeutralForeground3);
|
|
244
254
|
}
|
package/package.json
CHANGED