@universal-ember/docs-support 0.6.5 → 0.6.7

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.
@@ -1,4 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
+ import type RouterService from '@ember/routing/router-service';
2
3
  import type { DocsService } from 'kolay';
3
4
  export declare class SideNav extends Component<{
4
5
  Element: HTMLElement;
@@ -7,7 +8,9 @@ export declare class SideNav extends Component<{
7
8
  };
8
9
  }> {
9
10
  docs: DocsService;
11
+ router: RouterService;
10
12
  get humanSelected(): string | undefined;
13
+ get rootUrl(): string;
11
14
  closeNav: (event: Event) => void;
12
15
  }
13
16
  //# sourceMappingURL=side-nav.gts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"side-nav.gts.d.ts","sourceRoot":"","sources":["../src/side-nav.gts"],"names":[],"mappings":"AAyKA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAU3C,OAAO,KAAK,EAAE,WAAW,EAAQ,MAAM,OAAO,CAAC;AA+D/C,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;CACH,CAAC;IAC+B,IAAI,EAAE,WAAW,CAAC;IAEjD,IAAI,aAAa,uBAMhB;IAED,QAAQ,GAAI,OAAO,KAAK,UAItB;CAiBH"}
1
+ {"version":3,"file":"side-nav.gts.d.ts","sourceRoot":"","sources":["../src/side-nav.gts"],"names":[],"mappings":"AA0LA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAG3C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAQ/D,OAAO,KAAK,EAAE,WAAW,EAAQ,MAAM,OAAO,CAAC;AA0E/C,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;CACH,CAAC;IAC+B,IAAI,EAAE,WAAW,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IAEjD,IAAI,aAAa,uBAMhB;IAED,IAAI,OAAO,WAEV;IAED,QAAQ,GAAI,OAAO,KAAK,UAItB;CAiBH"}
package/dist/side-nav.js CHANGED
@@ -20,6 +20,10 @@ function fixWords(text) {
20
20
  return text;
21
21
  }
22
22
  }
23
+ const joinUrl = (...strs) => {
24
+ let prefix = strs[0]?.startsWith('/') ? '/' : '';
25
+ return prefix + strs.map(s => s.replace(/^\//, '').replace(/\/$/, '')).filter(x => !!x).join('/');
26
+ };
23
27
  /**
24
28
  * Converts 1-2-hyphenated-thing
25
29
  * to
@@ -64,11 +68,18 @@ class SideNav extends Component {
64
68
  g(this.prototype, "docs", [service('kolay/docs')]);
65
69
  }
66
70
  #docs = (i(this, "docs"), void 0);
71
+ static {
72
+ g(this.prototype, "router", [service('router')]);
73
+ }
74
+ #router = (i(this, "router"), void 0);
67
75
  get humanSelected() {
68
76
  let path = this.docs.selected?.path;
69
77
  if (!path) return undefined;
70
78
  return path.split('/').filter(Boolean).map(titleize).join(' / ');
71
79
  }
80
+ get rootUrl() {
81
+ return this.router.rootURL;
82
+ }
72
83
  closeNav = event => {
73
84
  if (!getAnchor(event)) return;
74
85
  this.args.onClick?.();
@@ -86,11 +97,12 @@ class SideNav extends Component {
86
97
  * The links themselves remain the actual interactive elements.
87
98
  */
88
99
  static {
89
- setComponentTemplate(precompileTemplate("\n <aside class=\"bg-white dark:bg-slate-900\" ...attributes>\n <PageNav aria-label=\"Main Navigation\">\n <:page as |x|>\n <SubSectionLink @href={{x.page.path}} @name={{nameFor x.page}} {{on \"click\" this.closeNav}} />\n </:page>\n\n <:collection as |x|>\n {{#if x.index}}\n <SectionLink @href={{x.index.page.path}} @name={{titleize x.collection.name}} {{on \"click\" this.closeNav}} />\n {{else}}\n <h2>\n {{titleize x.collection.name}}\n </h2>\n {{/if}}\n </:collection>\n </PageNav>\n </aside>\n ", {
100
+ setComponentTemplate(precompileTemplate("\n <aside class=\"bg-white dark:bg-slate-900\" ...attributes>\n <PageNav aria-label=\"Main Navigation\">\n <:page as |x|>\n <SubSectionLink @href={{joinUrl this.rootUrl x.page.path}} @name={{nameFor x.page}} {{on \"click\" this.closeNav}} />\n </:page>\n\n <:collection as |x|>\n {{#if x.index}}\n <SectionLink @href={{joinUrl this.rootUrl x.index.page.path}} @name={{titleize x.collection.name}} {{on \"click\" this.closeNav}} />\n {{else}}\n <h2>\n {{titleize x.collection.name}}\n </h2>\n {{/if}}\n </:collection>\n </PageNav>\n </aside>\n ", {
90
101
  strictMode: true,
91
102
  scope: () => ({
92
103
  PageNav,
93
104
  SubSectionLink,
105
+ joinUrl,
94
106
  nameFor,
95
107
  on,
96
108
  SectionLink,
@@ -1 +1 @@
1
- {"version":3,"file":"side-nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"side-nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -36,6 +36,8 @@
36
36
  overflow: auto;
37
37
  max-height: calc(100dvh - 80px);
38
38
  padding-bottom: 80px;
39
+ position: sticky;
40
+ top: 92px;
39
41
  }
40
42
  }
41
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-ember/docs-support",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "description": "The default blueprint for Embroider v2 addons.",
5
5
  "keywords": [
6
6
  "ember-addon"