@contractspec/lib.example-shared-ui 3.4.3 → 4.0.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/.turbo/turbo-build.log +36 -27
- package/CHANGELOG.md +20 -0
- package/dist/SpecDrivenTemplateShell.d.ts +19 -0
- package/dist/SpecDrivenTemplateShell.js +195 -0
- package/dist/browser/SpecDrivenTemplateShell.js +194 -0
- package/dist/browser/bundles/ExampleTemplateBundle.js +85 -0
- package/dist/browser/bundles/index.js +85 -0
- package/dist/browser/index.js +107 -33
- package/dist/bundles/ExampleTemplateBundle.d.ts +79 -0
- package/dist/bundles/ExampleTemplateBundle.js +86 -0
- package/dist/bundles/index.d.ts +1 -0
- package/dist/bundles/index.js +86 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +107 -33
- package/dist/node/SpecDrivenTemplateShell.js +194 -0
- package/dist/node/bundles/ExampleTemplateBundle.js +85 -0
- package/dist/node/bundles/index.js +85 -0
- package/dist/node/index.js +107 -33
- package/package.json +74 -7
- package/src/SpecDrivenTemplateShell.tsx +76 -0
- package/src/bundles/ExampleTemplateBundle.ts +91 -0
- package/src/bundles/index.ts +1 -0
- package/src/index.ts +1 -0
package/dist/node/index.js
CHANGED
|
@@ -2128,6 +2128,79 @@ function SaveToStudioButton({
|
|
|
2128
2128
|
}, undefined, true, undefined, this);
|
|
2129
2129
|
}
|
|
2130
2130
|
|
|
2131
|
+
// src/SpecDrivenTemplateShell.tsx
|
|
2132
|
+
import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
|
|
2133
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
2134
|
+
function SpecDrivenTemplateShell({
|
|
2135
|
+
plan,
|
|
2136
|
+
title,
|
|
2137
|
+
description,
|
|
2138
|
+
sidebar,
|
|
2139
|
+
actions,
|
|
2140
|
+
showSaveAction = true,
|
|
2141
|
+
saveProps,
|
|
2142
|
+
children
|
|
2143
|
+
}) {
|
|
2144
|
+
const headerContent = /* @__PURE__ */ jsxDEV8("header", {
|
|
2145
|
+
className: "border-border bg-card rounded-2xl border p-6 shadow-sm",
|
|
2146
|
+
children: [
|
|
2147
|
+
/* @__PURE__ */ jsxDEV8("div", {
|
|
2148
|
+
className: "flex flex-wrap items-center justify-between gap-4",
|
|
2149
|
+
children: [
|
|
2150
|
+
/* @__PURE__ */ jsxDEV8("div", {
|
|
2151
|
+
children: [
|
|
2152
|
+
/* @__PURE__ */ jsxDEV8("p", {
|
|
2153
|
+
className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase",
|
|
2154
|
+
children: "ContractSpec Templates"
|
|
2155
|
+
}, undefined, false, undefined, this),
|
|
2156
|
+
/* @__PURE__ */ jsxDEV8("h1", {
|
|
2157
|
+
className: "text-3xl font-bold",
|
|
2158
|
+
children: title
|
|
2159
|
+
}, undefined, false, undefined, this),
|
|
2160
|
+
description ? /* @__PURE__ */ jsxDEV8("p", {
|
|
2161
|
+
className: "text-muted-foreground mt-2 max-w-2xl text-sm",
|
|
2162
|
+
children: description
|
|
2163
|
+
}, undefined, false, undefined, this) : null
|
|
2164
|
+
]
|
|
2165
|
+
}, undefined, true, undefined, this),
|
|
2166
|
+
/* @__PURE__ */ jsxDEV8("div", {
|
|
2167
|
+
className: "flex flex-col items-end gap-2",
|
|
2168
|
+
children: [
|
|
2169
|
+
/* @__PURE__ */ jsxDEV8(LocalDataIndicator, {}, undefined, false, undefined, this),
|
|
2170
|
+
showSaveAction ? /* @__PURE__ */ jsxDEV8(SaveToStudioButton, {
|
|
2171
|
+
...saveProps
|
|
2172
|
+
}, undefined, false, undefined, this) : null
|
|
2173
|
+
]
|
|
2174
|
+
}, undefined, true, undefined, this)
|
|
2175
|
+
]
|
|
2176
|
+
}, undefined, true, undefined, this),
|
|
2177
|
+
actions ? /* @__PURE__ */ jsxDEV8("div", {
|
|
2178
|
+
className: "mt-4",
|
|
2179
|
+
children: actions
|
|
2180
|
+
}, undefined, false, undefined, this) : null
|
|
2181
|
+
]
|
|
2182
|
+
}, undefined, true, undefined, this);
|
|
2183
|
+
const slotContent = {
|
|
2184
|
+
header: headerContent,
|
|
2185
|
+
primary: /* @__PURE__ */ jsxDEV8("main", {
|
|
2186
|
+
className: "space-y-4 p-2",
|
|
2187
|
+
children
|
|
2188
|
+
}, undefined, false, undefined, this)
|
|
2189
|
+
};
|
|
2190
|
+
if (sidebar != null) {
|
|
2191
|
+
slotContent.sidebar = /* @__PURE__ */ jsxDEV8("aside", {
|
|
2192
|
+
className: "border-border bg-card rounded-2xl border p-4",
|
|
2193
|
+
children: sidebar
|
|
2194
|
+
}, undefined, false, undefined, this);
|
|
2195
|
+
}
|
|
2196
|
+
return /* @__PURE__ */ jsxDEV8(BundleProvider, {
|
|
2197
|
+
plan,
|
|
2198
|
+
children: /* @__PURE__ */ jsxDEV8(BundleRenderer, {
|
|
2199
|
+
slotContent
|
|
2200
|
+
}, undefined, false, undefined, this)
|
|
2201
|
+
}, undefined, false, undefined, this);
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2131
2204
|
// src/utils/generateSpecFromTemplate.ts
|
|
2132
2205
|
function generateSpecFromTemplate(template) {
|
|
2133
2206
|
const templateId = template?.id ?? "unknown";
|
|
@@ -2697,7 +2770,7 @@ function useSpecContent(templateId) {
|
|
|
2697
2770
|
import { useCallback as useCallback8, useEffect as useEffect5 } from "react";
|
|
2698
2771
|
import { Button as Button5, LoaderBlock as LoaderBlock3 } from "@contractspec/lib.design-system";
|
|
2699
2772
|
import { Badge as Badge5 } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
2700
|
-
import { jsxDEV as
|
|
2773
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
2701
2774
|
"use client";
|
|
2702
2775
|
function SpecEditorPanel({
|
|
2703
2776
|
templateId,
|
|
@@ -2739,54 +2812,54 @@ function SpecEditorPanel({
|
|
|
2739
2812
|
onLog?.("Spec reset to template defaults");
|
|
2740
2813
|
}, [reset, onLog]);
|
|
2741
2814
|
if (loading) {
|
|
2742
|
-
return /* @__PURE__ */
|
|
2815
|
+
return /* @__PURE__ */ jsxDEV9(LoaderBlock3, {
|
|
2743
2816
|
label: "Loading spec..."
|
|
2744
2817
|
}, undefined, false, undefined, this);
|
|
2745
2818
|
}
|
|
2746
|
-
return /* @__PURE__ */
|
|
2819
|
+
return /* @__PURE__ */ jsxDEV9("div", {
|
|
2747
2820
|
className: "space-y-4",
|
|
2748
2821
|
children: [
|
|
2749
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
2750
2823
|
className: "flex items-center justify-between",
|
|
2751
2824
|
children: [
|
|
2752
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
2753
2826
|
className: "flex items-center gap-2",
|
|
2754
2827
|
children: [
|
|
2755
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ jsxDEV9(Button5, {
|
|
2756
2829
|
variant: "default",
|
|
2757
2830
|
size: "sm",
|
|
2758
2831
|
onClick: handleSave,
|
|
2759
2832
|
children: "Save"
|
|
2760
2833
|
}, undefined, false, undefined, this),
|
|
2761
|
-
/* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ jsxDEV9(Button5, {
|
|
2762
2835
|
variant: "outline",
|
|
2763
2836
|
size: "sm",
|
|
2764
2837
|
onClick: handleValidate,
|
|
2765
2838
|
children: "Validate"
|
|
2766
2839
|
}, undefined, false, undefined, this),
|
|
2767
|
-
isDirty && /* @__PURE__ */
|
|
2840
|
+
isDirty && /* @__PURE__ */ jsxDEV9(Badge5, {
|
|
2768
2841
|
variant: "secondary",
|
|
2769
2842
|
className: "border-amber-500/30 bg-amber-500/20 text-amber-400",
|
|
2770
2843
|
children: "Unsaved changes"
|
|
2771
2844
|
}, undefined, false, undefined, this),
|
|
2772
|
-
validation && /* @__PURE__ */
|
|
2845
|
+
validation && /* @__PURE__ */ jsxDEV9(Badge5, {
|
|
2773
2846
|
variant: validation.valid ? "default" : "destructive",
|
|
2774
2847
|
className: validation.valid ? "border-green-500/30 bg-green-500/20 text-green-400" : "",
|
|
2775
2848
|
children: validation.valid ? "Valid" : `${validation.errors.filter((e) => e.severity === "error").length} errors`
|
|
2776
2849
|
}, undefined, false, undefined, this)
|
|
2777
2850
|
]
|
|
2778
2851
|
}, undefined, true, undefined, this),
|
|
2779
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
2780
2853
|
className: "flex items-center gap-2",
|
|
2781
2854
|
children: [
|
|
2782
|
-
lastSaved && /* @__PURE__ */
|
|
2855
|
+
lastSaved && /* @__PURE__ */ jsxDEV9("span", {
|
|
2783
2856
|
className: "text-muted-foreground text-xs",
|
|
2784
2857
|
children: [
|
|
2785
2858
|
"Last saved: ",
|
|
2786
2859
|
new Date(lastSaved).toLocaleTimeString()
|
|
2787
2860
|
]
|
|
2788
2861
|
}, undefined, true, undefined, this),
|
|
2789
|
-
/* @__PURE__ */
|
|
2862
|
+
/* @__PURE__ */ jsxDEV9(Button5, {
|
|
2790
2863
|
variant: "ghost",
|
|
2791
2864
|
size: "sm",
|
|
2792
2865
|
onPress: handleReset,
|
|
@@ -2796,16 +2869,16 @@ function SpecEditorPanel({
|
|
|
2796
2869
|
}, undefined, true, undefined, this)
|
|
2797
2870
|
]
|
|
2798
2871
|
}, undefined, true, undefined, this),
|
|
2799
|
-
validation && validation.errors.length > 0 && /* @__PURE__ */
|
|
2872
|
+
validation && validation.errors.length > 0 && /* @__PURE__ */ jsxDEV9("div", {
|
|
2800
2873
|
className: "rounded-lg border border-amber-500/50 bg-amber-500/10 p-3",
|
|
2801
2874
|
children: [
|
|
2802
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsxDEV9("p", {
|
|
2803
2876
|
className: "mb-2 text-xs font-semibold text-amber-400 uppercase",
|
|
2804
2877
|
children: "Validation Issues"
|
|
2805
2878
|
}, undefined, false, undefined, this),
|
|
2806
|
-
/* @__PURE__ */
|
|
2879
|
+
/* @__PURE__ */ jsxDEV9("ul", {
|
|
2807
2880
|
className: "space-y-1",
|
|
2808
|
-
children: validation.errors.map((error, index) => /* @__PURE__ */
|
|
2881
|
+
children: validation.errors.map((error, index) => /* @__PURE__ */ jsxDEV9("li", {
|
|
2809
2882
|
className: `text-xs ${error.severity === "error" ? "text-red-400" : "text-amber-400"}`,
|
|
2810
2883
|
children: [
|
|
2811
2884
|
"Line ",
|
|
@@ -2817,9 +2890,9 @@ function SpecEditorPanel({
|
|
|
2817
2890
|
}, undefined, false, undefined, this)
|
|
2818
2891
|
]
|
|
2819
2892
|
}, undefined, true, undefined, this),
|
|
2820
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ jsxDEV9("div", {
|
|
2821
2894
|
className: "border-border bg-card rounded-2xl border p-4",
|
|
2822
|
-
children: /* @__PURE__ */
|
|
2895
|
+
children: /* @__PURE__ */ jsxDEV9(SpecEditor, {
|
|
2823
2896
|
projectId: "sandbox",
|
|
2824
2897
|
type: "CAPABILITY",
|
|
2825
2898
|
content,
|
|
@@ -2834,7 +2907,7 @@ function SpecEditorPanel({
|
|
|
2834
2907
|
}
|
|
2835
2908
|
|
|
2836
2909
|
// src/TemplateShell.tsx
|
|
2837
|
-
import { jsxDEV as
|
|
2910
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
2838
2911
|
var TemplateShell = ({
|
|
2839
2912
|
title,
|
|
2840
2913
|
description,
|
|
@@ -2843,56 +2916,56 @@ var TemplateShell = ({
|
|
|
2843
2916
|
showSaveAction = true,
|
|
2844
2917
|
saveProps,
|
|
2845
2918
|
children
|
|
2846
|
-
}) => /* @__PURE__ */
|
|
2919
|
+
}) => /* @__PURE__ */ jsxDEV10("div", {
|
|
2847
2920
|
className: "space-y-6",
|
|
2848
2921
|
children: [
|
|
2849
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsxDEV10("header", {
|
|
2850
2923
|
className: "border-border bg-card rounded-2xl border p-6 shadow-sm",
|
|
2851
2924
|
children: [
|
|
2852
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
2853
2926
|
className: "flex flex-wrap items-center justify-between gap-4",
|
|
2854
2927
|
children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
2856
2929
|
children: [
|
|
2857
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsxDEV10("p", {
|
|
2858
2931
|
className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase",
|
|
2859
2932
|
children: "ContractSpec Templates"
|
|
2860
2933
|
}, undefined, false, undefined, this),
|
|
2861
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ jsxDEV10("h1", {
|
|
2862
2935
|
className: "text-3xl font-bold",
|
|
2863
2936
|
children: title
|
|
2864
2937
|
}, undefined, false, undefined, this),
|
|
2865
|
-
description ? /* @__PURE__ */
|
|
2938
|
+
description ? /* @__PURE__ */ jsxDEV10("p", {
|
|
2866
2939
|
className: "text-muted-foreground mt-2 max-w-2xl text-sm",
|
|
2867
2940
|
children: description
|
|
2868
2941
|
}, undefined, false, undefined, this) : null
|
|
2869
2942
|
]
|
|
2870
2943
|
}, undefined, true, undefined, this),
|
|
2871
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
2872
2945
|
className: "flex flex-col items-end gap-2",
|
|
2873
2946
|
children: [
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
showSaveAction ? /* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ jsxDEV10(LocalDataIndicator, {}, undefined, false, undefined, this),
|
|
2948
|
+
showSaveAction ? /* @__PURE__ */ jsxDEV10(SaveToStudioButton, {
|
|
2876
2949
|
...saveProps
|
|
2877
2950
|
}, undefined, false, undefined, this) : null
|
|
2878
2951
|
]
|
|
2879
2952
|
}, undefined, true, undefined, this)
|
|
2880
2953
|
]
|
|
2881
2954
|
}, undefined, true, undefined, this),
|
|
2882
|
-
actions ? /* @__PURE__ */
|
|
2955
|
+
actions ? /* @__PURE__ */ jsxDEV10("div", {
|
|
2883
2956
|
className: "mt-4",
|
|
2884
2957
|
children: actions
|
|
2885
2958
|
}, undefined, false, undefined, this) : null
|
|
2886
2959
|
]
|
|
2887
2960
|
}, undefined, true, undefined, this),
|
|
2888
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
2889
2962
|
className: sidebar ? "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]" : "w-full",
|
|
2890
2963
|
children: [
|
|
2891
|
-
/* @__PURE__ */
|
|
2964
|
+
/* @__PURE__ */ jsxDEV10("main", {
|
|
2892
2965
|
className: "space-y-4 p-2",
|
|
2893
2966
|
children
|
|
2894
2967
|
}, undefined, false, undefined, this),
|
|
2895
|
-
sidebar ? /* @__PURE__ */
|
|
2968
|
+
sidebar ? /* @__PURE__ */ jsxDEV10("aside", {
|
|
2896
2969
|
className: "border-border bg-card rounded-2xl border p-4",
|
|
2897
2970
|
children: sidebar
|
|
2898
2971
|
}, undefined, false, undefined, this) : null
|
|
@@ -3486,6 +3559,7 @@ export {
|
|
|
3486
3559
|
TemplateRuntimeContext,
|
|
3487
3560
|
TemplateComponentRegistry,
|
|
3488
3561
|
SpecEditorPanel,
|
|
3562
|
+
SpecDrivenTemplateShell,
|
|
3489
3563
|
SaveToStudioButton,
|
|
3490
3564
|
PersonalizationInsights,
|
|
3491
3565
|
OverlayContextProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.example-shared-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,6 +10,27 @@
|
|
|
10
10
|
"browser": "./dist/browser/index.js",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./bundles": {
|
|
14
|
+
"types": "./dist/bundles/index.d.ts",
|
|
15
|
+
"bun": "./dist/bundles/index.js",
|
|
16
|
+
"node": "./dist/node/bundles/index.js",
|
|
17
|
+
"browser": "./dist/browser/bundles/index.js",
|
|
18
|
+
"default": "./dist/bundles/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./bundles/ExampleTemplateBundle": {
|
|
21
|
+
"types": "./dist/bundles/ExampleTemplateBundle.d.ts",
|
|
22
|
+
"bun": "./dist/bundles/ExampleTemplateBundle.js",
|
|
23
|
+
"node": "./dist/node/bundles/ExampleTemplateBundle.js",
|
|
24
|
+
"browser": "./dist/browser/bundles/ExampleTemplateBundle.js",
|
|
25
|
+
"default": "./dist/bundles/ExampleTemplateBundle.js"
|
|
26
|
+
},
|
|
27
|
+
"./bundles/index": {
|
|
28
|
+
"types": "./dist/bundles/index.d.ts",
|
|
29
|
+
"bun": "./dist/bundles/index.js",
|
|
30
|
+
"node": "./dist/node/bundles/index.js",
|
|
31
|
+
"browser": "./dist/browser/bundles/index.js",
|
|
32
|
+
"default": "./dist/bundles/index.js"
|
|
33
|
+
},
|
|
13
34
|
"./EvolutionDashboard": {
|
|
14
35
|
"types": "./dist/EvolutionDashboard.d.ts",
|
|
15
36
|
"bun": "./dist/EvolutionDashboard.js",
|
|
@@ -136,6 +157,13 @@
|
|
|
136
157
|
"browser": "./dist/browser/SaveToStudioButton.js",
|
|
137
158
|
"default": "./dist/SaveToStudioButton.js"
|
|
138
159
|
},
|
|
160
|
+
"./SpecDrivenTemplateShell": {
|
|
161
|
+
"types": "./dist/SpecDrivenTemplateShell.d.ts",
|
|
162
|
+
"bun": "./dist/SpecDrivenTemplateShell.js",
|
|
163
|
+
"node": "./dist/node/SpecDrivenTemplateShell.js",
|
|
164
|
+
"browser": "./dist/browser/SpecDrivenTemplateShell.js",
|
|
165
|
+
"default": "./dist/SpecDrivenTemplateShell.js"
|
|
166
|
+
},
|
|
139
167
|
"./SpecEditorPanel": {
|
|
140
168
|
"types": "./dist/SpecEditorPanel.d.ts",
|
|
141
169
|
"bun": "./dist/SpecEditorPanel.js",
|
|
@@ -205,6 +233,27 @@
|
|
|
205
233
|
"browser": "./dist/browser/index.js",
|
|
206
234
|
"default": "./dist/index.js"
|
|
207
235
|
},
|
|
236
|
+
"./bundles": {
|
|
237
|
+
"types": "./dist/bundles/index.d.ts",
|
|
238
|
+
"bun": "./dist/bundles/index.js",
|
|
239
|
+
"node": "./dist/node/bundles/index.js",
|
|
240
|
+
"browser": "./dist/browser/bundles/index.js",
|
|
241
|
+
"default": "./dist/bundles/index.js"
|
|
242
|
+
},
|
|
243
|
+
"./bundles/ExampleTemplateBundle": {
|
|
244
|
+
"types": "./dist/bundles/ExampleTemplateBundle.d.ts",
|
|
245
|
+
"bun": "./dist/bundles/ExampleTemplateBundle.js",
|
|
246
|
+
"node": "./dist/node/bundles/ExampleTemplateBundle.js",
|
|
247
|
+
"browser": "./dist/browser/bundles/ExampleTemplateBundle.js",
|
|
248
|
+
"default": "./dist/bundles/ExampleTemplateBundle.js"
|
|
249
|
+
},
|
|
250
|
+
"./bundles/index": {
|
|
251
|
+
"types": "./dist/bundles/index.d.ts",
|
|
252
|
+
"bun": "./dist/bundles/index.js",
|
|
253
|
+
"node": "./dist/node/bundles/index.js",
|
|
254
|
+
"browser": "./dist/browser/bundles/index.js",
|
|
255
|
+
"default": "./dist/bundles/index.js"
|
|
256
|
+
},
|
|
208
257
|
"./EvolutionDashboard": {
|
|
209
258
|
"types": "./dist/EvolutionDashboard.d.ts",
|
|
210
259
|
"bun": "./dist/EvolutionDashboard.js",
|
|
@@ -331,6 +380,13 @@
|
|
|
331
380
|
"browser": "./dist/browser/SaveToStudioButton.js",
|
|
332
381
|
"default": "./dist/SaveToStudioButton.js"
|
|
333
382
|
},
|
|
383
|
+
"./SpecDrivenTemplateShell": {
|
|
384
|
+
"types": "./dist/SpecDrivenTemplateShell.d.ts",
|
|
385
|
+
"bun": "./dist/SpecDrivenTemplateShell.js",
|
|
386
|
+
"node": "./dist/node/SpecDrivenTemplateShell.js",
|
|
387
|
+
"browser": "./dist/browser/SpecDrivenTemplateShell.js",
|
|
388
|
+
"default": "./dist/SpecDrivenTemplateShell.js"
|
|
389
|
+
},
|
|
334
390
|
"./SpecEditorPanel": {
|
|
335
391
|
"types": "./dist/SpecEditorPanel.d.ts",
|
|
336
392
|
"bun": "./dist/SpecEditorPanel.js",
|
|
@@ -375,24 +431,35 @@
|
|
|
375
431
|
}
|
|
376
432
|
}
|
|
377
433
|
},
|
|
434
|
+
"peerDependencies": {
|
|
435
|
+
"@contractspec/lib.surface-runtime": "0.3.0"
|
|
436
|
+
},
|
|
437
|
+
"peerDependenciesMeta": {
|
|
438
|
+
"@contractspec/lib.surface-runtime": {
|
|
439
|
+
"optional": true
|
|
440
|
+
}
|
|
441
|
+
},
|
|
378
442
|
"dependencies": {
|
|
379
443
|
"@apollo/client": "^4.1.6",
|
|
380
|
-
"@contractspec/lib.contracts-spec": "3.
|
|
381
|
-
"@contractspec/lib.design-system": "3.
|
|
382
|
-
"@contractspec/lib.ui-kit-web": "3.
|
|
444
|
+
"@contractspec/lib.contracts-spec": "3.5.0",
|
|
445
|
+
"@contractspec/lib.design-system": "3.5.0",
|
|
446
|
+
"@contractspec/lib.ui-kit-web": "3.5.0",
|
|
383
447
|
"@tanstack/react-query": "^5.90.21",
|
|
384
|
-
"framer-motion": "^12.35.
|
|
448
|
+
"framer-motion": "^12.35.1",
|
|
385
449
|
"lucide-react": "^0.577.0",
|
|
386
450
|
"react": "19.2.4",
|
|
387
451
|
"react-dom": "19.2.4"
|
|
388
452
|
},
|
|
453
|
+
"optionalDependencies": {
|
|
454
|
+
"@contractspec/lib.surface-runtime": "0.3.0"
|
|
455
|
+
},
|
|
389
456
|
"devDependencies": {
|
|
390
|
-
"@contractspec/tool.typescript": "3.
|
|
457
|
+
"@contractspec/tool.typescript": "3.5.0",
|
|
391
458
|
"@types/react": "^19.2.14",
|
|
392
459
|
"@types/react-dom": "^19.2.2",
|
|
393
460
|
"eslint": "^9.39.2",
|
|
394
461
|
"typescript": "^5.9.3",
|
|
395
|
-
"@contractspec/tool.bun": "3.
|
|
462
|
+
"@contractspec/tool.bun": "3.5.0"
|
|
396
463
|
},
|
|
397
464
|
"types": "./dist/index.d.ts"
|
|
398
465
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { BundleProvider, BundleRenderer } from '@contractspec/lib.surface-runtime/react';
|
|
3
|
+
import type { ResolvedSurfacePlan } from '@contractspec/lib.surface-runtime/runtime/resolve-bundle';
|
|
4
|
+
import { LocalDataIndicator } from './LocalDataIndicator';
|
|
5
|
+
import {
|
|
6
|
+
SaveToStudioButton,
|
|
7
|
+
type SaveToStudioButtonProps,
|
|
8
|
+
} from './SaveToStudioButton';
|
|
9
|
+
|
|
10
|
+
export interface SpecDrivenTemplateShellProps {
|
|
11
|
+
plan: ResolvedSurfacePlan;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
sidebar?: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
showSaveAction?: boolean;
|
|
18
|
+
saveProps?: SaveToStudioButtonProps;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Template shell driven by surface-runtime bundle spec.
|
|
23
|
+
* Uses BundleRenderer for adaptive, preference-driven layouts.
|
|
24
|
+
* Requires @contractspec/lib.surface-runtime as peer dependency.
|
|
25
|
+
*/
|
|
26
|
+
export function SpecDrivenTemplateShell({
|
|
27
|
+
plan,
|
|
28
|
+
title,
|
|
29
|
+
description,
|
|
30
|
+
sidebar,
|
|
31
|
+
actions,
|
|
32
|
+
showSaveAction = true,
|
|
33
|
+
saveProps,
|
|
34
|
+
children,
|
|
35
|
+
}: SpecDrivenTemplateShellProps) {
|
|
36
|
+
const headerContent = (
|
|
37
|
+
<header className="border-border bg-card rounded-2xl border p-6 shadow-sm">
|
|
38
|
+
<div className="flex flex-wrap items-center justify-between gap-4">
|
|
39
|
+
<div>
|
|
40
|
+
<p className="text-muted-foreground text-sm font-semibold tracking-wide uppercase">
|
|
41
|
+
ContractSpec Templates
|
|
42
|
+
</p>
|
|
43
|
+
<h1 className="text-3xl font-bold">{title}</h1>
|
|
44
|
+
{description ? (
|
|
45
|
+
<p className="text-muted-foreground mt-2 max-w-2xl text-sm">
|
|
46
|
+
{description}
|
|
47
|
+
</p>
|
|
48
|
+
) : null}
|
|
49
|
+
</div>
|
|
50
|
+
<div className="flex flex-col items-end gap-2">
|
|
51
|
+
<LocalDataIndicator />
|
|
52
|
+
{showSaveAction ? <SaveToStudioButton {...saveProps} /> : null}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
{actions ? <div className="mt-4">{actions}</div> : null}
|
|
56
|
+
</header>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const slotContent: Partial<Record<string, ReactNode>> = {
|
|
60
|
+
header: headerContent,
|
|
61
|
+
primary: <main className="space-y-4 p-2">{children}</main>,
|
|
62
|
+
};
|
|
63
|
+
if (sidebar != null) {
|
|
64
|
+
slotContent.sidebar = (
|
|
65
|
+
<aside className="border-border bg-card rounded-2xl border p-4">
|
|
66
|
+
{sidebar}
|
|
67
|
+
</aside>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<BundleProvider plan={plan}>
|
|
73
|
+
<BundleRenderer slotContent={slotContent} />
|
|
74
|
+
</BundleProvider>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal bundle spec for example template shells.
|
|
3
|
+
* Requires @contractspec/lib.surface-runtime when used.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { defineModuleBundle } from '@contractspec/lib.surface-runtime/spec';
|
|
7
|
+
|
|
8
|
+
export const ExampleTemplateBundle = defineModuleBundle({
|
|
9
|
+
meta: {
|
|
10
|
+
key: 'example.template',
|
|
11
|
+
version: '0.1.0',
|
|
12
|
+
title: 'Example Template',
|
|
13
|
+
description: 'Adaptive template shell for ContractSpec examples',
|
|
14
|
+
owners: ['team-platform'],
|
|
15
|
+
tags: ['example', 'template'],
|
|
16
|
+
stability: 'experimental',
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
routes: [
|
|
20
|
+
{
|
|
21
|
+
routeId: 'template',
|
|
22
|
+
path: '/sandbox',
|
|
23
|
+
defaultSurface: 'template-shell',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
surfaces: {
|
|
28
|
+
'template-shell': {
|
|
29
|
+
surfaceId: 'template-shell',
|
|
30
|
+
kind: 'workbench',
|
|
31
|
+
title: 'Template Shell',
|
|
32
|
+
slots: [
|
|
33
|
+
{
|
|
34
|
+
slotId: 'header',
|
|
35
|
+
role: 'header',
|
|
36
|
+
accepts: ['action-bar'],
|
|
37
|
+
cardinality: 'many',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
slotId: 'primary',
|
|
41
|
+
role: 'primary',
|
|
42
|
+
accepts: ['entity-section', 'rich-doc', 'form', 'custom-widget'],
|
|
43
|
+
cardinality: 'many',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
slotId: 'sidebar',
|
|
47
|
+
role: 'secondary',
|
|
48
|
+
accepts: ['entity-section', 'custom-widget'],
|
|
49
|
+
cardinality: 'one',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
|
|
53
|
+
layouts: [
|
|
54
|
+
{
|
|
55
|
+
layoutId: 'main-with-sidebar',
|
|
56
|
+
title: 'Main with sidebar',
|
|
57
|
+
root: {
|
|
58
|
+
type: 'panel-group',
|
|
59
|
+
direction: 'horizontal',
|
|
60
|
+
persistKey: 'example.template.main-sidebar',
|
|
61
|
+
children: [
|
|
62
|
+
{
|
|
63
|
+
type: 'panel-group',
|
|
64
|
+
direction: 'vertical',
|
|
65
|
+
persistKey: 'example.template.content',
|
|
66
|
+
children: [
|
|
67
|
+
{ type: 'slot', slotId: 'header' },
|
|
68
|
+
{ type: 'slot', slotId: 'primary' },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{ type: 'slot', slotId: 'sidebar' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
data: [],
|
|
77
|
+
|
|
78
|
+
verification: {
|
|
79
|
+
dimensions: {
|
|
80
|
+
guidance: 'Can reveal hints and walkthrough notes.',
|
|
81
|
+
density: 'Can select compact or balanced layouts.',
|
|
82
|
+
dataDepth: 'Controls content depth and expansion.',
|
|
83
|
+
control: 'Shows advanced options when allowed.',
|
|
84
|
+
media: 'Supports text-first and hybrid modes.',
|
|
85
|
+
pace: 'Maps to motion tokens and transitions.',
|
|
86
|
+
narrative: 'Can order summary before or after detail.',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExampleTemplateBundle } from './ExampleTemplateBundle';
|