{#each Object.keys(inputSpecs) as inputSpecKey, index (index)}
{@const input = inputSpecs[inputSpecKey]}
-
-
{
- if (openedProp === inputSpecKey) {
- openedProp = undefined
- } else {
- openedProp = inputSpecKey
- }
- }}
- >
- {inputSpecKey}
- {#if input?.fieldType}
-
- {capitalize(fieldTypeToTsType(input.fieldType))}
-
- {/if}
-
- {#if inputSpecKey === openedProp}
-
- {#if staticOnly}
+ {#if true}
+
+
+
{capitalize(inputSpecKey)}
+
+
+
+ {input.fieldType === 'array' && input.subFieldType
+ ? `${capitalize(fieldTypeToTsType(input.subFieldType))}[]`
+ : capitalize(fieldTypeToTsType(input.fieldType))}
+
+
-
- Static
-
+
- Connect
-
+ iconOnly
+ disabled={staticOnly}
+ />
{#if userInputEnabled}
- User
-
+ iconOnly
+ disabled={staticOnly && !userInputEnabled}
+ />
{/if}
- {/if}
-
+
- {/if}
-
+
+
+
+ {/if}
{/each}
{:else}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/Recompute.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/Recompute.svelte
new file mode 100644
index 0000000000..0826613b4c
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/Recompute.svelte
@@ -0,0 +1,55 @@
+
+
+
+ {#if Object.keys($runnableComponents ?? {}).length > 0}
+
+ {:else}
+ No components to recompute
+ {/if}
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
index 30224a75c8..5fcf21b791 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
@@ -1,12 +1,11 @@
@@ -29,41 +28,21 @@
{/each}
- {:else if componentInput.fieldType === 'array'}
-
- {#if componentInput.value}
- {#each componentInput.value as value, index}
-
- {
- if (componentInput?.type === 'static' && componentInput.value) {
- componentInput.value[index] = JSON.parse(e.detail.code)
- }
- }}
- />
-
- {/each}
-
- {/if}
+ {:else if componentInput.fieldType === 'object'}
+
+ {
+ if (componentInput?.type === 'static' && componentInput.value) {
+ componentInput.value = JSON.parse(e.detail.code)
+ }
+ }}
+ />
+ {:else if componentInput.fieldType === 'array'}
+
{:else}
{/if}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/SubTypeEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/SubTypeEditor.svelte
new file mode 100644
index 0000000000..c21f5077c3
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/SubTypeEditor.svelte
@@ -0,0 +1,22 @@
+
+
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte
index f0236e8527..e94bf2cbd0 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte
@@ -53,7 +53,7 @@
defaultValue: '',
value: ''
},
- recompute: undefined,
+ recomputeIds: undefined,
card: false
}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
index e8bd8762f3..ce7674bf31 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
@@ -2,11 +2,12 @@
import { classNames } from '$lib/utils'
export let title: string
+ export let smallPadding: boolean = false
-
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte
new file mode 100644
index 0000000000..a2eacd035b
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte
@@ -0,0 +1,58 @@
+
+
+
x.summary} />
+
+
+
+
+
+{#if inlineScripts.length == 0}
+ Should create
+{:else if filteredItems.length == 0}
+
+{:else}
+
+ {#each filteredItems as item (item)}
+ -
+
+
+ {/each}
+
+{/if}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte
new file mode 100644
index 0000000000..2f3024b6b5
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+ Inline Scripts
+
+
+
+
+
+ Workspace Scripts
+
+
+
+
+
+ Workspace Flows
+
+
+
+
+
+ Hub Scripts
+
+
+
+
+
+
+ {#if tab == 'inlinescripts'}
+
pickInlineScript(e.detail)} />
+ {:else if tab == 'workspacescripts'}
+ pickScript(e.detail)} />
+ {:else if tab == 'workspaceflows'}
+ pickFlow(e.detail)} />
+ {:else if tab == 'hubscripts'}
+ pickScript(e.detail.path)} />
+ {/if}
+
+
+
+
+
+
+
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte
new file mode 100644
index 0000000000..b623549b6d
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte
@@ -0,0 +1,88 @@
+
+
+ (emptyString(x.summary) ? x.path : x.summary + ' (' + x.path + ')')}
+/>
+
+
+
+
+
+{#if flows}
+ {#if filteredItems.length == 0}
+
+ {:else}
+
+ {#each filteredItems as item (item)}
+ -
+
+
+ {/each}
+
+ {/if}
+{:else}
+ {#each Array(10).fill(0) as _}
+
+ {/each}
+{/if}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceScriptList.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceScriptList.svelte
new file mode 100644
index 0000000000..58ae5e2d43
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/WorkspaceScriptList.svelte
@@ -0,0 +1,89 @@
+
+
+ (emptyString(x.summary) ? x.path : x.summary + ' (' + x.path + ')')}
+/>
+
+
+
+
+
+{#if scripts}
+ {#if filteredItems.length == 0}
+
+ {:else}
+
+ {#each filteredItems as item (item)}
+ -
+
+
+ {/each}
+
+ {/if}
+{:else}
+ {#each Array(10).fill(0) as _}
+
+ {/each}
+{/if}
diff --git a/frontend/src/lib/components/apps/inputType.ts b/frontend/src/lib/components/apps/inputType.ts
index 4ceef727c2..b136ca7ee8 100644
--- a/frontend/src/lib/components/apps/inputType.ts
+++ b/frontend/src/lib/components/apps/inputType.ts
@@ -10,6 +10,7 @@ export type InputType =
| 'time'
| 'datetime'
| 'object'
+ | 'array'
// Connection to an output of another component
// defined by the id of the component and the path of the output
@@ -39,7 +40,7 @@ export type StaticInput = {
type RunnableByPath = {
path: string
- runType: 'script' | 'flow'
+ runType: 'script' | 'flow' | 'hubscript'
type: 'runnableByPath'
}
@@ -53,16 +54,22 @@ export type Runnable = RunnableByPath | RunnableByName | undefined
// Runnable input, set by the developer in the component panel
export type ResultInput = {
runnable: Runnable
- fields: AppInputs
+ fields: Record
type: 'runnable'
}
-type AppInputSpec = (StaticInput | ConnectedInput | UserInput | ResultInput) &
- InputConfiguration
+type AppInputSpec = (
+ | StaticInput
+ | ConnectedInput
+ | UserInput
+ | ResultInput
+) &
+ InputConfiguration
-type InputConfiguration = {
+type InputConfiguration = {
fieldType: T
defaultValue: U
+ subFieldType?: V
}
export type AppInput =
@@ -74,12 +81,27 @@ export type AppInput =
| AppInputSpec<'time', string>
| AppInputSpec<'datetime', string>
| AppInputSpec<'object', Record>
- | AppInputSpec<'array', any[]>
| (AppInputSpec<'select', string> & {
/**
* One of the keys of `staticValues` from `lib/components/apps/editor/componentsPanel/componentStaticValues`
*/
optionValuesKey: keyof typeof staticValues
})
+ | AppInputSpec<'array', string[], 'text'>
+ | AppInputSpec<'array', string[], 'textarea'>
+ | AppInputSpec<'array', number[], 'number'>
+ | AppInputSpec<'array', boolean[], 'boolean'>
+ | AppInputSpec<'array', string[], 'date'>
+ | AppInputSpec<'array', string[], 'time'>
+ | AppInputSpec<'array', string[], 'datetime'>
+ | AppInputSpec<'array', object[], 'object'>
+ | (AppInputSpec<'array', string[], 'select'> & {
+ optionValuesKey: keyof typeof staticValues
+ })
+
+export type StaticAppInput = Extract
+export type ConnectedAppInput = Extract
+export type UserAppInput = Extract
+export type ResultAppInput = Extract
export type AppInputs = Record
diff --git a/frontend/src/lib/components/apps/types.ts b/frontend/src/lib/components/apps/types.ts
index aa265eede6..e7334fdd81 100644
--- a/frontend/src/lib/components/apps/types.ts
+++ b/frontend/src/lib/components/apps/types.ts
@@ -2,7 +2,13 @@ import type { Schema } from '$lib/common'
import type { Preview } from '$lib/gen'
import type { FilledItem } from 'svelte-grid'
import type { Writable } from 'svelte/store'
-import type { AppInput, ConnectedInput } from './inputType'
+import type {
+ AppInput,
+ ConnectedAppInput,
+ ConnectedInput,
+ StaticAppInput,
+ UserAppInput
+} from './inputType'
import type { World } from './rx'
type BaseComponent = {
@@ -12,7 +18,7 @@ type BaseComponent = {
export type TextComponent = BaseComponent<'textcomponent'>
export type TextInputComponent = BaseComponent<'textinputcomponent'>
export type ButtonComponent = BaseComponent<'buttoncomponent'> & {
- recompute: string[] | undefined
+ recomputeIds: string[] | undefined
}
export type RunFormComponent = BaseComponent<'runformcomponent'>
@@ -40,7 +46,7 @@ export type Aligned = {
export interface BaseAppComponent extends Partial {
id: ComponentID
componentInput: AppInput | undefined
- configuration: Record
+ configuration: Record
card: boolean | undefined
// TODO: add min/max width/height
}
@@ -107,6 +113,7 @@ export type AppEditorContext = {
mode: Writable
connectingInput: Writable
breakpoint: Writable
+ runnableComponents: Writable void>>
}
export type EditorMode = 'dnd' | 'preview'
diff --git a/frontend/src/lib/components/apps/utils.ts b/frontend/src/lib/components/apps/utils.ts
index df15c87344..8a85130c19 100644
--- a/frontend/src/lib/components/apps/utils.ts
+++ b/frontend/src/lib/components/apps/utils.ts
@@ -15,13 +15,13 @@ import {
Type
} from 'lucide-svelte'
import type { InputType } from 'zlib'
-import type { AppInput, AppInputs } from './inputType'
+import type { AppInputs } from './inputType'
import type { AppComponent } from './types'
export async function loadSchema(
workspace: string,
path: string,
- runType: 'script' | 'flow'
+ runType: 'script' | 'flow' | 'hubscript'
): Promise {
if (runType === 'script') {
const script = await ScriptService.getScriptByPath({
@@ -30,13 +30,21 @@ export async function loadSchema(
})
return script.schema
- } else {
+ } else if (runType === 'flow') {
const flow = await FlowService.getFlowByPath({
workspace,
path
})
return flow.schema
+ } else {
+ const script = await ScriptService.getHubScriptByPath({
+ path
+ })
+
+ debugger
+
+ return script.schema
}
}
@@ -55,7 +63,7 @@ export function schemaToInputsSpec(schema: Schema): AppInputs {
}, {})
}
-export const displayData: Record = {
+export const displayData: Record = {
displaycomponent: {
name: 'Result',
icon: Monitor
@@ -130,68 +138,17 @@ export function accessPropertyByPath(object: T, path: string): T | undefined
return object
}
-export function fieldTypeToTsType(InputType: InputType): string {
- switch (InputType) {
+export function fieldTypeToTsType(inputType: InputType): string {
+ switch (inputType) {
case 'number':
return 'number'
case 'boolean':
return 'boolean'
case 'object':
return 'object'
+ case 'array':
+ return 'array'
default:
return 'string'
}
}
-
-const userTypeKeys = ['value']
-const staticTypeKeys = ['value']
-const dynamicTypeKeys = ['connection']
-const runnableTypeKeys = ['runnable', 'fields']
-
-export function sanitizeInputSpec(componentInput: AppInput): AppInput {
- if (componentInput.type === 'user') {
- for (const key of staticTypeKeys) {
- delete componentInput[key]
- }
- for (const key of dynamicTypeKeys) {
- delete componentInput[key]
- }
- for (const key of runnableTypeKeys) {
- delete componentInput[key]
- }
- } else if (componentInput.type === 'static') {
- for (const key of userTypeKeys) {
- delete componentInput[key]
- }
- for (const key of dynamicTypeKeys) {
- delete componentInput[key]
- }
- for (const key of runnableTypeKeys) {
- delete componentInput[key]
- }
- } else if (componentInput.type === 'connected') {
- for (const key of userTypeKeys) {
- delete componentInput[key]
- }
- for (const key of staticTypeKeys) {
- delete componentInput[key]
- }
- for (const key of runnableTypeKeys) {
- delete componentInput[key]
- }
- } else if (componentInput.type === 'runnable') {
- for (const key of userTypeKeys) {
- delete componentInput[key]
- }
-
- for (const key of staticTypeKeys) {
- delete componentInput[key]
- }
-
- for (const key of dynamicTypeKeys) {
- delete componentInput[key]
- }
- }
-
- return componentInput
-}
diff --git a/frontend/src/lib/components/common/table/Row.svelte b/frontend/src/lib/components/common/table/Row.svelte
index db25809f10..0d04ad0a48 100644
--- a/frontend/src/lib/components/common/table/Row.svelte
+++ b/frontend/src/lib/components/common/table/Row.svelte
@@ -7,6 +7,7 @@
export let marked: string | undefined
export let starred: boolean
+ export let canFavorite: boolean = true
const dispatch = createEventDispatcher()
@@ -22,7 +23,10 @@
}[kind]
-
+
@@ -44,15 +48,17 @@
-
- {
- dispatch('change')
- }}
- />
-
+ {#if canFavorite}
+
+ {
+ dispatch('change')
+ }}
+ />
+
+ {/if}
diff --git a/frontend/src/lib/components/flows/content/FlowInputsFlow.svelte b/frontend/src/lib/components/flows/content/FlowInputsFlow.svelte
index 4777a49c43..314bf504e6 100644
--- a/frontend/src/lib/components/flows/content/FlowInputsFlow.svelte
+++ b/frontend/src/lib/components/flows/content/FlowInputsFlow.svelte
@@ -88,11 +88,11 @@
{@html marked}
{:else}
{!summary || summary.length == 0 ? path : summary}
- {/if}
+ {/if}
+
{path ?? ''}
+ >{path ?? ''}
+
{description ?? ''}
diff --git a/frontend/src/routes/PickHubFlow.svelte b/frontend/src/lib/components/flows/pickers/PickHubFlow.svelte
similarity index 97%
rename from frontend/src/routes/PickHubFlow.svelte
rename to frontend/src/lib/components/flows/pickers/PickHubFlow.svelte
index 7bb15fddb8..6912fda729 100644
--- a/frontend/src/routes/PickHubFlow.svelte
+++ b/frontend/src/lib/components/flows/pickers/PickHubFlow.svelte
@@ -47,7 +47,7 @@
{#each filteredItems as item (item)}