@contractspec/bundle.marketing 3.8.8 → 3.8.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.
Files changed (96) hide show
  1. package/.turbo/turbo-build.log +73 -29
  2. package/CHANGELOG.md +63 -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 +130 -0
  7. package/dist/browser/components/templates/TemplatesCatalogSection.js +307 -0
  8. package/dist/browser/components/templates/TemplatesClientPage.js +1020 -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/TemplatesOverlays.js +2874 -0
  12. package/dist/browser/components/templates/TemplatesPreviewModal.js +136 -126
  13. package/dist/browser/components/templates/index.js +1055 -952
  14. package/dist/browser/components/templates/template-catalog.js +83 -0
  15. package/dist/browser/components/templates/template-filters.js +99 -0
  16. package/dist/browser/components/templates/template-new.js +23 -0
  17. package/dist/browser/components/templates/template-preview.js +43 -0
  18. package/dist/browser/components/templates/template-source.js +19 -0
  19. package/dist/browser/components/templates/template-tag-visibility.js +40 -0
  20. package/dist/browser/components/templates/useTemplateBrowseState.js +191 -0
  21. package/dist/browser/index.js +1055 -952
  22. package/dist/components/templates/TemplateCard.d.ts +12 -0
  23. package/dist/components/templates/TemplateCard.js +78 -0
  24. package/dist/components/templates/TemplateCommandDialog.d.ts +6 -0
  25. package/dist/components/templates/TemplateCommandDialog.js +105 -0
  26. package/dist/components/templates/TemplatePreviewContent.d.ts +5 -0
  27. package/dist/components/templates/TemplatePreviewContent.js +91 -0
  28. package/dist/components/templates/TemplatesBrowseControls.d.ts +18 -0
  29. package/dist/components/templates/TemplatesBrowseControls.js +125 -0
  30. package/dist/components/templates/TemplatesCatalogSection.d.ts +17 -0
  31. package/dist/components/templates/TemplatesCatalogSection.js +302 -0
  32. package/dist/components/templates/TemplatesClientPage.js +1020 -917
  33. package/dist/components/templates/TemplatesHeroSection.d.ts +5 -0
  34. package/dist/components/templates/TemplatesHeroSection.js +82 -0
  35. package/dist/components/templates/TemplatesNextStepsSection.d.ts +1 -0
  36. package/dist/components/templates/TemplatesNextStepsSection.js +121 -0
  37. package/dist/components/templates/TemplatesOverlays.d.ts +10 -0
  38. package/dist/components/templates/TemplatesOverlays.js +2869 -0
  39. package/dist/components/templates/TemplatesPreviewModal.d.ts +3 -4
  40. package/dist/components/templates/TemplatesPreviewModal.js +136 -126
  41. package/dist/components/templates/index.js +1055 -952
  42. package/dist/components/templates/template-catalog.d.ts +28 -0
  43. package/dist/components/templates/template-catalog.js +78 -0
  44. package/dist/components/templates/template-catalog.test.d.ts +1 -0
  45. package/dist/components/templates/template-filters.d.ts +12 -0
  46. package/dist/components/templates/template-filters.js +94 -0
  47. package/dist/components/templates/template-new.d.ts +2 -0
  48. package/dist/components/templates/template-new.js +18 -0
  49. package/dist/components/templates/template-preview.d.ts +18 -0
  50. package/dist/components/templates/template-preview.js +38 -0
  51. package/dist/components/templates/template-source.d.ts +3 -0
  52. package/dist/components/templates/template-source.js +14 -0
  53. package/dist/components/templates/template-tag-visibility.d.ts +10 -0
  54. package/dist/components/templates/template-tag-visibility.js +35 -0
  55. package/dist/components/templates/useTemplateBrowseState.d.ts +22 -0
  56. package/dist/components/templates/useTemplateBrowseState.js +186 -0
  57. package/dist/index.js +1055 -952
  58. package/dist/node/components/templates/TemplateCard.js +78 -0
  59. package/dist/node/components/templates/TemplateCommandDialog.js +105 -0
  60. package/dist/node/components/templates/TemplatePreviewContent.js +91 -0
  61. package/dist/node/components/templates/TemplatesBrowseControls.js +125 -0
  62. package/dist/node/components/templates/TemplatesCatalogSection.js +302 -0
  63. package/dist/node/components/templates/TemplatesClientPage.js +1020 -917
  64. package/dist/node/components/templates/TemplatesHeroSection.js +82 -0
  65. package/dist/node/components/templates/TemplatesNextStepsSection.js +121 -0
  66. package/dist/node/components/templates/TemplatesOverlays.js +2869 -0
  67. package/dist/node/components/templates/TemplatesPreviewModal.js +136 -126
  68. package/dist/node/components/templates/index.js +1055 -952
  69. package/dist/node/components/templates/template-catalog.js +78 -0
  70. package/dist/node/components/templates/template-filters.js +94 -0
  71. package/dist/node/components/templates/template-new.js +18 -0
  72. package/dist/node/components/templates/template-preview.js +38 -0
  73. package/dist/node/components/templates/template-source.js +14 -0
  74. package/dist/node/components/templates/template-tag-visibility.js +35 -0
  75. package/dist/node/components/templates/useTemplateBrowseState.js +186 -0
  76. package/dist/node/index.js +1055 -952
  77. package/package.json +237 -26
  78. package/src/components/templates/TemplateCard.tsx +74 -0
  79. package/src/components/templates/TemplateCommandDialog.tsx +92 -0
  80. package/src/components/templates/TemplatePreviewContent.tsx +182 -0
  81. package/src/components/templates/TemplatesBrowseControls.tsx +144 -0
  82. package/src/components/templates/TemplatesCatalogSection.tsx +191 -0
  83. package/src/components/templates/TemplatesClientPage.tsx +85 -773
  84. package/src/components/templates/TemplatesHeroSection.tsx +41 -0
  85. package/src/components/templates/TemplatesNextStepsSection.tsx +80 -0
  86. package/src/components/templates/TemplatesOverlays.tsx +65 -0
  87. package/src/components/templates/TemplatesPreviewModal.tsx +19 -294
  88. package/src/components/templates/template-catalog.test.ts +162 -0
  89. package/src/components/templates/template-catalog.ts +140 -0
  90. package/src/components/templates/template-filters.ts +57 -0
  91. package/src/components/templates/template-new.ts +12 -0
  92. package/src/components/templates/template-preview.ts +57 -0
  93. package/src/components/templates/template-source.ts +13 -0
  94. package/src/components/templates/template-tag-visibility.ts +58 -0
  95. package/src/components/templates/useTemplateBrowseState.ts +101 -0
  96. package/.turbo/turbo-prebuild.log +0 -1
