@contractspec/lib.example-shared-ui 6.0.6 → 6.0.7

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 (81) hide show
  1. package/.turbo/turbo-build.log +90 -84
  2. package/AGENTS.md +43 -25
  3. package/README.md +63 -35
  4. package/dist/EvolutionDashboard.js +9 -9
  5. package/dist/EvolutionSidebar.js +15 -15
  6. package/dist/LocalDataIndicator.js +3 -3
  7. package/dist/MarkdownView.d.ts +0 -7
  8. package/dist/MarkdownView.js +76 -172
  9. package/dist/PersonalizationInsights.js +12 -12
  10. package/dist/SaveToStudioButton.js +2 -2
  11. package/dist/SpecDrivenTemplateShell.d.ts +1 -1
  12. package/dist/SpecDrivenTemplateShell.js +10 -10
  13. package/dist/SpecEditorPanel.js +3 -3
  14. package/dist/TemplateShell.js +10 -10
  15. package/dist/browser/EvolutionDashboard.js +9 -9
  16. package/dist/browser/EvolutionSidebar.js +15 -15
  17. package/dist/browser/LocalDataIndicator.js +3 -3
  18. package/dist/browser/MarkdownView.js +76 -172
  19. package/dist/browser/PersonalizationInsights.js +12 -12
  20. package/dist/browser/SaveToStudioButton.js +2 -2
  21. package/dist/browser/SpecDrivenTemplateShell.js +10 -10
  22. package/dist/browser/SpecEditorPanel.js +3 -3
  23. package/dist/browser/TemplateShell.js +10 -10
  24. package/dist/browser/hooks/index.js +29 -29
  25. package/dist/browser/index.js +193 -286
  26. package/dist/browser/lib/component-registry.js +1 -1
  27. package/dist/browser/markdown/formatPresentationName.js +9 -0
  28. package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
  29. package/dist/hooks/index.d.ts +3 -3
  30. package/dist/hooks/index.js +29 -29
  31. package/dist/index.d.ts +12 -11
  32. package/dist/index.js +193 -286
  33. package/dist/lib/component-registry.js +1 -1
  34. package/dist/markdown/formatPresentationName.d.ts +1 -0
  35. package/dist/markdown/formatPresentationName.js +10 -0
  36. package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
  37. package/dist/markdown/useMarkdownPresentation.js +66 -0
  38. package/dist/node/EvolutionDashboard.js +9 -9
  39. package/dist/node/EvolutionSidebar.js +15 -15
  40. package/dist/node/LocalDataIndicator.js +3 -3
  41. package/dist/node/MarkdownView.js +76 -172
  42. package/dist/node/PersonalizationInsights.js +12 -12
  43. package/dist/node/SaveToStudioButton.js +2 -2
  44. package/dist/node/SpecDrivenTemplateShell.js +10 -10
  45. package/dist/node/SpecEditorPanel.js +3 -3
  46. package/dist/node/TemplateShell.js +10 -10
  47. package/dist/node/hooks/index.js +29 -29
  48. package/dist/node/index.js +193 -286
  49. package/dist/node/lib/component-registry.js +1 -1
  50. package/dist/node/markdown/formatPresentationName.js +9 -0
  51. package/dist/node/markdown/useMarkdownPresentation.js +65 -0
  52. package/dist/utils/index.d.ts +1 -1
  53. package/package.json +38 -11
  54. package/src/EvolutionDashboard.tsx +415 -415
  55. package/src/EvolutionSidebar.tsx +245 -245
  56. package/src/LocalDataIndicator.tsx +28 -28
  57. package/src/MarkdownView.tsx +119 -372
  58. package/src/OverlayContextProvider.tsx +272 -272
  59. package/src/PersonalizationInsights.tsx +232 -232
  60. package/src/SaveToStudioButton.tsx +51 -51
  61. package/src/SpecDrivenTemplateShell.tsx +59 -59
  62. package/src/SpecEditorPanel.tsx +138 -138
  63. package/src/TemplateShell.tsx +50 -50
  64. package/src/bundles/ExampleTemplateBundle.ts +78 -78
  65. package/src/hooks/index.ts +3 -3
  66. package/src/hooks/useBehaviorTracking.ts +252 -252
  67. package/src/hooks/useEvolution.ts +437 -437
  68. package/src/hooks/useRegistryTemplates.ts +42 -42
  69. package/src/hooks/useSpecContent.ts +214 -214
  70. package/src/hooks/useWorkflowComposer.ts +567 -567
  71. package/src/index.ts +12 -11
  72. package/src/lib/component-registry.tsx +40 -40
  73. package/src/lib/runtime-context.tsx +31 -31
  74. package/src/lib/types.ts +57 -57
  75. package/src/markdown/formatPresentationName.ts +9 -0
  76. package/src/markdown/useMarkdownPresentation.ts +107 -0
  77. package/src/overlay-types.ts +15 -15
  78. package/src/utils/fetchPresentationData.ts +13 -13
  79. package/src/utils/generateSpecFromTemplate.ts +29 -29
  80. package/src/utils/index.ts +1 -1
  81. package/tsconfig.json +8 -8
