@docfy/ember 0.9.0 → 0.10.0
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/README.md +8 -5
- package/addon-main.cjs +4 -0
- package/declarations/components/docfy-demo.d.ts +44 -0
- package/declarations/components/docfy-demo.d.ts.map +1 -0
- package/declarations/components/docfy-link.d.ts +23 -0
- package/declarations/components/docfy-link.d.ts.map +1 -0
- package/declarations/components/docfy-output.d.ts +24 -0
- package/declarations/components/docfy-output.d.ts.map +1 -0
- package/declarations/components/docfy-previous-and-next-page.d.ts +23 -0
- package/declarations/components/docfy-previous-and-next-page.d.ts.map +1 -0
- package/declarations/index.d.ts +7 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/routing.d.ts +3 -0
- package/declarations/routing.d.ts.map +1 -0
- package/{services → declarations/services}/docfy.d.ts +4 -8
- package/declarations/services/docfy.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +11 -0
- package/declarations/template-registry.d.ts.map +1 -0
- package/dist/_app_/components/docfy-demo.js +1 -0
- package/dist/_app_/components/docfy-link.js +1 -0
- package/dist/_app_/components/docfy-output.js +1 -0
- package/dist/_app_/components/docfy-previous-and-next-page.js +1 -0
- package/dist/_app_/services/docfy.js +1 -0
- package/dist/components/docfy-demo.js +121 -0
- package/dist/components/docfy-demo.js.map +1 -0
- package/dist/components/docfy-link.js +58 -0
- package/dist/components/docfy-link.js.map +1 -0
- package/dist/components/docfy-output.js +43 -0
- package/dist/components/docfy-output.js.map +1 -0
- package/dist/components/docfy-previous-and-next-page.js +27 -0
- package/dist/components/docfy-previous-and-next-page.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +2 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +17 -0
- package/dist/output.js.map +1 -0
- package/dist/routing.js +29 -0
- package/dist/routing.js.map +1 -0
- package/dist/services/docfy.js +87 -0
- package/dist/services/docfy.js.map +1 -0
- package/dist/template-registry.js +2 -0
- package/dist/template-registry.js.map +1 -0
- package/package.json +91 -124
- package/-private/find-previous-or-next-page.d.ts +0 -2
- package/-private/flat-nested.d.ts +0 -2
- package/.docfy-config.js +0 -40
- package/addon/-private/find-previous-or-next-page.ts +0 -22
- package/addon/-private/flat-nested.ts +0 -18
- package/addon/components/docfy-demo/description.hbs +0 -26
- package/addon/components/docfy-demo/description.ts +0 -3
- package/addon/components/docfy-demo/example.hbs +0 -3
- package/addon/components/docfy-demo/example.ts +0 -3
- package/addon/components/docfy-demo/snippet.hbs +0 -8
- package/addon/components/docfy-demo/snippet.ts +0 -35
- package/addon/components/docfy-demo/snippets.hbs +0 -25
- package/addon/components/docfy-demo/snippets.ts +0 -27
- package/addon/components/docfy-demo.hbs +0 -10
- package/addon/components/docfy-demo.ts +0 -7
- package/addon/components/docfy-link.hbs +0 -8
- package/addon/components/docfy-link.ts +0 -54
- package/addon/components/docfy-output.hbs +0 -1
- package/addon/components/docfy-output.ts +0 -37
- package/addon/components/docfy-previous-and-next-page.hbs +0 -1
- package/addon/components/docfy-previous-and-next-page.ts +0 -20
- package/addon/helpers/docfy-eq.ts +0 -7
- package/addon/index.ts +0 -31
- package/addon/output.d.ts +0 -13
- package/addon/services/docfy.ts +0 -101
- package/app/components/docfy-demo/description.js +0 -1
- package/app/components/docfy-demo/example.js +0 -1
- package/app/components/docfy-demo/snippet.js +0 -1
- package/app/components/docfy-demo/snippets.js +0 -1
- package/app/components/docfy-demo.js +0 -1
- package/app/components/docfy-link.js +0 -1
- package/app/components/docfy-output.js +0 -1
- package/app/components/docfy-previous-and-next-page.js +0 -1
- package/app/helpers/docfy-eq.js +0 -1
- package/app/services/docfy.js +0 -1
- package/components/docfy-demo/description.d.ts +0 -3
- package/components/docfy-demo/example.d.ts +0 -3
- package/components/docfy-demo/snippet.d.ts +0 -13
- package/components/docfy-demo/snippets.d.ts +0 -11
- package/components/docfy-demo.d.ts +0 -7
- package/components/docfy-link.d.ts +0 -15
- package/components/docfy-output.d.ts +0 -16
- package/components/docfy-previous-and-next-page.d.ts +0 -12
- package/config/environment.js +0 -5
- package/docs/components/docfy-demo.md +0 -67
- package/docs/components/docfy-link-demo/anchor.md +0 -9
- package/docs/components/docfy-link-demo/simple.md +0 -7
- package/docs/components/docfy-link.md +0 -31
- package/docs/components/docfy-output-demo/edit-page.md +0 -54
- package/docs/components/docfy-output-demo/flat.md +0 -23
- package/docs/components/docfy-output-demo/on-this-page.md +0 -30
- package/docs/components/docfy-output-demo/sidebar.md +0 -45
- package/docs/components/docfy-output-demo/top-nav.md +0 -35
- package/docs/components/docfy-output.md +0 -34
- package/docs/components/docfy-previous-and-next-page-demo/scope.md +0 -26
- package/docs/components/docfy-previous-and-next-page-demo/simple.md +0 -24
- package/docs/components/docfy-previous-and-next-page.md +0 -21
- package/docs/configuration.md +0 -57
- package/docs/index.md +0 -165
- package/docs/writing-demos-demo/demo1.md +0 -18
- package/docs/writing-demos.md +0 -109
- package/dummy-docs/README.md +0 -140
- package/dummy-docs/github-icon.png +0 -0
- package/dummy-docs/installation.md +0 -14
- package/dummy-docs/introduction.md +0 -30
- package/dummy-docs/overview.md +0 -19
- package/dummy-docs/packages/core/helpers/genereate-flat-output.md +0 -10
- package/dummy-docs/packages/core/helpers/genereate-nested-output.md +0 -12
- package/dummy-docs/packages/core/overview.md +0 -19
- package/dummy-docs/packages/ember/components/docfy-link-demo/demo1.md +0 -26
- package/dummy-docs/packages/ember/components/docfy-link-demo/demo2.md +0 -20
- package/dummy-docs/packages/ember/components/docfy-link.md +0 -19
- package/dummy-docs/packages/ember/components/docfy-output.md +0 -32
- package/dummy-docs/packages/ember/components/docfy-with-hyphenated-number-2-demo/demo1.md +0 -25
- package/dummy-docs/packages/ember/components/docfy-with-hyphenated-number-2.md +0 -9
- package/dummy-docs/packages/ember/demo/my-ember-demo.md +0 -3
- package/dummy-docs/packages/ember/index.md +0 -23
- package/dummy-docs/packages/ember/installation.md +0 -14
- package/dummy-docs/packages/ember/plugins/manual-demo-insertion-demo/tomster.md +0 -15
- package/dummy-docs/packages/ember/plugins/manual-demo-insertion-demo/zoey.md +0 -9
- package/dummy-docs/packages/ember/plugins/manual-demo-insertion.md +0 -31
- package/dummy-docs/packages/ember/preview.md +0 -20
- package/ember-cli-addon.js +0 -3
- package/helpers/docfy-eq.d.ts +0 -7
- package/index.d.ts +0 -3
- package/lib/docfy-output-template.d.ts +0 -1
- package/lib/docfy-output-template.js +0 -23
- package/lib/get-config.d.ts +0 -7
- package/lib/get-config.js +0 -118
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -177
- package/lib/plugins/extract-demos-to-components.d.ts +0 -2
- package/lib/plugins/extract-demos-to-components.js +0 -149
- package/lib/plugins/preview-template.d.ts +0 -2
- package/lib/plugins/preview-template.js +0 -41
- package/lib/plugins/replace-internal-links-with-docfy-link.d.ts +0 -6
- package/lib/plugins/replace-internal-links-with-docfy-link.js +0 -44
- package/lib/plugins/types.d.ts +0 -29
- package/lib/plugins/types.js +0 -2
- package/lib/plugins/utils.d.ts +0 -31
- package/lib/plugins/utils.js +0 -142
- package/output.d.ts +0 -13
- package/src/docfy-output-template.ts +0 -20
- package/src/get-config.ts +0 -109
- package/src/index.ts +0 -229
- package/src/plugins/extract-demos-to-components.ts +0 -196
- package/src/plugins/preview-template.ts +0 -54
- package/src/plugins/replace-internal-links-with-docfy-link.ts +0 -61
- package/src/plugins/types.ts +0 -33
- package/src/plugins/utils.ts +0 -191
- package/src/tsconfig.json +0 -14
- package/src/types/broccoli-bridge.d.ts +0 -11
- package/src/types/broccoli-file-creator.d.ts +0 -11
- package/src/types/broccoli-funnel.d.ts +0 -19
- package/src/types/broccoli-merge-trees.d.ts +0 -13
- package/src/types/broccoli-source.d.ts +0 -9
- package/src/types/mdast-util-to-string.d.ts +0 -5
- package/src/types/unist-util-find.d.ts +0 -8
- package/tsconfig.json +0 -42
- package/types/dummy/index.d.ts +0 -0
- package/types/ember-get-config/index.d.ts +0 -9
- package/types/global.d.ts +0 -6
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { NestedPageMetadata, PageMetadata } from '@docfy/core/lib/types';
|
|
3
|
-
import { inject as service } from '@ember/service';
|
|
4
|
-
import RouterService from '@ember/routing/router-service';
|
|
5
|
-
import DocfyService from '../services/docfy';
|
|
6
|
-
|
|
7
|
-
interface DocfyOutputArgs {
|
|
8
|
-
type?: 'flat' | 'nested';
|
|
9
|
-
fromCurrentURL?: boolean;
|
|
10
|
-
url?: string;
|
|
11
|
-
scope?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default class DocfyOutput extends Component<DocfyOutputArgs> {
|
|
15
|
-
@service router!: RouterService;
|
|
16
|
-
@service docfy!: DocfyService;
|
|
17
|
-
|
|
18
|
-
get output(): NestedPageMetadata | PageMetadata[] | PageMetadata | undefined {
|
|
19
|
-
if (this.args.url) {
|
|
20
|
-
return this.docfy.findByUrl(this.args.url, this.args.scope);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (this.args.fromCurrentURL) {
|
|
24
|
-
return this.docfy.findByUrl(this.router.currentURL, this.args.scope);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (this.args.scope) {
|
|
28
|
-
return this.docfy.findNestedChildrenByName(this.args.scope);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (this.args.type === 'flat') {
|
|
32
|
-
return this.docfy.flat;
|
|
33
|
-
} else {
|
|
34
|
-
return this.docfy.nested;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{{yield this.previous this.next}}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import DocfyService from '../services/docfy';
|
|
3
|
-
import { PageMetadata } from '@docfy/core/lib/types';
|
|
4
|
-
import { inject as service } from '@ember/service';
|
|
5
|
-
|
|
6
|
-
interface DocfyPreviousAndNextPageArgs {
|
|
7
|
-
scope?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default class DocfyPreviousAndNextPage extends Component<DocfyPreviousAndNextPageArgs> {
|
|
11
|
-
@service docfy!: DocfyService;
|
|
12
|
-
|
|
13
|
-
get previous(): PageMetadata | undefined {
|
|
14
|
-
return this.docfy.previousPage(this.args.scope);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get next(): PageMetadata | undefined {
|
|
18
|
-
return this.docfy.nextPage(this.args.scope);
|
|
19
|
-
}
|
|
20
|
-
}
|
package/addon/index.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import output from '@docfy/ember/output';
|
|
2
|
-
import RouterDSL from '@ember/routing/-private/router-dsl';
|
|
3
|
-
import { NestedPageMetadata } from '@docfy/core/lib/types';
|
|
4
|
-
export { default as DocfyService } from './services/docfy';
|
|
5
|
-
|
|
6
|
-
function addFromNested(context: RouterDSL, nested: NestedPageMetadata): void {
|
|
7
|
-
function add(this: RouterDSL): void {
|
|
8
|
-
nested.pages.forEach((page) => {
|
|
9
|
-
const url = page.relativeUrl;
|
|
10
|
-
if (typeof url === 'string') {
|
|
11
|
-
if (url !== '') {
|
|
12
|
-
this.route(url);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
nested.children.forEach((node) => {
|
|
18
|
-
addFromNested(this, node);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (nested.name === '/') {
|
|
23
|
-
add.call(context);
|
|
24
|
-
} else {
|
|
25
|
-
context.route(nested.name, add);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function addDocfyRoutes(context: RouterDSL): void {
|
|
30
|
-
addFromNested(context, output.nested);
|
|
31
|
-
}
|
package/addon/output.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The actual output.js file is generated at build time. This is only to
|
|
3
|
-
* provide typing.
|
|
4
|
-
*/
|
|
5
|
-
import { NestedPageMetadata } from '@docfy/core/lib/types';
|
|
6
|
-
|
|
7
|
-
interface Output {
|
|
8
|
-
nested: NestedPageMetadata;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare const output: Output;
|
|
12
|
-
|
|
13
|
-
export default output;
|
package/addon/services/docfy.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import Service from '@ember/service';
|
|
2
|
-
import output from '@docfy/ember/output';
|
|
3
|
-
import { NestedPageMetadata, PageMetadata } from '@docfy/core/lib/types';
|
|
4
|
-
import flatNested from '../-private/flat-nested';
|
|
5
|
-
import { inject as service } from '@ember/service';
|
|
6
|
-
import RouterService from '@ember/routing/router-service';
|
|
7
|
-
|
|
8
|
-
export default class DocfyService extends Service {
|
|
9
|
-
@service router!: RouterService;
|
|
10
|
-
|
|
11
|
-
get flat(): PageMetadata[] {
|
|
12
|
-
return flatNested(this.nested);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get nested(): NestedPageMetadata {
|
|
16
|
-
return output.nested;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get currentPage(): PageMetadata | undefined {
|
|
20
|
-
return this.findByUrl(this.router.currentURL);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
findNestedChildrenByName(
|
|
24
|
-
scope: string,
|
|
25
|
-
previousNested: NestedPageMetadata | undefined | null = null
|
|
26
|
-
): NestedPageMetadata | undefined {
|
|
27
|
-
if (previousNested === null) {
|
|
28
|
-
previousNested = this.nested;
|
|
29
|
-
}
|
|
30
|
-
const parts = scope.split('/');
|
|
31
|
-
const name = parts.shift();
|
|
32
|
-
|
|
33
|
-
const foundScope = previousNested?.children.find((item) => {
|
|
34
|
-
return item.name === name;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (parts.length > 0) {
|
|
38
|
-
return this.findNestedChildrenByName(parts.join('/'), foundScope);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return foundScope;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
findByUrl(url: string, scopeByNestedName?: string): PageMetadata | undefined {
|
|
45
|
-
let pages = this.flat;
|
|
46
|
-
|
|
47
|
-
if (typeof scopeByNestedName === 'string') {
|
|
48
|
-
pages = flatNested(this.findNestedChildrenByName(scopeByNestedName));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
url = url.split('#')[0];
|
|
52
|
-
|
|
53
|
-
// Make sure to always remove the trailing slash.
|
|
54
|
-
// This is necessary for pre-rendered pages where the url always will end
|
|
55
|
-
// with an slash.
|
|
56
|
-
url = url.replace(/\/$/, '');
|
|
57
|
-
|
|
58
|
-
return pages.find((item) => {
|
|
59
|
-
return item.url === url || item.url === `${url}/`;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
previousPage(scopeByNestedName?: string): PageMetadata | undefined {
|
|
64
|
-
return this.findPreviousOrNextPage(true, scopeByNestedName);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
nextPage(scopeByNestedName?: string): PageMetadata | undefined {
|
|
68
|
-
return this.findPreviousOrNextPage(false, scopeByNestedName);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private findPreviousOrNextPage(
|
|
72
|
-
isPrevious: boolean,
|
|
73
|
-
scopeByNestedName?: string
|
|
74
|
-
): PageMetadata | undefined {
|
|
75
|
-
let pages = this.flat;
|
|
76
|
-
|
|
77
|
-
if (typeof scopeByNestedName === 'string') {
|
|
78
|
-
pages = flatNested(this.findNestedChildrenByName(scopeByNestedName));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const index = pages.findIndex((page) => {
|
|
82
|
-
return page === this.currentPage;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
if (index > -1) {
|
|
86
|
-
if (isPrevious) {
|
|
87
|
-
return this.flat[index - 1];
|
|
88
|
-
} else {
|
|
89
|
-
return this.flat[index + 1];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// DO NOT DELETE: this is how TypeScript knows how to look up your services.
|
|
97
|
-
declare module '@ember/service' {
|
|
98
|
-
interface Registry {
|
|
99
|
-
docfy: DocfyService;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-demo/description';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-demo/example';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-demo/snippet';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-demo/snippets';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-demo';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-link';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-output';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/components/docfy-previous-and-next-page';
|
package/app/helpers/docfy-eq.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default, docfyEq } from '@docfy/ember/helpers/docfy-eq';
|
package/app/services/docfy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@docfy/ember/services/docfy';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { SnippetRegisterArgs } from './snippets';
|
|
3
|
-
interface DocfyDemoSnippetArgs {
|
|
4
|
-
name: string;
|
|
5
|
-
active: string;
|
|
6
|
-
registerSnippet: (snippet: SnippetRegisterArgs) => void;
|
|
7
|
-
}
|
|
8
|
-
export default class DocfyDemoSnippet extends Component<DocfyDemoSnippetArgs> {
|
|
9
|
-
id: string;
|
|
10
|
-
constructor(owner: unknown, args: DocfyDemoSnippetArgs);
|
|
11
|
-
get isActive(): boolean;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
export interface SnippetRegisterArgs {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export default class DocfyDemoSnippets extends Component {
|
|
7
|
-
snippets: SnippetRegisterArgs[];
|
|
8
|
-
active?: string;
|
|
9
|
-
registerSnippet(snippet: SnippetRegisterArgs): void;
|
|
10
|
-
setActiveSnippet(id: string): void;
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import RouterService from '@ember/routing/router-service';
|
|
3
|
-
interface DocfyLinkArgs {
|
|
4
|
-
to: string;
|
|
5
|
-
anchor?: string;
|
|
6
|
-
activeClass?: string;
|
|
7
|
-
}
|
|
8
|
-
export default class DocfyLink extends Component<DocfyLinkArgs> {
|
|
9
|
-
router: RouterService;
|
|
10
|
-
get routeName(): string;
|
|
11
|
-
get href(): string;
|
|
12
|
-
get isActive(): boolean;
|
|
13
|
-
navigate(event: MouseEvent): void;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { NestedPageMetadata, PageMetadata } from '@docfy/core/lib/types';
|
|
3
|
-
import RouterService from '@ember/routing/router-service';
|
|
4
|
-
import DocfyService from '../services/docfy';
|
|
5
|
-
interface DocfyOutputArgs {
|
|
6
|
-
type?: 'flat' | 'nested';
|
|
7
|
-
fromCurrentURL?: boolean;
|
|
8
|
-
url?: string;
|
|
9
|
-
scope?: string;
|
|
10
|
-
}
|
|
11
|
-
export default class DocfyOutput extends Component<DocfyOutputArgs> {
|
|
12
|
-
router: RouterService;
|
|
13
|
-
docfy: DocfyService;
|
|
14
|
-
get output(): NestedPageMetadata | PageMetadata[] | PageMetadata | undefined;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import DocfyService from '../services/docfy';
|
|
3
|
-
import { PageMetadata } from '@docfy/core/lib/types';
|
|
4
|
-
interface DocfyPreviousAndNextPageArgs {
|
|
5
|
-
scope?: string;
|
|
6
|
-
}
|
|
7
|
-
export default class DocfyPreviousAndNextPage extends Component<DocfyPreviousAndNextPageArgs> {
|
|
8
|
-
docfy: DocfyService;
|
|
9
|
-
get previous(): PageMetadata | undefined;
|
|
10
|
-
get next(): PageMetadata | undefined;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
package/config/environment.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 4
|
|
3
|
-
category: components
|
|
4
|
-
title: <DocfyDemo>
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# {{"<DocfyDemo>"}}
|
|
8
|
-
|
|
9
|
-
This component is used internally to render demos. It's not meant to be used directly,
|
|
10
|
-
although that's possible. The scope of what you want to understand is the CSS
|
|
11
|
-
classes such that you can style the parts of the demo component yourself.
|
|
12
|
-
|
|
13
|
-
Make sure to look at [writing demos](../writing-demos.md), so you can understand how demos look.
|
|
14
|
-
|
|
15
|
-
Below is an example of how styling could look like. It uses
|
|
16
|
-
[TailwindCSS](https://tailwindcss.com/) and [PostCSS Nested](https://github.com/postcss/postcss-nested).
|
|
17
|
-
|
|
18
|
-
```css
|
|
19
|
-
.docfy-demo__example {
|
|
20
|
-
@apply p-4 border rounded-t;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.docfy-demo__description {
|
|
24
|
-
@apply p-4 border-l border-r;
|
|
25
|
-
|
|
26
|
-
&__header {
|
|
27
|
-
@apply flex justify-between;
|
|
28
|
-
|
|
29
|
-
&__title {
|
|
30
|
-
@apply mb-4 font-medium leading-tight text-gray-900;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&__edit-url {
|
|
34
|
-
@apply text-sm;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&__content {
|
|
39
|
-
@apply markdown;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
.docfy-demo__snippets {
|
|
43
|
-
&__tabs {
|
|
44
|
-
@apply px-2 border-l border-r;
|
|
45
|
-
|
|
46
|
-
&__button {
|
|
47
|
-
@apply p-2 mr-2 border-b-4;
|
|
48
|
-
|
|
49
|
-
&--active,
|
|
50
|
-
&:hover {
|
|
51
|
-
@apply border-blue-500;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.docfy-demo__snippet {
|
|
58
|
-
pre {
|
|
59
|
-
@apply p-4;
|
|
60
|
-
@apply flex text-gray-200 bg-gray-800;
|
|
61
|
-
@apply text-sm leading-normal;
|
|
62
|
-
@apply font-mono;
|
|
63
|
-
@apply rounded-b;
|
|
64
|
-
scrollbar-width: none;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 2
|
|
3
|
-
category: components
|
|
4
|
-
title: <DocfyLink>
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# {{"<DocfyLink>"}}
|
|
8
|
-
|
|
9
|
-
This component is useful for linking to pages created by Docfy. It understands
|
|
10
|
-
how the routing in Ember was designed and can correctly link to a given page URL.
|
|
11
|
-
If the component is not able to figure out the correct Ember route, it will fall
|
|
12
|
-
back to setting `windown.location` directly.
|
|
13
|
-
|
|
14
|
-
DocfyLink can also link to an anchor; this allows for linking to specific sections
|
|
15
|
-
on a page. Note that linking to an anchor may cause a full-page reload given that
|
|
16
|
-
Ember doesn't have support for anchors.
|
|
17
|
-
|
|
18
|
-
> Docfy also uses this component internally to replace any links between your
|
|
19
|
-
> markdown files. It gives a pleasant User Experience because it can use the
|
|
20
|
-
> Ember Routing to make the page transition, removing the need for a full-page reload.
|
|
21
|
-
|
|
22
|
-
Below you can see a simple example of this component; however, you can see more
|
|
23
|
-
of its usage throughout the documentation.
|
|
24
|
-
|
|
25
|
-
# API
|
|
26
|
-
|
|
27
|
-
| Argument | Description | Type | Default Value |
|
|
28
|
-
| -------------- | ----------------------------------------------- | ----------------------- | ------------- |
|
|
29
|
-
| `@to` | The URL to link | `string` | |
|
|
30
|
-
| `@anchor` | An anchor | `string` \| `undefined` | |
|
|
31
|
-
| `@activeClass` | The classes to be added when the link is active | `string` \| `undefined` | |
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 3
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Edit this page
|
|
6
|
-
|
|
7
|
-
This is another example using `@fromCurrentURL`, but here we build a "edit this
|
|
8
|
-
page" link.
|
|
9
|
-
|
|
10
|
-
For this feature to work, Docfy must be able to find the repository URL. In
|
|
11
|
-
Ember apps, we extract that from the `package.json`, but you can configure the
|
|
12
|
-
repository URL as well as the branch to edit.
|
|
13
|
-
|
|
14
|
-
```hbs template
|
|
15
|
-
<DocfyOutput @fromCurrentURL={{true}} as |page|>
|
|
16
|
-
{{#if page.editUrl}}
|
|
17
|
-
<a href={{page.editUrl}}>
|
|
18
|
-
Click here to edit this page
|
|
19
|
-
</a>
|
|
20
|
-
{{/if}}
|
|
21
|
-
</DocfyOutput>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
For this to work, you need to include `repository` in your docfy-config:
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
// in your docfy-config.js
|
|
28
|
-
module.exports = {
|
|
29
|
-
repository: {
|
|
30
|
-
url: 'https://github.com/@username/repo-name',
|
|
31
|
-
editBranch: 'main',
|
|
32
|
-
},
|
|
33
|
-
...// rest of your config
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Enterprise (aka on premise) git services
|
|
39
|
-
|
|
40
|
-
`page.editUrl` works for Github, Bitbucket, Gitlab and Sourcehut.
|
|
41
|
-
|
|
42
|
-
For on-premise instances git solutions (i.e. on-premise Gitlab, or on-premise Bitbucket), we expose the `page.relativePath` so that you might construct your own custom editUrl:
|
|
43
|
-
|
|
44
|
-
```hbs
|
|
45
|
-
<DocfyOutput @fromCurrentURL={{true}} as |page|>
|
|
46
|
-
{{#if page.relativePath}}
|
|
47
|
-
<a href=(concat "http://some-enterpise.com/browse/" page.relativePath)
|
|
48
|
-
Click here to edit this page
|
|
49
|
-
</a>
|
|
50
|
-
{{/if}}
|
|
51
|
-
</DocfyOutput>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Note: the edit url for your on-premise instance might be more complex than the example above. But the `page.relativePath` will give you the relative path to that file in your repo.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 5
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Flat output
|
|
6
|
-
|
|
7
|
-
This option will return an array of `PageMetadata`. It will contain all the
|
|
8
|
-
pages in a flat array, one could render a list of all the pages without worrying
|
|
9
|
-
about the scope.
|
|
10
|
-
|
|
11
|
-
```hbs template
|
|
12
|
-
<DocfyOutput @type="flat" as |pages|>
|
|
13
|
-
<ul class="list-disc list-inside space-y-2">
|
|
14
|
-
{{#each pages as |page|}}
|
|
15
|
-
<li>
|
|
16
|
-
<DocfyLink @to={{page.url}}>
|
|
17
|
-
{{page.title}}
|
|
18
|
-
</DocfyLink>
|
|
19
|
-
</li>
|
|
20
|
-
{{/each}}
|
|
21
|
-
</ul>
|
|
22
|
-
</DocfyOutput>
|
|
23
|
-
```
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 2
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# On this page
|
|
6
|
-
|
|
7
|
-
In this example, we are using the option `@fromCurrentURL`. It tells the component
|
|
8
|
-
to search for the definition of the page that corresponds to the current URL.
|
|
9
|
-
We are then using the `headings` property, a data structure that represents a
|
|
10
|
-
Table of Content. The `headings` is a recursive data structure, meaning that you
|
|
11
|
-
can render their child for subheadings and their sub-subheadings. The depth of
|
|
12
|
-
headings available here is default to 6 but can be changed using the configuration
|
|
13
|
-
option `tocMaxDepth`.
|
|
14
|
-
|
|
15
|
-
```hbs template
|
|
16
|
-
<DocfyOutput @fromCurrentURL={{true}} as |page|>
|
|
17
|
-
<div class="mb-4 font-medium">
|
|
18
|
-
On this page:
|
|
19
|
-
</div>
|
|
20
|
-
<ul class="list-disc list-inside space-y-2">
|
|
21
|
-
{{#each page.headings as |heading|}}
|
|
22
|
-
<li>
|
|
23
|
-
<a href="#{{heading.id}}">
|
|
24
|
-
{{heading.title}}
|
|
25
|
-
</a>
|
|
26
|
-
</li>
|
|
27
|
-
{{/each}}
|
|
28
|
-
</ul>
|
|
29
|
-
</DocfyOutput>
|
|
30
|
-
```
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 1
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Sidebar Navigation
|
|
6
|
-
|
|
7
|
-
In this example, we are filtering the `NestedPageMetadata` by the scope name `docs`.
|
|
8
|
-
Then we use the yielded data to render pages, their children, and their children's
|
|
9
|
-
pages. Depending on how your documentation is structured, you might need to render
|
|
10
|
-
more deep into the tree or more shadow.
|
|
11
|
-
|
|
12
|
-
> You might have noticed that for this documentation site, we haven't rendered
|
|
13
|
-
> too deep into the tree to display all items.
|
|
14
|
-
|
|
15
|
-
```hbs template
|
|
16
|
-
<DocfyOutput @scope="docs" as |node|>
|
|
17
|
-
<ul class="list-disc list-inside space-y-2">
|
|
18
|
-
{{#each node.pages as |page|}}
|
|
19
|
-
<li>
|
|
20
|
-
<DocfyLink @to={{page.url}}>
|
|
21
|
-
{{page.title}}
|
|
22
|
-
</DocfyLink>
|
|
23
|
-
</li>
|
|
24
|
-
{{/each}}
|
|
25
|
-
|
|
26
|
-
{{#each node.children as |child|}}
|
|
27
|
-
<li class="block ml-4">
|
|
28
|
-
<div class="py-2">
|
|
29
|
-
{{child.label}}
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<ul class="list-disc list-inside space-y-2">
|
|
33
|
-
{{#each child.pages as |page|}}
|
|
34
|
-
<li>
|
|
35
|
-
<DocfyLink @to={{page.url}}>
|
|
36
|
-
{{page.title}}
|
|
37
|
-
</DocfyLink>
|
|
38
|
-
</li>
|
|
39
|
-
{{/each}}
|
|
40
|
-
</ul>
|
|
41
|
-
</li>
|
|
42
|
-
{{/each}}
|
|
43
|
-
</ul>
|
|
44
|
-
</DocfyOutput>
|
|
45
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 4
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Top Navigation
|
|
6
|
-
|
|
7
|
-
Here is another example that builds a top nav that could be used for the entire
|
|
8
|
-
application. It will link to any top-level pages as well as to the first page of
|
|
9
|
-
every child.
|
|
10
|
-
|
|
11
|
-
```hbs template
|
|
12
|
-
<DocfyOutput @type="nested" as |node|>
|
|
13
|
-
<ul>
|
|
14
|
-
{{#each node.pages as |page|}}
|
|
15
|
-
<li>
|
|
16
|
-
<DocfyLink @to={{page.url}}>
|
|
17
|
-
{{page.title}}
|
|
18
|
-
</DocfyLink>
|
|
19
|
-
</li>
|
|
20
|
-
{{/each}}
|
|
21
|
-
|
|
22
|
-
{{#each node.children as |child|}}
|
|
23
|
-
{{#let (get child.pages 0) as |page|}}
|
|
24
|
-
{{#if page}}
|
|
25
|
-
<li>
|
|
26
|
-
<DocfyLink @to={{page.url}}>
|
|
27
|
-
{{child.label}}
|
|
28
|
-
</DocfyLink>
|
|
29
|
-
</li>
|
|
30
|
-
{{/if}}
|
|
31
|
-
{{/let}}
|
|
32
|
-
{{/each}}
|
|
33
|
-
</ul>
|
|
34
|
-
</DocfyOutput>
|
|
35
|
-
```
|