@contractspec/lib.example-shared-ui 6.0.6 → 6.0.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 (82) hide show
  1. package/.turbo/turbo-build.log +90 -84
  2. package/AGENTS.md +43 -25
  3. package/CHANGELOG.md +24 -0
  4. package/README.md +63 -35
  5. package/dist/EvolutionDashboard.js +9 -9
  6. package/dist/EvolutionSidebar.js +15 -15
  7. package/dist/LocalDataIndicator.js +3 -3
  8. package/dist/MarkdownView.d.ts +0 -7
  9. package/dist/MarkdownView.js +76 -172
  10. package/dist/PersonalizationInsights.js +12 -12
  11. package/dist/SaveToStudioButton.js +2 -2
  12. package/dist/SpecDrivenTemplateShell.d.ts +1 -1
  13. package/dist/SpecDrivenTemplateShell.js +10 -10
  14. package/dist/SpecEditorPanel.js +3 -3
  15. package/dist/TemplateShell.js +10 -10
  16. package/dist/browser/EvolutionDashboard.js +9 -9
  17. package/dist/browser/EvolutionSidebar.js +15 -15
  18. package/dist/browser/LocalDataIndicator.js +3 -3
  19. package/dist/browser/MarkdownView.js +76 -172
  20. package/dist/browser/PersonalizationInsights.js +12 -12
  21. package/dist/browser/SaveToStudioButton.js +2 -2
  22. package/dist/browser/SpecDrivenTemplateShell.js +10 -10
  23. package/dist/browser/SpecEditorPanel.js +3 -3
  24. package/dist/browser/TemplateShell.js +10 -10
  25. package/dist/browser/hooks/index.js +29 -29
  26. package/dist/browser/index.js +193 -286
  27. package/dist/browser/lib/component-registry.js +1 -1
  28. package/dist/browser/markdown/formatPresentationName.js +9 -0
  29. package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
  30. package/dist/hooks/index.d.ts +3 -3
  31. package/dist/hooks/index.js +29 -29
  32. package/dist/index.d.ts +12 -11
  33. package/dist/index.js +193 -286
  34. package/dist/lib/component-registry.js +1 -1
  35. package/dist/markdown/formatPresentationName.d.ts +1 -0
  36. package/dist/markdown/formatPresentationName.js +10 -0
  37. package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
  38. package/dist/markdown/useMarkdownPresentation.js +66 -0
  39. package/dist/node/EvolutionDashboard.js +9 -9
  40. package/dist/node/EvolutionSidebar.js +15 -15
  41. package/dist/node/LocalDataIndicator.js +3 -3
  42. package/dist/node/MarkdownView.js +76 -172
  43. package/dist/node/PersonalizationInsights.js +12 -12
  44. package/dist/node/SaveToStudioButton.js +2 -2
  45. package/dist/node/SpecDrivenTemplateShell.js +10 -10
  46. package/dist/node/SpecEditorPanel.js +3 -3
  47. package/dist/node/TemplateShell.js +10 -10
  48. package/dist/node/hooks/index.js +29 -29
  49. package/dist/node/index.js +193 -286
  50. package/dist/node/lib/component-registry.js +1 -1
  51. package/dist/node/markdown/formatPresentationName.js +9 -0
  52. package/dist/node/markdown/useMarkdownPresentation.js +65 -0
  53. package/dist/utils/index.d.ts +1 -1
  54. package/package.json +40 -13
  55. package/src/EvolutionDashboard.tsx +415 -415
  56. package/src/EvolutionSidebar.tsx +245 -245
  57. package/src/LocalDataIndicator.tsx +28 -28
  58. package/src/MarkdownView.tsx +119 -372
  59. package/src/OverlayContextProvider.tsx +272 -272
  60. package/src/PersonalizationInsights.tsx +232 -232
  61. package/src/SaveToStudioButton.tsx +51 -51
  62. package/src/SpecDrivenTemplateShell.tsx +59 -59
  63. package/src/SpecEditorPanel.tsx +138 -138
  64. package/src/TemplateShell.tsx +50 -50
  65. package/src/bundles/ExampleTemplateBundle.ts +78 -78
  66. package/src/hooks/index.ts +3 -3
  67. package/src/hooks/useBehaviorTracking.ts +252 -252
  68. package/src/hooks/useEvolution.ts +437 -437
  69. package/src/hooks/useRegistryTemplates.ts +42 -42
  70. package/src/hooks/useSpecContent.ts +214 -214
  71. package/src/hooks/useWorkflowComposer.ts +567 -567
  72. package/src/index.ts +12 -11
  73. package/src/lib/component-registry.tsx +40 -40
  74. package/src/lib/runtime-context.tsx +31 -31
  75. package/src/lib/types.ts +57 -57
  76. package/src/markdown/formatPresentationName.ts +9 -0
  77. package/src/markdown/useMarkdownPresentation.ts +107 -0
  78. package/src/overlay-types.ts +15 -15
  79. package/src/utils/fetchPresentationData.ts +13 -13
  80. package/src/utils/generateSpecFromTemplate.ts +29 -29
  81. package/src/utils/index.ts +1 -1
  82. 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.10",
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.10"
399
427
  },
400
428
  "peerDependenciesMeta": {
401
429
  "@contractspec/lib.surface-runtime": {
@@ -404,25 +432,24 @@
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.1.2",
436
+ "@contractspec/lib.design-system": "3.8.3",
437
+ "@contractspec/lib.ui-kit-web": "3.9.2",
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.10"
418
446
  },
419
447
  "devDependencies": {
420
- "@contractspec/tool.typescript": "3.7.6",
448
+ "@contractspec/tool.typescript": "3.7.8",
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
- "@contractspec/tool.bun": "3.7.6"
452
+ "@contractspec/tool.bun": "3.7.8"
426
453
  },
427
454
  "types": "./dist/index.d.ts"
428
455
  }