@sanity/ailf-studio 1.15.0 → 1.15.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.
Files changed (2) hide show
  1. package/dist/index.js +47 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2326,8 +2326,17 @@ import {
2326
2326
  } from "sanity";
2327
2327
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2328
2328
  function CanonicalDocPreview(props) {
2329
- const { perspective, perspectiveTitle, reason, refType, slug, path } = props;
2329
+ const {
2330
+ docType,
2331
+ perspective,
2332
+ perspectiveTitle,
2333
+ reason,
2334
+ refType,
2335
+ slug,
2336
+ path
2337
+ } = props;
2330
2338
  const isPerspective = refType === "perspective";
2339
+ const isNonArticleDoc = !isPerspective && typeof docType === "string" && docType !== "article";
2331
2340
  const { data: activeReleases } = useActiveReleases();
2332
2341
  const { data: archivedReleases } = useArchivedReleases();
2333
2342
  const resolvedTitle = useMemo(() => {
@@ -2374,7 +2383,14 @@ function CanonicalDocPreview(props) {
2374
2383
  return /* @__PURE__ */ jsxs5(Flex3, { align: "center", gap: 2, padding: 2, children: [
2375
2384
  /* @__PURE__ */ jsx5(Text5, { size: 2, children: icon }),
2376
2385
  /* @__PURE__ */ jsxs5(Flex3, { direction: "column", gap: 1, flex: 1, children: [
2377
- /* @__PURE__ */ jsx5(Text5, { size: 2, weight: "semibold", children: resolvedTitle }),
2386
+ /* @__PURE__ */ jsxs5(Flex3, { align: "center", gap: 2, children: [
2387
+ /* @__PURE__ */ jsx5(Text5, { size: 2, weight: "semibold", children: resolvedTitle }),
2388
+ isNonArticleDoc && /* @__PURE__ */ jsxs5(Text5, { muted: true, size: 0, children: [
2389
+ "(",
2390
+ docType,
2391
+ ")"
2392
+ ] })
2393
+ ] }),
2378
2394
  subtitle && /* @__PURE__ */ jsx5(Text5, { muted: true, size: 1, children: subtitle })
2379
2395
  ] })
2380
2396
  ] });
@@ -2839,6 +2855,17 @@ var taskSchema = defineType5({
2839
2855
  select: { subtitle: "slug.current", title: "title" }
2840
2856
  },
2841
2857
  type: "article"
2858
+ },
2859
+ // typesReference — SDK / API type-definition documents.
2860
+ // The pipeline resolves these via the renderer registry
2861
+ // (see packages/eval/src/sanity/document-renderers.ts);
2862
+ // adding more curated types here is a one-line schema
2863
+ // change with no other code path required (W0195).
2864
+ {
2865
+ preview: {
2866
+ select: { subtitle: "slug.current", title: "title" }
2867
+ },
2868
+ type: "typesReference"
2842
2869
  }
2843
2870
  ],
2844
2871
  type: "crossDatasetReference",
@@ -2897,6 +2924,7 @@ var taskSchema = defineType5({
2897
2924
  name: "canonicalDocRef",
2898
2925
  preview: {
2899
2926
  select: {
2927
+ docType: "doc._type",
2900
2928
  path: "path",
2901
2929
  perspective: "perspective",
2902
2930
  perspectiveTitle: "perspectiveTitle",
@@ -4088,6 +4116,20 @@ function getDimensionValue(score, key) {
4088
4116
  }
4089
4117
 
4090
4118
  // src/lib/comparison.ts
4119
+ function normalizePerArea(perArea) {
4120
+ if (perArea == null) return [];
4121
+ if (Array.isArray(perArea)) {
4122
+ return perArea.filter(
4123
+ (e) => typeof e === "object" && e !== null && typeof e.area === "string" && typeof e.delta === "number"
4124
+ );
4125
+ }
4126
+ if (typeof perArea === "object") {
4127
+ return Object.entries(perArea).filter(
4128
+ (entry) => typeof entry[1] === "number"
4129
+ ).map(([area, delta]) => ({ area, delta }));
4130
+ }
4131
+ return [];
4132
+ }
4091
4133
  function scoreMap(summary) {
4092
4134
  return new Map(summary.scores.map((s) => [s.feature, s]));
4093
4135
  }
@@ -12058,7 +12100,7 @@ function StrengthsList({
12058
12100
  AreaScoresGrid,
12059
12101
  {
12060
12102
  mode,
12061
- perArea: comparison?.deltas?.perArea,
12103
+ perArea: normalizePerArea(comparison?.deltas?.perArea),
12062
12104
  perModel: expandedPerModel,
12063
12105
  scores: displayedScores
12064
12106
  }
@@ -12145,7 +12187,7 @@ function WeaknessesList({
12145
12187
  );
12146
12188
  const dimWeaknesses = scores.map((s) => ({ area: s, dims: getDimensionWeaknesses(s) })).filter(({ dims }) => dims.length > 0);
12147
12189
  const regressed = comparison?.regressed ?? [];
12148
- const perArea = comparison?.deltas?.perArea;
12190
+ const perArea = normalizePerArea(comparison?.deltas?.perArea);
12149
12191
  const efficiencyAnomalies = scores.filter(
12150
12192
  (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency > EFFICIENCY_ANOMALY
12151
12193
  );
@@ -12358,7 +12400,7 @@ function WeaknessesList({
12358
12400
  ),
12359
12401
  /* @__PURE__ */ jsx56(Stack31, { children: regressed.map((featureName, i) => {
12360
12402
  const area = scores.find((s) => s.feature === featureName);
12361
- const areaDelta = perArea?.find(
12403
+ const areaDelta = perArea.find(
12362
12404
  (p) => p.area === featureName
12363
12405
  )?.delta;
12364
12406
  return /* @__PURE__ */ jsxs40(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf-studio",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "AI Literacy Framework — Sanity Studio dashboard plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",