@primafuture/contrib-kit-react 1.0.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.
Files changed (128) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +294 -0
  3. package/dist/contribution-component.d.ts +82 -0
  4. package/dist/contribution-component.d.ts.map +1 -0
  5. package/dist/contribution-component.js +12 -0
  6. package/dist/contribution-component.js.map +1 -0
  7. package/dist/extension-outlet.d.ts +155 -0
  8. package/dist/extension-outlet.d.ts.map +1 -0
  9. package/dist/extension-outlet.js +229 -0
  10. package/dist/extension-outlet.js.map +1 -0
  11. package/dist/extension-registry-provider.d.ts +26 -0
  12. package/dist/extension-registry-provider.d.ts.map +1 -0
  13. package/dist/extension-registry-provider.js +82 -0
  14. package/dist/extension-registry-provider.js.map +1 -0
  15. package/dist/index.d.ts +22 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +14 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/internal/adapter-configuration.d.ts +54 -0
  20. package/dist/internal/adapter-configuration.d.ts.map +1 -0
  21. package/dist/internal/adapter-configuration.js +89 -0
  22. package/dist/internal/adapter-configuration.js.map +1 -0
  23. package/dist/internal/adapter-context.d.ts +24 -0
  24. package/dist/internal/adapter-context.d.ts.map +1 -0
  25. package/dist/internal/adapter-context.js +23 -0
  26. package/dist/internal/adapter-context.js.map +1 -0
  27. package/dist/internal/adapter-registry-bridge.d.ts +58 -0
  28. package/dist/internal/adapter-registry-bridge.d.ts.map +1 -0
  29. package/dist/internal/adapter-registry-bridge.js +494 -0
  30. package/dist/internal/adapter-registry-bridge.js.map +1 -0
  31. package/dist/internal/adapter-registry-protocol.d.ts +53 -0
  32. package/dist/internal/adapter-registry-protocol.d.ts.map +1 -0
  33. package/dist/internal/adapter-registry-protocol.js +182 -0
  34. package/dist/internal/adapter-registry-protocol.js.map +1 -0
  35. package/dist/internal/adapter-scope.d.ts +87 -0
  36. package/dist/internal/adapter-scope.d.ts.map +1 -0
  37. package/dist/internal/adapter-scope.js +346 -0
  38. package/dist/internal/adapter-scope.js.map +1 -0
  39. package/dist/internal/implementation-classifier.d.ts +21 -0
  40. package/dist/internal/implementation-classifier.d.ts.map +1 -0
  41. package/dist/internal/implementation-classifier.js +39 -0
  42. package/dist/internal/implementation-classifier.js.map +1 -0
  43. package/dist/internal/managed-lazy-generation.d.ts +100 -0
  44. package/dist/internal/managed-lazy-generation.d.ts.map +1 -0
  45. package/dist/internal/managed-lazy-generation.js +419 -0
  46. package/dist/internal/managed-lazy-generation.js.map +1 -0
  47. package/dist/internal/outlet-commit-lease.d.ts +46 -0
  48. package/dist/internal/outlet-commit-lease.d.ts.map +1 -0
  49. package/dist/internal/outlet-commit-lease.js +137 -0
  50. package/dist/internal/outlet-commit-lease.js.map +1 -0
  51. package/dist/internal/outlet-error-pipeline.d.ts +122 -0
  52. package/dist/internal/outlet-error-pipeline.d.ts.map +1 -0
  53. package/dist/internal/outlet-error-pipeline.js +214 -0
  54. package/dist/internal/outlet-error-pipeline.js.map +1 -0
  55. package/dist/internal/outlet-input.d.ts +42 -0
  56. package/dist/internal/outlet-input.d.ts.map +1 -0
  57. package/dist/internal/outlet-input.js +86 -0
  58. package/dist/internal/outlet-input.js.map +1 -0
  59. package/dist/internal/outlet-membership-boundary.d.ts +93 -0
  60. package/dist/internal/outlet-membership-boundary.d.ts.map +1 -0
  61. package/dist/internal/outlet-membership-boundary.js +710 -0
  62. package/dist/internal/outlet-membership-boundary.js.map +1 -0
  63. package/dist/internal/outlet-membership.d.ts +31 -0
  64. package/dist/internal/outlet-membership.d.ts.map +1 -0
  65. package/dist/internal/outlet-membership.js +65 -0
  66. package/dist/internal/outlet-membership.js.map +1 -0
  67. package/dist/internal/outlet-projection.d.ts +102 -0
  68. package/dist/internal/outlet-projection.d.ts.map +1 -0
  69. package/dist/internal/outlet-projection.js +228 -0
  70. package/dist/internal/outlet-projection.js.map +1 -0
  71. package/dist/internal/outlet-reporter-boundary.d.ts +42 -0
  72. package/dist/internal/outlet-reporter-boundary.d.ts.map +1 -0
  73. package/dist/internal/outlet-reporter-boundary.js +57 -0
  74. package/dist/internal/outlet-reporter-boundary.js.map +1 -0
  75. package/dist/internal/public-input-capture.d.ts +13 -0
  76. package/dist/internal/public-input-capture.d.ts.map +1 -0
  77. package/dist/internal/public-input-capture.js +34 -0
  78. package/dist/internal/public-input-capture.js.map +1 -0
  79. package/dist/internal/resolved-contributions-query.d.ts +42 -0
  80. package/dist/internal/resolved-contributions-query.d.ts.map +1 -0
  81. package/dist/internal/resolved-contributions-query.js +203 -0
  82. package/dist/internal/resolved-contributions-query.js.map +1 -0
  83. package/dist/react-adapter-diagnostics.d.ts +199 -0
  84. package/dist/react-adapter-diagnostics.d.ts.map +1 -0
  85. package/dist/react-adapter-diagnostics.js +257 -0
  86. package/dist/react-adapter-diagnostics.js.map +1 -0
  87. package/dist/react-adapter-error.d.ts +35 -0
  88. package/dist/react-adapter-error.d.ts.map +1 -0
  89. package/dist/react-adapter-error.js +37 -0
  90. package/dist/react-adapter-error.js.map +1 -0
  91. package/dist/react-extension-point.d.ts +26 -0
  92. package/dist/react-extension-point.d.ts.map +1 -0
  93. package/dist/react-extension-point.js +100 -0
  94. package/dist/react-extension-point.js.map +1 -0
  95. package/dist/react-lazy-contribution.d.ts +40 -0
  96. package/dist/react-lazy-contribution.d.ts.map +1 -0
  97. package/dist/react-lazy-contribution.js +18 -0
  98. package/dist/react-lazy-contribution.js.map +1 -0
  99. package/dist/resolved-contributions.d.ts +90 -0
  100. package/dist/resolved-contributions.d.ts.map +1 -0
  101. package/dist/resolved-contributions.js +455 -0
  102. package/dist/resolved-contributions.js.map +1 -0
  103. package/package.json +47 -0
  104. package/src/contribution-component.ts +118 -0
  105. package/src/extension-outlet.ts +590 -0
  106. package/src/extension-registry-provider.ts +179 -0
  107. package/src/index.ts +72 -0
  108. package/src/internal/adapter-configuration.ts +181 -0
  109. package/src/internal/adapter-context.ts +43 -0
  110. package/src/internal/adapter-registry-bridge.ts +723 -0
  111. package/src/internal/adapter-registry-protocol.ts +365 -0
  112. package/src/internal/adapter-scope.ts +500 -0
  113. package/src/internal/implementation-classifier.ts +59 -0
  114. package/src/internal/managed-lazy-generation.ts +540 -0
  115. package/src/internal/outlet-commit-lease.ts +216 -0
  116. package/src/internal/outlet-error-pipeline.ts +447 -0
  117. package/src/internal/outlet-input.ts +264 -0
  118. package/src/internal/outlet-membership-boundary.ts +1048 -0
  119. package/src/internal/outlet-membership.ts +125 -0
  120. package/src/internal/outlet-projection.ts +511 -0
  121. package/src/internal/outlet-reporter-boundary.ts +105 -0
  122. package/src/internal/public-input-capture.ts +55 -0
  123. package/src/internal/resolved-contributions-query.ts +318 -0
  124. package/src/react-adapter-diagnostics.ts +457 -0
  125. package/src/react-adapter-error.ts +88 -0
  126. package/src/react-extension-point.ts +181 -0
  127. package/src/react-lazy-contribution.ts +66 -0
  128. package/src/resolved-contributions.ts +895 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolved-contributions.d.ts","sourceRoot":"","sources":["../src/resolved-contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAOhE,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,iBAAiB,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,0BAA0B,MAAM,4CAA4C,CAAC;AAGzF,OAAO,KAAK,KAAK,mBAAmB,MAAM,4BAA4B,CAAC;AAEvE,yDAAyD;AACzD,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,CACrC,KAAK,SAAS,OAAO,4BAA4B,EAAE,sBAAsB,IAEvE;IACD,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,6DAA6D;IAC7D,QAA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@@
