@typespec/playground 0.13.0-dev.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react/index.js
CHANGED
|
@@ -1311,12 +1311,13 @@ const EmitterOptionsForm = ({
|
|
|
1311
1311
|
}
|
|
1312
1312
|
const entries = Object.entries(emitterOptionsSchema);
|
|
1313
1313
|
return /* @__PURE__ */ jsx("div", { className: style$8["form"], children: entries.map(([key, value]) => {
|
|
1314
|
-
|
|
1314
|
+
const resolved = value.oneOf ? resolveOneOfProperty(value) : value;
|
|
1315
|
+
return /* @__PURE__ */ jsx("div", { className: style$8["form-item"], children: resolved.type === "array" ? /* @__PURE__ */ jsx(
|
|
1315
1316
|
JsonSchemaArrayPropertyInput,
|
|
1316
1317
|
{
|
|
1317
1318
|
emitterOptions: options[library.name] ?? {},
|
|
1318
1319
|
name: key,
|
|
1319
|
-
prop:
|
|
1320
|
+
prop: resolved,
|
|
1320
1321
|
onChange: handleChange
|
|
1321
1322
|
}
|
|
1322
1323
|
) : /* @__PURE__ */ jsx(
|
|
@@ -1324,12 +1325,22 @@ const EmitterOptionsForm = ({
|
|
|
1324
1325
|
{
|
|
1325
1326
|
emitterOptions: options[library.name] ?? {},
|
|
1326
1327
|
name: key,
|
|
1327
|
-
prop:
|
|
1328
|
+
prop: resolved,
|
|
1328
1329
|
onChange: handleChange
|
|
1329
1330
|
}
|
|
1330
1331
|
) }, key);
|
|
1331
1332
|
}) });
|
|
1332
1333
|
};
|
|
1334
|
+
function resolveOneOfProperty(prop) {
|
|
1335
|
+
const arrayBranch = prop.oneOf.find(
|
|
1336
|
+
(branch) => branch.type === "array"
|
|
1337
|
+
);
|
|
1338
|
+
if (arrayBranch) {
|
|
1339
|
+
return { ...arrayBranch, description: arrayBranch.description ?? prop.description };
|
|
1340
|
+
}
|
|
1341
|
+
const first = prop.oneOf[0];
|
|
1342
|
+
return { ...first, description: first.description ?? prop.description };
|
|
1343
|
+
}
|
|
1333
1344
|
const JsonSchemaArrayPropertyInput = ({
|
|
1334
1345
|
emitterOptions,
|
|
1335
1346
|
name,
|
|
@@ -1337,7 +1348,8 @@ const JsonSchemaArrayPropertyInput = ({
|
|
|
1337
1348
|
onChange
|
|
1338
1349
|
}) => {
|
|
1339
1350
|
const itemsSchema = prop.items;
|
|
1340
|
-
const
|
|
1351
|
+
const rawValue = emitterOptions[name] ?? itemsSchema.default;
|
|
1352
|
+
const value = Array.isArray(rawValue) ? rawValue : rawValue != null ? [rawValue] : [];
|
|
1341
1353
|
const prettyName = useMemo(
|
|
1342
1354
|
() => name[0].toUpperCase() + name.slice(1).replace(/-/g, " "),
|
|
1343
1355
|
[name]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter-options-form.d.ts","sourceRoot":"","sources":["../../../../src/react/settings/emitter-options-form.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"emitter-options-form.d.ts","sourceRoot":"","sources":["../../../../src/react/settings/emitter-options-form.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,CAoDzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/playground",
|
|
3
|
-
"version": "0.13.0
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec playground UI components.",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -61,15 +61,6 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@fluentui/react-components": "~9.73.1",
|
|
63
63
|
"@fluentui/react-icons": "^2.0.292",
|
|
64
|
-
"@typespec/bundler": "^0.5.0 || >= 0.5.1-dev.1",
|
|
65
|
-
"@typespec/compiler": "^1.9.0 || >= 1.10.0-dev.8",
|
|
66
|
-
"@typespec/html-program-viewer": "^0.79.0 || >= 0.80.0-dev.2",
|
|
67
|
-
"@typespec/http": "^1.9.1 || >= 1.10.0-dev.3",
|
|
68
|
-
"@typespec/openapi": "^1.9.0 || >= 1.10.0-dev.4",
|
|
69
|
-
"@typespec/openapi3": "^1.9.0 || >= 1.10.0-dev.6",
|
|
70
|
-
"@typespec/protobuf": "^0.79.0 || >= 0.80.0-dev.2",
|
|
71
|
-
"@typespec/rest": "^0.79.0 || >= 0.80.0-dev.2",
|
|
72
|
-
"@typespec/versioning": "^0.79.0 || >= 0.80.0-dev.2",
|
|
73
64
|
"clsx": "^2.1.1",
|
|
74
65
|
"debounce": "~3.0.0",
|
|
75
66
|
"lzutf8": "0.6.3",
|
|
@@ -80,7 +71,16 @@
|
|
|
80
71
|
"swagger-ui-dist": "^5.20.1",
|
|
81
72
|
"yaml": "~2.8.2",
|
|
82
73
|
"vscode-languageserver": "~9.0.1",
|
|
83
|
-
"vscode-languageserver-textdocument": "~1.0.12"
|
|
74
|
+
"vscode-languageserver-textdocument": "~1.0.12",
|
|
75
|
+
"@typespec/compiler": "^1.10.0",
|
|
76
|
+
"@typespec/bundler": "^0.5.1",
|
|
77
|
+
"@typespec/http": "^1.10.0",
|
|
78
|
+
"@typespec/html-program-viewer": "^0.80.0",
|
|
79
|
+
"@typespec/openapi": "^1.10.0",
|
|
80
|
+
"@typespec/openapi3": "^1.10.0",
|
|
81
|
+
"@typespec/protobuf": "^0.80.0",
|
|
82
|
+
"@typespec/rest": "^0.80.0",
|
|
83
|
+
"@typespec/versioning": "^0.80.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@babel/core": "^7.26.10",
|
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
"@types/react": "~19.2.7",
|
|
93
93
|
"@types/react-dom": "~19.2.2",
|
|
94
94
|
"@types/swagger-ui-dist": "~3.30.5",
|
|
95
|
-
"@typespec/bundler": "^0.5.0 || >= 0.5.1-dev.1",
|
|
96
95
|
"@vitejs/plugin-react": "~5.1.2",
|
|
97
96
|
"c8": "^11.0.0",
|
|
98
97
|
"cross-env": "~10.1.0",
|
|
@@ -103,6 +102,7 @@
|
|
|
103
102
|
"vite": "^7.2.7",
|
|
104
103
|
"vite-plugin-checker": "^0.12.0",
|
|
105
104
|
"vite-plugin-dts": "4.5.4",
|
|
105
|
+
"@typespec/bundler": "^0.5.1",
|
|
106
106
|
"@typespec/react-components": "^0.57.0"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|