@kestra-io/ui-libs 0.0.79 → 0.0.80
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/_theme-dark.scss +20 -0
- package/dist/_variables.scss +119 -0
- package/dist/kestra-ui.js +17683 -0
- package/dist/kestra-ui.umd.cjs +71 -0
- package/dist/style.css +1 -0
- package/package.json +22 -4
- package/src/components/misc/Tooltip.vue +2 -2
- package/src/components/plugins/PropertyDetail.vue +130 -0
- package/src/components/plugins/PropertyType.vue +70 -0
- package/src/components/plugins/SchemaToCode.vue +6 -2
- package/src/components/plugins/SchemaToHtml.vue +137 -217
- package/src/placeholder.css +0 -0
- package/src/scss/bootstrap-overload.scss +4 -0
- package/src/utils/YamlUtils.js +1 -1
- package/src/utils/state.js +1 -2
|
@@ -1,200 +1,116 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="bd-markdown">
|
|
3
|
-
<div class="doc-alert alert alert-
|
|
4
|
-
<p
|
|
3
|
+
<div class="doc-alert alert alert-info" role="alert" v-if="schema.properties?.$beta">
|
|
4
|
+
<p>
|
|
5
|
+
This plugin is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.
|
|
6
|
+
</p>
|
|
5
7
|
</div>
|
|
6
8
|
|
|
7
|
-
<SchemaToCode language="yaml" :code="`type: "${
|
|
8
|
-
<p v-if="
|
|
9
|
-
<span style="font-size:1.5em;" v-html="replaceText(
|
|
9
|
+
<SchemaToCode :highlighter="highlighter" language="yaml" :code="`type: "${pluginType}"`" />
|
|
10
|
+
<p v-if="schema.properties?.title">
|
|
11
|
+
<span style="font-size:1.5em;" v-html="replaceText(schema.properties.title)" />
|
|
10
12
|
</p>
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
|
|
14
|
+
<slot v-if="schema.properties?.description" :content="schema.properties.description" name="markdown" />
|
|
15
|
+
|
|
16
|
+
<template v-if="schema.properties?.['$examples']">
|
|
17
|
+
<h2 id="examples">
|
|
18
|
+
<a href="#examples">Examples</a>
|
|
19
|
+
</h2>
|
|
20
|
+
<template
|
|
21
|
+
v-for="(example, index) in schema.properties['$examples']"
|
|
22
|
+
:key="index"
|
|
23
|
+
>
|
|
24
|
+
<slot v-if="example.title" :content="example.title" name="markdown" />
|
|
25
|
+
<SchemaToCode :highlighter="highlighter" :language="example.lang ?? 'yaml'" :code="generateExampleCode(example)" v-if="example.code" />
|
|
26
|
+
</template>
|
|
21
27
|
</template>
|
|
22
|
-
<template v-for="(pageBlock, key) in page?.body?.children ?? []" :key="key">
|
|
23
|
-
<template v-if="key !== 'examples'">
|
|
24
|
-
<h2 :id="key">
|
|
25
|
-
<a :href="`#${key}`">{{ capitalizeFirstLetter(key) }}</a>
|
|
26
|
-
</h2>
|
|
27
|
-
<template v-if="key !== 'definitions'">
|
|
28
|
-
<template v-for="(property, propertyKey) in sortSchemaByRequired(pageBlock)" :key="propertyKey">
|
|
29
|
-
<h3 :id="property.name || propertyKey">
|
|
30
|
-
<a :href="`#${property.name || propertyKey}`">
|
|
31
|
-
<code>{{ property.name || propertyKey }}</code>
|
|
32
|
-
</a>
|
|
33
|
-
</h3>
|
|
34
|
-
<div
|
|
35
|
-
class="doc-alert alert alert-warning"
|
|
36
|
-
role="alert"
|
|
37
|
-
v-if="property['$deprecated']"
|
|
38
|
-
>
|
|
39
|
-
<p>⚠ Deprecated</p>
|
|
40
|
-
</div>
|
|
41
|
-
<ul>
|
|
42
|
-
<li>
|
|
43
|
-
<strong>Type: </strong>
|
|
44
|
-
<mark
|
|
45
|
-
class="type-mark type-mark-default"
|
|
46
|
-
v-if="property.type || property['$ref']"
|
|
47
|
-
>
|
|
48
|
-
{{ property.type || property['$ref']?.split('.').reverse()[0] }}
|
|
49
|
-
</mark>
|
|
50
|
-
<ul v-else-if="property.anyOf">
|
|
51
|
-
<li v-for="(anyOf, index) in property.anyOf" :key="index">
|
|
52
|
-
<mark class="type-mark type-mark-default">{{ anyOf.type }}</mark>
|
|
53
|
-
</li>
|
|
54
|
-
</ul>
|
|
55
|
-
</li>
|
|
56
|
-
<li v-if="property.items">
|
|
57
|
-
<strong>SubType: </strong>
|
|
58
|
-
<a
|
|
59
|
-
aria-current="page"
|
|
60
|
-
v-if="property.items['$ref']"
|
|
61
|
-
:href="generateTaskHref(property.items['$ref'])"
|
|
62
|
-
class="router-link-active router-link-exact-active"
|
|
63
|
-
>
|
|
64
|
-
<mark class="type-mark type-mark-default">
|
|
65
|
-
{{ property.items['$ref']?.split('.').reverse()[0] ||
|
|
66
|
-
property.items.type ||'String' }}
|
|
67
|
-
</mark>
|
|
68
|
-
</a>
|
|
69
|
-
<mark v-else class="type-mark type-mark-default">
|
|
70
|
-
{{ property.items['$ref']?.split('.').reverse()[0] ||
|
|
71
|
-
property.items.type ||'String' }}
|
|
72
|
-
</mark>
|
|
73
|
-
</li>
|
|
74
|
-
<li v-if="property['$dynamic'] !== undefined">
|
|
75
|
-
<strong>Dynamic: </strong>{{
|
|
76
|
-
property['$dynamic'] === true ? "✔️" :
|
|
77
|
-
(property['$dynamic'] === false ? "❌" : "❓") }}
|
|
78
|
-
</li>
|
|
79
|
-
<li v-if="property['$required'] !== undefined">
|
|
80
|
-
<strong>Required: </strong> {{
|
|
81
|
-
property['$required'] === true ? "✔️" :
|
|
82
|
-
(property['$required'] === false ? "❌" : "❓") }}
|
|
83
|
-
</li>
|
|
84
|
-
<li v-if="property.default !== undefined">
|
|
85
|
-
<strong>Default: </strong>
|
|
86
|
-
<code>{{ property.default }}</code>
|
|
87
|
-
</li>
|
|
88
|
-
<li v-if="property.format">
|
|
89
|
-
<strong>Format: </strong>
|
|
90
|
-
<code> {{ property.format }} </code>
|
|
91
|
-
</li>
|
|
92
|
-
<li v-if="property.minItems">
|
|
93
|
-
<strong>Min items: </strong>
|
|
94
|
-
<code> {{ property.minItems }} </code>
|
|
95
|
-
</li>
|
|
96
|
-
<li v-if="property.minLength">
|
|
97
|
-
<strong>Min length: </strong>
|
|
98
|
-
<code>{{ property.minLength }}</code>
|
|
99
|
-
</li>
|
|
100
|
-
<li v-if="property.enum">
|
|
101
|
-
<strong>Possible Values:</strong>
|
|
102
|
-
<ul>
|
|
103
|
-
<li v-for="(possibleValue, index) in property.enum" :key="index">
|
|
104
|
-
<code data-v-c4861ad0="" class="">{{ possibleValue }}</code>
|
|
105
|
-
</li>
|
|
106
|
-
</ul>
|
|
107
|
-
</li>
|
|
108
|
-
</ul>
|
|
109
28
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<template
|
|
133
|
-
v-for="(definition, propertyKey) in item.properties ?? []"
|
|
134
|
-
:key="propertyKey"
|
|
135
|
-
>
|
|
136
|
-
<h5 :id="definition.name || propertyKey">
|
|
137
|
-
<a :href="`#${definition.name || propertyKey}`">
|
|
138
|
-
<code>{{ definition.name || propertyKey }}</code>
|
|
139
|
-
</a>
|
|
140
|
-
</h5>
|
|
141
|
-
<ul>
|
|
142
|
-
<li>
|
|
143
|
-
<strong>Type: </strong>
|
|
144
|
-
<mark class="type-mark type-mark-default">
|
|
145
|
-
{{ definition.type ||
|
|
146
|
-
definition['$ref']?.split('.').reverse()[0] }}
|
|
147
|
-
</mark>
|
|
148
|
-
</li>
|
|
149
|
-
<li v-if="definition.items">
|
|
150
|
-
<strong>SubType: </strong>
|
|
151
|
-
<a
|
|
152
|
-
aria-current="page"
|
|
153
|
-
v-if="definition.items['$ref']"
|
|
154
|
-
:href="generateTaskHref(definition.items['$ref'])"
|
|
155
|
-
class="router-link-active router-link-exact-active"
|
|
156
|
-
>
|
|
157
|
-
<mark class="type-mark type-mark-default">
|
|
158
|
-
{{ definition.items?.type || 'Task' }}
|
|
159
|
-
</mark>
|
|
160
|
-
</a>
|
|
161
|
-
<mark v-else class="type-mark type-mark-default">
|
|
162
|
-
{{ definition.items?.type || 'Task' }}
|
|
163
|
-
</mark>
|
|
164
|
-
</li>
|
|
165
|
-
<li v-if="definition['$dynamic'] !== undefined">
|
|
166
|
-
<strong>Dynamic: </strong>
|
|
167
|
-
{{ definition['$dynamic'] === true ? "✔️" :
|
|
168
|
-
(definition['$dynamic'] === false ? "❌" : "❓") }}
|
|
169
|
-
</li>
|
|
170
|
-
<li v-if="definition['$required'] !== undefined">
|
|
171
|
-
<strong>Required: </strong>
|
|
172
|
-
{{
|
|
173
|
-
definition['$required'] === true ? "✔️" :
|
|
174
|
-
(definition['$required'] === false ? "❌" : "❓") }}
|
|
175
|
-
</li>
|
|
176
|
-
<li v-if="definition.default !== undefined">
|
|
177
|
-
<strong>Default: </strong>
|
|
178
|
-
<code>{{ definition.default }}</code>
|
|
179
|
-
</li>
|
|
180
|
-
<li v-if="definition.format">
|
|
181
|
-
<strong>Format: </strong>
|
|
182
|
-
<code>{{ definition.format }}</code>
|
|
183
|
-
</li>
|
|
184
|
-
<li v-if="definition.minItems">
|
|
185
|
-
<strong>Min items: </strong>
|
|
186
|
-
<code>{{ definition.minItems }}</code>
|
|
187
|
-
</li>
|
|
188
|
-
</ul>
|
|
189
|
-
<p>
|
|
190
|
-
<strong v-html="replaceText(definition.title)" />
|
|
191
|
-
</p>
|
|
192
|
-
<blockquote class="blockquote">
|
|
193
|
-
<p v-html="replaceText(definition.description)" />
|
|
194
|
-
</blockquote>
|
|
29
|
+
<template v-if="schema.properties?.properties">
|
|
30
|
+
<h2 id="properties">
|
|
31
|
+
<a href="#properties">Properties</a>
|
|
32
|
+
</h2>
|
|
33
|
+
|
|
34
|
+
<template v-for="(property, propertyKey) in sortSchemaByRequired(schema.properties.properties)" :key="propertyKey">
|
|
35
|
+
<h3 :id="propertyKey">
|
|
36
|
+
<a :href="`#${propertyKey}`">
|
|
37
|
+
<code>{{ propertyKey }}</code>
|
|
38
|
+
</a>
|
|
39
|
+
</h3>
|
|
40
|
+
<div
|
|
41
|
+
class="doc-alert alert alert-info"
|
|
42
|
+
role="alert"
|
|
43
|
+
v-if="property['$beta']"
|
|
44
|
+
>
|
|
45
|
+
<p>This property is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.</p>
|
|
46
|
+
</div>
|
|
47
|
+
<ul>
|
|
48
|
+
<PropertyDetail :property="property" :text-sanitizer="replaceText">
|
|
49
|
+
<template #markdown="{content}">
|
|
50
|
+
<slot :content="content" name="markdown" />
|
|
195
51
|
</template>
|
|
52
|
+
</PropertyDetail>
|
|
53
|
+
</ul>
|
|
54
|
+
</template>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<template v-if="schema.outputs?.properties">
|
|
58
|
+
<h2 id="outputs">
|
|
59
|
+
<a href="#outputs">Outputs</a>
|
|
60
|
+
</h2>
|
|
61
|
+
|
|
62
|
+
<template v-for="(output, outputKey) in sortSchemaByRequired(schema.outputs.properties)" :key="outputKey">
|
|
63
|
+
<h3 :id="outputKey">
|
|
64
|
+
<a :href="`#${outputKey}`">
|
|
65
|
+
<code>{{ outputKey }}</code>
|
|
66
|
+
</a>
|
|
67
|
+
</h3>
|
|
68
|
+
<div
|
|
69
|
+
class="doc-alert alert alert-warning"
|
|
70
|
+
role="alert"
|
|
71
|
+
v-if="output['$deprecated']"
|
|
72
|
+
>
|
|
73
|
+
<p>⚠ Deprecated</p>
|
|
74
|
+
</div>
|
|
75
|
+
<div
|
|
76
|
+
class="doc-alert alert alert-info"
|
|
77
|
+
role="alert"
|
|
78
|
+
v-if="output['$beta']"
|
|
79
|
+
>
|
|
80
|
+
<p>This property is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.</p>
|
|
81
|
+
</div>
|
|
82
|
+
<ul>
|
|
83
|
+
<PropertyDetail :show-dynamic="false" :property="output" :text-sanitizer="replaceText" />
|
|
84
|
+
</ul>
|
|
85
|
+
</template>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<template v-if="schema.definitions">
|
|
89
|
+
<h2 id="definitions">
|
|
90
|
+
<a href="#definitions">Definitions</a>
|
|
91
|
+
</h2>
|
|
92
|
+
|
|
93
|
+
<template v-for="(definition, definitionKey) in schema.definitions" :key="definitionKey">
|
|
94
|
+
<h3 :id="definitionKey">
|
|
95
|
+
<a :href="`#${definitionKey}`">
|
|
96
|
+
<code>{{ definitionKey }}</code>
|
|
97
|
+
</a>
|
|
98
|
+
</h3>
|
|
99
|
+
<h4 :id="'properties-' + definitionKey" v-if="(definition.properties?.length ?? 0) > 0">
|
|
100
|
+
<a :href="`#properties-${definitionKey}`">
|
|
101
|
+
Properties
|
|
102
|
+
</a>
|
|
103
|
+
</h4>
|
|
104
|
+
<ul>
|
|
105
|
+
<template v-for="(property, propertyKey) in sortSchemaByRequired(definition.properties)" :key="propertyKey">
|
|
106
|
+
<h5 :id="definitionKey + '-' + propertyKey" v-if="definition.properties">
|
|
107
|
+
<code>
|
|
108
|
+
{{ propertyKey }}
|
|
109
|
+
</code>
|
|
110
|
+
</h5>
|
|
111
|
+
<PropertyDetail :property="property" :text-sanitizer="replaceText" />
|
|
196
112
|
</template>
|
|
197
|
-
</
|
|
113
|
+
</ul>
|
|
198
114
|
</template>
|
|
199
115
|
</template>
|
|
200
116
|
</div>
|
|
@@ -202,24 +118,26 @@
|
|
|
202
118
|
|
|
203
119
|
<script setup>
|
|
204
120
|
import SchemaToCode from "./SchemaToCode.vue";
|
|
121
|
+
import {createHighlighterCore} from "shiki/core";
|
|
122
|
+
import githubDark from "shiki/themes/github-dark.mjs";
|
|
123
|
+
import yaml from "shiki/langs/yaml.mjs";
|
|
124
|
+
import python from "shiki/langs/python.mjs";
|
|
125
|
+
import javascript from "shiki/langs/javascript.mjs";
|
|
205
126
|
import {computed} from "vue";
|
|
127
|
+
import PropertyDetail from "./PropertyDetail.vue";
|
|
128
|
+
import {createJavaScriptRegexEngine} from "shiki/engine/javascript";
|
|
206
129
|
|
|
207
130
|
const props = defineProps({
|
|
208
|
-
|
|
131
|
+
schema: {
|
|
209
132
|
type: Object,
|
|
210
133
|
required: true,
|
|
211
134
|
},
|
|
212
|
-
|
|
213
|
-
type:
|
|
135
|
+
pluginType: {
|
|
136
|
+
type: String,
|
|
214
137
|
required: true,
|
|
215
138
|
}
|
|
216
139
|
});
|
|
217
140
|
|
|
218
|
-
|
|
219
|
-
function capitalizeFirstLetter(str) {
|
|
220
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
141
|
const replaceText = (str) => {
|
|
224
142
|
str = str?.split("```")[0]?.replace(/`([^`]*)`/g, "<code>$1</code>");
|
|
225
143
|
str = str?.replace(
|
|
@@ -235,14 +153,8 @@
|
|
|
235
153
|
return str?.split("```")[0];
|
|
236
154
|
};
|
|
237
155
|
|
|
238
|
-
const generateTaskHref = (href) => {
|
|
239
|
-
if (href) {
|
|
240
|
-
const taskHref = href?.split("/");
|
|
241
|
-
return `#${taskHref[taskHref?.length - 1].toLowerCase()}`;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
156
|
computed(() => {
|
|
245
|
-
const textBlocks = props.
|
|
157
|
+
const textBlocks = props.schema?.description.split("\n\n");
|
|
246
158
|
let content = "";
|
|
247
159
|
textBlocks.forEach((text) => {
|
|
248
160
|
const newText = replaceText(text);
|
|
@@ -284,7 +196,7 @@
|
|
|
284
196
|
}
|
|
285
197
|
}
|
|
286
198
|
|
|
287
|
-
const sortedKeys = [...requiredKeys, ...nonRequiredKeys];
|
|
199
|
+
const sortedKeys = [...requiredKeys.sort(), ...nonRequiredKeys.sort()];
|
|
288
200
|
|
|
289
201
|
const sortedSchema = {};
|
|
290
202
|
sortedKeys.forEach(key => {
|
|
@@ -309,26 +221,34 @@
|
|
|
309
221
|
|
|
310
222
|
const generateExampleCode = (example) => {
|
|
311
223
|
if (!example?.full) {
|
|
312
|
-
const
|
|
313
|
-
return
|
|
224
|
+
const fullCode = `id: "${props.pluginType.split(".").reverse()[0]?.toLowerCase()}"\ntype: "${props.pluginType}"\n`;
|
|
225
|
+
return fullCode.concat(example.code)
|
|
314
226
|
}
|
|
315
227
|
|
|
316
228
|
return example.code;
|
|
317
229
|
}
|
|
230
|
+
|
|
231
|
+
const highlighter = await createHighlighterCore({
|
|
232
|
+
themes: [
|
|
233
|
+
githubDark
|
|
234
|
+
],
|
|
235
|
+
langs: [
|
|
236
|
+
yaml,
|
|
237
|
+
python,
|
|
238
|
+
javascript
|
|
239
|
+
],
|
|
240
|
+
engine: createJavaScriptRegexEngine(),
|
|
241
|
+
});
|
|
318
242
|
</script>
|
|
319
243
|
|
|
320
244
|
<style lang="scss" scoped>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
color: #b9b9ba;
|
|
329
|
-
padding: 0 .25rem;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
245
|
+
.bd-markdown {
|
|
246
|
+
code{
|
|
247
|
+
background: #161617;
|
|
248
|
+
border: 1px solid #252526;
|
|
249
|
+
border-radius: var(--bs-border-radius);
|
|
250
|
+
color: #b9b9ba;
|
|
251
|
+
padding: 0 .25rem;
|
|
332
252
|
}
|
|
333
253
|
}
|
|
334
254
|
</style>
|
|
File without changes
|
package/src/utils/YamlUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import JsYaml from "js-yaml";
|
|
2
2
|
import yaml, {Document, YAMLMap, isSeq, isMap, Pair, Scalar, YAMLSeq, LineCounter} from "yaml";
|
|
3
|
-
import
|
|
3
|
+
import cloneDeep from "lodash/cloneDeep"
|
|
4
4
|
import {SECTIONS} from "./constants.js";
|
|
5
5
|
|
|
6
6
|
const TOSTRING_OPTIONS = {lineWidth: 0};
|
package/src/utils/state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mapValues from "lodash/mapValues";
|
|
2
2
|
import PauseCircle from "vue-material-design-icons/PauseCircle.vue";
|
|
3
3
|
import CheckCircle from "vue-material-design-icons/CheckCircle.vue";
|
|
4
4
|
import PlayCircle from "vue-material-design-icons/PlayCircle.vue";
|
|
@@ -7,7 +7,6 @@ import StopCircle from "vue-material-design-icons/StopCircle.vue";
|
|
|
7
7
|
import SkipPreviousCircle from "vue-material-design-icons/SkipPreviousCircle.vue";
|
|
8
8
|
import AlertCircle from "vue-material-design-icons/AlertCircle.vue";
|
|
9
9
|
import DotsVerticalCircle from "vue-material-design-icons/DotsVerticalCircle.vue";
|
|
10
|
-
// import {cssVariable} from "./global"
|
|
11
10
|
|
|
12
11
|
const STATE = Object.freeze({
|
|
13
12
|
CREATED: {
|