@umami/shiso 1.14.0 → 1.15.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/chunks/App.js
CHANGED
|
@@ -8151,21 +8151,21 @@ function operationSections(operation) {
|
|
|
8151
8151
|
//#endregion
|
|
8152
8152
|
//#region src/components/OpenApiOperation.tsx
|
|
8153
8153
|
function FieldChildren({ node }) {
|
|
8154
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
})
|
|
8168
|
-
|
|
8154
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [node.description, node.enum && node.enum.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
8155
|
+
className: "mt-1",
|
|
8156
|
+
children: [
|
|
8157
|
+
"Options:",
|
|
8158
|
+
" ",
|
|
8159
|
+
node.enum.map((value, index) => /* @__PURE__ */ jsxs("span", { children: [index > 0 && ", ", /* @__PURE__ */ jsx("code", { children: value })] }, value))
|
|
8160
|
+
]
|
|
8161
|
+
})] });
|
|
8162
|
+
}
|
|
8163
|
+
function schemaDetails(node) {
|
|
8164
|
+
if (!node.children?.length) return void 0;
|
|
8165
|
+
return /* @__PURE__ */ jsx(Expandable, {
|
|
8166
|
+
title: node.type === "oneOf" || node.type === "anyOf" ? "Allowed types" : "properties",
|
|
8167
|
+
children: /* @__PURE__ */ jsx(SchemaTable, { nodes: node.children })
|
|
8168
|
+
});
|
|
8169
8169
|
}
|
|
8170
8170
|
function SchemaTable({ nodes }) {
|
|
8171
8171
|
return /* @__PURE__ */ jsx(PropertiesTable, { children: nodes.map((node) => /* @__PURE__ */ jsx(PropertiesTable.Row, {
|
|
@@ -8174,12 +8174,14 @@ function SchemaTable({ nodes }) {
|
|
|
8174
8174
|
required: node.required,
|
|
8175
8175
|
deprecated: node.deprecated,
|
|
8176
8176
|
default: node.default,
|
|
8177
|
+
details: schemaDetails(node),
|
|
8177
8178
|
children: /* @__PURE__ */ jsx(FieldChildren, { node })
|
|
8178
8179
|
}, node.name || node.type)) });
|
|
8179
8180
|
}
|
|
8180
8181
|
/** Renders a schema tree: a root object's properties, or the node itself. */
|
|
8181
8182
|
function SchemaFields({ node }) {
|
|
8182
|
-
|
|
8183
|
+
const isUnion = node.type === "oneOf" || node.type === "anyOf";
|
|
8184
|
+
return /* @__PURE__ */ jsx(SchemaTable, { nodes: !node.name && !isUnion && node.children?.length ? node.children : [node] });
|
|
8183
8185
|
}
|
|
8184
8186
|
function HighlightedCode({ language, title, html, source, lineCount }) {
|
|
8185
8187
|
return /* @__PURE__ */ jsx(CodeBlock, {
|
|
@@ -8219,6 +8221,7 @@ function OpenApiOperation({ operation }) {
|
|
|
8219
8221
|
required: parameter.required,
|
|
8220
8222
|
deprecated: parameter.deprecated,
|
|
8221
8223
|
default: parameter.default,
|
|
8224
|
+
details: schemaDetails(parameter),
|
|
8222
8225
|
children: /* @__PURE__ */ jsx(FieldChildren, { node: parameter })
|
|
8223
8226
|
}, parameter.name))] })] }, location)),
|
|
8224
8227
|
operation.requestBody && /* @__PURE__ */ jsxs("section", { children: [
|
package/dist/chunks/docs.js
CHANGED
|
@@ -12277,9 +12277,10 @@ function PropertiesTable({ children }) {
|
|
|
12277
12277
|
const rows = toElementArray(children);
|
|
12278
12278
|
if (!rows.length) return null;
|
|
12279
12279
|
return /* @__PURE__ */ jsx("div", {
|
|
12280
|
+
"data-slot": "properties-table",
|
|
12280
12281
|
className: "my-4 overflow-x-auto",
|
|
12281
12282
|
children: /* @__PURE__ */ jsxs("table", {
|
|
12282
|
-
className: "m-0
|
|
12283
|
+
className: "m-0 table-fixed [overflow-wrap:anywhere]",
|
|
12283
12284
|
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
12284
12285
|
/* @__PURE__ */ jsx("th", {
|
|
12285
12286
|
className: "w-[30%]",
|
|
@@ -12294,9 +12295,9 @@ function PropertiesTable({ children }) {
|
|
|
12294
12295
|
})
|
|
12295
12296
|
});
|
|
12296
12297
|
}
|
|
12297
|
-
function PropertiesTableRow({ name, type, required, deprecated, default: value, children }) {
|
|
12298
|
+
function PropertiesTableRow({ name, type, required, deprecated, default: value, children, details }) {
|
|
12298
12299
|
const defaultValue = displayValue(value);
|
|
12299
|
-
return /* @__PURE__ */ jsxs("tr", { children: [
|
|
12300
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", { children: [
|
|
12300
12301
|
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("span", {
|
|
12301
12302
|
className: "inline-flex flex-wrap items-center gap-2",
|
|
12302
12303
|
children: [
|
|
@@ -12320,7 +12321,11 @@ function PropertiesTableRow({ name, type, required, deprecated, default: value,
|
|
|
12320
12321
|
children: ["Default: ", defaultValue]
|
|
12321
12322
|
}) : null]
|
|
12322
12323
|
})
|
|
12323
|
-
] })
|
|
12324
|
+
] }), details && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
12325
|
+
colSpan: 3,
|
|
12326
|
+
className: "[&>[data-slot=collapsible]]:my-0 [&_[data-slot=collapsible-trigger]]:py-1 [&_[data-slot=properties-table]]:my-2",
|
|
12327
|
+
children: details
|
|
12328
|
+
}) })] });
|
|
12324
12329
|
}
|
|
12325
12330
|
PropertiesTable.Row = PropertiesTableRow;
|
|
12326
12331
|
|
package/package.json
CHANGED
package/scripts/lib/openapi.mjs
CHANGED
|
@@ -97,7 +97,7 @@ function typeLabel(spec, schema) {
|
|
|
97
97
|
return `enum<${baseType(schema)}>`;
|
|
98
98
|
}
|
|
99
99
|
if (schema.oneOf || schema.anyOf) {
|
|
100
|
-
return 'oneOf';
|
|
100
|
+
return schema.oneOf ? 'oneOf' : 'anyOf';
|
|
101
101
|
}
|
|
102
102
|
if (schema.type === 'array' || (Array.isArray(schema.type) && schema.type.includes('array'))) {
|
|
103
103
|
const items = schema.items ? deref(spec, schema.items) : undefined;
|
|
@@ -159,6 +159,23 @@ export function schemaTree(spec, schema, { name, required, seen = new Set(), dep
|
|
|
159
159
|
depth: depth + 1,
|
|
160
160
|
}),
|
|
161
161
|
);
|
|
162
|
+
// Plain scalar alternatives fit in the type cell; keep richer variants
|
|
163
|
+
// expanded so descriptions, constraints, and nested properties remain visible.
|
|
164
|
+
if (
|
|
165
|
+
variants.length <= MAX_CHILDREN &&
|
|
166
|
+
node.children.every(
|
|
167
|
+
child =>
|
|
168
|
+
/^(string|number|integer|boolean|null)$/.test(child.type) &&
|
|
169
|
+
!child.description &&
|
|
170
|
+
!child.enum &&
|
|
171
|
+
child.default === undefined &&
|
|
172
|
+
!child.deprecated &&
|
|
173
|
+
!child.children?.length,
|
|
174
|
+
)
|
|
175
|
+
) {
|
|
176
|
+
node.type = [...new Set(node.children.map(child => child.type))].join(' | ');
|
|
177
|
+
delete node.children;
|
|
178
|
+
}
|
|
162
179
|
return node;
|
|
163
180
|
}
|
|
164
181
|
|
|
@@ -21,15 +21,22 @@ function FieldChildren({ node }: { node: SchemaNode }) {
|
|
|
21
21
|
))}
|
|
22
22
|
</div>
|
|
23
23
|
)}
|
|
24
|
-
{node.children && node.children.length > 0 && (
|
|
25
|
-
<Expandable title="properties">
|
|
26
|
-
<SchemaTable nodes={node.children} />
|
|
27
|
-
</Expandable>
|
|
28
|
-
)}
|
|
29
24
|
</>
|
|
30
25
|
);
|
|
31
26
|
}
|
|
32
27
|
|
|
28
|
+
function schemaDetails(node: SchemaNode) {
|
|
29
|
+
if (!node.children?.length) return undefined;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Expandable
|
|
33
|
+
title={node.type === 'oneOf' || node.type === 'anyOf' ? 'Allowed types' : 'properties'}
|
|
34
|
+
>
|
|
35
|
+
<SchemaTable nodes={node.children} />
|
|
36
|
+
</Expandable>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
function SchemaTable({ nodes }: { nodes: SchemaNode[] }) {
|
|
34
41
|
return (
|
|
35
42
|
<PropertiesTable>
|
|
@@ -41,6 +48,7 @@ function SchemaTable({ nodes }: { nodes: SchemaNode[] }) {
|
|
|
41
48
|
required={node.required}
|
|
42
49
|
deprecated={node.deprecated}
|
|
43
50
|
default={node.default}
|
|
51
|
+
details={schemaDetails(node)}
|
|
44
52
|
>
|
|
45
53
|
<FieldChildren node={node} />
|
|
46
54
|
</PropertiesTable.Row>
|
|
@@ -51,7 +59,10 @@ function SchemaTable({ nodes }: { nodes: SchemaNode[] }) {
|
|
|
51
59
|
|
|
52
60
|
/** Renders a schema tree: a root object's properties, or the node itself. */
|
|
53
61
|
function SchemaFields({ node }: { node: SchemaNode }) {
|
|
54
|
-
|
|
62
|
+
const isUnion = node.type === 'oneOf' || node.type === 'anyOf';
|
|
63
|
+
return (
|
|
64
|
+
<SchemaTable nodes={!node.name && !isUnion && node.children?.length ? node.children : [node]} />
|
|
65
|
+
);
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
function HighlightedCode({
|
|
@@ -115,6 +126,7 @@ export function OpenApiOperation({ operation }: OpenApiOperationProps) {
|
|
|
115
126
|
required={parameter.required}
|
|
116
127
|
deprecated={parameter.deprecated}
|
|
117
128
|
default={parameter.default}
|
|
129
|
+
details={schemaDetails(parameter)}
|
|
118
130
|
>
|
|
119
131
|
<FieldChildren node={parameter} />
|
|
120
132
|
</PropertiesTable.Row>
|
|
@@ -10,6 +10,7 @@ export interface PropertiesTableRowProps {
|
|
|
10
10
|
default?: FieldValue;
|
|
11
11
|
required?: boolean;
|
|
12
12
|
deprecated?: boolean;
|
|
13
|
+
details?: ReactNode;
|
|
13
14
|
children?: ReactNode;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -35,8 +36,8 @@ export function PropertiesTable({ children }: PropertiesTableProps) {
|
|
|
35
36
|
// Rendered as a plain table so the .docs-markdown table rules in global.css
|
|
36
37
|
// style it exactly like a GFM table; only column widths are set here.
|
|
37
38
|
return (
|
|
38
|
-
<div className="my-4 overflow-x-auto">
|
|
39
|
-
<table className="m-0
|
|
39
|
+
<div data-slot="properties-table" className="my-4 overflow-x-auto">
|
|
40
|
+
<table className="m-0 table-fixed [overflow-wrap:anywhere]">
|
|
40
41
|
<thead>
|
|
41
42
|
<tr>
|
|
42
43
|
<th className="w-[30%]">Name</th>
|
|
@@ -57,30 +58,43 @@ function PropertiesTableRow({
|
|
|
57
58
|
deprecated,
|
|
58
59
|
default: value,
|
|
59
60
|
children,
|
|
61
|
+
details,
|
|
60
62
|
}: PropertiesTableRowProps) {
|
|
61
63
|
const defaultValue = displayValue(value);
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
<>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>
|
|
69
|
+
<span className="inline-flex flex-wrap items-center gap-2">
|
|
70
|
+
{name}
|
|
71
|
+
{required ? (
|
|
72
|
+
<Badge size="sm" tone="primary">
|
|
73
|
+
required
|
|
74
|
+
</Badge>
|
|
75
|
+
) : null}
|
|
76
|
+
{deprecated ? <Badge size="sm">deprecated</Badge> : null}
|
|
77
|
+
</span>
|
|
78
|
+
</td>
|
|
79
|
+
<td>{displayValue(type)}</td>
|
|
80
|
+
<td className="[&_p]:m-0">
|
|
81
|
+
{children}
|
|
82
|
+
{defaultValue ? (
|
|
83
|
+
<span className="mt-1 block text-muted-foreground">Default: {defaultValue}</span>
|
|
72
84
|
) : null}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
{details && (
|
|
88
|
+
<tr>
|
|
89
|
+
<td
|
|
90
|
+
colSpan={3}
|
|
91
|
+
className="[&>[data-slot=collapsible]]:my-0 [&_[data-slot=collapsible-trigger]]:py-1 [&_[data-slot=properties-table]]:my-2"
|
|
92
|
+
>
|
|
93
|
+
{details}
|
|
94
|
+
</td>
|
|
95
|
+
</tr>
|
|
96
|
+
)}
|
|
97
|
+
</>
|
|
84
98
|
);
|
|
85
99
|
}
|
|
86
100
|
|