diff --git a/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json b/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json index 67bdf6ea9d..dcd14131c0 100644 --- a/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json +++ b/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json b/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json index 272aefc9d2..ad66cfa646 100644 --- a/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json +++ b/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json @@ -67,6 +67,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json b/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json index 4df35d6cf7..2e4467041b 100644 --- a/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json +++ b/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json @@ -28,6 +28,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json b/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json index e6282c7e80..c84e2ab8e2 100644 --- a/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json +++ b/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json @@ -60,6 +60,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-98c8e2c58b38beedcb474251c2554a2f1b768ec7ed1a419313f4842f26425e5d.json b/backend/.sqlx/query-98c8e2c58b38beedcb474251c2554a2f1b768ec7ed1a419313f4842f26425e5d.json new file mode 100644 index 0000000000..dbbbc03a87 --- /dev/null +++ b/backend/.sqlx/query-98c8e2c58b38beedcb474251c2554a2f1b768ec7ed1a419313f4842f26425e5d.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO folder (workspace_id, name, display_name, owners, extra_perms) VALUES ($1, 'app_custom', 'App Custom Components', ARRAY[]::TEXT[], '{\"g/all\": false}') ON CONFLICT DO NOTHING", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "98c8e2c58b38beedcb474251c2554a2f1b768ec7ed1a419313f4842f26425e5d" +} diff --git a/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json b/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json index 61da7601af..8b139967a6 100644 --- a/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json +++ b/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json @@ -40,6 +40,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-a9915d3c72a278ff08fbe6571c2a4fc993507e255004107345b7151322e063de.json b/backend/.sqlx/query-a9915d3c72a278ff08fbe6571c2a4fc993507e255004107345b7151322e063de.json index de4127eb14..b0437fe128 100644 --- a/backend/.sqlx/query-a9915d3c72a278ff08fbe6571c2a4fc993507e255004107345b7151322e063de.json +++ b/backend/.sqlx/query-a9915d3c72a278ff08fbe6571c2a4fc993507e255004107345b7151322e063de.json @@ -46,6 +46,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json b/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json index 40ab7503e5..0385dfd1d5 100644 --- a/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json +++ b/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json b/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json index 3b43ee29f5..091c4160e3 100644 --- a/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json +++ b/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json b/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json index c0c9ef873f..7df86d1a0e 100644 --- a/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json +++ b/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json @@ -37,6 +37,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-e92536776a1960fa739bbb01d5a8d1b451ff2689a95442bdf820c65f0a8412a5.json b/backend/.sqlx/query-e92536776a1960fa739bbb01d5a8d1b451ff2689a95442bdf820c65f0a8412a5.json new file mode 100644 index 0000000000..a818fbdcc1 --- /dev/null +++ b/backend/.sqlx/query-e92536776a1960fa739bbb01d5a8d1b451ff2689a95442bdf820c65f0a8412a5.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT value->>'js' FROM resource\n WHERE path = $1 AND workspace_id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "?column?", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "e92536776a1960fa739bbb01d5a8d1b451ff2689a95442bdf820c65f0a8412a5" +} diff --git a/backend/migrations/20231108200232_add_custom_components.down.sql b/backend/migrations/20231108200232_add_custom_components.down.sql new file mode 100644 index 0000000000..d2f607c5b8 --- /dev/null +++ b/backend/migrations/20231108200232_add_custom_components.down.sql @@ -0,0 +1 @@ +-- Add down migration script here diff --git a/backend/migrations/20231108200232_add_custom_components.up.sql b/backend/migrations/20231108200232_add_custom_components.up.sql new file mode 100644 index 0000000000..f5705d9ff0 --- /dev/null +++ b/backend/migrations/20231108200232_add_custom_components.up.sql @@ -0,0 +1,2 @@ +-- Add up migration script here +INSERT INTO folder (workspace_id, name, display_name, owners, extra_perms) SELECT id, 'app_custom', 'App Custom Components', ARRAY[]::TEXT[], '{"g/all": false}' FROM workspace ON CONFLICT DO NOTHING; diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index 9cceff91d2..15d80bbc16 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -245,6 +245,10 @@ pub async fn run_server( "/w/:workspace_id/jobs_u", jobs::global_service().layer(cors.clone()), ) + .nest( + "/w/:workspace_id/resources_u", + resources::public_service().layer(cors.clone()), + ) .nest( "/w/:workspace_id/capture_u", capture::global_service().layer(cors), diff --git a/backend/windmill-api/src/resources.rs b/backend/windmill-api/src/resources.rs index e8d9cefdce..bda0e34d4b 100644 --- a/backend/windmill-api/src/resources.rs +++ b/backend/windmill-api/src/resources.rs @@ -12,11 +12,14 @@ use crate::{ webhook_util::{WebhookMessage, WebhookShared}, }; use axum::{ + body, extract::{Extension, Path, Query}, + response::Response, routing::{delete, get, post}, Json, Router, }; -use hyper::StatusCode; +use bytes::Bytes; +use hyper::{header, StatusCode}; use serde::{Deserialize, Serialize}; use serde_json::{value::RawValue, Value}; use sql_builder::{bind::Bind, SqlBuilder}; @@ -56,6 +59,10 @@ pub fn workspaced_service() -> Router { .route("/type/create", post(create_resource_type)) } +pub fn public_service() -> Router { + Router::new().route("/custom_component/:name", get(custom_component)) +} + #[derive(FromRow, Serialize, Deserialize)] pub struct ResourceType { pub workspace_id: String, @@ -306,6 +313,33 @@ async fn get_resource_value( Ok(Json(value)) } +async fn custom_component( + authed: ApiAuthed, + Extension(user_db): Extension, + Path((w_id, name)): Path<(String, String)>, +) -> Result { + let mut tx = user_db.begin(&authed).await?; + + let cc_o = sqlx::query_scalar!( + "SELECT value->>'js' FROM resource + WHERE path = $1 AND workspace_id = $2", + format!("f/app_custom/{name}"), + &w_id + ) + .fetch_optional(&mut *tx) + .await? + .flatten(); + + tx.commit().await?; + + let cc = not_found_if_none(cc_o, "Custom Component", name)?; + let res = Response::builder().header(header::CONTENT_TYPE, "text/javascript"); + + Ok(res + .body(body::boxed(body::Full::from(Bytes::from(cc)))) + .unwrap()) +} + #[derive(Deserialize)] struct JobInfo { job_id: Option, diff --git a/backend/windmill-api/src/workspaces.rs b/backend/windmill-api/src/workspaces.rs index 17a6d546f9..1b636e5010 100644 --- a/backend/windmill-api/src/workspaces.rs +++ b/backend/windmill-api/src/workspaces.rs @@ -1028,6 +1028,13 @@ async fn create_workspace( .execute(&mut *tx) .await?; + sqlx::query!( + "INSERT INTO folder (workspace_id, name, display_name, owners, extra_perms) VALUES ($1, 'app_custom', 'App Custom Components', ARRAY[]::TEXT[], '{\"g/all\": false}') ON CONFLICT DO NOTHING", + nw.id, + ) + .execute(&mut *tx) + .await?; + sqlx::query!( "INSERT INTO folder (workspace_id, name, display_name, owners, extra_perms) VALUES ($1, 'app_groups', 'App Groups', ARRAY[]::TEXT[], '{\"g/all\": false}') ON CONFLICT DO NOTHING", nw.id, diff --git a/frontend/src/lib/components/Path.svelte b/frontend/src/lib/components/Path.svelte index db9b58f20e..0aaf5fd877 100644 --- a/frontend/src/lib/components/Path.svelte +++ b/frontend/src/lib/components/Path.svelte @@ -133,7 +133,14 @@ workspace: $workspaceStore! }) ) - .filter((x) => x != initialFolder) + .filter( + (x) => + x != initialFolder && + x != 'app_groups' && + x != 'app_custom' && + x != 'app_themes' && + x != 'app_custom' + ) .map((x) => ({ name: x, write: diff --git a/frontend/src/lib/components/apps/components/display/AppCustomComponent.svelte b/frontend/src/lib/components/apps/components/display/AppCustomComponent.svelte new file mode 100644 index 0000000000..9c7d1fd9a9 --- /dev/null +++ b/frontend/src/lib/components/apps/components/display/AppCustomComponent.svelte @@ -0,0 +1,113 @@ + + + + +{#if render} +
+ + {#if !loaded} + + {/if} +
+ +
+{/if} diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index 7586bc68d2..9493091160 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -388,16 +388,20 @@ let css: string | undefined = undefined + let lastTheme: string | undefined = undefined appStore.subscribe(async (currentAppStore) => { if (!currentAppStore.theme) { return } - if (currentAppStore.theme.type === 'inlined') { - css = currentAppStore.theme.css - } else if (currentAppStore.theme.type === 'path' && currentAppStore.theme?.path) { - let loadedCss = await getTheme($workspaceStore!, currentAppStore.theme.path) - css = loadedCss.value + if (JSON.stringify(currentAppStore.theme) != lastTheme) { + if (currentAppStore.theme.type === 'inlined') { + css = currentAppStore.theme.css + } else if (currentAppStore.theme.type === 'path' && currentAppStore.theme?.path) { + let loadedCss = await getTheme($workspaceStore!, currentAppStore.theme.path) + css = loadedCss.value + } + lastTheme = JSON.stringify(currentAppStore.theme) } }) diff --git a/frontend/src/lib/components/apps/editor/appUtils.ts b/frontend/src/lib/components/apps/editor/appUtils.ts index 5f0bdd6f76..d071a278f8 100644 --- a/frontend/src/lib/components/apps/editor/appUtils.ts +++ b/frontend/src/lib/components/apps/editor/appUtils.ts @@ -268,7 +268,8 @@ export function cleanseOneOfConfiguration( export function appComponentFromType( type: T, - overrideConfiguration?: Partial + overrideConfiguration?: Partial, + extra?: any ): (id: string) => BaseAppComponent & BaseComponent { return (id: string) => { const init = JSON.parse(JSON.stringify(ccomponents[type].initialData)) as InitialAppComponent @@ -304,7 +305,8 @@ export function appComponentFromType( numberOfSubgrids: init.numberOfSubgrids, horizontalAlignment: init.horizontalAlignment, verticalAlignment: init.verticalAlignment, - id + id, + ...(extra ?? {}) } } } @@ -424,9 +426,7 @@ export function getAllSubgridsAndComponentIds( return [subgrids, components] } -export function getAllGridItems( - app: App - ): GridItem[] { +export function getAllGridItems(app: App): GridItem[] { return app.grid.concat(Object.values(app.subgrids ?? {}).flat()) } diff --git a/frontend/src/lib/components/apps/editor/component/Component.svelte b/frontend/src/lib/components/apps/editor/component/Component.svelte index 77bd183ef6..3457e1e049 100644 --- a/frontend/src/lib/components/apps/editor/component/Component.svelte +++ b/frontend/src/lib/components/apps/editor/component/Component.svelte @@ -62,6 +62,7 @@ import AppJobIdFlowStatus from '../../components/display/AppJobIdFlowStatus.svelte' import AppCarouselList from '../../components/display/AppCarouselList.svelte' import AppAggridTableEe from '../../components/display/table/AppAggridTableEe.svelte' + import AppCustomComponent from '../../components/display/AppCustomComponent.svelte' export let component: AppComponent export let selected: boolean @@ -231,6 +232,13 @@ componentInput={component.componentInput} {render} /> + {:else if component.type === 'customcomponent'} + {:else if component.type === 'mardowncomponent'} export type TextInputComponent = BaseComponent<'textinputcomponent'> export type QuillComponent = BaseComponent<'quillcomponent'> @@ -75,6 +81,9 @@ export type CurrencyComponent = BaseComponent<'currencycomponent'> export type SliderComponent = BaseComponent<'slidercomponent'> export type RangeComponent = BaseComponent<'rangecomponent'> export type HtmlComponent = BaseComponent<'htmlcomponent'> +export type CustomComponent = BaseComponent<'customcomponent'> & { + customComponent: CustomComponentConfig +} export type MarkdownComponent = BaseComponent<'mardowncomponent'> export type VegaLiteComponent = BaseComponent<'vegalitecomponent'> export type PlotlyComponent = BaseComponent<'plotlycomponent'> @@ -173,6 +182,7 @@ export type TypedComponent = | BarChartComponent | TimeseriesComponent | HtmlComponent + | CustomComponent | MarkdownComponent | TableComponent | TextComponent @@ -1198,6 +1208,23 @@ Hello \${ctx.username} configuration: {} } }, + customcomponent: { + name: 'Custom', + icon: Code2, + documentationLink: `${documentationBaseUrl}#custom`, + dims: '1:2-1:2' as AppComponentDimensions, + customCss: { + container: { class: '', style: '' } + }, + initialData: { + componentInput: { + type: 'static', + fieldType: 'object', + value: {} + }, + configuration: {} + } + }, mardowncomponent: { name: 'Markdown', icon: Heading1, diff --git a/frontend/src/lib/components/apps/editor/component/sets.ts b/frontend/src/lib/components/apps/editor/component/sets.ts index ff6121a26a..a0a0ff7770 100644 --- a/frontend/src/lib/components/apps/editor/component/sets.ts +++ b/frontend/src/lib/components/apps/editor/component/sets.ts @@ -63,7 +63,8 @@ const display: ComponentSet = { 'pdfcomponent', 'displaycomponent', 'jobidlogcomponent', - 'jobidflowstatuscomponent' + 'jobidflowstatuscomponent', + 'customcomponent' ] } as const diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte index 9645e74f0f..6abb59680e 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte @@ -1,6 +1,6 @@ -
+ + + + + + +
@@ -170,7 +247,7 @@
{#if groups} - {#each groups as group (group)} + {#each groups as group (group.path)}
{/each} {/if} +
+ +
Add new
+
+
+
+ +
+ {#if customComponents} + {#each customComponents as cc (cc.path)} +
+ +
+ {cc.name} +
+
+ {/each} + {/if} +
+ +
Add new
+
diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentRow.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentRow.svelte new file mode 100644 index 0000000000..3bc8adf61c --- /dev/null +++ b/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentRow.svelte @@ -0,0 +1,87 @@ + + + + +
+ { + if (!$workspaceStore) return + const cc = await ResourceService.getResourceValue({ + workspace: $workspaceStore ?? '', + path: row.path + }) + await ResourceService.updateResource({ + workspace: $workspaceStore ?? '', + path: row.path, + requestBody: { + path: `f/app_custom/${e.detail.name.replace(/-/g, '_').replace(/\s/g, '_')}`, + value: { + ...cc, + name: e.detail.name + } + } + }) + dispatch('reload') + + sendUserToast('Component name updated:\n' + e.detail.name) + }} + {row} + /> + {row.name} +
+
+ + +
+ +
+
+ diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentsList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentsList.svelte new file mode 100644 index 0000000000..463511eb31 --- /dev/null +++ b/frontend/src/lib/components/apps/editor/componentsPanel/CustomComponentsList.svelte @@ -0,0 +1,132 @@ + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ + {#if loading} +
+ {#each new Array(6) as _} + + {/each} +
+ {:else if Array.isArray(customcomponents) && customcomponents.length > 0} +
+ + + + Path + + + + + {#if customcomponents && customcomponents.length > 0} + {#each customcomponents as row} + {#key row} + { + getCustomComponents() + dispatch('reload') + }} + /> + {/key} + {/each} + {:else} + Loading... + {/if} + + +
+ {/if} +
diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/GroupList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/GroupList.svelte index 5319e28160..dec1b3e583 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/GroupList.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/GroupList.svelte @@ -1,7 +1,7 @@ +
+
diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/GroupManagementDrawer.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/GroupManagementDrawer.svelte index 51a2758c8b..3a1d9ca767 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/GroupManagementDrawer.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/GroupManagementDrawer.svelte @@ -1,25 +1,10 @@ - - + + diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/GroupRow.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/GroupRow.svelte index e8130c0cef..da0d7bbc85 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/GroupRow.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/GroupRow.svelte @@ -1,5 +1,5 @@
-
Edit group name
+
Edit {kind} name
- + diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts b/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts index 42ad822d29..94df15ed4d 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts +++ b/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts @@ -559,6 +559,7 @@ export const quickStyleProperties: Record< container: containerDefaultProps, button: buttonDefaultProps }, + customcomponent: {}, htmlcomponent: { container: [ layoutGrouping, diff --git a/frontend/src/lib/components/common/button/ButtonDropdown.svelte b/frontend/src/lib/components/common/button/ButtonDropdown.svelte index 3a8ada9250..7b0311063f 100644 --- a/frontend/src/lib/components/common/button/ButtonDropdown.svelte +++ b/frontend/src/lib/components/common/button/ButtonDropdown.svelte @@ -6,7 +6,7 @@ import Portal from 'svelte-portal' export let hasPadding: boolean = true - + export let target: string | undefined = undefined const [popperRef, popperContent] = createPopperActions({ placement: 'auto' }) const popperOptions: PopperOptions<{}> = { @@ -38,7 +38,7 @@ - +
button:focus,.mycomponent>button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){.mycomponent{color:#213547;background-color:#fff}.mycomponent a:hover{color:#747bff}.mycomponent button{background-color:#f9f9f9}}.mycomponent{margin:0 auto;text-align:center}.mycomponent .card{padding:2em}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})(); +var wmc=function(t,e,r){"use strict";const w="";function i({passSetters:n,setOutput:m,renderInit:u}){const[d,l]=e.useState(u),[s,c]=e.useState(void 0);return e.useEffect(()=>{n({onInput:a=>{c(a)},onRender:l})},[l,n]),d?e.createElement(e.Fragment,null,e.createElement("h1",null,"Minimal Component"),e.createElement("pre",null,JSON.stringify(s)),e.createElement("button",{style:{fontSize:"12px",marginBottom:"10px"},onClick:()=>{m("hello world")}},"set output")):e.createElement(e.Fragment,null)}function o(n){r.createRoot(document.getElementById(n.id)).render(e.createElement(e.StrictMode,null,e.createElement(i,{passSetters:n.passSetters,setOutput:n.setOutput,renderInit:n.render})))}return window.windmill===void 0&&(window.windmill={}),window.windmill.mycomponent=o,t.customComponent=o,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({},React,ReactDOM);