@kodaris/krubble-app-components 1.0.152 → 1.0.154
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/chatbot.d.ts +5 -0
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +1 -1
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +55 -4
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +3 -3
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +55 -4
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +3 -3
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/router.d.ts +14 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +54 -3
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
|
@@ -5999,7 +5999,7 @@ class KRChatbot extends i$3 {
|
|
|
5999
5999
|
` : A}
|
|
6000
6000
|
${global ? b `
|
|
6001
6001
|
<div class="skill-card__footer">
|
|
6002
|
-
<span class="skill-card__price"
|
|
6002
|
+
<span class="skill-card__price">${skill.priceLabel}</span>
|
|
6003
6003
|
<kr-button
|
|
6004
6004
|
class="skill-card__install-btn"
|
|
6005
6005
|
size="small"
|
|
@@ -12310,6 +12310,13 @@ class KRRouter {
|
|
|
12310
12310
|
static configure(config) {
|
|
12311
12311
|
KRRouter.base = config.base;
|
|
12312
12312
|
KRRouter.routes = config.routes;
|
|
12313
|
+
// Point the page's outlet class at this router. The Operations shell loads krubble globally while
|
|
12314
|
+
// an embedded app bundles its own copy, so the kr-router-outlet that won registration may belong
|
|
12315
|
+
// to the other copy; whichever it is, its outlets must register with the router that has routes.
|
|
12316
|
+
const outletClass = customElements.get('kr-router-outlet');
|
|
12317
|
+
if (outletClass) {
|
|
12318
|
+
outletClass.router = KRRouter;
|
|
12319
|
+
}
|
|
12313
12320
|
// Intercept <a> clicks for client-side navigation
|
|
12314
12321
|
window.addEventListener('click', (e) => {
|
|
12315
12322
|
const anchor = e.composedPath().find(el => el instanceof HTMLAnchorElement);
|
|
@@ -12534,6 +12541,46 @@ class KRRouter {
|
|
|
12534
12541
|
window.history.pushState({}, '', fullPath);
|
|
12535
12542
|
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
12536
12543
|
}
|
|
12544
|
+
/**
|
|
12545
|
+
* Rewrite the current url in place, keeping the mounted screen as it is — no popstate is dispatched,
|
|
12546
|
+
* so nothing in flight (a streaming response, an open editor) is torn down. For when a screen's url
|
|
12547
|
+
* becomes more specific after a server round-trip: a new chat's first message resolves a conversation
|
|
12548
|
+
* id, a new record's save yields its key.
|
|
12549
|
+
*
|
|
12550
|
+
* Use this instead of a bare history.replaceState. The cache files each screen under its url, so a raw
|
|
12551
|
+
* rewrite would leave the screen keyed by the OLD url: navigating back to that url would be a cache hit
|
|
12552
|
+
* handing back this same screen with all its state — a chat rewritten from `new` to `all/123` would
|
|
12553
|
+
* reopen conversation 123 on the next New Chat click instead of starting fresh. So the deepest level's
|
|
12554
|
+
* cache entry is re-filed under the new url, and its outlet context follows.
|
|
12555
|
+
*/
|
|
12556
|
+
static replace(path) {
|
|
12557
|
+
const before = KRRouter.matchRoutes();
|
|
12558
|
+
let fullPath = path;
|
|
12559
|
+
if (!path.startsWith('/')) {
|
|
12560
|
+
fullPath = KRRouter.base + '/' + path;
|
|
12561
|
+
}
|
|
12562
|
+
window.history.replaceState({}, '', fullPath);
|
|
12563
|
+
const after = KRRouter.matchRoutes();
|
|
12564
|
+
if (!before.routes.length || !after.routes.length) {
|
|
12565
|
+
return;
|
|
12566
|
+
}
|
|
12567
|
+
// The caller is the deepest matched screen rewriting its own url; shallower levels keep theirs.
|
|
12568
|
+
const level = before.routes.length - 1;
|
|
12569
|
+
const oldUrl = before.routes[level].url;
|
|
12570
|
+
const newUrl = after.routes[after.routes.length - 1].url;
|
|
12571
|
+
if (oldUrl === newUrl) {
|
|
12572
|
+
return;
|
|
12573
|
+
}
|
|
12574
|
+
const entry = KRRouter.routeCache.get(oldUrl);
|
|
12575
|
+
if (entry) {
|
|
12576
|
+
KRRouter.routeCache.delete(oldUrl);
|
|
12577
|
+
KRRouter.routeCache.set(newUrl, entry);
|
|
12578
|
+
}
|
|
12579
|
+
const context = KRRouter.outletContexts.get(level);
|
|
12580
|
+
if (context && context.url === oldUrl) {
|
|
12581
|
+
context.url = newUrl;
|
|
12582
|
+
}
|
|
12583
|
+
}
|
|
12537
12584
|
static getParams() {
|
|
12538
12585
|
const matched = KRRouter.matchRoutes();
|
|
12539
12586
|
const params = {};
|
|
@@ -12744,11 +12791,11 @@ class KRRouterOutlet extends i$3 {
|
|
|
12744
12791
|
}
|
|
12745
12792
|
}
|
|
12746
12793
|
this.level = level;
|
|
12747
|
-
|
|
12794
|
+
KRRouterOutlet.router.registerOutlet(this.level, this);
|
|
12748
12795
|
}
|
|
12749
12796
|
disconnectedCallback() {
|
|
12750
12797
|
super.disconnectedCallback();
|
|
12751
|
-
|
|
12798
|
+
KRRouterOutlet.router.unregisterOutlet(this.level, this);
|
|
12752
12799
|
}
|
|
12753
12800
|
activate(el) {
|
|
12754
12801
|
this.el = el;
|
|
@@ -12769,12 +12816,16 @@ KRRouterOutlet.styles = i$6 `
|
|
|
12769
12816
|
height: 100%;
|
|
12770
12817
|
}
|
|
12771
12818
|
`;
|
|
12819
|
+
// The router outlets register with. KRRouter.configure() sets this on whichever outlet class is
|
|
12820
|
+
// registered on the page, which may be another copy of krubble's; this copy's router is the default.
|
|
12821
|
+
KRRouterOutlet.router = KRRouter;
|
|
12772
12822
|
__decorate([
|
|
12773
12823
|
r()
|
|
12774
12824
|
], KRRouterOutlet.prototype, "el", void 0);
|
|
12775
12825
|
// Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
|
|
12776
12826
|
// the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
|
|
12777
|
-
// own copy) doesn't throw. First definition wins.
|
|
12827
|
+
// own copy) doesn't throw. First definition wins; KRRouter.configure() then points that class at
|
|
12828
|
+
// the configured router.
|
|
12778
12829
|
if (!customElements.get('kr-router-outlet')) {
|
|
12779
12830
|
customElements.define('kr-router-outlet', KRRouterOutlet);
|
|
12780
12831
|
}
|