@contractspec/lib.example-shared-ui 6.0.5 → 6.0.7

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 (82) hide show
  1. package/.turbo/turbo-build.log +90 -84
  2. package/AGENTS.md +43 -25
  3. package/CHANGELOG.md +11 -0
  4. package/README.md +63 -35
  5. package/dist/EvolutionDashboard.js +9 -9
  6. package/dist/EvolutionSidebar.js +15 -15
  7. package/dist/LocalDataIndicator.js +3 -3
  8. package/dist/MarkdownView.d.ts +0 -7
  9. package/dist/MarkdownView.js +76 -172
  10. package/dist/PersonalizationInsights.js +12 -12
  11. package/dist/SaveToStudioButton.js +2 -2
  12. package/dist/SpecDrivenTemplateShell.d.ts +1 -1
  13. package/dist/SpecDrivenTemplateShell.js +10 -10
  14. package/dist/SpecEditorPanel.js +3 -3
  15. package/dist/TemplateShell.js +10 -10
  16. package/dist/browser/EvolutionDashboard.js +9 -9
  17. package/dist/browser/EvolutionSidebar.js +15 -15
  18. package/dist/browser/LocalDataIndicator.js +3 -3
  19. package/dist/browser/MarkdownView.js +76 -172
  20. package/dist/browser/PersonalizationInsights.js +12 -12
  21. package/dist/browser/SaveToStudioButton.js +2 -2
  22. package/dist/browser/SpecDrivenTemplateShell.js +10 -10
  23. package/dist/browser/SpecEditorPanel.js +3 -3
  24. package/dist/browser/TemplateShell.js +10 -10
  25. package/dist/browser/hooks/index.js +29 -29
  26. package/dist/browser/index.js +193 -286
  27. package/dist/browser/lib/component-registry.js +1 -1
  28. package/dist/browser/markdown/formatPresentationName.js +9 -0
  29. package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
  30. package/dist/hooks/index.d.ts +3 -3
  31. package/dist/hooks/index.js +29 -29
  32. package/dist/index.d.ts +12 -11
  33. package/dist/index.js +193 -286
  34. package/dist/lib/component-registry.js +1 -1
  35. package/dist/markdown/formatPresentationName.d.ts +1 -0
  36. package/dist/markdown/formatPresentationName.js +10 -0
  37. package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
  38. package/dist/markdown/useMarkdownPresentation.js +66 -0
  39. package/dist/node/EvolutionDashboard.js +9 -9
  40. package/dist/node/EvolutionSidebar.js +15 -15
  41. package/dist/node/LocalDataIndicator.js +3 -3
  42. package/dist/node/MarkdownView.js +76 -172
  43. package/dist/node/PersonalizationInsights.js +12 -12
  44. package/dist/node/SaveToStudioButton.js +2 -2
  45. package/dist/node/SpecDrivenTemplateShell.js +10 -10
  46. package/dist/node/SpecEditorPanel.js +3 -3
  47. package/dist/node/TemplateShell.js +10 -10
  48. package/dist/node/hooks/index.js +29 -29
  49. package/dist/node/index.js +193 -286
  50. package/dist/node/lib/component-registry.js +1 -1
  51. package/dist/node/markdown/formatPresentationName.js +9 -0
  52. package/dist/node/markdown/useMarkdownPresentation.js +65 -0
  53. package/dist/utils/index.d.ts +1 -1
  54. package/package.json +40 -13
  55. package/src/EvolutionDashboard.tsx +415 -415
  56. package/src/EvolutionSidebar.tsx +245 -245
  57. package/src/LocalDataIndicator.tsx +28 -28
  58. package/src/MarkdownView.tsx +119 -372
  59. package/src/OverlayContextProvider.tsx +272 -272
  60. package/src/PersonalizationInsights.tsx +232 -232
  61. package/src/SaveToStudioButton.tsx +51 -51
  62. package/src/SpecDrivenTemplateShell.tsx +59 -59
  63. package/src/SpecEditorPanel.tsx +138 -138
  64. package/src/TemplateShell.tsx +50 -50
  65. package/src/bundles/ExampleTemplateBundle.ts +78 -78
  66. package/src/hooks/index.ts +3 -3
  67. package/src/hooks/useBehaviorTracking.ts +252 -252
  68. package/src/hooks/useEvolution.ts +437 -437
  69. package/src/hooks/useRegistryTemplates.ts +42 -42
  70. package/src/hooks/useSpecContent.ts +214 -214
  71. package/src/hooks/useWorkflowComposer.ts +567 -567
  72. package/src/index.ts +12 -11
  73. package/src/lib/component-registry.tsx +40 -40
  74. package/src/lib/runtime-context.tsx +31 -31
  75. package/src/lib/types.ts +57 -57
  76. package/src/markdown/formatPresentationName.ts +9 -0
  77. package/src/markdown/useMarkdownPresentation.ts +107 -0
  78. package/src/overlay-types.ts +15 -15
  79. package/src/utils/fetchPresentationData.ts +13 -13
  80. package/src/utils/generateSpecFromTemplate.ts +29 -29
  81. package/src/utils/index.ts +1 -1
  82. package/tsconfig.json +8 -8
