@sanity/assist 1.2.13 → 1.2.15-ui2.1

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/dist/index.js CHANGED
@@ -179,7 +179,7 @@ function isUnsupportedType(type) {
179
179
  }
180
180
  const inlineTypes = ["document", "object", "image", "file"];
181
181
  function serializeSchema(schema, options) {
182
- const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => isAssistSupported(t)).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
182
+ const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
183
183
  if ("to" in t && t.to && !t.to.length) {
184
184
  return false;
185
185
  }
@@ -733,7 +733,7 @@ function asStudioInstruction(instruction, run, validation) {
733
733
  });
734
734
  return {
735
735
  ...instruction,
736
- tasks: run.filter(task => task.instructionKey === instruction._key).filter(task => task.started && /* @__PURE__ */new Date().getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs),
736
+ tasks: run.filter(task => task.instructionKey === instruction._key).filter(task => task.started && ( /* @__PURE__ */new Date()).getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs),
737
737
  validation: errors.filter(marker => fieldRefs.map(r => r.path).filter(p => !!p).find(path => sanity.pathToString(marker.path) === path))
738
738
  };
739
739
  }
@@ -815,13 +815,13 @@ function InstructionTaskHistoryButton(props) {
815
815
  const statusDocId = assistTasksStatusId(documentId);
816
816
  const basePath = "".concat(sanity.typed("tasks"), '[_key=="').concat(taskKey, '"]');
817
817
  client.patch(statusDocId).set({
818
- ["".concat(basePath, ".").concat(sanity.typed("ended"))]: /* @__PURE__ */new Date().toISOString(),
818
+ ["".concat(basePath, ".").concat(sanity.typed("ended"))]: ( /* @__PURE__ */new Date()).toISOString(),
819
819
  ["".concat(basePath, ".").concat(sanity.typed("reason"))]: sanity.typed("aborted")
820
820
  }).commit().catch(console.error);
821
821
  }, [client, documentId]);