@@ -0,0 +1,302 @@
1
+ import { createRequire } from "node:module";
2
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
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
+ return matchesTemplateSearch(template, search) && (selectedTag === null || template.tags.includes(selectedTag));
115
+ }
116
+ function matchesTemplateSearch(template, search) {
117
+ const haystack = [
118
+ template.title,
119
+ template.description,
120
+ template.tags.join(" ")
121
+ ].join(" ").toLowerCase();
122
+ const searchTokens = search.trim().toLowerCase().split(/\s+/).filter(Boolean);
123
+ return searchTokens.length === 0 || searchTokens.every((token) => haystack.includes(token));
124
+ }
125
+ function formatExampleKindLabel(kind) {
126
+ return kind.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
127
+ }
128
+ function formatStabilityLabel(stability) {
129
+ return stability.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
130
+ }
131
+ function compareLocalTemplateCatalogItems(left, right) {
132
+ const leftNewIndex = NEW_TEMPLATE_INDEX.get(left.id);
133
+ const rightNewIndex = NEW_TEMPLATE_INDEX.get(right.id);
134
+ if (leftNewIndex !== undefined || rightNewIndex !== undefined) {
135
+ if (leftNewIndex === undefined) {
136
+ return 1;
137
+ }
138
+ if (rightNewIndex === undefined) {
139
+ return -1;
140
+ }
141
+ return leftNewIndex - rightNewIndex;
142
+ }
143
+ return left.title.localeCompare(right.title);
144
+ }
145
+
146
+ // src/components/templates/template-preview.ts
147
+ var INLINE_TEMPLATE_PREVIEW_IDS = [
148
+ "agent-console",
149
+ "ai-chat-assistant",
150
+ "analytics-dashboard",
151
+ "crm-pipeline",
152
+ "data-grid-showcase",
153
+ "integration-hub",
154
+ "marketplace",
155
+ "saas-boilerplate",
156
+ "visualization-showcase",
157
+ "workflow-system"
158
+ ];
159
+ var INLINE_TEMPLATE_PREVIEW_SET = new Set(INLINE_TEMPLATE_PREVIEW_IDS);
160
+ function supportsInlineTemplatePreview(templateId) {
161
+ return INLINE_TEMPLATE_PREVIEW_SET.has(templateId);
162
+ }
163
+ function getLocalTemplatePreviewAction(template) {
164
+ if (supportsInlineTemplatePreview(template.id)) {
165
+ return { kind: "modal", templateId: template.id };
166
+ }
167
+ return { kind: "sandbox", href: template.previewUrl };
168
+ }
169
+ function getRegistryTemplatePreviewAction(template, localTemplate) {
170
+ if (!localTemplate) {
171
+ return { kind: "disabled" };
172
+ }
173
+ return getLocalTemplatePreviewAction(localTemplate);
174
+ }
175
+
176
+ // src/components/templates/TemplatesCatalogSection.tsx
177
+ import Link from "next/link";
178
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
179
+ "use client";
180
+ function TemplatesCatalogSection({
181
+ source,
182
+ registryConfigured,
183
+ registryLoading,
184
+ registryHasTemplates,
185
+ localTemplates,
186
+ registryTemplates,
187
+ localTemplateById,
188
+ onPreview,
189
+ onUseTemplate,
190
+ hasSearch,
191
+ selectedTag
192
+ }) {
193
+ const showRegistry = source === "registry" && registryConfigured;
194
+ const emptyStateMessage = getEmptyStateMessage(hasSearch, selectedTag);
195
+ return /* @__PURE__ */ jsxDEV2("section", {
196
+ className: "section-padding",
197
+ children: /* @__PURE__ */ jsxDEV2("div", {
198
+ className: "editorial-shell",
199
+ children: showRegistry ? registryLoading ? /* @__PURE__ */ jsxDEV2("div", {
200
+ className: "py-12 text-center",
201
+ children: /* @__PURE__ */ jsxDEV2("p", {
202
+ className: "text-muted-foreground",
203
+ children: "Loading community templates…"
204
+ }, undefined, false, undefined, this)
205
+ }, undefined, false, undefined, this) : !registryHasTemplates ? /* @__PURE__ */ jsxDEV2("div", {
206
+ className: "py-12 text-center",
207
+ children: /* @__PURE__ */ jsxDEV2("p", {
208
+ className: "text-muted-foreground",
209
+ children: "No community templates found."
210
+ }, undefined, false, undefined, this)
211
+ }, undefined, false, undefined, this) : registryTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
212
+ className: "py-12 text-center",
213
+ children: /* @__PURE__ */ jsxDEV2("p", {
214
+ className: "text-muted-foreground",
215
+ children: emptyStateMessage
216
+ }, undefined, false, undefined, this)
217
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
218
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
219
+ children: registryTemplates.map((template) => {
220
+ const localTemplate = localTemplateById.get(template.id);
221
+ const previewAction = getRegistryTemplatePreviewAction(template, localTemplate);
222
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
223
+ title: template.name,
224
+ description: template.description,
225
+ metaBadges: ["Community"],
226
+ tags: template.tags,
227
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
228
+ className: "btn-ghost flex-1 text-center text-xs",
229
+ onClick: () => onPreview(template.id),
230
+ children: "Preview"
231
+ }, undefined, false, undefined, this) : previewAction.kind === "sandbox" ? /* @__PURE__ */ jsxDEV2(Link, {
232
+ href: previewAction.href,
233
+ className: "btn-ghost flex-1 text-center text-xs",
234
+ children: "Open Sandbox"
235
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("button", {
236
+ className: "btn-ghost flex-1 cursor-not-allowed text-center text-xs opacity-60",
237
+ type: "button",
238
+ disabled: true,
239
+ children: "Preview Unavailable"
240
+ }, undefined, false, undefined, this),
241
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
242
+ className: "btn-primary flex-1 text-center text-xs",
243
+ onClick: () => onUseTemplate(template.id, "registry"),
244
+ children: "Use Template"
245
+ }, undefined, false, undefined, this)
246
+ }, template.id, false, undefined, this);
247
+ })
248
+ }, undefined, false, undefined, this) : localTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
249
+ className: "py-12 text-center",
250
+ children: /* @__PURE__ */ jsxDEV2("p", {
251
+ className: "text-muted-foreground",
252
+ children: emptyStateMessage
253
+ }, undefined, false, undefined, this)
254
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
255
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
256
+ children: localTemplates.map((template) => {
257
+ const previewAction = getLocalTemplatePreviewAction(template);
258
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
259
+ title: template.title,
260
+ description: template.description,
261
+ isNew: template.isNew,
262
+ metaBadges: [
263
+ formatExampleKindLabel(template.kind),
264
+ formatStabilityLabel(template.stability)
265
+ ],
266
+ tags: template.tags,
267
+ featureList: template.featureList,
268
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
269
+ className: "btn-ghost flex-1 text-center text-xs",
270
+ onClick: () => onPreview(template.id),
271
+ children: "Preview"
272
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2(Link, {
273
+ href: previewAction.href,
274
+ className: "btn-ghost flex-1 text-center text-xs",
275
+ children: "Open Sandbox"
276
+ }, undefined, false, undefined, this),
277
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
278
+ className: "btn-primary flex-1 text-center text-xs",
279
+ onClick: () => onUseTemplate(template.id, "local"),
280
+ children: "Use Template"
281
+ }, undefined, false, undefined, this)
282
+ }, template.id, false, undefined, this);
283
+ })
284
+ }, undefined, false, undefined, this)
285
+ }, undefined, false, undefined, this)
286
+ }, undefined, false, undefined, this);
287
+ }
288
+ function getEmptyStateMessage(hasSearch, selectedTag) {
289
+ if (selectedTag !== null && hasSearch) {
290
+ return "No templates match this tag for the current search.";
291
+ }
292
+ if (selectedTag !== null) {
293
+ return "No templates match this tag. Try another tag or reset filters.";
294
+ }
295
+ if (hasSearch) {
296
+ return "No templates match your search. Try a different keyword.";
297
+ }
298
+ return "No templates match your filters. Try a different search.";
299
+ }
300
+ export {
301
+ TemplatesCatalogSection
302
+ };