@contractspec/module.examples 1.56.1 → 1.58.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.
@@ -1,225 +0,0 @@
1
- import { listExamples } from "../registry.js";
2
-
3
- //#region src/runtime/registry.ts
4
- const PRESENTATIONS_BY_TEMPLATE = {
5
- "saas-boilerplate": [
6
- "saas-boilerplate.dashboard",
7
- "saas-boilerplate.project.list",
8
- "saas-boilerplate.billing.settings"
9
- ],
10
- "crm-pipeline": ["crm-pipeline.dashboard", "crm-pipeline.deal.pipeline"],
11
- "agent-console": [
12
- "agent-console.dashboard",
13
- "agent-console.agent.list",
14
- "agent-console.run.list",
15
- "agent-console.tool.registry"
16
- ],
17
- "workflow-system": [
18
- "workflow-system.dashboard",
19
- "workflow-system.definition.list",
20
- "workflow-system.instance.detail"
21
- ],
22
- marketplace: [
23
- "marketplace.dashboard",
24
- "marketplace.product.catalog",
25
- "marketplace.order.list",
26
- "marketplace.store.manage"
27
- ],
28
- "integration-hub": [
29
- "integration-hub.dashboard",
30
- "integration-hub.connection.list",
31
- "integration-hub.sync.config"
32
- ],
33
- "analytics-dashboard": [
34
- "analytics-dashboard.dashboard",
35
- "analytics-dashboard.list",
36
- "analytics-dashboard.query.builder"
37
- ],
38
- "learning-journey-studio-onboarding": [
39
- "learning.journey.track_list",
40
- "learning.journey.track_detail",
41
- "learning.journey.progress_widget"
42
- ],
43
- "learning-journey-platform-tour": [
44
- "learning.journey.track_list",
45
- "learning.journey.track_detail",
46
- "learning.journey.progress_widget"
47
- ],
48
- "learning-journey-crm-onboarding": [
49
- "learning.journey.track_list",
50
- "learning.journey.track_detail",
51
- "learning.journey.progress_widget"
52
- ],
53
- "learning-journey-duo-drills": [
54
- "learning.journey.track_list",
55
- "learning.journey.track_detail",
56
- "learning.journey.progress_widget"
57
- ],
58
- "learning-journey-ambient-coach": [
59
- "learning.journey.track_list",
60
- "learning.journey.track_detail",
61
- "learning.journey.progress_widget"
62
- ],
63
- "learning-journey-quest-challenges": [
64
- "learning.journey.track_list",
65
- "learning.journey.track_detail",
66
- "learning.journey.progress_widget"
67
- ]
68
- };
69
- const TEMPLATE_REGISTRY = [
70
- {
71
- id: "todos-app",
72
- name: "To-dos List App",
73
- description: "CRUD flows, filtering, priorities, and ceremonies for handing off work across crews.",
74
- category: "productivity",
75
- complexity: "beginner",
76
- icon: "✅",
77
- features: [
78
- "CRUD tasks",
79
- "Filters",
80
- "Categories",
81
- "Search",
82
- "Priorities"
83
- ],
84
- tags: [
85
- "tasks",
86
- "ops",
87
- "starter"
88
- ],
89
- schema: {
90
- models: ["Task", "TaskCategory"],
91
- contracts: ["template.todos.crud"]
92
- },
93
- components: {
94
- list: "TaskList",
95
- detail: "TaskDetailPanel",
96
- form: "TaskForm"
97
- },
98
- preview: { demoUrl: "/sandbox?template=todos-app" },
99
- docs: { quickstart: "/docs/templates/todos-app" }
100
- },
101
- {
102
- id: "messaging-app",
103
- name: "Messaging Application",
104
- description: "Conversation roster, optimistic sending, typing indicators, and delivery telemetry.",
105
- category: "communication",
106
- complexity: "intermediate",
107
- icon: "💬",
108
- features: [
109
- "Conversations",
110
- "Real-time feed",
111
- "Typing indicators",
112
- "Read receipts"
113
- ],
114
- tags: [
115
- "messaging",
116
- "realtime",
117
- "ws"
118
- ],
119
- schema: {
120
- models: [
121
- "Conversation",
122
- "ConversationParticipant",
123
- "Message"
124
- ],
125
- contracts: ["template.messaging.core"]
126
- },
127
- components: {
128
- list: "ConversationList",
129
- detail: "MessageThread",
130
- form: "MessageComposer"
131
- },
132
- preview: { demoUrl: "/sandbox?template=messaging-app" },
133
- docs: { quickstart: "/docs/templates/messaging-app" }
134
- },
135
- {
136
- id: "recipe-app-i18n",
137
- name: "Recipe App (i18n)",
138
- description: "Localized browsing experience with bilingual content, categories, and favorites.",
139
- category: "content",
140
- complexity: "intermediate",
141
- icon: "🍲",
142
- features: [
143
- "i18n",
144
- "Favorites",
145
- "Categories",
146
- "Search",
147
- "RTL-ready"
148
- ],
149
- tags: [
150
- "content",
151
- "i18n",
152
- "localization"
153
- ],
154
- schema: {
155
- models: [
156
- "RecipeCategory",
157
- "Recipe",
158
- "RecipeIngredient",
159
- "RecipeInstruction"
160
- ],
161
- contracts: ["template.recipes.browse"]
162
- },
163
- components: {
164
- list: "RecipeList",
165
- detail: "RecipeDetail",
166
- form: "RecipeForm"
167
- },
168
- preview: { demoUrl: "/sandbox?template=recipe-app-i18n" },
169
- docs: { quickstart: "/docs/templates/recipe-app-i18n" }
170
- },
171
- ...listExamples().map((example) => {
172
- const tags = example.meta.keywords ?? [];
173
- const category = tags.some((t) => t.toLowerCase() === "ai") || tags.some((t) => t.toLowerCase() === "assistant") ? "ai" : "business";
174
- return {
175
- id: example.meta.key,
176
- name: example.meta.title ?? example.meta.key,
177
- description: example.meta.description ?? "",
178
- category,
179
- complexity: "beginner",
180
- icon: "📦",
181
- features: [],
182
- tags: [...tags],
183
- schema: {
184
- models: [],
185
- contracts: []
186
- },
187
- components: {
188
- list: "ExampleList",
189
- detail: "ExampleDetail"
190
- },
191
- preview: { demoUrl: `/sandbox?template=${encodeURIComponent(example.meta.key)}` },
192
- package: example.entrypoints.packageName,
193
- presentations: PRESENTATIONS_BY_TEMPLATE[example.meta.key] ?? [],
194
- renderTargets: ["react", "markdown"]
195
- };
196
- })
197
- ];
198
- function listTemplates(filter) {
199
- if (!filter) return TEMPLATE_REGISTRY;
200
- return TEMPLATE_REGISTRY.filter((template) => {
201
- if (filter.category && template.category !== filter.category) return false;
202
- if (filter.complexity && template.complexity !== filter.complexity) return false;
203
- if (filter.tag && !template.tags.some((tag) => tag.toLowerCase() === filter.tag?.toLowerCase())) return false;
204
- return true;
205
- });
206
- }
207
- function getTemplate(id) {
208
- return TEMPLATE_REGISTRY.find((template) => template.id === id);
209
- }
210
- /**
211
- * Get templates that use a specific cross-cutting module
212
- */
213
- function getTemplatesByModule(modulePackage) {
214
- return TEMPLATE_REGISTRY.filter((template) => template.usesModules?.includes(modulePackage));
215
- }
216
- /**
217
- * Get all templates with external packages (clonable via Git)
218
- */
219
- function getClonableTemplates() {
220
- return TEMPLATE_REGISTRY.filter((template) => !!template.package);
221
- }
222
-
223
- //#endregion
224
- export { TEMPLATE_REGISTRY, getClonableTemplates, getTemplate, getTemplatesByModule, listTemplates };
225
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../../src/runtime/registry.ts"],"sourcesContent":["import { listExamples } from '../registry';\nimport type {\n TemplateCategory,\n TemplateComplexity,\n TemplateDefinition,\n TemplateId,\n TemplateFilter,\n} from '@contractspec/lib.example-shared-ui';\n\nconst PRESENTATIONS_BY_TEMPLATE: Record<string, string[]> = {\n 'saas-boilerplate': [\n 'saas-boilerplate.dashboard',\n 'saas-boilerplate.project.list',\n 'saas-boilerplate.billing.settings',\n ],\n 'crm-pipeline': ['crm-pipeline.dashboard', 'crm-pipeline.deal.pipeline'],\n 'agent-console': [\n 'agent-console.dashboard',\n 'agent-console.agent.list',\n 'agent-console.run.list',\n 'agent-console.tool.registry',\n ],\n 'workflow-system': [\n 'workflow-system.dashboard',\n 'workflow-system.definition.list',\n 'workflow-system.instance.detail',\n ],\n marketplace: [\n 'marketplace.dashboard',\n 'marketplace.product.catalog',\n 'marketplace.order.list',\n 'marketplace.store.manage',\n ],\n 'integration-hub': [\n 'integration-hub.dashboard',\n 'integration-hub.connection.list',\n 'integration-hub.sync.config',\n ],\n 'analytics-dashboard': [\n 'analytics-dashboard.dashboard',\n 'analytics-dashboard.list',\n 'analytics-dashboard.query.builder',\n ],\n 'learning-journey-studio-onboarding': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n 'learning-journey-platform-tour': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n 'learning-journey-crm-onboarding': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n 'learning-journey-duo-drills': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n 'learning-journey-ambient-coach': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n 'learning-journey-quest-challenges': [\n 'learning.journey.track_list',\n 'learning.journey.track_detail',\n 'learning.journey.progress_widget',\n ],\n};\n\nexport const TEMPLATE_REGISTRY: TemplateDefinition[] = [\n {\n id: 'todos-app',\n name: 'To-dos List App',\n description:\n 'CRUD flows, filtering, priorities, and ceremonies for handing off work across crews.',\n category: 'productivity',\n complexity: 'beginner',\n icon: '✅',\n features: ['CRUD tasks', 'Filters', 'Categories', 'Search', 'Priorities'],\n tags: ['tasks', 'ops', 'starter'],\n schema: {\n models: ['Task', 'TaskCategory'],\n contracts: ['template.todos.crud'],\n },\n components: {\n list: 'TaskList',\n detail: 'TaskDetailPanel',\n form: 'TaskForm',\n },\n preview: {\n demoUrl: '/sandbox?template=todos-app',\n },\n docs: {\n quickstart: '/docs/templates/todos-app',\n },\n },\n {\n id: 'messaging-app',\n name: 'Messaging Application',\n description:\n 'Conversation roster, optimistic sending, typing indicators, and delivery telemetry.',\n category: 'communication',\n complexity: 'intermediate',\n icon: '💬',\n features: [\n 'Conversations',\n 'Real-time feed',\n 'Typing indicators',\n 'Read receipts',\n ],\n tags: ['messaging', 'realtime', 'ws'],\n schema: {\n models: ['Conversation', 'ConversationParticipant', 'Message'],\n contracts: ['template.messaging.core'],\n },\n components: {\n list: 'ConversationList',\n detail: 'MessageThread',\n form: 'MessageComposer',\n },\n preview: {\n demoUrl: '/sandbox?template=messaging-app',\n },\n docs: {\n quickstart: '/docs/templates/messaging-app',\n },\n },\n {\n id: 'recipe-app-i18n',\n name: 'Recipe App (i18n)',\n description:\n 'Localized browsing experience with bilingual content, categories, and favorites.',\n category: 'content',\n complexity: 'intermediate',\n icon: '🍲',\n features: ['i18n', 'Favorites', 'Categories', 'Search', 'RTL-ready'],\n tags: ['content', 'i18n', 'localization'],\n schema: {\n models: [\n 'RecipeCategory',\n 'Recipe',\n 'RecipeIngredient',\n 'RecipeInstruction',\n ],\n contracts: ['template.recipes.browse'],\n },\n components: {\n list: 'RecipeList',\n detail: 'RecipeDetail',\n form: 'RecipeForm',\n },\n preview: {\n demoUrl: '/sandbox?template=recipe-app-i18n',\n },\n docs: {\n quickstart: '/docs/templates/recipe-app-i18n',\n },\n },\n ...listExamples().map((example) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- meta.keywords fallback if tags missing\n const tags = (example.meta as any).keywords ?? [];\n\n const category: TemplateCategory =\n tags.some((t: string) => t.toLowerCase() === 'ai') ||\n tags.some((t: string) => t.toLowerCase() === 'assistant')\n ? 'ai'\n : 'business';\n\n const complexity: TemplateComplexity = 'beginner';\n\n const icon = '📦';\n\n return {\n id: example.meta.key,\n name: example.meta.title ?? example.meta.key,\n description: example.meta.description ?? '',\n category,\n complexity,\n icon,\n features: [],\n tags: [...tags],\n schema: { models: [], contracts: [] },\n components: { list: 'ExampleList', detail: 'ExampleDetail' },\n preview: {\n demoUrl: `/sandbox?template=${encodeURIComponent(example.meta.key)}`,\n },\n package: example.entrypoints.packageName,\n presentations: PRESENTATIONS_BY_TEMPLATE[example.meta.key] ?? [],\n renderTargets: ['react', 'markdown'],\n } satisfies TemplateDefinition;\n }),\n];\n\nexport function listTemplates(filter?: TemplateFilter): TemplateDefinition[] {\n if (!filter) return TEMPLATE_REGISTRY;\n return TEMPLATE_REGISTRY.filter((template) => {\n if (filter.category && template.category !== filter.category) {\n return false;\n }\n if (filter.complexity && template.complexity !== filter.complexity) {\n return false;\n }\n if (\n filter.tag &&\n !template.tags.some(\n (tag: string) => tag.toLowerCase() === filter.tag?.toLowerCase()\n )\n ) {\n return false;\n }\n return true;\n });\n}\n\nexport function getTemplate(id: TemplateId): TemplateDefinition | undefined {\n return TEMPLATE_REGISTRY.find((template) => template.id === id);\n}\n\n/**\n * Get templates that use a specific cross-cutting module\n */\nexport function getTemplatesByModule(\n modulePackage: string\n): TemplateDefinition[] {\n return TEMPLATE_REGISTRY.filter((template) =>\n template.usesModules?.includes(modulePackage)\n );\n}\n\n/**\n * Get all templates with external packages (clonable via Git)\n */\nexport function getClonableTemplates(): TemplateDefinition[] {\n return TEMPLATE_REGISTRY.filter((template) => !!template.package);\n}\n"],"mappings":";;;AASA,MAAM,4BAAsD;CAC1D,oBAAoB;EAClB;EACA;EACA;EACD;CACD,gBAAgB,CAAC,0BAA0B,6BAA6B;CACxE,iBAAiB;EACf;EACA;EACA;EACA;EACD;CACD,mBAAmB;EACjB;EACA;EACA;EACD;CACD,aAAa;EACX;EACA;EACA;EACA;EACD;CACD,mBAAmB;EACjB;EACA;EACA;EACD;CACD,uBAAuB;EACrB;EACA;EACA;EACD;CACD,sCAAsC;EACpC;EACA;EACA;EACD;CACD,kCAAkC;EAChC;EACA;EACA;EACD;CACD,mCAAmC;EACjC;EACA;EACA;EACD;CACD,+BAA+B;EAC7B;EACA;EACA;EACD;CACD,kCAAkC;EAChC;EACA;EACA;EACD;CACD,qCAAqC;EACnC;EACA;EACA;EACD;CACF;AAED,MAAa,oBAA0C;CACrD;EACE,IAAI;EACJ,MAAM;EACN,aACE;EACF,UAAU;EACV,YAAY;EACZ,MAAM;EACN,UAAU;GAAC;GAAc;GAAW;GAAc;GAAU;GAAa;EACzE,MAAM;GAAC;GAAS;GAAO;GAAU;EACjC,QAAQ;GACN,QAAQ,CAAC,QAAQ,eAAe;GAChC,WAAW,CAAC,sBAAsB;GACnC;EACD,YAAY;GACV,MAAM;GACN,QAAQ;GACR,MAAM;GACP;EACD,SAAS,EACP,SAAS,+BACV;EACD,MAAM,EACJ,YAAY,6BACb;EACF;CACD;EACE,IAAI;EACJ,MAAM;EACN,aACE;EACF,UAAU;EACV,YAAY;EACZ,MAAM;EACN,UAAU;GACR;GACA;GACA;GACA;GACD;EACD,MAAM;GAAC;GAAa;GAAY;GAAK;EACrC,QAAQ;GACN,QAAQ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