@contractspec/lib.example-shared-ui 6.0.6 → 6.0.10
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/.turbo/turbo-build.log +90 -84
- package/AGENTS.md +43 -25
- package/CHANGELOG.md +24 -0
- package/README.md +63 -35
- package/dist/EvolutionDashboard.js +9 -9
- package/dist/EvolutionSidebar.js +15 -15
- package/dist/LocalDataIndicator.js +3 -3
- package/dist/MarkdownView.d.ts +0 -7
- package/dist/MarkdownView.js +76 -172
- package/dist/PersonalizationInsights.js +12 -12
- package/dist/SaveToStudioButton.js +2 -2
- package/dist/SpecDrivenTemplateShell.d.ts +1 -1
- package/dist/SpecDrivenTemplateShell.js +10 -10
- package/dist/SpecEditorPanel.js +3 -3
- package/dist/TemplateShell.js +10 -10
- package/dist/browser/EvolutionDashboard.js +9 -9
- package/dist/browser/EvolutionSidebar.js +15 -15
- package/dist/browser/LocalDataIndicator.js +3 -3
- package/dist/browser/MarkdownView.js +76 -172
- package/dist/browser/PersonalizationInsights.js +12 -12
- package/dist/browser/SaveToStudioButton.js +2 -2
- package/dist/browser/SpecDrivenTemplateShell.js +10 -10
- package/dist/browser/SpecEditorPanel.js +3 -3
- package/dist/browser/TemplateShell.js +10 -10
- package/dist/browser/hooks/index.js +29 -29
- package/dist/browser/index.js +193 -286
- package/dist/browser/lib/component-registry.js +1 -1
- package/dist/browser/markdown/formatPresentationName.js +9 -0
- package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +29 -29
- package/dist/index.d.ts +12 -11
- package/dist/index.js +193 -286
- package/dist/lib/component-registry.js +1 -1
- package/dist/markdown/formatPresentationName.d.ts +1 -0
- package/dist/markdown/formatPresentationName.js +10 -0
- package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
- package/dist/markdown/useMarkdownPresentation.js +66 -0
- package/dist/node/EvolutionDashboard.js +9 -9
- package/dist/node/EvolutionSidebar.js +15 -15
- package/dist/node/LocalDataIndicator.js +3 -3
- package/dist/node/MarkdownView.js +76 -172
- package/dist/node/PersonalizationInsights.js +12 -12
- package/dist/node/SaveToStudioButton.js +2 -2
- package/dist/node/SpecDrivenTemplateShell.js +10 -10
- package/dist/node/SpecEditorPanel.js +3 -3
- package/dist/node/TemplateShell.js +10 -10
- package/dist/node/hooks/index.js +29 -29
- package/dist/node/index.js +193 -286
- package/dist/node/lib/component-registry.js +1 -1
- package/dist/node/markdown/formatPresentationName.js +9 -0
- package/dist/node/markdown/useMarkdownPresentation.js +65 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +40 -13
- package/src/EvolutionDashboard.tsx +415 -415
- package/src/EvolutionSidebar.tsx +245 -245
- package/src/LocalDataIndicator.tsx +28 -28
- package/src/MarkdownView.tsx +119 -372
- package/src/OverlayContextProvider.tsx +272 -272
- package/src/PersonalizationInsights.tsx +232 -232
- package/src/SaveToStudioButton.tsx +51 -51
- package/src/SpecDrivenTemplateShell.tsx +59 -59
- package/src/SpecEditorPanel.tsx +138 -138
- package/src/TemplateShell.tsx +50 -50
- package/src/bundles/ExampleTemplateBundle.ts +78 -78
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useBehaviorTracking.ts +252 -252
- package/src/hooks/useEvolution.ts +437 -437
- package/src/hooks/useRegistryTemplates.ts +42 -42
- package/src/hooks/useSpecContent.ts +214 -214
- package/src/hooks/useWorkflowComposer.ts +567 -567
- package/src/index.ts +12 -11
- package/src/lib/component-registry.tsx +40 -40
- package/src/lib/runtime-context.tsx +31 -31
- package/src/lib/types.ts +57 -57
- package/src/markdown/formatPresentationName.ts +9 -0
- package/src/markdown/useMarkdownPresentation.ts +107 -0
- package/src/overlay-types.ts +15 -15
- package/src/utils/fetchPresentationData.ts +13 -13
- package/src/utils/generateSpecFromTemplate.ts +29 -29
- package/src/utils/index.ts +1 -1
- package/tsconfig.json +8 -8
|
@@ -154,10 +154,10 @@ function generateRecommendations(featuresUsed, unusedFeatures, mostUsedModes, to
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/PersonalizationInsights.tsx
|
|
157
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
158
157
|
import { Button } from "@contractspec/lib.design-system";
|
|
159
|
-
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
160
158
|
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
159
|
+
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
160
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
161
161
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
162
162
|
"use client";
|
|
163
163
|
function PersonalizationInsights({
|
|
@@ -206,7 +206,7 @@ function PersonalizationInsights({
|
|
|
206
206
|
className: "overflow-hidden",
|
|
207
207
|
children: [
|
|
208
208
|
/* @__PURE__ */ jsxDEV("div", {
|
|
209
|
-
className: "flex items-center justify-between border-
|
|
209
|
+
className: "flex items-center justify-between border-blue-500/20 border-b bg-blue-500/5 px-4 py-3",
|
|
210
210
|
children: [
|
|
211
211
|
/* @__PURE__ */ jsxDEV("div", {
|
|
212
212
|
className: "flex items-center gap-2",
|
|
@@ -231,7 +231,7 @@ function PersonalizationInsights({
|
|
|
231
231
|
}, undefined, false, undefined, this),
|
|
232
232
|
onToggle && /* @__PURE__ */ jsxDEV("button", {
|
|
233
233
|
onClick: onToggle,
|
|
234
|
-
className: "text-muted-foreground hover:text-foreground
|
|
234
|
+
className: "p-1 text-muted-foreground hover:text-foreground",
|
|
235
235
|
type: "button",
|
|
236
236
|
title: "Collapse",
|
|
237
237
|
children: "✕"
|
|
@@ -273,7 +273,7 @@ function PersonalizationInsights({
|
|
|
273
273
|
className: "mb-4",
|
|
274
274
|
children: [
|
|
275
275
|
/* @__PURE__ */ jsxDEV("h4", {
|
|
276
|
-
className: "mb-2
|
|
276
|
+
className: "mb-2 font-semibold text-blue-400 text-xs uppercase",
|
|
277
277
|
children: "Recommendations"
|
|
278
278
|
}, undefined, false, undefined, this),
|
|
279
279
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
@@ -297,7 +297,7 @@ function PersonalizationInsights({
|
|
|
297
297
|
className: "mb-4",
|
|
298
298
|
children: [
|
|
299
299
|
/* @__PURE__ */ jsxDEV("h4", {
|
|
300
|
-
className: "mb-2
|
|
300
|
+
className: "mb-2 font-semibold text-blue-400 text-xs uppercase",
|
|
301
301
|
children: "Try These Features"
|
|
302
302
|
}, undefined, false, undefined, this),
|
|
303
303
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -314,7 +314,7 @@ function PersonalizationInsights({
|
|
|
314
314
|
sessionStart
|
|
315
315
|
}, undefined, false, undefined, this),
|
|
316
316
|
/* @__PURE__ */ jsxDEV("div", {
|
|
317
|
-
className: "mt-4 flex justify-end border-
|
|
317
|
+
className: "mt-4 flex justify-end border-blue-500/10 border-t pt-4",
|
|
318
318
|
children: /* @__PURE__ */ jsxDEV(Button, {
|
|
319
319
|
variant: "ghost",
|
|
320
320
|
size: "sm",
|
|
@@ -346,7 +346,7 @@ function StatCard({
|
|
|
346
346
|
children: icon
|
|
347
347
|
}, undefined, false, undefined, this),
|
|
348
348
|
/* @__PURE__ */ jsxDEV("div", {
|
|
349
|
-
className: "text-lg
|
|
349
|
+
className: "font-bold text-lg",
|
|
350
350
|
children: value
|
|
351
351
|
}, undefined, false, undefined, this),
|
|
352
352
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -361,12 +361,12 @@ function DetailedInsights({
|
|
|
361
361
|
sessionStart
|
|
362
362
|
}) {
|
|
363
363
|
return /* @__PURE__ */ jsxDEV("div", {
|
|
364
|
-
className: "mt-4 space-y-4 border-
|
|
364
|
+
className: "mt-4 space-y-4 border-blue-500/10 border-t pt-4",
|
|
365
365
|
children: [
|
|
366
366
|
summary.mostUsedTemplates.length > 0 && /* @__PURE__ */ jsxDEV("div", {
|
|
367
367
|
children: [
|
|
368
368
|
/* @__PURE__ */ jsxDEV("h4", {
|
|
369
|
-
className: "mb-2
|
|
369
|
+
className: "mb-2 font-semibold text-blue-400 text-xs uppercase",
|
|
370
370
|
children: "Most Used Templates"
|
|
371
371
|
}, undefined, false, undefined, this),
|
|
372
372
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -392,7 +392,7 @@ function DetailedInsights({
|
|
|
392
392
|
summary.mostUsedModes.length > 0 && /* @__PURE__ */ jsxDEV("div", {
|
|
393
393
|
children: [
|
|
394
394
|
/* @__PURE__ */ jsxDEV("h4", {
|
|
395
|
-
className: "mb-2
|
|
395
|
+
className: "mb-2 font-semibold text-blue-400 text-xs uppercase",
|
|
396
396
|
children: "Mode Usage"
|
|
397
397
|
}, undefined, false, undefined, this),
|
|
398
398
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -418,7 +418,7 @@ function DetailedInsights({
|
|
|
418
418
|
/* @__PURE__ */ jsxDEV("div", {
|
|
419
419
|
children: [
|
|
420
420
|
/* @__PURE__ */ jsxDEV("h4", {
|
|
421
|
-
className: "mb-2
|
|
421
|
+
className: "mb-2 font-semibold text-blue-400 text-xs uppercase",
|
|
422
422
|
children: "Features Used"
|
|
423
423
|
}, undefined, false, undefined, this),
|
|
424
424
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -11,8 +11,8 @@ function useTemplateRuntime() {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// src/SaveToStudioButton.tsx
|
|
14
|
-
import { useState } from "react";
|
|
15
14
|
import { Sparkles } from "lucide-react";
|
|
15
|
+
import { useState } from "react";
|
|
16
16
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
17
17
|
"use client";
|
|
18
18
|
function SaveToStudioButton({
|
|
@@ -62,7 +62,7 @@ function SaveToStudioButton({
|
|
|
62
62
|
children: error
|
|
63
63
|
}, undefined, false, undefined, this) : null,
|
|
64
64
|
status === "saved" ? /* @__PURE__ */ jsxDEV("p", {
|
|
65
|
-
className: "text-
|
|
65
|
+
className: "text-emerald-400 text-xs",
|
|
66
66
|
children: "Template sent to Studio."
|
|
67
67
|
}, undefined, false, undefined, this) : null
|
|
68
68
|
]
|
|
@@ -27,7 +27,7 @@ function LocalDataIndicator() {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
return /* @__PURE__ */ jsxDEV("div", {
|
|
30
|
-
className: "
|
|
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
|
|
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: "
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
149
|
+
className: "font-bold text-3xl",
|
|
150
150
|
children: title
|
|
151
151
|
}, undefined, false, undefined, this),
|
|
152
152
|
description ? /* @__PURE__ */ jsxDEV3("p", {
|
|
153
|
-
className: "
|
|
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
|
|
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
|
|
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
|
|
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: "
|
|
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
|
|
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: "
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
146
|
+
className: "font-bold text-3xl",
|
|
147
147
|
children: title
|
|
148
148
|
}, undefined, false, undefined, this),
|
|
149
149
|
description ? /* @__PURE__ */ jsxDEV3("p", {
|
|
150
|
-
className: "
|
|
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
|
|
180
|
+
className: "rounded-2xl border border-border bg-card p-4",
|
|
181
181
|
children: sidebar
|
|
182
182
|
}, undefined, false, undefined, this) : null
|
|
183
183
|
]
|
package/dist/node/hooks/index.js
CHANGED
|
@@ -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,
|