@d34dman/flowdrop 0.0.63 → 0.0.64
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/README.md +2 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +1 -40
- package/dist/api/enhanced-client.d.ts +19 -0
- package/dist/api/enhanced-client.js +9 -0
- package/dist/components/App.svelte +31 -35
- package/dist/components/CanvasBanner.stories.svelte +12 -8
- package/dist/components/CanvasBanner.stories.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.stories.svelte +35 -26
- package/dist/components/ConfigPanel.stories.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.stories.svelte +13 -13
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +1 -1
- package/dist/components/Logo.stories.svelte +4 -4
- package/dist/components/Logo.stories.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.stories.svelte +25 -10
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.stories.svelte +42 -30
- package/dist/components/Navbar.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.svelte +6 -3
- package/dist/components/NodeStatusOverlay.stories.svelte +61 -50
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +1 -1
- package/dist/components/PipelineStatus.svelte +9 -12
- package/dist/components/PipelineStatus.svelte.d.ts +2 -2
- package/dist/components/SchemaForm.stories.svelte +97 -82
- package/dist/components/SchemaForm.stories.svelte.d.ts +1 -1
- package/dist/components/SchemaForm.svelte +6 -2
- package/dist/components/SettingsPanel.svelte +5 -1
- package/dist/components/StatusIcon.stories.svelte +15 -15
- package/dist/components/StatusIcon.stories.svelte.d.ts +1 -1
- package/dist/components/StatusLabel.stories.svelte +8 -8
- package/dist/components/StatusLabel.stories.svelte.d.ts +1 -1
- package/dist/components/ThemeToggle.stories.svelte +10 -10
- package/dist/components/ThemeToggle.stories.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +23 -5
- package/dist/components/form/FormCheckboxGroup.stories.svelte +13 -13
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormField.svelte +2 -2
- package/dist/components/form/FormFieldLight.svelte +4 -4
- package/dist/components/form/FormFieldWrapper.stories.svelte +38 -16
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormNumberField.stories.svelte +21 -18
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormRangeField.stories.svelte +13 -13
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormSelect.stories.svelte +21 -21
- package/dist/components/form/FormSelect.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +0 -13
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +1 -7
- package/dist/components/form/FormTextField.stories.svelte +17 -17
- package/dist/components/form/FormTextField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextarea.stories.svelte +21 -18
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormToggle.stories.svelte +13 -13
- package/dist/components/form/FormToggle.stories.svelte.d.ts +1 -1
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form/index.js +1 -2
- package/dist/components/form/types.d.ts +8 -20
- package/dist/components/form/types.js +3 -8
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +37 -28
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +57 -35
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +52 -31
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.svelte +42 -25
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +32 -19
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.stories.svelte +96 -64
- package/dist/components/nodes/IdeaNode.stories.svelte +40 -36
- package/dist/components/nodes/NotesNode.stories.svelte +61 -54
- package/dist/components/nodes/SimpleNode.stories.svelte +141 -83
- package/dist/components/nodes/SquareNode.stories.svelte +70 -44
- package/dist/components/nodes/TerminalNode.stories.svelte +10 -10
- package/dist/components/nodes/TerminalNode.svelte +6 -2
- package/dist/components/nodes/ToolNode.stories.svelte +177 -59
- package/dist/components/nodes/WorkflowNode.stories.svelte +43 -38
- package/dist/components/playground/MessageBubble.stories.svelte +51 -38
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +1 -1
- package/dist/components/playground/Playground.svelte +1 -4
- package/dist/config/constants.d.ts +21 -0
- package/dist/config/constants.js +9 -0
- package/dist/core/index.d.ts +7 -5
- package/dist/core/index.js +5 -5
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/index.js +3 -4
- package/dist/form/code.js +16 -4
- package/dist/form/fieldRegistry.d.ts +8 -82
- package/dist/form/fieldRegistry.js +9 -101
- package/dist/form/full.d.ts +4 -1
- package/dist/form/full.js +6 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +0 -2
- package/dist/form/markdown.js +11 -3
- package/dist/helpers/workflowEditorHelper.d.ts +0 -3
- package/dist/helpers/workflowEditorHelper.js +7 -26
- package/dist/index.js +3 -0
- package/dist/schemas/v1/workflow.schema.json +950 -1076
- package/dist/services/apiVariableService.d.ts +1 -3
- package/dist/services/apiVariableService.js +3 -4
- package/dist/services/dynamicSchemaService.js +3 -4
- package/dist/stories/CanvasDecorator.svelte +7 -8
- package/dist/stories/CanvasDecorator.svelte.d.ts +2 -2
- package/dist/stories/NodeDecorator.svelte +13 -14
- package/dist/stories/NodeDecorator.svelte.d.ts +1 -1
- package/dist/stories/utils.d.ts +2 -2
- package/dist/stories/utils.js +55 -55
- package/dist/styles/base.css +12 -4
- package/dist/styles/tokens.css +138 -130
- package/dist/types/interrupt.d.ts +1 -4
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/package.json +53 -12
- package/dist/api/client.d.ts +0 -110
- package/dist/api/client.js +0 -240
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<script module>
|
|
2
|
-
import { defineMeta } from
|
|
3
|
-
import FormToggle from
|
|
4
|
-
import { fn } from
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import FormToggle from './FormToggle.svelte';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
title:
|
|
7
|
+
title: 'Form/FormToggle',
|
|
8
8
|
component: FormToggle,
|
|
9
|
-
tags: [
|
|
9
|
+
tags: ['autodocs'],
|
|
10
10
|
argTypes: {
|
|
11
|
-
value: { control:
|
|
12
|
-
onLabel: { control:
|
|
13
|
-
offLabel: { control:
|
|
14
|
-
disabled: { control:
|
|
11
|
+
value: { control: 'boolean' },
|
|
12
|
+
onLabel: { control: 'text' },
|
|
13
|
+
offLabel: { control: 'text' },
|
|
14
|
+
disabled: { control: 'boolean' }
|
|
15
15
|
},
|
|
16
16
|
args: {
|
|
17
|
-
id:
|
|
17
|
+
id: 'demo-toggle',
|
|
18
18
|
value: false,
|
|
19
|
-
onChange: fn()
|
|
20
|
-
}
|
|
19
|
+
onChange: fn()
|
|
20
|
+
}
|
|
21
21
|
});
|
|
22
22
|
</script>
|
|
23
23
|
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
<Story name="On" args={{ value: true }} />
|
|
27
27
|
|
|
28
|
-
<Story name="Custom Labels" args={{ value: true, onLabel:
|
|
28
|
+
<Story name="Custom Labels" args={{ value: true, onLabel: 'Yes', offLabel: 'No' }} />
|
|
29
29
|
|
|
30
30
|
<Story name="Disabled" args={{ value: true, disabled: true }} />
|
|
@@ -11,7 +11,7 @@ declare const FormToggle: $$__sveltets_2_IsomorphicComponent<{
|
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {}, {}, string>;
|
|
14
|
-
import FormToggle from
|
|
14
|
+
import FormToggle from './FormToggle.svelte';
|
|
15
15
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
17
|
$$bindings?: Bindings;
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
* />
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type { FieldType, FieldFormat, FieldOption, OneOfItem, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, CodeEditorFieldProps, MarkdownEditorFieldProps, TemplateEditorFieldProps, AutocompleteFieldProps, FieldSchema, FormFieldFactoryProps, FormFieldWrapperProps, SchemaFormProps, AutocompleteConfig } from './types.js';
|
|
33
|
+
export { isFieldOptionArray, isOneOfArray, oneOfToOptions, normalizeOptions, getSchemaOptions } from './types.js';
|
|
33
34
|
export { default as FormField } from './FormField.svelte';
|
|
34
35
|
export { default as FormFieldWrapper } from './FormFieldWrapper.svelte';
|
|
35
36
|
export { default as FormTextField } from './FormTextField.svelte';
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
* />
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
export * from './types.js';
|
|
32
|
+
export { isFieldOptionArray, isOneOfArray, oneOfToOptions, normalizeOptions, getSchemaOptions } from './types.js';
|
|
34
33
|
// Main factory component
|
|
35
34
|
export { default as FormField } from './FormField.svelte';
|
|
36
35
|
// Wrapper component
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* These types provide a foundation for dynamic form rendering based on JSON Schema
|
|
6
6
|
* and support extensibility for complex field types like arrays and objects.
|
|
7
7
|
*/
|
|
8
|
-
import type { AutocompleteConfig,
|
|
8
|
+
import type { AutocompleteConfig, TemplateVariablesConfig } from '../../types/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Supported field types for form rendering
|
|
11
11
|
* Aligned with JSON Schema specification (draft-07)
|
|
@@ -30,10 +30,10 @@ export type FieldFormat = 'multiline' | 'hidden' | 'range' | 'json' | 'code' | '
|
|
|
30
30
|
/**
|
|
31
31
|
* Option type for select and checkbox group fields
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
* This type is
|
|
33
|
+
* For new schemas, prefer JSON Schema `oneOf` with `const`/`title`.
|
|
34
|
+
* This type is supported for simpler use cases and backward compatibility.
|
|
35
35
|
*
|
|
36
|
-
* @example Standard JSON Schema approach:
|
|
36
|
+
* @example Standard JSON Schema approach (preferred):
|
|
37
37
|
* ```json
|
|
38
38
|
* {
|
|
39
39
|
* "type": "string",
|
|
@@ -199,12 +199,6 @@ export interface TemplateEditorFieldProps extends BaseFieldProps<string> {
|
|
|
199
199
|
* Controls which variables are available and how they are displayed.
|
|
200
200
|
*/
|
|
201
201
|
variables?: TemplateVariablesConfig;
|
|
202
|
-
/**
|
|
203
|
-
* Variable schema for advanced autocomplete with nested drilling.
|
|
204
|
-
* When provided, enables dot notation (user.name) and array access (items[0]).
|
|
205
|
-
* @deprecated Use `variables.schema` instead
|
|
206
|
-
*/
|
|
207
|
-
variableSchema?: VariableSchema;
|
|
208
202
|
/** Placeholder variable example for the hint */
|
|
209
203
|
placeholderExample?: string;
|
|
210
204
|
}
|
|
@@ -263,12 +257,6 @@ export interface FieldSchema {
|
|
|
263
257
|
multiple?: boolean;
|
|
264
258
|
/** Format hint for specialized rendering */
|
|
265
259
|
format?: FieldFormat;
|
|
266
|
-
/**
|
|
267
|
-
* Options for select type fields
|
|
268
|
-
* @deprecated Use JSON Schema `oneOf` with `const`/`title` instead.
|
|
269
|
-
* This property is kept for backwards compatibility but will be removed in a future version.
|
|
270
|
-
*/
|
|
271
|
-
options?: FieldOption[];
|
|
272
260
|
/** Placeholder text */
|
|
273
261
|
placeholder?: string;
|
|
274
262
|
/** Minimum value for numbers */
|
|
@@ -373,8 +361,8 @@ export declare function oneOfToOptions(oneOfItems: OneOfItem[]): FieldOption[];
|
|
|
373
361
|
/**
|
|
374
362
|
* Normalize options to FieldOption format
|
|
375
363
|
* Handles multiple input formats for consistent internal handling:
|
|
376
|
-
* - JSON Schema oneOf items
|
|
377
|
-
* - FieldOption array
|
|
364
|
+
* - JSON Schema oneOf items -> converted to FieldOption
|
|
365
|
+
* - FieldOption array -> passed through
|
|
378
366
|
* - String array -> converted to FieldOption
|
|
379
367
|
*
|
|
380
368
|
* @param options - Options in various formats
|
|
@@ -407,9 +395,9 @@ export declare function getSchemaOptions(schema: FieldSchema): FieldOption[];
|
|
|
407
395
|
* required: ["name"]
|
|
408
396
|
* },
|
|
409
397
|
* values: { name: "John", age: 30 },
|
|
410
|
-
* onChange: (values) =>
|
|
398
|
+
* onChange: (values) => handleChange(values),
|
|
411
399
|
* showActions: true,
|
|
412
|
-
* onSave: (values) =>
|
|
400
|
+
* onSave: (values) => handleSave(values)
|
|
413
401
|
* };
|
|
414
402
|
* ```
|
|
415
403
|
*/
|
|
@@ -33,8 +33,8 @@ export function oneOfToOptions(oneOfItems) {
|
|
|
33
33
|
/**
|
|
34
34
|
* Normalize options to FieldOption format
|
|
35
35
|
* Handles multiple input formats for consistent internal handling:
|
|
36
|
-
* - JSON Schema oneOf items
|
|
37
|
-
* - FieldOption array
|
|
36
|
+
* - JSON Schema oneOf items -> converted to FieldOption
|
|
37
|
+
* - FieldOption array -> passed through
|
|
38
38
|
* - String array -> converted to FieldOption
|
|
39
39
|
*
|
|
40
40
|
* @param options - Options in various formats
|
|
@@ -48,7 +48,7 @@ export function normalizeOptions(options) {
|
|
|
48
48
|
if (isOneOfArray(options)) {
|
|
49
49
|
return oneOfToOptions(options);
|
|
50
50
|
}
|
|
51
|
-
// Handle FieldOption array
|
|
51
|
+
// Handle FieldOption array
|
|
52
52
|
if (isFieldOptionArray(options)) {
|
|
53
53
|
return options;
|
|
54
54
|
}
|
|
@@ -66,13 +66,8 @@ export function normalizeOptions(options) {
|
|
|
66
66
|
* @returns Normalized FieldOption array
|
|
67
67
|
*/
|
|
68
68
|
export function getSchemaOptions(schema) {
|
|
69
|
-
// Prefer standard oneOf pattern
|
|
70
69
|
if (schema.oneOf && schema.oneOf.length > 0) {
|
|
71
70
|
return oneOfToOptions(schema.oneOf);
|
|
72
71
|
}
|
|
73
|
-
// Fall back to deprecated options property
|
|
74
|
-
if (schema.options && schema.options.length > 0) {
|
|
75
|
-
return schema.options;
|
|
76
|
-
}
|
|
77
72
|
return [];
|
|
78
73
|
}
|
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
<script module>
|
|
2
|
-
import { defineMeta } from
|
|
3
|
-
import ChoicePrompt from
|
|
4
|
-
import { fn } from
|
|
5
|
-
import { createChoiceConfig } from
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ChoicePrompt from './ChoicePrompt.svelte';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
import { createChoiceConfig } from '../../stories/utils.js';
|
|
6
6
|
|
|
7
7
|
const { Story } = defineMeta({
|
|
8
|
-
title:
|
|
8
|
+
title: 'Interrupt/ChoicePrompt',
|
|
9
9
|
component: ChoicePrompt,
|
|
10
|
-
tags: [
|
|
10
|
+
tags: ['autodocs'],
|
|
11
11
|
args: {
|
|
12
12
|
config: createChoiceConfig(),
|
|
13
13
|
isResolved: false,
|
|
14
14
|
isSubmitting: false,
|
|
15
|
-
onSubmit: fn()
|
|
16
|
-
}
|
|
15
|
+
onSubmit: fn()
|
|
16
|
+
}
|
|
17
17
|
});
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<Story name="Single Select" />
|
|
21
21
|
|
|
22
|
-
<Story
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
<Story
|
|
23
|
+
name="Multi Select"
|
|
24
|
+
args={{
|
|
25
|
+
config: createChoiceConfig({
|
|
26
|
+
message: 'Select the features to enable:',
|
|
27
|
+
multiple: true,
|
|
28
|
+
options: [
|
|
29
|
+
{ value: 'auth', label: 'Authentication', description: 'User login and signup' },
|
|
30
|
+
{ value: 'analytics', label: 'Analytics', description: 'Usage tracking and metrics' },
|
|
31
|
+
{ value: 'notifications', label: 'Notifications', description: 'Email and push alerts' },
|
|
32
|
+
{ value: 'export', label: 'Data Export', description: 'CSV and JSON export' }
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
34
37
|
|
|
35
|
-
<Story
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
<Story
|
|
39
|
+
name="Resolved"
|
|
40
|
+
args={{
|
|
41
|
+
isResolved: true,
|
|
42
|
+
resolvedValue: 'high',
|
|
43
|
+
resolvedByUserName: 'Bob'
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
40
46
|
|
|
41
|
-
<Story
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
<Story
|
|
48
|
+
name="Submitting"
|
|
49
|
+
args={{
|
|
50
|
+
isSubmitting: true
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
@@ -11,7 +11,7 @@ declare const ChoicePrompt: $$__sveltets_2_IsomorphicComponent<{
|
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {}, {}, string>;
|
|
14
|
-
import ChoicePrompt from
|
|
14
|
+
import ChoicePrompt from './ChoicePrompt.svelte';
|
|
15
15
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
17
|
$$bindings?: Bindings;
|
|
@@ -1,49 +1,71 @@
|
|
|
1
1
|
<script module>
|
|
2
|
-
import { defineMeta } from
|
|
3
|
-
import ConfirmationPrompt from
|
|
4
|
-
import { fn } from
|
|
5
|
-
import { createConfirmationConfig } from
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ConfirmationPrompt from './ConfirmationPrompt.svelte';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
import { createConfirmationConfig } from '../../stories/utils.js';
|
|
6
6
|
|
|
7
7
|
const { Story } = defineMeta({
|
|
8
|
-
title:
|
|
8
|
+
title: 'Interrupt/ConfirmationPrompt',
|
|
9
9
|
component: ConfirmationPrompt,
|
|
10
|
-
tags: [
|
|
10
|
+
tags: ['autodocs'],
|
|
11
11
|
args: {
|
|
12
12
|
config: createConfirmationConfig(),
|
|
13
13
|
isResolved: false,
|
|
14
14
|
isSubmitting: false,
|
|
15
15
|
onConfirm: fn(),
|
|
16
|
-
onDecline: fn()
|
|
17
|
-
}
|
|
16
|
+
onDecline: fn()
|
|
17
|
+
}
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<Story name="Pending" />
|
|
22
22
|
|
|
23
|
-
<Story
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
<Story
|
|
24
|
+
name="Custom Labels"
|
|
25
|
+
args={{
|
|
26
|
+
config: createConfirmationConfig({
|
|
27
|
+
message: 'Deploy to production?',
|
|
28
|
+
confirmLabel: 'Deploy',
|
|
29
|
+
cancelLabel: 'Abort'
|
|
30
|
+
})
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<Story
|
|
35
|
+
name="Confirmed"
|
|
36
|
+
args={{
|
|
37
|
+
isResolved: true,
|
|
38
|
+
resolvedValue: true
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<Story
|
|
43
|
+
name="Declined"
|
|
44
|
+
args={{
|
|
45
|
+
isResolved: true,
|
|
46
|
+
resolvedValue: false
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<Story
|
|
51
|
+
name="Submitting"
|
|
52
|
+
args={{
|
|
53
|
+
isSubmitting: true
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<Story
|
|
58
|
+
name="With Error"
|
|
59
|
+
args={{
|
|
60
|
+
error: 'Network error: Failed to submit response'
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<Story
|
|
65
|
+
name="Resolved By User"
|
|
66
|
+
args={{
|
|
67
|
+
isResolved: true,
|
|
68
|
+
resolvedValue: true,
|
|
69
|
+
resolvedByUserName: 'Alice'
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
@@ -11,7 +11,7 @@ declare const ConfirmationPrompt: $$__sveltets_2_IsomorphicComponent<{
|
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {}, {}, string>;
|
|
14
|
-
import ConfirmationPrompt from
|
|
14
|
+
import ConfirmationPrompt from './ConfirmationPrompt.svelte';
|
|
15
15
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
17
|
$$bindings?: Bindings;
|
|
@@ -1,46 +1,67 @@
|
|
|
1
1
|
<script module>
|
|
2
|
-
import { defineMeta } from
|
|
3
|
-
import ReviewPrompt from
|
|
4
|
-
import { fn } from
|
|
5
|
-
import { createReviewConfig } from
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ReviewPrompt from './ReviewPrompt.svelte';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
import { createReviewConfig } from '../../stories/utils.js';
|
|
6
6
|
|
|
7
7
|
const { Story } = defineMeta({
|
|
8
|
-
title:
|
|
8
|
+
title: 'Interrupt/ReviewPrompt',
|
|
9
9
|
component: ReviewPrompt,
|
|
10
|
-
tags: [
|
|
10
|
+
tags: ['autodocs'],
|
|
11
11
|
args: {
|
|
12
12
|
config: createReviewConfig(),
|
|
13
13
|
isResolved: false,
|
|
14
14
|
isSubmitting: false,
|
|
15
|
-
onSubmit: fn()
|
|
16
|
-
}
|
|
15
|
+
onSubmit: fn()
|
|
16
|
+
}
|
|
17
17
|
});
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<Story name="Default" />
|
|
21
21
|
|
|
22
|
-
<Story
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
22
|
+
<Story
|
|
23
|
+
name="Many Changes"
|
|
24
|
+
args={{
|
|
25
|
+
config: createReviewConfig({
|
|
26
|
+
message: 'Review the content updates:',
|
|
27
|
+
changes: [
|
|
28
|
+
{
|
|
29
|
+
field: 'title',
|
|
30
|
+
label: 'Title',
|
|
31
|
+
original: 'Getting Started',
|
|
32
|
+
proposed: 'Quick Start Guide'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
field: 'slug',
|
|
36
|
+
label: 'URL Slug',
|
|
37
|
+
original: '/getting-started',
|
|
38
|
+
proposed: '/quick-start-guide'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
field: 'description',
|
|
42
|
+
label: 'Meta Description',
|
|
43
|
+
original: 'Learn how to get started',
|
|
44
|
+
proposed: 'A quick start guide for new users'
|
|
45
|
+
},
|
|
46
|
+
{ field: 'author', label: 'Author', original: 'admin', proposed: 'editor' },
|
|
47
|
+
{ field: 'status', label: 'Status', original: 'draft', proposed: 'published' }
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
34
52
|
|
|
35
|
-
<Story
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
<Story
|
|
54
|
+
name="Resolved"
|
|
55
|
+
args={{
|
|
56
|
+
isResolved: true,
|
|
57
|
+
resolvedValue: {
|
|
58
|
+
decisions: {
|
|
59
|
+
title: { accepted: true, value: 'New Title' },
|
|
60
|
+
description: { accepted: false, value: 'Old description text' },
|
|
61
|
+
status: { accepted: true, value: 'published' }
|
|
62
|
+
},
|
|
63
|
+
summary: { accepted: 2, rejected: 1, total: 3 }
|
|
42
64
|
},
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}} />
|
|
65
|
+
resolvedByUserName: 'Diana'
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
@@ -11,7 +11,7 @@ declare const ReviewPrompt: $$__sveltets_2_IsomorphicComponent<{
|
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {}, {}, string>;
|
|
14
|
-
import ReviewPrompt from
|
|
14
|
+
import ReviewPrompt from './ReviewPrompt.svelte';
|
|
15
15
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
17
|
$$bindings?: Bindings;
|
|
@@ -176,7 +176,11 @@
|
|
|
176
176
|
* Supports strings (word-level), arrays (element-level), and objects (JSON line-level).
|
|
177
177
|
* For HTML strings, strips tags and diffs the plain text content.
|
|
178
178
|
*/
|
|
179
|
-
function computeDiff(
|
|
179
|
+
function computeDiff(
|
|
180
|
+
original: unknown,
|
|
181
|
+
proposed: unknown,
|
|
182
|
+
rawMode: boolean = false
|
|
183
|
+
): Change[] | null {
|
|
180
184
|
if (typeof original === 'string' && typeof proposed === 'string') {
|
|
181
185
|
const origText = !rawMode && containsHtml(original) ? stripHtmlTags(original) : original;
|
|
182
186
|
const propText = !rawMode && containsHtml(proposed) ? stripHtmlTags(proposed) : proposed;
|
|
@@ -335,9 +339,13 @@
|
|
|
335
339
|
<div class="review-prompt__diff-row">
|
|
336
340
|
<span class="review-prompt__diff-label">Original:</span>
|
|
337
341
|
{#if isHtml && !isRawView}
|
|
338
|
-
<span class="review-prompt__diff-value review-prompt__html-content"
|
|
342
|
+
<span class="review-prompt__diff-value review-prompt__html-content"
|
|
343
|
+
>{@html sanitizeHtml(String(change.original))}</span
|
|
344
|
+
>
|
|
339
345
|
{:else if isHtml && isRawView}
|
|
340
|
-
<code class="review-prompt__diff-value review-prompt__raw-html"
|
|
346
|
+
<code class="review-prompt__diff-value review-prompt__raw-html"
|
|
347
|
+
>{change.original}</code
|
|
348
|
+
>
|
|
341
349
|
{:else}
|
|
342
350
|
<span class="review-prompt__diff-value">
|
|
343
351
|
{formatValue(change.original)}
|
|
@@ -347,9 +355,15 @@
|
|
|
347
355
|
<div class="review-prompt__diff-row">
|
|
348
356
|
<span class="review-prompt__diff-label">Proposed:</span>
|
|
349
357
|
{#if isHtml && !isRawView}
|
|
350
|
-
<span
|
|
358
|
+
<span
|
|
359
|
+
class="review-prompt__diff-value review-prompt__diff-value--proposed review-prompt__html-content"
|
|
360
|
+
>{@html sanitizeHtml(String(change.proposed))}</span
|
|
361
|
+
>
|
|
351
362
|
{:else if isHtml && isRawView}
|
|
352
|
-
<code
|
|
363
|
+
<code
|
|
364
|
+
class="review-prompt__diff-value review-prompt__diff-value--proposed review-prompt__raw-html"
|
|
365
|
+
>{change.proposed}</code
|
|
366
|
+
>
|
|
353
367
|
{:else}
|
|
354
368
|
<span class="review-prompt__diff-value review-prompt__diff-value--proposed">
|
|
355
369
|
{formatValue(change.proposed)}
|
|
@@ -359,21 +373,26 @@
|
|
|
359
373
|
{#if diff}
|
|
360
374
|
<div class="review-prompt__diff-row">
|
|
361
375
|
<span class="review-prompt__diff-label">Diff:</span>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
{
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
{#if isMultiLineDiff(diff)}
|
|
377
|
+
<pre
|
|
378
|
+
class="review-prompt__diff-value review-prompt__diff-block">{#each diff as part}{#if part.added}<span
|
|
379
|
+
class="review-prompt__diff-token--added">{part.value}</span
|
|
380
|
+
>{:else if part.removed}<span class="review-prompt__diff-token--removed"
|
|
381
|
+
>{part.value}</span
|
|
382
|
+
>{:else}<span>{part.value}</span>{/if}{/each}</pre>
|
|
383
|
+
{:else}
|
|
384
|
+
<span class="review-prompt__diff-value review-prompt__diff-inline">
|
|
385
|
+
{#each diff as part}
|
|
386
|
+
{#if part.added}
|
|
387
|
+
<span class="review-prompt__diff-token--added">{part.value}</span>
|
|
388
|
+
{:else if part.removed}
|
|
389
|
+
<span class="review-prompt__diff-token--removed">{part.value}</span>
|
|
390
|
+
{:else}
|
|
391
|
+
<span>{part.value}</span>
|
|
392
|
+
{/if}
|
|
393
|
+
{/each}
|
|
394
|
+
</span>
|
|
395
|
+
{/if}
|
|
377
396
|
</div>
|
|
378
397
|
{/if}
|
|
379
398
|
</div>
|
|
@@ -404,8 +423,8 @@
|
|
|
404
423
|
{#if isResolved && resolvedValue}
|
|
405
424
|
<div class="review-prompt__summary">
|
|
406
425
|
<span class="review-prompt__summary-text">
|
|
407
|
-
{resolvedValue.summary.accepted} accepted, {resolvedValue.summary.rejected} rejected
|
|
408
|
-
|
|
426
|
+
{resolvedValue.summary.accepted} accepted, {resolvedValue.summary.rejected} rejected out of {resolvedValue
|
|
427
|
+
.summary.total} changes
|
|
409
428
|
</span>
|
|
410
429
|
</div>
|
|
411
430
|
{/if}
|
|
@@ -415,9 +434,7 @@
|
|
|
415
434
|
<div class="review-prompt__resolved-badge">
|
|
416
435
|
<Icon icon="mdi:check-circle" />
|
|
417
436
|
<span>
|
|
418
|
-
{resolvedByUserName
|
|
419
|
-
? `Response submitted by ${resolvedByUserName}`
|
|
420
|
-
: 'Response submitted'}
|
|
437
|
+
{resolvedByUserName ? `Response submitted by ${resolvedByUserName}` : 'Response submitted'}
|
|
421
438
|
</span>
|
|
422
439
|
</div>
|
|
423
440
|
{/if}
|