@abgov/web-components 1.16.0 → 1.17.0-alpha.1

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.
@@ -11850,16 +11850,32 @@ customElements.define("goa-input", Input);
11850
11850
 
11851
11851
  function create_if_block_3$7(ctx) {
11852
11852
  let div;
11853
+ let t0;
11854
+ let a;
11855
+ let t1;
11856
+ let a_target_value;
11853
11857
 
11854
11858
  return {
11855
11859
  c() {
11856
11860
  div = element("div");
11857
- div.innerHTML = `An official site of the <a href="https://www.alberta.ca/index.aspx">Alberta Government</a>`;
11861
+ t0 = text("An official site of the ");
11862
+ a = element("a");
11863
+ t1 = text("Alberta Government");
11864
+ attr(a, "href", "https://www.alberta.ca/index.aspx");
11865
+ attr(a, "target", a_target_value = `_${/*headerurltarget*/ ctx[4]}`);
11858
11866
  attr(div, "data-testid", "type");
11859
11867
  attr(div, "class", "site-text");
11860
11868
  },
11861
11869
  m(target, anchor) {
11862
11870
  insert(target, div, anchor);
11871
+ append(div, t0);
11872
+ append(div, a);
11873
+ append(a, t1);
11874
+ },
11875
+ p(ctx, dirty) {
11876
+ if (dirty & /*headerurltarget*/ 16 && a_target_value !== (a_target_value = `_${/*headerurltarget*/ ctx[4]}`)) {
11877
+ attr(a, "target", a_target_value);
11878
+ }
11863
11879
  },
11864
11880
  d(detaching) {
11865
11881
  if (detaching) detach(div);
@@ -11867,7 +11883,7 @@ function create_if_block_3$7(ctx) {
11867
11883
  };
11868
11884
  }
11869
11885
 
11870
- // (31:4) {#if ["alpha", "beta"].includes(type)}
11886
+ // (37:4) {#if ["alpha", "beta"].includes(type)}
11871
11887
  function create_if_block_1$8(ctx) {
11872
11888
  let div0;
11873
11889
  let t0_value = capitalize(/*type*/ ctx[0]) + "";
@@ -11877,6 +11893,8 @@ function create_if_block_1$8(ctx) {
11877
11893
  let div1;
11878
11894
  let t2;
11879
11895
  let a;
11896
+ let t3;
11897
+ let a_target_value;
11880
11898
  let t4;
11881
11899
  let if_block = /*feedbackurl*/ ctx[2] && create_if_block_2$7(ctx);
11882
11900
 
@@ -11888,12 +11906,13 @@ function create_if_block_1$8(ctx) {
11888
11906
  div1 = element("div");
11889
11907
  t2 = text("This is a new ");
11890
11908
  a = element("a");
11891
- a.textContent = "Alberta Government";
11909
+ t3 = text("Alberta Government");
11892
11910
  t4 = text(" service\n ");
11893
11911
  if (if_block) if_block.c();
11894
11912
  attr(div0, "data-testid", "type");
11895
11913
  attr(div0, "class", div0_class_value = "service-type service-type--" + /*type*/ ctx[0].toLowerCase());
11896
11914
  attr(a, "href", "https://www.alberta.ca/index.aspx");
11915
+ attr(a, "target", a_target_value = `_${/*headerurltarget*/ ctx[4]}`);
11897
11916
  attr(div1, "data-testid", "site-text");
11898
11917
  attr(div1, "class", "site-text");
11899
11918
  },
@@ -11904,6 +11923,7 @@ function create_if_block_1$8(ctx) {
11904
11923
  insert(target, div1, anchor);
11905
11924
  append(div1, t2);
11906
11925
  append(div1, a);
11926
+ append(a, t3);
11907
11927
  append(div1, t4);
11908
11928
  if (if_block) if_block.m(div1, null);
11909
11929
  },
@@ -11914,6 +11934,10 @@ function create_if_block_1$8(ctx) {
11914
11934
  attr(div0, "class", div0_class_value);
11915
11935
  }
11916
11936
 
11937
+ if (dirty & /*headerurltarget*/ 16 && a_target_value !== (a_target_value = `_${/*headerurltarget*/ ctx[4]}`)) {
11938
+ attr(a, "target", a_target_value);
11939
+ }
11940
+
11917
11941
  if (/*feedbackurl*/ ctx[2]) {
11918
11942
  if (if_block) {
11919
11943
  if_block.p(ctx, dirty);
@@ -11936,12 +11960,13 @@ function create_if_block_1$8(ctx) {
11936
11960
  };
11937
11961
  }
11938
11962
 
11939
- // (40:8) {#if feedbackurl}
11963
+ // (46:8) {#if feedbackurl}
11940
11964
  function create_if_block_2$7(ctx) {
11941
11965
  let span;
11942
11966
  let t0;
11943
11967
  let a;
11944
11968
  let t1;
11969
+ let a_target_value;
11945
11970
 
11946
11971
  return {
11947
11972
  c() {
@@ -11950,6 +11975,7 @@ function create_if_block_2$7(ctx) {
11950
11975
  a = element("a");
11951
11976
  t1 = text("feedback");
11952
11977
  attr(a, "href", /*feedbackurl*/ ctx[2]);
11978
+ attr(a, "target", a_target_value = `_${/*feedbackurltarget*/ ctx[5]}`);
11953
11979
  attr(span, "data-testid", "feedback");
11954
11980
  },
11955
11981
  m(target, anchor) {
@@ -11962,6 +11988,10 @@ function create_if_block_2$7(ctx) {
11962
11988
  if (dirty & /*feedbackurl*/ 4) {
11963
11989
  attr(a, "href", /*feedbackurl*/ ctx[2]);
11964
11990
  }
11991
+
11992
+ if (dirty & /*feedbackurltarget*/ 32 && a_target_value !== (a_target_value = `_${/*feedbackurltarget*/ ctx[5]}`)) {
11993
+ attr(a, "target", a_target_value);
11994
+ }
11965
11995
  },
11966
11996
  d(detaching) {
11967
11997
  if (detaching) detach(span);
@@ -11969,7 +11999,7 @@ function create_if_block_2$7(ctx) {
11969
11999
  };
11970
12000
  }
11971
12001
 
11972
- // (46:4) {#if version}
12002
+ // (52:4) {#if version}
11973
12003
  function create_if_block$i(ctx) {
11974
12004
  let div;
11975
12005
  let t;
@@ -12003,7 +12033,7 @@ function create_fragment$x(ctx) {
12003
12033
  let div0;
12004
12034
  let t2;
12005
12035
  let header_style_value;
12006
- let if_block0 = /*type*/ ctx[0] === "live" && create_if_block_3$7();
12036
+ let if_block0 = /*type*/ ctx[0] === "live" && create_if_block_3$7(ctx);
12007
12037
  let if_block1 = show_if && create_if_block_1$8(ctx);
12008
12038
  let if_block2 = /*version*/ ctx[1] && create_if_block$i(ctx);
12009
12039
 
@@ -12037,8 +12067,10 @@ function create_fragment$x(ctx) {
12037
12067
  },
12038
12068
  p(ctx, [dirty]) {
12039
12069
  if (/*type*/ ctx[0] === "live") {
12040
- if (if_block0) ; else {
12041
- if_block0 = create_if_block_3$7();
12070
+ if (if_block0) {
12071
+ if_block0.p(ctx, dirty);
12072
+ } else {
12073
+ if_block0 = create_if_block_3$7(ctx);
12042
12074
  if_block0.c();
12043
12075
  if_block0.m(div1, t0);
12044
12076
  }
@@ -12101,9 +12133,16 @@ function instance$u($$self, $$props, $$invalidate) {
12101
12133
  let { version = "" } = $$props;
12102
12134
  let { feedbackurl = "" } = $$props;
12103
12135
  let { maxcontentwidth = "100%" } = $$props;
12136
+ let { headerurltarget = "blank" } = $$props;
12137
+ let { feedbackurltarget = "blank" } = $$props;
12138
+
12139
+ // Validator
12140
+ const [UrlTarget, validateUrlTargetType] = typeValidator("URL target values", ["self", "blank"]);
12104
12141
 
12105
12142
  onMount(() => {
12106
12143
  setTimeout(() => validateType(type), 1);
12144
+ validateUrlTargetType(headerurltarget);
12145
+ validateUrlTargetType(feedbackurltarget);
12107
12146
  });
12108
12147
 
12109
12148
  $$self.$$set = $$props => {
@@ -12111,16 +12150,29 @@ function instance$u($$self, $$props, $$invalidate) {
12111
12150
  if ('version' in $$props) $$invalidate(1, version = $$props.version);
12112
12151
  if ('feedbackurl' in $$props) $$invalidate(2, feedbackurl = $$props.feedbackurl);
12113
12152
  if ('maxcontentwidth' in $$props) $$invalidate(3, maxcontentwidth = $$props.maxcontentwidth);
12153
+ if ('headerurltarget' in $$props) $$invalidate(4, headerurltarget = $$props.headerurltarget);
12154
+ if ('feedbackurltarget' in $$props) $$invalidate(5, feedbackurltarget = $$props.feedbackurltarget);
12114
12155
  };
12115
12156
 
12116
- return [type, version, feedbackurl, maxcontentwidth];
12157
+ return [
12158
+ type,
12159
+ version,
12160
+ feedbackurl,
12161
+ maxcontentwidth,
12162
+ headerurltarget,
12163
+ feedbackurltarget
12164
+ ];
12117
12165
  }
12118
12166
 
12119
12167
  class MicrositeHeader extends SvelteElement {
12120
12168
  constructor(options) {
12121
12169
  super();
12122
12170
  const style = document.createElement('style');
12123
- 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}`;
12171
+
12172
+ 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")
12173
+ 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")
12174
+ 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}`;
12175
+
12124
12176
  this.shadowRoot.appendChild(style);
12125
12177
 
12126
12178
  init(
@@ -12137,7 +12189,9 @@ class MicrositeHeader extends SvelteElement {
12137
12189
  type: 0,
12138
12190
  version: 1,
12139
12191
  feedbackurl: 2,
12140
- maxcontentwidth: 3
12192
+ maxcontentwidth: 3,
12193
+ headerurltarget: 4,
12194
+ feedbackurltarget: 5
12141
12195
  },
12142
12196
  null
12143
12197
  );
@@ -12155,7 +12209,14 @@ class MicrositeHeader extends SvelteElement {
12155
12209
  }
12156
12210
 
12157
12211
  static get observedAttributes() {
12158
- return ["type", "version", "feedbackurl", "maxcontentwidth"];
12212
+ return [
12213
+ "type",
12214
+ "version",
12215
+ "feedbackurl",
12216
+ "maxcontentwidth",
12217
+ "headerurltarget",
12218
+ "feedbackurltarget"
12219
+ ];
12159
12220
  }
12160
12221
 
12161
12222
  get type() {
@@ -12193,6 +12254,24 @@ class MicrositeHeader extends SvelteElement {
12193
12254
  this.$$set({ maxcontentwidth });
12194
12255
  flush();
12195
12256
  }
12257
+
12258
+ get headerurltarget() {
12259
+ return this.$$.ctx[4];
12260
+ }
12261
+
12262
+ set headerurltarget(headerurltarget) {
12263
+ this.$$set({ headerurltarget });
12264
+ flush();
12265
+ }
12266
+
12267
+ get feedbackurltarget() {
12268
+ return this.$$.ctx[5];
12269
+ }
12270
+
12271
+ set feedbackurltarget(feedbackurltarget) {
12272
+ this.$$set({ feedbackurltarget });
12273
+ flush();
12274
+ }
12196
12275
  }
12197
12276
 
12198
12277
  customElements.define("goa-microsite-header", MicrositeHeader);
@@ -12810,7 +12889,7 @@ class Modal extends SvelteElement {
12810
12889
  constructor(options) {
12811
12890
  super();
12812
12891
  const style = document.createElement('style');
12813
- 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)}`;
12892
+ 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)}`;
12814
12893
  this.shadowRoot.appendChild(style);
12815
12894
 
12816
12895
  init(
@@ -26072,18 +26151,29 @@ class Pages extends SvelteElement {
26072
26151
  customElements.define("goa-pages", Pages);
26073
26152
 
26074
26153
  function isUrlMatch(windowUrl, testUrl) {
26075
- if (!testUrl)
26076
- return false;
26077
- const pathParts = windowUrl.pathname.split("/");
26078
- testUrl = testUrl.replace(/^\//, "");
26079
- for (const part of pathParts) {
26080
- if (part === testUrl)
26081
- return true;
26154
+ if (testUrl === void 0)
26155
+ return -1;
26156
+ const windowUrlParts = windowUrl.pathname.replace(/^\//, "").split("/");
26157
+ const urlParts = testUrl.replace(/^\//, "").split("/");
26158
+ if (windowUrlParts.length < urlParts.length) {
26159
+ return -1;
26082
26160
  }
26083
- if (windowUrl.hash === testUrl) {
26084
- return true;
26161
+ if (windowUrl.hash.length > 0 && windowUrl.hash === testUrl) {
26162
+ return 1;
26085
26163
  }
26086
- return false;
26164
+ if (urlParts.length === 1 && urlParts[0] === "") {
26165
+ return 0;
26166
+ }
26167
+ let weight = -1;
26168
+ let index = 0;
26169
+ for (const part of windowUrlParts) {
26170
+ if (urlParts[index] !== part) {
26171
+ break;
26172
+ }
26173
+ weight += 1;
26174
+ index++;
26175
+ }
26176
+ return weight >= 0 ? weight + 1 : weight;
26087
26177
  }
26088
26178
 
26089
26179
  /* src/components/side-menu/SideMenu.svelte generated by Svelte v3.59.2 */
@@ -26129,16 +26219,23 @@ function instance$4($$self, $$props, $$invalidate) {
26129
26219
  }
26130
26220
 
26131
26221
  const links = slot.assignedElements().filter(el => el.tagName === "A");
26222
+ let currentEl;
26223
+ let maxWeight = 0;
26132
26224
 
26133
26225
  links.forEach(child => {
26134
- const current = isUrlMatch(document.location, child.getAttribute("href"));
26226
+ const weight = isUrlMatch(document.location, child.getAttribute("href"));
26135
26227
 
26136
- if (current) {
26137
- child.classList.add("current");
26138
- } else {
26139
- child.classList.remove("current");
26228
+ if (weight > maxWeight) {
26229
+ maxWeight = weight;
26230
+ currentEl = child;
26140
26231
  }
26232
+
26233
+ child.classList.remove("current");
26141
26234
  });
26235
+
26236
+ if (currentEl) {
26237
+ currentEl.classList.add("current");
26238
+ }
26142
26239
  }
26143
26240
 
26144
26241
  function addEventListeners() {
@@ -26220,7 +26317,7 @@ function create_else_block(ctx) {
26220
26317
  };
26221
26318
  }
26222
26319
 
26223
- // (190:4) {#if _open}
26320
+ // (193:4) {#if _open}
26224
26321
  function create_if_block$2(ctx) {
26225
26322
  let goa_icon;
26226
26323
 
@@ -26383,11 +26480,11 @@ function instance$3($$self, $$props, $$invalidate) {
26383
26480
  }
26384
26481
 
26385
26482
  function matchesMenu() {
26386
- return isUrlMatch(document.location, _slug);
26483
+ return isUrlMatch(document.location, _slug) >= 0;
26387
26484
  }
26388
26485
 
26389
26486
  function matchesChild(el) {
26390
- if (isUrlMatch(document.location, toSlug(el.heading))) {
26487
+ if (isUrlMatch(document.location, toSlug(el.heading)) >= 0) {
26391
26488
  return true;
26392
26489
  }
26393
26490
 
@@ -26400,12 +26497,11 @@ function instance$3($$self, $$props, $$invalidate) {
26400
26497
  const children = slot.assignedElements();
26401
26498
 
26402
26499
  return !!children.find(child => {
26403
- return isUrlMatch(document.location, child.getAttribute("href"));
26500
+ return isUrlMatch(document.location, child.getAttribute("href")) >= 0;
26404
26501
  });
26405
26502
  }
26406
26503
 
26407
26504
  function setCurrent() {
26408
- document.location.href;
26409
26505
  const slot = _rootEl.querySelector("slot");
26410
26506
 
26411
26507
  if (!slot) {
@@ -26413,25 +26509,32 @@ function instance$3($$self, $$props, $$invalidate) {
26413
26509
  }
26414
26510
 
26415
26511
  const children = slot.assignedElements();
26512
+ let maxMatchWeight = -1;
26513
+ let matchedChild = null;
26416
26514
  $$invalidate(2, _current = false);
26417
26515
 
26418
26516
  children.forEach(child => {
26419
26517
  const url = child.getAttribute("href");
26420
- const current = isUrlMatch(document.location, url);
26518
+ const weight = isUrlMatch(document.location, url);
26421
26519
 
26422
- if (current) {
26423
- $$invalidate(2, _current = true);
26424
- child.classList.add("current");
26425
- notifyParent(true);
26426
- } else {
26427
- child.classList.remove("current");
26520
+ if (weight > maxMatchWeight) {
26521
+ maxMatchWeight = weight;
26522
+ matchedChild = child;
26428
26523
  }
26429
26524
 
26525
+ child.classList.remove("current");
26526
+
26430
26527
  // get side-menu-group (level >= 2) marked as children
26431
26528
  if (child.tagName === "GOA-SIDE-MENU-GROUP") {
26432
26529
  child.setAttribute("child", "true");
26433
26530
  }
26434
26531
  });
26532
+
26533
+ if (matchedChild) {
26534
+ $$invalidate(2, _current = true);
26535
+ matchedChild.classList.add("current");
26536
+ notifyParent(true);
26537
+ }
26435
26538
  }
26436
26539
 
26437
26540
  function handleClick(e) {