1
+ import * as contribKitCore from "@primafuture/contrib-kit-core";
2
+ import * as react from "react";
3
+ import * as adapterConfiguration from "./internal/adapter-configuration.js";
4
+ import * as adapterContext from "./internal/adapter-context.js";
5
+ import * as adapterRegistryBridge from "./internal/adapter-registry-bridge.js";
6
+ import * as adapterRegistryProtocol from "./internal/adapter-registry-protocol.js";
7
+ import * as adapterScope from "./internal/adapter-scope.js";
8
+ import * as outletCommitLease from "./internal/outlet-commit-lease.js";
9
+ import * as outletInput from "./internal/outlet-input.js";
10
+ import * as publicInputCapture from "./internal/public-input-capture.js";
11
+ import * as resolvedContributionsQuery from "./internal/resolved-contributions-query.js";
12
+ import * as reactAdapterDiagnostics from "./react-adapter-diagnostics.js";
13
+ import * as reactAdapterError from "./react-adapter-error.js";
14
+ /** Stable external-store fallback pro configuration a unavailable větve. */
15
+ const EMPTY_EXTERNAL_STORE = Object.freeze({
16
+ /** Resource-free subscribe vracející idempotentní no-op. */
17
+ subscribe() {
18
+ /** Resource-free unsubscribe fallback. */
19
+ function unsubscribe() {
20
+ // Bez validního registry protocolu nevznikla žádná resource.
21
+ }
22
+ return unsubscribe;
23
+ },
24
+ /** Konstantní client snapshot bez host reads. */
25
+ getSnapshot() {
26
+ return "disposed:0";
27
+ },
28
+ /** Konstantní server snapshot sdílený s normálním bridgem. */
29
+ getServerSnapshot() {
30
+ return "contrib-kit-react:server";
31
+ },
32
+ /** Neexistující bridge nemůže mít committed fault. */
33
+ readFault() {
34
+ return undefined;
35
+ },
36
+ /** Fallback pouze splní interní structural interface. */
37
+ readRegistryState() {
38
+ return "disposed";
39
+ },
40
+ });
41
+ /** Vytvoří resource-free consumer-local scope jako lazy React state. */
42
+ function createConsumerScope() {
43
+ return new adapterScope.AdapterScopeRuntime();
44
+ }
45
+ /** Ověří, že point může bezpečně sloužit jako exact WeakMap capability key. */
46
+ function requirePointObject(value) {
47
+ if (typeof value !== "object" || value === null) {
48
+ throw new reactAdapterError.ReactAdapterError("REACT_INVALID_ARGUMENT", "options.point must be a non-null object.", { details: { field: "options.point", phase: "configuration" } });
49
+ }
50
+ return value;
51
+ }
52
+ /** Rozpozná unavailable query failure, která patří do public failed state. */
53
+ function isUnavailableProtocolError(cause) {
54
+ return cause instanceof reactAdapterError.ReactAdapterError
55
+ && cause.code === "REACT_REGISTRY_UNAVAILABLE"
56
+ && cause.details.phase === "resolve";
57
+ }
58
+ /**
59
+ * Zachytí structural registry protocol pro již read-once point/context/config vstup.
60
+ */
61
+ function captureResolvedRegistry(point, context, registry, configuration, parent, localScope, checkpoint) {
62
+ const scope = parent?.scope ?? localScope;
63
+ let protocol;
64
+ try {
65
+ protocol = adapterRegistryProtocol.captureAdapterRegistryProtocol(registry, checkpoint);
66
+ }
67
+ catch (cause) {
68
+ if (isUnavailableProtocolError(cause)) {
69
+ return Object.freeze({
70
+ kind: "unavailable",
71
+ point,
72
+ context,
73
+ configuration,
74
+ scope,
75
+ rawRegistry: registry,
76
+ generation: parent?.generation,
77
+ cause,
78
+ });
79
+ }
80
+ throw cause;
81
+ }
82
+ const generation = parent?.generation
83
+ ?? adapterScope.createAdapterScopeGeneration(protocol, configuration);
84
+ return Object.freeze({
85
+ kind: "captured",
86
+ point,
87
+ context,
88
+ protocol,
89
+ scope,
90
+ generation,
91
+ configuration,
92
+ standalone: parent === undefined,
93
+ });
94
+ }
95
+ /** Zachytí hook options v přesném veřejném pořadí bez partial publication. */
96
+ function captureResolvedHook(options, parent, localScope, checkpoint) {
97
+ const source = publicInputCapture.requireInputObject(options, "options");
98
+ const pointValue = publicInputCapture.readInputProperty(source, "point", "options.point", checkpoint);
99
+ const context = publicInputCapture.readInputProperty(source, "context", "options.context", checkpoint);
100
+ const registryValue = publicInputCapture.readInputProperty(source, "registry", "options.registry", checkpoint);
101
+ const sinkValue = publicInputCapture.readInputProperty(source, "sink", "options.sink", checkpoint);
102
+ const projectContextValue = publicInputCapture.readInputProperty(source, "projectContext", "options.projectContext", checkpoint);
103
+ const point = requirePointObject(pointValue);
104
+ const patch = adapterConfiguration.captureAdapterConfigurationPatch(sinkValue, undefined, projectContextValue, checkpoint);
105
+ const configuration = adapterConfiguration.resolveAdapterScopeConfiguration(parent?.generation.configuration, patch);
106
+ const registry = adapterConfiguration.resolveAdapterRegistryInput(registryValue, parent?.generation.defaultProtocol.rawRegistry);
107
+ return captureResolvedRegistry(point, context, registry, configuration, parent, localScope, checkpoint);
108
+ }
109
+ /** Zachytí outlet props jednou a připraví query nad stejným config/scope vstupem. */
110
+ function captureOutletResolvedHook(props, parent, localScope, checkpoint) {
111
+ const input = outletInput.captureOutletInput(props, parent?.generation.defaultProtocol.rawRegistry, parent?.generation.configuration, checkpoint);
112
+ const captured = captureResolvedRegistry(input.point, input.context, input.registry, input.configuration, parent, localScope, checkpoint);
113
+ return Object.freeze({ captured, payload: input });
114
+ }
115
+ /** Vrátí stabilní binding a zachová první committed method capture bridge. */
116
+ function resolveExternalStoreBinding(captured, cacheRef) {
117
+ const cached = cacheRef.current;
118
+ if (cached !== undefined
119
+ && cached.scope === captured.scope
120
+ && cached.rawRegistry === captured.protocol.rawRegistry
121
+ && cached.registryId === captured.protocol.registryId
122
+ && cached.point === captured.point
123
+ && adapterScope.isSameAdapterScopeGeneration(cached.generation, captured.generation)) {
124
+ return cached.binding;
125
+ }
126
+ const binding = captured.scope.createExternalStore(captured.generation, captured.protocol, captured.point);
127
+ cacheRef.current = Object.freeze({
128
+ scope: captured.scope,
129
+ generation: captured.generation,
130
+ rawRegistry: captured.protocol.rawRegistry,
131
+ registryId: captured.protocol.registryId,
132
+ point: captured.point,
133
+ binding,
134
+ });
135
+ return binding;
136
+ }
137
+ /** Ověří committed autoritu po každém sink callbacku. */
138
+ function isCommittedAttemptCurrent(authority, committedRef, commandEpochRef) {
139
+ return committedRef.current === authority
140
+ && commandEpochRef.current === authority.commandEpoch;
141
+ }
142
+ /**
143
+ * Sdílí Hook pořadí, external-store bridge a query mezi public hookem a outletem.
144
+ */
145
+ function useResolvedContributionsEngine(captureFactory, commitOwner, commitObserver) {
146
+ const parent = adapterContext.useAdapterContext();
147
+ const [localScope] = react.useState(createConsumerScope);
148
+ const [, forceRefresh] = react.useReducer(
149
+ /** Monotonicky posune pouze hook-local render command. */
150
+ function incrementRefreshEpoch(value) {
151
+ return value + 1;
152
+ }, 0);
153
+ const renderSerialRef = react.useRef(0);
154
+ const commandEpochRef = react.useRef(0);
155
+ const controlRef = react.useRef({
156
+ mounted: false,
157
+ allowWithoutGeneration: false,
158
+ });
159
+ const committedRef = react.useRef(undefined);
160
+ const storeCacheRef = react.useRef(undefined);
161
+ const [outletLease, setOutletLease] = react.useState(undefined);
162
+ const [refresh] = react.useState(
163
+ /** Vytvoří právě jednu referenčně stabilní refresh capability. */
164
+ function createRefresh() {
165
+ /** Invaliduje předchozí command autoritu před React update schedulingem. */
166
+ function refreshResolvedContributions() {
167
+ const control = controlRef.current;
168
+ if (!control.mounted) {
169
+ return;
170
+ }
171
+ if (!control.allowWithoutGeneration
172
+ && (control.scope === undefined
173
+ || control.generation === undefined
174
+ || !control.scope.isGenerationActive(control.generation))) {
175
+ return;
176
+ }
177
+ commandEpochRef.current += 1;
178
+ forceRefresh();
179
+ }
180
+ return refreshResolvedContributions;
181
+ });
182
+ renderSerialRef.current += 1;
183
+ const renderSerial = renderSerialRef.current;
184
+ const renderCommandEpoch = commandEpochRef.current;
185
+ /** Ukončí reentrantně stale capture nebo query bez dalšího public Getu. */
186
+ function checkpointRenderAuthority() {
187
+ if (renderSerialRef.current !== renderSerial
188
+ || commandEpochRef.current !== renderCommandEpoch) {
189
+ throw new reactAdapterError.ReactAdapterError("REACT_ADAPTER_DISPOSED", "The resolved contribution render attempt is no longer current.", { details: { field: "hook.render", phase: "lifecycle" } });
190
+ }
191
+ }
192
+ let captured;
193
+ let payload;
194
+ try {
195
+ const envelope = captureFactory(parent, localScope, checkpointRenderAuthority);
196
+ captured = envelope.captured;
197
+ payload = envelope.payload;
198
+ }
199
+ catch (cause) {
200
+ captured = Object.freeze({ kind: "configurationFailure", cause });
201
+ }
202
+ const externalStore = captured.kind === "captured"
203
+ ? resolveExternalStoreBinding(captured, storeCacheRef)
204
+ : EMPTY_EXTERNAL_STORE;
205
+ let renderAttempt;
206
+ let renderConfiguration;
207
+ let renderScope;
208
+ let renderGeneration;
209
+ let renderStandalone = false;
210
+ const outletRegistryIdentity = captured.kind === "captured"
211
+ ? captured.protocol.rawRegistry
212
+ : captured.kind === "unavailable"
213
+ ? captured.rawRegistry
214
+ : undefined;
215
+ react.useEffect(
216
+ /** Standalone hook vlastní scope epochu pouze po React commitu. */
217
+ function acquireStandaloneScope() {
218
+ if (!renderStandalone || renderGeneration === undefined || renderScope === undefined) {
219
+ return undefined;
220
+ }
221
+ return renderScope.acquireOwner(renderGeneration);
222
+ }, [captured.kind === "captured" ? captured.scope : undefined,
223
+ captured.kind === "captured" ? captured.generation : undefined,
224
+ captured.kind === "captured" ? captured.standalone : false]);
225
+ react.useEffect(
226
+ /** Publikuje pouze committed attempt autoritu a synchronně ji invaliduje při cleanupu. */
227
+ function commitResolvedAttempt() {
228
+ if (renderAttempt === undefined || renderScope === undefined) {
229
+ return function cleanupMissingAttempt() {
230
+ // Configuration failure nemá committed autoritu k invalidaci.
231
+ };
232
+ }
233
+ const authority = Object.freeze({
234
+ attempt: renderAttempt,
235
+ commandEpoch: commandEpochRef.current,
236
+ scope: renderScope,
237
+ configuration: renderConfiguration
238
+ ?? adapterConfiguration.EMPTY_ADAPTER_SCOPE_CONFIGURATION,
239
+ });
240
+ committedRef.current = authority;
241
+ controlRef.current = {
242
+ mounted: true,
243
+ scope: renderScope,
244
+ ...(renderGeneration === undefined ? {} : { generation: renderGeneration }),
245
+ allowWithoutGeneration: renderGeneration === undefined,
246
+ };
247
+ /** Zneplatní uniklé command capability před resource effect cleanupem. */
248
+ function cleanupCommittedAttempt() {
249
+ if (committedRef.current !== authority) {
250
+ return;
251
+ }
252
+ committedRef.current = undefined;
253
+ controlRef.current.mounted = false;
254
+ commandEpochRef.current += 1;
255
+ }
256
+ return cleanupCommittedAttempt;
257
+ });
258
+ react.useEffect(
259
+ /** Doručí secondary a primary diagnostiku pouze jednou pro committed attempt. */
260
+ function reportCommittedResolveFailure() {
261
+ const authority = committedRef.current;
262
+ if (authority === undefined
263
+ || authority.attempt !== renderAttempt
264
+ || renderAttempt?.primaryDiagnostic === undefined
265
+ || !authority.scope.claimDiagnosticAttempt(renderAttempt.token)) {
266
+ return;
267
+ }
268
+ if (renderAttempt.secondaryDiagnostic !== undefined) {
269
+ reactAdapterDiagnostics.reportReactAdapterDiagnostic(renderAttempt.secondaryDiagnostic, authority.configuration);
270
+ if (!isCommittedAttemptCurrent(authority, committedRef, commandEpochRef)) {
271
+ return;
272
+ }
273
+ }
274
+ reactAdapterDiagnostics.reportReactAdapterDiagnostic(renderAttempt.primaryDiagnostic, authority.configuration);
275
+ });
276
+ react.useEffect(
277
+ /** Přidělí outlet ID až po committed query autoritě a active scope epoše. */
278
+ function acquireOutletCommitLease() {
279
+ if (commitOwner === undefined
280
+ || renderGeneration === undefined
281
+ || renderScope === undefined
282
+ || renderAttempt?.state.status !== "resolved"
283
+ || committedRef.current?.attempt !== renderAttempt) {
284
+ return undefined;
285
+ }
286
+ const lease = renderScope.acquireCommitLease(renderGeneration, "outlet", commitOwner.token);
287
+ setOutletLease(lease);
288
+ /** Synchronous cleanup zneplatní ID před další scope/outlet prací. */
289
+ function releaseOutletCommitLease() {
290
+ lease.release();
291
+ }
292
+ return releaseOutletCommitLease;
293
+ }, [commitOwner?.token, outletRegistryIdentity, renderScope, renderGeneration]);
294
+ react.useEffect(
295
+ /** Doručí outlet observer až po committed authority, sinku a lease effectu. */
296
+ function notifyCommittedResolvedObserver() {
297
+ const attempt = renderAttempt;
298
+ const scope = renderScope;
299
+ if (commitObserver === undefined
300
+ || attempt === undefined
301
+ || scope === undefined
302
+ || payload === undefined) {
303
+ return;
304
+ }
305
+ const authority = committedRef.current;
306
+ if (authority === undefined
307
+ || authority.attempt !== attempt
308
+ || !isCommittedAttemptCurrent(authority, committedRef, commandEpochRef)) {
309
+ return;
310
+ }
311
+ const rawRegistry = captured.kind === "captured"
312
+ ? captured.protocol.rawRegistry
313
+ : captured.kind === "unavailable"
314
+ ? captured.rawRegistry
315
+ : undefined;
316
+ if (rawRegistry === undefined) {
317
+ return;
318
+ }
319
+ const committedAuthority = authority;
320
+ /** Ověří tutéž authority i po user-observable callback seamu. */
321
+ function isCurrent() {
322
+ return isCommittedAttemptCurrent(committedAuthority, committedRef, commandEpochRef);
323
+ }
324
+ const result = Object.freeze({
325
+ state: attempt.state,
326
+ refresh,
327
+ });
328
+ try {
329
+ commitObserver(Object.freeze({
330
+ payload,
331
+ result,
332
+ attempt,
333
+ scope,
334
+ generation: renderGeneration,
335
+ rawRegistry,
336
+ isCurrent,
337
+ checkpoint: checkpointRenderAuthority,
338
+ outletLease,
339
+ serverSnapshot,
340
+ }));
341
+ }
342
+ catch {
343
+ // Interní observer musí vlastní host callback chyby bezpečně normalizovat.
344
+ }
345
+ });
346
+ const externalStoreSnapshot = react.useSyncExternalStore(externalStore.subscribe, externalStore.getSnapshot, externalStore.getServerSnapshot);
347
+ const serverSnapshot = externalStoreSnapshot === adapterRegistryBridge.ADAPTER_SERVER_SNAPSHOT;
348
+ if (captured.kind === "configurationFailure") {
349
+ throw captured.cause;
350
+ }
351
+ renderConfiguration = captured.configuration;
352
+ renderScope = captured.scope;
353
+ if (captured.kind === "captured") {
354
+ renderGeneration = captured.generation;
355
+ renderStandalone = captured.standalone;
356
+ const bridgeFault = externalStore.readFault();
357
+ renderAttempt = resolvedContributionsQuery.queryResolvedContributions({
358
+ protocol: captured.protocol,
359
+ point: captured.point,
360
+ context: captured.context,
361
+ configuration: captured.configuration,
362
+ ...(bridgeFault === undefined ? {} : { bridgeFault }),
363
+ checkpoint: checkpointRenderAuthority,
364
+ });
365
+ }
366
+ else {
367
+ renderAttempt = resolvedContributionsQuery.createFailedResolvedQueryAttempt(captured.cause, captured.point, captured.context, captured.configuration, checkpointRenderAuthority);
368
+ }
369
+ const attempt = renderAttempt;
370
+ const scope = renderScope;
371
+ if (attempt === undefined || scope === undefined || payload === undefined) {
372
+ throw new reactAdapterError.ReactAdapterError("REACT_ADAPTER_DISPOSED", "The resolved contribution render attempt did not produce a complete binding.", { details: { field: "hook.binding", phase: "lifecycle" } });
373
+ }
374
+ const rawRegistry = captured.kind === "captured"
375
+ ? captured.protocol.rawRegistry
376
+ : captured.rawRegistry;
377
+ const result = Object.freeze({
378
+ state: attempt.state,
379
+ refresh,
380
+ });
381
+ /** Ověří exact attempt po jeho committed effectu a command epoch gate. */
382
+ function isCurrent() {
383
+ const authority = committedRef.current;
384
+ return authority !== undefined
385
+ && authority.attempt === attempt
386
+ && isCommittedAttemptCurrent(authority, committedRef, commandEpochRef);
387
+ }
388
+ return Object.freeze({
389
+ payload,
390
+ result,
391
+ attempt,
392
+ scope,
393
+ generation: renderGeneration,
394
+ rawRegistry,
395
+ isCurrent,
396
+ checkpoint: checkpointRenderAuthority,
397
+ outletLease,
398
+ serverSnapshot,
399
+ });
400
+ }
401
+ /**
402
+ * Synchronně promítne public Core katalog do React render state.
403
+ *
404
+ * @public
405
+ */
406
+ export function useResolvedContributions(options) {
407
+ const engine = useResolvedContributionsEngine(
408
+ /** Zachytí public hook options uvnitř společného Hook-order-safe enginu. */
409
+ function capturePublicResolvedHook(parent, localScope, checkpoint) {
410
+ return Object.freeze({
411
+ captured: captureResolvedHook(options, parent, localScope, checkpoint),
412
+ payload: true,
413
+ });
414
+ });
415
+ return engine.result;
416
+ }
417
+ /**
418
+ * Interně promítne outlet props stejným subscriberem, query a committed autoritou.
419
+ */
420
+ export function useResolvedContributionsForOutlet(props, commitObserver) {
421
+ const [outletToken] = react.useState(outletCommitLease.createOutletInstanceToken);
422
+ const engine = useResolvedContributionsEngine(
423
+ /** Zachytí celý outlet vstup právě jednou v normativním pořadí. */
424
+ function captureOutletHook(parent, localScope, checkpoint) {
425
+ return captureOutletResolvedHook(props, parent, localScope, checkpoint);
426
+ }, { token: outletToken }, commitObserver === undefined
427
+ ? undefined
428
+ : function observeCommittedOutlet(engineResult) {
429
+ commitObserver(Object.freeze({
430
+ input: engineResult.payload,
431
+ result: engineResult.result,
432
+ attempt: engineResult.attempt,
433
+ scope: engineResult.scope,
434
+ generation: engineResult.generation,
435
+ rawRegistry: engineResult.rawRegistry,
436
+ isCurrent: engineResult.isCurrent,
437
+ checkpoint: engineResult.checkpoint,
438
+ outletLease: engineResult.outletLease,
439
+ serverSnapshot: engineResult.serverSnapshot,
440
+ }));
441
+ });
442
+ return Object.freeze({
443
+ input: engine.payload,
444
+ result: engine.result,
445
+ attempt: engine.attempt,
446
+ scope: engine.scope,
447
+ generation: engine.generation,
448
+ rawRegistry: engine.rawRegistry,
449
+ isCurrent: engine.isCurrent,
450
+ checkpoint: engine.checkpoint,
451
+ outletLease: engine.outletLease,
452
+ serverSnapshot: engine.serverSnapshot,
453
+ });
454
+ }
455
+ //# sourceMappingURL=resolved-contributions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolved-contributions.js","sourceRoot":"","sources":["../src/resolved-contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,oBAAoB,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,qBAAqB,MAAM,uCAAuC,CAAC;AAC/E,OAAO,KAAK,uBAAuB,MAAM,yCAAyC,CAAC;AACnF,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,iBAAiB,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,kBAAkB,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,0BAA0B,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAA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C,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;KACrC,CAAC,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@primafuture/contrib-kit-react",
3
+ "version": "1.0.0",
4
+ "description": "React adapter for Contrib Kit with headless outlets, scoped registries, managed lazy loading, and SSR support.",
5
+ "keywords": [
6
+ "react",
7
+ "contributions",
8
+ "extension-points",
9
+ "plugins",
10
+ "typescript"
11
+ ],
12
+ "author": "PrimaFuture.cz s.r.o. <dev@primafuture.cz>",
13
+ "license": "ISC",
14
+ "type": "module",
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
24
+ }
25
+ },
26
+ "peerDependencies": {
27
+ "@primafuture/contrib-kit-core": ">=1.0.0 <2",
28
+ "react": ">=18.3.1 <20",
29
+ "react-dom": ">=18.3.1 <20"
30
+ },
31
+ "devDependencies": {
32
+ "@primafuture/contrib-kit-core": "^1.0.0",
33
+ "@types/react": "19.2.17",
34
+ "@types/react-dom": "19.2.3",
35
+ "react": "19.2.8",
36
+ "react-dom": "19.2.8"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "scripts": {
42
+ "typecheck": "tsc --project tsconfig.json",
43
+ "build": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.json",
44
+ "test": "tsc --project tsconfig.test.json && vitest run",
45
+ "api:check": "api-extractor run"
46
+ }
47
+ }
@@ -0,0 +1,118 @@
1
+ import type * as react from "react";
2
+
3
+ /**
4
+ * Privátní compile-time identita, která brání záměně komponent s odlišným kontraktem.
5
+ */
6
+ declare const reactContributionComponentBrand: unique symbol;
7
+
8
+ /**
9
+ * Immutable public view of one contribution passed to a rendering component.
10
+ *
11
+ * @public
12
+ */
13
+ export interface ExtensionContributionView<Data> {
14
+ /** Stable identifier of the specific contribution within the registry. */
15
+ readonly contributionId: string;
16
+
17
+ /** Optional owner identifier when the contribution declares one publicly. */
18
+ readonly contributorId?: string;
19
+
20
+ /** Opaque data projection defined by the specific extension point. */
21
+ readonly data: Data;
22
+
23
+ /** Optional human-readable label without adapter runtime identity. */
24
+ readonly label?: string;
25
+
26
+ /** Optional local name that the host can use for readable identification. */
27
+ readonly localName?: string;
28
+ }
29
+
30
+ /**
31
+ * Outlet-local logical placement within the final resolved contribution order.
32
+ *
33
+ * @public
34
+ */
35
+ export interface ResolvedContributionPlacement {
36
+ /** Zero-based position within the final resolved collection. */
37
+ readonly index: number;
38
+
39
+ /** Total number of memberships in the final resolved collection. */
40
+ readonly count: number;
41
+
42
+ /** True only for the first membership in a non-empty collection. */
43
+ readonly isFirst: boolean;
44
+
45
+ /** True only for the last membership in a non-empty collection. */
46
+ readonly isLast: boolean;
47
+ }
48
+
49
+ /**
50
+ * The only required props passed by an outlet to a contribution component.
51
+ *
52
+ * @public
53
+ */
54
+ export interface ExtensionContributionProps<Context, Data> {
55
+ /** Context captured for the current resolution and render attempt. */
56
+ readonly context: Context;
57
+
58
+ /** Immutable public view of the contribution currently being rendered. */
59
+ readonly contribution: ExtensionContributionView<Data>;
60
+
61
+ /** Outlet-local logical placement in the final resolved order. */
62
+ readonly placement: ResolvedContributionPlacement;
63
+ }
64
+
65
+ /**
66
+ * React component verified for the exact contribution context/data contract.
67
+ *
68
+ * A private brand keeps both types invariant and prevents assigning an
69
+ * unverified raw component without {@link defineReactContributionComponent}.
70
+ *
71
+ * @public
72
+ */
73
+ export type ReactContributionComponent<Context, Data> =
74
+ (react.ComponentType<any> | react.ExoticComponent<any>) & {
75
+ /** Compile-time identity; no property is added to the component at runtime. */
76
+ readonly [reactContributionComponentBrand]: {
77
+ /** Invariant anchor for rendering context. */
78
+ readonly context: (value: Context) => Context;
79
+
80
+ /** Invariant anchor for contribution data. */
81
+ readonly data: (value: Data) => Data;
82
+ };
83
+ };
84
+
85
+ /**
86
+ * Verifies a React component props contract and returns its original runtime reference.
87
+ *
88
+ * The component must require `context`, `contribution`, and `placement`, cannot
89
+ * require any additional prop, and may declare additional optional props.
90
+ *
91
+ * @public
92
+ */
93
+ export function defineReactContributionComponent<
94
+ const Component extends react.ComponentType<any> | react.ExoticComponent<any>,
95
+ Props = Component extends react.ComponentType<infer ComponentProps>
96
+ ? ComponentProps
97
+ : Component extends react.ExoticComponent<infer ExoticProps>
98
+ ? ExoticProps
99
+ : never,
100
+ Context = Props extends { readonly context: infer ComponentContext }
101
+ ? ComponentContext
102
+ : never,
103
+ Data = Props extends {
104
+ readonly contribution: ExtensionContributionView<infer ComponentData>;
105
+ }
106
+ ? ComponentData
107
+ : never,
108
+ >(
109
+ component: Component & (
110
+ Props extends ExtensionContributionProps<Context, Data>
111
+ ? ExtensionContributionProps<Context, Data> extends Props
112
+ ? unknown
113
+ : never
114
+ : never
115
+ ),
116
+ ): Component & ReactContributionComponent<Context, Data> {
117
+ return component as unknown as Component & ReactContributionComponent<Context, Data>;
118
+ }