@abgov/web-components 1.15.1 → 1.16.0-alpha.2

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.
@@ -11952,16 +11952,32 @@ customElements.define("goa-input", Input);
11952
11952
 
11953
11953
  function create_if_block_3$7(ctx) {
11954
11954
  let div;
11955
+ let t0;
11956
+ let a;
11957
+ let t1;
11958
+ let a_target_value;
11955
11959
 
11956
11960
  return {
11957
11961
  c() {
11958
11962
  div = element("div");
11959
- div.innerHTML = `An official site of the <a href="https://www.alberta.ca/index.aspx">Alberta Government</a>`;
11963
+ t0 = text("An official site of the ");
11964
+ a = element("a");
11965
+ t1 = text("Alberta Government");
11966
+ attr(a, "href", "https://www.alberta.ca/index.aspx");
11967
+ attr(a, "target", a_target_value = `_${/*headerurltarget*/ ctx[4]}`);
11960
11968
  attr(div, "data-testid", "type");
11961
11969
  attr(div, "class", "site-text");
11962
11970
  },
11963
11971
  m(target, anchor) {
11964
11972
  insert(target, div, anchor);
11973
+ append(div, t0);
11974
+ append(div, a);
11975
+ append(a, t1);
11976
+ },
11977
+ p(ctx, dirty) {
11978
+ if (dirty & /*headerurltarget*/ 16 && a_target_value !== (a_target_value = `_${/*headerurltarget*/ ctx[4]}`)) {
11979
+ attr(a, "target", a_target_value);
11980
+ }
11965
11981
  },
11966
11982
  d(detaching) {
11967
11983
  if (detaching) detach(div);
@@ -11969,7 +11985,7 @@ function create_if_block_3$7(ctx) {
11969
11985
  };
11970
11986
  }
11971
11987
 
11972
- // (31:4) {#if ["alpha", "beta"].includes(type)}
11988
+ // (37:4) {#if ["alpha", "beta"].includes(type)}
11973
11989
  function create_if_block_1$8(ctx) {
11974
11990
  let div0;
11975
11991
  let t0_value = capitalize(/*type*/ ctx[0]) + "";
@@ -11979,6 +11995,8 @@ function create_if_block_1$8(ctx) {
11979
11995
  let div1;
11980
11996
  let t2;
11981
11997
  let a;
11998
+ let t3;
11999
+ let a_target_value;
11982
12000
  let t4;
11983
12001
  let if_block = /*feedbackurl*/ ctx[2] && create_if_block_2$7(ctx);
11984
12002
 
@@ -11990,12 +12008,13 @@ function create_if_block_1$8(ctx) {
11990
12008
  div1 = element("div");
11991
12009
  t2 = text("This is a new ");
11992
12010
  a = element("a");
11993
- a.textContent = "Alberta Government";
12011
+ t3 = text("Alberta Government");
11994
12012
  t4 = text(" service\n ");
11995
12013
  if (if_block) if_block.c();
11996
12014
  attr(div0, "data-testid", "type");
11997
12015
  attr(div0, "class", div0_class_value = "service-type service-type--" + /*type*/ ctx[0].toLowerCase());
11998
12016
  attr(a, "href", "https://www.alberta.ca/index.aspx");
12017
+ attr(a, "target", a_target_value = `_${/*headerurltarget*/ ctx[4]}`);
11999
12018
  attr(div1, "data-testid", "site-text");
12000
12019
  attr(div1, "class", "site-text");
12001
12020
  },
@@ -12006,6 +12025,7 @@ function create_if_block_1$8(ctx) {
12006
12025
  insert(target, div1, anchor);
12007
12026
  append(div1, t2);
12008
12027
  append(div1, a);
12028
+ append(a, t3);
12009
12029
  append(div1, t4);
12010
12030
  if (if_block) if_block.m(div1, null);
12011
12031
  },
@@ -12016,6 +12036,10 @@ function create_if_block_1$8(ctx) {
12016
12036
  attr(div0, "class", div0_class_value);
12017
12037
  }
12018
12038
 
12039
+ if (dirty & /*headerurltarget*/ 16 && a_target_value !== (a_target_value = `_${/*headerurltarget*/ ctx[4]}`)) {
12040
+ attr(a, "target", a_target_value);
12041
+ }
12042
+
12019
12043
  if (/*feedbackurl*/ ctx[2]) {
12020
12044
  if (if_block) {
12021
12045
  if_block.p(ctx, dirty);
@@ -12038,12 +12062,13 @@ function create_if_block_1$8(ctx) {
12038
12062
  };
12039
12063
  }
12040
12064
 
12041
- // (40:8) {#if feedbackurl}
12065
+ // (46:8) {#if feedbackurl}
12042
12066
  function create_if_block_2$7(ctx) {
12043
12067
  let span;
12044
12068
  let t0;
12045
12069
  let a;
12046
12070
  let t1;
12071
+ let a_target_value;
12047
12072
 
12048
12073
  return {
12049
12074
  c() {
@@ -12052,6 +12077,7 @@ function create_if_block_2$7(ctx) {
12052
12077
  a = element("a");
12053
12078
  t1 = text("feedback");
12054
12079
  attr(a, "href", /*feedbackurl*/ ctx[2]);
12080
+ attr(a, "target", a_target_value = `_${/*feedbackurltarget*/ ctx[5]}`);
12055
12081
  attr(span, "data-testid", "feedback");
12056
12082
  },
12057
12083
  m(target, anchor) {
@@ -12064,6 +12090,10 @@ function create_if_block_2$7(ctx) {
12064
12090
  if (dirty & /*feedbackurl*/ 4) {
12065
12091
  attr(a, "href", /*feedbackurl*/ ctx[2]);
12066
12092
  }
12093
+
12094
+ if (dirty & /*feedbackurltarget*/ 32 && a_target_value !== (a_target_value = `_${/*feedbackurltarget*/ ctx[5]}`)) {
12095
+ attr(a, "target", a_target_value);
12096
+ }
12067
12097
  },
12068
12098
  d(detaching) {
12069
12099
  if (detaching) detach(span);
@@ -12071,7 +12101,7 @@ function create_if_block_2$7(ctx) {
12071
12101
  };
12072
12102
  }
12073
12103
 
12074
- // (46:4) {#if version}
12104
+ // (52:4) {#if version}
12075
12105
  function create_if_block$i(ctx) {
12076
12106
  let div;
12077
12107
  let t;
@@ -12105,7 +12135,7 @@ function create_fragment$x(ctx) {
12105
12135
  let div0;
12106
12136
  let t2;
12107
12137
  let header_style_value;
12108
- let if_block0 = /*type*/ ctx[0] === "live" && create_if_block_3$7();
12138
+ let if_block0 = /*type*/ ctx[0] === "live" && create_if_block_3$7(ctx);
12109
12139
  let if_block1 = show_if && create_if_block_1$8(ctx);
12110
12140
  let if_block2 = /*version*/ ctx[1] && create_if_block$i(ctx);
12111
12141
 
@@ -12139,8 +12169,10 @@ function create_fragment$x(ctx) {
12139
12169
  },
12140
12170
  p(ctx, [dirty]) {
12141
12171
  if (/*type*/ ctx[0] === "live") {
12142
- if (if_block0) ; else {
12143
- if_block0 = create_if_block_3$7();
12172
+ if (if_block0) {
12173
+ if_block0.p(ctx, dirty);
12174
+ } else {
12175
+ if_block0 = create_if_block_3$7(ctx);
12144
12176
  if_block0.c();
12145
12177
  if_block0.m(div1, t0);
12146
12178
  }
@@ -12203,9 +12235,16 @@ function instance$u($$self, $$props, $$invalidate) {
12203
12235
  let { version = "" } = $$props;
12204
12236
  let { feedbackurl = "" } = $$props;
12205
12237
  let { maxcontentwidth = "100%" } = $$props;
12238
+ let { headerurltarget = "blank" } = $$props;
12239
+ let { feedbackurltarget = "blank" } = $$props;
12240
+
12241
+ // Validator
12242
+ const [UrlTarget, validateUrlTargetType] = typeValidator("URL target values", ["self", "blank"]);
12206
12243
 
12207
12244
  onMount(() => {
12208
12245
  setTimeout(() => validateType(type), 1);
12246
+ validateUrlTargetType(headerurltarget);
12247
+ validateUrlTargetType(feedbackurltarget);
12209
12248
  });
12210
12249
 
12211
12250
  $$self.$$set = $$props => {
@@ -12213,16 +12252,29 @@ function instance$u($$self, $$props, $$invalidate) {
12213
12252
  if ('version' in $$props) $$invalidate(1, version = $$props.version);
12214
12253
  if ('feedbackurl' in $$props) $$invalidate(2, feedbackurl = $$props.feedbackurl);
12215
12254
  if ('maxcontentwidth' in $$props) $$invalidate(3, maxcontentwidth = $$props.maxcontentwidth);
12255
+ if ('headerurltarget' in $$props) $$invalidate(4, headerurltarget = $$props.headerurltarget);
12256
+ if ('feedbackurltarget' in $$props) $$invalidate(5, feedbackurltarget = $$props.feedbackurltarget);
12216
12257
  };
12217
12258
 
12218
- return [type, version, feedbackurl, maxcontentwidth];
12259
+ return [
12260
+ type,
12261
+ version,
12262
+ feedbackurl,
12263
+ maxcontentwidth,
12264
+ headerurltarget,
12265
+ feedbackurltarget
12266
+ ];
12219
12267
  }
12220
12268
 
12221
12269
  class MicrositeHeader extends SvelteElement {
12222
12270
  constructor(options) {
12223
12271
  super();
12224
12272
  const style = document.createElement('style');
12225
- style.textContent = `:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}a{color:var(--goa-color-interactive-default);cursor:pointer}a:hover{color:var(--goa-color-interactive-hover)}a:focus{outline-width:thin;outline-style:solid;outline-color:var(--goa-color-interactive-hover);outline-offset:0px}.goa-official-site-header{font-size:var(--goa-font-size-2);background-color:var(--goa-color-greyscale-100);padding:0.5rem 1rem}.content-container{display:flex;align-items:start;justify-content:space-between;max-width:min(var(--max-content-width), 100%);margin:0 auto}@media screen and (max-width: 623px){@media not (max-color:2147477350){.goa-official-site-header{padding:0.25rem 2rem}.content-container{align-items:center}}}@media not screen and (max-width: 623px){@media not (color:2147477350){.goa-official-site-header{padding:0.25rem 2rem}.content-container{align-items:center}}}@media screen and (min-width: 1024px){.goa-official-site-header{padding:0.25rem 4.5rem}}.spacer{flex:1 1 auto}.version{color:var(--goa-color-text-secondary);padding-left:1rem;line-height:1.25rem}.service-type{font-weight:bold;padding:0.125rem 0.25rem;display:flex;margin-right:1rem;line-height:initial}.service-type--alpha{background-color:var(--goa-color-warning-default);color:var(--goa-color-text-default)}.service-type--beta{background-color:var(--goa-color-brand-default);color:var(--goa-color-text-light)}.site-text{color:var(--goa-color-text-default);line-height:1.25rem}`;
12273
+
12274
+ style.textContent = `:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}a{color:var(--goa-color-interactive-default);cursor:pointer}a:hover{color:var(--goa-color-interactive-hover)}a:focus{outline-width:thin;outline-style:solid;outline-color:var(--goa-color-interactive-hover);outline-offset:0px}a[target="_blank"]::after{content:"";width:var(--goa-icon-size-s);height:var(--goa-icon-size-s);background-color:var(--goa-color-interactive-default);display:inline-block;margin-left:var(--goa-space-2xs);vertical-align:sub;mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20class%3D%22ionicon%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M384%20224v184a40%2040%200%200%201-40%2040H104a40%2040%200%200%201-40-40V168a40%2040%200%200%201%2040-40h167.48M336%2064h112v112M224%20288%20440%2072%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%2232%22%2F%3E%3C%2Fsvg%3E")
12275
+ center bottom no-repeat;-webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20class%3D%22ionicon%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M384%20224v184a40%2040%200%200%201-40%2040H104a40%2040%200%200%201-40-40V168a40%2040%200%200%201%2040-40h167.48M336%2064h112v112M224%20288%20440%2072%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%2232%22%2F%3E%3C%2Fsvg%3E")
12276
+ center bottom no-repeat}a[target="_blank"]:hover:after{background-color:var(--goa-color-interactive-hover)}.goa-official-site-header{font-size:var(--goa-font-size-2);background-color:var(--goa-color-greyscale-100);padding:0.5rem 1rem}.content-container{display:flex;align-items:start;justify-content:space-between;max-width:min(var(--max-content-width), 100%);margin:0 auto}@media screen and (max-width: 623px){@media not (max-color:2147477350){.goa-official-site-header{padding:0.25rem 2rem}.content-container{align-items:center}}}@media not screen and (max-width: 623px){@media not (color:2147477350){.goa-official-site-header{padding:0.25rem 2rem}.content-container{align-items:center}}}@media screen and (min-width: 1024px){.goa-official-site-header{padding:0.25rem 4.5rem}}.spacer{flex:1 1 auto}.version{color:var(--goa-color-text-secondary);padding-left:1rem;line-height:1.25rem}.service-type{font-weight:bold;padding:0.125rem 0.25rem;display:flex;margin-right:1rem;line-height:initial}.service-type--alpha{background-color:var(--goa-color-warning-default);color:var(--goa-color-text-default)}.service-type--beta{background-color:var(--goa-color-brand-default);color:var(--goa-color-text-light)}.site-text{color:var(--goa-color-text-default);line-height:1.25rem}`;
12277
+
12226
12278
  this.shadowRoot.appendChild(style);
12227
12279
 
12228
12280
  init(
@@ -12239,7 +12291,9 @@ class MicrositeHeader extends SvelteElement {
12239
12291
  type: 0,
12240
12292
  version: 1,
12241
12293
  feedbackurl: 2,
12242
- maxcontentwidth: 3
12294
+ maxcontentwidth: 3,
12295
+ headerurltarget: 4,
12296
+ feedbackurltarget: 5
12243
12297
  },
12244
12298
  null
12245
12299
  );
@@ -12257,7 +12311,14 @@ class MicrositeHeader extends SvelteElement {
12257
12311
  }
12258
12312
 
12259
12313
  static get observedAttributes() {
12260
- return ["type", "version", "feedbackurl", "maxcontentwidth"];
12314
+ return [
12315
+ "type",
12316
+ "version",
12317
+ "feedbackurl",
12318
+ "maxcontentwidth",
12319
+ "headerurltarget",
12320
+ "feedbackurltarget"
12321
+ ];
12261
12322
  }
12262
12323
 
12263
12324
  get type() {
@@ -12295,6 +12356,24 @@ class MicrositeHeader extends SvelteElement {
12295
12356
  this.$$set({ maxcontentwidth });
12296
12357
  flush();
12297
12358
  }
12359
+
12360
+ get headerurltarget() {
12361
+ return this.$$.ctx[4];
12362
+ }
12363
+
12364
+ set headerurltarget(headerurltarget) {
12365
+ this.$$set({ headerurltarget });
12366
+ flush();
12367
+ }
12368
+
12369
+ get feedbackurltarget() {
12370
+ return this.$$.ctx[5];
12371
+ }
12372
+
12373
+ set feedbackurltarget(feedbackurltarget) {
12374
+ this.$$set({ feedbackurltarget });
12375
+ flush();
12376
+ }
12298
12377
  }
12299
12378
 
12300
12379
  customElements.define("goa-microsite-header", MicrositeHeader);
@@ -12912,7 +12991,7 @@ class Modal extends SvelteElement {
12912
12991
  constructor(options) {
12913
12992
  super();
12914
12993
  const style = document.createElement('style');
12915
- style.textContent = `:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}:host *{box-sizing:border-box}.modal{font-family:var(--goa-font-family-sans);position:fixed;inset:0;display:flex;align-items:center;justify-content:center;height:100vh;width:100%;z-index:100}.modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.2);z-index:1000}.emergency{background-color:var(--goa-color-emergency-default)}.important{background-color:var(--goa-color-warning-default)}.information{background-color:var(--goa-color-info-default)}.event{background-color:var(--goa-color-info-default)}.success{background-color:var(--goa-color-success-default)}.callout-bar{flex:0 0 3rem;text-align:center;padding-top:2rem;border-radius:4px 0px 0px 4px}.content{flex:1 1 auto;width:100%;margin:var(--goa-space-xl)}.content header{display:flex;justify-content:space-between}.content header.has-content{margin-bottom:var(--goa-space-l)}@media screen and (max-width: 623px){.content{margin:var(--goa-space-l)}.content header.has-content{margin-bottom:var(--goa-space-m)}}.modal-pane{background-color:#fff;z-index:1001;width:90%;display:flex;box-shadow:var(--goa-shadow-modal);border-radius:4px;border:1px solid var(--goa-color-greyscale-700)}.modal-actions ::slotted(*){padding:var(--goa-space-xl) 0 0}@media screen and (max-width: 623px){.modal-pane{max-width:var(--maxwidth)}.modal-actions ::slotted(*){padding:var(--goa-space-l) 0 0}}.modal-content{margin:0 -2rem;line-height:1.75rem}.modal-content ::slotted(:last-child){margin-bottom:0 !important}.modal-title{font:var(--goa-typography-heading-m)}.modal-close{padding-left:var(--goa-space-m);margin-top:var(--goa-space-2xs)}.scroll-top{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-middle{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1), inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-bottom{box-shadow:inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}`;
12994
+ style.textContent = `:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}:host *{box-sizing:border-box}.modal{font-family:var(--goa-font-family-sans);position:fixed;inset:0;display:flex;align-items:center;justify-content:center;height:100vh;width:100%;z-index:100}.modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.2);z-index:1000}.emergency{background-color:var(--goa-color-emergency-default)}.important{background-color:var(--goa-color-warning-default)}.information{background-color:var(--goa-color-info-default)}.event{background-color:var(--goa-color-info-default)}.success{background-color:var(--goa-color-success-default)}.callout-bar{flex:0 0 3rem;text-align:center;padding-top:2rem;border-radius:4px 0px 0px 4px}.content{flex:1 1 auto;width:100%;margin:var(--goa-space-xl)}.content header{display:flex;justify-content:space-between}.content header.has-content{margin-bottom:var(--goa-space-l)}@media screen and (max-width: 623px){.content{margin:var(--goa-space-l)}.content header.has-content{margin-bottom:var(--goa-space-m)}.modal-actions ::slotted(*){padding:var(--goa-space-l) 0 0}}@media screen and (min-width: 1024px){.modal-pane{max-width:var(--maxwidth)}}.modal-pane{background-color:#fff;z-index:1001;width:90%;display:flex;box-shadow:var(--goa-shadow-modal);border-radius:4px;border:1px solid var(--goa-color-greyscale-700)}.modal-actions ::slotted(*){padding:var(--goa-space-xl) 0 0}.modal-content{margin:0 -2rem;line-height:1.75rem}.modal-content ::slotted(:last-child){margin-bottom:0 !important}.modal-title{font:var(--goa-typography-heading-m)}.modal-close{padding-left:var(--goa-space-m);margin-top:var(--goa-space-2xs)}.scroll-top{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-middle{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1), inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-bottom{box-shadow:inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}`;
12916
12995
  this.shadowRoot.appendChild(style);
12917
12996
 
12918
12997
  init(
@@ -26177,18 +26256,29 @@ class Pages extends SvelteElement {
26177
26256
  customElements.define("goa-pages", Pages);
26178
26257
 
26179
26258
  function isUrlMatch(windowUrl, testUrl) {
26180
- if (!testUrl)
26181
- return false;
26182
- const pathParts = windowUrl.pathname.split("/");
26183
- testUrl = testUrl.replace(/^\//, "");
26184
- for (const part of pathParts) {
26185
- if (part === testUrl)
26186
- return true;
26259
+ if (testUrl === void 0)
26260
+ return -1;
26261
+ const windowUrlParts = windowUrl.pathname.replace(/^\//, "").split("/");
26262
+ const urlParts = testUrl.replace(/^\//, "").split("/");
26263
+ if (windowUrlParts.length < urlParts.length) {
26264
+ return -1;
26187
26265
  }
26188
- if (windowUrl.hash === testUrl) {
26189
- return true;
26266
+ if (windowUrl.hash.length > 0 && windowUrl.hash === testUrl) {
26267
+ return 1;
26190
26268
  }
26191
- return false;
26269
+ if (urlParts.length === 1 && urlParts[0] === "") {
26270
+ return 0;
26271
+ }
26272
+ let weight = -1;
26273
+ let index = 0;
26274
+ for (const part of windowUrlParts) {
26275
+ if (urlParts[index] !== part) {
26276
+ break;
26277
+ }
26278
+ weight += 1;
26279
+ index++;
26280
+ }
26281
+ return weight >= 0 ? weight + 1 : weight;
26192
26282
  }
26193
26283
 
26194
26284
  /* src/components/side-menu/SideMenu.svelte generated by Svelte v3.59.2 */
@@ -26234,16 +26324,23 @@ function instance$4($$self, $$props, $$invalidate) {
26234
26324
  }
26235
26325
 
26236
26326
  const links = slot.assignedElements().filter(el => el.tagName === "A");
26327
+ let currentEl;
26328
+ let maxWeight = 0;
26237
26329
 
26238
26330
  links.forEach(child => {
26239
- const current = isUrlMatch(document.location, child.getAttribute("href"));
26331
+ const weight = isUrlMatch(document.location, child.getAttribute("href"));
26240
26332
 
26241
- if (current) {
26242
- child.classList.add("current");
26243
- } else {
26244
- child.classList.remove("current");
26333
+ if (weight > maxWeight) {
26334
+ maxWeight = weight;
26335
+ currentEl = child;
26245
26336
  }
26337
+
26338
+ child.classList.remove("current");
26246
26339
  });
26340
+
26341
+ if (currentEl) {
26342
+ currentEl.classList.add("current");
26343
+ }
26247
26344
  }
26248
26345
 
26249
26346
  function addEventListeners() {
@@ -26325,7 +26422,7 @@ function create_else_block(ctx) {
26325
26422
  };
26326
26423
  }
26327
26424
 
26328
- // (190:4) {#if _open}
26425
+ // (193:4) {#if _open}
26329
26426
  function create_if_block$2(ctx) {
26330
26427
  let goa_icon;
26331
26428
 
@@ -26488,11 +26585,11 @@ function instance$3($$self, $$props, $$invalidate) {
26488
26585
  }
26489
26586
 
26490
26587
  function matchesMenu() {
26491
- return isUrlMatch(document.location, _slug);
26588
+ return isUrlMatch(document.location, _slug) >= 0;
26492
26589
  }
26493
26590
 
26494
26591
  function matchesChild(el) {
26495
- if (isUrlMatch(document.location, toSlug(el.heading))) {
26592
+ if (isUrlMatch(document.location, toSlug(el.heading)) >= 0) {
26496
26593
  return true;
26497
26594
  }
26498
26595
 
@@ -26505,12 +26602,11 @@ function instance$3($$self, $$props, $$invalidate) {
26505
26602
  const children = slot.assignedElements();
26506
26603
 
26507
26604
  return !!children.find(child => {
26508
- return isUrlMatch(document.location, child.getAttribute("href"));
26605
+ return isUrlMatch(document.location, child.getAttribute("href")) >= 0;
26509
26606
  });
26510
26607
  }
26511
26608
 
26512
26609
  function setCurrent() {
26513
- document.location.href;
26514
26610
  const slot = _rootEl.querySelector("slot");
26515
26611
 
26516
26612
  if (!slot) {
@@ -26518,25 +26614,32 @@ function instance$3($$self, $$props, $$invalidate) {
26518
26614
  }
26519
26615
 
26520
26616
  const children = slot.assignedElements();
26617
+ let maxMatchWeight = -1;
26618
+ let matchedChild = null;
26521
26619
  $$invalidate(2, _current = false);
26522
26620
 
26523
26621
  children.forEach(child => {
26524
26622
  const url = child.getAttribute("href");
26525
- const current = isUrlMatch(document.location, url);
26623
+ const weight = isUrlMatch(document.location, url);
26526
26624
 
26527
- if (current) {
26528
- $$invalidate(2, _current = true);
26529
- child.classList.add("current");
26530
- notifyParent(true);
26531
- } else {
26532
- child.classList.remove("current");
26625
+ if (weight > maxMatchWeight) {
26626
+ maxMatchWeight = weight;
26627
+ matchedChild = child;
26533
26628
  }
26534
26629
 
26630
+ child.classList.remove("current");
26631
+
26535
26632
  // get side-menu-group (level >= 2) marked as children
26536
26633
  if (child.tagName === "GOA-SIDE-MENU-GROUP") {
26537
26634
  child.setAttribute("child", "true");
26538
26635
  }
26539
26636
  });
26637
+
26638
+ if (matchedChild) {
26639
+ $$invalidate(2, _current = true);
26640
+ matchedChild.classList.add("current");
26641
+ notifyParent(true);
26642
+ }
26540
26643
  }
26541
26644
 
26542
26645
  function handleClick(e) {