@sanity/ailf-studio 0.4.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -295,6 +295,7 @@ interface ContentImpactItem {
295
295
  source: string;
296
296
  tag: null | string;
297
297
  targetDocuments: null | string[];
298
+ title: null | string;
298
299
  trigger: null | string;
299
300
  }
300
301
  /** Provenance data as stored in Sanity */
@@ -354,6 +355,7 @@ interface ReportDetail {
354
355
  reportId: string;
355
356
  summary: SummaryData;
356
357
  tag: null | string;
358
+ title: null | string;
357
359
  }
358
360
  /** Shape returned by latestReportsQuery */
359
361
  interface ReportListItem {
@@ -388,6 +390,7 @@ interface ReportListItem {
388
390
  scores: ScoreItem[];
389
391
  source: string;
390
392
  tag: null | string;
393
+ title: null | string;
391
394
  /** Target document slugs (when evaluated with --changed-docs) */
392
395
  targetDocuments?: null | string[];
393
396
  trigger: string;
@@ -505,6 +508,7 @@ interface TimelineDataPoint {
505
508
  }[];
506
509
  source: string;
507
510
  tag: null | string;
511
+ title: null | string;
508
512
  }
509
513
  /**
510
514
  * A single help topic extracted from markdown docs at build time.
@@ -698,7 +702,7 @@ declare const scoreTimelineQuery: string;
698
702
  *
699
703
  * Used by: ReportDetail view
700
704
  */
701
- declare const reportDetailQuery = "\n *[_type == \"ailf.report\" && reportId == $reportId][0] {\n _id,\n reportId,\n completedAt,\n durationMs,\n tag,\n provenance,\n summary,\n comparison\n }\n";
705
+ declare const reportDetailQuery = "\n *[_type == \"ailf.report\" && reportId == $reportId][0] {\n _id,\n reportId,\n completedAt,\n durationMs,\n tag,\n title,\n provenance,\n summary,\n comparison\n }\n";
702
706
  /**
703
707
  * Find all reports that evaluated a specific Sanity document or perspective.
704
708
  *
@@ -741,7 +745,7 @@ declare const distinctPerspectivesQuery = "\n array::unique(*[_type == \"ailf.r
741
745
  *
742
746
  * Used by: ComparisonView — user selects two reports to compare
743
747
  */
744
- declare const comparisonPairQuery = "\n *[_type == \"ailf.report\" && reportId in [$baselineId, $experimentId]] {\n _id,\n reportId,\n completedAt,\n tag,\n provenance,\n summary\n }\n";
748
+ declare const comparisonPairQuery = "\n *[_type == \"ailf.report\" && reportId in [$baselineId, $experimentId]] {\n _id,\n reportId,\n completedAt,\n tag,\n title,\n provenance,\n summary\n }\n";
745
749
  /** All unique source names (for filter dropdowns) */
746
750
  declare const distinctSourcesQuery = "\n array::unique(*[_type == \"ailf.report\"].provenance.source.name)\n";
747
751
  /** All unique modes (for filter dropdowns) */
@@ -847,6 +851,7 @@ declare const reportSchema: {
847
851
  mode: string;
848
852
  overall: string;
849
853
  tag: string;
854
+ title: string;
850
855
  }, Record<string, unknown>> | undefined;
851
856
  };
852
857
 
package/dist/index.js CHANGED
@@ -739,6 +739,14 @@ var reportSchema = defineType4({
739
739
  title: "Duration (ms)",
740
740
  type: "number"
741
741
  }),