@@ -1,5 +1,5 @@
1
1
  // src/lib/component-registry.tsx
2
- import { useState, useEffect } from "react";
2
+ import { useEffect, useState } from "react";
3
3
  "use client";
4
4
 
5
5
  class TemplateComponentRegistry {
@@ -0,0 +1,9 @@
1
+ // src/markdown/formatPresentationName.ts
2
+ function formatPresentationName(name) {
3
+ const parts = name.split(".");
4
+ const lastPart = parts[parts.length - 1] ?? name;
5
+ return lastPart.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
6
+ }
7
+ export {
8
+ formatPresentationName
9
+ };
@@ -0,0 +1,65 @@
1
+ // src/markdown/useMarkdownPresentation.ts
2
+ import { useCallback, useEffect, useState } from "react";
3
+ "use client";
4
+ function useMarkdownPresentation({
5
+ engine,
6
+ fetchData,
7
+ presentationId,
8
+ presentations,
9
+ resolvePresentation,
10
+ templateId
11
+ }) {
12
+ const [selectedPresentation, setSelectedPresentation] = useState("");
13
+ const [markdownContent, setMarkdownContent] = useState("");
14
+ const [loading, setLoading] = useState(false);
15
+ const [error, setError] = useState(null);
16
+ useEffect(() => {
17
+ if (presentationId && presentations.includes(presentationId)) {
18
+ setSelectedPresentation(presentationId);
19
+ return;
20
+ }
21
+ if (presentations.length === 0) {
22
+ setSelectedPresentation("");
23
+ return;
24
+ }
25
+ if (!presentations.includes(selectedPresentation)) {
26
+ setSelectedPresentation(presentations[0] ?? "");
27
+ }
28
+ }, [presentationId, presentations, selectedPresentation, templateId]);
29
+ const renderMarkdown = useCallback(async () => {
30
+ if (!selectedPresentation || !engine)
31
+ return;
32
+ setLoading(true);
33
+ setError(null);
34
+ try {
35
+ if (!resolvePresentation) {
36
+ throw new Error("resolvePresentation not available in runtime context");
37
+ }
38
+ const descriptor = resolvePresentation(selectedPresentation);
39
+ if (!descriptor) {
40
+ throw new Error(`Presentation descriptor not found: ${selectedPresentation}`);
41
+ }
42
+ const dataResult = await fetchData(selectedPresentation);
43
+ const result = await engine.render("markdown", descriptor, { data: dataResult.data });
44
+ setMarkdownContent(result.body);
45
+ } catch (err) {
46
+ setError(err instanceof Error ? err : new Error("Failed to render markdown"));
47
+ } finally {
48
+ setLoading(false);
49
+ }
50
+ }, [engine, fetchData, resolvePresentation, selectedPresentation]);
51
+ useEffect(() => {
52
+ renderMarkdown();
53
+ }, [renderMarkdown]);
54
+ return {
55
+ error,
56
+ loading,
57
+ markdownContent,
58
+ renderMarkdown,
59
+ selectedPresentation,
60
+ setSelectedPresentation
61
+ };
62
+ }
63
+ export {
64
+ useMarkdownPresentation
65
+ };
@@ -1,2 +1,2 @@
1
- export * from './generateSpecFromTemplate';
2
1
  export * from './fetchPresentationData';
2
+ export * from './generateSpecFromTemplate';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.example-shared-ui",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -108,6 +108,20 @@
108
108
  "node": "./dist/node/LocalDataIndicator.js",
109
109
  "default": "./dist/LocalDataIndicator.js"
110
110
  },
