@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
import Service, { service } from '@ember/service';
|
|
3
|
+
import { cached } from '@glimmer/tracking';
|
|
4
|
+
import output from '@embroider/virtual/docfy/output';
|
|
5
|
+
import { g, i, n } from 'decorator-transforms/runtime';
|
|
6
|
+
|
|
7
|
+
function flatNested(output, pages = []) {
|
|
8
|
+
if (typeof output === 'undefined') {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
pages.push(...output.pages);
|
|
12
|
+
output.children.forEach(child => {
|
|
13
|
+
flatNested(child, pages);
|
|
14
|
+
});
|
|
15
|
+
return pages;
|
|
16
|
+
}
|
|
17
|
+
class DocfyService extends Service {
|
|
18
|
+
static {
|
|
19
|
+
g(this.prototype, "router", [service('router')]);
|
|
20
|
+
}
|
|
21
|
+
#router = (i(this, "router"), void 0);
|
|
22
|
+
get currentPage() {
|
|
23
|
+
const currentURL = this.router.currentURL;
|
|
24
|
+
return currentURL ? this.findByUrl(currentURL) : undefined;
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
n(this.prototype, "currentPage", [cached]);
|
|
28
|
+
}
|
|
29
|
+
get flat() {
|
|
30
|
+
return flatNested(this.nested);
|
|
31
|
+
}
|
|
32
|
+
get nested() {
|
|
33
|
+
return output.nested;
|
|
34
|
+
}
|
|
35
|
+
findNestedChildrenByName(scope, previousNested = null) {
|
|
36
|
+
if (previousNested === null) {
|
|
37
|
+
previousNested = this.nested;
|
|
38
|
+
}
|
|
39
|
+
const parts = scope.split('/');
|
|
40
|
+
const name = parts.shift();
|
|
41
|
+
const foundScope = previousNested?.children.find(item => {
|
|
42
|
+
return item.name === name;
|
|
43
|
+
});
|
|
44
|
+
if (parts.length > 0) {
|
|
45
|
+
return this.findNestedChildrenByName(parts.join('/'), foundScope);
|
|
46
|
+
}
|
|
47
|
+
return foundScope;
|
|
48
|
+
}
|
|
49
|
+
findByUrl(url, scopeByNestedName) {
|
|
50
|
+
let pages = this.flat;
|
|
51
|
+
if (typeof scopeByNestedName === 'string') {
|
|
52
|
+
pages = flatNested(this.findNestedChildrenByName(scopeByNestedName));
|
|
53
|
+
}
|
|
54
|
+
const cleanedUrl = url.split('#')[0] || '';
|
|
55
|
+
const finalUrl = cleanedUrl.replace(/\/$/, '');
|
|
56
|
+
return pages.find(item => {
|
|
57
|
+
return item.url === finalUrl || item.url === `${finalUrl}/`;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
previousPage(scopeByNestedName) {
|
|
61
|
+
return this.findPreviousOrNextPage(true, scopeByNestedName);
|
|
62
|
+
}
|
|
63
|
+
nextPage(scopeByNestedName) {
|
|
64
|
+
return this.findPreviousOrNextPage(false, scopeByNestedName);
|
|
65
|
+
}
|
|
66
|
+
findPreviousOrNextPage(isPrevious, scopeByNestedName) {
|
|
67
|
+
const currentPage = this.currentPage;
|
|
68
|
+
let pages = this.flat;
|
|
69
|
+
if (typeof scopeByNestedName === 'string') {
|
|
70
|
+
pages = flatNested(this.findNestedChildrenByName(scopeByNestedName));
|
|
71
|
+
}
|
|
72
|
+
const index = pages.findIndex(page => {
|
|
73
|
+
return page === currentPage;
|
|
74
|
+
});
|
|
75
|
+
if (index > -1) {
|
|
76
|
+
if (isPrevious) {
|
|
77
|
+
return pages[index - 1];
|
|
78
|
+
} else {
|
|
79
|
+
return pages[index + 1];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { DocfyService as default };
|
|
87
|
+
//# sourceMappingURL=docfy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docfy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,141 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docfy/ember",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "The default blueprint for Embroider v2 addons.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"ember-addon"
|
|
7
|
-
"prember-plugin"
|
|
6
|
+
"ember-addon"
|
|
8
7
|
],
|
|
9
|
-
"repository": "
|
|
8
|
+
"repository": "",
|
|
10
9
|
"license": "MIT",
|
|
11
|
-
"author": "
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
10
|
+
"author": "",
|
|
11
|
+
"files": [
|
|
12
|
+
"addon-main.cjs",
|
|
13
|
+
"declarations",
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"lint:hbs": "
|
|
22
|
-
"lint:
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"test:ember-compatibility": "echo 'ember try:each TODO'"
|
|
17
|
+
"build": "rollup --config",
|
|
18
|
+
"compile": "rollup --config",
|
|
19
|
+
"format": "prettier . --cache --write",
|
|
20
|
+
"format:check": "prettier . --cache --check",
|
|
21
|
+
"lint": "concurrently \"yarn:lint:js\" \"yarn:lint:hbs\" \"yarn:lint:types\" \"yarn:lint:format\" --names \"lint:\" --prefixColors auto",
|
|
22
|
+
"lint:fix": "concurrently \"yarn:lint:*:fix\" --names \"fix:\" --prefixColors auto && yarn format",
|
|
23
|
+
"lint:format": "prettier . --cache --check",
|
|
24
|
+
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
|
|
25
|
+
"lint:js": "eslint . --cache",
|
|
26
|
+
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
|
|
27
|
+
"lint:js:fix": "eslint . --fix",
|
|
28
|
+
"lint:types": "glint",
|
|
29
|
+
"prepack": "rollup --config"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"broccoli-funnel": "^3.0.8",
|
|
37
|
-
"broccoli-merge-trees": "^4.2.0",
|
|
38
|
-
"broccoli-node-api": "^1.7.0",
|
|
39
|
-
"broccoli-plugin": "^4.0.7",
|
|
40
|
-
"broccoli-source": "^3.0.1",
|
|
41
|
-
"calculate-cache-key-for-tree": "2.0.0",
|
|
42
|
-
"debug": "^4.3.3",
|
|
43
|
-
"ember-cli-babel": "^8.2.0",
|
|
44
|
-
"ember-cli-htmlbars": "^6.3.0",
|
|
45
|
-
"ember-cli-typescript": "^4.2.1",
|
|
46
|
-
"ember-get-config": "^1.0.2",
|
|
47
|
-
"mdast-util-to-string": "^2.0.0",
|
|
48
|
-
"remark-hbs": "^0.4.1",
|
|
49
|
-
"unist-builder": "^2.0.3",
|
|
50
|
-
"unist-util-find": "^1.0.2",
|
|
51
|
-
"unist-util-visit": "^2.0.2"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@babel/helper-define-map": "^7.16.7",
|
|
55
|
-
"@docfy/plugin-with-prose": "^0.9.0",
|
|
56
|
-
"@ember/optional-features": "^2.0.0",
|
|
57
|
-
"@ember/test-helpers": "^2.6.0",
|
|
58
|
-
"@embroider/compat": "^1.0.0",
|
|
59
|
-
"@embroider/core": "^1.0.0",
|
|
60
|
-
"@embroider/webpack": "^1.0.0",
|
|
61
|
-
"@glimmer/component": "^1.0.4",
|
|
62
|
-
"@glimmer/tracking": "^1.0.4",
|
|
63
|
-
"@mapbox/rehype-prism": "^0.5.0",
|
|
64
|
-
"@tailwindcss/typography": "^0.4.0",
|
|
65
|
-
"@types/ember-qunit": "^5.0.0",
|
|
66
|
-
"@types/ember-resolver": "^5.0.11",
|
|
67
|
-
"@types/ember__application": "^4.0.0",
|
|
68
|
-
"@types/ember__array": "^4.0.1",
|
|
69
|
-
"@types/ember__component": "^4.0.1",
|
|
70
|
-
"@types/ember__debug": "^4.0.0",
|
|
71
|
-
"@types/ember__error": "^4.0.0",
|
|
72
|
-
"@types/ember__object": "^4.0.0",
|
|
73
|
-
"@types/ember__routing": "^4.0.2",
|
|
74
|
-
"@types/ember__runloop": "^4.0.0",
|
|
75
|
-
"@types/ember__service": "^4.0.0",
|
|
76
|
-
"@types/ember__string": "^3.0.9",
|
|
77
|
-
"@types/ember__template": "^4.0.0",
|
|
78
|
-
"@types/ember__test": "^4.0.0",
|
|
79
|
-
"@types/ember__test-helpers": "^2.6.1",
|
|
80
|
-
"@types/htmlbars-inline-precompile": "^3.0.0",
|
|
81
|
-
"@types/qunit": "^2.11.3",
|
|
82
|
-
"@types/rsvp": "^4.0.4",
|
|
83
|
-
"@types/sinon": "^9.0.10",
|
|
84
|
-
"autoprefixer": "^10.4.2",
|
|
85
|
-
"broccoli-asset-rev": "^3.0.0",
|
|
86
|
-
"ember-auto-import": "^2.4.0",
|
|
87
|
-
"ember-cli": "~4.1.1",
|
|
88
|
-
"ember-cli-babel": "8.2.0",
|
|
89
|
-
"ember-cli-dependency-checker": "^3.2.0",
|
|
90
|
-
"ember-cli-fastboot": "^3.2.0-beta.5",
|
|
91
|
-
"ember-cli-fastboot-testing": "^0.6.0",
|
|
92
|
-
"ember-cli-inject-live-reload": "^2.1.0",
|
|
93
|
-
"ember-cli-postcss": "^8.0.0",
|
|
94
|
-
"ember-cli-sri": "^2.1.1",
|
|
95
|
-
"ember-cli-typescript-blueprints": "^3.0.0",
|
|
96
|
-
"ember-cli-uglify": "^3.0.0",
|
|
97
|
-
"ember-disable-prototype-extensions": "^1.1.3",
|
|
98
|
-
"ember-export-application-global": "^2.0.1",
|
|
99
|
-
"ember-load-initializers": "^2.1.2",
|
|
100
|
-
"ember-maybe-import-regenerator": "^1.0.0",
|
|
101
|
-
"ember-qunit": "^5.1.5",
|
|
102
|
-
"ember-resolver": "^8.0.3",
|
|
103
|
-
"ember-router-helpers": "^0.4.0",
|
|
104
|
-
"ember-sinon": "^5.0.0",
|
|
105
|
-
"ember-source": "~4.1.0",
|
|
106
|
-
"ember-source-channel-url": "^3.0.0",
|
|
107
|
-
"ember-template-imports": "^4.0.0",
|
|
108
|
-
"ember-template-lint": "^2.18.0",
|
|
109
|
-
"ember-try": "^2.0.0",
|
|
110
|
-
"loader.js": "^4.7.0",
|
|
111
|
-
"npm-run-all": "^4.1.5",
|
|
112
|
-
"postcss-import": "^14.0.2",
|
|
113
|
-
"postcss-nested": "^5.0.6",
|
|
114
|
-
"prember": "^1.1.0",
|
|
115
|
-
"qunit": "^2.17.2",
|
|
116
|
-
"qunit-dom": "^2.0.0",
|
|
117
|
-
"refractor": "^3.0.0",
|
|
118
|
-
"remark-autolink-headings": "^6.0.0",
|
|
119
|
-
"remark-code-import": "^0.2.0",
|
|
120
|
-
"tailwindcss": "^2.0.2",
|
|
121
|
-
"typescript": "^4.1.3",
|
|
122
|
-
"webpack": "^5.67.0"
|
|
32
|
+
"@embroider/addon-shim": "^1.8.9",
|
|
33
|
+
"@embroider/macros": "^1.18.0",
|
|
34
|
+
"decorator-transforms": "^2.3.0"
|
|
123
35
|
},
|
|
124
|
-
"
|
|
125
|
-
"
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"ember-source": ">= 4.12.0"
|
|
126
38
|
},
|
|
127
|
-
"
|
|
128
|
-
"
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/core": "^7.25.2",
|
|
41
|
+
"@babel/eslint-parser": "^7.25.1",
|
|
42
|
+
"@babel/plugin-transform-typescript": "^7.25.2",
|
|
43
|
+
"@babel/runtime": "^7.25.6",
|
|
44
|
+
"@ember/library-tsconfig": "^1.0.0",
|
|
45
|
+
"@embroider/addon-dev": "^8.1.0",
|
|
46
|
+
"@eslint/js": "^9.17.0",
|
|
47
|
+
"@glimmer/component": "^2.0.0",
|
|
48
|
+
"@glint/core": "1.5.2",
|
|
49
|
+
"@glint/environment-ember-loose": "1.5.2",
|
|
50
|
+
"@glint/environment-ember-template-imports": "1.5.2",
|
|
51
|
+
"@glint/template": "1.5.2",
|
|
52
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
53
|
+
"@types/qunit": "^2.19.12",
|
|
54
|
+
"babel-plugin-ember-template-compilation": "^3.0.0",
|
|
55
|
+
"concurrently": "^9.0.1",
|
|
56
|
+
"ember-source": "^6.3.0",
|
|
57
|
+
"ember-template-lint": "^7.9.0",
|
|
58
|
+
"eslint": "^9.17.0",
|
|
59
|
+
"eslint-config-prettier": "^10.1.5",
|
|
60
|
+
"eslint-plugin-ember": "^12.3.3",
|
|
61
|
+
"eslint-plugin-import": "^2.31.0",
|
|
62
|
+
"eslint-plugin-n": "^17.15.1",
|
|
63
|
+
"globals": "^16.1.0",
|
|
64
|
+
"prettier": "^3.4.2",
|
|
65
|
+
"prettier-plugin-ember-template-tag": "^2.0.4",
|
|
66
|
+
"rollup": "^4.22.5",
|
|
67
|
+
"typescript": "~5.8.3",
|
|
68
|
+
"typescript-eslint": "^8.19.1"
|
|
129
69
|
},
|
|
130
70
|
"ember": {
|
|
131
71
|
"edition": "octane"
|
|
132
72
|
},
|
|
133
73
|
"ember-addon": {
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
74
|
+
"version": 2,
|
|
75
|
+
"type": "addon",
|
|
76
|
+
"main": "addon-main.cjs",
|
|
77
|
+
"app-js": {
|
|
78
|
+
"./components/docfy-demo.js": "./dist/_app_/components/docfy-demo.js",
|
|
79
|
+
"./components/docfy-link.js": "./dist/_app_/components/docfy-link.js",
|
|
80
|
+
"./components/docfy-output.js": "./dist/_app_/components/docfy-output.js",
|
|
81
|
+
"./components/docfy-previous-and-next-page.js": "./dist/_app_/components/docfy-previous-and-next-page.js",
|
|
82
|
+
"./services/docfy.js": "./dist/_app_/services/docfy.js"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"imports": {
|
|
86
|
+
"#src/*": "./src/*"
|
|
87
|
+
},
|
|
88
|
+
"exports": {
|
|
89
|
+
".": {
|
|
90
|
+
"types": "./declarations/index.d.ts",
|
|
91
|
+
"default": "./dist/index.js"
|
|
92
|
+
},
|
|
93
|
+
"./*.css": "./dist/*.css",
|
|
94
|
+
"./*": {
|
|
95
|
+
"types": "./declarations/*.d.ts",
|
|
96
|
+
"default": "./dist/*.js"
|
|
97
|
+
},
|
|
98
|
+
"./addon-main.js": "./addon-main.cjs"
|
|
99
|
+
},
|
|
100
|
+
"typesVersions": {
|
|
101
|
+
"*": {
|
|
102
|
+
"*": [
|
|
103
|
+
"declarations/*"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
139
106
|
},
|
|
140
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "02bfa7220969ce5585709d43ffaa5c8b3f9c1819"
|
|
141
108
|
}
|
package/.docfy-config.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const autolinkHeadings = require('remark-autolink-headings');
|
|
3
|
-
const prism = require('@mapbox/rehype-prism');
|
|
4
|
-
const refractor = require('refractor');
|
|
5
|
-
const docfyWithProse = require('@docfy/plugin-with-prose');
|
|
6
|
-
|
|
7
|
-
refractor.alias('handlebars', 'hbs');
|
|
8
|
-
refractor.alias('shell', 'sh');
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
remarkHbsOptions: {
|
|
12
|
-
escapeCurliesCode: false
|
|
13
|
-
},
|
|
14
|
-
remarkPlugins: [
|
|
15
|
-
[
|
|
16
|
-
autolinkHeadings,
|
|
17
|
-
{
|
|
18
|
-
behavior: 'wrap'
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
],
|
|
22
|
-
plugins: [docfyWithProse],
|
|
23
|
-
rehypePlugins: [() => [prism, { alias: { gts: 'ts', gjs: 'js' } }]],
|
|
24
|
-
sources: [
|
|
25
|
-
{
|
|
26
|
-
root: path.join(__dirname, 'dummy-docs'),
|
|
27
|
-
pattern: '**/*.md',
|
|
28
|
-
urlSchema: 'manual',
|
|
29
|
-
urlPrefix: 'docs'
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
labels: {
|
|
33
|
-
components: 'Components',
|
|
34
|
-
plugins: 'Plugins',
|
|
35
|
-
helpers: 'Helpers',
|
|
36
|
-
core: '@docfy/core',
|
|
37
|
-
ember: '@docfy/ember',
|
|
38
|
-
docs: 'Documentation'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NestedPageMetadata, PageMetadata } from '@docfy/core/lib/types';
|
|
2
|
-
import flatNested from './flat-nested';
|
|
3
|
-
|
|
4
|
-
export default function findPreviousOrNextPage(
|
|
5
|
-
url: string,
|
|
6
|
-
isPrevious: boolean,
|
|
7
|
-
nested: NestedPageMetadata
|
|
8
|
-
): PageMetadata | undefined {
|
|
9
|
-
const flat = flatNested(nested);
|
|
10
|
-
const index = flat.findIndex((page) => {
|
|
11
|
-
return page.url === url || page.url === `${url}/`;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
if (index > -1) {
|
|
15
|
-
if (isPrevious) {
|
|
16
|
-
return flat[index - 1];
|
|
17
|
-
} else {
|
|
18
|
-
return flat[index + 1];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NestedPageMetadata, PageMetadata } from '@docfy/core/lib/types';
|
|
2
|
-
|
|
3
|
-
export default function flatNested(
|
|
4
|
-
output?: NestedPageMetadata,
|
|
5
|
-
pages: PageMetadata[] = []
|
|
6
|
-
): PageMetadata[] {
|
|
7
|
-
if (typeof output === 'undefined') {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
pages.push(...output.pages);
|
|
12
|
-
|
|
13
|
-
output.children.forEach((child) => {
|
|
14
|
-
flatNested(child, pages);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return pages;
|
|
18
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<div class="docfy-demo__description" ...attributes>
|
|
2
|
-
<div class="docfy-demo__description__header">
|
|
3
|
-
{{#if @title}}
|
|
4
|
-
<h3 class="docfy-demo__description__header__title">
|
|
5
|
-
<a href="#{{@id}}">
|
|
6
|
-
<span class="icon icon-link"></span>
|
|
7
|
-
</a>
|
|
8
|
-
{{@title}}
|
|
9
|
-
</h3>
|
|
10
|
-
{{/if}}
|
|
11
|
-
{{#if @editUrl}}
|
|
12
|
-
<a
|
|
13
|
-
href="{{@editUrl}}"
|
|
14
|
-
target="_blank"
|
|
15
|
-
rel="noopener noreferrer"
|
|
16
|
-
class="docfy-demo__description__header__edit-url"
|
|
17
|
-
>
|
|
18
|
-
Edit this demo
|
|
19
|
-
</a>
|
|
20
|
-
{{/if}}
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div class="docfy-demo__description__content">
|
|
24
|
-
{{yield}}
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { guidFor } from '@ember/object/internals';
|
|
3
|
-
import { SnippetRegisterArgs } from './snippets';
|
|
4
|
-
|
|
5
|
-
interface DocfyDemoSnippetArgs {
|
|
6
|
-
name: string;
|
|
7
|
-
active: string;
|
|
8
|
-
registerSnippet: (snippet: SnippetRegisterArgs) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default class DocfyDemoSnippet extends Component<DocfyDemoSnippetArgs> {
|
|
12
|
-
id = guidFor(this);
|
|
13
|
-
|
|
14
|
-
constructor(owner: unknown, args: DocfyDemoSnippetArgs) {
|
|
15
|
-
super(owner, args);
|
|
16
|
-
|
|
17
|
-
if (typeof this.args.registerSnippet === 'function') {
|
|
18
|
-
let name = this.args.name || '';
|
|
19
|
-
name = name.charAt(0).toUpperCase() + name.slice(1);
|
|
20
|
-
|
|
21
|
-
this.args.registerSnippet({
|
|
22
|
-
id: this.id,
|
|
23
|
-
name
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get isActive(): boolean {
|
|
29
|
-
if (typeof this.args.registerSnippet !== 'function') {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return this.id === this.args.active;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<div class="docfy-demo__snippets">
|
|
2
|
-
<div class="docfy-demo__snippets__tabs">
|
|
3
|
-
{{#each this.snippets as |snippet|}}
|
|
4
|
-
<button
|
|
5
|
-
type="button"
|
|
6
|
-
class="docfy-demo__snippets__tabs__button {{
|
|
7
|
-
if
|
|
8
|
-
(docfy-eq this.active snippet.id)
|
|
9
|
-
"docfy-demo__snippets__tabs__button--active"
|
|
10
|
-
}}"
|
|
11
|
-
{{on "click" (fn this.setActiveSnippet snippet.id)}}
|
|
12
|
-
>
|
|
13
|
-
{{snippet.name}}
|
|
14
|
-
</button>
|
|
15
|
-
{{/each}}
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
{{yield
|
|
19
|
-
(component
|
|
20
|
-
"docfy-demo/snippet"
|
|
21
|
-
registerSnippet=this.registerSnippet
|
|
22
|
-
active=this.active
|
|
23
|
-
)
|
|
24
|
-
}}
|
|
25
|
-
</div>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import { schedule } from '@ember/runloop';
|
|
5
|
-
|
|
6
|
-
export interface SnippetRegisterArgs {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default class DocfyDemoSnippets extends Component {
|
|
12
|
-
@tracked snippets: SnippetRegisterArgs[] = [];
|
|
13
|
-
@tracked active?: string;
|
|
14
|
-
|
|
15
|
-
@action registerSnippet(snippet: SnippetRegisterArgs): void {
|
|
16
|
-
schedule('render', this, () => {
|
|
17
|
-
this.snippets = [...this.snippets, snippet];
|
|
18
|
-
if (!this.active) {
|
|
19
|
-
this.active = snippet.id;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@action setActiveSnippet(id: string): void {
|
|
25
|
-
this.active = id;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<div id={{@id}} class="docfy-demo" ...attributes>
|
|
2
|
-
{{yield
|
|
3
|
-
(hash
|
|
4
|
-
Example=(component "docfy-demo/example")
|
|
5
|
-
Description=(component "docfy-demo/description" id=@id)
|
|
6
|
-
Snippet=(component "docfy-demo/snippet")
|
|
7
|
-
Snippets=(component "docfy-demo/snippets")
|
|
8
|
-
)
|
|
9
|
-
}}
|
|
10
|
-
</div>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { inject as service } from '@ember/service';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import RouterService from '@ember/routing/router-service';
|
|
5
|
-
import config from 'ember-get-config';
|
|
6
|
-
|
|
7
|
-
interface DocfyLinkArgs {
|
|
8
|
-
to: string;
|
|
9
|
-
anchor?: string;
|
|
10
|
-
activeClass?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default class DocfyLink extends Component<DocfyLinkArgs> {
|
|
14
|
-
@service router!: RouterService;
|
|
15
|
-
|
|
16
|
-
get routeName(): string {
|
|
17
|
-
let { to } = this.args;
|
|
18
|
-
|
|
19
|
-
if (config.rootURL && config.rootURL !== '/') {
|
|
20
|
-
to = to.replace(/^\//, config.rootURL);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return (this.router as any).recognize(to)?.name; // eslint-disable-line
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get href(): string {
|
|
27
|
-
let url = this.args.to;
|
|
28
|
-
if (this.routeName) {
|
|
29
|
-
url = this.router.urlFor(this.routeName);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (this.args.anchor) {
|
|
33
|
-
return `${url}#${this.args.anchor}`;
|
|
34
|
-
} else {
|
|
35
|
-
return url;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get isActive(): boolean {
|
|
40
|
-
return this.router.currentRouteName === this.routeName;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@action
|
|
44
|
-
navigate(event: MouseEvent): void {
|
|
45
|
-
if (event.ctrlKey || event.metaKey) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (this.routeName && !this.args.anchor) {
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
this.router.transitionTo(this.routeName);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{{yield this.output}}
|