@foxford/den 3.1.3 → 3.1.4

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/island/index.cjs CHANGED
@@ -37,6 +37,19 @@ function onIslandNavigate(node, onNavigate) {
37
37
  node.removeEventListener(NAVIGATE_EVENT, listener);
38
38
  };
39
39
  }
40
+ var DOCUMENT_EVENT = "den:document";
41
+ function publishIslandDocument(node, contribution) {
42
+ node.dispatchEvent(new CustomEvent(DOCUMENT_EVENT, { bubbles: true, detail: contribution }));
43
+ }
44
+ function onIslandDocument(node, onDocument) {
45
+ const listener = (event) => {
46
+ onDocument(event.detail);
47
+ };
48
+ node.addEventListener(DOCUMENT_EVENT, listener);
49
+ return () => {
50
+ node.removeEventListener(DOCUMENT_EVENT, listener);
51
+ };
52
+ }
40
53
 
41
54
  // src/island/slot-address.ts
42
55
  function slotAddress(app, slot) {
@@ -106,4 +119,7 @@ function describeIsland(descriptor, denState) {
106
119
 
107
120
 
108
121
 
109
- exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkZOU6W6ZQcjs.activateIslandViewModels; exports.collectDocumentContribution = _chunkZOU6W6ZQcjs.collectDocumentContribution; exports.collectIslandState = _chunkZOU6W6ZQcjs.collectIslandState; exports.createIslandContainer = _chunkZOU6W6ZQcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkZOU6W6ZQcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkZOU6W6ZQcjs.hydrateIslandState; exports.isDocumentSource = _chunkZOU6W6ZQcjs.isDocumentSource; exports.matchRoute = _chunkZOU6W6ZQcjs.matchRoute; exports.navigateIsland = navigateIsland; exports.normalizeRoutes = _chunkZOU6W6ZQcjs.normalizeRoutes; exports.onIslandNavigate = onIslandNavigate; exports.pathPattern = _chunkZOU6W6ZQcjs.pathPattern; exports.registerIsland = registerIsland; exports.renderApp = _chunkZOU6W6ZQcjs.renderApp; exports.resolveEagerUnits = _chunkZOU6W6ZQcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
122
+
123
+
124
+
125
+ exports.DOCUMENT_EVENT = DOCUMENT_EVENT; exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkZOU6W6ZQcjs.activateIslandViewModels; exports.collectDocumentContribution = _chunkZOU6W6ZQcjs.collectDocumentContribution; exports.collectIslandState = _chunkZOU6W6ZQcjs.collectIslandState; exports.createIslandContainer = _chunkZOU6W6ZQcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkZOU6W6ZQcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkZOU6W6ZQcjs.hydrateIslandState; exports.isDocumentSource = _chunkZOU6W6ZQcjs.isDocumentSource; exports.matchRoute = _chunkZOU6W6ZQcjs.matchRoute; exports.navigateIsland = navigateIsland; exports.normalizeRoutes = _chunkZOU6W6ZQcjs.normalizeRoutes; exports.onIslandDocument = onIslandDocument; exports.onIslandNavigate = onIslandNavigate; exports.pathPattern = _chunkZOU6W6ZQcjs.pathPattern; exports.publishIslandDocument = publishIslandDocument; exports.registerIsland = registerIsland; exports.renderApp = _chunkZOU6W6ZQcjs.renderApp; exports.resolveEagerUnits = _chunkZOU6W6ZQcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
@@ -182,6 +182,26 @@ declare function navigateIsland(node: EventTarget, route: IslandRoute): void;
182
182
  * @returns Отписка
183
183
  */
184
184
  declare function onIslandNavigate(node: EventTarget, onNavigate: (route: IslandRoute) => void): () => void;
185
+ /** Имя события, которым приложение сообщает свой вклад в документ. */
186
+ declare const DOCUMENT_EVENT = "den:document";
187
+ /**
188
+ * Сообщает хосту вклад приложения в документ.
189
+ *
190
+ * Зовётся ПОСЛЕ активации: вклад считается по состоянию VM, а состояние нового адреса приезжает
191
+ * асинхронно. Событие всплывает — хост слушает документ одним слушателем и не ведёт учёт узлов.
192
+ *
193
+ * @param node - Узел приложения
194
+ * @param contribution - Вклад в документ, собранный движком
195
+ */
196
+ declare function publishIslandDocument(node: EventTarget, contribution: DocumentContribution): void;
197
+ /**
198
+ * Подписывает хост на вклад приложений в документ.
199
+ *
200
+ * @param node - Узел, который слышит всплывающие события (обычно документ)
201
+ * @param onDocument - Что делать с вкладом
202
+ * @returns Отписка
203
+ */
204
+ declare function onIslandDocument(node: EventTarget, onDocument: (contribution: DocumentContribution) => void): () => void;
185
205
 
186
206
  /** Запрос на рендер приложения. */
187
207
  interface RenderAppRequest {
@@ -297,4 +317,4 @@ declare function getAppContainer(): Container;
297
317
  */
298
318
  declare function slotAddress(app: string, slot: string): string;
299
319
 
300
- export { AppAssets, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, navigateIsland, onIslandNavigate, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
320
+ export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, navigateIsland, onIslandDocument, onIslandNavigate, publishIslandDocument, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
package/island/index.d.ts CHANGED
@@ -182,6 +182,26 @@ declare function navigateIsland(node: EventTarget, route: IslandRoute): void;
182
182
  * @returns Отписка
183
183
  */
184
184
  declare function onIslandNavigate(node: EventTarget, onNavigate: (route: IslandRoute) => void): () => void;
185
+ /** Имя события, которым приложение сообщает свой вклад в документ. */
186
+ declare const DOCUMENT_EVENT = "den:document";
187
+ /**
188
+ * Сообщает хосту вклад приложения в документ.
189
+ *
190
+ * Зовётся ПОСЛЕ активации: вклад считается по состоянию VM, а состояние нового адреса приезжает
191
+ * асинхронно. Событие всплывает — хост слушает документ одним слушателем и не ведёт учёт узлов.
192
+ *
193
+ * @param node - Узел приложения
194
+ * @param contribution - Вклад в документ, собранный движком
195
+ */
196
+ declare function publishIslandDocument(node: EventTarget, contribution: DocumentContribution): void;
197
+ /**
198
+ * Подписывает хост на вклад приложений в документ.
199
+ *
200
+ * @param node - Узел, который слышит всплывающие события (обычно документ)
201
+ * @param onDocument - Что делать с вкладом
202
+ * @returns Отписка
203
+ */
204
+ declare function onIslandDocument(node: EventTarget, onDocument: (contribution: DocumentContribution) => void): () => void;
185
205
 
186
206
  /** Запрос на рендер приложения. */
187
207
  interface RenderAppRequest {
@@ -297,4 +317,4 @@ declare function getAppContainer(): Container;
297
317
  */
298
318
  declare function slotAddress(app: string, slot: string): string;
299
319
 
300
- export { AppAssets, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, navigateIsland, onIslandNavigate, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
320
+ export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, navigateIsland, onIslandDocument, onIslandNavigate, publishIslandDocument, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
package/island/index.js CHANGED
@@ -37,6 +37,19 @@ function onIslandNavigate(node, onNavigate) {
37
37
  node.removeEventListener(NAVIGATE_EVENT, listener);
38
38
  };
39
39
  }
40
+ var DOCUMENT_EVENT = "den:document";
41
+ function publishIslandDocument(node, contribution) {
42
+ node.dispatchEvent(new CustomEvent(DOCUMENT_EVENT, { bubbles: true, detail: contribution }));
43
+ }
44
+ function onIslandDocument(node, onDocument) {
45
+ const listener = (event) => {
46
+ onDocument(event.detail);
47
+ };
48
+ node.addEventListener(DOCUMENT_EVENT, listener);
49
+ return () => {
50
+ node.removeEventListener(DOCUMENT_EVENT, listener);
51
+ };
52
+ }
40
53
 
41
54
  // src/island/slot-address.ts
42
55
  function slotAddress(app, slot) {
@@ -83,6 +96,7 @@ function describeIsland(descriptor, denState) {
83
96
  };
84
97
  }
85
98
  export {
99
+ DOCUMENT_EVENT,
86
100
  NAVIGATE_EVENT,
87
101
  ViewLayerToken,
88
102
  activateIslandViewModels,
@@ -97,8 +111,10 @@ export {
97
111
  matchRoute,
98
112
  navigateIsland,
99
113
  normalizeRoutes,
114
+ onIslandDocument,
100
115
  onIslandNavigate,
101
116
  pathPattern,
117
+ publishIslandDocument,
102
118
  registerIsland,
103
119
  renderApp,
104
120
  resolveEagerUnits,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxford/den",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "Den — декларативный метафреймворк Foxford (core runtime)",
5
5
  "keywords": [
6
6
  "foxford",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "fastify": "^5.11.2",
27
- "@foxford/ioc": "^1.1.2",
28
- "@foxford/logger": "^1.2.2"
27
+ "@foxford/logger": "^1.2.2",
28
+ "@foxford/ioc": "^1.1.2"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "vite": ">=5.0.0"
@@ -125,6 +125,6 @@
125
125
  "view-adapter-B4gEb-ms.d.ts",
126
126
  "view-adapter-DJ7yB6Ml.d.cts"
127
127
  ],
128
- "sha": "c633e3b",
128
+ "sha": "d7b1436",
129
129
  "scripts": {}
130
130
  }