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