@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8
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,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/utils/relative-time.ts
|
|
3
|
+
/** The page's language (the app sets it), else undefined for the browser's. */
|
|
4
|
+
function pageLocale() {
|
|
5
|
+
if (typeof document === "undefined") return void 0;
|
|
6
|
+
return document.documentElement.lang || void 0;
|
|
7
|
+
}
|
|
8
|
+
/** One relative-time formatter per page language, built once (not per row). */
|
|
9
|
+
const relativeFormats = /* @__PURE__ */ new Map();
|
|
10
|
+
function relativeFormat(locale) {
|
|
11
|
+
const cacheKey = locale ?? "";
|
|
12
|
+
let format = relativeFormats.get(cacheKey);
|
|
13
|
+
if (!format) {
|
|
14
|
+
format = new Intl.RelativeTimeFormat(locale, {
|
|
15
|
+
numeric: "always",
|
|
16
|
+
style: "narrow"
|
|
17
|
+
});
|
|
18
|
+
relativeFormats.set(cacheKey, format);
|
|
19
|
+
}
|
|
20
|
+
return format;
|
|
21
|
+
}
|
|
22
|
+
const MINUTE = 6e4;
|
|
23
|
+
const HOUR = 60 * MINUTE;
|
|
24
|
+
const DAY = 24 * HOUR;
|
|
25
|
+
const WEEK = 7 * DAY;
|
|
26
|
+
/**
|
|
27
|
+
* A compact "when" for a timestamp: "just now", then minutes, hours and days
|
|
28
|
+
* ago in the page's language, then a short date (with the year) beyond a week.
|
|
29
|
+
* An empty or unreadable timestamp is an em dash.
|
|
30
|
+
*/
|
|
31
|
+
function formatRelativeTime(tr, iso, now = Date.now(), locale = pageLocale()) {
|
|
32
|
+
if (!iso) return "—";
|
|
33
|
+
const then = new Date(iso).getTime();
|
|
34
|
+
if (Number.isNaN(then)) return "—";
|
|
35
|
+
const diff = now - then;
|
|
36
|
+
if (diff < MINUTE) return tr("fluidgrids.builder.cardWorkflow.justNow", "just now");
|
|
37
|
+
const relative = relativeFormat(locale);
|
|
38
|
+
if (diff < HOUR) return relative.format(-Math.floor(diff / MINUTE), "minute");
|
|
39
|
+
if (diff < DAY) return relative.format(-Math.floor(diff / HOUR), "hour");
|
|
40
|
+
if (diff < WEEK) return relative.format(-Math.floor(diff / DAY), "day");
|
|
41
|
+
return new Intl.DateTimeFormat(locale, {
|
|
42
|
+
month: "short",
|
|
43
|
+
day: "numeric",
|
|
44
|
+
year: "numeric"
|
|
45
|
+
}).format(new Date(then));
|
|
46
|
+
}
|
|
47
|
+
/** The full local date and time of a timestamp, for a tooltip. */
|
|
48
|
+
function formatExactTime(iso, locale = pageLocale()) {
|
|
49
|
+
if (!iso) return void 0;
|
|
50
|
+
const date = new Date(iso);
|
|
51
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
52
|
+
return date.toLocaleString(locale);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { relativeFormat as i, formatRelativeTime as n, pageLocale as r, formatExactTime as t };
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./cn-QqidFIgr.js";
|
|
3
|
+
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
4
|
+
import { t as describeOperationError } from "./errors-ClKb5sEt.js";
|
|
5
|
+
import { r as pageLocale } from "./relative-time-Dxt8ZIIu.js";
|
|
6
|
+
import { n as LIST_BOX } from "./styles-WGmTnZ2n.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AlertCircle, Lock, Search } from "lucide-react";
|
|
9
|
+
import { EmptyState, GALLERY_PAGE_SIZE, GalleryPager, GalleryPanel, ShowTechnicalDetails, Skeleton, clampPage, pageRange, totalPagesFor, useGlassEmptyStates } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
import { Button as Button$1 } from "@burdenoff/fe-libs/button";
|
|
11
|
+
|
|
12
|
+
// src/components/moreTools/paging.ts
|
|
13
|
+
/**
|
|
14
|
+
* Paging maths for the More tools lists (BOFF-15502). Every list uses the
|
|
15
|
+
* Templates pager: 20 per page, "Showing 21–40 of N", the page in the
|
|
16
|
+
* address and clamped. The rules themselves are fe-libs' (`gallery-paging`);
|
|
17
|
+
* this adds the slice for lists the service does not page yet, so a list
|
|
18
|
+
* moves to server paging by swapping its source, not its page.
|
|
19
|
+
*/
|
|
20
|
+
/** Results per page on every More tools list (the Templates pager's size). */
|
|
21
|
+
const MORE_TOOLS_PAGE_SIZE = GALLERY_PAGE_SIZE;
|
|
22
|
+
/**
|
|
23
|
+
* One page of a list held in memory. A page past the end shows the last
|
|
24
|
+
* page; a page below 1 shows the first.
|
|
25
|
+
*/
|
|
26
|
+
function pageSlice(list, requestedPage, pageSize = MORE_TOOLS_PAGE_SIZE) {
|
|
27
|
+
const total = list.length;
|
|
28
|
+
const totalPages = totalPagesFor(total, pageSize);
|
|
29
|
+
const page = clampPage(requestedPage, totalPages);
|
|
30
|
+
const { start, end } = pageRange(page, pageSize, total);
|
|
31
|
+
return {
|
|
32
|
+
items: list.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
33
|
+
page,
|
|
34
|
+
totalPages,
|
|
35
|
+
total,
|
|
36
|
+
start,
|
|
37
|
+
end
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The offset/limit a server-paged list asks for, for a 1-based page. */
|
|
41
|
+
function serverWindow(page, pageSize = MORE_TOOLS_PAGE_SIZE) {
|
|
42
|
+
return {
|
|
43
|
+
offset: (Math.max(1, Math.floor(page)) - 1) * pageSize,
|
|
44
|
+
limit: pageSize
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Counts of a list by a key, for status chips ("Online 3"); 0 is left out. */
|
|
48
|
+
function countBy(list, keyOf) {
|
|
49
|
+
const counts = {};
|
|
50
|
+
for (const item of list) {
|
|
51
|
+
const key = keyOf(item);
|
|
52
|
+
counts[key] = (counts[key] ?? 0) + 1;
|
|
53
|
+
}
|
|
54
|
+
return counts;
|
|
55
|
+
}
|
|
56
|
+
/** Case- and accent-insensitive "contains", for searching names in memory. */
|
|
57
|
+
function matchesSearch(query, ...fields) {
|
|
58
|
+
const needle = normalise(query.trim());
|
|
59
|
+
if (!needle) return true;
|
|
60
|
+
return fields.some((field) => !!field && normalise(field).includes(needle));
|
|
61
|
+
}
|
|
62
|
+
function normalise(text) {
|
|
63
|
+
return text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/components/moreTools/format.ts
|
|
67
|
+
/**
|
|
68
|
+
* Numbers and times as the More tools pages show them (BOFF-15502): in the
|
|
69
|
+
* page's language, with thousands separators ("1,240 rows", never "1240").
|
|
70
|
+
*/
|
|
71
|
+
const countFormats = /* @__PURE__ */ new Map();
|
|
72
|
+
/** A whole number with the page language's grouping: 1,240. */
|
|
73
|
+
function formatCount(value, locale = pageLocale()) {
|
|
74
|
+
const key = locale ?? "";
|
|
75
|
+
let format = countFormats.get(key);
|
|
76
|
+
if (!format) {
|
|
77
|
+
format = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });
|
|
78
|
+
countFormats.set(key, format);
|
|
79
|
+
}
|
|
80
|
+
return format.format(value);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A short date and time in the page's language: "Nov 18, 14:05", with the
|
|
84
|
+
* year when it is not this year ("Nov 18, 2025, 14:05").
|
|
85
|
+
*/
|
|
86
|
+
function formatShortDateTime(iso, locale = pageLocale(), now = /* @__PURE__ */ new Date()) {
|
|
87
|
+
if (!iso) return "—";
|
|
88
|
+
const date = new Date(iso);
|
|
89
|
+
if (Number.isNaN(date.getTime())) return "—";
|
|
90
|
+
return new Intl.DateTimeFormat(locale, {
|
|
91
|
+
month: "short",
|
|
92
|
+
day: "numeric",
|
|
93
|
+
...date.getFullYear() === now.getFullYear() ? {} : { year: "numeric" },
|
|
94
|
+
hour: "2-digit",
|
|
95
|
+
minute: "2-digit"
|
|
96
|
+
}).format(date);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/components/moreTools/results.tsx
|
|
100
|
+
/** The pager's words, translated; each a literal key the extractor finds. */
|
|
101
|
+
function usePagerLabels() {
|
|
102
|
+
const tr = useTr();
|
|
103
|
+
return {
|
|
104
|
+
pagesNav: tr("fluidgrids.moreTools.common.pager.pages", "Pages"),
|
|
105
|
+
previous: tr("fluidgrids.moreTools.common.pager.previous", "Previous"),
|
|
106
|
+
next: tr("fluidgrids.moreTools.common.pager.next", "Next"),
|
|
107
|
+
previousPage: tr("fluidgrids.moreTools.common.pager.previousPage", "Previous page"),
|
|
108
|
+
nextPage: tr("fluidgrids.moreTools.common.pager.nextPage", "Next page"),
|
|
109
|
+
showing: (start, end, total) => tr("fluidgrids.moreTools.common.pager.showing", "Showing {{start}}–{{end}} of {{total}}", {
|
|
110
|
+
start: formatCount(start),
|
|
111
|
+
end: formatCount(end),
|
|
112
|
+
total: formatCount(total)
|
|
113
|
+
}),
|
|
114
|
+
pageAria: (page) => tr("fluidgrids.moreTools.common.pager.pageAria", "Page {{page}}", { page }),
|
|
115
|
+
pageOf: (page, pages) => tr("fluidgrids.moreTools.common.pager.pageOf", "Page {{page}} of {{pages}}", {
|
|
116
|
+
page,
|
|
117
|
+
pages
|
|
118
|
+
})
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function ResultsHeading({ title, page, total, showRange, headingRef, extra, pageSize = MORE_TOOLS_PAGE_SIZE }) {
|
|
122
|
+
const labels = usePagerLabels();
|
|
123
|
+
const { start, end } = pageRange(page, pageSize, total);
|
|
124
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
className: "mb-2.5 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1",
|
|
126
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "flex min-w-0 items-baseline gap-3",
|
|
128
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
129
|
+
ref: headingRef,
|
|
130
|
+
tabIndex: -1,
|
|
131
|
+
className: "text-[15px] font-semibold text-text-primary outline-none",
|
|
132
|
+
"data-testid": "more-tools-results-heading",
|
|
133
|
+
children: title
|
|
134
|
+
}), extra]
|
|
135
|
+
}), showRange && total > 0 && /* @__PURE__ */ jsx("span", {
|
|
136
|
+
className: "text-[13px] tabular-nums text-text-muted max-sm:text-xs",
|
|
137
|
+
"data-testid": "more-tools-range",
|
|
138
|
+
children: labels.showing(start, end, total)
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** While the next page loads, the previous page stays, dimmed, under a thin bar. */
|
|
143
|
+
function PagedBody({ pageLoading, page, busy, children }) {
|
|
144
|
+
const tr = useTr();
|
|
145
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
146
|
+
className: "relative",
|
|
147
|
+
children: [pageLoading && /* @__PURE__ */ jsx("div", {
|
|
148
|
+
role: "progressbar",
|
|
149
|
+
"aria-label": tr("fluidgrids.moreTools.common.pager.loadingPage", "Loading page {{page}}", { page }),
|
|
150
|
+
className: "absolute inset-x-0 -top-2 h-[3px] overflow-hidden rounded bg-border-subtle",
|
|
151
|
+
"data-testid": "more-tools-page-progress",
|
|
152
|
+
children: /* @__PURE__ */ jsx("span", { className: "absolute start-0 top-0 h-[3px] w-1/3 rounded bg-accent-glow" })
|
|
153
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
154
|
+
"aria-busy": busy || pageLoading || void 0,
|
|
155
|
+
className: cn("transition-opacity motion-reduce:transition-none", pageLoading && "opacity-55"),
|
|
156
|
+
children
|
|
157
|
+
})]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/** The Templates pager, with the "Showing …" line announced to screen readers. */
|
|
161
|
+
function ResultsPager({ page, total, onPage, pageSize = MORE_TOOLS_PAGE_SIZE, className }) {
|
|
162
|
+
const labels = usePagerLabels();
|
|
163
|
+
const totalPages = totalPagesFor(total, pageSize);
|
|
164
|
+
const { start, end } = pageRange(page, pageSize, total);
|
|
165
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [totalPages > 1 && /* @__PURE__ */ jsx(GalleryPager, {
|
|
166
|
+
page,
|
|
167
|
+
totalPages,
|
|
168
|
+
total,
|
|
169
|
+
pageSize,
|
|
170
|
+
onPage,
|
|
171
|
+
labels,
|
|
172
|
+
className
|
|
173
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
174
|
+
className: "sr-only",
|
|
175
|
+
"aria-live": "polite",
|
|
176
|
+
children: total > 0 ? labels.showing(start, end, total) : ""
|
|
177
|
+
})] });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* A panel shown in place of results. FluidGrids draws it as fe-libs' glass
|
|
181
|
+
* `EmptyState`, with its situation (`kind`), subject and size
|
|
182
|
+
* (`AppShellConfig.glassEmptyStates`, BOFF-15564); without the opt-in it is
|
|
183
|
+
* the dashed gallery panel the Templates gallery and these pages have always
|
|
184
|
+
* shown.
|
|
185
|
+
*/
|
|
186
|
+
function StatePanel({ kind, title, text, icon, illustration, size = "page", role, children }) {
|
|
187
|
+
if (!useGlassEmptyStates()) return /* @__PURE__ */ jsx(GalleryPanel, {
|
|
188
|
+
icon,
|
|
189
|
+
title,
|
|
190
|
+
text,
|
|
191
|
+
role,
|
|
192
|
+
children
|
|
193
|
+
});
|
|
194
|
+
const state = /* @__PURE__ */ jsx(EmptyState, {
|
|
195
|
+
kind,
|
|
196
|
+
illustration,
|
|
197
|
+
size,
|
|
198
|
+
icon,
|
|
199
|
+
title,
|
|
200
|
+
description: text,
|
|
201
|
+
action: children
|
|
202
|
+
});
|
|
203
|
+
return role ? /* @__PURE__ */ jsx("div", {
|
|
204
|
+
role,
|
|
205
|
+
children: state
|
|
206
|
+
}) : state;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A list could not load: said in plain words, with Try again. The server's
|
|
210
|
+
* raw text stays one click away under "Show technical details". In glass it
|
|
211
|
+
* is the `error` empty state; otherwise a red panel (shorter at `panel` size).
|
|
212
|
+
*/
|
|
213
|
+
function LoadErrorPanel({ title, text, error, onRetry, className, size = "page" }) {
|
|
214
|
+
const tr = useTr();
|
|
215
|
+
const glass = useGlassEmptyStates();
|
|
216
|
+
const icon = /* @__PURE__ */ jsx(AlertCircle, {
|
|
217
|
+
className: "size-5 text-status-error-text",
|
|
218
|
+
"aria-hidden": "true"
|
|
219
|
+
});
|
|
220
|
+
const actions = /* @__PURE__ */ jsxs("div", {
|
|
221
|
+
className: "flex flex-col items-center gap-2",
|
|
222
|
+
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
223
|
+
variant: "outline",
|
|
224
|
+
onClick: onRetry,
|
|
225
|
+
"data-testid": "more-tools-retry",
|
|
226
|
+
children: tr("fluidgrids.moreTools.common.tryAgain", "Try again")
|
|
227
|
+
}), /* @__PURE__ */ jsx(ShowTechnicalDetails, {
|
|
228
|
+
copyable: true,
|
|
229
|
+
children: describeOperationError(error)
|
|
230
|
+
})]
|
|
231
|
+
});
|
|
232
|
+
if (glass) return /* @__PURE__ */ jsx("div", {
|
|
233
|
+
role: "alert",
|
|
234
|
+
className,
|
|
235
|
+
"data-testid": "more-tools-load-error",
|
|
236
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
237
|
+
kind: "error",
|
|
238
|
+
size,
|
|
239
|
+
icon,
|
|
240
|
+
title,
|
|
241
|
+
description: text,
|
|
242
|
+
action: actions
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
role: "alert",
|
|
247
|
+
className: cn("flex flex-col items-center gap-2.5 rounded-xl border border-status-error-border bg-status-error-bg-subtle px-4 text-center", size === "panel" ? "py-6" : "py-10", className),
|
|
248
|
+
"data-testid": "more-tools-load-error",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx("span", {
|
|
251
|
+
className: "flex size-12 items-center justify-center rounded-[14px] border border-status-error-border bg-bg-elevated",
|
|
252
|
+
children: icon
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ jsx("h3", {
|
|
255
|
+
className: "text-base font-semibold text-status-error-text",
|
|
256
|
+
children: title
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx("p", {
|
|
259
|
+
className: "max-w-[30rem] text-sm text-text-secondary",
|
|
260
|
+
children: text
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ jsx("div", {
|
|
263
|
+
className: "mt-1.5",
|
|
264
|
+
children: actions
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
/** Nothing matched: a search (`no-results`, the default) or the filters. */
|
|
270
|
+
function NoResultsPanel({ kind = "no-results", ...props }) {
|
|
271
|
+
return /* @__PURE__ */ jsx(StatePanel, {
|
|
272
|
+
...props,
|
|
273
|
+
kind,
|
|
274
|
+
icon: /* @__PURE__ */ jsx(Search, {
|
|
275
|
+
className: "size-5 text-text-secondary",
|
|
276
|
+
"aria-hidden": "true"
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Nothing exists yet: what the page is for, and the way to start. The same
|
|
282
|
+
* frame says a thing is gone (`not-found`) or that nothing needs doing
|
|
283
|
+
* (`all-done`).
|
|
284
|
+
*/
|
|
285
|
+
function EmptyPanel({ kind = "first-use", ...props }) {
|
|
286
|
+
return /* @__PURE__ */ jsx(StatePanel, {
|
|
287
|
+
...props,
|
|
288
|
+
kind
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/** The person's role cannot open this part: say who can give access. */
|
|
292
|
+
function NoAccessPanel(props) {
|
|
293
|
+
return /* @__PURE__ */ jsx(StatePanel, {
|
|
294
|
+
...props,
|
|
295
|
+
kind: "no-access",
|
|
296
|
+
icon: /* @__PURE__ */ jsx(Lock, {
|
|
297
|
+
className: "size-5 text-text-secondary",
|
|
298
|
+
"aria-hidden": "true"
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/** Placeholder rows shaped like the list, while it loads. */
|
|
303
|
+
function ListSkeleton({ rows = 6 }) {
|
|
304
|
+
const tr = useTr();
|
|
305
|
+
return /* @__PURE__ */ jsx("div", {
|
|
306
|
+
className: cn(LIST_BOX, "divide-y divide-border-subtle"),
|
|
307
|
+
"aria-busy": "true",
|
|
308
|
+
"aria-label": tr("fluidgrids.moreTools.common.loading", "Loading…"),
|
|
309
|
+
"data-testid": "more-tools-skeleton",
|
|
310
|
+
children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("div", {
|
|
311
|
+
className: "flex items-center gap-3 px-4 py-3",
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "size-8 rounded-lg" }),
|
|
314
|
+
/* @__PURE__ */ jsxs("div", {
|
|
315
|
+
className: "grid min-w-0 flex-1 gap-1.5",
|
|
316
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-1/2 rounded" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-1/3 rounded" })]
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-20 rounded max-sm:hidden" }),
|
|
319
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16 rounded max-sm:hidden" })
|
|
320
|
+
]
|
|
321
|
+
}, index))
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export { NoResultsPanel as a, ResultsPager as c, formatShortDateTime as d, MORE_TOOLS_PAGE_SIZE as f, serverWindow as g, pageSlice as h, NoAccessPanel as i, StatePanel as l, matchesSearch as m, ListSkeleton as n, PagedBody as o, countBy as p, LoadErrorPanel as r, ResultsHeading as s, EmptyPanel as t, formatCount as u };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __exportAll = (all, flags) => {
|
|
5
|
+
let target = Object.setPrototypeOf({}, null);
|
|
6
|
+
for (var name in all) {
|
|
7
|
+
__defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (!(flags & 1)) {
|
|
13
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
}
|
|
15
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as FluidGridsFlagContext } from "./index-ROZzNGyY.js";
|
|
3
|
+
import { n as isPageDataRoute, r as pageDataRouteOf, t as PageDataRoute } from "./route-match-C-0_EnAt.js";
|
|
4
|
+
export interface RouteDataFlags {
|
|
5
|
+
settled: boolean;
|
|
6
|
+
withCounts: boolean;
|
|
7
|
+
withSearchAttributes: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function routeDataFlagsOf(context: FluidGridsFlagContext | null): RouteDataFlags;
|
|
10
|
+
export declare function preloadRouteData(route: PageDataRoute | string, flags: RouteDataFlags): Promise<boolean>;
|
|
11
|
+
export declare function useRouteDataPreload(): (route: PageDataRoute | string) => Promise<boolean>;
|
|
12
|
+
export { type PageDataRoute, isPageDataRoute, pageDataRouteOf };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as resolveDurableParity, o as resolveFluidGridsFlagsSettled, s as resolvePhaseCFlags } from "./feature-flags-B2qetXKd.js";
|
|
3
|
+
import { n as pageDataRouteOf, t as isPageDataRoute } from "./route-match-DMkUICYV.js";
|
|
4
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
5
|
+
import { useOptionalFeatureFlags } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
|
|
7
|
+
// src/route-data.ts
|
|
8
|
+
/**
|
|
9
|
+
* Route data subpath export (BOFF-16690): what a host needs to start a list
|
|
10
|
+
* page's data on navigation intent, without the SDK's root barrel.
|
|
11
|
+
*
|
|
12
|
+
* `preloadRoutePageData` (the root export, BOFF-17172) sends a list page's
|
|
13
|
+
* page operation `cache-first`, so the page that opens draws its answer from
|
|
14
|
+
* the cache. Calling it from a host's always-loaded link listener would pull
|
|
15
|
+
* the root barrel into that host's first load, and the Runs page's operation
|
|
16
|
+
* also carries two feature flags as variables. This entry statically imports
|
|
17
|
+
* only the path matcher and the flag readers; the preload itself (the page
|
|
18
|
+
* operations, the stores and the SDK's Apollo client) loads on the first
|
|
19
|
+
* hover or focus, which is also when the page's own code starts to load.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The Runs page's flags as the page itself reads them (`ExecutionsListPage`
|
|
23
|
+
* waits for `useFluidGridsFlagsSettled`, then reads `useDurableParityEnabled`
|
|
24
|
+
* and `usePhaseCFlags().searchAttributes`), from the optional flag context.
|
|
25
|
+
*/
|
|
26
|
+
function routeDataFlagsOf(context) {
|
|
27
|
+
return {
|
|
28
|
+
settled: resolveFluidGridsFlagsSettled(context),
|
|
29
|
+
withCounts: resolveDurableParity(context),
|
|
30
|
+
withSearchAttributes: resolvePhaseCFlags(context).searchAttributes
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Preload a list page's data: `route` is a PageDataRoute or a path. Resolves
|
|
35
|
+
* true when the page's answer is in the cache; never rejects. Resolves false,
|
|
36
|
+
* without loading anything, for a path that opens no list page, while the
|
|
37
|
+
* flags have not settled (a read sent then would carry other variables than
|
|
38
|
+
* the page's), and when the SDK's client is not set up yet.
|
|
39
|
+
*/
|
|
40
|
+
async function preloadRouteData(route, flags) {
|
|
41
|
+
const page = isPageDataRoute(route) ? route : pageDataRouteOf(route);
|
|
42
|
+
if (!page || !flags.settled) return false;
|
|
43
|
+
try {
|
|
44
|
+
const [{ preloadRoutePageData }, { getFluidGridsClientSafe }] = await Promise.all([import("./route-preload-C4DlGoCd.js").then((n) => n.r), import("./client-holder-C0M5Cfwl.js").then((n) => n.t)]);
|
|
45
|
+
const client = getFluidGridsClientSafe();
|
|
46
|
+
if (!client) return false;
|
|
47
|
+
return await preloadRoutePageData(page, client, { runs: {
|
|
48
|
+
withCounts: flags.withCounts,
|
|
49
|
+
withSearchAttributes: flags.withSearchAttributes
|
|
50
|
+
} });
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A stable function that preloads a list page's data with the active
|
|
57
|
+
* workspace's flags, read when it is called, so a host can hand it to a link
|
|
58
|
+
* listener installed once.
|
|
59
|
+
*/
|
|
60
|
+
function useRouteDataPreload() {
|
|
61
|
+
const context = useOptionalFeatureFlags();
|
|
62
|
+
const contextRef = useRef(context);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
contextRef.current = context;
|
|
65
|
+
}, [context]);
|
|
66
|
+
return useCallback((route) => preloadRouteData(route, routeDataFlagsOf(contextRef.current)), []);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { isPageDataRoute, pageDataRouteOf, preloadRouteData, routeDataFlagsOf, useRouteDataPreload };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
type PageDataRoute = "workflows-list" | "runs";
|
|
3
|
+
declare function isPageDataRoute(value: string): value is PageDataRoute;
|
|
4
|
+
declare function pageDataRouteOf(path: string): PageDataRoute | null;
|
|
5
|
+
export { isPageDataRoute as n, pageDataRouteOf as r, PageDataRoute as t };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/graphql/route-match.ts
|
|
3
|
+
/** Path segments that never preload: sign-in, sign-out and SSO relays. */
|
|
4
|
+
const AUTH_SEGMENTS = /* @__PURE__ */ new Set([
|
|
5
|
+
"auth",
|
|
6
|
+
"login",
|
|
7
|
+
"logout",
|
|
8
|
+
"signin",
|
|
9
|
+
"signout",
|
|
10
|
+
"sign-in",
|
|
11
|
+
"sign-out",
|
|
12
|
+
"sso",
|
|
13
|
+
"callback",
|
|
14
|
+
"oauth"
|
|
15
|
+
]);
|
|
16
|
+
/** True when `value` names a preloadable list page. */
|
|
17
|
+
function isPageDataRoute(value) {
|
|
18
|
+
return value === "workflows-list" || value === "runs";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The list page a path opens, or null. Accepts an app path or full URL
|
|
22
|
+
* (`/workflows/list`, `https://app.fluidgrids.ai/workflows/runs?x=1`); any
|
|
23
|
+
* sign-in or SSO path is null.
|
|
24
|
+
*/
|
|
25
|
+
function pageDataRouteOf(path) {
|
|
26
|
+
let pathname = path;
|
|
27
|
+
try {
|
|
28
|
+
pathname = new URL(path, "https://route.invalid").pathname;
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const segments = pathname.split("/").filter(Boolean).map((segment) => segment.toLowerCase());
|
|
33
|
+
if (segments.some((segment) => AUTH_SEGMENTS.has(segment))) return null;
|
|
34
|
+
const [parent, last] = segments.slice(-2);
|
|
35
|
+
if (parent !== "workflows") return null;
|
|
36
|
+
if (last === "list") return "workflows-list";
|
|
37
|
+
if (last === "runs") return "runs";
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { pageDataRouteOf as n, isPageDataRoute as t };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
|
|
3
|
+
import { i as RunsPageDocument, t as runsPageVariables } from "./useRunsPage-DG656UCK.js";
|
|
4
|
+
import { t as WorkflowsListPageDocument } from "./WorkflowsListPageDocument-CnzcQm_o.js";
|
|
5
|
+
import { a as readCachedPageOperation, i as preloadContextId, o as stableStringify, r as notePreloadedPageOperation } from "./page-operation-DrWuhd6Y.js";
|
|
6
|
+
import { d as DEFAULT_EXECUTIONS_FILTER, f as useExecutionsStore, r as getFluidGridsConfig } from "./config-DO68jw5k.js";
|
|
7
|
+
import { b as withProductFilter } from "./useWorkflows-Cvg-Z_IE.js";
|
|
8
|
+
import { n as pageDataRouteOf, t as isPageDataRoute } from "./route-match-DMkUICYV.js";
|
|
9
|
+
|
|
10
|
+
// src/graphql/route-preload.ts
|
|
11
|
+
/**
|
|
12
|
+
* Page data preloads for navigation intent (BOFF-17172, NET-05).
|
|
13
|
+
*
|
|
14
|
+
* A host calls `preloadRoutePageData` when a pointer enters, or focus lands
|
|
15
|
+
* on, a link to a list page (the sidebar's Workflows and Runs links). It sends
|
|
16
|
+
* that page's page operation `cache-first` with the variables the page's own
|
|
17
|
+
* first read uses, so the page that opens draws the answer from the cache;
|
|
18
|
+
* when the preload answered within PRELOAD_FRESH_MS the page sends no request
|
|
19
|
+
* of its own. A route that is not a list page (sign-in, SSO, the builder)
|
|
20
|
+
* preloads nothing.
|
|
21
|
+
*/
|
|
22
|
+
var route_preload_exports = /* @__PURE__ */ __exportAll({
|
|
23
|
+
PRELOAD_TIMEOUT_MS: () => PRELOAD_TIMEOUT_MS,
|
|
24
|
+
ROUTE_PAGE_DATA: () => ROUTE_PAGE_DATA,
|
|
25
|
+
clearInFlightPreloads: () => clearInFlightPreloads,
|
|
26
|
+
pageDataRouteOf: () => pageDataRouteOf,
|
|
27
|
+
preloadRoutePageData: () => preloadRoutePageData,
|
|
28
|
+
runsPageRead: () => runsPageRead,
|
|
29
|
+
workflowsListPageRead: () => workflowsListPageRead
|
|
30
|
+
});
|
|
31
|
+
/** WorkflowsListPage as the list page first reads it (no filters). */
|
|
32
|
+
function workflowsListPageRead(productId) {
|
|
33
|
+
return {
|
|
34
|
+
query: WorkflowsListPageDocument,
|
|
35
|
+
variables: { input: withProductFilter({
|
|
36
|
+
limit: 100,
|
|
37
|
+
latestOnly: true
|
|
38
|
+
}, productId) }
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* RunsPage as the Runs page first reads it, or null when the runs filter is
|
|
43
|
+
* not the default one (the page's input then depends on it, and a guess
|
|
44
|
+
* would only cost a request the page does not use).
|
|
45
|
+
*/
|
|
46
|
+
function runsPageRead(productId, options = {}) {
|
|
47
|
+
const { filter, pagination } = useExecutionsStore.getState();
|
|
48
|
+
if (stableStringify(filter) !== stableStringify(DEFAULT_EXECUTIONS_FILTER) || pagination.page !== 1) return null;
|
|
49
|
+
return {
|
|
50
|
+
query: RunsPageDocument,
|
|
51
|
+
variables: runsPageVariables({
|
|
52
|
+
input: {
|
|
53
|
+
limit: pagination.pageSize,
|
|
54
|
+
offset: 0
|
|
55
|
+
},
|
|
56
|
+
withCounts: options.withCounts ?? false,
|
|
57
|
+
scopedWorkflowKey: "",
|
|
58
|
+
withSearchAttributes: options.withSearchAttributes ?? false
|
|
59
|
+
}, productId)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** The page operation each preloadable route reads first. */
|
|
63
|
+
const ROUTE_PAGE_DATA = {
|
|
64
|
+
"workflows-list": (productId) => workflowsListPageRead(productId),
|
|
65
|
+
runs: (productId, options) => runsPageRead(productId, options.runs)
|
|
66
|
+
};
|
|
67
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
68
|
+
/** Test-only: forget every preload in flight. */
|
|
69
|
+
function clearInFlightPreloads() {
|
|
70
|
+
inFlight.clear();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* How long a preload may hold its in-flight slot. A host client with no
|
|
74
|
+
* network timeout could otherwise leave a hung request blocking every later
|
|
75
|
+
* preload of the same page; after this the preload resolves false and the
|
|
76
|
+
* slot is free again (the request itself is left to the client).
|
|
77
|
+
*/
|
|
78
|
+
const PRELOAD_TIMEOUT_MS = 15e3;
|
|
79
|
+
/**
|
|
80
|
+
* Preload a list page's data: `route` is a PageDataRoute or a path
|
|
81
|
+
* (pageDataRouteOf). Sends the page operation `cache-first`, at most once at
|
|
82
|
+
* a time per route and variables, and never for a sign-in route. Resolves
|
|
83
|
+
* true when the page's answer is in the cache; never rejects.
|
|
84
|
+
*/
|
|
85
|
+
function preloadRoutePageData(route, client, options = {}) {
|
|
86
|
+
const page = isPageDataRoute(route) ? route : pageDataRouteOf(route);
|
|
87
|
+
if (!page) return Promise.resolve(false);
|
|
88
|
+
const read = ROUTE_PAGE_DATA[page](getFluidGridsConfig().productId, options);
|
|
89
|
+
if (!read) return Promise.resolve(false);
|
|
90
|
+
const context = preloadContextId();
|
|
91
|
+
const key = `${context}:${page}:${stableStringify(read.variables)}`;
|
|
92
|
+
const running = inFlight.get(key);
|
|
93
|
+
if (running) return running;
|
|
94
|
+
const alreadyCached = readCachedPageOperation(client, read.query, read.variables) !== null;
|
|
95
|
+
let timer;
|
|
96
|
+
let timedOut = false;
|
|
97
|
+
const request = client.query({
|
|
98
|
+
query: read.query,
|
|
99
|
+
variables: read.variables,
|
|
100
|
+
fetchPolicy: "cache-first"
|
|
101
|
+
}).then((result) => {
|
|
102
|
+
const ok = Boolean(result.data) && !result.error;
|
|
103
|
+
if (ok && !alreadyCached && !timedOut && context === preloadContextId()) notePreloadedPageOperation(read.query, read.variables);
|
|
104
|
+
return ok;
|
|
105
|
+
}).catch(() => false);
|
|
106
|
+
const timeout = new Promise((resolve) => {
|
|
107
|
+
timer = setTimeout(() => {
|
|
108
|
+
timedOut = true;
|
|
109
|
+
resolve(false);
|
|
110
|
+
}, PRELOAD_TIMEOUT_MS);
|
|
111
|
+
});
|
|
112
|
+
const preload = Promise.race([request, timeout]).finally(() => {
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
inFlight.delete(key);
|
|
115
|
+
});
|
|
116
|
+
inFlight.set(key, preload);
|
|
117
|
+
return preload;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { preloadRoutePageData as n, route_preload_exports as r, ROUTE_PAGE_DATA as t };
|