@contractspec/lib.example-shared-ui 6.0.15 → 6.0.17
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 +37 -38
- package/CHANGELOG.md +27 -0
- package/dist/LocalDataIndicator.js +7 -1
- package/dist/MarkdownView.js +7 -1
- package/dist/SaveToStudioButton.js +7 -1
- package/dist/SpecDrivenTemplateShell.js +7 -1
- package/dist/SpecEditorPanel.js +7 -1
- package/dist/TemplateShell.js +7 -1
- package/dist/browser/LocalDataIndicator.js +7 -1
- package/dist/browser/MarkdownView.js +7 -1
- package/dist/browser/SaveToStudioButton.js +7 -1
- package/dist/browser/SpecDrivenTemplateShell.js +7 -1
- package/dist/browser/SpecEditorPanel.js +7 -1
- package/dist/browser/TemplateShell.js +7 -1
- package/dist/browser/hooks/index.js +7 -1
- package/dist/browser/hooks/useSpecContent.js +7 -1
- package/dist/browser/index.js +14 -2
- package/dist/browser/lib/component-registry.js +7 -1
- package/dist/browser/lib/runtime-context.js +7 -1
- package/dist/hooks/index.js +7 -1
- package/dist/hooks/useSpecContent.js +7 -1
- package/dist/index.js +14 -2
- package/dist/lib/component-registry.js +7 -1
- package/dist/lib/runtime-context.d.ts +2 -1
- package/dist/lib/runtime-context.js +7 -1
- package/dist/lib/singletons.test.d.ts +1 -0
- package/dist/node/LocalDataIndicator.js +7 -1
- package/dist/node/MarkdownView.js +7 -1
- package/dist/node/SaveToStudioButton.js +7 -1
- package/dist/node/SpecDrivenTemplateShell.js +7 -1
- package/dist/node/SpecEditorPanel.js +7 -1
- package/dist/node/TemplateShell.js +7 -1
- package/dist/node/hooks/index.js +7 -1
- package/dist/node/hooks/useSpecContent.js +7 -1
- package/dist/node/index.js +14 -2
- package/dist/node/lib/component-registry.js +7 -1
- package/dist/node/lib/runtime-context.js +7 -1
- package/package.json +10 -10
- package/src/lib/component-registry.tsx +15 -1
- package/src/lib/runtime-context.tsx +17 -3
- package/src/lib/singletons.test.ts +54 -0
- package/.turbo/turbo-prebuild.log +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,101 +1,100 @@
|
|
|
1
1
|
$ contractspec-bun-build prebuild
|
|
2
|
-
$ bun run
|
|
3
|
-
$ contractspec-bun-build prebuild
|
|
2
|
+
$ bun run build:bundle && bun run build:types
|
|
4
3
|
$ contractspec-bun-build transpile
|
|
5
4
|
[contractspec-bun-build] transpile target=bun root=src entries=28 noBundle=false
|
|
6
|
-
Bundled 28 modules in
|
|
5
|
+
Bundled 28 modules in 58ms
|
|
7
6
|
|
|
8
7
|
./EvolutionDashboard.js 31.40 KB (entry point)
|
|
9
|
-
./index.js
|
|
8
|
+
./index.js 120.15 KB (entry point)
|
|
10
9
|
./overlay-types.js 8 bytes (entry point)
|
|
11
10
|
utils/index.js 10.1 KB (entry point)
|
|
12
11
|
utils/fetchPresentationData.js 461 bytes (entry point)
|
|
13
|
-
lib/component-registry.js 1.
|
|
12
|
+
lib/component-registry.js 1.56 KB (entry point)
|
|
14
13
|
lib/types.js 8 bytes (entry point)
|
|
15
|
-
./SpecEditorPanel.js 19.
|
|
16
|
-
./TemplateShell.js
|
|
14
|
+
./SpecEditorPanel.js 19.95 KB (entry point)
|
|
15
|
+
./TemplateShell.js 7.16 KB (entry point)
|
|
17
16
|
bundles/index.js 2.44 KB (entry point)
|
|
18
17
|
bundles/ExampleTemplateBundle.js 2.44 KB (entry point)
|
|
19
|
-
hooks/index.js 44.
|
|
18
|
+
hooks/index.js 44.38 KB (entry point)
|
|
20
19
|
hooks/useWorkflowComposer.js 13.67 KB (entry point)
|
|
21
|
-
hooks/useSpecContent.js 14.
|
|
20
|
+
hooks/useSpecContent.js 14.61 KB (entry point)
|
|
22
21
|
utils/generateSpecFromTemplate.js 9.65 KB (entry point)
|
|
23
22
|
hooks/useRegistryTemplates.js 0.94 KB (entry point)
|
|
24
23
|
./EvolutionSidebar.js 21.24 KB (entry point)
|
|
25
24
|
hooks/useEvolution.js 9.50 KB (entry point)
|
|
26
|
-
./MarkdownView.js 7.
|
|
25
|
+
./MarkdownView.js 7.34 KB (entry point)
|
|
27
26
|
markdown/formatPresentationName.js 314 bytes (entry point)
|
|
28
27
|
markdown/useMarkdownPresentation.js 2.1 KB (entry point)
|
|
29
28
|
./OverlayContextProvider.js 5.89 KB (entry point)
|
|
30
29
|
./PersonalizationInsights.js 17.74 KB (entry point)
|
|
31
30
|
hooks/useBehaviorTracking.js 5.53 KB (entry point)
|
|
32
|
-
./SpecDrivenTemplateShell.js
|
|
33
|
-
./LocalDataIndicator.js 2.
|
|
34
|
-
./SaveToStudioButton.js 2.
|
|
35
|
-
lib/runtime-context.js
|
|
31
|
+
./SpecDrivenTemplateShell.js 7.21 KB (entry point)
|
|
32
|
+
./LocalDataIndicator.js 2.52 KB (entry point)
|
|
33
|
+
./SaveToStudioButton.js 2.64 KB (entry point)
|
|
34
|
+
lib/runtime-context.js 0.75 KB (entry point)
|
|
36
35
|
|
|
37
36
|
[contractspec-bun-build] transpile target=node root=src entries=28 noBundle=false
|
|
38
|
-
Bundled 28 modules in
|
|
37
|
+
Bundled 28 modules in 96ms
|
|
39
38
|
|
|
40
39
|
./EvolutionDashboard.js 31.38 KB (entry point)
|
|
41
|
-
./index.js
|
|
40
|
+
./index.js 120.1 KB (entry point)
|
|
42
41
|
./overlay-types.js 0 KB (entry point)
|
|
43
42
|
utils/index.js 10.1 KB (entry point)
|
|
44
43
|
utils/fetchPresentationData.js 453 bytes (entry point)
|
|
45
|
-
lib/component-registry.js 1.
|
|
44
|
+
lib/component-registry.js 1.55 KB (entry point)
|
|
46
45
|
lib/types.js 0 KB (entry point)
|
|
47
|
-
./SpecEditorPanel.js 19.
|
|
48
|
-
./TemplateShell.js
|
|
46
|
+
./SpecEditorPanel.js 19.95 KB (entry point)
|
|
47
|
+
./TemplateShell.js 7.14 KB (entry point)
|
|
49
48
|
bundles/index.js 2.43 KB (entry point)
|
|
50
49
|
bundles/ExampleTemplateBundle.js 2.43 KB (entry point)
|
|
51
|
-
hooks/index.js 44.
|
|
50
|
+
hooks/index.js 44.37 KB (entry point)
|
|
52
51
|
hooks/useWorkflowComposer.js 13.67 KB (entry point)
|
|
53
|
-
hooks/useSpecContent.js 14.
|
|
52
|
+
hooks/useSpecContent.js 14.60 KB (entry point)
|
|
54
53
|
utils/generateSpecFromTemplate.js 9.64 KB (entry point)
|
|
55
54
|
hooks/useRegistryTemplates.js 0.93 KB (entry point)
|
|
56
55
|
./EvolutionSidebar.js 21.23 KB (entry point)
|
|
57
56
|
hooks/useEvolution.js 9.50 KB (entry point)
|
|
58
|
-
./MarkdownView.js 7.
|
|
57
|
+
./MarkdownView.js 7.33 KB (entry point)
|
|
59
58
|
markdown/formatPresentationName.js 306 bytes (entry point)
|
|
60
59
|
markdown/useMarkdownPresentation.js 2.0 KB (entry point)
|
|
61
60
|
./OverlayContextProvider.js 5.88 KB (entry point)
|
|
62
61
|
./PersonalizationInsights.js 17.71 KB (entry point)
|
|
63
62
|
hooks/useBehaviorTracking.js 5.52 KB (entry point)
|
|
64
|
-
./SpecDrivenTemplateShell.js
|
|
65
|
-
./LocalDataIndicator.js 2.
|
|
66
|
-
./SaveToStudioButton.js 2.
|
|
67
|
-
lib/runtime-context.js
|
|
63
|
+
./SpecDrivenTemplateShell.js 7.20 KB (entry point)
|
|
64
|
+
./LocalDataIndicator.js 2.51 KB (entry point)
|
|
65
|
+
./SaveToStudioButton.js 2.63 KB (entry point)
|
|
66
|
+
lib/runtime-context.js 0.74 KB (entry point)
|
|
68
67
|
|
|
69
68
|
[contractspec-bun-build] transpile target=browser root=src entries=28 noBundle=false
|
|
70
|
-
Bundled 28 modules in
|
|
69
|
+
Bundled 28 modules in 81ms
|
|
71
70
|
|
|
72
71
|
./EvolutionDashboard.js 31.38 KB (entry point)
|
|
73
|
-
./index.js
|
|
72
|
+
./index.js 120.1 KB (entry point)
|
|
74
73
|
./overlay-types.js 0 KB (entry point)
|
|
75
74
|
utils/index.js 10.1 KB (entry point)
|
|
76
75
|
utils/fetchPresentationData.js 453 bytes (entry point)
|
|
77
|
-
lib/component-registry.js 1.
|
|
76
|
+
lib/component-registry.js 1.55 KB (entry point)
|
|
78
77
|
lib/types.js 0 KB (entry point)
|
|
79
|
-
./SpecEditorPanel.js 19.
|
|
80
|
-
./TemplateShell.js
|
|
78
|
+
./SpecEditorPanel.js 19.95 KB (entry point)
|
|
79
|
+
./TemplateShell.js 7.14 KB (entry point)
|
|
81
80
|
bundles/index.js 2.43 KB (entry point)
|
|
82
81
|
bundles/ExampleTemplateBundle.js 2.43 KB (entry point)
|
|
83
|
-
hooks/index.js 44.
|
|
82
|
+
hooks/index.js 44.37 KB (entry point)
|
|
84
83
|
hooks/useWorkflowComposer.js 13.67 KB (entry point)
|
|
85
|
-
hooks/useSpecContent.js 14.
|
|
84
|
+
hooks/useSpecContent.js 14.60 KB (entry point)
|
|
86
85
|
utils/generateSpecFromTemplate.js 9.64 KB (entry point)
|
|
87
86
|
hooks/useRegistryTemplates.js 0.93 KB (entry point)
|
|
88
87
|
./EvolutionSidebar.js 21.23 KB (entry point)
|
|
89
88
|
hooks/useEvolution.js 9.50 KB (entry point)
|
|
90
|
-
./MarkdownView.js 7.
|
|
89
|
+
./MarkdownView.js 7.33 KB (entry point)
|
|
91
90
|
markdown/formatPresentationName.js 306 bytes (entry point)
|
|
92
91
|
markdown/useMarkdownPresentation.js 2.0 KB (entry point)
|
|
93
92
|
./OverlayContextProvider.js 5.88 KB (entry point)
|
|
94
93
|
./PersonalizationInsights.js 17.71 KB (entry point)
|
|
95
94
|
hooks/useBehaviorTracking.js 5.52 KB (entry point)
|
|
96
|
-
./SpecDrivenTemplateShell.js
|
|
97
|
-
./LocalDataIndicator.js 2.
|
|
98
|
-
./SaveToStudioButton.js 2.
|
|
99
|
-
lib/runtime-context.js
|
|
95
|
+
./SpecDrivenTemplateShell.js 7.20 KB (entry point)
|
|
96
|
+
./LocalDataIndicator.js 2.51 KB (entry point)
|
|
97
|
+
./SaveToStudioButton.js 2.63 KB (entry point)
|
|
98
|
+
lib/runtime-context.js 0.74 KB (entry point)
|
|
100
99
|
|
|
101
100
|
$ contractspec-bun-build types
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @contractspec/lib.example-shared-ui
|
|
2
2
|
|
|
3
|
+
## 6.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix workflow runtime imports for sandboxed workflow execution and keep workflow authoring on safe subpaths.
|
|
8
|
+
- Migration: Keep Node-only workflow runner code out of "use workflow" entrypoints.
|
|
9
|
+
- Deprecations: Importing the broad `@contractspec/lib.contracts-spec/workflow` barrel from sandboxed workflow entrypoints is discouraged.
|
|
10
|
+
- Updated dependencies because of Fix workflow runtime imports for sandboxed workflow execution and keep workflow authoring on safe subpaths.
|
|
11
|
+
- Updated dependencies because of Add versioning-backed release capsules, generated patch notes, and guided upgrade flows.
|
|
12
|
+
- @contractspec/lib.presentation-runtime-core@3.9.5
|
|
13
|
+
- @contractspec/lib.surface-runtime@0.5.17
|
|
14
|
+
- @contractspec/lib.contracts-spec@5.1.0
|
|
15
|
+
- @contractspec/lib.design-system@3.8.10
|
|
16
|
+
- @contractspec/lib.ui-kit-web@3.9.9
|
|
17
|
+
|
|
18
|
+
## 6.0.16
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 2b59171: fix: crypto package issue due to nodejs only runtime
|
|
23
|
+
- Updated dependencies [2b59171]
|
|
24
|
+
- @contractspec/lib.presentation-runtime-core@3.9.4
|
|
25
|
+
- @contractspec/lib.surface-runtime@0.5.16
|
|
26
|
+
- @contractspec/lib.contracts-spec@5.0.4
|
|
27
|
+
- @contractspec/lib.design-system@3.8.9
|
|
28
|
+
- @contractspec/lib.ui-kit-web@3.9.8
|
|
29
|
+
|
|
3
30
|
## 6.0.15
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
package/dist/MarkdownView.js
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
package/dist/SpecEditorPanel.js
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
package/dist/TemplateShell.js
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -259,7 +259,13 @@ function generateRecommendedActions(anomaly) {
|
|
|
259
259
|
// src/lib/runtime-context.tsx
|
|
260
260
|
import { createContext, useContext } from "react";
|
|
261
261
|
"use client";
|
|
262
|
-
var
|
|
262
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
263
|
+
function getTemplateRuntimeContextSingleton() {
|
|
264
|
+
const store = globalThis;
|
|
265
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
266
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
267
|
+
}
|
|
268
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
263
269
|
function useTemplateRuntime() {
|
|
264
270
|
const context = useContext(TemplateRuntimeContext);
|
|
265
271
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
package/dist/browser/index.js
CHANGED
|
@@ -1073,7 +1073,13 @@ function CompactSuggestionCard({
|
|
|
1073
1073
|
// src/lib/runtime-context.tsx
|
|
1074
1074
|
import { createContext, useContext } from "react";
|
|
1075
1075
|
"use client";
|
|
1076
|
-
var
|
|
1076
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
1077
|
+
function getTemplateRuntimeContextSingleton() {
|
|
1078
|
+
const store = globalThis;
|
|
1079
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
1080
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
1081
|
+
}
|
|
1082
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
1077
1083
|
function useTemplateRuntime() {
|
|
1078
1084
|
const context = useContext(TemplateRuntimeContext);
|
|
1079
1085
|
if (!context) {
|
|
@@ -3422,7 +3428,13 @@ class TemplateComponentRegistry {
|
|
|
3422
3428
|
};
|
|
3423
3429
|
}
|
|
3424
3430
|
}
|
|
3425
|
-
var
|
|
3431
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
3432
|
+
function getTemplateComponentRegistrySingleton() {
|
|
3433
|
+
const store = globalThis;
|
|
3434
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
3435
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
3436
|
+
}
|
|
3437
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
3426
3438
|
function registerTemplateComponents(templateId, components) {
|
|
3427
3439
|
templateComponentRegistry.register(templateId, components);
|
|
3428
3440
|
}
|
|
@@ -19,7 +19,13 @@ class TemplateComponentRegistry {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
23
|
+
function getTemplateComponentRegistrySingleton() {
|
|
24
|
+
const store = globalThis;
|
|
25
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
26
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
27
|
+
}
|
|
28
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
23
29
|
function registerTemplateComponents(templateId, components) {
|
|
24
30
|
templateComponentRegistry.register(templateId, components);
|
|
25
31
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
package/dist/hooks/index.js
CHANGED
|
@@ -260,7 +260,13 @@ function generateRecommendedActions(anomaly) {
|
|
|
260
260
|
// src/lib/runtime-context.tsx
|
|
261
261
|
import { createContext, useContext } from "react";
|
|
262
262
|
"use client";
|
|
263
|
-
var
|
|
263
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
264
|
+
function getTemplateRuntimeContextSingleton() {
|
|
265
|
+
const store = globalThis;
|
|
266
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
267
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
268
|
+
}
|
|
269
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
264
270
|
function useTemplateRuntime() {
|
|
265
271
|
const context = useContext(TemplateRuntimeContext);
|
|
266
272
|
if (!context) {
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
package/dist/index.js
CHANGED
|
@@ -1074,7 +1074,13 @@ function CompactSuggestionCard({
|
|
|
1074
1074
|
// src/lib/runtime-context.tsx
|
|
1075
1075
|
import { createContext, useContext } from "react";
|
|
1076
1076
|
"use client";
|
|
1077
|
-
var
|
|
1077
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
1078
|
+
function getTemplateRuntimeContextSingleton() {
|
|
1079
|
+
const store = globalThis;
|
|
1080
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
1081
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
1082
|
+
}
|
|
1083
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
1078
1084
|
function useTemplateRuntime() {
|
|
1079
1085
|
const context = useContext(TemplateRuntimeContext);
|
|
1080
1086
|
if (!context) {
|
|
@@ -3423,7 +3429,13 @@ class TemplateComponentRegistry {
|
|
|
3423
3429
|
};
|
|
3424
3430
|
}
|
|
3425
3431
|
}
|
|
3426
|
-
var
|
|
3432
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
3433
|
+
function getTemplateComponentRegistrySingleton() {
|
|
3434
|
+
const store = globalThis;
|
|
3435
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
3436
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
3437
|
+
}
|
|
3438
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
3427
3439
|
function registerTemplateComponents(templateId, components) {
|
|
3428
3440
|
templateComponentRegistry.register(templateId, components);
|
|
3429
3441
|
}
|
|
@@ -20,7 +20,13 @@ class TemplateComponentRegistry {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
var
|
|
23
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
24
|
+
function getTemplateComponentRegistrySingleton() {
|
|
25
|
+
const store = globalThis;
|
|
26
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
27
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
28
|
+
}
|
|
29
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
24
30
|
function registerTemplateComponents(templateId, components) {
|
|
25
31
|
templateComponentRegistry.register(templateId, components);
|
|
26
32
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApolloClient } from '@apollo/client';
|
|
2
2
|
import type { TransformEngine } from '@contractspec/lib.presentation-runtime-core/transform-engine';
|
|
3
|
+
import { type Context } from 'react';
|
|
3
4
|
import type { TemplateDefinition, TemplateId, TemplateInstaller } from './types';
|
|
4
5
|
export type GenericTemplateHandlers = unknown;
|
|
5
6
|
export interface TemplateRuntimeContextValue<THandlers = GenericTemplateHandlers> {
|
|
@@ -19,7 +20,7 @@ export interface TemplateRuntimeContextValue<THandlers = GenericTemplateHandlers
|
|
|
19
20
|
handlers: THandlers;
|
|
20
21
|
resolvePresentation?: (presentationName: string) => unknown;
|
|
21
22
|
}
|
|
22
|
-
export declare const TemplateRuntimeContext:
|
|
23
|
+
export declare const TemplateRuntimeContext: Context<TemplateRuntimeContextValue<unknown> | null>;
|
|
23
24
|
export declare function useTemplateRuntime<THandlers = GenericTemplateHandlers>(): TemplateRuntimeContextValue<THandlers>;
|
|
24
25
|
export interface TemplateRuntimeProviderProps {
|
|
25
26
|
templateId: TemplateId;
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// src/lib/runtime-context.tsx
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
"use client";
|
|
5
|
-
var
|
|
5
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
6
|
+
function getTemplateRuntimeContextSingleton() {
|
|
7
|
+
const store = globalThis;
|
|
8
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
9
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
10
|
+
}
|
|
11
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
6
12
|
function useTemplateRuntime() {
|
|
7
13
|
const context = useContext(TemplateRuntimeContext);
|
|
8
14
|
if (!context) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
package/dist/node/hooks/index.js
CHANGED
|
@@ -259,7 +259,13 @@ function generateRecommendedActions(anomaly) {
|
|
|
259
259
|
// src/lib/runtime-context.tsx
|
|
260
260
|
import { createContext, useContext } from "react";
|
|
261
261
|
"use client";
|
|
262
|
-
var
|
|
262
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
263
|
+
function getTemplateRuntimeContextSingleton() {
|
|
264
|
+
const store = globalThis;
|
|
265
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
266
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
267
|
+
}
|
|
268
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
263
269
|
function useTemplateRuntime() {
|
|
264
270
|
const context = useContext(TemplateRuntimeContext);
|
|
265
271
|
if (!context) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
package/dist/node/index.js
CHANGED
|
@@ -1073,7 +1073,13 @@ function CompactSuggestionCard({
|
|
|
1073
1073
|
// src/lib/runtime-context.tsx
|
|
1074
1074
|
import { createContext, useContext } from "react";
|
|
1075
1075
|
"use client";
|
|
1076
|
-
var
|
|
1076
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
1077
|
+
function getTemplateRuntimeContextSingleton() {
|
|
1078
|
+
const store = globalThis;
|
|
1079
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
1080
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
1081
|
+
}
|
|
1082
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
1077
1083
|
function useTemplateRuntime() {
|
|
1078
1084
|
const context = useContext(TemplateRuntimeContext);
|
|
1079
1085
|
if (!context) {
|
|
@@ -3422,7 +3428,13 @@ class TemplateComponentRegistry {
|
|
|
3422
3428
|
};
|
|
3423
3429
|
}
|
|
3424
3430
|
}
|
|
3425
|
-
var
|
|
3431
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
3432
|
+
function getTemplateComponentRegistrySingleton() {
|
|
3433
|
+
const store = globalThis;
|
|
3434
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
3435
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
3436
|
+
}
|
|
3437
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
3426
3438
|
function registerTemplateComponents(templateId, components) {
|
|
3427
3439
|
templateComponentRegistry.register(templateId, components);
|
|
3428
3440
|
}
|
|
@@ -19,7 +19,13 @@ class TemplateComponentRegistry {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-component-registry");
|
|
23
|
+
function getTemplateComponentRegistrySingleton() {
|
|
24
|
+
const store = globalThis;
|
|
25
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry;
|
|
26
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
27
|
+
}
|
|
28
|
+
var templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
23
29
|
function registerTemplateComponents(templateId, components) {
|
|
24
30
|
templateComponentRegistry.register(templateId, components);
|
|
25
31
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/lib/runtime-context.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
"use client";
|
|
4
|
-
var
|
|
4
|
+
var TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for("@contractspec/lib.example-shared-ui/template-runtime-context");
|
|
5
|
+
function getTemplateRuntimeContextSingleton() {
|
|
6
|
+
const store = globalThis;
|
|
7
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??= createContext(null);
|
|
8
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
9
|
+
}
|
|
10
|
+
var TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
5
11
|
function useTemplateRuntime() {
|
|
6
12
|
const context = useContext(TemplateRuntimeContext);
|
|
7
13
|
if (!context) {
|
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.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"scripts": {
|
|
204
204
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
205
205
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
206
|
-
"build": "bun run
|
|
206
|
+
"build": "bun run build:bundle && bun run build:types",
|
|
207
207
|
"build:bundle": "contractspec-bun-build transpile",
|
|
208
208
|
"build:types": "contractspec-bun-build types",
|
|
209
209
|
"dev": "contractspec-bun-build dev",
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
}
|
|
424
424
|
},
|
|
425
425
|
"peerDependencies": {
|
|
426
|
-
"@contractspec/lib.surface-runtime": "0.5.
|
|
426
|
+
"@contractspec/lib.surface-runtime": "0.5.17"
|
|
427
427
|
},
|
|
428
428
|
"peerDependenciesMeta": {
|
|
429
429
|
"@contractspec/lib.surface-runtime": {
|
|
@@ -432,25 +432,25 @@
|
|
|
432
432
|
},
|
|
433
433
|
"dependencies": {
|
|
434
434
|
"@apollo/client": "^4.1.6",
|
|
435
|
-
"@contractspec/lib.contracts-spec": "5.0
|
|
436
|
-
"@contractspec/lib.design-system": "3.8.
|
|
437
|
-
"@contractspec/lib.ui-kit-web": "3.9.
|
|
435
|
+
"@contractspec/lib.contracts-spec": "5.1.0",
|
|
436
|
+
"@contractspec/lib.design-system": "3.8.10",
|
|
437
|
+
"@contractspec/lib.ui-kit-web": "3.9.9",
|
|
438
438
|
"@tanstack/react-query": "^5.95.2",
|
|
439
439
|
"framer-motion": "^12.38.0",
|
|
440
440
|
"lucide-react": "^1.6.0",
|
|
441
441
|
"react": "19.2.0",
|
|
442
442
|
"react-dom": "19.2.0",
|
|
443
|
-
"@contractspec/lib.presentation-runtime-core": "3.9.
|
|
443
|
+
"@contractspec/lib.presentation-runtime-core": "3.9.5"
|
|
444
444
|
},
|
|
445
445
|
"optionalDependencies": {
|
|
446
|
-
"@contractspec/lib.surface-runtime": "0.5.
|
|
446
|
+
"@contractspec/lib.surface-runtime": "0.5.17"
|
|
447
447
|
},
|
|
448
448
|
"devDependencies": {
|
|
449
|
-
"@contractspec/tool.typescript": "3.7.
|
|
449
|
+
"@contractspec/tool.typescript": "3.7.13",
|
|
450
450
|
"@types/react": "^19.2.14",
|
|
451
451
|
"@types/react-dom": "^19.2.2",
|
|
452
452
|
"typescript": "^5.9.3",
|
|
453
|
-
"@contractspec/tool.bun": "3.7.
|
|
453
|
+
"@contractspec/tool.bun": "3.7.13"
|
|
454
454
|
},
|
|
455
455
|
"types": "./dist/index.d.ts"
|
|
456
456
|
}
|
|
@@ -36,7 +36,21 @@ export class TemplateComponentRegistry {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for(
|
|
40
|
+
'@contractspec/lib.example-shared-ui/template-component-registry'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
type TemplateComponentRegistryStore = typeof globalThis & {
|
|
44
|
+
[TEMPLATE_COMPONENT_REGISTRY_KEY]?: TemplateComponentRegistry;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function getTemplateComponentRegistrySingleton() {
|
|
48
|
+
const store = globalThis as TemplateComponentRegistryStore;
|
|
49
|
+
store[TEMPLATE_COMPONENT_REGISTRY_KEY] ??= new TemplateComponentRegistry();
|
|
50
|
+
return store[TEMPLATE_COMPONENT_REGISTRY_KEY];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const templateComponentRegistry = getTemplateComponentRegistrySingleton();
|
|
40
54
|
|
|
41
55
|
export function registerTemplateComponents(
|
|
42
56
|
templateId: TemplateId,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ApolloClient } from '@apollo/client';
|
|
4
4
|
import type { TransformEngine } from '@contractspec/lib.presentation-runtime-core/transform-engine';
|
|
5
|
-
import { createContext, useContext } from 'react';
|
|
5
|
+
import { createContext, useContext, type Context } from 'react';
|
|
6
6
|
import type {
|
|
7
7
|
TemplateDefinition,
|
|
8
8
|
TemplateId,
|
|
@@ -32,8 +32,22 @@ export interface TemplateRuntimeContextValue<
|
|
|
32
32
|
resolvePresentation?: (presentationName: string) => unknown;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for(
|
|
36
|
+
'@contractspec/lib.example-shared-ui/template-runtime-context'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
type TemplateRuntimeContextStore = typeof globalThis & {
|
|
40
|
+
[TEMPLATE_RUNTIME_CONTEXT_KEY]?: Context<TemplateRuntimeContextValue | null>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function getTemplateRuntimeContextSingleton() {
|
|
44
|
+
const store = globalThis as TemplateRuntimeContextStore;
|
|
45
|
+
store[TEMPLATE_RUNTIME_CONTEXT_KEY] ??=
|
|
46
|
+
createContext<TemplateRuntimeContextValue | null>(null);
|
|
47
|
+
return store[TEMPLATE_RUNTIME_CONTEXT_KEY];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const TemplateRuntimeContext = getTemplateRuntimeContextSingleton();
|
|
37
51
|
|
|
38
52
|
export function useTemplateRuntime<
|
|
39
53
|
THandlers = GenericTemplateHandlers,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import {
|
|
3
|
+
registerTemplateComponents,
|
|
4
|
+
templateComponentRegistry,
|
|
5
|
+
} from './component-registry';
|
|
6
|
+
import { TemplateRuntimeContext } from './runtime-context';
|
|
7
|
+
|
|
8
|
+
const TEMPLATE_RUNTIME_CONTEXT_KEY = Symbol.for(
|
|
9
|
+
'@contractspec/lib.example-shared-ui/template-runtime-context'
|
|
10
|
+
);
|
|
11
|
+
const TEMPLATE_COMPONENT_REGISTRY_KEY = Symbol.for(
|
|
12
|
+
'@contractspec/lib.example-shared-ui/template-component-registry'
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const DummyComponent = () => null;
|
|
16
|
+
|
|
17
|
+
describe('@contractspec/lib.example-shared-ui singletons', () => {
|
|
18
|
+
test('stores TemplateRuntimeContext on globalThis and reuses it', async () => {
|
|
19
|
+
const runtimeContextStore = globalThis as Record<PropertyKey, unknown>;
|
|
20
|
+
const runtimeContextModule = await import('./runtime-context');
|
|
21
|
+
|
|
22
|
+
expect(runtimeContextStore[TEMPLATE_RUNTIME_CONTEXT_KEY]).toBe(
|
|
23
|
+
TemplateRuntimeContext
|
|
24
|
+
);
|
|
25
|
+
expect(runtimeContextModule.TemplateRuntimeContext).toBe(
|
|
26
|
+
TemplateRuntimeContext
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test(
|
|
31
|
+
'stores TemplateComponentRegistry on globalThis and reuses registrations',
|
|
32
|
+
async () => {
|
|
33
|
+
const registryStore = globalThis as Record<PropertyKey, unknown>;
|
|
34
|
+
const registryModule = await import('./component-registry');
|
|
35
|
+
const templateId = `singleton-test-${Date.now()}`;
|
|
36
|
+
const registration = {
|
|
37
|
+
list: DummyComponent,
|
|
38
|
+
detail: DummyComponent,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
registerTemplateComponents(templateId, registration);
|
|
42
|
+
|
|
43
|
+
expect(registryStore[TEMPLATE_COMPONENT_REGISTRY_KEY]).toBe(
|
|
44
|
+
templateComponentRegistry
|
|
45
|
+
);
|
|
46
|
+
expect(registryModule.templateComponentRegistry).toBe(
|
|
47
|
+
templateComponentRegistry
|
|
48
|
+
);
|
|
49
|
+
expect(registryModule.templateComponentRegistry.get(templateId)).toBe(
|
|
50
|
+
registration
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ contractspec-bun-build prebuild
|