@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7
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 +564 -2
- package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
- package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
- package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
- package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
- package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
- package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
- package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
- package/dist/DateTimeField-B1qR4ruo.js +51 -0
- package/dist/Disclosure-BNKij7-v.js +45 -0
- package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
- package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
- package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
- package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
- package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
- package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
- package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
- package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
- package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
- package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
- package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
- package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
- package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
- package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
- package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
- package/dist/FluidGridsMark-CE2blT7K.js +74 -0
- package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
- package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
- package/dist/HistoryPage-BSBISXoj.js +2835 -0
- package/dist/Icon-BtQ0HXLh.js +160 -0
- package/dist/InsightsPage-D7ybj8N9.js +11245 -0
- package/dist/IsolationSetting-vy911E8b.js +1153 -0
- package/dist/LibraryParts-DOeNgR8A.js +413 -0
- package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
- package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
- package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
- package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
- package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
- package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
- package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
- package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
- package/dist/NodesPage-O7KeeKtd.js +653 -0
- package/dist/OfflineIcon-TwMKYWjA.js +207 -0
- package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
- package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
- package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
- package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
- package/dist/RunActionsMenu-DodOgIQm.js +59 -0
- package/dist/RunnerStatusPill-C1v967iq.js +24 -0
- package/dist/RunnersPage-dB0RSdY_.js +1929 -0
- package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
- package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
- package/dist/SearchBox-BGtYjvfs.js +49 -0
- package/dist/SequenceEditor-CFiHeHkR.js +497 -0
- package/dist/SettingsPage-0CQBNPZV.js +8695 -0
- package/dist/StewardPages-DAJhepen.js +47 -0
- package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
- package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
- package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
- package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
- package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
- package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
- package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
- package/dist/TemplatePreview-cx7-NOeG.js +868 -0
- package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
- package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
- package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
- package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
- package/dist/TranslationBridge-Da-TPgQm.js +68 -0
- package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
- package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
- package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
- package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
- package/dist/VariablesPage-ChfGuW22.js +2243 -0
- package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
- package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
- package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
- package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
- package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
- package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
- package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
- package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
- package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
- package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
- package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
- package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
- package/dist/WorkflowsList--hR2_8gf.js +4593 -0
- package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
- package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
- package/dist/addonCatalog-CbZS4deh.js +58 -0
- package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
- package/dist/addons.d.ts +3 -0
- package/dist/addons.js +4 -0
- package/dist/agent-form-Bfvm32j1.js +83 -0
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/agentTools-CyL7DLOF.js +320 -0
- package/dist/ai-usage-BrxDgvdR.js +240 -0
- package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
- package/dist/api-BKq-nIOZ.js +2286 -0
- package/dist/api-Ol7I8NxE.js +8289 -0
- package/dist/apollo-type-policies.d.ts +11 -0
- package/dist/apollo-type-policies.js +64 -0
- package/dist/askAboutBridge-ByYsQams.js +106 -0
- package/dist/askQuestions-Cmx7VnMm.js +742 -0
- package/dist/assert-rules-lfYEMc99.js +318 -0
- package/dist/assistant.d.ts +94 -0
- package/dist/assistant.js +99 -0
- package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/basil.generated-BK-EHbwN.js +10 -0
- package/dist/browser-steps-DMpS5TyB.js +533 -0
- package/dist/builderTimings-pvGnK1m-.js +510 -0
- package/dist/button-DG7y_FVJ.js +48 -0
- package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
- package/dist/card-Bomy_1UG.js +44 -0
- package/dist/catalogGrid-BOrfMgi-.js +41 -0
- package/dist/channel-CPyQ1NR1.js +212 -0
- package/dist/chips-CvNrYJZa.js +27 -0
- package/dist/client-holder-C0M5Cfwl.js +68 -0
- package/dist/cn-QqidFIgr.js +10 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/code-editor-field-x_JrY8KR.js +113 -0
- package/dist/codec-client-DPuD6mw7.js +515 -0
- package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
- package/dist/config-DO68jw5k.js +322 -0
- package/dist/constants-DgbVc24O.d.ts +296 -0
- package/dist/constants-DlRnHBfQ.js +217 -0
- package/dist/convert-browser-action-pfecelF7.js +347 -0
- package/dist/convert-dialog-B_o22NiJ.js +382 -0
- package/dist/create-workflow-first-Azg3JUdX.js +120 -0
- package/dist/definition-canvas-Bsda-rDT.js +31 -0
- package/dist/dialog-BVd152GS.js +94 -0
- package/dist/durable-nodes-BXyYCLxT.js +91 -0
- package/dist/duration-CDb7-mT_.js +33 -0
- package/dist/edge-mapper-wEAdGVU2.js +4477 -0
- package/dist/element-library-DkSlg_VE.js +727 -0
- package/dist/entities-I_0kio3q.js +38 -0
- package/dist/error-advice-QLr5NCm7.js +65 -0
- package/dist/errors-ClKb5sEt.js +188 -0
- package/dist/executions.d.ts +3 -0
- package/dist/executions.js +5 -0
- package/dist/feature-flags-B2qetXKd.js +385 -0
- package/dist/field-label-DPZRmE_B.js +153 -0
- package/dist/firstWorkflow-C_h0KMB2.js +133 -0
- package/dist/flags.d.ts +3 -0
- package/dist/flags.js +4 -0
- package/dist/flow-builder-DIvLOhz0.js +28038 -0
- package/dist/flow-store-holder-CUN7Terz.js +52 -0
- package/dist/fluent.generated-CA_e6-4l.js +14 -0
- package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
- package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
- package/dist/global-client-BQPuFrFa.js +433 -0
- package/dist/global-operations-BG6YgxrM.js +136 -0
- package/dist/graphql-types-UTYtujY9.js +21358 -0
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/index-AoJAa5vU.d.ts +164958 -0
- package/dist/index-DEMT3iAM.d.ts +120 -0
- package/dist/index-ROZzNGyY.d.ts +76 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8123 -0
- package/dist/ion.generated-mbajjcAg.js +10 -0
- package/dist/label-Lzb8ZXf_.js +29 -0
- package/dist/labels-rXd9gYQz.js +1236 -0
- package/dist/liveCanvas-D5ytXDp8.js +103 -0
- package/dist/logos.generated-X6_0kjVR.js +21 -0
- package/dist/logs-panel-Cw0DkG0l.js +468 -0
- package/dist/lucide.generated-B6NVd3GT.js +29 -0
- package/dist/marksStore-a9oIMMot.js +175 -0
- package/dist/mcp-trigger-D0nRdvq5.js +307 -0
- package/dist/mdi.generated-D1BV74d6.js +292 -0
- package/dist/menus-CU3hDGYl.js +160 -0
- package/dist/mynaui.generated-DMWr5cXz.js +66 -0
- package/dist/navigation-v2.d.ts +3 -0
- package/dist/navigation-v2.js +5 -0
- package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
- package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
- package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/node-role-TMbnkmeP.js +132 -0
- package/dist/node-type-icon-BZa8n4iG.js +33 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +5 -0
- package/dist/offset-pages-zghoClB3.js +55 -0
- package/dist/operations-BBmT9ToP.js +663 -0
- package/dist/operations-WxRJWeqO.js +3133 -0
- package/dist/output-files-Ba8bu5lv.js +196 -0
- package/dist/page-operation-DrWuhd6Y.js +129 -0
- package/dist/page-twins.d.ts +13 -0
- package/dist/page-twins.js +186 -0
- package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
- package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
- package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
- package/dist/panels-PfBBAToE.js +346 -0
- package/dist/parts-B7fBcw-B.js +346 -0
- package/dist/popover-Dms9Vz3j.js +3389 -0
- package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
- package/dist/proactive.d.ts +66 -0
- package/dist/proactive.js +237 -0
- package/dist/quick-config-panel-DFd77xho.js +451 -0
- package/dist/quota-DeA_CJ2e.js +175 -0
- package/dist/quota.d.ts +3 -0
- package/dist/quota.js +4 -0
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/relative-time-Dxt8ZIIu.js +55 -0
- package/dist/results-CwK_yDxK.js +325 -0
- package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
- package/dist/route-data.d.ts +12 -0
- package/dist/route-data.js +69 -0
- package/dist/route-match-C-0_EnAt.d.ts +5 -0
- package/dist/route-match-DMkUICYV.js +41 -0
- package/dist/route-preload-C4DlGoCd.js +120 -0
- package/dist/run-display-UjLAoYqQ.js +81 -0
- package/dist/run-history-arGiHzGU.js +285 -0
- package/dist/run-list-links-DJn4Mf1T.js +98 -0
- package/dist/run-mode-USmM0-Uo.js +82 -0
- package/dist/run-parity-CWXqEJqM.js +144 -0
- package/dist/runsQuota-B6SyTbne.js +100 -0
- package/dist/runsQuota-DsniKiSg.d.ts +20 -0
- package/dist/safe-expression-Cw7-SCsm.js +1251 -0
- package/dist/save-status-store-C7nEYpfb.js +631 -0
- package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
- package/dist/schedule-rules-ggVKRkBH.js +358 -0
- package/dist/secrets-Re_wSiE3.js +153 -0
- package/dist/settings.d.ts +4 -0
- package/dist/settings.js +6 -0
- package/dist/shared-DAWGGMSM.js +177 -0
- package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
- package/dist/solar.generated-CGYuUQAC.js +10 -0
- package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
- package/dist/start-url-CT6Yz96K.js +24 -0
- package/dist/status-CessxGpm.js +55 -0
- package/dist/store-icon-OctYp5zP.js +155 -0
- package/dist/styles-WGmTnZ2n.js +26 -0
- package/dist/styles.css +139 -0
- package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
- package/dist/template-code-CzN6JWNV.js +191 -0
- package/dist/template-graph-DLF9dygU.js +20 -0
- package/dist/template-preview-DcIIKOOL.js +32 -0
- package/dist/template-price-CdUHZRMF.js +40 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +5 -0
- package/dist/theme-provider-CntfC4_i.js +23 -0
- package/dist/transient-DgZfhDfN.js +57 -0
- package/dist/typed-calls-C5tO03wq.js +26 -0
- package/dist/ui-script-By74Guk3.js +1094 -0
- package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
- package/dist/ui-step-fix-8uM2_Hft.js +67 -0
- package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
- package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
- package/dist/ui-target-editor-D2JhB_lD.js +673 -0
- package/dist/uiMarkTools-CSznnO1i.js +1054 -0
- package/dist/upgradePrompt-BAFBKKW5.js +72 -0
- package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
- package/dist/use-browser-available-hj8wc3Kb.js +241 -0
- package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
- package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
- package/dist/use-mobile-BTqCUjzS.js +27 -0
- package/dist/use-sdk-query-C697xZVv.js +116 -0
- package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
- package/dist/useActionParam-B2tU2BlY.js +85 -0
- package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
- package/dist/useBrowserClients-3v95-gSh.js +103 -0
- package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
- package/dist/useConnections-DsgEJs05.js +439 -0
- package/dist/useDebouncedValue-BFekcv6n.js +18 -0
- package/dist/useDurableParity-8fnMZmBc.js +1787 -0
- package/dist/useEntityTags-D0spL6Ut.js +460 -0
- package/dist/useExecutions-2u5nGJJk.js +681 -0
- package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
- package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
- package/dist/useHumanRequests-zlYDp3l1.js +221 -0
- package/dist/useNavigationV2-C2WeqN7d.js +29 -0
- package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
- package/dist/useObservability-BRlQ0tOA.js +285 -0
- package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
- package/dist/useRunHistory-CXCMUPyf.js +2759 -0
- package/dist/useRunLive-D0JvVZT2.js +1060 -0
- package/dist/useRunnerList-Dbi59i1K.js +446 -0
- package/dist/useRunners-URUc5quU.js +173 -0
- package/dist/useRunsPage-DG656UCK.js +2709 -0
- package/dist/useVariables-BIelxcWr.js +463 -0
- package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
- package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
- package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
- package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
- package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
- package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
- package/dist/utils-fvBb5qOD.js +89 -0
- package/dist/webhook-deliveries-AvQujaZy.js +99 -0
- package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
- package/dist/workflow-builder.d.ts +3 -0
- package/dist/workflow-builder.js +8 -0
- package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
- package/dist/workflow-embed.d.ts +3 -0
- package/dist/workflow-embed.js +4 -0
- package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
- package/dist/workflow-host.d.ts +6 -0
- package/dist/workflow-host.js +11 -0
- package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
- package/dist/workflow-pages.d.ts +3 -0
- package/dist/workflow-pages.js +115 -0
- package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
- package/dist/workflow-preview.d.ts +65 -0
- package/dist/workflow-preview.js +4 -0
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflow-save-state-D0l-DkLf.js +767 -0
- package/dist/workflow-transfer-CQnQC-ke.js +104 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.d.ts +10 -0
- package/dist/workflows-list.js +5 -0
- package/package.json +320 -4
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronDown, ChevronUp, Plus, X } from "lucide-react";
|
|
6
|
+
import { cn } from "@burdenoff/fe-libs/utils";
|
|
7
|
+
import { ThemedSelect } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
|
|
9
|
+
// src/builder/components/ndv/ui-script-editor/ui-styles.ts
|
|
10
|
+
/** Shared class names of the Use Browser step editor (semantic tokens only). */
|
|
11
|
+
const uiSmallLabel = "text-[10px] font-semibold text-muted-foreground";
|
|
12
|
+
const uiInputClass = "rounded border border-input bg-background px-1.5 py-1 text-xs text-foreground outline-none focus:border-primary disabled:opacity-50";
|
|
13
|
+
const uiIconButton = "rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary disabled:opacity-30";
|
|
14
|
+
const uiLinkButton = "flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50";
|
|
15
|
+
|
|
16
|
+
// src/builder/components/ndv/ui-script-editor/ui-buffered-input.tsx
|
|
17
|
+
/**
|
|
18
|
+
* A text box whose stored value is parsed from what is typed (keys, seconds,
|
|
19
|
+
* a similarity), so the stored form may read differently from the text: `1.`
|
|
20
|
+
* stores 1, `Control+` stores ["Control"]. It keeps the typed text while it
|
|
21
|
+
* means the stored value, and shows the stored value again only when that
|
|
22
|
+
* changes from outside (undo, the JSON box).
|
|
23
|
+
*/
|
|
24
|
+
function BufferedInput({ value, onText, normalize, ...props }) {
|
|
25
|
+
const [text, setText] = useState(value);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setText((current) => normalize(current) === value ? current : value);
|
|
28
|
+
}, [value, normalize]);
|
|
29
|
+
return /* @__PURE__ */ jsx("input", {
|
|
30
|
+
...props,
|
|
31
|
+
type: "text",
|
|
32
|
+
value: text,
|
|
33
|
+
onChange: (event) => {
|
|
34
|
+
setText(event.target.value);
|
|
35
|
+
onText(event.target.value);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/builder/components/ndv/ui-script-editor/ui-target-editor.tsx
|
|
41
|
+
/**
|
|
42
|
+
* Where a step acts (spec 05 section 3): a target is an ordered list of
|
|
43
|
+
* methods, each with an on or off switch, plus an optional frame chain; or a
|
|
44
|
+
* pinned Element library element.
|
|
45
|
+
*
|
|
46
|
+
* - {@link UiTargetQuickField} is the everyday level: the element's label or
|
|
47
|
+
* visible text. No selector shows here (spec 19, M1 rule 5).
|
|
48
|
+
* - {@link UiTargetMethodsEditor} is level 3, "Technical details": every
|
|
49
|
+
* method, in the order they are tried, with its fields (spec 19, M2 rule 6).
|
|
50
|
+
*/
|
|
51
|
+
function isRecord(value) {
|
|
52
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53
|
+
}
|
|
54
|
+
/** The target's methods, when it is an inline target. */
|
|
55
|
+
function targetMethods(target) {
|
|
56
|
+
if (!isRecord(target) || !Array.isArray(target.methods)) return [];
|
|
57
|
+
return target.methods.filter((method) => isRecord(method) && typeof method.kind === "string");
|
|
58
|
+
}
|
|
59
|
+
/** The library element key a target pins, or null for an inline target. */
|
|
60
|
+
function pinnedElementKey(target) {
|
|
61
|
+
return isRecord(target) && typeof target.element === "string" ? target.element : null;
|
|
62
|
+
}
|
|
63
|
+
/** The fields a method of a kind starts with. */
|
|
64
|
+
function newMethod(kind) {
|
|
65
|
+
switch (kind) {
|
|
66
|
+
case "role": return {
|
|
67
|
+
kind,
|
|
68
|
+
role: "button",
|
|
69
|
+
name: ""
|
|
70
|
+
};
|
|
71
|
+
case "css": return {
|
|
72
|
+
kind,
|
|
73
|
+
selector: ""
|
|
74
|
+
};
|
|
75
|
+
case "testId": return {
|
|
76
|
+
kind,
|
|
77
|
+
value: ""
|
|
78
|
+
};
|
|
79
|
+
case "xpath": return {
|
|
80
|
+
kind,
|
|
81
|
+
xpath: ""
|
|
82
|
+
};
|
|
83
|
+
case "fuzzy": return {
|
|
84
|
+
kind,
|
|
85
|
+
name: ""
|
|
86
|
+
};
|
|
87
|
+
case "anchor": return {
|
|
88
|
+
kind,
|
|
89
|
+
anchor: {
|
|
90
|
+
kind: "text",
|
|
91
|
+
text: ""
|
|
92
|
+
},
|
|
93
|
+
relation: "rightOf"
|
|
94
|
+
};
|
|
95
|
+
default: return {
|
|
96
|
+
kind: "text",
|
|
97
|
+
text: ""
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** The method whose name or text the everyday field edits, by index. */
|
|
102
|
+
function quickMethodIndex(methods) {
|
|
103
|
+
return methods.findIndex((method) => method.kind === "role" || method.kind === "text" || method.kind === "fuzzy");
|
|
104
|
+
}
|
|
105
|
+
/** The everyday text of a target: its role name, visible text or fuzzy name. */
|
|
106
|
+
function quickText(methods) {
|
|
107
|
+
const method = methods[quickMethodIndex(methods)];
|
|
108
|
+
if (!method) return "";
|
|
109
|
+
const text = method.kind === "text" ? method.text : method.name;
|
|
110
|
+
return typeof text === "string" ? text : "";
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The target with its everyday text set: on the first role, text or fuzzy
|
|
114
|
+
* method, or as a new visible-text method when it has none (then it is tried
|
|
115
|
+
* first, before any technical method).
|
|
116
|
+
*/
|
|
117
|
+
function withQuickText(target, text) {
|
|
118
|
+
const base = isRecord(target) && !pinnedElementKey(target) ? target : {};
|
|
119
|
+
const methods = targetMethods(base);
|
|
120
|
+
const index = quickMethodIndex(methods);
|
|
121
|
+
if (index < 0) return {
|
|
122
|
+
...base,
|
|
123
|
+
methods: [{
|
|
124
|
+
kind: "text",
|
|
125
|
+
text
|
|
126
|
+
}, ...methods]
|
|
127
|
+
};
|
|
128
|
+
const next = methods.slice();
|
|
129
|
+
const method = next[index];
|
|
130
|
+
if (method) next[index] = method.kind === "text" ? {
|
|
131
|
+
...method,
|
|
132
|
+
text
|
|
133
|
+
} : {
|
|
134
|
+
...method,
|
|
135
|
+
name: text
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
...base,
|
|
139
|
+
methods: next
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** The choice of the element chooser that means "an inline target". */
|
|
143
|
+
const INLINE_TARGET = "";
|
|
144
|
+
/**
|
|
145
|
+
* Which library element a step uses, when the script pins any (RPA plan
|
|
146
|
+
* P1-13: shared sequences pin their elements; a Use Browser node may too):
|
|
147
|
+
* one of the pinned keys, or the inline target typed below.
|
|
148
|
+
*/
|
|
149
|
+
function ElementChooser({ pinned, choices, onChange, testId, readOnly }) {
|
|
150
|
+
const tr = useTr();
|
|
151
|
+
return /* @__PURE__ */ jsxs(ThemedSelect, {
|
|
152
|
+
value: pinned ?? INLINE_TARGET,
|
|
153
|
+
disabled: readOnly,
|
|
154
|
+
"aria-label": tr("fluidgrids.builder.uiScript.target.chooseElement", "Library element"),
|
|
155
|
+
onChange: (event) => onChange(event.target.value === INLINE_TARGET ? { methods: [{
|
|
156
|
+
kind: "text",
|
|
157
|
+
text: ""
|
|
158
|
+
}] } : { element: event.target.value }),
|
|
159
|
+
className: cn(uiInputClass, "w-full"),
|
|
160
|
+
"data-testid": `${testId}-element`,
|
|
161
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
162
|
+
value: INLINE_TARGET,
|
|
163
|
+
children: tr("fluidgrids.builder.uiScript.target.inline", "Found by its label or text")
|
|
164
|
+
}), Object.entries(choices).map(([key, name]) => /* @__PURE__ */ jsx("option", {
|
|
165
|
+
value: key,
|
|
166
|
+
children: tr("fluidgrids.builder.uiScript.target.pinned", "{{name}} (Element library)", { name })
|
|
167
|
+
}, key))]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function UiTargetQuickField({ label, target, elementName, elementChoices, onChange, testId, readOnly }) {
|
|
171
|
+
const tr = useTr();
|
|
172
|
+
const pinned = pinnedElementKey(target);
|
|
173
|
+
const chooser = elementChoices && Object.keys(elementChoices).length > 0 ? /* @__PURE__ */ jsx(ElementChooser, {
|
|
174
|
+
pinned,
|
|
175
|
+
choices: elementChoices,
|
|
176
|
+
onChange,
|
|
177
|
+
testId,
|
|
178
|
+
readOnly
|
|
179
|
+
}) : null;
|
|
180
|
+
if (pinned) {
|
|
181
|
+
const known = chooser !== null && Object.hasOwn(elementChoices ?? {}, pinned);
|
|
182
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
183
|
+
className: "flex flex-col gap-0.5",
|
|
184
|
+
"data-testid": testId,
|
|
185
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: uiSmallLabel,
|
|
187
|
+
children: label
|
|
188
|
+
}), known ? chooser : /* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "text-xs text-foreground",
|
|
190
|
+
"data-testid": `${testId}-pinned`,
|
|
191
|
+
children: tr("fluidgrids.builder.uiScript.target.pinned", "{{name}} (Element library)", { name: elementName ?? pinned })
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
const methods = targetMethods(target);
|
|
196
|
+
const control = methods.length === 0 || quickMethodIndex(methods) >= 0 ? /* @__PURE__ */ jsx("input", {
|
|
197
|
+
type: "text",
|
|
198
|
+
value: quickText(methods),
|
|
199
|
+
readOnly,
|
|
200
|
+
placeholder: tr("fluidgrids.builder.uiScript.target.quickPlaceholder", "Its label or visible text, such as Search"),
|
|
201
|
+
"aria-label": chooser ? label : void 0,
|
|
202
|
+
onChange: (event) => onChange(withQuickText(target, event.target.value)),
|
|
203
|
+
className: cn(uiInputClass, "w-full"),
|
|
204
|
+
"data-testid": `${testId}-text`
|
|
205
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: "text-[11px] text-muted-foreground",
|
|
207
|
+
children: tr("fluidgrids.builder.uiScript.target.technicalOnly", "Found by its technical details. Open Show technical details to change how.")
|
|
208
|
+
});
|
|
209
|
+
if (chooser) return /* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "flex flex-col gap-0.5",
|
|
211
|
+
"data-testid": testId,
|
|
212
|
+
children: [
|
|
213
|
+
/* @__PURE__ */ jsx("span", {
|
|
214
|
+
className: uiSmallLabel,
|
|
215
|
+
children: label
|
|
216
|
+
}),
|
|
217
|
+
chooser,
|
|
218
|
+
control
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
222
|
+
className: "flex flex-col gap-0.5",
|
|
223
|
+
"data-testid": testId,
|
|
224
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
225
|
+
className: uiSmallLabel,
|
|
226
|
+
children: label
|
|
227
|
+
}), control]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
const METHOD_KINDS = [
|
|
231
|
+
{
|
|
232
|
+
kind: "role",
|
|
233
|
+
key: "fluidgrids.builder.uiScript.method.role",
|
|
234
|
+
fallback: "Strict: role and name"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
kind: "css",
|
|
238
|
+
key: "fluidgrids.builder.uiScript.method.css",
|
|
239
|
+
fallback: "Strict: CSS selector"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
kind: "testId",
|
|
243
|
+
key: "fluidgrids.builder.uiScript.method.testId",
|
|
244
|
+
fallback: "Strict: test id"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
kind: "xpath",
|
|
248
|
+
key: "fluidgrids.builder.uiScript.method.xpath",
|
|
249
|
+
fallback: "Strict: XPath"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
kind: "fuzzy",
|
|
253
|
+
key: "fluidgrids.builder.uiScript.method.fuzzy",
|
|
254
|
+
fallback: "Fuzzy: similar name"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
kind: "anchor",
|
|
258
|
+
key: "fluidgrids.builder.uiScript.method.anchor",
|
|
259
|
+
fallback: "Anchor: beside a label"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
kind: "text",
|
|
263
|
+
key: "fluidgrids.builder.uiScript.method.text",
|
|
264
|
+
fallback: "Text: visible text"
|
|
265
|
+
}
|
|
266
|
+
];
|
|
267
|
+
const ANCHOR_RELATIONS = [
|
|
268
|
+
"leftOf",
|
|
269
|
+
"rightOf",
|
|
270
|
+
"above",
|
|
271
|
+
"below",
|
|
272
|
+
"inside",
|
|
273
|
+
"sameRow"
|
|
274
|
+
];
|
|
275
|
+
function MethodText({ label, value, onChange, testId, readOnly, mono, numeric }) {
|
|
276
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
277
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
278
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
279
|
+
className: uiSmallLabel,
|
|
280
|
+
children: label
|
|
281
|
+
}), /* @__PURE__ */ jsx(BufferedInput, {
|
|
282
|
+
value: typeof value === "string" || typeof value === "number" ? String(value) : "",
|
|
283
|
+
normalize: numeric ? normalizeNumber : sameText,
|
|
284
|
+
inputMode: numeric ? "decimal" : void 0,
|
|
285
|
+
readOnly,
|
|
286
|
+
onText: onChange,
|
|
287
|
+
className: cn(uiInputClass, "w-full", mono && "font-mono"),
|
|
288
|
+
"data-testid": testId
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/** A number field of a method: empty removes it. */
|
|
293
|
+
function numberOrUndefined(text) {
|
|
294
|
+
if (!text.trim()) return void 0;
|
|
295
|
+
const value = Number(text);
|
|
296
|
+
return Number.isFinite(value) ? value : void 0;
|
|
297
|
+
}
|
|
298
|
+
/** How a typed number reads once stored. */
|
|
299
|
+
function normalizeNumber(text) {
|
|
300
|
+
const value = numberOrUndefined(text);
|
|
301
|
+
return value === void 0 ? "" : String(value);
|
|
302
|
+
}
|
|
303
|
+
function sameText(text) {
|
|
304
|
+
return text;
|
|
305
|
+
}
|
|
306
|
+
function withField(method, field, value) {
|
|
307
|
+
const copy = { ...method };
|
|
308
|
+
if (value === void 0 || value === "") delete copy[field];
|
|
309
|
+
else copy[field] = value;
|
|
310
|
+
return copy;
|
|
311
|
+
}
|
|
312
|
+
function MethodFields({ method, onChange, testId, readOnly }) {
|
|
313
|
+
const tr = useTr();
|
|
314
|
+
const set = (field, value) => onChange(withField(method, field, value));
|
|
315
|
+
switch (method.kind) {
|
|
316
|
+
case "role": return /* @__PURE__ */ jsxs("div", {
|
|
317
|
+
className: "grid grid-cols-3 gap-1",
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
320
|
+
label: tr("fluidgrids.builder.uiScript.method.roleField", "Role"),
|
|
321
|
+
value: method.role,
|
|
322
|
+
onChange: (next) => onChange({
|
|
323
|
+
...method,
|
|
324
|
+
role: next
|
|
325
|
+
}),
|
|
326
|
+
testId: `${testId}-role`,
|
|
327
|
+
readOnly
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
330
|
+
label: tr("fluidgrids.builder.uiScript.method.nameField", "Name"),
|
|
331
|
+
value: method.name,
|
|
332
|
+
onChange: (next) => onChange({
|
|
333
|
+
...method,
|
|
334
|
+
name: next
|
|
335
|
+
}),
|
|
336
|
+
testId: `${testId}-name`,
|
|
337
|
+
readOnly
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
340
|
+
label: tr("fluidgrids.builder.uiScript.method.nthField", "Which match (0 = first)"),
|
|
341
|
+
value: method.nth,
|
|
342
|
+
onChange: (next) => set("nth", numberOrUndefined(next)),
|
|
343
|
+
numeric: true,
|
|
344
|
+
testId: `${testId}-nth`,
|
|
345
|
+
readOnly
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
});
|
|
349
|
+
case "css": return /* @__PURE__ */ jsx(MethodText, {
|
|
350
|
+
label: tr("fluidgrids.builder.uiScript.method.selector", "Selector"),
|
|
351
|
+
value: method.selector,
|
|
352
|
+
onChange: (next) => onChange({
|
|
353
|
+
...method,
|
|
354
|
+
selector: next
|
|
355
|
+
}),
|
|
356
|
+
testId: `${testId}-selector`,
|
|
357
|
+
readOnly,
|
|
358
|
+
mono: true
|
|
359
|
+
});
|
|
360
|
+
case "testId": return /* @__PURE__ */ jsxs("div", {
|
|
361
|
+
className: "grid grid-cols-2 gap-1",
|
|
362
|
+
children: [/* @__PURE__ */ jsx(MethodText, {
|
|
363
|
+
label: tr("fluidgrids.builder.uiScript.method.testIdValue", "Id"),
|
|
364
|
+
value: method.value,
|
|
365
|
+
onChange: (next) => onChange({
|
|
366
|
+
...method,
|
|
367
|
+
value: next
|
|
368
|
+
}),
|
|
369
|
+
testId: `${testId}-value`,
|
|
370
|
+
readOnly,
|
|
371
|
+
mono: true
|
|
372
|
+
}), /* @__PURE__ */ jsx(MethodText, {
|
|
373
|
+
label: tr("fluidgrids.builder.uiScript.method.attribute", "Attribute (default data-testid)"),
|
|
374
|
+
value: method.attribute,
|
|
375
|
+
onChange: (next) => set("attribute", next),
|
|
376
|
+
testId: `${testId}-attribute`,
|
|
377
|
+
readOnly,
|
|
378
|
+
mono: true
|
|
379
|
+
})]
|
|
380
|
+
});
|
|
381
|
+
case "xpath": return /* @__PURE__ */ jsx(MethodText, {
|
|
382
|
+
label: tr("fluidgrids.builder.uiScript.method.xpathField", "XPath"),
|
|
383
|
+
value: method.xpath,
|
|
384
|
+
onChange: (next) => onChange({
|
|
385
|
+
...method,
|
|
386
|
+
xpath: next
|
|
387
|
+
}),
|
|
388
|
+
testId: `${testId}-xpath`,
|
|
389
|
+
readOnly,
|
|
390
|
+
mono: true
|
|
391
|
+
});
|
|
392
|
+
case "fuzzy": return /* @__PURE__ */ jsxs("div", {
|
|
393
|
+
className: "grid grid-cols-3 gap-1",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
396
|
+
label: tr("fluidgrids.builder.uiScript.method.roleOptional", "Role (optional)"),
|
|
397
|
+
value: method.role,
|
|
398
|
+
onChange: (next) => set("role", next),
|
|
399
|
+
testId: `${testId}-role`,
|
|
400
|
+
readOnly
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
403
|
+
label: tr("fluidgrids.builder.uiScript.method.nameField", "Name"),
|
|
404
|
+
value: method.name,
|
|
405
|
+
onChange: (next) => onChange({
|
|
406
|
+
...method,
|
|
407
|
+
name: next
|
|
408
|
+
}),
|
|
409
|
+
testId: `${testId}-name`,
|
|
410
|
+
readOnly
|
|
411
|
+
}),
|
|
412
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
413
|
+
label: tr("fluidgrids.builder.uiScript.method.threshold", "Similarity (0.5 to 1)"),
|
|
414
|
+
value: method.threshold,
|
|
415
|
+
onChange: (next) => set("threshold", numberOrUndefined(next)),
|
|
416
|
+
numeric: true,
|
|
417
|
+
testId: `${testId}-threshold`,
|
|
418
|
+
readOnly
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
});
|
|
422
|
+
case "anchor": {
|
|
423
|
+
const anchor = isRecord(method.anchor) ? method.anchor : {};
|
|
424
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
425
|
+
className: "grid grid-cols-3 gap-1",
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
428
|
+
label: tr("fluidgrids.builder.uiScript.method.anchorText", "Label text"),
|
|
429
|
+
value: anchor.kind === "role" ? anchor.name : anchor.text,
|
|
430
|
+
onChange: (next) => onChange({
|
|
431
|
+
...method,
|
|
432
|
+
anchor: anchor.kind === "role" ? {
|
|
433
|
+
...anchor,
|
|
434
|
+
name: next
|
|
435
|
+
} : {
|
|
436
|
+
kind: "text",
|
|
437
|
+
text: next
|
|
438
|
+
}
|
|
439
|
+
}),
|
|
440
|
+
testId: `${testId}-anchor`,
|
|
441
|
+
readOnly
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsxs("label", {
|
|
444
|
+
className: "flex flex-col gap-0.5",
|
|
445
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
446
|
+
className: uiSmallLabel,
|
|
447
|
+
children: tr("fluidgrids.builder.uiScript.method.relation", "Where")
|
|
448
|
+
}), /* @__PURE__ */ jsx(ThemedSelect, {
|
|
449
|
+
value: typeof method.relation === "string" ? method.relation : "rightOf",
|
|
450
|
+
disabled: readOnly,
|
|
451
|
+
onChange: (event) => onChange({
|
|
452
|
+
...method,
|
|
453
|
+
relation: event.target.value
|
|
454
|
+
}),
|
|
455
|
+
className: uiInputClass,
|
|
456
|
+
"data-testid": `${testId}-relation`,
|
|
457
|
+
children: ANCHOR_RELATIONS.map((relation) => /* @__PURE__ */ jsx("option", {
|
|
458
|
+
value: relation,
|
|
459
|
+
children: relation
|
|
460
|
+
}, relation))
|
|
461
|
+
})]
|
|
462
|
+
}),
|
|
463
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
464
|
+
label: tr("fluidgrids.builder.uiScript.method.roleOptional", "Role (optional)"),
|
|
465
|
+
value: method.role,
|
|
466
|
+
onChange: (next) => set("role", next),
|
|
467
|
+
testId: `${testId}-role`,
|
|
468
|
+
readOnly
|
|
469
|
+
})
|
|
470
|
+
]
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
default: return /* @__PURE__ */ jsxs("div", {
|
|
474
|
+
className: "grid grid-cols-3 gap-1",
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
477
|
+
label: tr("fluidgrids.builder.uiScript.method.textField", "Text"),
|
|
478
|
+
value: method.text,
|
|
479
|
+
onChange: (next) => onChange({
|
|
480
|
+
...method,
|
|
481
|
+
text: next
|
|
482
|
+
}),
|
|
483
|
+
testId: `${testId}-text`,
|
|
484
|
+
readOnly
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ jsxs("label", {
|
|
487
|
+
className: "flex items-center gap-1 pt-3 text-xs",
|
|
488
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
489
|
+
type: "checkbox",
|
|
490
|
+
checked: method.exact === true,
|
|
491
|
+
disabled: readOnly,
|
|
492
|
+
onChange: (event) => set("exact", event.target.checked ? true : void 0),
|
|
493
|
+
"data-testid": `${testId}-exact`
|
|
494
|
+
}), tr("fluidgrids.builder.uiScript.method.exact", "Whole text")]
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ jsx(MethodText, {
|
|
497
|
+
label: tr("fluidgrids.builder.uiScript.method.nthField", "Which match (0 = first)"),
|
|
498
|
+
value: method.nth,
|
|
499
|
+
onChange: (next) => set("nth", numberOrUndefined(next)),
|
|
500
|
+
numeric: true,
|
|
501
|
+
testId: `${testId}-nth`,
|
|
502
|
+
readOnly
|
|
503
|
+
})
|
|
504
|
+
]
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/** The target's frame chain as editable text: CSS selectors, outermost first. */
|
|
509
|
+
function frameText(target) {
|
|
510
|
+
return isRecord(target) && Array.isArray(target.frame) ? target.frame.filter((part) => typeof part === "string").join(" >> ") : "";
|
|
511
|
+
}
|
|
512
|
+
/** The frame chain field: written when it loses focus, so `>>` can be typed in full. */
|
|
513
|
+
function FrameInput({ initial, onCommit, readOnly, testId }) {
|
|
514
|
+
const tr = useTr();
|
|
515
|
+
const [text, setText] = useState(initial);
|
|
516
|
+
return /* @__PURE__ */ jsx("input", {
|
|
517
|
+
type: "text",
|
|
518
|
+
"aria-label": tr("fluidgrids.builder.uiScript.target.frame", "Inside frames or shadow roots (CSS selectors, outermost first, separated by >>)"),
|
|
519
|
+
value: text,
|
|
520
|
+
readOnly,
|
|
521
|
+
onChange: (event) => setText(event.target.value),
|
|
522
|
+
onBlur: () => {
|
|
523
|
+
if (text !== initial) onCommit(text);
|
|
524
|
+
},
|
|
525
|
+
className: cn(uiInputClass, "w-full font-mono"),
|
|
526
|
+
"data-testid": testId
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function UiTargetMethodsEditor({ target, onChange, testId, readOnly }) {
|
|
530
|
+
const tr = useTr();
|
|
531
|
+
if (pinnedElementKey(target)) return /* @__PURE__ */ jsx("p", {
|
|
532
|
+
className: "text-[11px] text-muted-foreground",
|
|
533
|
+
"data-testid": testId,
|
|
534
|
+
children: tr("fluidgrids.builder.uiScript.target.pinnedTechnical", "This step uses an Element library element at a pinned version. Its methods are edited in the Element library; workflows keep the version they pinned.")
|
|
535
|
+
});
|
|
536
|
+
const base = isRecord(target) ? target : {};
|
|
537
|
+
const methods = targetMethods(base);
|
|
538
|
+
const write = (next) => onChange({
|
|
539
|
+
...base,
|
|
540
|
+
methods: next
|
|
541
|
+
});
|
|
542
|
+
const move = (index, delta) => {
|
|
543
|
+
const to = index + delta;
|
|
544
|
+
if (to < 0 || to >= methods.length) return;
|
|
545
|
+
const next = methods.slice();
|
|
546
|
+
const [moved] = next.splice(index, 1);
|
|
547
|
+
if (moved) next.splice(to, 0, moved);
|
|
548
|
+
write(next);
|
|
549
|
+
};
|
|
550
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
551
|
+
className: "flex flex-col gap-1.5",
|
|
552
|
+
"data-testid": testId,
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsx("span", {
|
|
555
|
+
className: "text-[11px] text-muted-foreground",
|
|
556
|
+
children: tr("fluidgrids.builder.uiScript.target.methodsHint", "How the element is found, tried in this order: the first method that finds exactly one visible element wins. More than one match is never accepted.")
|
|
557
|
+
}),
|
|
558
|
+
methods.map((method, index) => /* @__PURE__ */ jsxs("div", {
|
|
559
|
+
className: "flex flex-col gap-1 rounded border border-border p-1.5",
|
|
560
|
+
"data-testid": `${testId}-method-${index}`,
|
|
561
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
562
|
+
className: "flex items-center gap-1",
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ jsxs("span", {
|
|
565
|
+
className: uiSmallLabel,
|
|
566
|
+
children: [index + 1, "."]
|
|
567
|
+
}),
|
|
568
|
+
/* @__PURE__ */ jsx(ThemedSelect, {
|
|
569
|
+
value: method.kind,
|
|
570
|
+
disabled: readOnly,
|
|
571
|
+
"aria-label": tr("fluidgrids.builder.uiScript.method.kind", "Method"),
|
|
572
|
+
onChange: (event) => {
|
|
573
|
+
const next = methods.slice();
|
|
574
|
+
next[index] = {
|
|
575
|
+
...newMethod(event.target.value),
|
|
576
|
+
...method.enabled === false ? { enabled: false } : {}
|
|
577
|
+
};
|
|
578
|
+
write(next);
|
|
579
|
+
},
|
|
580
|
+
className: cn(uiInputClass, "min-w-0 flex-1"),
|
|
581
|
+
"data-testid": `${testId}-method-${index}-kind`,
|
|
582
|
+
children: METHOD_KINDS.map((kind) => /* @__PURE__ */ jsx("option", {
|
|
583
|
+
value: kind.kind,
|
|
584
|
+
children: tr(kind.key, kind.fallback)
|
|
585
|
+
}, kind.kind))
|
|
586
|
+
}),
|
|
587
|
+
/* @__PURE__ */ jsxs("label", {
|
|
588
|
+
className: "flex items-center gap-1 text-[11px]",
|
|
589
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
590
|
+
type: "checkbox",
|
|
591
|
+
checked: method.enabled !== false,
|
|
592
|
+
disabled: readOnly,
|
|
593
|
+
onChange: (event) => {
|
|
594
|
+
const next = methods.slice();
|
|
595
|
+
next[index] = withField(method, "enabled", event.target.checked ? void 0 : false);
|
|
596
|
+
write(next);
|
|
597
|
+
},
|
|
598
|
+
"data-testid": `${testId}-method-${index}-enabled`
|
|
599
|
+
}), tr("fluidgrids.builder.uiScript.method.enabled", "On")]
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ jsx("button", {
|
|
602
|
+
type: "button",
|
|
603
|
+
disabled: readOnly || index === 0,
|
|
604
|
+
onClick: () => move(index, -1),
|
|
605
|
+
"aria-label": tr("fluidgrids.builder.uiScript.method.up", "Try this method earlier"),
|
|
606
|
+
className: uiIconButton,
|
|
607
|
+
"data-testid": `${testId}-method-${index}-up`,
|
|
608
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-3.5" })
|
|
609
|
+
}),
|
|
610
|
+
/* @__PURE__ */ jsx("button", {
|
|
611
|
+
type: "button",
|
|
612
|
+
disabled: readOnly || index === methods.length - 1,
|
|
613
|
+
onClick: () => move(index, 1),
|
|
614
|
+
"aria-label": tr("fluidgrids.builder.uiScript.method.down", "Try this method later"),
|
|
615
|
+
className: uiIconButton,
|
|
616
|
+
"data-testid": `${testId}-method-${index}-down`,
|
|
617
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5" })
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ jsx("button", {
|
|
620
|
+
type: "button",
|
|
621
|
+
disabled: readOnly,
|
|
622
|
+
onClick: () => write(methods.filter((_, i) => i !== index)),
|
|
623
|
+
"aria-label": tr("fluidgrids.builder.uiScript.method.remove", "Remove this method"),
|
|
624
|
+
className: uiIconButton,
|
|
625
|
+
"data-testid": `${testId}-method-${index}-remove`,
|
|
626
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
627
|
+
})
|
|
628
|
+
]
|
|
629
|
+
}), /* @__PURE__ */ jsx(MethodFields, {
|
|
630
|
+
method,
|
|
631
|
+
onChange: (next) => {
|
|
632
|
+
const list = methods.slice();
|
|
633
|
+
list[index] = next;
|
|
634
|
+
write(list);
|
|
635
|
+
},
|
|
636
|
+
testId: `${testId}-method-${index}`,
|
|
637
|
+
readOnly
|
|
638
|
+
})]
|
|
639
|
+
}, `${index}-${method.kind}`)),
|
|
640
|
+
/* @__PURE__ */ jsxs("button", {
|
|
641
|
+
type: "button",
|
|
642
|
+
disabled: readOnly || methods.length >= 8,
|
|
643
|
+
onClick: () => write([...methods, newMethod("role")]),
|
|
644
|
+
className: uiLinkButton,
|
|
645
|
+
"data-testid": `${testId}-method-add`,
|
|
646
|
+
children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), tr("fluidgrids.builder.uiScript.method.add", "Add a method")]
|
|
647
|
+
}),
|
|
648
|
+
/* @__PURE__ */ jsxs("label", {
|
|
649
|
+
className: "flex flex-col gap-0.5",
|
|
650
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
651
|
+
className: uiSmallLabel,
|
|
652
|
+
children: tr("fluidgrids.builder.uiScript.target.frame", "Inside frames or shadow roots (CSS selectors, outermost first, separated by >>)")
|
|
653
|
+
}), /* @__PURE__ */ jsx(FrameInput, {
|
|
654
|
+
initial: frameText(base),
|
|
655
|
+
readOnly,
|
|
656
|
+
onCommit: (text) => {
|
|
657
|
+
const parts = text.split(">>").map((part) => part.trim()).filter(Boolean);
|
|
658
|
+
const next = {
|
|
659
|
+
...base,
|
|
660
|
+
methods
|
|
661
|
+
};
|
|
662
|
+
if (parts.length > 0) next.frame = parts;
|
|
663
|
+
else delete next.frame;
|
|
664
|
+
onChange(next);
|
|
665
|
+
},
|
|
666
|
+
testId: `${testId}-frame`
|
|
667
|
+
}, frameText(base))]
|
|
668
|
+
})
|
|
669
|
+
]
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export { uiInputClass as a, uiIconButton as i, UiTargetQuickField as n, uiLinkButton as o, BufferedInput as r, uiSmallLabel as s, UiTargetMethodsEditor as t };
|