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