822
822
  const titledTasks = react.useMemo(() => {
823
823
  var _a2;
824
- const t = (_a2 = tasks == null ? void 0 : tasks.filter(task => task.started && /* @__PURE__ */new Date().getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs).map(task => {
824
+ const t = (_a2 = tasks == null ? void 0 : tasks.filter(task => task.started && ( /* @__PURE__ */new Date()).getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs).map(task => {
825
825
  var _a3;
826
826
  const instruction = instructions == null ? void 0 : instructions.find(i => i._key === task.instructionKey);
827
827
  return {
@@ -888,11 +888,10 @@ const TaskStatusButton = react.forwardRef(function TaskStatusButton2(props, ref)
888
888
  mode: "bleed",
889
889
  onClick,
890
890
  tone: hasErrors ? "critical" : void 0,
891
- fontSize: 1,
892
891
  disabled,
893
892
  ref,
894
893
  selected,
895
- tooltip: TASK_STATUS_BUTTON_TOOLTIP_PROPS
894
+ tooltipProps: TASK_STATUS_BUTTON_TOOLTIP_PROPS
896
895
  });
897
896
  });
898
897
  function TaskList(props) {
@@ -2174,7 +2173,7 @@ function useAssistPresence(path, showFocusWithin) {
2174
2173
  const activePresence = (_b = (_a = tasks == null ? void 0 : tasks.filter(task => !task.ended)) == null ? void 0 : _a.flatMap(task => {
2175
2174
  var _a2;
2176
2175
  return (_a2 = task.presence) != null ? _a2 : [];
2177
- })) == null ? void 0 : _b.filter(p => p.started && /* @__PURE__ */new Date().getTime() - new Date(p.started).getTime() < maxHistoryVisibilityMs).filter(presence => {
2176
+ })) == null ? void 0 : _b.filter(p => p.started && ( /* @__PURE__ */new Date()).getTime() - new Date(p.started).getTime() < maxHistoryVisibilityMs).filter(presence => {
2178
2177
  if (!presence.path || !path.length) {
2179
2178
  return false;
2180
2179
  }
@@ -2208,7 +2207,7 @@ function aiPresence(presence, path, title) {
2208
2207
  },
2209
2208
  path,
2210
2209
  sessionId: "not-available",
2211
- lastActiveAt: (_a = presence == null ? void 0 : presence.started) != null ? _a : /* @__PURE__ */new Date().toISOString()
2210
+ lastActiveAt: (_a = presence == null ? void 0 : presence.started) != null ? _a : ( /* @__PURE__ */new Date()).toISOString()
2212
2211
  };
2213
2212
  }
2214
2213
  var __freeze$3 = Object.freeze;
@@ -2235,47 +2234,47 @@ const FadeInContent = react.forwardRef(function FadeInContent2(_ref9, ref) {
2235
2234
  const purple = {
2236
2235
  "50": {
2237
2236
  title: "Purple 50",
2238
- hex: "#f8e9fe"
2237
+ hex: "#f8f5ff"
2239
2238
  },
2240
2239
  "100": {
2241
2240
  title: "Purple 100",
2242
- hex: "#f2d3fe"
2241
+ hex: "#f1ebff"
2243
2242
  },
2244
2243
  "200": {
2245
2244
  title: "Purple 200",
2246
- hex: "#e6a7fd"
2245
+ hex: "#ece1fe"
2247
2246
  },
2248
2247
  "300": {
2249
2248
  title: "Purple 300",
2250
- hex: "#d97bfd"
2249
+ hex: "#ccb1fc"
2251
2250
  },
2252
2251
  "400": {
2253
2252
  title: "Purple 400",
2254
- hex: "#cd4efc"
2253
+ hex: "#b087f7"
2255
2254
  },
2256
2255
  "500": {
2257
2256
  title: "Purple 500",
2258
- hex: "#c123fc"
2257
+ hex: "#8f57ef"
2259
2258
  },
2260
2259
  "600": {
2261
2260
  title: "Purple 600",
2262
- hex: "#9d1fcd"
2261
+ hex: "#721fe5"
2263
2262
  },
2264
2263
  "700": {
2265
2264
  title: "Purple 700",
2266
- hex: "#7a1b9e"
2265
+ hex: "#4c1a9e"
2267
2266
  },
2268
2267
  "800": {
2269
2268
  title: "Purple 800",
2270
- hex: "#56186f"
2269
+ hex: "#2f1862"
2271
2270
  },
2272
2271
  "900": {
2273
2272
  title: "Purple 900",
2274
- hex: "#331440"
2273
+ hex: "#23173f"
2275
2274
  },
2276
2275
  "950": {
2277
2276
  title: "Purple 950",
2278
- hex: "#211229"
2277
+ hex: "#181128"
2279
2278
  }
2280
2279
  };
2281
2280
  var __freeze$2 = Object.freeze;
@@ -2972,7 +2971,6 @@ function AssistConnectorsOverlay(props) {
2972
2971
  zIndex: 150
2973
2972
  // zIndex,
2974
2973
  },
2975
-
2976
2974
  children: connectors.map(connector => /* @__PURE__ */jsxRuntime.jsx(ConnectorPath, {
2977
2975
  from: connector.from,
2978
2976
  options,
@@ -3987,7 +3985,6 @@ const prompt = sanity.defineType({
3987
3985
  type: userInput.name,
3988
3986
  }),*/]
3989
3987
  });
3990
-
3991
3988
  const instruction = sanity.defineType({
3992
3989
  type: "object",
3993
3990
  name: instructionTypeName,
@@ -4716,11 +4713,11 @@ function AssistDocumentPresence(props) {
4716
4713
  const anyPresence2 = (_b = (_a = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _a.filter(run => !run.ended && !run.reason)) == null ? void 0 : _b.flatMap(run => {
4717
4714
  var _a2;
4718
4715
  return (_a2 = run.presence) != null ? _a2 : [];
4719
- }).find(f => f.started && /* @__PURE__ */new Date().getTime() - new Date(f.started).getTime() < 3e4);
4716
+ }).find(f => f.started && ( /* @__PURE__ */new Date()).getTime() - new Date(f.started).getTime() < 3e4);
4720
4717
  if (anyPresence2) {
4721
4718
  return aiPresence(anyPresence2, []);
4722
4719
  }
4723
- const anyRun = (_d = (_c = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _c.filter(run => !run.ended && !run.reason)) == null ? void 0 : _d.find(f => f.started && /* @__PURE__ */new Date().getTime() - new Date(f.started).getTime() < 3e4);
4720
+ const anyRun = (_d = (_c = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _c.filter(run => !run.ended && !run.reason)) == null ? void 0 : _d.find(f => f.started && ( /* @__PURE__ */new Date()).getTime() - new Date(f.started).getTime() < 3e4);
4724
4721
  return anyRun ? aiPresence({
4725
4722
  started: anyRun.started,
4726
4723
  path: documentRootKey,
@@ -4757,15 +4754,23 @@ const assist = sanity.definePlugin(config => {
4757
4754
  }
4758
4755
  return prev;
4759
4756
  },
4760
- unstable_fieldActions: prev => {
4761
- return [...prev, assistFieldActions];
4757
+ unstable_fieldActions: (prev, _ref17) => {
4758
+ let {
4759
+ documentType,
4760
+ schema
4761
+ } = _ref17;
4762
+ const docSchema = schema.get(documentType);
4763
+ if (docSchema && isSchemaAssistEnabled(docSchema)) {
4764
+ return [...prev, assistFieldActions];
4765
+ }
4766
+ return prev;
4762
4767
  },
4763
- unstable_languageFilter: (prev, _ref17) => {
4768
+ unstable_languageFilter: (prev, _ref18) => {
4764
4769
  let {
4765
4770
  documentId,
4766
4771
  schema,
4767
4772
  schemaType
4768
- } = _ref17;
4773
+ } = _ref18;
4769
4774
  const docSchema = schema.get(schemaType);
4770
4775
  if (docSchema && sanity.isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
4771
4776
  return [...prev, createAssistDocumentPresence(documentId, docSchema)];