@contractspec/bundle.marketing 3.8.8 → 3.8.9

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 (76) hide show
  1. package/.turbo/turbo-build.log +64 -32
  2. package/CHANGELOG.md +30 -0
  3. package/dist/browser/components/templates/TemplateCard.js +83 -0
  4. package/dist/browser/components/templates/TemplateCommandDialog.js +110 -0
  5. package/dist/browser/components/templates/TemplatePreviewContent.js +96 -0
  6. package/dist/browser/components/templates/TemplatesBrowseControls.js +115 -0
  7. package/dist/browser/components/templates/TemplatesCatalogSection.js +284 -0
  8. package/dist/browser/components/templates/TemplatesClientPage.js +840 -917
  9. package/dist/browser/components/templates/TemplatesHeroSection.js +87 -0
  10. package/dist/browser/components/templates/TemplatesNextStepsSection.js +126 -0
  11. package/dist/browser/components/templates/TemplatesPreviewModal.js +136 -126
  12. package/dist/browser/components/templates/index.js +873 -950
  13. package/dist/browser/components/templates/template-catalog.js +81 -0
  14. package/dist/browser/components/templates/template-new.js +23 -0
  15. package/dist/browser/components/templates/template-preview.js +43 -0
  16. package/dist/browser/components/templates/template-source.js +19 -0
  17. package/dist/browser/index.js +873 -950
  18. package/dist/components/templates/TemplateCard.d.ts +12 -0
  19. package/dist/components/templates/TemplateCard.js +78 -0
  20. package/dist/components/templates/TemplateCommandDialog.d.ts +6 -0
  21. package/dist/components/templates/TemplateCommandDialog.js +105 -0
  22. package/dist/components/templates/TemplatePreviewContent.d.ts +5 -0
  23. package/dist/components/templates/TemplatePreviewContent.js +91 -0
  24. package/dist/components/templates/TemplatesBrowseControls.d.ts +13 -0
  25. package/dist/components/templates/TemplatesBrowseControls.js +110 -0
  26. package/dist/components/templates/TemplatesCatalogSection.d.ts +14 -0
  27. package/dist/components/templates/TemplatesCatalogSection.js +279 -0
  28. package/dist/components/templates/TemplatesClientPage.js +840 -917
  29. package/dist/components/templates/TemplatesHeroSection.d.ts +5 -0
  30. package/dist/components/templates/TemplatesHeroSection.js +82 -0
  31. package/dist/components/templates/TemplatesNextStepsSection.d.ts +1 -0
  32. package/dist/components/templates/TemplatesNextStepsSection.js +121 -0
  33. package/dist/components/templates/TemplatesPreviewModal.d.ts +3 -4
  34. package/dist/components/templates/TemplatesPreviewModal.js +136 -126
  35. package/dist/components/templates/index.js +873 -950
  36. package/dist/components/templates/template-catalog.d.ts +27 -0
  37. package/dist/components/templates/template-catalog.js +76 -0
  38. package/dist/components/templates/template-catalog.test.d.ts +1 -0
  39. package/dist/components/templates/template-new.d.ts +2 -0
  40. package/dist/components/templates/template-new.js +18 -0
  41. package/dist/components/templates/template-preview.d.ts +18 -0
  42. package/dist/components/templates/template-preview.js +38 -0
  43. package/dist/components/templates/template-source.d.ts +3 -0
  44. package/dist/components/templates/template-source.js +14 -0
  45. package/dist/index.js +873 -950
  46. package/dist/node/components/templates/TemplateCard.js +78 -0
  47. package/dist/node/components/templates/TemplateCommandDialog.js +105 -0
  48. package/dist/node/components/templates/TemplatePreviewContent.js +91 -0
  49. package/dist/node/components/templates/TemplatesBrowseControls.js +110 -0
  50. package/dist/node/components/templates/TemplatesCatalogSection.js +279 -0
  51. package/dist/node/components/templates/TemplatesClientPage.js +840 -917
  52. package/dist/node/components/templates/TemplatesHeroSection.js +82 -0
  53. package/dist/node/components/templates/TemplatesNextStepsSection.js +121 -0
  54. package/dist/node/components/templates/TemplatesPreviewModal.js +136 -126
  55. package/dist/node/components/templates/index.js +873 -950
  56. package/dist/node/components/templates/template-catalog.js +76 -0
  57. package/dist/node/components/templates/template-new.js +18 -0
  58. package/dist/node/components/templates/template-preview.js +38 -0
  59. package/dist/node/components/templates/template-source.js +14 -0
  60. package/dist/node/index.js +873 -950
  61. package/package.json +181 -26
  62. package/src/components/templates/TemplateCard.tsx +74 -0
  63. package/src/components/templates/TemplateCommandDialog.tsx +92 -0
  64. package/src/components/templates/TemplatePreviewContent.tsx +182 -0
  65. package/src/components/templates/TemplatesBrowseControls.tsx +120 -0
  66. package/src/components/templates/TemplatesCatalogSection.tsx +166 -0
  67. package/src/components/templates/TemplatesClientPage.tsx +109 -741
  68. package/src/components/templates/TemplatesHeroSection.tsx +41 -0
  69. package/src/components/templates/TemplatesNextStepsSection.tsx +80 -0
  70. package/src/components/templates/TemplatesPreviewModal.tsx +19 -294
  71. package/src/components/templates/template-catalog.test.ts +66 -0
  72. package/src/components/templates/template-catalog.ts +132 -0
  73. package/src/components/templates/template-new.ts +12 -0
  74. package/src/components/templates/template-preview.ts +57 -0
  75. package/src/components/templates/template-source.ts +13 -0
  76. package/.turbo/turbo-prebuild.log +0 -1
