@sanity/workflow-studio-plugin 0.3.0 → 0.4.0
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/CHANGELOG.md +119 -0
- package/README.md +63 -7
- package/dist/_chunks-cjs/index.cjs +4043 -3603
- package/dist/_chunks-cjs/workflows-tool-root.cjs +41 -42
- package/dist/_chunks-es/index.js +3775 -3361
- package/dist/_chunks-es/workflows-tool-root.js +43 -42
- package/dist/index.d.cts +40 -15
- package/dist/index.d.ts +40 -15
- package/package.json +11 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), ui = require("@sanity/ui"), react = require("react"), router = require("sanity/router"), index = require("./index.cjs"), ChevronDown = require("@sanity/icons/ChevronDown"), ChevronRight = require("@sanity/icons/ChevronRight"), workflowEngine = require("@sanity/workflow-engine"), Checkmark = require("@sanity/icons/Checkmark"), Close = require("@sanity/icons/Close"), Filter = require("@sanity/icons/Filter"), endOfDay = require("date-fns/endOfDay"), sanity = require("sanity"), workflowStudio = require("@sanity/workflow-studio"), ArrowLeft = require("@sanity/icons/ArrowLeft"), workflowDiagram = require("@sanity/workflow-diagram"), Add = require("@sanity/icons/Add"), Search = require("@sanity/icons/Search"), EllipsisHorizontal = require("@sanity/icons/EllipsisHorizontal");
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), ui = require("@sanity/ui"), react = require("react"), router = require("sanity/router"), index = require("./index.cjs"), ChevronDown = require("@sanity/icons/ChevronDown"), ChevronRight = require("@sanity/icons/ChevronRight"), workflowEngine = require("@sanity/workflow-engine"), Checkmark = require("@sanity/icons/Checkmark"), Close = require("@sanity/icons/Close"), Filter = require("@sanity/icons/Filter"), workflowComponents = require("@sanity/workflow-components"), endOfDay = require("date-fns/endOfDay"), sanity = require("sanity"), workflowStudio = require("@sanity/workflow-studio"), ArrowLeft = require("@sanity/icons/ArrowLeft"), workflowDiagram = require("@sanity/workflow-diagram"), Add = require("@sanity/icons/Add"), Search = require("@sanity/icons/Search"), EllipsisHorizontal = require("@sanity/icons/EllipsisHorizontal");
|
|
4
4
|
|
|
5
5
|
function MutedNote({text: text}) {
|
|
6
6
|
/* @__PURE__ */
|
|
@@ -350,7 +350,7 @@ function useDocPreviewTitles(documents) {
|
|
|
350
350
|
titles: new Map(titles),
|
|
351
351
|
resolved: new Set(resolved)
|
|
352
352
|
}), subscriptions = documents.flatMap(doc => {
|
|
353
|
-
const parsedRef
|
|
353
|
+
const {parsed: parsedRef, local: local} = index.gdrLocality(doc.id, binding.contentResource), schemaType = schema.get(doc.type);
|
|
354
354
|
return !parsedRef || !local || !schemaType ? (resolved.add(doc.id), []) : [ previewStore.observeForPreview({
|
|
355
355
|
_type: "reference",
|
|
356
356
|
_ref: parsedRef.documentId
|
|
@@ -384,14 +384,18 @@ function TaskFilterMenu({filters: filters, options: options, onChange: onChange}
|
|
|
384
384
|
onDismiss: () => setOpen(!1),
|
|
385
385
|
open: open,
|
|
386
386
|
overflow: "visible",
|
|
387
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
387
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index.HoverHint, {
|
|
388
|
+
disabled: open,
|
|
389
|
+
text: "Filter",
|
|
390
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
391
|
+
"aria-label": "Filter",
|
|
392
|
+
fontSize: 1,
|
|
393
|
+
icon: Filter.FilterIcon,
|
|
394
|
+
mode: "bleed",
|
|
395
|
+
onClick: () => setOpen(v => !v),
|
|
396
|
+
padding: 2,
|
|
397
|
+
selected: active || open
|
|
398
|
+
})
|
|
395
399
|
})
|
|
396
400
|
});
|
|
397
401
|
}
|
|
@@ -521,7 +525,7 @@ function FilterField({label: label, placeholder: placeholder, pills: pills, onCl
|
|
|
521
525
|
});
|
|
522
526
|
}
|
|
523
527
|
|
|
524
|
-
function TagField({label: label, placeholder: placeholder, rows: rows, activeKeys: activeKeys, onToggle: onToggle, pillLabel: pillLabel, open: open, onOpen: onOpen, emptyNote: emptyNote = "Nothing matches
|
|
528
|
+
function TagField({label: label, placeholder: placeholder, rows: rows, activeKeys: activeKeys, onToggle: onToggle, pillLabel: pillLabel, open: open, onOpen: onOpen, emptyNote: emptyNote = "Nothing matches"}) {
|
|
525
529
|
const [query, setQuery] = react.useState(""), q = query.trim().toLowerCase(), hits = q ? rows.filter(row => row.text.toLowerCase().includes(q)) : rows, shown = shownHits(hits, HITS_CAP);
|
|
526
530
|
/* @__PURE__ */
|
|
527
531
|
return jsxRuntime.jsx(FilterField, {
|
|
@@ -702,7 +706,7 @@ function AssigneeField({activeIds: activeIds, onToggle: onToggle, open: open, on
|
|
|
702
706
|
align: "center",
|
|
703
707
|
gap: 2,
|
|
704
708
|
children: [
|
|
705
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsx(workflowComponents.MemberAvatar, {
|
|
706
710
|
imageUrl: member.imageUrl,
|
|
707
711
|
name: member.displayName
|
|
708
712
|
}),
|
|
@@ -738,7 +742,7 @@ function DocumentField({documents: documents, activeIds: activeIds, onToggle: on
|
|
|
738
742
|
/* @__PURE__ */
|
|
739
743
|
return jsxRuntime.jsx(TagField, {
|
|
740
744
|
activeKeys: activeIds,
|
|
741
|
-
emptyNote: "No documents match
|
|
745
|
+
emptyNote: "No documents match",
|
|
742
746
|
label: "Document",
|
|
743
747
|
onOpen: onOpen,
|
|
744
748
|
onToggle: onToggle,
|
|
@@ -795,7 +799,7 @@ function DateField({date: date, onChange: onChange, open: open, onOpen: onOpen})
|
|
|
795
799
|
children: "Before…"
|
|
796
800
|
})
|
|
797
801
|
}),
|
|
798
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
802
|
+
/* @__PURE__ */ jsxRuntime.jsx(workflowComponents.DatePicker, {
|
|
799
803
|
onSelect: next => pick({
|
|
800
804
|
before: endOfDayIso(next)
|
|
801
805
|
}),
|
|
@@ -895,7 +899,7 @@ function WorkflowsDashboard({instances: instances, onOpenInstance: onOpenInstanc
|
|
|
895
899
|
return loading ? /* @__PURE__ */ jsxRuntime.jsx(index.LoadingRow, {
|
|
896
900
|
label: "Loading workflows…"
|
|
897
901
|
}) : inFlight.length === 0 && settled.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(MutedNote, {
|
|
898
|
-
text: "No workflows yet — start one with “New workflow
|
|
902
|
+
text: "No workflows yet — start one with “New workflow”"
|
|
899
903
|
}) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, {
|
|
900
904
|
gap: 2,
|
|
901
905
|
children: [
|
|
@@ -915,7 +919,7 @@ function WorkflowsDashboard({instances: instances, onOpenInstance: onOpenInstanc
|
|
|
915
919
|
options: options
|
|
916
920
|
}) ]
|
|
917
921
|
}), visibleInFlight.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(MutedNote, {
|
|
918
|
-
text: "No running workflows match
|
|
922
|
+
text: "No running workflows match"
|
|
919
923
|
}) : /* @__PURE__ */ jsxRuntime.jsx(InstanceRows, {
|
|
920
924
|
instances: visibleInFlight,
|
|
921
925
|
onOpenInstance: onOpenInstance
|
|
@@ -997,11 +1001,7 @@ function InstanceRow({instance: instance, onOpen: onOpen}) {
|
|
|
997
1001
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, {
|
|
998
1002
|
flex: 1
|
|
999
1003
|
}),
|
|
1000
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.
|
|
1001
|
-
definition: definition,
|
|
1002
|
-
instance: instance
|
|
1003
|
-
}),
|
|
1004
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.PendingWorkBadge, {
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.AbortedBadge, {
|
|
1005
1005
|
instance: instance
|
|
1006
1006
|
}) ]
|
|
1007
1007
|
})
|
|
@@ -1156,13 +1156,16 @@ function DetailHeader({entry: entry, definition: definition, onBack: onBack}) {
|
|
|
1156
1156
|
gap: 3,
|
|
1157
1157
|
wrap: "wrap",
|
|
1158
1158
|
children: [
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1159
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.HoverHint, {
|
|
1160
|
+
text: "Back to workflows",
|
|
1161
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
1162
|
+
"aria-label": "Back to workflows",
|
|
1163
|
+
fontSize: 1,
|
|
1164
|
+
icon: ArrowLeft.ArrowLeftIcon,
|
|
1165
|
+
mode: "bleed",
|
|
1166
|
+
onClick: onBack,
|
|
1167
|
+
padding: 2
|
|
1168
|
+
})
|
|
1166
1169
|
}),
|
|
1167
1170
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, {
|
|
1168
1171
|
gap: 2,
|
|
@@ -1179,11 +1182,7 @@ function DetailHeader({entry: entry, definition: definition, onBack: onBack}) {
|
|
|
1179
1182
|
}) ]
|
|
1180
1183
|
}), workflowEngine.terminalState(instance) === "in-flight" ? /* @__PURE__ */ jsxRuntime.jsx(index.StageChip, {
|
|
1181
1184
|
title: index.stageTitle(definition, instance.currentStage)
|
|
1182
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(index.
|
|
1183
|
-
definition: definition,
|
|
1184
|
-
instance: instance
|
|
1185
|
-
}),
|
|
1186
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.PendingWorkBadge, {
|
|
1185
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(index.AbortedBadge, {
|
|
1187
1186
|
instance: instance
|
|
1188
1187
|
}),
|
|
1189
1188
|
/* @__PURE__ */ jsxRuntime.jsx(SpinnerSlot, {
|
|
@@ -1234,7 +1233,7 @@ function StageDiagramSection({entry: entry, definition: definition}) {
|
|
|
1234
1233
|
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
|
|
1235
1234
|
muted: !0,
|
|
1236
1235
|
size: 1,
|
|
1237
|
-
children: "Couldn’t load this workflow’s
|
|
1236
|
+
children: "Couldn’t load this workflow’s full details — the stage diagram is unavailable, and technical names show instead of titles."
|
|
1238
1237
|
})
|
|
1239
1238
|
});
|
|
1240
1239
|
}
|
|
@@ -1313,9 +1312,9 @@ function DefinitionPickerPanel({onPick: onPick}) {
|
|
|
1313
1312
|
}) : null, !definitions && !error ? /* @__PURE__ */ jsxRuntime.jsx(index.LoadingRow, {
|
|
1314
1313
|
label: "Loading workflows…"
|
|
1315
1314
|
}) : null, definitions && definitions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(MutedNote, {
|
|
1316
|
-
text: "No startable workflows are deployed
|
|
1315
|
+
text: "No startable workflows are deployed"
|
|
1317
1316
|
}) : null, definitions && definitions.length > 0 && visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(MutedNote, {
|
|
1318
|
-
text: "No workflows match
|
|
1317
|
+
text: "No workflows match"
|
|
1319
1318
|
}) : null,
|
|
1320
1319
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Stack, {
|
|
1321
1320
|
gap: 1,
|
|
@@ -1393,7 +1392,7 @@ function ToolActivityDialog({target: target, onClose: onClose}) {
|
|
|
1393
1392
|
|
|
1394
1393
|
function TaskGroupList({groups: groups, onOpenTask: onOpenTask, onOpenWorkflow: onOpenWorkflow}) {
|
|
1395
1394
|
return groups.withDocuments.length === 0 && groups.withoutDocuments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(MutedNote, {
|
|
1396
|
-
text: "No tasks match — adjust the filters, or start a workflow
|
|
1395
|
+
text: "No tasks match — adjust the filters, or start a workflow"
|
|
1397
1396
|
}) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, {
|
|
1398
1397
|
gap: 2,
|
|
1399
1398
|
children: [ groups.withDocuments.map(group => /* @__PURE__ */ jsxRuntime.jsx(DocumentTaskGroup, {
|
|
@@ -1520,9 +1519,9 @@ function DocumentTaskGroup({group: group, onOpenTask: onOpenTask, onOpenWorkflow
|
|
|
1520
1519
|
}
|
|
1521
1520
|
|
|
1522
1521
|
function GroupMenu({group: group, document: document, onOpenWorkflow: onOpenWorkflow}) {
|
|
1523
|
-
const router$1 = router.useRouter();
|
|
1522
|
+
const router$1 = router.useRouter(), state = index.useDocLink(document);
|
|
1524
1523
|
/* @__PURE__ */
|
|
1525
|
-
return jsxRuntime.jsx(
|
|
1524
|
+
return jsxRuntime.jsx(index.HintedMenuButton, {
|
|
1526
1525
|
button: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
1527
1526
|
"aria-label": "Group actions",
|
|
1528
1527
|
fontSize: 1,
|
|
@@ -1530,16 +1529,16 @@ function GroupMenu({group: group, document: document, onOpenWorkflow: onOpenWork
|
|
|
1530
1529
|
mode: "bleed",
|
|
1531
1530
|
padding: 2
|
|
1532
1531
|
}),
|
|
1532
|
+
hint: "Group actions",
|
|
1533
1533
|
id: `task-group-menu-${group.key}`,
|
|
1534
1534
|
menu: /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, {
|
|
1535
1535
|
children: [
|
|
1536
1536
|
/* @__PURE__ */ jsxRuntime.jsx(ui.MenuItem, {
|
|
1537
1537
|
onClick: () => onOpenWorkflow(group.instanceId),
|
|
1538
1538
|
text: "View workflow"
|
|
1539
|
-
}),
|
|
1539
|
+
}), state.kind === "linked" ? /* @__PURE__ */ jsxRuntime.jsx(ui.MenuItem, {
|
|
1540
1540
|
onClick: () => router$1.navigateIntent("edit", {
|
|
1541
|
-
id:
|
|
1542
|
-
type: document.type
|
|
1541
|
+
id: state.bareId
|
|
1543
1542
|
}),
|
|
1544
1543
|
text: "Open document"
|
|
1545
1544
|
}) : null ]
|