@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,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
3
|
+
|
|
4
|
+
// src/builder/stores/flow-store-holder.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reading the builder's flow store without loading it (BOFF-16427).
|
|
7
|
+
*
|
|
8
|
+
* The flow store (`flow-store.ts`) is part of the builder: it imports
|
|
9
|
+
* `@xyflow/react` for its canvas reducers. Pages that draw no canvas (the
|
|
10
|
+
* workflow list, settings, the runs quota meter) only ask "is a workflow open
|
|
11
|
+
* in the builder, and which?". Importing the store for that put the canvas
|
|
12
|
+
* package into every one of those pages' first load.
|
|
13
|
+
*
|
|
14
|
+
* The store hands itself to this holder when its module loads (the builder
|
|
15
|
+
* loads it). Until then no workflow is open in a builder on this page, so a
|
|
16
|
+
* reader gets its fallback, and an action on the store has nothing to act on.
|
|
17
|
+
*/
|
|
18
|
+
let loaded = null;
|
|
19
|
+
const onProvide = /* @__PURE__ */ new Set();
|
|
20
|
+
/** Called once by the flow store module when it loads. */
|
|
21
|
+
function provideFlowStore(store) {
|
|
22
|
+
loaded = store;
|
|
23
|
+
for (const listener of [...onProvide]) listener();
|
|
24
|
+
}
|
|
25
|
+
/** The flow store if the builder has loaded it, else null. */
|
|
26
|
+
function loadedFlowStore() {
|
|
27
|
+
return loaded;
|
|
28
|
+
}
|
|
29
|
+
function subscribe(listener) {
|
|
30
|
+
let unsubscribeStore = loaded ? loaded.subscribe(listener) : null;
|
|
31
|
+
const attach = () => {
|
|
32
|
+
unsubscribeStore?.();
|
|
33
|
+
unsubscribeStore = loaded ? loaded.subscribe(listener) : null;
|
|
34
|
+
listener();
|
|
35
|
+
};
|
|
36
|
+
onProvide.add(attach);
|
|
37
|
+
return () => {
|
|
38
|
+
onProvide.delete(attach);
|
|
39
|
+
unsubscribeStore?.();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `selector` of the flow store's state once the builder has loaded it, and
|
|
44
|
+
* `fallback` before. The selector should return a primitive or a stable
|
|
45
|
+
* reference, as with zustand's own hook.
|
|
46
|
+
*/
|
|
47
|
+
function useLoadedFlowStore(selector, fallback) {
|
|
48
|
+
const read = useCallback(() => loaded ? selector(loaded.getState()) : fallback, [selector, fallback]);
|
|
49
|
+
return useSyncExternalStore(subscribe, read, () => fallback);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { provideFlowStore as n, useLoadedFlowStore as r, loadedFlowStore as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/icons/bundled/fluent.generated.ts
|
|
3
|
+
const FLUENT_ICONS = {
|
|
4
|
+
"prefix": "fluent",
|
|
5
|
+
"width": 20,
|
|
6
|
+
"height": 20,
|
|
7
|
+
"icons": { "save-28-filled": {
|
|
8
|
+
"body": "<path fill=\"currentColor\" d=\"M8 3H6.25A3.25 3.25 0 0 0 3 6.25v15.5a3.25 3.25 0 0 0 3 3.24v-8.74A2.25 2.25 0 0 1 8.25 14h11.5A2.25 2.25 0 0 1 22 16.25v8.74a3.25 3.25 0 0 0 3-3.24V8.786a3.25 3.25 0 0 0-.952-2.299l-2.535-2.535A3.25 3.25 0 0 0 19.214 3H19v5.75A2.25 2.25 0 0 1 16.75 11h-6.5A2.25 2.25 0 0 1 8 8.75zm9.5 0h-8v5.75c0 .414.336.75.75.75h6.5a.75.75 0 0 0 .75-.75zm3 22v-8.75a.75.75 0 0 0-.75-.75H8.25a.75.75 0 0 0-.75.75V25z\"/>",
|
|
9
|
+
"width": 28,
|
|
10
|
+
"height": 28
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { FLUENT_ICONS };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { i as RUNS_QUOTA_NAME, o as WORKFLOWS_QUOTA_NAME } from "./quota-DeA_CJ2e.js";
|
|
3
|
+
import { t as isNodeTrigger } from "./node-role-TMbnkmeP.js";
|
|
4
|
+
|
|
5
|
+
// src/analytics/fluidgridsEvents.ts
|
|
6
|
+
/** `component` stamped on every event so devtools/OTel can tell the emitter. */
|
|
7
|
+
const FLUIDGRIDS_ANALYTICS_COMPONENT = "fluidgrids-fe-sdk";
|
|
8
|
+
/** Upper bound for a slug-like dimension; anything longer is not a slug. */
|
|
9
|
+
const MAX_DIMENSION_LENGTH = 64;
|
|
10
|
+
const SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_./:-]*$/;
|
|
11
|
+
/**
|
|
12
|
+
* Keep a dimension only when it is a short slug (`integration/slack`,
|
|
13
|
+
* `trigger_webhook`, `marketing`). Anything else — spaces, free text, a very
|
|
14
|
+
* long value — is dropped rather than risk sending user data.
|
|
15
|
+
*/
|
|
16
|
+
function toDimension(value) {
|
|
17
|
+
if (typeof value !== "string") return void 0;
|
|
18
|
+
const trimmed = value.trim();
|
|
19
|
+
if (!trimmed || trimmed.length > MAX_DIMENSION_LENGTH) return void 0;
|
|
20
|
+
return SLUG_PATTERN.test(trimmed) ? trimmed : void 0;
|
|
21
|
+
}
|
|
22
|
+
/** Non-empty string id, or undefined. */
|
|
23
|
+
function idOrUndefined(value) {
|
|
24
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
/** A finite, non-negative integer count, or undefined. */
|
|
27
|
+
function countOrUndefined(value) {
|
|
28
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : void 0;
|
|
29
|
+
}
|
|
30
|
+
function emit(bus, name, payload) {
|
|
31
|
+
if (!bus) return;
|
|
32
|
+
const clean = Object.fromEntries(Object.entries(payload).filter(([, value]) => value !== void 0));
|
|
33
|
+
try {
|
|
34
|
+
bus.emit(name, clean, { component: FLUIDGRIDS_ANALYTICS_COMPONENT });
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.warn(`[fluidgrids analytics] failed to emit ${name}`, error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function asRecord(value) {
|
|
40
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The executable node list of a workflow definition, wherever it sits: the
|
|
44
|
+
* flow store's `{ nodes }`, a saved `definitionJson` (`{ data: { nodes } }`) or
|
|
45
|
+
* a raw list.
|
|
46
|
+
*/
|
|
47
|
+
function nodesOf(definition) {
|
|
48
|
+
if (Array.isArray(definition)) return definition;
|
|
49
|
+
const record = asRecord(definition);
|
|
50
|
+
if (!record) return [];
|
|
51
|
+
if (Array.isArray(record.nodes)) return record.nodes;
|
|
52
|
+
const data = asRecord(record.data);
|
|
53
|
+
if (data && Array.isArray(data.nodes)) return data.nodes;
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Whether a node of a saved definition is a trigger: the builder's own rule
|
|
58
|
+
* ({@link isNodeTrigger}, which knows every built-in trigger type such as
|
|
59
|
+
* `internal:workflow-call` or `internal:record-change`, BOFF-15125), or the
|
|
60
|
+
* looser older markers (a type naming "trigger", `isTrigger`, a trigger
|
|
61
|
+
* category). The agent's run tool picks its trigger node with this too.
|
|
62
|
+
*/
|
|
63
|
+
function isDefinitionTriggerNode(node) {
|
|
64
|
+
const rawType = typeof node.type === "string" ? node.type : void 0;
|
|
65
|
+
if (isNodeTrigger({
|
|
66
|
+
type: rawType,
|
|
67
|
+
data: node.data
|
|
68
|
+
})) return true;
|
|
69
|
+
if ((rawType?.toLowerCase() ?? "").includes("trigger")) return true;
|
|
70
|
+
const data = asRecord(node.data);
|
|
71
|
+
return data?.isTrigger === true || data?.category === "trigger";
|
|
72
|
+
}
|
|
73
|
+
/** Node-type slug of the workflow's trigger node, when it has one. */
|
|
74
|
+
function triggerTypeOf(definition) {
|
|
75
|
+
const trigger = nodesOf(definition).find(isDefinitionTriggerNode);
|
|
76
|
+
return trigger ? toDimension(trigger.type) : void 0;
|
|
77
|
+
}
|
|
78
|
+
/** Number of executable nodes on the canvas. */
|
|
79
|
+
function nodeCountOf(definition) {
|
|
80
|
+
const nodes = nodesOf(definition);
|
|
81
|
+
return nodes.length > 0 ? nodes.length : void 0;
|
|
82
|
+
}
|
|
83
|
+
/** `fluidgrids.workflow.created` — a new workflow exists in the workspace. */
|
|
84
|
+
function emitWorkflowCreated(bus, fact) {
|
|
85
|
+
emit(bus, "fluidgrids.workflow.created", {
|
|
86
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
87
|
+
workflowId: idOrUndefined(fact.workflowId),
|
|
88
|
+
source: fact.source,
|
|
89
|
+
triggerType: triggerTypeOf(fact.definition),
|
|
90
|
+
nodeCount: nodeCountOf(fact.definition)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** `fluidgrids.workflow.published` — a version was activated. */
|
|
94
|
+
function emitWorkflowPublished(bus, fact) {
|
|
95
|
+
emit(bus, "fluidgrids.workflow.published", {
|
|
96
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
97
|
+
workflowId: idOrUndefined(fact.workflowId),
|
|
98
|
+
triggerType: triggerTypeOf(fact.definition),
|
|
99
|
+
nodeCount: nodeCountOf(fact.definition)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** `fluidgrids.workflow.run_started` — the backend accepted a run. */
|
|
103
|
+
function emitRunStarted(bus, fact) {
|
|
104
|
+
emit(bus, "fluidgrids.workflow.run_started", {
|
|
105
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
106
|
+
workflowId: idOrUndefined(fact.workflowId),
|
|
107
|
+
executionId: idOrUndefined(fact.executionId),
|
|
108
|
+
trigger: fact.trigger
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* `fluidgrids.workflow.run_failed` — a run this user started ended FAILED.
|
|
113
|
+
* `errorCode` is the run's machine error classification (`TIMEOUT`,
|
|
114
|
+
* `VALIDATION`, …), never its message.
|
|
115
|
+
*/
|
|
116
|
+
function emitRunFailed(bus, fact) {
|
|
117
|
+
emit(bus, "fluidgrids.workflow.run_failed", {
|
|
118
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
119
|
+
workflowId: idOrUndefined(fact.workflowId),
|
|
120
|
+
executionId: idOrUndefined(fact.executionId),
|
|
121
|
+
trigger: fact.trigger,
|
|
122
|
+
errorCode: toDimension(fact.errorCode),
|
|
123
|
+
durationMs: countOrUndefined(fact.durationMs)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** `fluidgrids.template.used` — a store template became a workflow. */
|
|
127
|
+
function emitTemplateUsed(bus, fact) {
|
|
128
|
+
emit(bus, "fluidgrids.template.used", {
|
|
129
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
130
|
+
templateId: idOrUndefined(fact.templateId),
|
|
131
|
+
category: toDimension(fact.category)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/** `fluidgrids.node.installed` — a store node was installed. */
|
|
135
|
+
function emitNodeInstalled(bus, fact) {
|
|
136
|
+
emit(bus, "fluidgrids.node.installed", {
|
|
137
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
138
|
+
nodeType: toDimension(fact.nodeType),
|
|
139
|
+
source: fact.source
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** `fluidgrids.quota.workflow_limit_hit` — a create was refused at the limit. */
|
|
143
|
+
function emitWorkflowLimitHit(bus, fact) {
|
|
144
|
+
emit(bus, "fluidgrids.quota.workflow_limit_hit", {
|
|
145
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
146
|
+
quotaKey: WORKFLOWS_QUOTA_NAME,
|
|
147
|
+
surface: fact.surface
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/** `fluidgrids.quota.run_limit_hit` — a run was refused at the monthly limit. */
|
|
151
|
+
function emitRunLimitHit(bus, fact) {
|
|
152
|
+
emit(bus, "fluidgrids.quota.run_limit_hit", {
|
|
153
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
154
|
+
quotaKey: toDimension(fact.quotaKey) ?? "fluidgrids.runs.monthly",
|
|
155
|
+
surface: fact.surface
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/** `fluidgrids.billing.upgrade_clicked` — a FluidGrids upgrade CTA was clicked. */
|
|
159
|
+
function emitUpgradeClicked(bus, fact) {
|
|
160
|
+
emit(bus, "fluidgrids.billing.upgrade_clicked", {
|
|
161
|
+
workspaceId: idOrUndefined(fact.workspaceId),
|
|
162
|
+
surface: fact.surface,
|
|
163
|
+
quotaKey: toDimension(fact.quotaKey)
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Map a run's backend mode/trigger to the analytics trigger dimension. The
|
|
168
|
+
* builder's debug paths are always `TEST`; anything else a person started by
|
|
169
|
+
* hand is `manual`.
|
|
170
|
+
*/
|
|
171
|
+
function runTriggerFromMode(mode) {
|
|
172
|
+
return typeof mode === "string" && mode.toUpperCase() === "TEST" ? "test" : "manual";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { emitRunStarted as a, emitWorkflowCreated as c, isDefinitionTriggerNode as d, nodesOf as f, emitRunLimitHit as i, emitWorkflowLimitHit as l, emitNodeInstalled as n, emitTemplateUsed as o, runTriggerFromMode as p, emitRunFailed as r, emitUpgradeClicked as s, FLUIDGRIDS_ANALYTICS_COMPONENT as t, emitWorkflowPublished as u };
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/theme/fluidgridsTheme.ts
|
|
3
|
+
const color = (...cssVariables) => ({
|
|
4
|
+
kind: "color",
|
|
5
|
+
cssVariables
|
|
6
|
+
});
|
|
7
|
+
const length = (...cssVariables) => ({
|
|
8
|
+
kind: "length",
|
|
9
|
+
cssVariables
|
|
10
|
+
});
|
|
11
|
+
const font = (...cssVariables) => ({
|
|
12
|
+
kind: "font",
|
|
13
|
+
cssVariables
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Theme token → the fe-libs semantic CSS variables it sets. This table is the
|
|
17
|
+
* public contract: a token keeps its variables across minor releases.
|
|
18
|
+
*/
|
|
19
|
+
const FLUIDGRIDS_THEME_TOKEN_MAP = {
|
|
20
|
+
"colors.bgCanvas": color("--color-bg-canvas"),
|
|
21
|
+
"colors.bgSurface": color("--color-bg-surface"),
|
|
22
|
+
"colors.bgElevated": color("--color-bg-elevated"),
|
|
23
|
+
"colors.bgSunken": color("--color-bg-sunken"),
|
|
24
|
+
"colors.textPrimary": color("--color-text-primary"),
|
|
25
|
+
"colors.textSecondary": color("--color-text-secondary"),
|
|
26
|
+
"colors.textMuted": color("--color-text-muted"),
|
|
27
|
+
"colors.borderDefault": color("--color-border-default"),
|
|
28
|
+
"colors.borderSubtle": color("--color-border-subtle"),
|
|
29
|
+
"colors.borderStrong": color("--color-border-strong"),
|
|
30
|
+
"colors.primary": color("--color-action-primary-bg", "--color-action-primary-border"),
|
|
31
|
+
"colors.primaryHover": color("--color-action-primary-bgHover"),
|
|
32
|
+
"colors.primaryActive": color("--color-action-primary-bgActive"),
|
|
33
|
+
"colors.primaryText": color("--color-action-primary-text"),
|
|
34
|
+
"colors.success": color("--color-status-success-bg"),
|
|
35
|
+
"colors.warning": color("--color-status-warning-bg"),
|
|
36
|
+
"colors.error": color("--color-status-error-bg"),
|
|
37
|
+
"colors.info": color("--color-status-info-bg"),
|
|
38
|
+
"radius.base": length("--radius"),
|
|
39
|
+
"radius.card": length("--radius-card"),
|
|
40
|
+
"radius.button": length("--radius-button"),
|
|
41
|
+
"radius.input": length("--radius-input"),
|
|
42
|
+
"font.body": font("--font-family-body", "--font-sans"),
|
|
43
|
+
"font.heading": font("--font-family-heading"),
|
|
44
|
+
"font.mono": font("--font-family-mono", "--font-mono")
|
|
45
|
+
};
|
|
46
|
+
const MAX_VALUE_LENGTH = 200;
|
|
47
|
+
const FORBIDDEN_VALUE = /[;{}<>\\!@"`]|\/\*|\*\/|url\s*\(|expression\s*\(|image\s*\(|image-set\s*\(|javascript:|@import/i;
|
|
48
|
+
const HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
49
|
+
const NAMED_COLOR = /^[a-z]{3,30}$/i;
|
|
50
|
+
const COLOR_FUNCTION = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\([a-z0-9#%.,/\s()+-]*\)$/i;
|
|
51
|
+
const CSS_VAR = /^var\(--[a-z0-9-]+\)$/i;
|
|
52
|
+
const LENGTH = /^(?:0|\d*\.?\d+(?:px|rem|em|%|vh|vw|vmin|vmax|ch|ex|pt))$/i;
|
|
53
|
+
const CALC = /^calc\([a-z0-9%.\s()*/+-]*\)$/i;
|
|
54
|
+
const FONT_FAMILY_ITEM = /^(?:[a-z0-9][a-z0-9 _-]*|'[a-z0-9 _-]+')$/i;
|
|
55
|
+
function balancedParentheses(value) {
|
|
56
|
+
let depth = 0;
|
|
57
|
+
for (const char of value) {
|
|
58
|
+
if (char === "(") depth += 1;
|
|
59
|
+
if (char === ")") depth -= 1;
|
|
60
|
+
if (depth < 0) return false;
|
|
61
|
+
}
|
|
62
|
+
return depth === 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Validate one token value. Returns the trimmed value, or null when it is not
|
|
66
|
+
* a plain CSS value of the expected kind.
|
|
67
|
+
*/
|
|
68
|
+
function sanitizeThemeValue(kind, value) {
|
|
69
|
+
if (typeof value !== "string") return null;
|
|
70
|
+
const trimmed = value.trim();
|
|
71
|
+
if (!trimmed || trimmed.length > MAX_VALUE_LENGTH) return null;
|
|
72
|
+
if (FORBIDDEN_VALUE.test(trimmed) || !balancedParentheses(trimmed)) return null;
|
|
73
|
+
if (CSS_VAR.test(trimmed)) return trimmed;
|
|
74
|
+
switch (kind) {
|
|
75
|
+
case "color": return HEX_COLOR.test(trimmed) || NAMED_COLOR.test(trimmed) || COLOR_FUNCTION.test(trimmed) ? trimmed : null;
|
|
76
|
+
case "length": return LENGTH.test(trimmed) || CALC.test(trimmed) ? trimmed : null;
|
|
77
|
+
case "font": {
|
|
78
|
+
const items = trimmed.split(",").map((item) => item.trim());
|
|
79
|
+
return items.every((item) => FONT_FAMILY_ITEM.test(item)) ? items.join(", ") : null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function warnDropped(key, value) {
|
|
84
|
+
console.warn(`[FluidGrids SDK] theme token "${key}" ignored: ${JSON.stringify(value)} is not a plain CSS value.`);
|
|
85
|
+
}
|
|
86
|
+
/** Relative luminance of a hex colour, or null for any other notation. */
|
|
87
|
+
function hexLuminance(value) {
|
|
88
|
+
if (!HEX_COLOR.test(value)) return null;
|
|
89
|
+
let hex = value.slice(1);
|
|
90
|
+
if (hex.length <= 4) hex = hex.split("").map((digit) => digit + digit).join("");
|
|
91
|
+
const [red = 0, green = 0, blue = 0] = [
|
|
92
|
+
0,
|
|
93
|
+
2,
|
|
94
|
+
4
|
|
95
|
+
].map((offset) => {
|
|
96
|
+
const channel = parseInt(hex.slice(offset, offset + 2), 16) / 255;
|
|
97
|
+
return channel <= .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
|
|
98
|
+
});
|
|
99
|
+
return .2126 * red + .7152 * green + .0722 * blue;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The resolved mode of a theme: the shortcut itself, `theme.mode`, or
|
|
103
|
+
* undefined when the theme leaves the mode to the host.
|
|
104
|
+
*/
|
|
105
|
+
function themeMode(theme) {
|
|
106
|
+
if (theme === "light" || theme === "dark") return theme;
|
|
107
|
+
if (theme && typeof theme === "object") return theme.mode === "light" || theme.mode === "dark" ? theme.mode : void 0;
|
|
108
|
+
}
|
|
109
|
+
function groupEntries(theme, group) {
|
|
110
|
+
const values = theme[group];
|
|
111
|
+
if (!values || typeof values !== "object") return [];
|
|
112
|
+
return Object.entries(values);
|
|
113
|
+
}
|
|
114
|
+
function isTokenKey(key) {
|
|
115
|
+
return Object.prototype.hasOwnProperty.call(FLUIDGRIDS_THEME_TOKEN_MAP, key);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Turn a theme into the CSS custom properties it sets. Pure: no DOM access.
|
|
119
|
+
*
|
|
120
|
+
* Values that are not plain CSS values of the token's kind (anything with
|
|
121
|
+
* `;`, `{`, `}`, `url(`, `expression(`, quotes other than single-quoted font
|
|
122
|
+
* names, …) are dropped with a console warning. Unknown keys are dropped the
|
|
123
|
+
* same way. When `colors.primary` is set, the hover / pressed shades and the
|
|
124
|
+
* text colour are derived from it unless they are set explicitly; the text
|
|
125
|
+
* colour is picked for contrast when `primary` is a hex colour.
|
|
126
|
+
*/
|
|
127
|
+
function themeToCssVariables(theme) {
|
|
128
|
+
const variables = {};
|
|
129
|
+
if (!theme || typeof theme !== "object") return variables;
|
|
130
|
+
const colors = {};
|
|
131
|
+
for (const group of [
|
|
132
|
+
"colors",
|
|
133
|
+
"radius",
|
|
134
|
+
"font"
|
|
135
|
+
]) for (const [name, raw] of groupEntries(theme, group)) {
|
|
136
|
+
if (raw === void 0) continue;
|
|
137
|
+
const key = `${group}.${name}`;
|
|
138
|
+
if (!isTokenKey(key)) {
|
|
139
|
+
warnDropped(key, raw);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const mapping = FLUIDGRIDS_THEME_TOKEN_MAP[key];
|
|
143
|
+
const value = sanitizeThemeValue(mapping.kind, raw);
|
|
144
|
+
if (value === null) {
|
|
145
|
+
warnDropped(key, raw);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (group === "colors") colors[name] = value;
|
|
149
|
+
for (const cssVariable of mapping.cssVariables) variables[cssVariable] = value;
|
|
150
|
+
}
|
|
151
|
+
const primary = colors.primary;
|
|
152
|
+
if (primary) {
|
|
153
|
+
if (!colors.primaryHover) variables["--color-action-primary-bgHover"] = `color-mix(in oklab, ${primary} 84%, var(--palette-black))`;
|
|
154
|
+
if (!colors.primaryActive) variables["--color-action-primary-bgActive"] = `color-mix(in oklab, ${primary} 70%, var(--palette-black))`;
|
|
155
|
+
if (!colors.primaryText) {
|
|
156
|
+
const luminance = hexLuminance(primary);
|
|
157
|
+
if (luminance !== null) variables["--color-action-primary-text"] = luminance > .4 ? "var(--palette-black)" : "var(--palette-white)";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return variables;
|
|
161
|
+
}
|
|
162
|
+
const stack = [];
|
|
163
|
+
let nextId = 1;
|
|
164
|
+
let observer = null;
|
|
165
|
+
const hostVariables = /* @__PURE__ */ new Map();
|
|
166
|
+
const appliedVariables = /* @__PURE__ */ new Map();
|
|
167
|
+
let hostMode = null;
|
|
168
|
+
function readHostMode(root) {
|
|
169
|
+
return {
|
|
170
|
+
dataTheme: root.getAttribute("data-theme"),
|
|
171
|
+
dark: root.classList.contains("dark")
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function writeMode(root, mode) {
|
|
175
|
+
if (mode.dataTheme === null) root.removeAttribute("data-theme");
|
|
176
|
+
else if (root.getAttribute("data-theme") !== mode.dataTheme) root.setAttribute("data-theme", mode.dataTheme);
|
|
177
|
+
if (root.classList.contains("dark") !== mode.dark) root.classList.toggle("dark", mode.dark);
|
|
178
|
+
}
|
|
179
|
+
function modeDrifted(root, mode) {
|
|
180
|
+
return root.getAttribute("data-theme") !== mode || root.classList.contains("dark") !== (mode === "dark");
|
|
181
|
+
}
|
|
182
|
+
function restoreVariable(root, name) {
|
|
183
|
+
const previous = hostVariables.get(name) ?? "";
|
|
184
|
+
if (previous) root.style.setProperty(name, previous);
|
|
185
|
+
else root.style.removeProperty(name);
|
|
186
|
+
hostVariables.delete(name);
|
|
187
|
+
appliedVariables.delete(name);
|
|
188
|
+
}
|
|
189
|
+
function forceVariable(root, name, value) {
|
|
190
|
+
root.style.setProperty(name, value);
|
|
191
|
+
appliedVariables.set(name, root.style.getPropertyValue(name));
|
|
192
|
+
}
|
|
193
|
+
/** Re-force the winning theme where something else changed it. */
|
|
194
|
+
function reconcileDrift() {
|
|
195
|
+
const top = stack.at(-1);
|
|
196
|
+
if (!top || typeof document === "undefined") return;
|
|
197
|
+
const root = document.documentElement;
|
|
198
|
+
for (const [name, value] of Object.entries(top.variables)) {
|
|
199
|
+
const current = root.style.getPropertyValue(name);
|
|
200
|
+
if (current !== appliedVariables.get(name)) {
|
|
201
|
+
hostVariables.set(name, current);
|
|
202
|
+
forceVariable(root, name, value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (top.mode && modeDrifted(root, top.mode)) {
|
|
206
|
+
hostMode = readHostMode(root);
|
|
207
|
+
writeMode(root, {
|
|
208
|
+
dataTheme: top.mode,
|
|
209
|
+
dark: top.mode === "dark"
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/** Make the document match the top of the stack. */
|
|
214
|
+
function sync() {
|
|
215
|
+
if (typeof document === "undefined") return;
|
|
216
|
+
const root = document.documentElement;
|
|
217
|
+
const top = stack.at(-1);
|
|
218
|
+
const wanted = top?.variables ?? {};
|
|
219
|
+
for (const name of [...appliedVariables.keys()]) if (!(name in wanted)) restoreVariable(root, name);
|
|
220
|
+
for (const [name, value] of Object.entries(wanted)) {
|
|
221
|
+
if (!hostVariables.has(name)) hostVariables.set(name, root.style.getPropertyValue(name));
|
|
222
|
+
if (appliedVariables.get(name) !== value) forceVariable(root, name, value);
|
|
223
|
+
}
|
|
224
|
+
if (top?.mode) {
|
|
225
|
+
if (!hostMode) hostMode = readHostMode(root);
|
|
226
|
+
writeMode(root, {
|
|
227
|
+
dataTheme: top.mode,
|
|
228
|
+
dark: top.mode === "dark"
|
|
229
|
+
});
|
|
230
|
+
} else if (hostMode) {
|
|
231
|
+
writeMode(root, hostMode);
|
|
232
|
+
hostMode = null;
|
|
233
|
+
}
|
|
234
|
+
if (!top) {
|
|
235
|
+
observer?.disconnect();
|
|
236
|
+
observer = null;
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!observer && typeof MutationObserver !== "undefined") {
|
|
240
|
+
observer = new MutationObserver(reconcileDrift);
|
|
241
|
+
observer.observe(root, {
|
|
242
|
+
attributes: true,
|
|
243
|
+
attributeFilter: [
|
|
244
|
+
"style",
|
|
245
|
+
"data-theme",
|
|
246
|
+
"class"
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Apply a theme to the document and return a function that removes it again.
|
|
253
|
+
*
|
|
254
|
+
* Sets each variable from {@link themeToCssVariables} as an inline custom
|
|
255
|
+
* property on `document.documentElement`, and for a mode sets `data-theme`
|
|
256
|
+
* and the `.dark` class. While applied, the values are re-forced if something
|
|
257
|
+
* else (a host ThemeProvider) rewrites them. Disposing restores the inline
|
|
258
|
+
* values and mode the document had (including any change the host made in
|
|
259
|
+
* between). When several themes are applied, the most recent one wins.
|
|
260
|
+
* Calling the returned function more than once is safe. Without a DOM
|
|
261
|
+
* (server rendering) it does nothing.
|
|
262
|
+
*/
|
|
263
|
+
function applyFluidGridsTheme(theme) {
|
|
264
|
+
if (typeof document === "undefined") return () => void 0;
|
|
265
|
+
const entry = {
|
|
266
|
+
id: nextId++,
|
|
267
|
+
variables: themeToCssVariables(theme),
|
|
268
|
+
mode: themeMode(theme)
|
|
269
|
+
};
|
|
270
|
+
stack.push(entry);
|
|
271
|
+
sync();
|
|
272
|
+
let disposed = false;
|
|
273
|
+
return () => {
|
|
274
|
+
if (disposed) return;
|
|
275
|
+
disposed = true;
|
|
276
|
+
const index = stack.findIndex((active) => active.id === entry.id);
|
|
277
|
+
if (index >= 0) stack.splice(index, 1);
|
|
278
|
+
sync();
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Stable key for a theme value, so callers can tell two theme objects with the
|
|
283
|
+
* same content apart from a real change (hosts often pass inline objects).
|
|
284
|
+
*/
|
|
285
|
+
function themeKey(theme) {
|
|
286
|
+
if (!theme) return "";
|
|
287
|
+
if (typeof theme === "string") return theme;
|
|
288
|
+
const sortedGroup = (group) => groupEntries(theme, group).filter(([, value]) => value !== void 0).sort(([a], [b]) => a.localeCompare(b));
|
|
289
|
+
return JSON.stringify([
|
|
290
|
+
theme.mode ?? null,
|
|
291
|
+
sortedGroup("colors"),
|
|
292
|
+
sortedGroup("radius"),
|
|
293
|
+
sortedGroup("font")
|
|
294
|
+
]);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export { themeToCssVariables as a, themeKey as i, applyFluidGridsTheme as n, sanitizeThemeValue as r, FLUIDGRIDS_THEME_TOKEN_MAP as t };
|