@@ -0,0 +1,279 @@
1
+ // @bun
2
+ var __require = import.meta.require;
3
+
4
+ // src/components/templates/TemplateCard.tsx
5
+ import { jsxDEV } from "react/jsx-dev-runtime";
6
+ "use client";
7
+ function TemplateCard({
8
+ title,
9
+ description,
10
+ metaBadges,
11
+ tags,
12
+ featureList = [],
13
+ isNew = false,
14
+ previewAction,
15
+ useAction
16
+ }) {
17
+ return /* @__PURE__ */ jsxDEV("div", {
18
+ className: "editorial-panel relative flex flex-col space-y-4 transition-colors hover:border-[color:rgb(162_79_42_/_0.55)]",
19
+ children: [
20
+ isNew ? /* @__PURE__ */ jsxDEV("span", {
21
+ className: "absolute top-4 right-4 rounded-full bg-[color:var(--success)] px-2.5 py-1 font-medium text-[11px] text-white uppercase",
22
+ children: "New"
23
+ }, undefined, false, undefined, this) : null,
24
+ /* @__PURE__ */ jsxDEV("div", {
25
+ children: [
26
+ /* @__PURE__ */ jsxDEV("h3", {
27
+ className: "font-serif text-2xl tracking-[-0.03em]",
28
+ children: title
29
+ }, undefined, false, undefined, this),
30
+ /* @__PURE__ */ jsxDEV("p", {
31
+ className: "mt-1 text-muted-foreground text-sm",
32
+ children: description
33
+ }, undefined, false, undefined, this)
34
+ ]
35
+ }, undefined, true, undefined, this),
36
+ /* @__PURE__ */ jsxDEV("div", {
37
+ className: "flex-1 space-y-3",
38
+ children: [
39
+ /* @__PURE__ */ jsxDEV("div", {
40
+ className: "flex flex-wrap gap-2",
41
+ children: metaBadges.map((badge) => /* @__PURE__ */ jsxDEV("span", {
42
+ className: "rounded-full border border-border bg-background px-3 py-1 text-[11px] text-foreground",
43
+ children: badge
44
+ }, badge, false, undefined, this))
45
+ }, undefined, false, undefined, this),
46
+ featureList.length > 0 ? /* @__PURE__ */ jsxDEV("p", {
47
+ className: "text-muted-foreground text-xs",
48
+ children: [
49
+ /* @__PURE__ */ jsxDEV("span", {
50
+ className: "font-medium text-foreground",
51
+ children: "Features:"
52
+ }, undefined, false, undefined, this),
53
+ " ",
54
+ featureList.join(", ")
55
+ ]
56
+ }, undefined, true, undefined, this) : null,
57
+ /* @__PURE__ */ jsxDEV("div", {
58
+ className: "flex flex-wrap gap-1",
59
+ children: tags.map((tag) => /* @__PURE__ */ jsxDEV("span", {
60
+ className: "rounded-full border border-border bg-muted px-3 py-1 text-[11px] text-muted-foreground",
61
+ children: tag
62
+ }, tag, false, undefined, this))
63
+ }, undefined, false, undefined, this)
64
+ ]
65
+ }, undefined, true, undefined, this),
66
+ /* @__PURE__ */ jsxDEV("div", {
67
+ className: "flex gap-2 pt-4",
68
+ children: [
69
+ previewAction,
70
+ useAction
71
+ ]
72
+ }, undefined, true, undefined, this)
73
+ ]
74
+ }, undefined, true, undefined, this);
75
+ }
76
+
77
+ // src/components/templates/template-new.ts
78
+ var NEW_TEMPLATE_IDS = [
79
+ "minimal",
80
+ "messaging-agent-actions",
81
+ "policy-safe-knowledge-assistant",
82
+ "visualization-showcase"
83
+ ];
84
+ var NEW_TEMPLATE_ID_SET = new Set(NEW_TEMPLATE_IDS);
85
+ function isNewTemplateId(templateId) {
86
+ return NEW_TEMPLATE_ID_SET.has(templateId);
87
+ }
88
+
89
+ // src/components/templates/template-catalog.ts
90
+ import { listExamples, listTemplates } from "@contractspec/module.examples";
91
+ var NEW_TEMPLATE_INDEX = new Map(NEW_TEMPLATE_IDS.map((templateId, index) => [templateId, index]));
92
+ function buildLocalTemplateCatalog(examples = listExamples(), templates = listTemplates()) {
93
+ const templatesById = new Map(templates.map((template) => [template.id, template]));
94
+ return examples.filter((example) => example.meta.visibility === "public" && example.surfaces.templates).map((example) => {
95
+ const template = templatesById.get(example.meta.key);
96
+ const tags = Array.from(new Set(example.meta.tags.map((tag) => tag.trim()).filter(Boolean))).sort((left, right) => left.localeCompare(right));
97
+ return {
98
+ id: example.meta.key,
99
+ title: example.meta.title ?? template?.name ?? example.meta.key,
100
+ description: example.meta.summary ?? example.meta.description,
101
+ tags,
102
+ kind: example.meta.kind,
103
+ stability: example.meta.stability,
104
+ previewUrl: template?.preview?.demoUrl ?? `/sandbox?template=${encodeURIComponent(example.meta.key)}`,
105
+ featureList: [...template?.features ?? []],
106
+ sandboxModes: example.surfaces.sandbox.modes,
107
+ renderTargets: [...template?.renderTargets ?? []],
108
+ isNew: isNewTemplateId(example.meta.key),
109
+ packageName: example.entrypoints.packageName
110
+ };
111
+ }).sort(compareLocalTemplateCatalogItems);
112
+ }
113
+ function matchesTemplateFilters(template, search, selectedTag) {
114
+ const haystack = [
115
+ template.title,
116
+ template.description,
117
+ template.tags.join(" ")
118
+ ].join(" ").toLowerCase();
119
+ const searchTokens = search.trim().toLowerCase().split(/\s+/).filter(Boolean);
120
+ const matchesSearch = searchTokens.length === 0 || searchTokens.every((token) => haystack.includes(token));
121
+ const matchesTag = selectedTag === null || template.tags.includes(selectedTag);
122
+ return matchesSearch && matchesTag;
123
+ }
124
+ function formatExampleKindLabel(kind) {
125
+ return kind.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
126
+ }
127
+ function formatStabilityLabel(stability) {
128
+ return stability.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
129
+ }
130
+ function compareLocalTemplateCatalogItems(left, right) {
131
+ const leftNewIndex = NEW_TEMPLATE_INDEX.get(left.id);
132
+ const rightNewIndex = NEW_TEMPLATE_INDEX.get(right.id);
133
+ if (leftNewIndex !== undefined || rightNewIndex !== undefined) {
134
+ if (leftNewIndex === undefined) {
135
+ return 1;
136
+ }
137
+ if (rightNewIndex === undefined) {
138
+ return -1;
139
+ }
140
+ return leftNewIndex - rightNewIndex;
141
+ }
142
+ return left.title.localeCompare(right.title);
143
+ }
144
+
145
+ // src/components/templates/template-preview.ts
146
+ var INLINE_TEMPLATE_PREVIEW_IDS = [
147
+ "agent-console",
148
+ "ai-chat-assistant",
149
+ "analytics-dashboard",
150
+ "crm-pipeline",
151
+ "data-grid-showcase",
152
+ "integration-hub",
153
+ "marketplace",
154
+ "saas-boilerplate",
155
+ "visualization-showcase",
156
+ "workflow-system"
157
+ ];
158
+ var INLINE_TEMPLATE_PREVIEW_SET = new Set(INLINE_TEMPLATE_PREVIEW_IDS);
159
+ function supportsInlineTemplatePreview(templateId) {
160
+ return INLINE_TEMPLATE_PREVIEW_SET.has(templateId);
161
+ }
162
+ function getLocalTemplatePreviewAction(template) {
163
+ if (supportsInlineTemplatePreview(template.id)) {
164
+ return { kind: "modal", templateId: template.id };
165
+ }
166
+ return { kind: "sandbox", href: template.previewUrl };
167
+ }
168
+ function getRegistryTemplatePreviewAction(template, localTemplate) {
169
+ if (!localTemplate) {
170
+ return { kind: "disabled" };
171
+ }
172
+ return getLocalTemplatePreviewAction(localTemplate);
173
+ }
174
+
175
+ // src/components/templates/TemplatesCatalogSection.tsx
176
+ import Link from "next/link";
177
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
178
+ "use client";
179
+ function TemplatesCatalogSection({
180
+ source,
181
+ registryConfigured,
182
+ registryLoading,
183
+ localTemplates,
184
+ registryTemplates,
185
+ localTemplateById,
186
+ onPreview,
187
+ onUseTemplate
188
+ }) {
189
+ const showRegistry = source === "registry" && registryConfigured;
190
+ return /* @__PURE__ */ jsxDEV2("section", {
191
+ className: "section-padding",
192
+ children: /* @__PURE__ */ jsxDEV2("div", {
193
+ className: "editorial-shell",
194
+ children: showRegistry ? registryLoading ? /* @__PURE__ */ jsxDEV2("div", {
195
+ className: "py-12 text-center",
196
+ children: /* @__PURE__ */ jsxDEV2("p", {
197
+ className: "text-muted-foreground",
198
+ children: "Loading community templates\u2026"
199
+ }, undefined, false, undefined, this)
200
+ }, undefined, false, undefined, this) : registryTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
201
+ className: "py-12 text-center",
202
+ children: /* @__PURE__ */ jsxDEV2("p", {
203
+ className: "text-muted-foreground",
204
+ children: "No community templates found."
205
+ }, undefined, false, undefined, this)
206
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
207
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
208
+ children: registryTemplates.map((template) => {
209
+ const localTemplate = localTemplateById.get(template.id);
210
+ const previewAction = getRegistryTemplatePreviewAction(template, localTemplate);
211
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
212
+ title: template.name,
213
+ description: template.description,
214
+ metaBadges: ["Community"],
215
+ tags: template.tags,
216
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
217
+ className: "btn-ghost flex-1 text-center text-xs",
218
+ onClick: () => onPreview(template.id),
219
+ children: "Preview"
220
+ }, undefined, false, undefined, this) : previewAction.kind === "sandbox" ? /* @__PURE__ */ jsxDEV2(Link, {
221
+ href: previewAction.href,
222
+ className: "btn-ghost flex-1 text-center text-xs",
223
+ children: "Open Sandbox"
224
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("button", {
225
+ className: "btn-ghost flex-1 cursor-not-allowed text-center text-xs opacity-60",
226
+ type: "button",
227
+ disabled: true,
228
+ children: "Preview Unavailable"
229
+ }, undefined, false, undefined, this),
230
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
231
+ className: "btn-primary flex-1 text-center text-xs",
232
+ onClick: () => onUseTemplate(template.id, "registry"),
233
+ children: "Use Template"
234
+ }, undefined, false, undefined, this)
235
+ }, template.id, false, undefined, this);
236
+ })
237
+ }, undefined, false, undefined, this) : localTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
238
+ className: "py-12 text-center",
239
+ children: /* @__PURE__ */ jsxDEV2("p", {
240
+ className: "text-muted-foreground",
241
+ children: "No templates match your filters. Try a different search."
242
+ }, undefined, false, undefined, this)
243
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
244
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
245
+ children: localTemplates.map((template) => {
246
+ const previewAction = getLocalTemplatePreviewAction(template);
247
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
248
+ title: template.title,
249
+ description: template.description,
250
+ isNew: template.isNew,
251
+ metaBadges: [
252
+ formatExampleKindLabel(template.kind),
253
+ formatStabilityLabel(template.stability)
254
+ ],
255
+ tags: template.tags,
256
+ featureList: template.featureList,
257
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
258
+ className: "btn-ghost flex-1 text-center text-xs",
259
+ onClick: () => onPreview(template.id),
260
+ children: "Preview"
261
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2(Link, {
262
+ href: previewAction.href,
263
+ className: "btn-ghost flex-1 text-center text-xs",
264
+ children: "Open Sandbox"
265
+ }, undefined, false, undefined, this),
266
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
267
+ className: "btn-primary flex-1 text-center text-xs",
268
+ onClick: () => onUseTemplate(template.id, "local"),
269
+ children: "Use Template"
270
+ }, undefined, false, undefined, this)
271
+ }, template.id, false, undefined, this);
272
+ })
273
+ }, undefined, false, undefined, this)
274
+ }, undefined, false, undefined, this)
275
+ }, undefined, false, undefined, this);
276
+ }
277
+ export {
278
+ TemplatesCatalogSection
279
+ };