@logicplanes/kaeso-ui 0.5.6 → 0.6.0-rc.2
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/ai/component-guides.md +303 -1
- package/ai/component-registry.json +187 -2
- package/ai/component-registry.md +49 -2
- package/ai/icons.md +3 -3
- package/ai/tokens.md +2 -1
- package/dist/blocks/delete-resource.js +1 -1
- package/dist/blocks/pages.js +4 -4
- package/dist/blocks/resource-list.js +5 -5
- package/dist/chunks/{agent-avatar-DHieggHK.js → agent-avatar-Djd5BojE.js} +4 -4
- package/dist/chunks/{agent-avatar-DHieggHK.js.map → agent-avatar-Djd5BojE.js.map} +1 -1
- package/dist/chunks/{app-frame-P0frr7bS.js → app-frame-FPxcLx5a.js} +7 -7
- package/dist/chunks/{app-frame-P0frr7bS.js.map → app-frame-FPxcLx5a.js.map} +1 -1
- package/dist/chunks/{avatar-CYNMK7uY.js → avatar-CAtsciEK.js} +3 -3
- package/dist/chunks/{avatar-CYNMK7uY.js.map → avatar-CAtsciEK.js.map} +1 -1
- package/dist/chunks/{badge-C0GC3B9X.js → badge-DCG794sL.js} +3 -3
- package/dist/chunks/{badge-C0GC3B9X.js.map → badge-DCG794sL.js.map} +1 -1
- package/dist/chunks/{banner-DEbXXqmm.js → banner-Bh9ALjtn.js} +4 -4
- package/dist/chunks/{banner-DEbXXqmm.js.map → banner-Bh9ALjtn.js.map} +1 -1
- package/dist/chunks/{button-DAzCLcr-.js → button-BhgnxxnI.js} +7 -7
- package/dist/chunks/{button-DAzCLcr-.js.map → button-BhgnxxnI.js.map} +1 -1
- package/dist/chunks/{calendar-Dc6_dl0f.js → calendar-BF77Yau7.js} +2 -2
- package/dist/chunks/{calendar-Dc6_dl0f.js.map → calendar-BF77Yau7.js.map} +1 -1
- package/dist/chunks/{checkbox-ahl1SOqU.js → checkbox-CX9ocjBN.js} +3 -3
- package/dist/chunks/{checkbox-ahl1SOqU.js.map → checkbox-CX9ocjBN.js.map} +1 -1
- package/dist/chunks/{cn-BjnOAUrA.js → cn-y70pJ-RU.js} +19 -1
- package/dist/chunks/cn-y70pJ-RU.js.map +1 -0
- package/dist/chunks/{code-xqjww4Pv.js → code-C9y0iqOD.js} +2 -2
- package/dist/chunks/{code-xqjww4Pv.js.map → code-C9y0iqOD.js.map} +1 -1
- package/dist/chunks/{code-block-CgFazxDO.js → code-block-Co5XHbO4.js} +6 -6
- package/dist/chunks/{code-block-CgFazxDO.js.map → code-block-Co5XHbO4.js.map} +1 -1
- package/dist/chunks/{code-block-DlepLS16.js → code-block-ojOGgAZo.js} +5 -5
- package/dist/chunks/{code-block-DlepLS16.js.map → code-block-ojOGgAZo.js.map} +1 -1
- package/dist/chunks/{combobox-Bl6ewCVK.js → combobox-DIDrrFMN.js} +6 -6
- package/dist/chunks/{combobox-Bl6ewCVK.js.map → combobox-DIDrrFMN.js.map} +1 -1
- package/dist/chunks/{command-list-CmFekgMn.js → command-list-DWXF8Zg5.js} +4 -4
- package/dist/chunks/{command-list-CmFekgMn.js.map → command-list-DWXF8Zg5.js.map} +1 -1
- package/dist/chunks/{copy-button-8W-3B59C.js → copy-button-Blv3FuOX.js} +5 -5
- package/dist/chunks/{copy-button-8W-3B59C.js.map → copy-button-Blv3FuOX.js.map} +1 -1
- package/dist/chunks/{core-eNNh7t33.js → core-CEO7wu2u.js} +6 -6
- package/dist/chunks/{core-eNNh7t33.js.map → core-CEO7wu2u.js.map} +1 -1
- package/dist/chunks/{data-table-DvErn5iF.js → data-table-DS8QEm1P.js} +14 -14
- package/dist/chunks/{data-table-DvErn5iF.js.map → data-table-DS8QEm1P.js.map} +1 -1
- package/dist/chunks/{date-popup-DOoksCNY.js → date-popup-D7f-QQJm.js} +4 -4
- package/dist/chunks/{date-popup-DOoksCNY.js.map → date-popup-D7f-QQJm.js.map} +1 -1
- package/dist/chunks/{de-CqC4aSIV.js → de-CRbLcQNS.js} +10 -1
- package/dist/chunks/de-CRbLcQNS.js.map +1 -0
- package/dist/chunks/{dialog-bUFUnQC0.js → dialog-BoQZ-CRe.js} +5 -5
- package/dist/chunks/{dialog-bUFUnQC0.js.map → dialog-BoQZ-CRe.js.map} +1 -1
- package/dist/chunks/{disclosure-3CIz2WZa.js → disclosure-DVefCcYM.js} +2 -2
- package/dist/chunks/{disclosure-3CIz2WZa.js.map → disclosure-DVefCcYM.js.map} +1 -1
- package/dist/chunks/{domain-D-rdW5fm.js → domain-Dd4A6swO.js} +2 -2
- package/dist/chunks/{domain-D-rdW5fm.js.map → domain-Dd4A6swO.js.map} +1 -1
- package/dist/chunks/{empty-BpiUgGzm.js → empty-DZ-j3vpS.js} +2 -2
- package/dist/chunks/{empty-BpiUgGzm.js.map → empty-DZ-j3vpS.js.map} +1 -1
- package/dist/chunks/{field-D7m-yl-D.js → field-BoF0Q8U2.js} +3 -3
- package/dist/chunks/{field-D7m-yl-D.js.map → field-BoF0Q8U2.js.map} +1 -1
- package/dist/chunks/icon-CPNoEw5s.js +102 -0
- package/dist/chunks/icon-CPNoEw5s.js.map +1 -0
- package/dist/chunks/{icon-CBzOwqrX.js → icon-R4bPkYOo.js} +2 -2
- package/dist/chunks/{icon-CBzOwqrX.js.map → icon-R4bPkYOo.js.map} +1 -1
- package/dist/chunks/{icon-button--mBwM08L.js → icon-button-B8Xm10KH.js} +3 -3
- package/dist/chunks/{icon-button--mBwM08L.js.map → icon-button-B8Xm10KH.js.map} +1 -1
- package/dist/chunks/{identity-mwyVq4mE.js → identity-qb5JVtKG.js} +6 -6
- package/dist/chunks/{identity-mwyVq4mE.js.map → identity-qb5JVtKG.js.map} +1 -1
- package/dist/chunks/{input-BJpzRpEj.js → input-DvU5KIT0.js} +5 -5
- package/dist/chunks/{input-BJpzRpEj.js.map → input-DvU5KIT0.js.map} +1 -1
- package/dist/chunks/{input-group-BpHmsM9g.js → input-group-BPf_IWMR.js} +4 -4
- package/dist/chunks/{input-group-BpHmsM9g.js.map → input-group-BPf_IWMR.js.map} +1 -1
- package/dist/chunks/{iso-field-C97XNnpF.js → iso-field-CgLCZF7B.js} +2 -2
- package/dist/chunks/{iso-field-C97XNnpF.js.map → iso-field-CgLCZF7B.js.map} +1 -1
- package/dist/chunks/{json-view-DZ2nL2Ir.js → json-view-B2OSpSY-.js} +3 -3
- package/dist/chunks/{json-view-DZ2nL2Ir.js.map → json-view-B2OSpSY-.js.map} +1 -1
- package/dist/chunks/{kbd-8A0ML_up.js → kbd-B1rQ6Xzz.js} +2 -2
- package/dist/chunks/{kbd-8A0ML_up.js.map → kbd-B1rQ6Xzz.js.map} +1 -1
- package/dist/chunks/{label-DW24Aj0Z.js → label-Bd7EgBMU.js} +2 -2
- package/dist/chunks/{label-DW24Aj0Z.js.map → label-Bd7EgBMU.js.map} +1 -1
- package/dist/chunks/{link-CMjkcLQK.js → link-CkEhtnKp.js} +3 -3
- package/dist/chunks/{link-CMjkcLQK.js.map → link-CkEhtnKp.js.map} +1 -1
- package/dist/chunks/{list-DBltIx9B.js → list-CHKT0Q3_.js} +9 -9
- package/dist/chunks/{list-DBltIx9B.js.map → list-CHKT0Q3_.js.map} +1 -1
- package/dist/chunks/{loader-zo8CCIGJ.js → loader-BL8eBso7.js} +2 -2
- package/dist/chunks/{loader-zo8CCIGJ.js.map → loader-BL8eBso7.js.map} +1 -1
- package/dist/chunks/{markdown-C0_t7T9r.js → markdown-CzhAHVFg.js} +10 -10
- package/dist/chunks/{markdown-C0_t7T9r.js.map → markdown-CzhAHVFg.js.map} +1 -1
- package/dist/chunks/{menu-BDce2kiw.js → menu-CRZ-O7Ok.js} +4 -4
- package/dist/chunks/{menu-BDce2kiw.js.map → menu-CRZ-O7Ok.js.map} +1 -1
- package/dist/chunks/{meter-CASMHlxl.js → meter-dMtm0QPc.js} +3 -3
- package/dist/chunks/{meter-CASMHlxl.js.map → meter-dMtm0QPc.js.map} +1 -1
- package/dist/chunks/{nav-sheet-S7tagFJT.js → nav-sheet-C1oJliq_.js} +3 -3
- package/dist/chunks/{nav-sheet-S7tagFJT.js.map → nav-sheet-C1oJliq_.js.map} +1 -1
- package/dist/chunks/{nav-wordmark-J4pB_vjr.js → nav-wordmark-Cd-zaGgh.js} +2 -2
- package/dist/chunks/{nav-wordmark-J4pB_vjr.js.map → nav-wordmark-Cd-zaGgh.js.map} +1 -1
- package/dist/chunks/{page-header-D-8GD_Dz.js → page-header-BjW-S0c2.js} +5 -5
- package/dist/chunks/{page-header-D-8GD_Dz.js.map → page-header-BjW-S0c2.js.map} +1 -1
- package/dist/chunks/{pagination-DMb0xe4q.js → pagination--er5TNg5.js} +4 -4
- package/dist/chunks/{pagination-DMb0xe4q.js.map → pagination--er5TNg5.js.map} +1 -1
- package/dist/chunks/{picker-popover-DuhzZbyA.js → picker-popover-B7V6Z-qY.js} +7 -7
- package/dist/chunks/{picker-popover-DuhzZbyA.js.map → picker-popover-B7V6Z-qY.js.map} +1 -1
- package/dist/chunks/{popover-Bl5QYqnh.js → popover-CxYzFnPK.js} +2 -2
- package/dist/chunks/{popover-Bl5QYqnh.js.map → popover-CxYzFnPK.js.map} +1 -1
- package/dist/chunks/{radio-C6GtzF_t.js → radio-BIBakGpi.js} +2 -2
- package/dist/chunks/{radio-C6GtzF_t.js.map → radio-BIBakGpi.js.map} +1 -1
- package/dist/chunks/{range-popup-BHgt4Buj.js → range-popup-DuMX8dGS.js} +7 -7
- package/dist/chunks/{range-popup-BHgt4Buj.js.map → range-popup-DuMX8dGS.js.map} +1 -1
- package/dist/chunks/{reasoning-frame-C3HdQRRS.js → reasoning-frame-CX236xqG.js} +3 -3
- package/dist/chunks/{reasoning-frame-C3HdQRRS.js.map → reasoning-frame-CX236xqG.js.map} +1 -1
- package/dist/chunks/{release-art-ChiT4T2S.js → release-art-D1knR09f.js} +2 -2
- package/dist/chunks/{release-art-ChiT4T2S.js.map → release-art-D1knR09f.js.map} +1 -1
- package/dist/chunks/{rights-DWXZSM9D.js → rights-ghO_k76Q.js} +10 -10
- package/dist/chunks/{rights-DWXZSM9D.js.map → rights-ghO_k76Q.js.map} +1 -1
- package/dist/chunks/{scroll-area-_Ljh4-bG.js → scroll-area-eHO5yx8V.js} +2 -2
- package/dist/chunks/{scroll-area-_Ljh4-bG.js.map → scroll-area-eHO5yx8V.js.map} +1 -1
- package/dist/chunks/{section-CFBYhsUi.js → section-DdBjIPpm.js} +3 -3
- package/dist/chunks/{section-CFBYhsUi.js.map → section-DdBjIPpm.js.map} +1 -1
- package/dist/chunks/{segmented-D9i1avik.js → segmented--cvKKVgU.js} +4 -4
- package/dist/chunks/{segmented-D9i1avik.js.map → segmented--cvKKVgU.js.map} +1 -1
- package/dist/chunks/{select-UTdHKubp.js → select-CYxdDJuW.js} +4 -4
- package/dist/chunks/{select-UTdHKubp.js.map → select-CYxdDJuW.js.map} +1 -1
- package/dist/chunks/{separator-BNWf6BBj.js → separator-cMjJSR_v.js} +2 -2
- package/dist/chunks/{separator-BNWf6BBj.js.map → separator-cMjJSR_v.js.map} +1 -1
- package/dist/chunks/{sidebar-menu-C0qJsQF5.js → sidebar-menu-BIzCokEt.js} +2 -2
- package/dist/chunks/{sidebar-menu-C0qJsQF5.js.map → sidebar-menu-BIzCokEt.js.map} +1 -1
- package/dist/chunks/{sidebar-BO1mnjVH.js → sidebar-rSlJVHXr.js} +8 -8
- package/dist/chunks/{sidebar-BO1mnjVH.js.map → sidebar-rSlJVHXr.js.map} +1 -1
- package/dist/chunks/{skeleton-D-qk3mes.js → skeleton-CRaxQo8h.js} +2 -2
- package/dist/chunks/{skeleton-D-qk3mes.js.map → skeleton-CRaxQo8h.js.map} +1 -1
- package/dist/chunks/{slider-CcE8GtuV.js → slider-CJ5xhCGl.js} +2 -2
- package/dist/chunks/{slider-CcE8GtuV.js.map → slider-CJ5xhCGl.js.map} +1 -1
- package/dist/chunks/{status-dot-CP6runiC.js → status-dot-BJ_xdPOz.js} +3 -3
- package/dist/chunks/{status-dot-CP6runiC.js.map → status-dot-BJ_xdPOz.js.map} +1 -1
- package/dist/chunks/{swap-text-D88Zlu4i.js → swap-text-Dg5TYR3P.js} +2 -2
- package/dist/chunks/{swap-text-D88Zlu4i.js.map → swap-text-Dg5TYR3P.js.map} +1 -1
- package/dist/chunks/{switch-ngywMQdl.js → switch-BlrAa7fs.js} +4 -4
- package/dist/chunks/{switch-ngywMQdl.js.map → switch-BlrAa7fs.js.map} +1 -1
- package/dist/chunks/{table-CTK5E0J7.js → table-2mqGuSzh.js} +2 -2
- package/dist/chunks/{table-CTK5E0J7.js.map → table-2mqGuSzh.js.map} +1 -1
- package/dist/chunks/{tag-BGr6lTSV.js → tag-CyuvhNkV.js} +4 -4
- package/dist/chunks/{tag-BGr6lTSV.js.map → tag-CyuvhNkV.js.map} +1 -1
- package/dist/chunks/{text-DkKdTVUf.js → text-DG2r9OVy.js} +3 -3
- package/dist/chunks/{text-DkKdTVUf.js.map → text-DG2r9OVy.js.map} +1 -1
- package/dist/chunks/{textarea-CmUdpNFk.js → textarea-BhJSBzKA.js} +5 -5
- package/dist/chunks/{textarea-CmUdpNFk.js.map → textarea-BhJSBzKA.js.map} +1 -1
- package/dist/chunks/{timeseries-DY9PLLDJ.js → timeseries-yWYVK-Hb.js} +4 -4
- package/dist/chunks/{timeseries-DY9PLLDJ.js.map → timeseries-yWYVK-Hb.js.map} +1 -1
- package/dist/chunks/{toolbar-u0Gm7Q7-.js → toolbar-CXjo1MZi.js} +2 -2
- package/dist/chunks/{toolbar-u0Gm7Q7-.js.map → toolbar-CXjo1MZi.js.map} +1 -1
- package/dist/chunks/{tooltip-root-BC_RNNiP.js → tooltip-root-CIagHqa7.js} +4 -4
- package/dist/chunks/{tooltip-root-BC_RNNiP.js.map → tooltip-root-CIagHqa7.js.map} +1 -1
- package/dist/chunks/{tooltip-Tkm-urbi.js → tooltip-wfY3dDNy.js} +4 -4
- package/dist/chunks/{tooltip-Tkm-urbi.js.map → tooltip-wfY3dDNy.js.map} +1 -1
- package/dist/chunks/{truncated-d1afmUJT.js → truncated-BITAemX4.js} +3 -3
- package/dist/chunks/{truncated-d1afmUJT.js.map → truncated-BITAemX4.js.map} +1 -1
- package/dist/chunks/{zh-CN-BlpsT6d_.js → zh-CN-BHGxG46g.js} +10 -1
- package/dist/chunks/zh-CN-BHGxG46g.js.map +1 -0
- package/dist/components/agent-avatar.js +1 -1
- package/dist/components/app-frame.js +2 -2
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/button-group.js +4 -4
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/charts/bar.js +3 -3
- package/dist/components/charts/donut.js +3 -3
- package/dist/components/charts/gauge.js +2 -2
- package/dist/components/charts/heatmap.js +2 -2
- package/dist/components/charts/sankey.js +3 -3
- package/dist/components/charts/sparkline.js +1 -1
- package/dist/components/charts/timeseries.js +1 -1
- package/dist/components/charts.js +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +3 -3
- package/dist/components/code.js +1 -1
- package/dist/components/collapsible.js +2 -2
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-list.js +2 -2
- package/dist/components/command-palette.js +4 -4
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/date-picker.js +7 -7
- package/dist/components/dialog.js +2 -2
- package/dist/components/display-options.js +8 -8
- package/dist/components/empty.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/figure.js +2 -2
- package/dist/components/filter-chip.js +5 -5
- package/dist/components/filter-row.js +1 -1
- package/dist/components/filter-toggle.js +2 -2
- package/dist/components/flow-canvas.js +702 -0
- package/dist/components/flow-canvas.js.map +1 -0
- package/dist/components/flow.js +2 -2
- package/dist/components/heading.js +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/icon.js +2 -2
- package/dist/components/input.js +8 -8
- package/dist/components/kaeso/conversation.js +8 -8
- package/dist/components/kaeso/identity.js +1 -1
- package/dist/components/kaeso/moments.js +5 -5
- package/dist/components/kaeso/rights.js +1 -1
- package/dist/components/kaeso/usage.js +7 -7
- package/dist/components/kaeso.js +12 -12
- package/dist/components/kbd.js +1 -1
- package/dist/components/key-value.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/loader.js +2 -2
- package/dist/components/logo.js +2 -2
- package/dist/components/markdown.js +1 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/playground.js +17 -17
- package/dist/components/popover.js +2 -2
- package/dist/components/qr-code.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/release-art.js +1 -1
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/section.js +1 -1
- package/dist/components/segmented.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/settings.js +2 -2
- package/dist/components/sheet.js +2 -2
- package/dist/components/sidebar.js +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/stat.js +4 -4
- package/dist/components/status-dot.js +1 -1
- package/dist/components/surface.js +1 -1
- package/dist/components/swap-text.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tag.js +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/theme-image.js +1 -1
- package/dist/components/theme-menu.js +2 -2
- package/dist/components/theme-select.js +1 -1
- package/dist/components/thumbnail.js +1 -1
- package/dist/components/timeline.js +3 -3
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toast.js +4 -4
- package/dist/components/toc.js +1 -1
- package/dist/components/toolbar.js +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/visually-hidden.js +1 -1
- package/dist/i18n-provider.js +1 -1
- package/dist/index.js +60 -60
- package/dist/kaeso.css +38 -0
- package/dist/styles.css +1 -1
- package/dist/types/components/flow-canvas/docs.d.ts +35 -0
- package/dist/types/components/flow-canvas/flow-canvas.d.ts +36 -0
- package/dist/types/components/flow-canvas/flow-workspace.d.ts +32 -0
- package/dist/types/components/flow-canvas/index.d.ts +2 -0
- package/dist/types/components/flow-canvas/layout.d.ts +74 -0
- package/dist/types/components/timeline/timeline.d.ts +1 -1
- package/dist/types/icons/groups.d.ts +2 -2
- package/dist/types/icons/vocabulary.d.ts +35 -0
- package/dist/types/utils/cn.d.ts +6 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/cn-BjnOAUrA.js.map +0 -1
- package/dist/chunks/de-CqC4aSIV.js.map +0 -1
- package/dist/chunks/icon-CPJWE2N-.js +0 -95
- package/dist/chunks/icon-CPJWE2N-.js.map +0 -1
- package/dist/chunks/zh-CN-BlpsT6d_.js.map +0 -1
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../chunks/cn-y70pJ-RU.js";
|
|
3
|
+
import { i as t } from "../chunks/context-BELWW79w.js";
|
|
4
|
+
import { t as n } from "../chunks/observe-resize-DhxhmoyB.js";
|
|
5
|
+
import { t as r } from "../chunks/icon-button-B8Xm10KH.js";
|
|
6
|
+
import { c as i } from "../chunks/menu-CRZ-O7Ok.js";
|
|
7
|
+
import { r as a } from "../chunks/status-dot-BJ_xdPOz.js";
|
|
8
|
+
import { forwardRef as o, useCallback as s, useEffect as c, useId as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
|
+
import { Add01Icon as g, ArrowExpand01Icon as ee, MinusSignIcon as te, MoreHorizontalIcon as ne } from "@hugeicons/core-free-icons";
|
|
11
|
+
var _ = 176, v = 40, y = 24, b = 12, x = (e, t) => e ? t ? {
|
|
12
|
+
l: Math.min(e.l, t.l),
|
|
13
|
+
r: Math.max(e.r, t.r)
|
|
14
|
+
} : e : t ?? null, S = (e, t) => t < e.contour.length ? e.contour[t] ?? null : e.tail, C = (e, t) => t === 0 ? e : {
|
|
15
|
+
items: e.items.map((e) => ({
|
|
16
|
+
...e,
|
|
17
|
+
x: e.x + t
|
|
18
|
+
})),
|
|
19
|
+
contour: e.contour.map((e) => ({
|
|
20
|
+
l: e.l + t,
|
|
21
|
+
r: e.r + t
|
|
22
|
+
})),
|
|
23
|
+
tail: e.tail && {
|
|
24
|
+
l: e.tail.l + t,
|
|
25
|
+
r: e.tail.r + t
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function re(e, t) {
|
|
29
|
+
let n = Math.max(e.contour.length, t.contour.length) + 1, r = -Infinity;
|
|
30
|
+
for (let i = 0; i < n; i++) {
|
|
31
|
+
let n = S(e, i), a = S(t, i);
|
|
32
|
+
n && a && (r = Math.max(r, n.r - a.l + v));
|
|
33
|
+
}
|
|
34
|
+
return r === -Infinity ? 0 : r;
|
|
35
|
+
}
|
|
36
|
+
function ie(e) {
|
|
37
|
+
let t = [], n = null, r = [];
|
|
38
|
+
for (let t of e) r.push(...t.items), n = x(n, t.tail);
|
|
39
|
+
let i = Math.max(0, ...e.map((e) => e.contour.length));
|
|
40
|
+
for (let n = 0; n < i; n++) {
|
|
41
|
+
let r = null;
|
|
42
|
+
for (let t of e) r = x(r, S(t, n));
|
|
43
|
+
t.push(r ?? {
|
|
44
|
+
l: 0,
|
|
45
|
+
r: 0
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
items: r,
|
|
50
|
+
contour: t,
|
|
51
|
+
tail: n
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function ae(e, t) {
|
|
55
|
+
return t.node ? t.node.id : `${e}::${t.id}`;
|
|
56
|
+
}
|
|
57
|
+
function w(e, t, n, r) {
|
|
58
|
+
let i = ae(t, n);
|
|
59
|
+
return e.order.push(i), e.placed.set(i, {
|
|
60
|
+
key: i,
|
|
61
|
+
kind: "slot",
|
|
62
|
+
x: 0,
|
|
63
|
+
y: 0,
|
|
64
|
+
w: 24,
|
|
65
|
+
h: 24,
|
|
66
|
+
level: r,
|
|
67
|
+
node: void 0,
|
|
68
|
+
edge: n,
|
|
69
|
+
parent: t,
|
|
70
|
+
children: []
|
|
71
|
+
}), i;
|
|
72
|
+
}
|
|
73
|
+
function T(e, t, n, r, i) {
|
|
74
|
+
let a = e.id, o = e.children ?? [];
|
|
75
|
+
t.order.push(a), t.placed.set(a, {
|
|
76
|
+
key: a,
|
|
77
|
+
kind: "node",
|
|
78
|
+
x: 0,
|
|
79
|
+
y: 0,
|
|
80
|
+
w: 240,
|
|
81
|
+
h: 80,
|
|
82
|
+
level: i,
|
|
83
|
+
node: e,
|
|
84
|
+
edge: r,
|
|
85
|
+
parent: n,
|
|
86
|
+
children: o.map((e) => ae(a, e))
|
|
87
|
+
});
|
|
88
|
+
let s = {
|
|
89
|
+
l: -120,
|
|
90
|
+
r: 120
|
|
91
|
+
}, c = o.map((e) => e.node ? T(e.node, t, a, e, i + 1) : {
|
|
92
|
+
items: [{
|
|
93
|
+
key: w(t, a, e, i + 1),
|
|
94
|
+
x: 0,
|
|
95
|
+
level: 0
|
|
96
|
+
}],
|
|
97
|
+
contour: [{
|
|
98
|
+
l: -12,
|
|
99
|
+
r: 12
|
|
100
|
+
}],
|
|
101
|
+
tail: null
|
|
102
|
+
}), l = [], u = null;
|
|
103
|
+
for (let e of c) {
|
|
104
|
+
let t = u ? C(e, re(u, e)) : e;
|
|
105
|
+
l.push(t), u = u ? ie([u, t]) : t;
|
|
106
|
+
}
|
|
107
|
+
if (l.length > 0) {
|
|
108
|
+
let e = l.map((e) => e.items[0].x), t = -(e[0] + e[e.length - 1]) / 2;
|
|
109
|
+
l = l.map((e) => C(e, t));
|
|
110
|
+
}
|
|
111
|
+
let d = l.length > 0 ? ie(l) : null;
|
|
112
|
+
return {
|
|
113
|
+
items: [{
|
|
114
|
+
key: a,
|
|
115
|
+
x: 0,
|
|
116
|
+
level: 0
|
|
117
|
+
}, ...d ? d.items.map((e) => ({
|
|
118
|
+
...e,
|
|
119
|
+
level: e.level + 1
|
|
120
|
+
})) : []],
|
|
121
|
+
contour: [s, ...d ? d.contour : []],
|
|
122
|
+
tail: d?.tail ?? null
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
var E = (e) => Math.round(e * 2) / 2;
|
|
126
|
+
function D(e, t, n, r, i) {
|
|
127
|
+
if (Math.abs(n - e) < 1) return `M${e} ${t}V${r}`;
|
|
128
|
+
let a = n > e ? 1 : -1, o = Math.min(b, Math.abs(n - e) / 2, Math.abs(i - t), Math.abs(r - i));
|
|
129
|
+
return `M${e} ${t}V${i - o}Q${e} ${i} ${e + a * o} ${i}H${n - a * o}Q${n} ${i} ${n} ${i + o}V${r}`;
|
|
130
|
+
}
|
|
131
|
+
function oe(e) {
|
|
132
|
+
let t = {
|
|
133
|
+
placed: /* @__PURE__ */ new Map(),
|
|
134
|
+
order: []
|
|
135
|
+
}, n = T(e, t, null, void 0, 0);
|
|
136
|
+
for (let e of n.items) {
|
|
137
|
+
let n = t.placed.get(e.key);
|
|
138
|
+
n.x = E(e.x), n.y = n.kind === "slot" ? e.level * _ + 28 : e.level * _;
|
|
139
|
+
}
|
|
140
|
+
let r = t.placed;
|
|
141
|
+
for (let e of t.order) {
|
|
142
|
+
let t = r.get(e), n = t.parent === null ? void 0 : r.get(t.parent);
|
|
143
|
+
t.kind === "slot" && n?.node?.terminal && (t.y = n.y + 80 + 32);
|
|
144
|
+
}
|
|
145
|
+
let i = [], a = 0, o = Infinity, s = -Infinity;
|
|
146
|
+
for (let e of r.values()) a = Math.max(a, e.y + e.h), o = Math.min(o, e.x - e.w / 2), s = Math.max(s, e.x + e.w / 2);
|
|
147
|
+
let c = (e) => e.label !== void 0 && e.label !== null && e.label !== "";
|
|
148
|
+
for (let e of t.order) {
|
|
149
|
+
let t = r.get(e);
|
|
150
|
+
if (t.parent === null) continue;
|
|
151
|
+
let n = r.get(t.parent), a = t.edge, o = a.variant ?? "default", s = t.y, l = n.y + 80 + y, u = D(n.x, n.y + 80, t.x, s, l), d = Math.abs(t.x - n.x) < 1 ? n.y + 80 : l, f = s - d, p = t.kind === "node" && c(a) ? {
|
|
152
|
+
x: t.x,
|
|
153
|
+
y: E(d + Math.min(22, f / 3))
|
|
154
|
+
} : null, m = t.kind === "node" ? {
|
|
155
|
+
x: t.x,
|
|
156
|
+
y: E(p ? s - 20 : d + f / 2)
|
|
157
|
+
} : null;
|
|
158
|
+
i.push({
|
|
159
|
+
key: `wire:${e}`,
|
|
160
|
+
from: n.key,
|
|
161
|
+
to: e,
|
|
162
|
+
d: u,
|
|
163
|
+
variant: o,
|
|
164
|
+
label: a.label,
|
|
165
|
+
labelAt: p,
|
|
166
|
+
insertAt: m,
|
|
167
|
+
edge: a
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
items: r,
|
|
172
|
+
order: t.order,
|
|
173
|
+
wires: i,
|
|
174
|
+
bounds: {
|
|
175
|
+
minX: o,
|
|
176
|
+
maxX: s,
|
|
177
|
+
minY: 0,
|
|
178
|
+
maxY: a
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/components/flow-canvas/flow-canvas.tsx
|
|
184
|
+
var se = {
|
|
185
|
+
success: "var(--k-success-text)",
|
|
186
|
+
warning: "var(--k-warning-text)",
|
|
187
|
+
danger: "var(--k-danger-text)"
|
|
188
|
+
}, ce = {
|
|
189
|
+
danger: "ring-invalid",
|
|
190
|
+
warning: "ring-warning",
|
|
191
|
+
success: "ring-success",
|
|
192
|
+
neutral: void 0
|
|
193
|
+
}, le = { background: {
|
|
194
|
+
dots: { classes: "flow-canvas-dots" },
|
|
195
|
+
plain: { classes: "" }
|
|
196
|
+
} }, O = { background: "dots" }, k = [
|
|
197
|
+
.25,
|
|
198
|
+
.33,
|
|
199
|
+
.5,
|
|
200
|
+
.67,
|
|
201
|
+
.8,
|
|
202
|
+
1,
|
|
203
|
+
1.2,
|
|
204
|
+
1.5
|
|
205
|
+
], A = .25, j = 1.5, M = .67, N = 48, P = 64, F = 24, ue = 16, de = 4, I = (e) => Math.min(j, Math.max(A, e)), fe = (e, t) => t > 0 ? k.find((t) => t > e + .001) ?? j : [...k].reverse().find((t) => t < e - .001) ?? A, L = (e) => Math.round(e * 100) / 100;
|
|
206
|
+
function pe(e, t, n) {
|
|
207
|
+
let r = t > 256 ? P : 0, i = t - r, a = e.maxX - e.minX + 96, o = e.maxY - e.minY + 96, s = i > 0 && n > 0 ? Math.min(1, i / a, n / o) : 1, c = I(Math.max(M, s)), l = c * a <= i ? r + i / 2 - c * (e.minX + e.maxX) / 2 : Math.min(r + N * c - c * e.minX, Math.max(r + i - N * c - c * e.maxX, r + i / 2));
|
|
208
|
+
return {
|
|
209
|
+
k: c,
|
|
210
|
+
x: Math.round(l),
|
|
211
|
+
y: Math.round(N * c - e.minY * c)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function me(e) {
|
|
215
|
+
let t = e.children?.filter((e) => e.node).map((e) => ({
|
|
216
|
+
...e,
|
|
217
|
+
node: me(e.node)
|
|
218
|
+
}));
|
|
219
|
+
return t ? {
|
|
220
|
+
...e,
|
|
221
|
+
children: t
|
|
222
|
+
} : e;
|
|
223
|
+
}
|
|
224
|
+
function he(e, t) {
|
|
225
|
+
return e.split(/(\{\w+\})/).map((e, n) => {
|
|
226
|
+
let r = /^\{(\w+)\}$/.exec(e)?.[1];
|
|
227
|
+
return r && r in t ? /* @__PURE__ */ m("span", { children: t[r] }, n) : e;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
var ge = (e) => e ? e.label ?? (typeof e.title == "string" ? e.title : typeof e.kind == "string" ? e.kind : void 0) : void 0, R = /* @__PURE__ */ o(function({ root: o, selected: _ = null, onSelect: v, addMenu: y, nodeActions: b, onDelete: x, trace: S, busy: C, background: re = "dots", className: ie, "aria-label": ae }, w) {
|
|
231
|
+
let T = t(), E = `k-flow-hint-${l().replace(/[^\w-]/g, "")}`, D = !!y, O = d(() => D ? o : me(o), [o, D]), k = d(() => oe(O), [O]), M = d(() => S ? new Set(S) : null, [S]), P = f(null), R = f(/* @__PURE__ */ new Map()), [z, _e] = p({
|
|
232
|
+
w: 0,
|
|
233
|
+
h: 0
|
|
234
|
+
}), B = f(z);
|
|
235
|
+
B.current = z;
|
|
236
|
+
let [V, H] = p({
|
|
237
|
+
x: 0,
|
|
238
|
+
y: N,
|
|
239
|
+
k: 1
|
|
240
|
+
}), ve = f(!1), [U, ye] = p(null), [be, xe] = p(null), [Se, Ce] = p(!1), W = f(/* @__PURE__ */ new Map()), G = f(null);
|
|
241
|
+
u(() => {
|
|
242
|
+
let e = P.current;
|
|
243
|
+
if (!e) return;
|
|
244
|
+
let t = () => _e({
|
|
245
|
+
w: e.clientWidth,
|
|
246
|
+
h: e.clientHeight
|
|
247
|
+
});
|
|
248
|
+
return t(), n([e], t);
|
|
249
|
+
}, []), u(() => {
|
|
250
|
+
ve.current || z.w === 0 || z.h === 0 || (ve.current = !0, H(pe(k.bounds, z.w, z.h)));
|
|
251
|
+
}, [k, z]);
|
|
252
|
+
let we = s((e, t, n) => {
|
|
253
|
+
H((r) => {
|
|
254
|
+
let i = I(r.k * e), a = i / r.k;
|
|
255
|
+
return {
|
|
256
|
+
k: i,
|
|
257
|
+
x: L(t - (t - r.x) * a),
|
|
258
|
+
y: L(n - (n - r.y) * a)
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}, []), K = s((e) => H((t) => {
|
|
262
|
+
let n = fe(t.k, e), r = B.current.w / 2, i = B.current.h / 2;
|
|
263
|
+
return {
|
|
264
|
+
k: n,
|
|
265
|
+
x: L(r - (r - t.x) * n / t.k),
|
|
266
|
+
y: L(i - (i - t.y) * n / t.k)
|
|
267
|
+
};
|
|
268
|
+
}), []), Te = s(() => H(pe(k.bounds, B.current.w, B.current.h)), [k]), q = s((e) => {
|
|
269
|
+
let t = k.items.get(e);
|
|
270
|
+
t && H((e) => {
|
|
271
|
+
let { w: n, h: r } = B.current;
|
|
272
|
+
if (n === 0 || r === 0) return e;
|
|
273
|
+
let i = e.x + (t.x - t.w / 2) * e.k, a = e.x + (t.x + t.w / 2) * e.k, o = e.y + t.y * e.k, s = e.y + (t.y + t.h) * e.k, c = 0, l = 0;
|
|
274
|
+
return i < F ? c = F - i : a > n - F && (c = Math.max(n - F - a, F - i)), o < F ? l = F - o : s > r - F && (l = Math.max(r - F - s, F - o)), c === 0 && l === 0 ? e : {
|
|
275
|
+
...e,
|
|
276
|
+
x: L(e.x + c),
|
|
277
|
+
y: L(e.y + l)
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
}, [k]), J = f(q);
|
|
281
|
+
J.current = q, c(() => {
|
|
282
|
+
_ && J.current(_);
|
|
283
|
+
}, [_]);
|
|
284
|
+
let Y = S?.[S.length - 1];
|
|
285
|
+
c(() => {
|
|
286
|
+
Y && J.current(Y);
|
|
287
|
+
}, [Y]), c(() => {
|
|
288
|
+
let e = P.current;
|
|
289
|
+
if (!e) return;
|
|
290
|
+
let t = (t) => {
|
|
291
|
+
t.preventDefault();
|
|
292
|
+
let n = t.deltaMode === 1 ? ue : t.deltaMode === 2 ? e.clientHeight : 1;
|
|
293
|
+
if (t.ctrlKey || t.metaKey) {
|
|
294
|
+
let r = e.getBoundingClientRect();
|
|
295
|
+
we(Math.exp(-t.deltaY * n * .01), t.clientX - r.left, t.clientY - r.top);
|
|
296
|
+
} else H((e) => ({
|
|
297
|
+
...e,
|
|
298
|
+
x: L(e.x - t.deltaX * n),
|
|
299
|
+
y: L(e.y - t.deltaY * n)
|
|
300
|
+
}));
|
|
301
|
+
};
|
|
302
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
303
|
+
}, [we]);
|
|
304
|
+
let Ee = () => {
|
|
305
|
+
let [e, t] = [...W.current.values()];
|
|
306
|
+
if (!e) {
|
|
307
|
+
G.current = null;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
let n = t ? {
|
|
311
|
+
d: Math.hypot(t.x - e.x, t.y - e.y) || 1,
|
|
312
|
+
k: V.k
|
|
313
|
+
} : null, r = t ? (e.x + t.x) / 2 : e.x, i = t ? (e.y + t.y) / 2 : e.y;
|
|
314
|
+
G.current = {
|
|
315
|
+
x: r,
|
|
316
|
+
y: i,
|
|
317
|
+
view: V,
|
|
318
|
+
moved: G.current?.moved ?? !1,
|
|
319
|
+
pinch: n
|
|
320
|
+
};
|
|
321
|
+
}, De = (e) => {
|
|
322
|
+
e.currentTarget.contains(e.target) && (e.target.closest("[data-flow-interactive]") || (e.pointerType !== "mouse" || e.button === 0) && (e.currentTarget.setPointerCapture?.(e.pointerId), W.current.set(e.pointerId, {
|
|
323
|
+
x: e.clientX,
|
|
324
|
+
y: e.clientY
|
|
325
|
+
}), Ee()));
|
|
326
|
+
}, Oe = (e) => {
|
|
327
|
+
if (!W.current.has(e.pointerId)) return;
|
|
328
|
+
W.current.set(e.pointerId, {
|
|
329
|
+
x: e.clientX,
|
|
330
|
+
y: e.clientY
|
|
331
|
+
});
|
|
332
|
+
let t = G.current;
|
|
333
|
+
if (!t) return;
|
|
334
|
+
let [n, r] = [...W.current.values()];
|
|
335
|
+
if (t.pinch && n && r) {
|
|
336
|
+
let i = e.currentTarget.getBoundingClientRect(), a = I(t.pinch.k * (Math.hypot(r.x - n.x, r.y - n.y) / t.pinch.d)), o = (n.x + r.x) / 2 - i.left, s = (n.y + r.y) / 2 - i.top, c = a / t.view.k, l = t.x - i.left, u = t.y - i.top;
|
|
337
|
+
t.moved = !0, H({
|
|
338
|
+
k: a,
|
|
339
|
+
x: L(o - (l - t.view.x) * c),
|
|
340
|
+
y: L(s - (u - t.view.y) * c)
|
|
341
|
+
});
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (!n) return;
|
|
345
|
+
let i = n.x - t.x, a = n.y - t.y;
|
|
346
|
+
!t.moved && Math.abs(i) + Math.abs(a) < de || (t.moved || Ce(!0), t.moved = !0, H({
|
|
347
|
+
...t.view,
|
|
348
|
+
x: L(t.view.x + i),
|
|
349
|
+
y: L(t.view.y + a)
|
|
350
|
+
}));
|
|
351
|
+
}, ke = (e) => {
|
|
352
|
+
if (!W.current.delete(e.pointerId)) return;
|
|
353
|
+
let t = G.current?.moved ?? !1;
|
|
354
|
+
W.current.size > 0 ? Ee() : (G.current = null, Ce(!1), !t && e.type === "pointerup" && v?.(null));
|
|
355
|
+
}, Ae = U && k.items.has(U) ? U : _ && k.items.has(_) ? _ : O.id, je = (e) => {
|
|
356
|
+
e && (ye(e), R.current.get(e)?.focus({ preventScroll: !0 }), q(e));
|
|
357
|
+
}, Me = (e, t) => {
|
|
358
|
+
let n = t.parent ? k.items.get(t.parent).children : [t.key], r = n.indexOf(t.key), i;
|
|
359
|
+
switch (e.key) {
|
|
360
|
+
case "ArrowDown":
|
|
361
|
+
i = t.children[0];
|
|
362
|
+
break;
|
|
363
|
+
case "ArrowUp":
|
|
364
|
+
i = t.parent;
|
|
365
|
+
break;
|
|
366
|
+
case "ArrowLeft":
|
|
367
|
+
i = n[r - 1];
|
|
368
|
+
break;
|
|
369
|
+
case "ArrowRight":
|
|
370
|
+
i = n[r + 1];
|
|
371
|
+
break;
|
|
372
|
+
case "Home":
|
|
373
|
+
i = O.id;
|
|
374
|
+
break;
|
|
375
|
+
case "End":
|
|
376
|
+
i = k.order[k.order.length - 1];
|
|
377
|
+
break;
|
|
378
|
+
case "Escape":
|
|
379
|
+
if (_ === null) return;
|
|
380
|
+
e.preventDefault(), v?.(null);
|
|
381
|
+
return;
|
|
382
|
+
case "+":
|
|
383
|
+
case "=":
|
|
384
|
+
e.preventDefault(), K(1);
|
|
385
|
+
return;
|
|
386
|
+
case "-":
|
|
387
|
+
e.preventDefault(), K(-1);
|
|
388
|
+
return;
|
|
389
|
+
case "0":
|
|
390
|
+
e.preventDefault(), Te();
|
|
391
|
+
return;
|
|
392
|
+
default:
|
|
393
|
+
if (t.kind !== "node") return;
|
|
394
|
+
e.key === "Enter" || e.key === " " ? (e.preventDefault(), v?.(t.key)) : (e.key === "Delete" || e.key === "Backspace") && x ? (e.preventDefault(), x(t.key)) : (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) && b?.(t.key) && (e.preventDefault(), xe(t.key));
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
e.preventDefault(), je(i);
|
|
398
|
+
}, Ne = (e) => (t) => {
|
|
399
|
+
t ? R.current.set(e, t) : R.current.delete(e);
|
|
400
|
+
}, Pe = (e) => {
|
|
401
|
+
let t = k.items.get(e);
|
|
402
|
+
return t?.kind === "slot" ? t.edge?.addLabel ?? T("flowCanvas.add", "Add a step") : t?.node?.title;
|
|
403
|
+
}, Fe = (e, t) => ({
|
|
404
|
+
left: e.x - e.w / 2,
|
|
405
|
+
top: e.y,
|
|
406
|
+
width: e.w,
|
|
407
|
+
height: e.h,
|
|
408
|
+
...t
|
|
409
|
+
}), Ie = (e, t) => _ !== null && (e === _ || t === _), X = (e, t) => !M || M.has(e) && M.has(t), Z = (e) => e.edge?.tone && X(e.from, e.to) ? e.edge.tone : void 0, Le = (e) => {
|
|
410
|
+
let t = Z(e);
|
|
411
|
+
return t ? se[t] : M ? X(e.from, e.to) ? "var(--k-text)" : "var(--k-line)" : Ie(e.from, e.to) ? "var(--k-text-secondary)" : "var(--k-text-tertiary)";
|
|
412
|
+
}, Q = (e) => !!M && X(e.from, e.to), Re = [...k.wires].sort((e, t) => Number(Q(e)) + Number(!!Z(e)) - (Number(Q(t)) + Number(!!Z(t)))), ze = {
|
|
413
|
+
"--k-flow-dot-gap": `${L(ue * V.k)}px`,
|
|
414
|
+
"--k-flow-dot-x": `${V.x}px`,
|
|
415
|
+
"--k-flow-dot-y": `${V.y}px`
|
|
416
|
+
}, $ = { transform: `translate(${V.x}px, ${V.y}px) scale(${V.k})` }, Be = T("flowCanvas.connection", "{from} to {to}"), Ve = T("flowCanvas.connectionLabelled", "{from} to {to}, {label}");
|
|
417
|
+
return /* @__PURE__ */ h("div", {
|
|
418
|
+
ref: (e) => {
|
|
419
|
+
P.current = e, typeof w == "function" ? w(e) : w && (w.current = e);
|
|
420
|
+
},
|
|
421
|
+
"data-flow-canvas": "",
|
|
422
|
+
...Se ? { "data-dragging": "" } : {},
|
|
423
|
+
className: e("relative h-full min-h-0 w-full touch-none overflow-hidden bg-panel select-none cursor-grab dragging:cursor-grabbing", le.background[re].classes, ie),
|
|
424
|
+
style: ze,
|
|
425
|
+
onPointerDown: De,
|
|
426
|
+
onPointerMove: Oe,
|
|
427
|
+
onPointerUp: ke,
|
|
428
|
+
onPointerCancel: ke,
|
|
429
|
+
children: [
|
|
430
|
+
/* @__PURE__ */ h("div", {
|
|
431
|
+
"aria-hidden": !0,
|
|
432
|
+
className: "pointer-events-none absolute top-0 left-0 origin-top-left",
|
|
433
|
+
style: $,
|
|
434
|
+
children: [/* @__PURE__ */ m("svg", {
|
|
435
|
+
className: "absolute top-0 left-0 overflow-visible",
|
|
436
|
+
width: 1,
|
|
437
|
+
height: 1,
|
|
438
|
+
children: Re.map((e) => {
|
|
439
|
+
let t = Z(e), n = !!C && Q(e) && !t;
|
|
440
|
+
return /* @__PURE__ */ m("path", {
|
|
441
|
+
"data-flow-wire": e.key,
|
|
442
|
+
...t ? { "data-tone": t } : {},
|
|
443
|
+
...n ? { "data-flowing": "" } : {},
|
|
444
|
+
d: e.d,
|
|
445
|
+
fill: "none",
|
|
446
|
+
stroke: Le(e),
|
|
447
|
+
strokeWidth: Q(e) ? 2 : 1.5,
|
|
448
|
+
strokeLinecap: "round",
|
|
449
|
+
strokeLinejoin: "round",
|
|
450
|
+
className: n ? "animate-flow-wire" : void 0,
|
|
451
|
+
...e.variant === "fallback" || n ? { strokeDasharray: "4 5" } : {}
|
|
452
|
+
}, e.key);
|
|
453
|
+
})
|
|
454
|
+
}), k.wires.map((t) => t.labelAt && /* @__PURE__ */ m("span", {
|
|
455
|
+
"data-flow-label": t.to,
|
|
456
|
+
className: e("absolute flex h-20 -translate-x-1/2 -translate-y-1/2 items-center rounded-pill bg-panel px-8 text-caption font-medium whitespace-nowrap text-fg-secondary shadow-ring", !X(t.from, t.to) && "text-fg-tertiary"),
|
|
457
|
+
style: {
|
|
458
|
+
left: t.labelAt.x,
|
|
459
|
+
top: t.labelAt.y
|
|
460
|
+
},
|
|
461
|
+
children: t.label
|
|
462
|
+
}, `label:${t.key}`))]
|
|
463
|
+
}),
|
|
464
|
+
y && /* @__PURE__ */ m("div", {
|
|
465
|
+
className: "pointer-events-none absolute top-0 left-0 origin-top-left",
|
|
466
|
+
style: $,
|
|
467
|
+
children: k.wires.map((e) => e.insertAt && e.edge && /* @__PURE__ */ m("span", {
|
|
468
|
+
"data-flow-interactive": "",
|
|
469
|
+
className: "pointer-events-auto absolute -translate-x-1/2 -translate-y-1/2",
|
|
470
|
+
style: {
|
|
471
|
+
left: e.insertAt.x,
|
|
472
|
+
top: e.insertAt.y
|
|
473
|
+
},
|
|
474
|
+
children: /* @__PURE__ */ h(i, { children: [/* @__PURE__ */ m(i.Trigger, { children: /* @__PURE__ */ m(r, {
|
|
475
|
+
icon: g,
|
|
476
|
+
variant: "secondary",
|
|
477
|
+
size: "xs",
|
|
478
|
+
tabIndex: -1,
|
|
479
|
+
"aria-label": e.edge.insertLabel ?? T("flowCanvas.insert", "Insert a step here")
|
|
480
|
+
}) }), /* @__PURE__ */ m(i.Content, {
|
|
481
|
+
align: "center",
|
|
482
|
+
children: y({
|
|
483
|
+
edge: e.edge.id,
|
|
484
|
+
insert: !0
|
|
485
|
+
})
|
|
486
|
+
})] })
|
|
487
|
+
}, `insert:${e.key}`))
|
|
488
|
+
}),
|
|
489
|
+
/* @__PURE__ */ m("div", {
|
|
490
|
+
role: "tree",
|
|
491
|
+
"aria-label": ae,
|
|
492
|
+
"aria-describedby": E,
|
|
493
|
+
"aria-busy": C || void 0,
|
|
494
|
+
className: "absolute top-0 left-0 origin-top-left",
|
|
495
|
+
style: $,
|
|
496
|
+
children: k.order.map((t) => {
|
|
497
|
+
let n = k.items.get(t), o = n.level + 1, s = n.parent ? k.items.get(n.parent).children : [t], c = {
|
|
498
|
+
role: "treeitem",
|
|
499
|
+
"aria-level": o,
|
|
500
|
+
"aria-setsize": s.length,
|
|
501
|
+
"aria-posinset": s.indexOf(t) + 1,
|
|
502
|
+
tabIndex: Ae === t ? 0 : -1,
|
|
503
|
+
"data-flow-item": t,
|
|
504
|
+
"data-flow-interactive": "",
|
|
505
|
+
onFocus: () => ye(t),
|
|
506
|
+
onKeyDown: (e) => Me(e, n)
|
|
507
|
+
};
|
|
508
|
+
if (n.kind === "slot") {
|
|
509
|
+
let e = n.edge;
|
|
510
|
+
return /* @__PURE__ */ m("span", {
|
|
511
|
+
className: "absolute flex items-center justify-center",
|
|
512
|
+
style: Fe(n),
|
|
513
|
+
children: /* @__PURE__ */ h(i, { children: [/* @__PURE__ */ m(i.Trigger, { children: /* @__PURE__ */ m(r, {
|
|
514
|
+
ref: Ne(t),
|
|
515
|
+
...c,
|
|
516
|
+
"aria-selected": !1,
|
|
517
|
+
icon: g,
|
|
518
|
+
variant: "secondary",
|
|
519
|
+
size: "xs",
|
|
520
|
+
"aria-label": e.addLabel ?? T("flowCanvas.add", "Add a step")
|
|
521
|
+
}) }), /* @__PURE__ */ m(i.Content, {
|
|
522
|
+
align: "start",
|
|
523
|
+
children: y({
|
|
524
|
+
edge: e.id,
|
|
525
|
+
insert: !1
|
|
526
|
+
})
|
|
527
|
+
})] })
|
|
528
|
+
}, t);
|
|
529
|
+
}
|
|
530
|
+
let l = n.node, u = !!M && !M.has(t), d = b?.(t), f = ge(l) ?? "";
|
|
531
|
+
return /* @__PURE__ */ h("div", {
|
|
532
|
+
ref: Ne(t),
|
|
533
|
+
...c,
|
|
534
|
+
"aria-selected": _ === t,
|
|
535
|
+
...d ? { "aria-haspopup": "menu" } : {},
|
|
536
|
+
...l["data-force"] ? { "data-force": l["data-force"] } : {},
|
|
537
|
+
...M ? { "data-trace": M.has(t) ? "on" : "off" } : {},
|
|
538
|
+
onClick: () => v?.(t),
|
|
539
|
+
className: e("absolute flex cursor-pointer flex-col justify-center gap-2 rounded-well bg-panel px-12 py-10 text-left shadow-control transition-control outline-none focus-ring", "hover:shadow-control-hover selected:bg-item-hover selected:shadow-control-selected selected:hover:shadow-control-selected forced-colors:outline-1 forced-colors:outline-solid", l.status && ce[l.status.tone], u && "shadow-ring", d && "pr-40"),
|
|
540
|
+
style: Fe(n),
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ h("span", {
|
|
543
|
+
className: "flex h-16 min-w-0 items-center justify-between gap-8 text-caption font-medium text-fg-tertiary",
|
|
544
|
+
children: [/* @__PURE__ */ m("span", {
|
|
545
|
+
className: "truncate",
|
|
546
|
+
children: l.kind
|
|
547
|
+
}), l.status ? /* @__PURE__ */ m(a, {
|
|
548
|
+
tone: l.status.tone,
|
|
549
|
+
size: "sm",
|
|
550
|
+
className: "shrink-0 text-caption",
|
|
551
|
+
children: l.status.label
|
|
552
|
+
}) : l.badge !== void 0 && l.badge !== null && /* @__PURE__ */ m("span", {
|
|
553
|
+
className: "shrink-0 text-fg-secondary",
|
|
554
|
+
children: l.badge
|
|
555
|
+
})]
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ h("span", {
|
|
558
|
+
className: "flex h-20 min-w-0 items-center gap-8",
|
|
559
|
+
children: [l.leading && /* @__PURE__ */ m("span", {
|
|
560
|
+
className: "flex shrink-0",
|
|
561
|
+
children: l.leading
|
|
562
|
+
}), /* @__PURE__ */ m("span", {
|
|
563
|
+
className: e("truncate text-body font-medium", u ? "text-fg-secondary" : "text-fg"),
|
|
564
|
+
children: l.title
|
|
565
|
+
})]
|
|
566
|
+
}),
|
|
567
|
+
l.subtitle !== void 0 && l.subtitle !== null && l.subtitle !== "" && /* @__PURE__ */ m("span", {
|
|
568
|
+
className: e("h-18 truncate text-small", u ? "text-fg-tertiary" : "text-fg-secondary"),
|
|
569
|
+
children: l.subtitle
|
|
570
|
+
}),
|
|
571
|
+
d && /* @__PURE__ */ m("span", {
|
|
572
|
+
"aria-hidden": !0,
|
|
573
|
+
"data-flow-interactive": "",
|
|
574
|
+
className: "absolute top-1/2 right-8 -translate-y-1/2",
|
|
575
|
+
onClick: (e) => e.stopPropagation(),
|
|
576
|
+
onFocus: (e) => {
|
|
577
|
+
e.stopPropagation(), R.current.get(t)?.focus({ preventScroll: !0 });
|
|
578
|
+
},
|
|
579
|
+
children: /* @__PURE__ */ h(i, {
|
|
580
|
+
open: be === t,
|
|
581
|
+
onOpenChange: (e) => xe(e ? t : null),
|
|
582
|
+
children: [/* @__PURE__ */ m(i.Trigger, { children: /* @__PURE__ */ m(r, {
|
|
583
|
+
icon: ne,
|
|
584
|
+
size: "xs",
|
|
585
|
+
tabIndex: -1,
|
|
586
|
+
"aria-label": T("flowCanvas.actionsFor", "Actions for {name}", { name: f })
|
|
587
|
+
}) }), /* @__PURE__ */ m(i.Content, {
|
|
588
|
+
align: "start",
|
|
589
|
+
children: d
|
|
590
|
+
})]
|
|
591
|
+
})
|
|
592
|
+
})
|
|
593
|
+
]
|
|
594
|
+
}, t);
|
|
595
|
+
})
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ h("div", {
|
|
598
|
+
"data-flow-interactive": "",
|
|
599
|
+
className: "absolute bottom-24 left-24 flex flex-col gap-8",
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ m(r, {
|
|
602
|
+
icon: g,
|
|
603
|
+
variant: "secondary",
|
|
604
|
+
tooltipSide: "right",
|
|
605
|
+
"aria-label": T("flowCanvas.zoomIn", "Zoom in"),
|
|
606
|
+
disabled: V.k >= j,
|
|
607
|
+
onClick: () => K(1)
|
|
608
|
+
}),
|
|
609
|
+
/* @__PURE__ */ m(r, {
|
|
610
|
+
icon: te,
|
|
611
|
+
variant: "secondary",
|
|
612
|
+
tooltipSide: "right",
|
|
613
|
+
"aria-label": T("flowCanvas.zoomOut", "Zoom out"),
|
|
614
|
+
disabled: V.k <= A,
|
|
615
|
+
onClick: () => K(-1)
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ m(r, {
|
|
618
|
+
icon: ee,
|
|
619
|
+
variant: "secondary",
|
|
620
|
+
tooltipSide: "right",
|
|
621
|
+
"aria-label": T("flowCanvas.fit", "Fit to view"),
|
|
622
|
+
onClick: Te
|
|
623
|
+
})
|
|
624
|
+
]
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ m("p", {
|
|
627
|
+
id: E,
|
|
628
|
+
className: "sr-only",
|
|
629
|
+
children: T("flowCanvas.keys", "Arrow keys move between steps, Enter selects one, plus and minus zoom, and 0 fits the view.")
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ m("ul", {
|
|
632
|
+
className: "sr-only",
|
|
633
|
+
children: k.wires.map((e) => /* @__PURE__ */ m("li", { children: he(e.label ? Ve : Be, {
|
|
634
|
+
from: Pe(e.from),
|
|
635
|
+
to: Pe(e.to),
|
|
636
|
+
label: e.label
|
|
637
|
+
}) }, e.key))
|
|
638
|
+
})
|
|
639
|
+
]
|
|
640
|
+
});
|
|
641
|
+
});
|
|
642
|
+
process.env.NODE_ENV !== "production" && (R.displayName = "FlowCanvas");
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/components/flow-canvas/flow-workspace.tsx
|
|
645
|
+
var z = { width: {
|
|
646
|
+
default: { classes: "lg:w-400" },
|
|
647
|
+
wide: { classes: "lg:w-480" }
|
|
648
|
+
} }, _e = { width: "default" }, B = /* @__PURE__ */ o(function({ children: t, panel: n, panelLabel: r, width: i = "default", className: a, ...o }, s) {
|
|
649
|
+
return /* @__PURE__ */ h("div", {
|
|
650
|
+
ref: s,
|
|
651
|
+
"data-flow-workspace": "",
|
|
652
|
+
className: e("flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain scrollbar-quiet lg:flex-row lg:overflow-hidden", a),
|
|
653
|
+
...o,
|
|
654
|
+
children: [/* @__PURE__ */ m("div", {
|
|
655
|
+
"data-flow-workspace-canvas": "",
|
|
656
|
+
className: "relative h-400 shrink-0 lg:h-auto lg:min-h-0 lg:min-w-0 lg:flex-1",
|
|
657
|
+
children: t
|
|
658
|
+
}), n && /* @__PURE__ */ m("aside", {
|
|
659
|
+
...r ? { "aria-label": r } : {},
|
|
660
|
+
"data-flow-workspace-panel": "",
|
|
661
|
+
className: e("relative shrink-0 max-lg:divider-t lg:min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:scrollbar-quiet lg:divider-l", z.width[i].classes),
|
|
662
|
+
children: n
|
|
663
|
+
})]
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
process.env.NODE_ENV !== "production" && (B.displayName = "FlowWorkspace");
|
|
667
|
+
var V = /* @__PURE__ */ o(function({ title: t, description: n, actions: r, children: i, className: a, ...o }, s) {
|
|
668
|
+
let c = `k-flow-panel-${l().replace(/[^\w-]/g, "")}`;
|
|
669
|
+
return /* @__PURE__ */ h("section", {
|
|
670
|
+
ref: s,
|
|
671
|
+
"aria-labelledby": c,
|
|
672
|
+
className: e("flex flex-col px-24 pt-20 pb-40", a),
|
|
673
|
+
...o,
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ h("header", {
|
|
676
|
+
className: "flex min-h-32 items-center justify-between gap-12",
|
|
677
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
678
|
+
id: c,
|
|
679
|
+
className: "min-w-0 text-title-sm font-semibold text-balance text-fg",
|
|
680
|
+
children: t
|
|
681
|
+
}), r && /* @__PURE__ */ m("div", {
|
|
682
|
+
className: "flex shrink-0 items-center gap-8",
|
|
683
|
+
children: r
|
|
684
|
+
})]
|
|
685
|
+
}),
|
|
686
|
+
n && /* @__PURE__ */ m("p", {
|
|
687
|
+
className: "mt-4 text-small text-fg-secondary",
|
|
688
|
+
children: n
|
|
689
|
+
}),
|
|
690
|
+
i && /* @__PURE__ */ m("div", {
|
|
691
|
+
className: "mt-20 flex flex-col gap-20",
|
|
692
|
+
children: i
|
|
693
|
+
})
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
process.env.NODE_ENV !== "production" && (V.displayName = "FlowWorkspace.Panel");
|
|
698
|
+
var H = /* @__PURE__ */ Object.assign(B, { Panel: V });
|
|
699
|
+
//#endregion
|
|
700
|
+
export { R as FlowCanvas, H as FlowWorkspace, V as FlowWorkspacePanel, O as KAESO_FLOW_CANVAS_DEFAULT_VARIANTS, le as KAESO_FLOW_CANVAS_VARIANTS, _e as KAESO_FLOW_WORKSPACE_DEFAULT_VARIANTS, z as KAESO_FLOW_WORKSPACE_VARIANTS };
|
|
701
|
+
|
|
702
|
+
//# sourceMappingURL=flow-canvas.js.map
|