@@ -27,7 +27,7 @@ function LocalDataIndicator() {
27
27
  }
28
28
  };
29
29
  return /* @__PURE__ */ jsxDEV("div", {
30
- className: "border-border bg-muted/40 text-muted-foreground inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs",
30
+ className: "inline-flex items-center gap-2 rounded-full border border-border bg-muted/40 px-3 py-1 text-muted-foreground text-xs",
31
31
  children: [
32
32
  /* @__PURE__ */ jsxDEV(Shield, {
33
33
  className: "h-3.5 w-3.5 text-violet-400"
@@ -37,14 +37,14 @@ function LocalDataIndicator() {
37
37
  "Local runtime ·",
38
38
  " ",
39
39
  /* @__PURE__ */ jsxDEV("span", {
40
- className: "text-foreground font-semibold",
40
+ className: "font-semibold text-foreground",
41
41
  children: template.name
42
42
  }, undefined, false, undefined, this)
43
43
  ]
44
44
  }, undefined, true, undefined, this),
45
45
  /* @__PURE__ */ jsxDEV("button", {
46
46
  type: "button",
47
- className: "border-border text-muted-foreground hover:text-foreground inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-semibold",
47
+ className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 font-semibold text-[11px] text-muted-foreground hover:text-foreground",
48
48
  onClick: handleReset,
49
49
  disabled: isResetting,
50
50
  children: [
@@ -59,8 +59,8 @@ function LocalDataIndicator() {
59
59
  }
60
60
 
61
61
  // src/SaveToStudioButton.tsx
62
- import { useState as useState2 } from "react";
63
62
  import { Sparkles } from "lucide-react";
63
+ import { useState as useState2 } from "react";
64
64
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
65
65
  "use client";
66
66
  function SaveToStudioButton({
@@ -110,7 +110,7 @@ function SaveToStudioButton({
110
110
  children: error
111
111
  }, undefined, false, undefined, this) : null,
112
112
  status === "saved" ? /* @__PURE__ */ jsxDEV2("p", {
113
- className: "text-xs text-emerald-400",
113
+ className: "text-emerald-400 text-xs",
114
114
  children: "Template sent to Studio."
115
115
  }, undefined, false, undefined, this) : null
116
116
  ]
@@ -134,7 +134,7 @@ function SpecDrivenTemplateShell({
134
134
  children
135
135
  }) {
136
136
  const headerContent = /* @__PURE__ */ jsxDEV3("header", {
137
- className: "border-border bg-card rounded-2xl border p-6 shadow-sm",
137
+ className: "rounded-2xl border border-border bg-card p-6 shadow-sm",
138
138
  children: [
139
139
  /* @__PURE__ */ jsxDEV3("div", {
140
140
  className: "flex flex-wrap items-center justify-between gap-4",
@@ -142,15 +142,15 @@ function SpecDrivenTemplateShell({
142
142
  /* @__PURE__ */ jsxDEV3("div", {
143
143
  children: [
144
144
  /* @__PURE__ */ jsxDEV3("p", {
145
- className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase",
145
+ className: "font-semibold text-muted-foreground text-sm uppercase tracking-wide",
146
146
  children: "ContractSpec Templates"
147
147
  }, undefined, false, undefined, this),
148
148
  /* @__PURE__ */ jsxDEV3("h1", {
149
- className: "text-3xl font-bold",
149
+ className: "font-bold text-3xl",
150
150
  children: title
151
151
  }, undefined, false, undefined, this),
152
152
  description ? /* @__PURE__ */ jsxDEV3("p", {
153
- className: "text-muted-foreground mt-2 max-w-2xl text-sm",
153
+ className: "mt-2 max-w-2xl text-muted-foreground text-sm",
154
154
  children: description
155
155
  }, undefined, false, undefined, this) : null
156
156
  ]
@@ -181,7 +181,7 @@ function SpecDrivenTemplateShell({
181
181
  };
182
182
  if (sidebar != null) {
183
183
  slotContent.sidebar = /* @__PURE__ */ jsxDEV3("aside", {
184
- className: "border-border bg-card rounded-2xl border p-4",
184
+ className: "rounded-2xl border border-border bg-card p-4",
185
185
  children: sidebar
186
186
  }, undefined, false, undefined, this);
187
187
  }
@@ -576,9 +576,9 @@ function useSpecContent(templateId) {
576
576
  }
577
577
 
578
578
  // src/SpecEditorPanel.tsx
579
- import { useCallback as useCallback2, useEffect as useEffect2 } from "react";
580
579
  import { Button, LoaderBlock } from "@contractspec/lib.design-system";
581
580
  import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
581
+ import { useCallback as useCallback2, useEffect as useEffect2 } from "react";
582
582
  import { jsxDEV } from "react/jsx-dev-runtime";
583
583
  "use client";
584
584
  function SpecEditorPanel({
@@ -682,7 +682,7 @@ function SpecEditorPanel({
682
682
  className: "rounded-lg border border-amber-500/50 bg-amber-500/10 p-3",
683
683
  children: [
684
684
  /* @__PURE__ */ jsxDEV("p", {
685
- className: "mb-2 text-xs font-semibold text-amber-400 uppercase",
685
+ className: "mb-2 font-semibold text-amber-400 text-xs uppercase",
686
686
  children: "Validation Issues"
687
687
  }, undefined, false, undefined, this),
688
688
  /* @__PURE__ */ jsxDEV("ul", {
@@ -700,7 +700,7 @@ function SpecEditorPanel({
700
700
  ]
701
701
  }, undefined, true, undefined, this),
702
702
  /* @__PURE__ */ jsxDEV("div", {
703
- className: "border-border bg-card rounded-2xl border p-4",
703
+ className: "rounded-2xl border border-border bg-card p-4",
704
704
  children: /* @__PURE__ */ jsxDEV(SpecEditor, {
705
705
  projectId: "sandbox",
706
706
  type: "CAPABILITY",
@@ -27,7 +27,7 @@ function LocalDataIndicator() {
27
27
  }
28
28
  };
29
29
  return /* @__PURE__ */ jsxDEV("div", {
30
- className: "border-border bg-muted/40 text-muted-foreground inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs",
30
+ className: "inline-flex items-center gap-2 rounded-full border border-border bg-muted/40 px-3 py-1 text-muted-foreground text-xs",
31
31
  children: [
32
32
  /* @__PURE__ */ jsxDEV(Shield, {
33
33
  className: "h-3.5 w-3.5 text-violet-400"
@@ -37,14 +37,14 @@ function LocalDataIndicator() {
37
37
  "Local runtime ·",
38
38
  " ",
39
39
  /* @__PURE__ */ jsxDEV("span", {
40
- className: "text-foreground font-semibold",
40
+ className: "font-semibold text-foreground",
41
41
  children: template.name
42
42
  }, undefined, false, undefined, this)
43
43
  ]
44
44
  }, undefined, true, undefined, this),
45
45
  /* @__PURE__ */ jsxDEV("button", {
46
46
  type: "button",
47
- className: "border-border text-muted-foreground hover:text-foreground inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-semibold",
47
+ className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 font-semibold text-[11px] text-muted-foreground hover:text-foreground",
48
48
  onClick: handleReset,
49
49
  disabled: isResetting,
50
50
  children: [
@@ -59,8 +59,8 @@ function LocalDataIndicator() {
59
59
  }
60
60
 
61
61
  // src/SaveToStudioButton.tsx
62
- import { useState as useState2 } from "react";
63
62
  import { Sparkles } from "lucide-react";
63
+ import { useState as useState2 } from "react";
64
64
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
65
65
  "use client";
66
66
  function SaveToStudioButton({
@@ -110,7 +110,7 @@ function SaveToStudioButton({
110
110
  children: error
111
111
  }, undefined, false, undefined, this) : null,
112
112
  status === "saved" ? /* @__PURE__ */ jsxDEV2("p", {
113
- className: "text-xs text-emerald-400",
113
+ className: "text-emerald-400 text-xs",
114
114
  children: "Template sent to Studio."
115
115
  }, undefined, false, undefined, this) : null
116
116
  ]
@@ -131,7 +131,7 @@ var TemplateShell = ({
131
131
  className: "space-y-6",
132
132
  children: [
133
133
  /* @__PURE__ */ jsxDEV3("header", {
134
- className: "border-border bg-card rounded-2xl border p-6 shadow-sm",
134
+ className: "rounded-2xl border border-border bg-card p-6 shadow-sm",
135
135
  children: [
136
136
  /* @__PURE__ */ jsxDEV3("div", {
137
137
  className: "flex flex-wrap items-center justify-between gap-4",
@@ -139,15 +139,15 @@ var TemplateShell = ({
139
139
  /* @__PURE__ */ jsxDEV3("div", {
140
140
  children: [
141
141
  /* @__PURE__ */ jsxDEV3("p", {
142
- className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase",
142
+ className: "font-semibold text-muted-foreground text-sm uppercase tracking-wide",
143
143
  children: "ContractSpec Templates"
144
144
  }, undefined, false, undefined, this),
145
145
  /* @__PURE__ */ jsxDEV3("h1", {
146
- className: "text-3xl font-bold",
146
+ className: "font-bold text-3xl",
147
147
  children: title
148
148
  }, undefined, false, undefined, this),
149
149
  description ? /* @__PURE__ */ jsxDEV3("p", {
150
- className: "text-muted-foreground mt-2 max-w-2xl text-sm",
150
+ className: "mt-2 max-w-2xl text-muted-foreground text-sm",
151
151
  children: description
152
152
  }, undefined, false, undefined, this) : null
153
153
  ]
@@ -177,7 +177,7 @@ var TemplateShell = ({
177
177
  children
178
178
  }, undefined, false, undefined, this),
179
179
  sidebar ? /* @__PURE__ */ jsxDEV3("aside", {
180
- className: "border-border bg-card rounded-2xl border p-4",
180
+ className: "rounded-2xl border border-border bg-card p-4",
181
181
  children: sidebar
182
182
  }, undefined, false, undefined, this) : null
183
183
  ]
@@ -988,6 +988,35 @@ function useSpecContent(templateId) {
988
988
  };
989
989
  }
990
990
 
991
+ // src/hooks/useRegistryTemplates.ts
992
+ import { useQuery } from "@tanstack/react-query";
993
+ function useRegistryTemplates() {
994
+ return useQuery({
995
+ queryKey: ["registryTemplates"],
996
+ queryFn: async () => {
997
+ const registryUrl = process.env.NEXT_PUBLIC_CONTRACTSPEC_REGISTRY_URL ?? "";
998
+ if (!registryUrl)
999
+ return [];
1000
+ const res = await fetch(`${registryUrl.replace(/\/$/, "")}/r/contractspec.json`, {
1001
+ method: "GET",
1002
+ headers: { Accept: "application/json" }
1003
+ });
1004
+ if (!res.ok)
1005
+ return [];
1006
+ const json = await res.json();
1007
+ const items = json.items ?? [];
1008
+ return items.filter((i) => i.type === "contractspec:template").map((i) => ({
1009
+ id: i.name,
1010
+ name: i.title ?? i.name,
1011
+ description: i.description,
1012
+ tags: i.meta?.tags ?? [],
1013
+ source: "registry",
1014
+ registryUrl
1015
+ }));
1016
+ }
1017
+ });
1018
+ }
1019
+
991
1020
  // src/hooks/useWorkflowComposer.ts
992
1021
  import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
993
1022
  "use client";
@@ -1478,35 +1507,6 @@ function getTemplateWorkflows(templateId) {
1478
1507
  };
1479
1508
  return templateWorkflows[templateId] ?? [];
1480
1509
  }
1481
-
1482
- // src/hooks/useRegistryTemplates.ts
1483
- import { useQuery } from "@tanstack/react-query";
1484
- function useRegistryTemplates() {
1485
- return useQuery({
1486
- queryKey: ["registryTemplates"],
1487
- queryFn: async () => {
1488
- const registryUrl = process.env.NEXT_PUBLIC_CONTRACTSPEC_REGISTRY_URL ?? "";
1489
- if (!registryUrl)
1490
- return [];
1491
- const res = await fetch(`${registryUrl.replace(/\/$/, "")}/r/contractspec.json`, {
1492
- method: "GET",
1493
- headers: { Accept: "application/json" }
1494
- });
1495
- if (!res.ok)
1496
- return [];
1497
- const json = await res.json();
1498
- const items = json.items ?? [];
1499
- return items.filter((i) => i.type === "contractspec:template").map((i) => ({
1500
- id: i.name,
1501
- name: i.title ?? i.name,
1502
- description: i.description,
1503
- tags: i.meta?.tags ?? [],
1504
- source: "registry",
1505
- registryUrl
1506
- }));
1507
- }
1508
- });
1509
- }
1510
1510
  export {
1511
1511
  useWorkflowComposer,
1512
1512
  useSpecContent,