111
+ "./markdown/formatPresentationName": {
112
+ "types": "./dist/markdown/formatPresentationName.d.ts",
113
+ "browser": "./dist/browser/markdown/formatPresentationName.js",
114
+ "bun": "./dist/markdown/formatPresentationName.js",
115
+ "node": "./dist/node/markdown/formatPresentationName.js",
116
+ "default": "./dist/markdown/formatPresentationName.js"
117
+ },
118
+ "./markdown/useMarkdownPresentation": {
119
+ "types": "./dist/markdown/useMarkdownPresentation.d.ts",
120
+ "browser": "./dist/browser/markdown/useMarkdownPresentation.js",
121
+ "bun": "./dist/markdown/useMarkdownPresentation.js",
122
+ "node": "./dist/node/markdown/useMarkdownPresentation.js",
123
+ "default": "./dist/markdown/useMarkdownPresentation.js"
124
+ },
111
125
  "./MarkdownView": {
112
126
  "types": "./dist/MarkdownView.d.ts",
113
127
  "browser": "./dist/browser/MarkdownView.js",
@@ -195,8 +209,8 @@
195
209
  "dev": "contractspec-bun-build dev",
196
210
  "clean": "rimraf dist .turbo",
197
211
  "lint": "bun lint:fix",
198
- "lint:fix": "eslint src --fix",
199
- "lint:check": "eslint src",
212
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
213
+ "lint:check": "biome check .",
200
214
  "test": "bun test --pass-with-no-tests",
201
215
  "prebuild": "contractspec-bun-build prebuild",
202
216
  "typecheck": "tsc --noEmit"
@@ -315,6 +329,20 @@
315
329
  "node": "./dist/node/LocalDataIndicator.js",
316
330
  "default": "./dist/LocalDataIndicator.js"
317
331
  },
332
+ "./markdown/formatPresentationName": {
333
+ "types": "./dist/markdown/formatPresentationName.d.ts",
334
+ "browser": "./dist/browser/markdown/formatPresentationName.js",
335
+ "bun": "./dist/markdown/formatPresentationName.js",
336
+ "node": "./dist/node/markdown/formatPresentationName.js",
337
+ "default": "./dist/markdown/formatPresentationName.js"
338
+ },
339
+ "./markdown/useMarkdownPresentation": {
340
+ "types": "./dist/markdown/useMarkdownPresentation.d.ts",
341
+ "browser": "./dist/browser/markdown/useMarkdownPresentation.js",
342
+ "bun": "./dist/markdown/useMarkdownPresentation.js",
343
+ "node": "./dist/node/markdown/useMarkdownPresentation.js",
344
+ "default": "./dist/markdown/useMarkdownPresentation.js"
345
+ },
318
346
  "./MarkdownView": {
319
347
  "types": "./dist/MarkdownView.d.ts",
320
348
  "browser": "./dist/browser/MarkdownView.js",
@@ -395,7 +423,7 @@
395
423
  }
396
424
  },
397
425
  "peerDependencies": {
398
- "@contractspec/lib.surface-runtime": "0.5.6"
426
+ "@contractspec/lib.surface-runtime": "0.5.7"
399
427
  },
400
428
  "peerDependenciesMeta": {
401
429
  "@contractspec/lib.surface-runtime": {
@@ -404,23 +432,22 @@
404
432
  },
405
433
  "dependencies": {
406
434
  "@apollo/client": "^4.1.6",
407
- "@contractspec/lib.contracts-spec": "3.7.6",
408
- "@contractspec/lib.design-system": "3.7.6",
409
- "@contractspec/lib.ui-kit-web": "3.7.6",
410
- "@tanstack/react-query": "^5.90.21",
411
- "framer-motion": "^12.35.1",
435
+ "@contractspec/lib.contracts-spec": "4.0.0",
436
+ "@contractspec/lib.design-system": "3.8.0",
437
+ "@contractspec/lib.ui-kit-web": "3.8.0",
438
+ "@tanstack/react-query": "^5.91.2",
439
+ "framer-motion": "^12.38.0",
412
440
  "lucide-react": "^0.577.0",
413
441
  "react": "19.2.0",
414
442
  "react-dom": "19.2.0"
415
443
  },
416
444
  "optionalDependencies": {
417
- "@contractspec/lib.surface-runtime": "0.5.6"
445
+ "@contractspec/lib.surface-runtime": "0.5.7"
418
446
  },
419
447
  "devDependencies": {
420
448
  "@contractspec/tool.typescript": "3.7.6",
421
449
  "@types/react": "^19.2.14",
422
450
  "@types/react-dom": "^19.2.2",
423
- "eslint": "^9.39.2",
424
451
  "typescript": "^5.9.3",
425
452
  "@contractspec/tool.bun": "3.7.6"
426
453
  },