742
+ defineField4({
743
+ description: "Auto-generated descriptive title for discoverability and sharing",
744
+ group: ["main", "all-fields"],
745
+ name: "title",
746
+ readOnly: true,
747
+ title: "Title",
748
+ type: "string"
749
+ }),
742
750
  defineField4({
743
751
  group: ["optional", "all-fields"],
744
752
  name: "tag",
@@ -1583,22 +1591,30 @@ var reportSchema = defineType4({
1583
1591
  ],
1584
1592
  name: "ailf.report",
1585
1593
  preview: {
1586
- prepare({ completedAt, mode, overall, tag }) {
1594
+ prepare({
1595
+ completedAt,
1596
+ mode,
1597
+ overall,
1598
+ tag,
1599
+ title
1600
+ }) {
1587
1601
  const avgScore = overall !== null && typeof overall === "object" && "avgScore" in overall ? overall.avgScore : void 0;
1588
1602
  const score = typeof avgScore === "number" ? `${Math.round(avgScore)}/100` : "\u2014";
1589
1603
  const date = typeof completedAt === "string" ? new Date(completedAt).toLocaleDateString() : "";
1590
1604
  const modeStr = typeof mode === "string" ? mode : "baseline";
1605
+ const titleStr = typeof title === "string" ? title : void 0;
1591
1606
  const tagStr = typeof tag === "string" ? tag : void 0;
1592
1607
  return {
1593
1608
  subtitle: `${modeStr} \xB7 ${score} \xB7 ${date}`,
1594
- title: tagStr ?? `Report ${date}`
1609
+ title: titleStr ?? tagStr ?? `Report ${date}`
1595
1610
  };
1596
1611
  },
1597
1612
  select: {
1598
1613
  completedAt: "completedAt",
1599
1614
  mode: "provenance.mode",
1600
1615
  overall: "summary.overall",
1601
- tag: "tag"
1616
+ tag: "tag",
1617
+ title: "title"
1602
1618
  }
1603
1619
  },
1604
1620
  title: "AILF Report",
@@ -3551,6 +3567,7 @@ var latestReportsQuery = (
3551
3567
  completedAt,
3552
3568
  durationMs,
3553
3569
  tag,
3570
+ title,
3554
3571
  "mode": provenance.mode,
3555
3572
  "source": provenance.source.name,
3556
3573
  "areas": provenance.areas,
@@ -3607,7 +3624,8 @@ var scoreTimelineQuery = (
3607
3624
  "actualScore": summary.overall.avgActualScore,
3608
3625
  "mode": provenance.mode,
3609
3626
  "source": provenance.source.name,
3610
- tag
3627
+ tag,
3628
+ title
3611
3629
  }
3612
3630
  `
3613
3631
  );
@@ -3620,6 +3638,7 @@ var reportDetailQuery = (
3620
3638
  completedAt,
3621
3639
  durationMs,
3622
3640
  tag,
3641
+ title,
3623
3642
  provenance,
3624
3643
  summary,
3625
3644
  comparison
@@ -3642,6 +3661,7 @@ var contentImpactQuery = (
3642
3661
  completedAt,
3643
3662
  durationMs,
3644
3663
  tag,
3664
+ title,
3645
3665
  "mode": provenance.mode,
3646
3666
  "source": provenance.source.name,
3647
3667
  "perspective": provenance.source.perspective,
@@ -3679,6 +3699,7 @@ var recentDocumentEvalsQuery = (
3679
3699
  completedAt,
3680
3700
  durationMs,
3681
3701
  tag,
3702
+ title,
3682
3703
  "mode": provenance.mode,
3683
3704
  "source": provenance.source.name,
3684
3705
  "perspective": provenance.source.perspective,
@@ -3741,6 +3762,7 @@ var comparisonPairQuery = (
3741
3762
  reportId,
3742
3763
  completedAt,
3743
3764
  tag,
3765
+ title,
3744
3766
  provenance,
3745
3767
  summary
3746
3768
  }
@@ -4060,7 +4082,7 @@ function ThreeLayerDeltasTable({
4060
4082
  ] }) });
4061
4083
  }
4062
4084
  function formatOption(r) {
4063
- const label = r.tag ?? r.completedAt.slice(0, 10);
4085
+ const label = r.title ?? r.tag ?? r.completedAt.slice(0, 10);
4064
4086
  return `${label} \u2014 ${r.mode} / ${r.source} (${r.overall.toFixed(1)})`;
4065
4087
  }
4066
4088
 
@@ -5160,7 +5182,7 @@ function ReportRow({
5160
5182
  ) }),
5161
5183
  /* @__PURE__ */ jsxs17(Stack14, { space: 2, children: [
5162
5184
  /* @__PURE__ */ jsxs17(Flex11, { align: "center", gap: 2, wrap: "wrap", children: [
5163
- /* @__PURE__ */ jsx21(Text19, { size: isSmall ? 2 : 3, weight: "semibold", children: report.tag ?? formatCardDate(report.completedAt) }),
5185
+ /* @__PURE__ */ jsx21(Text19, { size: isSmall ? 2 : 3, weight: "semibold", children: report.title ?? report.tag ?? formatCardDate(report.completedAt) }),
5164
5186
  git && /* @__PURE__ */ jsxs17(Flex11, { align: "center", gap: 2, children: [
5165
5187
  git.repo && /* @__PURE__ */ jsx21(Code2, { size: isSmall ? 1 : 2, style: { opacity: 0.7 }, children: git.repo }),
5166
5188
  /* @__PURE__ */ jsxs17(Inline, { space: 1, children: [
@@ -6435,7 +6457,8 @@ var SPAWNED_REPORTS_QUERY = (
6435
6457
  *[_type == $type && provenance.lineage.rerunOf == $reportId] | order(completedAt desc) {
6436
6458
  reportId,
6437
6459
  completedAt,
6438
- tag
6460
+ tag,
6461
+ title
6439
6462
  }
6440
6463
  `
6441
6464
  );
@@ -6524,7 +6547,7 @@ function SpawnedReportRow({
6524
6547
  router.navigate({ reportId: report.reportId });
6525
6548
  }, [report.reportId, router]);
6526
6549
  const dateLabel = formatShortDate(report.completedAt);
6527
- const label = report.tag ?? dateLabel;
6550
+ const label = report.title ?? report.tag ?? dateLabel;
6528
6551
  return /* @__PURE__ */ jsxs22(Flex15, { align: "center", gap: 2, children: [
6529
6552
  /* @__PURE__ */ jsx26(Text24, { size: 2, children: /* @__PURE__ */ jsx26(
6530
6553
  "a",
@@ -6538,7 +6561,7 @@ function SpawnedReportRow({
6538
6561
  children: label
6539
6562
  }
6540
6563
  ) }),
6541
- report.tag && /* @__PURE__ */ jsx26(Text24, { muted: true, size: 1, children: dateLabel }),
6564
+ (report.title ?? report.tag) && /* @__PURE__ */ jsx26(Text24, { muted: true, size: 1, children: dateLabel }),
6542
6565
  /* @__PURE__ */ jsx26(Badge6, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
6543
6566
  ] });
6544
6567
  }
@@ -7680,15 +7703,20 @@ function ReportActions({
7680
7703
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
7681
7704
  import { Button as Button7, Flex as Flex21, Stack as Stack24, Text as Text29 } from "@sanity/ui";
7682
7705
  import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
7683
- function ReportHeader({ completedAt, onBack, tag }) {
7706
+ function ReportHeader({
7707
+ completedAt,
7708
+ onBack,
7709
+ tag,
7710
+ title
7711
+ }) {
7684
7712
  const dateLabel = formatCardDate(completedAt);
7685
- const title = tag ?? dateLabel;
7686
- const hasTag = Boolean(tag);
7713
+ const displayTitle = title ?? tag ?? dateLabel;
7714
+ const hasSubtitle = Boolean(title ?? tag);
7687
7715
  return /* @__PURE__ */ jsxs28(Flex21, { align: "center", gap: 3, children: [
7688
7716
  /* @__PURE__ */ jsx40(Button7, { icon: ArrowLeftIcon2, mode: "bleed", onClick: onBack, text: "Back" }),
7689
7717
  /* @__PURE__ */ jsxs28(Stack24, { flex: 1, space: 1, children: [
7690
- /* @__PURE__ */ jsx40(Text29, { size: 4, weight: "bold", children: title }),
7691
- hasTag && /* @__PURE__ */ jsx40(Text29, { muted: true, size: 2, children: dateLabel })
7718
+ /* @__PURE__ */ jsx40(Text29, { size: 4, weight: "bold", children: displayTitle }),
7719
+ hasSubtitle && /* @__PURE__ */ jsx40(Text29, { muted: true, size: 2, children: dateLabel })
7692
7720
  ] })
7693
7721
  ] });
7694
7722
  }
@@ -9001,7 +9029,8 @@ function ReportDetail({
9001
9029
  {
9002
9030
  completedAt: report.completedAt,
9003
9031
  onBack,
9004
- tag: report.tag
9032
+ tag: report.tag,
9033
+ title: report.title
9005
9034
  }
9006
9035
  ),
9007
9036
  /* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 2, wrap: "wrap", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf-studio",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "AI Literacy Framework — Sanity Studio dashboard plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",