@kestra-io/ui-libs 0.0.263 → 0.0.264
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/{VueFlowUtils-D6fVYEkI.js → VueFlowUtils-DifPO0kH.js} +1229 -1261
- package/dist/VueFlowUtils-DifPO0kH.js.map +1 -0
- package/dist/VueFlowUtils-DjetWQIy.cjs +2 -0
- package/dist/VueFlowUtils-DjetWQIy.cjs.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/misc/Collapsible.vue.d.ts.map +1 -1
- package/dist/components/misc/ElementCard.vue.d.ts +25 -0
- package/dist/components/misc/ElementCard.vue.d.ts.map +1 -0
- package/dist/components/misc/Status.vue.d.ts.map +1 -1
- package/dist/components/misc/SubgroupCard.vue.d.ts +20 -0
- package/dist/components/misc/SubgroupCard.vue.d.ts.map +1 -0
- package/dist/components/nodes/EdgeNode.vue.d.ts.map +1 -1
- package/dist/components/plugins/CollapsibleProperties.vue.d.ts.map +1 -1
- package/dist/components/plugins/PluginIndex.vue.d.ts +13 -3
- package/dist/components/plugins/PluginIndex.vue.d.ts.map +1 -1
- package/dist/components/plugins/PropertyDetail.vue.d.ts.map +1 -1
- package/dist/components/plugins/SchemaToHtml.vue.d.ts.map +1 -1
- package/dist/components/plugins_v2/CollapsiblePropertiesV2.vue.d.ts +39 -0
- package/dist/components/plugins_v2/CollapsiblePropertiesV2.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/CollapsibleV2.vue.d.ts +34 -0
- package/dist/components/plugins_v2/CollapsibleV2.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/DefinitionCollapsible.vue.d.ts +34 -0
- package/dist/components/plugins_v2/DefinitionCollapsible.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/PropertyBadges.vue.d.ts +13 -0
- package/dist/components/plugins_v2/PropertyBadges.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/PropertyDetailV2.vue.d.ts +43 -0
- package/dist/components/plugins_v2/PropertyDetailV2.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/PropertyMeta.vue.d.ts +10 -0
- package/dist/components/plugins_v2/PropertyMeta.vue.d.ts.map +1 -0
- package/dist/components/plugins_v2/SchemaToHtmlV2.vue.d.ts +50 -0
- package/dist/components/plugins_v2/SchemaToHtmlV2.vue.d.ts.map +1 -0
- package/dist/components/topology/Topology.vue.d.ts +1 -1
- package/dist/composables/usePluginElementCounts.d.ts +13 -0
- package/dist/composables/usePluginElementCounts.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/kestra-index.cjs.js +15 -13
- package/dist/kestra-index.cjs.js.map +1 -1
- package/dist/kestra-index.es.js +4862 -4017
- package/dist/kestra-index.es.js.map +1 -1
- package/dist/kestra-vueflowutils.cjs.js +1 -1
- package/dist/kestra-vueflowutils.es.js +10 -10
- package/dist/ui-libs.css +1 -1
- package/dist/utils/Utils.d.ts +2 -0
- package/dist/utils/Utils.d.ts.map +1 -1
- package/dist/utils/VueFlowUtils.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +0 -39
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/plugins.d.ts +30 -0
- package/dist/utils/plugins.d.ts.map +1 -1
- package/dist/utils/schemaUtils.d.ts +6 -0
- package/dist/utils/schemaUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +4 -0
- package/src/components/misc/Collapsible.vue +7 -1
- package/src/components/misc/ElementCard.vue +132 -0
- package/src/components/misc/Status.vue +0 -1
- package/src/components/misc/SubgroupCard.vue +178 -0
- package/src/components/nodes/EdgeNode.vue +17 -1
- package/src/components/plugins/CollapsibleProperties.vue +2 -13
- package/src/components/plugins/PluginIndex.vue +166 -37
- package/src/components/plugins/PropertyDetail.vue +5 -5
- package/src/components/plugins/SchemaToHtml.vue +7 -3
- package/src/components/plugins_v2/CollapsiblePropertiesV2.vue +183 -0
- package/src/components/plugins_v2/CollapsibleV2.vue +121 -0
- package/src/components/plugins_v2/DefinitionCollapsible.vue +208 -0
- package/src/components/plugins_v2/PropertyBadges.vue +93 -0
- package/src/components/plugins_v2/PropertyDetailV2.vue +127 -0
- package/src/components/plugins_v2/PropertyMeta.vue +169 -0
- package/src/components/plugins_v2/SchemaToHtmlV2.vue +213 -0
- package/src/composables/usePluginElementCounts.ts +16 -0
- package/src/index.ts +2 -1
- package/src/scss/_variables.scss +69 -0
- package/src/utils/Utils.ts +5 -0
- package/src/utils/VueFlowUtils.ts +10 -2
- package/src/utils/constants.ts +0 -45
- package/src/utils/plugins.ts +76 -1
- package/src/utils/schemaUtils.ts +45 -1
- package/dist/VueFlowUtils-CF-L3pYu.cjs +0 -2
- package/dist/VueFlowUtils-CF-L3pYu.cjs.map +0 -1
- package/dist/VueFlowUtils-D6fVYEkI.js.map +0 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Collapsible class="section-collapsible" :title="sectionName" :href="href" @expand="emit('expand')" :initially-expanded="initiallyExpanded || autoExpanded" :no-url-change="noUrlChange">
|
|
3
|
+
<template v-if="Object.keys(properties ?? {}).length > 0" #content>
|
|
4
|
+
<div class="border overflow-hidden">
|
|
5
|
+
<Collapsible
|
|
6
|
+
class="property"
|
|
7
|
+
v-for="(property, propertyKey) in sortedAndAggregated(properties)"
|
|
8
|
+
:key="propertyKey"
|
|
9
|
+
:title="propertyKey"
|
|
10
|
+
:href="href + '_' + propertyKey"
|
|
11
|
+
@expand="autoExpanded = true"
|
|
12
|
+
:no-url-change
|
|
13
|
+
:class="sectionClass"
|
|
14
|
+
>
|
|
15
|
+
<template #right>
|
|
16
|
+
<PropertyBadges :property="property" :show-dynamic="showDynamic" />
|
|
17
|
+
</template>
|
|
18
|
+
<template #content>
|
|
19
|
+
<PropertyDetail :property="property" :definitions="definitions" :section="sectionName.toLowerCase()">
|
|
20
|
+
<template #markdown="{content}">
|
|
21
|
+
<slot :content="content" name="markdown" />
|
|
22
|
+
</template>
|
|
23
|
+
</PropertyDetail>
|
|
24
|
+
</template>
|
|
25
|
+
</Collapsible>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
</Collapsible>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import {
|
|
33
|
+
type JSONProperty,
|
|
34
|
+
type JSONSchema,
|
|
35
|
+
aggregateAllOf
|
|
36
|
+
} from "../../utils/schemaUtils";
|
|
37
|
+
import Collapsible from "./CollapsibleV2.vue";
|
|
38
|
+
import PropertyDetail from "../plugins_v2/PropertyDetailV2.vue";
|
|
39
|
+
import PropertyBadges from "../plugins_v2/PropertyBadges.vue";
|
|
40
|
+
import {ref, watch, computed} from "vue";
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(defineProps<{
|
|
43
|
+
href?: string,
|
|
44
|
+
sectionName: string,
|
|
45
|
+
properties?: Record<string, JSONProperty>,
|
|
46
|
+
showDynamic?: boolean,
|
|
47
|
+
initiallyExpanded?: boolean,
|
|
48
|
+
forceInclude?: string[],
|
|
49
|
+
noUrlChange?: boolean,
|
|
50
|
+
definitions?: Record<string, JSONSchema>
|
|
51
|
+
}>(), {
|
|
52
|
+
properties: undefined,
|
|
53
|
+
href: Math.random().toString(36).substring(2, 5),
|
|
54
|
+
showDynamic: true,
|
|
55
|
+
initiallyExpanded: false,
|
|
56
|
+
forceInclude: () => [] as string[],
|
|
57
|
+
noUrlChange: false,
|
|
58
|
+
definitions: undefined
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const emit = defineEmits(["expand"]);
|
|
62
|
+
|
|
63
|
+
const sectionClass = computed(() => {
|
|
64
|
+
const name = props.sectionName.toLowerCase();
|
|
65
|
+
if (name === "properties") return "section-properties";
|
|
66
|
+
if (name === "outputs") return "section-outputs";
|
|
67
|
+
if (name === "metrics") return "section-metrics";
|
|
68
|
+
return "";
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const autoExpanded = ref(false);
|
|
72
|
+
|
|
73
|
+
watch(
|
|
74
|
+
autoExpanded,
|
|
75
|
+
newInitiallyExpanded => {
|
|
76
|
+
if (newInitiallyExpanded) {
|
|
77
|
+
emit("expand");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
function sortedAndAggregated(schema: Record<string, JSONProperty>): Record<string, JSONProperty> {
|
|
83
|
+
const requiredKeys = [];
|
|
84
|
+
const nonRequiredKeys = [];
|
|
85
|
+
|
|
86
|
+
for (const key in schema) {
|
|
87
|
+
if (typeof schema[key] === "object") {
|
|
88
|
+
schema[key] = aggregateAllOf(schema[key]);
|
|
89
|
+
if (schema[key].$required) {
|
|
90
|
+
requiredKeys.push(key);
|
|
91
|
+
} else {
|
|
92
|
+
nonRequiredKeys.push(key);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const sortedKeys = [...requiredKeys.sort(), ...nonRequiredKeys.sort()];
|
|
98
|
+
|
|
99
|
+
const sortedSchema = {} as Record<string, JSONProperty>;
|
|
100
|
+
sortedKeys.forEach(key => {
|
|
101
|
+
if (!schema[key].$deprecated || props.forceInclude?.includes(key)) {
|
|
102
|
+
sortedSchema[key] = schema[key];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return sortedSchema;
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style lang="scss" scoped>
|
|
111
|
+
@use "../../scss/variables" as variables;
|
|
112
|
+
@use "../../scss/color-palette" as color-palette;
|
|
113
|
+
|
|
114
|
+
.border {
|
|
115
|
+
border-radius: .5rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.property {
|
|
119
|
+
|
|
120
|
+
&:deep(> button) {
|
|
121
|
+
font-size: 1rem !important;
|
|
122
|
+
line-height: 1.5rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:deep(> .collapse-button) {
|
|
126
|
+
padding: 9px 16px;
|
|
127
|
+
border: 1px solid variables.$black-6;
|
|
128
|
+
border-radius: 12px;
|
|
129
|
+
background-color: variables.$black-9;
|
|
130
|
+
transition: border-radius 150ms ease;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&[open] {
|
|
134
|
+
:deep(> .collapse-button) {
|
|
135
|
+
border-radius: 12px 12px 0 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:not([open]) {
|
|
140
|
+
:deep(> .collapse-button) {
|
|
141
|
+
margin-bottom: 1rem;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:deep(> .collapsible-body:not(.collapsed)) {
|
|
146
|
+
padding-top: .75rem;
|
|
147
|
+
padding-bottom: .75rem;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:deep(.property-detail) {
|
|
151
|
+
border: 1px solid variables.$black-6;
|
|
152
|
+
margin-bottom: 1rem;
|
|
153
|
+
border-radius: 0 0 12px 12px;
|
|
154
|
+
|
|
155
|
+
&:first-child {
|
|
156
|
+
border-top: none;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:deep(.property-detail > *) {
|
|
161
|
+
padding: 1rem 2rem;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
$section-colors: (
|
|
166
|
+
properties: color-palette.$base-blue-300,
|
|
167
|
+
outputs: color-palette.$base-green-300,
|
|
168
|
+
metrics: color-palette.$base-orange-400
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@each $section, $color in $section-colors {
|
|
173
|
+
.section-#{$section} {
|
|
174
|
+
:deep(.collapse-button span:not(.type-box)) {
|
|
175
|
+
color: $color;
|
|
176
|
+
font-size: 1rem;
|
|
177
|
+
font-weight: normal;
|
|
178
|
+
font-family: "source code pro", monospace;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<details :id="href" :open="open">
|
|
3
|
+
<summary
|
|
4
|
+
class="d-flex align-items-center justify-content-between fw-bold gap-2 collapse-button"
|
|
5
|
+
:class="{collapsed}"
|
|
6
|
+
@click="handleToggle"
|
|
7
|
+
>
|
|
8
|
+
<span>{{ title }}<slot name="additional" /></span>
|
|
9
|
+
<slot name="right" />
|
|
10
|
+
<span v-if="arrow" class="chevron">
|
|
11
|
+
<component :is="collapsed ? ChevronRight : ChevronDown" />
|
|
12
|
+
</span>
|
|
13
|
+
</summary>
|
|
14
|
+
<div v-if="$slots.content" :id="href + '-body'">
|
|
15
|
+
<div>
|
|
16
|
+
<slot name="content" />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</details>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import {ref, watch, computed} from "vue";
|
|
24
|
+
import ChevronRight from "vue-material-design-icons/ChevronRight.vue";
|
|
25
|
+
import ChevronDown from "vue-material-design-icons/ChevronDown.vue";
|
|
26
|
+
import {useBrowserLocation} from "@vueuse/core";
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<{
|
|
29
|
+
href?: string,
|
|
30
|
+
title: string,
|
|
31
|
+
arrow?: boolean,
|
|
32
|
+
initiallyExpanded?: boolean
|
|
33
|
+
noUrlChange?: boolean
|
|
34
|
+
}>(), {
|
|
35
|
+
href: Math.random().toString(36).substring(2, 5),
|
|
36
|
+
arrow: true,
|
|
37
|
+
initiallyExpanded: false,
|
|
38
|
+
noUrlChange: false
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const collapsed = ref(true);
|
|
42
|
+
|
|
43
|
+
const location = useBrowserLocation();
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits(["expand"]);
|
|
46
|
+
|
|
47
|
+
const getHash = computed(() => `#${props.href}-body`);
|
|
48
|
+
|
|
49
|
+
const handleToggle = (event: Event) => {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
collapsed.value = !collapsed.value;
|
|
52
|
+
open.value = !collapsed.value;
|
|
53
|
+
if(!collapsed.value) {
|
|
54
|
+
emit("expand");
|
|
55
|
+
}
|
|
56
|
+
if (props.noUrlChange) return;
|
|
57
|
+
|
|
58
|
+
const newUrl = window.location.pathname + window.location.search + (!collapsed.value ? getHash.value : "");
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
window.history.pushState(null, "", newUrl);
|
|
62
|
+
} catch {
|
|
63
|
+
try {
|
|
64
|
+
if (!collapsed.value) window.location.hash = getHash.value;
|
|
65
|
+
else window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
66
|
+
} catch {
|
|
67
|
+
void 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const open = ref(false);
|
|
73
|
+
|
|
74
|
+
watch(
|
|
75
|
+
() => props.initiallyExpanded,
|
|
76
|
+
(initiallyExpanded) => {
|
|
77
|
+
if (initiallyExpanded !== undefined) {
|
|
78
|
+
open.value = initiallyExpanded;
|
|
79
|
+
collapsed.value = !initiallyExpanded;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
, {immediate: true});
|
|
83
|
+
|
|
84
|
+
watch(
|
|
85
|
+
() => location.value.hash,
|
|
86
|
+
(hash) => {
|
|
87
|
+
if (hash === getHash.value && collapsed.value) {
|
|
88
|
+
open.value = true;
|
|
89
|
+
collapsed.value = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
, {immediate: true});
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style scoped lang="scss">
|
|
96
|
+
details{
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
details::details-content{
|
|
101
|
+
block-size: 0%;
|
|
102
|
+
transition: block-size 150ms,
|
|
103
|
+
content-visibility 150ms;
|
|
104
|
+
transition-behavior: allow-discrete;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
details[open]::details-content{
|
|
108
|
+
block-size: auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.collapse-button {
|
|
112
|
+
padding: 0;
|
|
113
|
+
border: none;
|
|
114
|
+
background: none;
|
|
115
|
+
|
|
116
|
+
&:focus {
|
|
117
|
+
outline: none;
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Collapsible
|
|
3
|
+
:title="definition.title"
|
|
4
|
+
:href="`def-${definition.key}`"
|
|
5
|
+
class="def-collapsible"
|
|
6
|
+
:class="`section-${section}`"
|
|
7
|
+
arrow
|
|
8
|
+
no-url-change
|
|
9
|
+
>
|
|
10
|
+
<template #content>
|
|
11
|
+
<div class="def-content">
|
|
12
|
+
<div v-for="(prop, propKey) in definition.properties" :key="propKey" class="def-property">
|
|
13
|
+
<div class="d-flex align-items-center justify-content-between gap-2">
|
|
14
|
+
<span>{{ propKey }}</span>
|
|
15
|
+
<PropertyBadges :property="prop" :show-dynamic="false" section-class="section-properties" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<PropertyMeta :property="prop" :subtype="getSubtype(prop)" :enum-values="getEnumValues(prop)" />
|
|
19
|
+
|
|
20
|
+
<div v-if="prop.title !== undefined || prop.description !== undefined" class="property-desc mt-2">
|
|
21
|
+
<slot v-if="prop.title" :content="codeSanitizer(prop.title)" name="markdown" />
|
|
22
|
+
<slot v-if="prop.description" :content="codeSanitizer(prop.description)" name="markdown" />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div v-if="depth < maxDepth && getDefs(prop).length" class="mt-3 nested-defs">
|
|
26
|
+
<DefinitionCollapsible
|
|
27
|
+
v-for="nested in getDefs(prop)"
|
|
28
|
+
:key="`${definition.key}-${nested.key}`"
|
|
29
|
+
:definition="nested"
|
|
30
|
+
:definitions="definitions"
|
|
31
|
+
:visited-keys="visitedKeysWithCurrent"
|
|
32
|
+
:depth="depth + 1"
|
|
33
|
+
:max-depth="maxDepth"
|
|
34
|
+
>
|
|
35
|
+
<template #markdown="{content}">
|
|
36
|
+
<slot :content="content" name="markdown" />
|
|
37
|
+
</template>
|
|
38
|
+
</DefinitionCollapsible>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</Collapsible>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import {computed} from "vue";
|
|
48
|
+
import {
|
|
49
|
+
extractEnumValues,
|
|
50
|
+
extractTypeInfo,
|
|
51
|
+
extractReferencedDefinitions,
|
|
52
|
+
type JSONProperty,
|
|
53
|
+
type JSONSchema
|
|
54
|
+
} from "../../utils/schemaUtils.ts";
|
|
55
|
+
import {sanitizeForMarkdown} from "../../utils/Utils";
|
|
56
|
+
import Collapsible from "./CollapsibleV2.vue";
|
|
57
|
+
import PropertyBadges from "./PropertyBadges.vue";
|
|
58
|
+
import PropertyMeta from "./PropertyMeta.vue";
|
|
59
|
+
|
|
60
|
+
const props = withDefaults(defineProps<{
|
|
61
|
+
definition: {
|
|
62
|
+
key: string,
|
|
63
|
+
title: string,
|
|
64
|
+
properties: Record<string, JSONProperty>
|
|
65
|
+
},
|
|
66
|
+
definitions?: Record<string, JSONSchema>,
|
|
67
|
+
visitedKeys?: Set<string>,
|
|
68
|
+
depth?: number,
|
|
69
|
+
maxDepth?: number,
|
|
70
|
+
section?: string
|
|
71
|
+
}>(), {
|
|
72
|
+
definitions: undefined,
|
|
73
|
+
visitedKeys: () => new Set<string>(),
|
|
74
|
+
depth: 0,
|
|
75
|
+
maxDepth: 3,
|
|
76
|
+
section: "properties"
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
defineSlots<{
|
|
80
|
+
markdown: { content: string }
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const codeSanitizer = sanitizeForMarkdown;
|
|
84
|
+
|
|
85
|
+
const getSubtype = (p: JSONProperty) => {
|
|
86
|
+
const subtype = extractTypeInfo(p).subType;
|
|
87
|
+
return subtype && !subtype.startsWith("#") ? subtype : undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const getEnumValues = (p: JSONProperty) => extractEnumValues(p);
|
|
91
|
+
|
|
92
|
+
const getDefs = (p: JSONProperty) => {
|
|
93
|
+
const defs = props.definitions;
|
|
94
|
+
const d = props.depth;
|
|
95
|
+
const max = props.maxDepth;
|
|
96
|
+
const visited = props.visitedKeys;
|
|
97
|
+
|
|
98
|
+
if (!defs || d >= max) return [];
|
|
99
|
+
return extractReferencedDefinitions(p, defs, visited);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const visitedKeysWithCurrent = computed(() => {
|
|
103
|
+
const newSet = new Set(props.visitedKeys);
|
|
104
|
+
newSet.add(props.definition.key);
|
|
105
|
+
return newSet;
|
|
106
|
+
});
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
@use "../../scss/variables" as variables;
|
|
111
|
+
@use "../../scss/color-palette" as color-palette;
|
|
112
|
+
|
|
113
|
+
$section-colors: (
|
|
114
|
+
properties: color-palette.$base-blue-300,
|
|
115
|
+
outputs: color-palette.$base-green-300,
|
|
116
|
+
metrics: color-palette.$base-orange-400
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
@each $section, $color in $section-colors {
|
|
120
|
+
.section-#{$section} {
|
|
121
|
+
.def-property span {
|
|
122
|
+
color: $color;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.def-collapsible {
|
|
128
|
+
margin-bottom: 0.875rem;
|
|
129
|
+
|
|
130
|
+
:deep(.collapse-button span:not(.type-box)) {
|
|
131
|
+
color: variables.$purple-37 !important;
|
|
132
|
+
font-weight: 500 !important;
|
|
133
|
+
font-size: 12px !important;
|
|
134
|
+
font-family: "Source code pro", monospace;
|
|
135
|
+
white-space: normal !important;
|
|
136
|
+
overflow-wrap: anywhere !important;
|
|
137
|
+
word-break: break-word !important;
|
|
138
|
+
display: inline-block !important;
|
|
139
|
+
max-width: 100%;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:deep(summary) {
|
|
143
|
+
padding: 9px 1.875rem;
|
|
144
|
+
font-size: 0.875rem;
|
|
145
|
+
font-weight: 500;
|
|
146
|
+
background: variables.$black-9;
|
|
147
|
+
border: 1px solid variables.$black-6;
|
|
148
|
+
border-radius: 12px 12px 0 0;
|
|
149
|
+
transition: border-radius 150ms ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:deep(summary.collapsed) {
|
|
153
|
+
border-radius: 12px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.def-content {
|
|
157
|
+
padding: 1rem 0;
|
|
158
|
+
background: variables.$black-4;
|
|
159
|
+
border: 1px solid variables.$black-6;
|
|
160
|
+
border-top: none;
|
|
161
|
+
border-radius: 0 0 12px 12px
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.def-property {
|
|
165
|
+
padding: 9px 2rem;
|
|
166
|
+
border-bottom: 1px solid variables.$black-6;
|
|
167
|
+
|
|
168
|
+
&:last-child {
|
|
169
|
+
border-bottom: none;
|
|
170
|
+
padding-bottom: 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&:first-child {
|
|
174
|
+
padding-top: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
span {
|
|
178
|
+
font-size: 12px !important;
|
|
179
|
+
font-family: "Source code pro", monospace;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.property-desc {
|
|
184
|
+
font-size: 0.875rem;
|
|
185
|
+
color: var(--ks-content-secondary) !important;
|
|
186
|
+
line-height: 1.5;
|
|
187
|
+
|
|
188
|
+
:deep(p) {
|
|
189
|
+
margin: 0;
|
|
190
|
+
font-size: 0.875rem !important;
|
|
191
|
+
line-height: 22px;
|
|
192
|
+
font-weight: normal;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
:deep(code) {
|
|
196
|
+
font-size: 0.8125rem;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.nested-defs {
|
|
202
|
+
.def-collapsible {
|
|
203
|
+
:deep(summary) {
|
|
204
|
+
padding-left: 1.5rem;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="d-flex flex-grow-1 align-items-center">
|
|
3
|
+
<span class="d-flex gap-2 flex-wrap align-items-center" :class="sectionClass">
|
|
4
|
+
<Tooltip v-if="property && property['$required']" class="d-flex align-items-center" title="Required">
|
|
5
|
+
<span class="text-danger">*</span>
|
|
6
|
+
</Tooltip>
|
|
7
|
+
<Tooltip v-if="showDynamic && property && !isDynamic(property)" class="d-flex" title="Non-dynamic">
|
|
8
|
+
<Snowflake class="text-info" />
|
|
9
|
+
</Tooltip>
|
|
10
|
+
<Tooltip v-if="property && property['$beta']" class="d-flex" title="Beta">
|
|
11
|
+
<AlphaBBox class="text-warning" />
|
|
12
|
+
</Tooltip>
|
|
13
|
+
<Tooltip v-if="property && property['$deprecated']" class="d-flex" title="Deprecated">
|
|
14
|
+
<Alert class="text-warning" />
|
|
15
|
+
</Tooltip>
|
|
16
|
+
<template v-if="property">
|
|
17
|
+
<span v-for="type in getBaseTypes(property)" :key="type" class="type-box rounded fs-7 px-2 py-1">
|
|
18
|
+
{{ type }}
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
</span>
|
|
22
|
+
</span>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import {
|
|
27
|
+
extractTypeInfo,
|
|
28
|
+
type JSONProperty,
|
|
29
|
+
isDynamic
|
|
30
|
+
} from "../../utils/schemaUtils";
|
|
31
|
+
import Tooltip from "../misc/Tooltip.vue";
|
|
32
|
+
import Alert from "vue-material-design-icons/Alert.vue";
|
|
33
|
+
import Snowflake from "vue-material-design-icons/Snowflake.vue";
|
|
34
|
+
import AlphaBBox from "vue-material-design-icons/AlphaBBox.vue";
|
|
35
|
+
|
|
36
|
+
withDefaults(defineProps<{
|
|
37
|
+
property: JSONProperty,
|
|
38
|
+
showDynamic?: boolean,
|
|
39
|
+
sectionClass?: string
|
|
40
|
+
}>(), {
|
|
41
|
+
showDynamic: true,
|
|
42
|
+
sectionClass: ""
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function getBaseTypes(property: JSONProperty): string[] {
|
|
47
|
+
const typeInfo = extractTypeInfo(property);
|
|
48
|
+
return typeInfo.types.filter(type => !type.startsWith("#"));
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style lang="scss" scoped>
|
|
53
|
+
@use "../../scss/color-palette" as color-palette;
|
|
54
|
+
|
|
55
|
+
$section-styles: (
|
|
56
|
+
properties: (
|
|
57
|
+
color: var(--ks-content-running),
|
|
58
|
+
background: var(--ks-background-running),
|
|
59
|
+
border-color: var(--ks-border-running)
|
|
60
|
+
),
|
|
61
|
+
outputs: (
|
|
62
|
+
color: var(--ks-content-success),
|
|
63
|
+
background: rgba(color-palette.$base-green-900, .2),
|
|
64
|
+
border-color: var(--ks-border-success)
|
|
65
|
+
),
|
|
66
|
+
metrics: (
|
|
67
|
+
color: var(--ks-content-warning),
|
|
68
|
+
background: var(--ks-background-warning),
|
|
69
|
+
border-color: var(--ks-border-warning)
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
.type-box {
|
|
74
|
+
font-size: 12px !important;
|
|
75
|
+
line-height: 20px;
|
|
76
|
+
padding: 0 10px !important;
|
|
77
|
+
padding-bottom: 2px;
|
|
78
|
+
border-radius: 40px !important;
|
|
79
|
+
text-transform: capitalize;
|
|
80
|
+
border: 1px solid;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@each $section, $styles in $section-styles {
|
|
84
|
+
.section-#{$section} {
|
|
85
|
+
.type-box {
|
|
86
|
+
color: map-get($styles, color);
|
|
87
|
+
background: map-get($styles, background) !important;
|
|
88
|
+
border-color: map-get($styles, border-color);
|
|
89
|
+
text-transform: lowercase;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</style>
|