windmill-components 1.665.0 → 1.677.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/sharedUtils/assets/tokens/colorTokensConfig.d.ts +2 -0
- package/dist/sharedUtils/base.d.ts +1 -0
- package/dist/sharedUtils/cloud.d.ts +1 -0
- package/dist/sharedUtils/common.d.ts +111 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/count.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/delete.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/insert.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +13 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/update.d.ts +11 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +95 -0
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +6 -0
- package/dist/sharedUtils/components/apps/editor/appUtilsCore.d.ts +7 -0
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +33 -0
- package/dist/sharedUtils/components/apps/editor/commonAppUtils.d.ts +10 -0
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +5371 -0
- package/dist/sharedUtils/components/apps/editor/component/default-codes.d.ts +3 -0
- package/dist/sharedUtils/components/apps/editor/component/index.d.ts +3 -0
- package/dist/sharedUtils/components/apps/editor/component/sets.d.ts +7 -0
- package/dist/sharedUtils/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +3 -0
- package/dist/sharedUtils/components/apps/gridUtils.d.ts +14 -0
- package/dist/sharedUtils/components/apps/inputType.d.ts +178 -0
- package/dist/sharedUtils/components/apps/rx.d.ts +29 -0
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +21 -0
- package/dist/sharedUtils/components/apps/types.d.ts +274 -0
- package/dist/sharedUtils/components/assets/lib.d.ts +25 -0
- package/dist/sharedUtils/components/common/alert/model.d.ts +2 -0
- package/dist/sharedUtils/components/common/badge/model.d.ts +8 -0
- package/dist/sharedUtils/components/common/button/model.d.ts +45 -0
- package/dist/sharedUtils/components/common/fileInput/model.d.ts +1 -0
- package/dist/sharedUtils/components/common/index.d.ts +24 -0
- package/dist/sharedUtils/components/common/skeleton/model.d.ts +21 -0
- package/dist/sharedUtils/components/dbTypes.d.ts +14 -0
- package/dist/sharedUtils/components/diff_drawer.d.ts +26 -0
- package/dist/sharedUtils/components/ducklake.d.ts +1 -0
- package/dist/sharedUtils/components/flows/scheduleUtils.d.ts +7 -0
- package/dist/sharedUtils/components/icons/index.d.ts +101 -0
- package/dist/sharedUtils/components/random_positive_adjetive.d.ts +1 -0
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +10 -0
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +15 -0
- package/dist/sharedUtils/components/triggers/email/utils.d.ts +4 -0
- package/dist/sharedUtils/components/triggers/gcp/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/http/utils.d.ts +11 -0
- package/dist/sharedUtils/components/triggers/kafka/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/mqtt/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/nats/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/postgres/utils.d.ts +8 -0
- package/dist/sharedUtils/components/triggers/sqs/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/triggers.svelte.d.ts +32 -0
- package/dist/sharedUtils/components/triggers/utils.d.ts +80 -0
- package/dist/sharedUtils/components/triggers/websocket/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers.d.ts +20 -0
- package/dist/sharedUtils/gen/core/ApiError.d.ts +10 -0
- package/dist/sharedUtils/gen/core/ApiRequestOptions.d.ts +13 -0
- package/dist/sharedUtils/gen/core/ApiResult.d.ts +7 -0
- package/dist/sharedUtils/gen/core/CancelablePromise.d.ts +26 -0
- package/dist/sharedUtils/gen/core/OpenAPI.d.ts +27 -0
- package/dist/sharedUtils/gen/core/request.d.ts +29 -0
- package/dist/sharedUtils/gen/index.d.ts +6 -0
- package/dist/sharedUtils/gen/schemas.gen.d.ts +7036 -0
- package/dist/sharedUtils/gen/services.gen.d.ts +6047 -0
- package/dist/sharedUtils/gen/types.gen.d.ts +21881 -0
- package/dist/sharedUtils/history.svelte.d.ts +9 -0
- package/dist/sharedUtils/hub.d.ts +49 -0
- package/dist/sharedUtils/jsr.json +6 -0
- package/dist/sharedUtils/lib.d.ts +5 -0
- package/dist/sharedUtils/lib.es.js +1588 -0
- package/dist/sharedUtils/package.json +12 -0
- package/dist/sharedUtils/schema.d.ts +3 -0
- package/dist/sharedUtils/stores.d.ts +97 -0
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +80 -0
- package/dist/sharedUtils/toast.d.ts +8 -0
- package/dist/sharedUtils/utils.d.ts +265 -0
- package/package/components/AddUser.svelte +67 -34
- package/package/components/AppConnectInner.svelte +9 -1
- package/package/components/ArgInfo.svelte +9 -1
- package/package/components/ArgInput.svelte +21 -1
- package/package/components/CompareWorkspaces.svelte +11 -2
- package/package/components/DedicatedWorkersSelector.svelte +262 -247
- package/package/components/DefaultTagsInner.svelte +40 -2
- package/package/components/DeployWorkspace.svelte +13 -0
- package/package/components/DiffEditor.svelte +44 -1
- package/package/components/EditableSchemaForm.svelte +5 -2
- package/package/components/EditableSchemaForm.svelte.d.ts +1 -0
- package/package/components/Editor.svelte +5 -1
- package/package/components/EditorBar.svelte +12 -3
- package/package/components/FilterSearchbar.svelte +26 -2
- package/package/components/FlowBuilder.svelte +6 -3
- package/package/components/FlowGraphDiffViewer.svelte +16 -17
- package/package/components/FlowGraphViewer.svelte +20 -6
- package/package/components/FlowGraphViewer.svelte.d.ts +2 -0
- package/package/components/FlowGraphViewerStep.svelte +14 -32
- package/package/components/FlowMetadata.svelte +4 -1
- package/package/components/FlowPreviewContent.svelte +2 -0
- package/package/components/FlowStatusWaitingForEvents.svelte +25 -4
- package/package/components/HighlightCode.svelte +3 -0
- package/package/components/InstanceSetting.svelte +9 -25
- package/package/components/InstanceSettings.svelte +16 -0
- package/package/components/LabelsInput.svelte +149 -0
- package/package/components/LabelsInput.svelte.d.ts +8 -0
- package/package/components/Login.svelte +6 -1
- package/package/components/ObjectStoreConfigSettings.svelte +273 -1
- package/package/components/OktaSetting.svelte +6 -5
- package/package/components/Password.svelte +74 -20
- package/package/components/Password.svelte.d.ts +1 -0
- package/package/components/PasswordArgInput.svelte +2 -2
- package/package/components/PasswordArgInput.svelte.d.ts +1 -0
- package/package/components/Path.svelte +8 -10
- package/package/components/PathNameAutocomplete.svelte +308 -0
- package/package/components/PathNameAutocomplete.svelte.d.ts +27 -0
- package/package/components/PowerShellCommonParams.svelte +84 -0
- package/package/components/PowerShellCommonParams.svelte.d.ts +6 -0
- package/package/components/Range.svelte +8 -3
- package/package/components/ResourceEditor.svelte +6 -2
- package/package/components/RunForm.svelte +71 -7
- package/package/components/RunForm.svelte.d.ts +2 -1
- package/package/components/ScriptBuilder.svelte +7 -3
- package/package/components/ScriptEditor.svelte +221 -187
- package/package/components/ScriptEditor.svelte.d.ts +1 -1
- package/package/components/ScriptSchema.svelte +1 -1
- package/package/components/StringTypeNarrowing.svelte +1 -1
- package/package/components/StringTypeNarrowing.svelte.d.ts +1 -1
- package/package/components/SummaryPathDisplay.svelte +32 -10
- package/package/components/SummaryPathDisplay.svelte.d.ts +2 -1
- package/package/components/VariableEditor.svelte +9 -2
- package/package/components/WorkerGroup.svelte +47 -2
- package/package/components/apps/editor/DeploymentHistory.svelte +112 -13
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +135 -35
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte.d.ts +3 -1
- package/package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +11 -35
- package/package/components/apps/editor/settingsPanel/mainInput/runnableSelectorUtils.d.ts +10 -0
- package/package/components/apps/editor/settingsPanel/mainInput/runnableSelectorUtils.js +14 -0
- package/package/components/apps/editor/settingsPanel/mainInput/runnableSelectorUtils.test.d.ts +1 -0
- package/package/components/apps/editor/settingsPanel/mainInput/runnableSelectorUtils.test.js +34 -0
- package/package/components/assets/AssetButtons.svelte +21 -25
- package/package/components/assets/AssetsUsageDrawer.svelte +7 -9
- package/package/components/common/fileUpload/FileUpload.svelte +6 -2
- package/package/components/common/languageIcons/LanguageIcon.svelte +3 -0
- package/package/components/common/table/AppRow.svelte +18 -0
- package/package/components/common/table/FlowRow.svelte +18 -0
- package/package/components/common/table/ScriptRow.svelte +18 -0
- package/package/components/copilot/chat/AIChatManager.svelte.js +3 -3
- package/package/components/copilot/chat/flow/openFlow.json +1 -1
- package/package/components/copilot/chat/flow/openFlowZod.js +3 -3
- package/package/components/custom_ui.d.ts +2 -0
- package/package/components/details/DetailPageHeader.svelte +2 -2
- package/package/components/details/DetailPageHeader.svelte.d.ts +2 -1
- package/package/components/flows/agentToolUtils.d.ts +5 -0
- package/package/components/flows/agentToolUtils.js +49 -0
- package/package/components/flows/agentToolUtils.test.d.ts +1 -0
- package/package/components/flows/agentToolUtils.test.js +55 -0
- package/package/components/flows/content/FlowInput.svelte +2 -0
- package/package/components/flows/content/FlowInputsQuick.svelte +1 -1
- package/package/components/flows/content/FlowLoop.svelte +5 -12
- package/package/components/flows/content/FlowModuleScript.svelte +5 -3
- package/package/components/flows/content/FlowPathViewer.svelte +2 -2
- package/package/components/flows/content/FlowPathViewer.svelte.d.ts +1 -0
- package/package/components/flows/content/FlowSettings.svelte +2 -0
- package/package/components/flows/content/FlowWhileLoop.svelte +5 -12
- package/package/components/flows/flowInfers.js +8 -3
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +49 -9
- package/package/components/flows/pickers/PickHubScriptQuick.svelte +5 -3
- package/package/components/flows/pickers/PickHubScriptQuick.svelte.d.ts +1 -1
- package/package/components/flows/scheduleUtils.js +2 -1
- package/package/components/graph/FlowGraphV2.svelte +13 -1
- package/package/components/graph/WacDiagram.svelte +96 -0
- package/package/components/graph/WacDiagram.svelte.d.ts +7 -0
- package/package/components/graph/noteEditor.svelte.d.ts +1 -1
- package/package/components/graph/noteEditor.svelte.js +12 -1
- package/package/components/graph/noteUtils.svelte.d.ts +1 -1
- package/package/components/graph/noteUtils.svelte.js +9 -2
- package/package/components/graph/renderers/edges/WacEdge.svelte +41 -0
- package/package/components/graph/renderers/edges/WacEdge.svelte.d.ts +4 -0
- package/package/components/graph/renderers/nodes/WacControlNode.svelte +51 -0
- package/package/components/graph/renderers/nodes/WacControlNode.svelte.d.ts +9 -0
- package/package/components/graph/renderers/nodes/WacStepNode.svelte +35 -0
- package/package/components/graph/renderers/nodes/WacStepNode.svelte.d.ts +9 -0
- package/package/components/graph/wacDagLayout.d.ts +10 -0
- package/package/components/graph/wacDagLayout.js +120 -0
- package/package/components/graph/wacToFlow.js +1 -1
- package/package/components/home/ItemsList.svelte +28 -4
- package/package/components/icons/RIcon.svelte +32 -0
- package/package/components/icons/RIcon.svelte.d.ts +7 -0
- package/package/components/instanceSettings/DbHealth.svelte +723 -0
- package/package/components/instanceSettings/DbHealth.svelte.d.ts +3 -0
- package/package/components/instanceSettings/SecretBackendConfig.svelte +343 -304
- package/package/components/instanceSettings/SmtpSettings.svelte +8 -0
- package/package/components/instanceSettings.js +14 -5
- package/package/components/mcp/McpScopeSelector.svelte +82 -16
- package/package/components/moveRenameManager.d.ts +1 -0
- package/package/components/moveRenameManager.js +7 -4
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte +14 -1
- package/package/components/raw_apps/rawAppPolicy.js +3 -2
- package/package/components/raw_apps/utils.test.d.ts +1 -0
- package/package/components/raw_apps/utils.test.js +38 -0
- package/package/components/recording/ScriptRecordingReplay.svelte +0 -1
- package/package/components/resources/resourcesFilter.d.ts +15 -2
- package/package/components/resources/resourcesFilter.js +11 -2
- package/package/components/runs/JobDetailFieldConfig.js +5 -3
- package/package/components/runs/JobDetailHeader.svelte +5 -2
- package/package/components/runs/JobRunsPreview.svelte +1 -0
- package/package/components/runs/RunBadges.svelte +7 -4
- package/package/components/runs/RunRow.svelte +7 -7
- package/package/components/schedules/schedulesFilter.d.ts +15 -2
- package/package/components/schedules/schedulesFilter.js +11 -2
- package/package/components/schema/EditableSchemaWrapper.svelte +6 -8
- package/package/components/schema/PropertyEditor.svelte +22 -1
- package/package/components/schema/PropertyEditor.svelte.d.ts +1 -0
- package/package/components/schema/editable_schema_wrapper.d.ts +1 -0
- package/package/components/secretArgUtils.d.ts +7 -0
- package/package/components/secretArgUtils.js +45 -0
- package/package/components/settings/WorkspaceUserSettings.svelte +359 -286
- package/package/components/sidebar/OperatorMenu.svelte +215 -197
- package/package/components/triggers/CaptureWrapper.svelte +1 -1
- package/package/components/triggers/TriggerFilters.svelte +17 -5
- package/package/components/triggers/TriggerFilters.svelte.d.ts +2 -1
- package/package/components/triggers/kafka/KafkaCapture.svelte +6 -2
- package/package/components/triggers/kafka/KafkaCapture.svelte.d.ts +1 -1
- package/package/components/triggers/kafka/KafkaTriggerEditorInner.svelte +5 -1
- package/package/components/triggers/kafka/utils.js +1 -0
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +6 -0
- package/package/components/triggers/websocket/WebsocketTriggerEditorInner.svelte +87 -1
- package/package/components/triggers/websocket/utils.js +2 -0
- package/package/components/variables/variablesFilter.d.ts +15 -2
- package/package/components/variables/variablesFilter.js +11 -2
- package/package/components/worker_group.js +1 -0
- package/package/components/workspaceSettings/DucklakeSettings.svelte +33 -41
- package/package/consts.d.ts +1 -0
- package/package/consts.js +1 -0
- package/package/editorLangUtils.d.ts +1 -1
- package/package/editorLangUtils.js +2 -0
- package/package/forLater.js +4 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +94 -294
- package/package/gen/schemas.gen.js +94 -294
- package/package/gen/services.gen.d.ts +5 -121
- package/package/gen/services.gen.js +5 -237
- package/package/gen/types.gen.d.ts +91 -715
- package/package/hubPaths.json +6 -3
- package/package/infer.d.ts +55 -0
- package/package/infer.js +131 -0
- package/package/infer.svelte.js +2 -0
- package/package/mcpEndpointTools.js +213 -22
- package/package/script_helpers.d.ts +3 -0
- package/package/script_helpers.js +26 -0
- package/package/scripts.d.ts +2 -1
- package/package/scripts.js +15 -3
- package/package/stores.d.ts +2 -0
- package/package/system_prompts/prompts.d.ts +6 -5
- package/package/system_prompts/prompts.js +188 -29
- package/package/user.js +5 -1
- package/package/utils.js +21 -0
- package/package/utils_deployable.d.ts +7 -0
- package/package/utils_workspace_deploy.js +36 -8
- package/package.json +6 -5
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
<script lang="ts">import { createBubbler } from 'svelte/legacy';
|
|
2
|
+
import { tick } from 'svelte';
|
|
2
3
|
import Button from './common/button/Button.svelte';
|
|
3
4
|
import TextInput from './text_input/TextInput.svelte';
|
|
4
5
|
import { Eye, EyeClosed } from 'lucide-svelte';
|
|
5
6
|
const bubble = createBubbler();
|
|
6
|
-
let { password = $bindable(), placeholder = '******', disabled = false, required = false, small = false, id, onKeyDown, onBlur } = $props();
|
|
7
|
+
let { password = $bindable(), placeholder = '******', disabled = false, required = false, small = false, minRows, id, onKeyDown, onBlur } = $props();
|
|
7
8
|
let red = $derived(required && (password == '' || password == undefined));
|
|
8
9
|
let hideValue = $state(true);
|
|
10
|
+
let forceMultiline = $state(false);
|
|
11
|
+
let isMultiline = $derived(forceMultiline || (minRows != null && minRows > 1) || (password?.includes('\n') ?? false));
|
|
12
|
+
let textareaRef = $state();
|
|
13
|
+
function insertAndSwitchToMultiline(input, text) {
|
|
14
|
+
const start = input.selectionStart;
|
|
15
|
+
const end = input.selectionEnd;
|
|
16
|
+
if (start != null && end != null) {
|
|
17
|
+
password = (password ?? '').substring(0, start) + text + (password ?? '').substring(end);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// selectionStart/End are null for type="password" inputs
|
|
21
|
+
password = (password ?? '') + text;
|
|
22
|
+
}
|
|
23
|
+
forceMultiline = true;
|
|
24
|
+
tick().then(() => textareaRef?.focus());
|
|
25
|
+
}
|
|
9
26
|
</script>
|
|
10
27
|
|
|
11
28
|
<div class="relative w-full {small ? 'max-w-lg' : ''}">
|
|
12
|
-
<div class="absolute inset-y-0 right-1 flex items-center">
|
|
29
|
+
<div class="absolute {isMultiline ? 'top-1' : 'inset-y-0'} right-1 flex items-center z-10">
|
|
13
30
|
<Button
|
|
14
31
|
unifiedSize="sm"
|
|
15
32
|
onClick={() => (hideValue = !hideValue)}
|
|
@@ -19,24 +36,61 @@ let hideValue = $state(true);
|
|
|
19
36
|
wrapperClasses="bg-surface-input"
|
|
20
37
|
/>
|
|
21
38
|
</div>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
{#if isMultiline}
|
|
40
|
+
<TextInput
|
|
41
|
+
bind:this={textareaRef}
|
|
42
|
+
size="md"
|
|
43
|
+
error={red}
|
|
44
|
+
bind:value={password}
|
|
45
|
+
underlyingInputEl="textarea"
|
|
46
|
+
inputProps={{
|
|
47
|
+
id,
|
|
48
|
+
disabled,
|
|
49
|
+
placeholder,
|
|
50
|
+
rows: minRows ?? 3,
|
|
51
|
+
autocomplete: 'new-password',
|
|
52
|
+
onblur: (e) => onBlur?.(e),
|
|
53
|
+
onkeydown: (e) => {
|
|
54
|
+
onKeyDown?.(e)
|
|
55
|
+
bubble('keydown')(e)
|
|
56
|
+
},
|
|
57
|
+
style: hideValue ? '-webkit-text-security: disc' : ''
|
|
58
|
+
}}
|
|
59
|
+
class="pr-8"
|
|
60
|
+
unifiedHeight={false}
|
|
61
|
+
/>
|
|
62
|
+
{:else}
|
|
63
|
+
<TextInput
|
|
64
|
+
size="md"
|
|
65
|
+
error={red}
|
|
66
|
+
bind:value={password}
|
|
67
|
+
inputProps={{
|
|
68
|
+
id,
|
|
69
|
+
disabled,
|
|
70
|
+
placeholder,
|
|
71
|
+
autocomplete: 'new-password',
|
|
72
|
+
onblur: (e) => onBlur?.(e),
|
|
73
|
+
onkeydown: (e) => {
|
|
74
|
+
if (e.key === 'Enter') {
|
|
75
|
+
e.preventDefault()
|
|
76
|
+
insertAndSwitchToMultiline(e.currentTarget as HTMLInputElement, '\n')
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
onKeyDown?.(e)
|
|
80
|
+
bubble('keydown')(e)
|
|
81
|
+
},
|
|
82
|
+
onpaste: (e) => {
|
|
83
|
+
const text = e.clipboardData?.getData('text')
|
|
84
|
+
if (text?.includes('\n')) {
|
|
85
|
+
e.preventDefault()
|
|
86
|
+
insertAndSwitchToMultiline(e.currentTarget as HTMLInputElement, text)
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
type: hideValue ? 'password' : 'text'
|
|
90
|
+
}}
|
|
91
|
+
class="pr-8"
|
|
92
|
+
/>
|
|
93
|
+
{/if}
|
|
40
94
|
</div>
|
|
41
95
|
{#if red}
|
|
42
96
|
<div class="text-red-600 text-2xs grow">This field is required</div>
|
|
@@ -4,7 +4,7 @@ import { generateRandomString } from '../utils';
|
|
|
4
4
|
import { Button } from './common';
|
|
5
5
|
import Password from './Password.svelte';
|
|
6
6
|
import { untrack } from 'svelte';
|
|
7
|
-
let { value = $bindable(undefined), disabled } = $props();
|
|
7
|
+
let { value = $bindable(undefined), disabled, minRows } = $props();
|
|
8
8
|
let path = $state('');
|
|
9
9
|
let password = $state(value && typeof value === 'string' && !value.startsWith('$var:') ? value : '');
|
|
10
10
|
let isGenerating = false;
|
|
@@ -80,5 +80,5 @@ $effect(() => {
|
|
|
80
80
|
</Button>
|
|
81
81
|
</div>
|
|
82
82
|
{:else}
|
|
83
|
-
<Password {disabled} bind:password />
|
|
83
|
+
<Password {disabled} {minRows} bind:password />
|
|
84
84
|
{/if}
|
|
@@ -17,6 +17,7 @@ import { Folder, Loader2, SearchCode, User } from 'lucide-svelte';
|
|
|
17
17
|
import Tooltip from './Tooltip.svelte';
|
|
18
18
|
import { tick } from 'svelte';
|
|
19
19
|
import FolderPicker from './FolderPicker.svelte';
|
|
20
|
+
import PathNameAutocomplete from './PathNameAutocomplete.svelte';
|
|
20
21
|
import TextInput from './text_input/TextInput.svelte';
|
|
21
22
|
let meta = $state(undefined);
|
|
22
23
|
let { fullNamePlaceholder = undefined, namePlaceholder = '', initialPath, path = $bindable(undefined), error = $bindable(undefined), disabled = $bindable(false), checkInitialPathExistence = false, autofocus = true, dirty = $bindable(false), kind, hideUser = false, disableEditing = false, hideFullPath = false, size = 'md', drawerOffset = 0 } = $props();
|
|
@@ -397,20 +398,17 @@ let pathUsageInScriptsPromise = $derived(kind == 'script' &&
|
|
|
397
398
|
<div class="text-sm text-secondary">/</div>
|
|
398
399
|
<label class="block grow min-w-32 max-w-md">
|
|
399
400
|
<!-- svelte-ignore a11y_autofocus -->
|
|
400
|
-
<
|
|
401
|
+
<PathNameAutocomplete
|
|
401
402
|
bind:this={inputP}
|
|
402
403
|
bind:value={meta.name}
|
|
404
|
+
prefix={`${meta.ownerKind?.charAt(0) ?? ''}/${meta.owner ?? ''}/`}
|
|
403
405
|
{size}
|
|
404
406
|
{error}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
autocomplete: 'off',
|
|
411
|
-
onkeyup: handleKeyUp,
|
|
412
|
-
placeholder: namePlaceholder
|
|
413
|
-
}}
|
|
407
|
+
{autofocus}
|
|
408
|
+
id="path"
|
|
409
|
+
placeholder={namePlaceholder}
|
|
410
|
+
disabled={disabled || disableEditing}
|
|
411
|
+
onkeyup={handleKeyUp}
|
|
414
412
|
/>
|
|
415
413
|
</label>
|
|
416
414
|
{/if}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<script module lang="ts">import { PathAutocompleteService } from '../gen';
|
|
2
|
+
/** Client-side TTL for the workspace path list (mirrors backend cache). */
|
|
3
|
+
const PATH_LIST_TTL_MS = 60_000;
|
|
4
|
+
/** Module-level shared cache so multiple PathNameAutocomplete instances on
|
|
5
|
+
* the same page reuse a single fetch per workspace. */
|
|
6
|
+
const pathListCache = new Map();
|
|
7
|
+
export async function fetchWorkspacePaths(workspace) {
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
const existing = pathListCache.get(workspace);
|
|
10
|
+
if (existing) {
|
|
11
|
+
if (existing.paths && now - existing.at < PATH_LIST_TTL_MS)
|
|
12
|
+
return existing.paths;
|
|
13
|
+
if (existing.pending)
|
|
14
|
+
return existing.pending;
|
|
15
|
+
}
|
|
16
|
+
const pending = (async () => {
|
|
17
|
+
try {
|
|
18
|
+
const res = await PathAutocompleteService.listPathAutocompletePaths({ workspace });
|
|
19
|
+
const paths = res.paths ?? [];
|
|
20
|
+
pathListCache.set(workspace, { at: Date.now(), paths, pending: null });
|
|
21
|
+
return paths;
|
|
22
|
+
}
|
|
23
|
+
catch (_e) {
|
|
24
|
+
pathListCache.delete(workspace);
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
pathListCache.set(workspace, { at: now, paths: null, pending });
|
|
29
|
+
return pending;
|
|
30
|
+
}
|
|
31
|
+
export function invalidateWorkspacePaths(workspace) {
|
|
32
|
+
pathListCache.delete(workspace);
|
|
33
|
+
}
|
|
34
|
+
/** Derive the set of path segments that exist directly under a given folder
|
|
35
|
+
* prefix, from the flat list of all workspace paths. */
|
|
36
|
+
export function segmentsUnderPrefix(paths, folderPrefix) {
|
|
37
|
+
const seen = new Map();
|
|
38
|
+
const prefixLen = folderPrefix.length;
|
|
39
|
+
for (const p of paths) {
|
|
40
|
+
if (!p.startsWith(folderPrefix))
|
|
41
|
+
continue;
|
|
42
|
+
const remainder = p.slice(prefixLen);
|
|
43
|
+
if (remainder.length === 0)
|
|
44
|
+
continue;
|
|
45
|
+
const slash = remainder.indexOf('/');
|
|
46
|
+
if (slash >= 0) {
|
|
47
|
+
seen.set(remainder.slice(0, slash), true);
|
|
48
|
+
}
|
|
49
|
+
else if (!seen.has(remainder)) {
|
|
50
|
+
seen.set(remainder, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return Array.from(seen, ([name, is_folder]) => ({ name, is_folder })).sort((a, b) => a.name.localeCompare(b.name));
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<script lang="ts">import TextInput from './text_input/TextInput.svelte';
|
|
58
|
+
import { workspaceStore } from '../stores';
|
|
59
|
+
import { untrack } from 'svelte';
|
|
60
|
+
let { prefix, value = $bindable(), placeholder = '', disabled = false, autofocus = false, id, size = 'md', error, onkeyup } = $props();
|
|
61
|
+
let inputEl = $state(undefined);
|
|
62
|
+
export function focus() {
|
|
63
|
+
inputEl?.focus();
|
|
64
|
+
}
|
|
65
|
+
let allPaths = $state([]);
|
|
66
|
+
let cycleMode = $state(null);
|
|
67
|
+
let dismissedFor = $state(undefined);
|
|
68
|
+
let hasFocus = $state(false);
|
|
69
|
+
// Flag set when keydown consumes Enter for ghost-text acceptance.
|
|
70
|
+
// Checked in keyup to suppress Path.svelte's 'enter' dispatch.
|
|
71
|
+
let enterConsumed = false;
|
|
72
|
+
let currentSegment = $derived.by(() => {
|
|
73
|
+
const v = value ?? '';
|
|
74
|
+
const idx = v.lastIndexOf('/');
|
|
75
|
+
return idx >= 0 ? v.slice(idx + 1) : v;
|
|
76
|
+
});
|
|
77
|
+
let folderPrefix = $derived.by(() => {
|
|
78
|
+
const v = value ?? '';
|
|
79
|
+
const idx = v.lastIndexOf('/');
|
|
80
|
+
return prefix + (idx >= 0 ? v.slice(0, idx + 1) : '');
|
|
81
|
+
});
|
|
82
|
+
let fullPrefix = $derived(prefix + (value ?? ''));
|
|
83
|
+
let derivedFolderMatches = $derived.by(() => {
|
|
84
|
+
if (allPaths.length === 0)
|
|
85
|
+
return [];
|
|
86
|
+
return segmentsUnderPrefix(allPaths, folderPrefix).filter((s) => s.is_folder && s.name.startsWith(currentSegment));
|
|
87
|
+
});
|
|
88
|
+
let displayedOptions = $derived(cycleMode ? cycleMode.options : derivedFolderMatches);
|
|
89
|
+
let displayedActiveIndex = $derived(cycleMode ? cycleMode.index : -1);
|
|
90
|
+
// Ghost text: longest common prefix across all matching folder names,
|
|
91
|
+
// beyond what the user has already typed. Shows the unambiguous part
|
|
92
|
+
// the user can accept with Enter (multi-match) or Tab (single match).
|
|
93
|
+
let ghostText = $derived.by(() => {
|
|
94
|
+
if (cycleMode)
|
|
95
|
+
return '';
|
|
96
|
+
if (derivedFolderMatches.length === 0)
|
|
97
|
+
return '';
|
|
98
|
+
const names = derivedFolderMatches.map((s) => s.name);
|
|
99
|
+
// Compute LCP of all matching folder names
|
|
100
|
+
let lcp = names[0];
|
|
101
|
+
for (let i = 1; i < names.length; i++) {
|
|
102
|
+
let j = 0;
|
|
103
|
+
while (j < lcp.length && j < names[i].length && lcp[j] === names[i][j])
|
|
104
|
+
j++;
|
|
105
|
+
lcp = lcp.slice(0, j);
|
|
106
|
+
}
|
|
107
|
+
if (lcp.length <= currentSegment.length)
|
|
108
|
+
return '';
|
|
109
|
+
const completion = lcp.slice(currentSegment.length);
|
|
110
|
+
// Append '/' only when the LCP fully resolves to one folder name
|
|
111
|
+
const trailingSlash = derivedFolderMatches.length === 1 ? '/' : '';
|
|
112
|
+
return completion + trailingSlash;
|
|
113
|
+
});
|
|
114
|
+
let showList = $derived(!disabled && dismissedFor !== fullPrefix && hasFocus && displayedOptions.length > 0);
|
|
115
|
+
function applyCycleOrComplete(direction) {
|
|
116
|
+
if (cycleMode) {
|
|
117
|
+
const n = cycleMode.options.length;
|
|
118
|
+
const nextIdx = (cycleMode.index + direction + n) % n;
|
|
119
|
+
cycleMode = { ...cycleMode, index: nextIdx };
|
|
120
|
+
value = cycleMode.cyclePrefix + cycleMode.options[nextIdx].name + '/';
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
if (derivedFolderMatches.length === 0)
|
|
124
|
+
return false;
|
|
125
|
+
const opts = [...derivedFolderMatches];
|
|
126
|
+
const vNow = value ?? '';
|
|
127
|
+
const slash = vNow.lastIndexOf('/');
|
|
128
|
+
const cyclePrefix = slash >= 0 ? vNow.slice(0, slash + 1) : '';
|
|
129
|
+
if (opts.length === 1) {
|
|
130
|
+
value = cyclePrefix + opts[0].name + '/';
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
const idx = direction === 1 ? 0 : opts.length - 1;
|
|
134
|
+
cycleMode = { cyclePrefix, options: opts, index: idx };
|
|
135
|
+
value = cyclePrefix + opts[idx].name + '/';
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
function handleKeydown(e) {
|
|
139
|
+
if (e.key === 'Tab' && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
140
|
+
const dir = e.shiftKey ? -1 : 1;
|
|
141
|
+
if (applyCycleOrComplete(dir)) {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Enter picks the currently highlighted folder (from Tab cycling)
|
|
148
|
+
// or the first match, and navigates into it.
|
|
149
|
+
if (e.key === 'Enter' && !e.ctrlKey && !e.metaKey) {
|
|
150
|
+
let pick;
|
|
151
|
+
let committed = '';
|
|
152
|
+
if (cycleMode) {
|
|
153
|
+
pick = cycleMode.options[cycleMode.index];
|
|
154
|
+
committed = cycleMode.cyclePrefix;
|
|
155
|
+
}
|
|
156
|
+
else if (derivedFolderMatches.length > 0) {
|
|
157
|
+
pick = derivedFolderMatches[0];
|
|
158
|
+
const vNow = value ?? '';
|
|
159
|
+
const slash = vNow.lastIndexOf('/');
|
|
160
|
+
committed = slash >= 0 ? vNow.slice(0, slash + 1) : '';
|
|
161
|
+
}
|
|
162
|
+
if (pick) {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
enterConsumed = true;
|
|
166
|
+
value = committed + pick.name + '/';
|
|
167
|
+
cycleMode = null;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (e.key === 'Escape' && (cycleMode || showList || ghostText)) {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
cycleMode = null;
|
|
174
|
+
dismissedFor = fullPrefix;
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function selectOption(opt) {
|
|
179
|
+
const vNow = value ?? '';
|
|
180
|
+
const slash = vNow.lastIndexOf('/');
|
|
181
|
+
const valueCommitted = slash >= 0 ? vNow.slice(0, slash + 1) : '';
|
|
182
|
+
value = valueCommitted + opt.name + '/';
|
|
183
|
+
cycleMode = null;
|
|
184
|
+
inputEl?.focus();
|
|
185
|
+
}
|
|
186
|
+
async function loadPaths(workspace) {
|
|
187
|
+
const paths = await fetchWorkspacePaths(workspace);
|
|
188
|
+
// Guard against workspace changing during the in-flight fetch.
|
|
189
|
+
if ($workspaceStore === workspace)
|
|
190
|
+
allPaths = paths;
|
|
191
|
+
}
|
|
192
|
+
$effect(() => {
|
|
193
|
+
const ws = $workspaceStore;
|
|
194
|
+
if (ws)
|
|
195
|
+
void loadPaths(ws);
|
|
196
|
+
});
|
|
197
|
+
$effect(() => {
|
|
198
|
+
void value;
|
|
199
|
+
void prefix;
|
|
200
|
+
// Re-arm after the dismissed prefix is left.
|
|
201
|
+
if (untrack(() => dismissedFor) !== undefined) {
|
|
202
|
+
const curr = untrack(() => fullPrefix);
|
|
203
|
+
if (untrack(() => dismissedFor) !== curr)
|
|
204
|
+
dismissedFor = undefined;
|
|
205
|
+
}
|
|
206
|
+
// Exit cycle mode if the value no longer matches the cycled option.
|
|
207
|
+
const cm = untrack(() => cycleMode);
|
|
208
|
+
if (cm) {
|
|
209
|
+
const expected = cm.cyclePrefix + cm.options[cm.index].name + '/';
|
|
210
|
+
if ((value ?? '') !== expected)
|
|
211
|
+
cycleMode = null;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const overlayPaddingX = {
|
|
215
|
+
xs: 'px-1',
|
|
216
|
+
sm: 'px-2',
|
|
217
|
+
md: 'px-2',
|
|
218
|
+
lg: 'px-2'
|
|
219
|
+
};
|
|
220
|
+
const overlayHeight = {
|
|
221
|
+
xs: 'h-5',
|
|
222
|
+
sm: 'h-7',
|
|
223
|
+
md: 'h-8',
|
|
224
|
+
lg: 'h-10'
|
|
225
|
+
};
|
|
226
|
+
function onInputFocus() {
|
|
227
|
+
hasFocus = true;
|
|
228
|
+
// Opportunistic refresh if the cache is stale.
|
|
229
|
+
if ($workspaceStore)
|
|
230
|
+
void loadPaths($workspaceStore);
|
|
231
|
+
}
|
|
232
|
+
function onInputBlur() {
|
|
233
|
+
setTimeout(() => {
|
|
234
|
+
hasFocus = false;
|
|
235
|
+
}, 150);
|
|
236
|
+
}
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<div class="relative w-full">
|
|
240
|
+
<div class="relative w-full">
|
|
241
|
+
<TextInput
|
|
242
|
+
bind:this={inputEl}
|
|
243
|
+
bind:value
|
|
244
|
+
{size}
|
|
245
|
+
{error}
|
|
246
|
+
inputProps={{
|
|
247
|
+
disabled,
|
|
248
|
+
type: 'text',
|
|
249
|
+
id,
|
|
250
|
+
autofocus,
|
|
251
|
+
autocomplete: 'off',
|
|
252
|
+
spellcheck: false,
|
|
253
|
+
placeholder: showList || ghostText ? '' : placeholder,
|
|
254
|
+
onkeydown: handleKeydown,
|
|
255
|
+
onkeyup: (e: KeyboardEvent) => {
|
|
256
|
+
if (e.key === 'Enter' && enterConsumed) {
|
|
257
|
+
e.preventDefault()
|
|
258
|
+
e.stopPropagation()
|
|
259
|
+
enterConsumed = false
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
onkeyup?.(e)
|
|
263
|
+
},
|
|
264
|
+
onfocus: onInputFocus,
|
|
265
|
+
onblur: onInputBlur
|
|
266
|
+
}}
|
|
267
|
+
/>
|
|
268
|
+
{#if ghostText && hasFocus && !cycleMode}
|
|
269
|
+
<div
|
|
270
|
+
class="pointer-events-none absolute inset-0 flex items-center overflow-hidden whitespace-pre font-normal text-xs text-primary {overlayPaddingX[
|
|
271
|
+
size
|
|
272
|
+
]} {overlayHeight[size]}"
|
|
273
|
+
aria-hidden="true"
|
|
274
|
+
>
|
|
275
|
+
<span class="invisible">{value ?? ''}</span>
|
|
276
|
+
<span class="text-tertiary/70">{ghostText}</span>
|
|
277
|
+
<span
|
|
278
|
+
class="ml-1.5 px-1 py-0 rounded border border-border-light text-[10px] text-tertiary bg-surface-secondary"
|
|
279
|
+
>
|
|
280
|
+
Enter
|
|
281
|
+
</span>
|
|
282
|
+
</div>
|
|
283
|
+
{/if}
|
|
284
|
+
</div>
|
|
285
|
+
{#if showList}
|
|
286
|
+
<div
|
|
287
|
+
class="absolute left-0 top-full z-10 mt-1 flex max-w-full flex-wrap items-center gap-1 rounded border border-border-light bg-surface px-1.5 py-1 shadow-sm"
|
|
288
|
+
>
|
|
289
|
+
<span class="text-[10px] text-tertiary mr-0.5">
|
|
290
|
+
{cycleMode ? 'Tab to cycle' : 'Tab'}
|
|
291
|
+
</span>
|
|
292
|
+
{#each displayedOptions as opt, i (opt.name)}
|
|
293
|
+
<button
|
|
294
|
+
type="button"
|
|
295
|
+
tabindex="-1"
|
|
296
|
+
onmousedown={(e) => e.preventDefault()}
|
|
297
|
+
onclick={() => selectOption(opt)}
|
|
298
|
+
class="px-1.5 py-0 rounded border text-[11px] font-mono leading-5 transition-colors
|
|
299
|
+
{i === displayedActiveIndex
|
|
300
|
+
? 'border-border-selected bg-surface-selected text-primary'
|
|
301
|
+
: 'border-border-light bg-surface-secondary text-secondary hover:border-border-selected'}"
|
|
302
|
+
>
|
|
303
|
+
{opt.name}/
|
|
304
|
+
</button>
|
|
305
|
+
{/each}
|
|
306
|
+
</div>
|
|
307
|
+
{/if}
|
|
308
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ButtonType } from './common/button/model';
|
|
2
|
+
type InputSize = ButtonType.UnifiedSize;
|
|
3
|
+
export type AutocompleteSegment = {
|
|
4
|
+
name: string;
|
|
5
|
+
is_folder: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function fetchWorkspacePaths(workspace: string): Promise<string[]>;
|
|
8
|
+
export declare function invalidateWorkspacePaths(workspace: string): void;
|
|
9
|
+
/** Derive the set of path segments that exist directly under a given folder
|
|
10
|
+
* prefix, from the flat list of all workspace paths. */
|
|
11
|
+
export declare function segmentsUnderPrefix(paths: string[], folderPrefix: string): AutocompleteSegment[];
|
|
12
|
+
type Props = {
|
|
13
|
+
prefix: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
autofocus?: boolean;
|
|
18
|
+
id?: string;
|
|
19
|
+
size?: InputSize;
|
|
20
|
+
error?: string | boolean;
|
|
21
|
+
onkeyup?: (e: KeyboardEvent) => void;
|
|
22
|
+
};
|
|
23
|
+
declare const PathNameAutocomplete: import("svelte").Component<Props, {
|
|
24
|
+
focus: () => void;
|
|
25
|
+
}, "value">;
|
|
26
|
+
type PathNameAutocomplete = ReturnType<typeof PathNameAutocomplete>;
|
|
27
|
+
export default PathNameAutocomplete;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">import { Badge } from './common';
|
|
2
|
+
import Toggle from './Toggle.svelte';
|
|
3
|
+
import Select from './select/Select.svelte';
|
|
4
|
+
import { untrack } from 'svelte';
|
|
5
|
+
import { ChevronRight } from 'lucide-svelte';
|
|
6
|
+
let { args = $bindable({}) } = $props();
|
|
7
|
+
let verbose = $state(false);
|
|
8
|
+
let debug = $state(false);
|
|
9
|
+
let errorAction = $state(undefined);
|
|
10
|
+
let collapsed = $state(true);
|
|
11
|
+
let initialized = false;
|
|
12
|
+
const errorActionItems = [
|
|
13
|
+
{ label: 'Stop', value: 'Stop' },
|
|
14
|
+
{ label: 'Continue', value: 'Continue' },
|
|
15
|
+
{ label: 'SilentlyContinue', value: 'SilentlyContinue' }
|
|
16
|
+
];
|
|
17
|
+
let activeBadges = $derived.by(() => {
|
|
18
|
+
const badges = [];
|
|
19
|
+
if (verbose)
|
|
20
|
+
badges.push('Verbose');
|
|
21
|
+
if (debug)
|
|
22
|
+
badges.push('Debug');
|
|
23
|
+
if (errorAction)
|
|
24
|
+
badges.push(`ErrorAction: ${errorAction}`);
|
|
25
|
+
return badges;
|
|
26
|
+
});
|
|
27
|
+
// Initialize toggles from pre-populated args (e.g. "Run again")
|
|
28
|
+
$effect(() => {
|
|
29
|
+
if (!initialized && args && Object.keys(args).length > 0) {
|
|
30
|
+
initialized = true;
|
|
31
|
+
untrack(() => {
|
|
32
|
+
verbose = args['_wm_ps_verbose'] === true;
|
|
33
|
+
debug = args['_wm_ps_debug'] === true;
|
|
34
|
+
errorAction = args['_wm_ps_error_action'] ?? undefined;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// Sync toggles → args
|
|
39
|
+
$effect(() => {
|
|
40
|
+
const newArgs = {};
|
|
41
|
+
if (verbose)
|
|
42
|
+
newArgs['_wm_ps_verbose'] = true;
|
|
43
|
+
if (debug)
|
|
44
|
+
newArgs['_wm_ps_debug'] = true;
|
|
45
|
+
if (errorAction)
|
|
46
|
+
newArgs['_wm_ps_error_action'] = errorAction;
|
|
47
|
+
args = newArgs;
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<div class="flex flex-col">
|
|
52
|
+
<button
|
|
53
|
+
class="flex items-center gap-1 text-xs text-secondary hover:text-primary transition-colors"
|
|
54
|
+
onclick={() => (collapsed = !collapsed)}
|
|
55
|
+
>
|
|
56
|
+
<ChevronRight size={12} class="transition duration-200 {collapsed ? '' : 'rotate-90'}" />
|
|
57
|
+
CmdletBinding parameters
|
|
58
|
+
{#if collapsed && activeBadges.length > 0}
|
|
59
|
+
<div class="flex gap-1 ml-1">
|
|
60
|
+
{#each activeBadges as label}
|
|
61
|
+
<Badge color="blue">{label}</Badge>
|
|
62
|
+
{/each}
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
65
|
+
</button>
|
|
66
|
+
{#if !collapsed}
|
|
67
|
+
<div class="flex flex-col gap-2 mt-2 ml-4">
|
|
68
|
+
<Toggle options={{ right: 'Verbose' }} bind:checked={verbose} size="xs" />
|
|
69
|
+
<Toggle options={{ right: 'Debug' }} bind:checked={debug} size="xs" />
|
|
70
|
+
<div class="flex items-center gap-2">
|
|
71
|
+
<span class="text-xs text-secondary">ErrorAction</span>
|
|
72
|
+
<div class="w-40">
|
|
73
|
+
<Select
|
|
74
|
+
items={errorActionItems}
|
|
75
|
+
bind:value={errorAction}
|
|
76
|
+
placeholder="Default"
|
|
77
|
+
clearable
|
|
78
|
+
size="sm"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
{/if}
|
|
84
|
+
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { run, createBubbler, stopPropagation } from 'svelte/legacy';
|
|
2
2
|
const bubble = createBubbler();
|
|
3
3
|
import RangeSlider from 'svelte-range-slider-pips';
|
|
4
|
-
let { min = 0, max = 100, initialValue = 0, value = $bindable(
|
|
4
|
+
let { min = 0, max = 100, initialValue = 0, value = $bindable(), disabled = false, defaultValue = undefined, format = (v) => `${v}`, hideInput = false } = $props();
|
|
5
5
|
let step = 1;
|
|
6
6
|
let slider = $state();
|
|
7
7
|
function calculateAxisStep(min, max) {
|
|
@@ -9,8 +9,13 @@ function calculateAxisStep(min, max) {
|
|
|
9
9
|
return range < 100 ? 1 : range / 20;
|
|
10
10
|
}
|
|
11
11
|
run(() => {
|
|
12
|
-
if (value === null) {
|
|
13
|
-
|
|
12
|
+
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
13
|
+
const fallback = initialValue !== undefined
|
|
14
|
+
? typeof initialValue === 'string'
|
|
15
|
+
? parseInt(initialValue)
|
|
16
|
+
: initialValue
|
|
17
|
+
: (min ?? 0);
|
|
18
|
+
value = Number.isNaN(fallback) ? (min ?? 0) : fallback;
|
|
14
19
|
}
|
|
15
20
|
});
|
|
16
21
|
let axisStep = $derived(calculateAxisStep(min, max));
|