@kodaris/krubble-app-components 1.0.141 → 1.0.142
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/krubble-app.bundled.js +50 -15
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +1 -1
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +50 -15
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +1 -1
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/router.d.ts +11 -4
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +50 -15
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export { KRChatbot } from './chatbot.js';
|
|
|
7
7
|
export type { KRSubbarBreadcrumb } from './subbar.js';
|
|
8
8
|
export type { KRNavItem, KRNavItemFlat, KRUser } from './scaffold.js';
|
|
9
9
|
export type { KRScreenNavItem, KRScreenNavAction } from './screen-nav.js';
|
|
10
|
-
export type { KRRoute, KRRouterConfig, KRMatchedRoute
|
|
10
|
+
export type { KRRoute, KRRouterConfig, KRMatchedRoute } from './router.js';
|
|
11
11
|
export type { KRChatbotMessage, KRChatbotSend, KRChatbotConversationFile, KRChatbotSendFile } from './chatbot.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -12168,6 +12168,17 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
12168
12168
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12169
12169
|
};
|
|
12170
12170
|
class KRRouter {
|
|
12171
|
+
/**
|
|
12172
|
+
* The current route's resolved data: everything every matched level's static resolve() returned,
|
|
12173
|
+
* merged with deeper levels winning on a shared key.
|
|
12174
|
+
*
|
|
12175
|
+
* Read it in connectedCallback — the router fills it before any element mounts. A child route gets
|
|
12176
|
+
* what its parent resolved from here, so a tab component needs no resolve() of its own. Use
|
|
12177
|
+
* KRRouter.getParams() for the route's params.
|
|
12178
|
+
*/
|
|
12179
|
+
static getData() {
|
|
12180
|
+
return KRRouter.data;
|
|
12181
|
+
}
|
|
12171
12182
|
static configure(config) {
|
|
12172
12183
|
KRRouter.base = config.base;
|
|
12173
12184
|
KRRouter.routes = config.routes;
|
|
@@ -12229,40 +12240,61 @@ class KRRouter {
|
|
|
12229
12240
|
}
|
|
12230
12241
|
}
|
|
12231
12242
|
const token = ++KRRouter.navToken;
|
|
12232
|
-
// Resolve every route's matching component (screen)
|
|
12243
|
+
// Resolve every route's matching component (screen), keeping each level's resolved data alongside
|
|
12244
|
+
// its element so the whole chain can be merged once they've all settled.
|
|
12233
12245
|
Promise.all(matched.routes.map(match => {
|
|
12234
|
-
// Reuse the cached element for this url if we have one
|
|
12246
|
+
// Reuse the cached element for this url if we have one. Its data is cached with it — resolve()
|
|
12247
|
+
// doesn't run again, but the level still has to contribute to the merge below.
|
|
12235
12248
|
const cached = KRRouter.routeCache.get(match.url);
|
|
12236
12249
|
if (cached) {
|
|
12237
|
-
return Promise.resolve(
|
|
12250
|
+
return Promise.resolve({
|
|
12251
|
+
el: cached.el,
|
|
12252
|
+
data: cached.data,
|
|
12253
|
+
});
|
|
12238
12254
|
}
|
|
12239
12255
|
// Create and cache the screen element
|
|
12240
12256
|
const el = document.createElement(match.route.component);
|
|
12241
|
-
|
|
12257
|
+
const entry = {
|
|
12242
12258
|
el,
|
|
12243
12259
|
scrolls: [],
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
//
|
|
12260
|
+
data: null,
|
|
12261
|
+
};
|
|
12262
|
+
KRRouter.routeCache.set(match.url, entry);
|
|
12263
|
+
// If the component class defines a static resolve(params), await it. Every level's result is
|
|
12264
|
+
// merged into KRRouter.data below before anything mounts, so a component paints with its data
|
|
12265
|
+
// already in hand instead of flashing empty.
|
|
12248
12266
|
const constructor = customElements.get(match.route.component);
|
|
12249
12267
|
if (constructor && typeof constructor.resolve === 'function') {
|
|
12250
12268
|
return Promise.resolve(constructor.resolve(KRRouter.getParams())).then(data => {
|
|
12251
|
-
|
|
12252
|
-
|
|
12269
|
+
entry.data = data;
|
|
12270
|
+
return {
|
|
12271
|
+
el,
|
|
12253
12272
|
data,
|
|
12254
|
-
}
|
|
12255
|
-
el.routeSnapshot = routeSnapshot;
|
|
12256
|
-
return el;
|
|
12273
|
+
};
|
|
12257
12274
|
});
|
|
12258
12275
|
}
|
|
12259
|
-
return Promise.resolve(
|
|
12276
|
+
return Promise.resolve({
|
|
12277
|
+
el,
|
|
12278
|
+
data: null,
|
|
12279
|
+
});
|
|
12260
12280
|
}))
|
|
12261
|
-
.then(
|
|
12281
|
+
.then(resolved => {
|
|
12262
12282
|
// A newer navigation started while we were resolving — its elements are the current truth.
|
|
12263
12283
|
if (token !== KRRouter.navToken) {
|
|
12264
12284
|
return;
|
|
12265
12285
|
}
|
|
12286
|
+
// Merge the whole chain's resolved data into one object, parents first so a deeper route can
|
|
12287
|
+
// override a key it shares with an ancestor. Set BEFORE any element mounts, so every component
|
|
12288
|
+
// — at any depth — reads it with KRRouter.getData() in connectedCallback: a tab component gets
|
|
12289
|
+
// what its parent resolved with no resolve() of its own and no second request. Mirrors
|
|
12290
|
+
// KNNavigator.data() in kodaris-ngx, which searches the Angular route tree by key.
|
|
12291
|
+
KRRouter.data = {};
|
|
12292
|
+
for (const item of resolved) {
|
|
12293
|
+
if (item.data) {
|
|
12294
|
+
Object.assign(KRRouter.data, item.data);
|
|
12295
|
+
}
|
|
12296
|
+
}
|
|
12297
|
+
const elements = resolved.map(item => item.el);
|
|
12266
12298
|
// ---- PASS 1: deactivate, deepest level first ----
|
|
12267
12299
|
// Remove screen elements that no longer apply to the new current routes for the current url
|
|
12268
12300
|
const levels = Array.from(KRRouter.outletContexts.keys()).sort((a, b) => b - a);
|
|
@@ -12535,6 +12567,9 @@ KRRouter.outletContexts = new Map();
|
|
|
12535
12567
|
// One token per navigation. A slower navigation that has been superseded must not activate its
|
|
12536
12568
|
// (stale) elements, so it checks the token before committing anything.
|
|
12537
12569
|
KRRouter.navToken = 0;
|
|
12570
|
+
// Every matched route level's resolved data, merged into one object for the current navigation. This
|
|
12571
|
+
// is set before anything mounts — see the merge in handleNavigation.
|
|
12572
|
+
KRRouter.data = {};
|
|
12538
12573
|
let KRRouterOutlet = class KRRouterOutlet extends i$3 {
|
|
12539
12574
|
constructor() {
|
|
12540
12575
|
super(...arguments);
|