@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.
- package/.turbo/turbo-build.log +90 -84
- package/AGENTS.md +43 -25
- package/README.md +63 -35
- package/dist/EvolutionDashboard.js +9 -9
- package/dist/EvolutionSidebar.js +15 -15
- package/dist/LocalDataIndicator.js +3 -3
- package/dist/MarkdownView.d.ts +0 -7
- package/dist/MarkdownView.js +76 -172
- package/dist/PersonalizationInsights.js +12 -12
- package/dist/SaveToStudioButton.js +2 -2
- package/dist/SpecDrivenTemplateShell.d.ts +1 -1
- package/dist/SpecDrivenTemplateShell.js +10 -10
- package/dist/SpecEditorPanel.js +3 -3
- package/dist/TemplateShell.js +10 -10
- package/dist/browser/EvolutionDashboard.js +9 -9
- package/dist/browser/EvolutionSidebar.js +15 -15
- package/dist/browser/LocalDataIndicator.js +3 -3
- package/dist/browser/MarkdownView.js +76 -172
- package/dist/browser/PersonalizationInsights.js +12 -12
- package/dist/browser/SaveToStudioButton.js +2 -2
- package/dist/browser/SpecDrivenTemplateShell.js +10 -10
- package/dist/browser/SpecEditorPanel.js +3 -3
- package/dist/browser/TemplateShell.js +10 -10
- package/dist/browser/hooks/index.js +29 -29
- package/dist/browser/index.js +193 -286
- package/dist/browser/lib/component-registry.js +1 -1
- package/dist/browser/markdown/formatPresentationName.js +9 -0
- package/dist/browser/markdown/useMarkdownPresentation.js +65 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +29 -29
- package/dist/index.d.ts +12 -11
- package/dist/index.js +193 -286
- package/dist/lib/component-registry.js +1 -1
- package/dist/markdown/formatPresentationName.d.ts +1 -0
- package/dist/markdown/formatPresentationName.js +10 -0
- package/dist/markdown/useMarkdownPresentation.d.ts +21 -0
- package/dist/markdown/useMarkdownPresentation.js +66 -0
- package/dist/node/EvolutionDashboard.js +9 -9
- package/dist/node/EvolutionSidebar.js +15 -15
- package/dist/node/LocalDataIndicator.js +3 -3
- package/dist/node/MarkdownView.js +76 -172
- package/dist/node/PersonalizationInsights.js +12 -12
- package/dist/node/SaveToStudioButton.js +2 -2
- package/dist/node/SpecDrivenTemplateShell.js +10 -10
- package/dist/node/SpecEditorPanel.js +3 -3
- package/dist/node/TemplateShell.js +10 -10
- package/dist/node/hooks/index.js +29 -29
- package/dist/node/index.js +193 -286
- package/dist/node/lib/component-registry.js +1 -1
- package/dist/node/markdown/formatPresentationName.js +9 -0
- package/dist/node/markdown/useMarkdownPresentation.js +65 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +38 -11
- package/src/EvolutionDashboard.tsx +415 -415
- package/src/EvolutionSidebar.tsx +245 -245
- package/src/LocalDataIndicator.tsx +28 -28
- package/src/MarkdownView.tsx +119 -372
- package/src/OverlayContextProvider.tsx +272 -272
- package/src/PersonalizationInsights.tsx +232 -232
- package/src/SaveToStudioButton.tsx +51 -51
- package/src/SpecDrivenTemplateShell.tsx +59 -59
- package/src/SpecEditorPanel.tsx +138 -138
- package/src/TemplateShell.tsx +50 -50
- package/src/bundles/ExampleTemplateBundle.ts +78 -78
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useBehaviorTracking.ts +252 -252
- package/src/hooks/useEvolution.ts +437 -437
- package/src/hooks/useRegistryTemplates.ts +42 -42
- package/src/hooks/useSpecContent.ts +214 -214
- package/src/hooks/useWorkflowComposer.ts +567 -567
- package/src/index.ts +12 -11
- package/src/lib/component-registry.tsx +40 -40
- package/src/lib/runtime-context.tsx +31 -31
- package/src/lib/types.ts +57 -57
- package/src/markdown/formatPresentationName.ts +9 -0
- package/src/markdown/useMarkdownPresentation.ts +107 -0
- package/src/overlay-types.ts +15 -15
- package/src/utils/fetchPresentationData.ts +13 -13
- package/src/utils/generateSpecFromTemplate.ts +29 -29
- package/src/utils/index.ts +1 -1
- package/tsconfig.json +8 -8
|
@@ -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
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.example-shared-ui",
|
|
3
|
-
"version": "6.0.
|
|
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": "
|
|
199
|
-
"lint:check": "
|
|
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.
|
|
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": "
|
|
408
|
-
"@contractspec/lib.design-system": "3.
|
|
409
|
-
"@contractspec/lib.ui-kit-web": "3.
|
|
410
|
-
"@tanstack/react-query": "^5.
|
|
411
|
-
"framer-motion": "^12.
|
|
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.
|
|
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
|
},
|