@terafina/tffa-sfdx-plugin 1.0.3 → 1.0.6
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 +88 -9
- package/assets/clipboard.min.js +7 -0
- package/assets/clippy.svg +3 -0
- package/assets/favicon.png +0 -0
- package/assets/index.css +258 -187
- package/assets/index.js +306 -285
- package/assets/tf-logo.png +0 -0
- package/lib/commands/tffa/apexdoc.js +9 -9
- package/lib/commands/tffa/apexdoc.js.map +1 -1
- package/lib/commands/tffa/lint.d.ts +18 -0
- package/lib/commands/tffa/lint.js +59 -0
- package/lib/commands/tffa/lint.js.map +1 -0
- package/lib/commands/tffa/ping.js +1 -2
- package/lib/commands/tffa/ping.js.map +1 -1
- package/lib/{apexdoc → shared/apexdoc}/common/apex-docs-error.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/apex-docs-error.js +0 -0
- package/lib/shared/apexdoc/common/apex-docs-error.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/array-utils.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/array-utils.js +0 -0
- package/lib/shared/apexdoc/common/array-utils.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/line-reader.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/line-reader.js +0 -0
- package/lib/shared/apexdoc/common/line-reader.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/apex-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/apex-model.js +0 -0
- package/lib/shared/apexdoc/common/models/apex-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/class-group.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/class-group.js +0 -0
- package/lib/shared/apexdoc/common/models/class-group.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/class-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/class-model.js +0 -0
- package/lib/shared/apexdoc/common/models/class-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/engine-config.d.ts +7 -4
- package/lib/shared/apexdoc/common/models/engine-config.js +49 -0
- package/lib/shared/apexdoc/common/models/engine-config.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/enum-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/enum-model.js +0 -0
- package/lib/shared/apexdoc/common/models/enum-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/index.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/index.js +0 -0
- package/lib/shared/apexdoc/common/models/index.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/method-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/method-model.js +0 -0
- package/lib/shared/apexdoc/common/models/method-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/property-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/property-model.js +0 -0
- package/lib/shared/apexdoc/common/models/property-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/top-level-model.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/models/top-level-model.js +0 -0
- package/lib/shared/apexdoc/common/models/top-level-model.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/settings.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/settings.js +3 -0
- package/lib/shared/apexdoc/common/settings.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/tags.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/tags.js +0 -0
- package/lib/shared/apexdoc/common/tags.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/utils.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/utils.js +0 -0
- package/lib/shared/apexdoc/common/utils.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/validator-engine.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/validator-engine.js +0 -0
- package/lib/shared/apexdoc/common/validator-engine.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/common/validator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/common/validator.js +0 -0
- package/lib/shared/apexdoc/common/validator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/file-manager.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/file-manager.js +1 -1
- package/lib/shared/apexdoc/engine/file-manager.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/generator-utils.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/generator-utils.js +0 -0
- package/lib/shared/apexdoc/engine/generators/generator-utils.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/menu-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/menu-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/menu-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/child-enum-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/child-enum-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/child-enum-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/class-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/class-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/class-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/enum-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/enum-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/enum-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/method-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/method-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/method-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/property-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/property-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/property-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/source-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/source-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/source-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/top-level-markup-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/models/top-level-markup-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/models/top-level-markup-generator.js.map +1 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/see-link-generator.d.ts +0 -0
- package/lib/{apexdoc → shared/apexdoc}/engine/generators/see-link-generator.js +0 -0
- package/lib/shared/apexdoc/engine/generators/see-link-generator.js.map +1 -0
- package/lib/shared/lint/apex-class-scan.d.ts +32 -0
- package/lib/{commands/tffa/scan.js → shared/lint/apex-class-scan.js} +32 -123
- package/lib/shared/lint/apex-class-scan.js.map +1 -0
- package/lib/shared/lint/ignored-files.d.ts +9 -0
- package/lib/shared/lint/ignored-files.js +20 -0
- package/lib/shared/lint/ignored-files.js.map +1 -0
- package/lib/shared/lint/metadata-scan.d.ts +22 -0
- package/lib/shared/lint/metadata-scan.js +195 -0
- package/lib/shared/lint/metadata-scan.js.map +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/lib/apexdoc/common/apex-docs-error.js.map +0 -1
- package/lib/apexdoc/common/array-utils.js.map +0 -1
- package/lib/apexdoc/common/line-reader.js.map +0 -1
- package/lib/apexdoc/common/models/apex-model.js.map +0 -1
- package/lib/apexdoc/common/models/class-group.js.map +0 -1
- package/lib/apexdoc/common/models/class-model.js.map +0 -1
- package/lib/apexdoc/common/models/engine-config.js +0 -29
- package/lib/apexdoc/common/models/engine-config.js.map +0 -1
- package/lib/apexdoc/common/models/enum-model.js.map +0 -1
- package/lib/apexdoc/common/models/index.js.map +0 -1
- package/lib/apexdoc/common/models/method-model.js.map +0 -1
- package/lib/apexdoc/common/models/property-model.js.map +0 -1
- package/lib/apexdoc/common/models/top-level-model.js.map +0 -1
- package/lib/apexdoc/common/settings.js.map +0 -1
- package/lib/apexdoc/common/tags.js.map +0 -1
- package/lib/apexdoc/common/utils.js.map +0 -1
- package/lib/apexdoc/common/validator-engine.js.map +0 -1
- package/lib/apexdoc/common/validator.js.map +0 -1
- package/lib/apexdoc/engine/file-manager.js.map +0 -1
- package/lib/apexdoc/engine/generators/generator-utils.js.map +0 -1
- package/lib/apexdoc/engine/generators/menu-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/child-enum-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/class-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/enum-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/method-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/property-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/source-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/models/top-level-markup-generator.js.map +0 -1
- package/lib/apexdoc/engine/generators/see-link-generator.js.map +0 -1
- package/lib/commands/tffa/scan.d.ts +0 -52
- package/lib/commands/tffa/scan.js.map +0 -1
- package/lib/shared/model.d.ts +0 -30
- package/lib/shared/model.js +0 -17
- package/lib/shared/model.js.map +0 -1
- package/lib/shared/parser.d.ts +0 -3
- package/lib/shared/parser.js +0 -101
- package/lib/shared/parser.js.map +0 -1
- package/lib/shared/rules.d.ts +0 -3
- package/lib/shared/rules.js +0 -5
- package/lib/shared/rules.js.map +0 -1
package/assets/index.js
CHANGED
|
@@ -2,410 +2,431 @@
|
|
|
2
2
|
// #region Constants / DOM lifecycle hooks
|
|
3
3
|
// ==================================================================
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SEARCH_STATE_KEY = 'APEXDOX_SEARCH_RESULTS';
|
|
5
|
+
const SCOPES = ['global', 'public', 'private', 'protected', 'testMethod', 'webService'],
|
|
6
|
+
MENU_STATE_KEY = 'APEX_DOC_2_MENU',
|
|
7
|
+
ACTIVE_EL_STATE_KEY = 'APEX_DOC_2_ACTIVE_EL',
|
|
8
|
+
SCOPE_STATE_KEY = 'APEX_DOC_2_SCOPE',
|
|
9
|
+
SEARCH_STATE_KEY = 'APEX_DOC_2_SEARCH_RESULTS';
|
|
11
10
|
|
|
12
11
|
const highlightJsSelectors = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
'pre code',
|
|
13
|
+
'.method-annotations',
|
|
14
|
+
'.class-signature',
|
|
15
|
+
'.attribute-signature',
|
|
16
|
+
'.method-signature',
|
|
17
|
+
'.class-annotations',
|
|
18
|
+
'.prop-annotations'
|
|
20
19
|
];
|
|
21
20
|
|
|
22
21
|
const initializers = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
initMenu,
|
|
23
|
+
initHighlightJs,
|
|
24
|
+
renderMenuFromState,
|
|
25
|
+
setActiveElement,
|
|
26
|
+
renderSearchFromState,
|
|
27
|
+
readScope,
|
|
28
|
+
hideAllScopes,
|
|
29
|
+
showScopes
|
|
31
30
|
];
|
|
32
31
|
|
|
33
|
-
const persisters = [
|
|
34
|
-
persistMenuState,
|
|
35
|
-
persistActiveElement,
|
|
36
|
-
persistSearchState
|
|
37
|
-
];
|
|
32
|
+
const persisters = [persistMenuState, persistActiveElement, persistSearchState];
|
|
38
33
|
|
|
39
34
|
const executeAll = funcs => funcs.forEach(func => func());
|
|
40
35
|
|
|
41
36
|
document.addEventListener('DOMContentLoaded', () => {
|
|
42
|
-
|
|
37
|
+
executeAll(initializers);
|
|
43
38
|
});
|
|
44
39
|
|
|
45
40
|
window.onbeforeunload = () => {
|
|
46
|
-
|
|
47
|
-
}
|
|
41
|
+
executeAll(persisters);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var imported = document.createElement('script');
|
|
45
|
+
imported.src = './assets/clipboard.min.js';
|
|
46
|
+
imported.charset = 'UTF-8';
|
|
47
|
+
document.head.appendChild(imported);
|
|
48
|
+
|
|
49
|
+
imported.onload = function () {
|
|
50
|
+
var pre = document.getElementsByTagName('pre');
|
|
51
|
+
for (var i = 0; i < pre.length; i++) {
|
|
52
|
+
var button = document.createElement('button');
|
|
53
|
+
button.className = 'copy-button';
|
|
54
|
+
button.textContent = 'Copy';
|
|
55
|
+
pre[i].appendChild(button);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var copyCode = new ClipboardJS('.copy-button', {
|
|
59
|
+
target: function (trigger) {
|
|
60
|
+
return trigger.previousElementSibling;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
copyCode.on('success', function (event) {
|
|
64
|
+
event.clearSelection();
|
|
65
|
+
event.trigger.textContent = 'Copied';
|
|
66
|
+
window.setTimeout(function () {
|
|
67
|
+
event.trigger.textContent = 'Copy';
|
|
68
|
+
}, 2000);
|
|
69
|
+
});
|
|
70
|
+
copyCode.on('error', function (event) {
|
|
71
|
+
event.trigger.textContent = 'Press "Ctrl + C" to copy';
|
|
72
|
+
window.setTimeout(function () {
|
|
73
|
+
event.trigger.textContent = 'Copy';
|
|
74
|
+
}, 2000);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
48
77
|
|
|
49
78
|
// #endregion
|
|
50
79
|
// ==================================================================
|
|
51
80
|
|
|
52
|
-
|
|
53
81
|
// ==================================================================
|
|
54
82
|
// #region Initialization & Menu Utils, local state
|
|
55
83
|
// ==================================================================
|
|
56
84
|
|
|
57
85
|
function initHighlightJs() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
// initialize highlighting for code examples and
|
|
87
|
+
// signatures for methods, classes, props and enums
|
|
88
|
+
highlightJsSelectors.forEach(selector => {
|
|
89
|
+
document.querySelectorAll(selector).forEach(block => {
|
|
90
|
+
hljs.highlightElement(block);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
65
93
|
}
|
|
66
94
|
|
|
67
95
|
// create session storage object for menu state
|
|
68
96
|
// and/or update state with any new menu items
|
|
69
97
|
function initMenu() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
const hasState = sessionStorage.getItem(MENU_STATE_KEY);
|
|
99
|
+
let items = document.querySelectorAll('.group-name');
|
|
100
|
+
let state = !hasState ? {} : JSON.parse(hasState);
|
|
101
|
+
|
|
102
|
+
if (!hasState) {
|
|
103
|
+
// initialize menu state
|
|
104
|
+
|
|
105
|
+
items.forEach(item => (state[item.id] = false));
|
|
106
|
+
} else {
|
|
107
|
+
// If already init, add any new class groups since last load.
|
|
108
|
+
// should really only happen when docs are under development
|
|
109
|
+
updateMenuModel(items, state);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// finally, update sessionStorage with latest state
|
|
113
|
+
sessionStorage.setItem(MENU_STATE_KEY, JSON.stringify(state));
|
|
86
114
|
}
|
|
87
115
|
|
|
88
116
|
function updateMenuModel(items, state) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (newKeys.length > 0) {
|
|
114
|
-
newKeys.forEach(item => state[item.id] = item.isOpen === '' && true);
|
|
115
|
-
console.log('ApexDox: New menu keys found, adding to session storage:');
|
|
116
|
-
console.log(newKeys.map(function(g) { return g.id }));
|
|
117
|
-
}
|
|
117
|
+
// 1) get keys currently in state object
|
|
118
|
+
let keys = Object.keys(state);
|
|
119
|
+
|
|
120
|
+
// 2) get ids from each .group-name <details> element
|
|
121
|
+
let groups = Array.prototype.map.call(items, item => ({
|
|
122
|
+
id: item.id,
|
|
123
|
+
isOpen: item.getAttribute('open')
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
// 3) perform diff to get Ids not yet captured in storage
|
|
127
|
+
let deletedKeys = keys.filter(key => groups.findIndex(group => group.id === key) === -1);
|
|
128
|
+
|
|
129
|
+
let newKeys = groups.filter(item => keys.indexOf(item.id) === -1);
|
|
130
|
+
|
|
131
|
+
// 4) add/delete keys to/from state
|
|
132
|
+
if (deletedKeys.length > 0) {
|
|
133
|
+
deletedKeys.forEach(key => {
|
|
134
|
+
delete state[key];
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (newKeys.length > 0) {
|
|
139
|
+
newKeys.forEach(item => (state[item.id] = item.isOpen === '' && true));
|
|
140
|
+
}
|
|
118
141
|
}
|
|
119
142
|
|
|
120
143
|
function renderMenuFromState() {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
144
|
+
let state = JSON.parse(sessionStorage.getItem(MENU_STATE_KEY));
|
|
145
|
+
if (state) {
|
|
146
|
+
for (let group in state) {
|
|
147
|
+
let item = document.getElementById(group);
|
|
148
|
+
if (state[group]) {
|
|
149
|
+
item.setAttribute('open', '');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
131
153
|
}
|
|
132
154
|
|
|
133
155
|
// save menu state before each unload so that state is
|
|
134
156
|
// preserved when changing files or when reloading the page.
|
|
135
157
|
function persistMenuState() {
|
|
136
|
-
|
|
137
|
-
|
|
158
|
+
let items = document.querySelectorAll('.group-name');
|
|
159
|
+
let state = JSON.parse(sessionStorage.getItem(MENU_STATE_KEY));
|
|
138
160
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
161
|
+
items.forEach(item => {
|
|
162
|
+
let isOpen = item.getAttribute('open');
|
|
163
|
+
state[item.id] = isOpen === '' && true;
|
|
164
|
+
});
|
|
144
165
|
|
|
145
|
-
|
|
166
|
+
sessionStorage.setItem(MENU_STATE_KEY, JSON.stringify(state));
|
|
146
167
|
}
|
|
147
168
|
|
|
148
169
|
// preserve active menu item across loads
|
|
149
170
|
function persistActiveElement() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
171
|
+
let active = document.querySelector('.active');
|
|
172
|
+
if (active) {
|
|
173
|
+
sessionStorage.setItem(ACTIVE_EL_STATE_KEY, active.id);
|
|
174
|
+
} else {
|
|
175
|
+
sessionStorage.removeItem(ACTIVE_EL_STATE_KEY);
|
|
176
|
+
}
|
|
156
177
|
}
|
|
157
178
|
|
|
158
179
|
// set active element from storage
|
|
159
180
|
function setActiveElement() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
181
|
+
const id = sessionStorage.getItem(ACTIVE_EL_STATE_KEY);
|
|
182
|
+
if (id) {
|
|
183
|
+
var item = document.getElementById(id);
|
|
184
|
+
item.classList.add('active');
|
|
185
|
+
// focus element as well so tab
|
|
186
|
+
// navigation can pick up where it left off
|
|
187
|
+
if (item.firstElementChild && item.firstElementChild.tagName === 'A') {
|
|
188
|
+
item.firstElementChild.focus();
|
|
189
|
+
} else {
|
|
190
|
+
item.focus();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
172
193
|
}
|
|
173
194
|
|
|
174
195
|
// persist any search results across loads
|
|
175
196
|
function persistSearchState() {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
const searchTerm = document.querySelector('#search-input').value;
|
|
198
|
+
const resultsMarkup = document.querySelector('#search-results').innerHTML;
|
|
199
|
+
|
|
200
|
+
if (searchTerm.length > 1) {
|
|
201
|
+
const searchState = JSON.stringify({
|
|
202
|
+
searchTerm,
|
|
203
|
+
resultsMarkup
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
sessionStorage.setItem(SEARCH_STATE_KEY, searchState);
|
|
207
|
+
} else {
|
|
208
|
+
sessionStorage.removeItem(SEARCH_STATE_KEY);
|
|
209
|
+
}
|
|
189
210
|
}
|
|
190
211
|
|
|
191
212
|
// preserve active menu item across loads
|
|
192
213
|
function renderSearchFromState() {
|
|
193
|
-
|
|
214
|
+
const state = JSON.parse(sessionStorage.getItem(SEARCH_STATE_KEY));
|
|
194
215
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
216
|
+
if (state) {
|
|
217
|
+
const searchResults = document.querySelector('#search-results');
|
|
218
|
+
const searchInput = document.querySelector('#search-input');
|
|
198
219
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
220
|
+
searchInput.value = state.searchTerm;
|
|
221
|
+
searchResults.classList.add('visible');
|
|
222
|
+
searchResults.classList.add('no-transition');
|
|
223
|
+
searchResults.innerHTML = state.resultsMarkup;
|
|
203
224
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
// remove class which prevents transition on page move
|
|
226
|
+
setTimeout(() => searchResults.classList.remove('no-transition'), 100);
|
|
227
|
+
}
|
|
207
228
|
}
|
|
208
229
|
|
|
209
230
|
// #endregion
|
|
210
231
|
// ==================================================================
|
|
211
232
|
|
|
212
|
-
|
|
213
233
|
// ==================================================================
|
|
214
234
|
// #region Scope Utils
|
|
215
235
|
// ==================================================================
|
|
216
236
|
|
|
217
237
|
function getListScope() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
238
|
+
let list = [];
|
|
239
|
+
let checkboxes = document.querySelectorAll('input[type=checkbox]');
|
|
240
|
+
checkboxes.forEach(checkbox => {
|
|
241
|
+
if (checkbox.checked && checkbox.id !== 'cbx-all') {
|
|
242
|
+
let str = checkbox.id;
|
|
243
|
+
str = str.replace('cbx-', '');
|
|
244
|
+
list.push(str);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return list;
|
|
228
248
|
}
|
|
229
249
|
|
|
230
250
|
function showScopes() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
251
|
+
let list = getListScope();
|
|
252
|
+
for (let i = 0; i < list.length; i++) {
|
|
253
|
+
toggleScope(list[i], true);
|
|
254
|
+
}
|
|
235
255
|
}
|
|
236
256
|
|
|
237
257
|
function showAllScopes() {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
258
|
+
for (let i = 0; i < SCOPES.length; i++) {
|
|
259
|
+
toggleScope(SCOPES[i], true);
|
|
260
|
+
}
|
|
241
261
|
}
|
|
242
262
|
|
|
243
263
|
function hideAllScopes() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
264
|
+
for (let i = 0; i < SCOPES.length; i++) {
|
|
265
|
+
toggleScope(SCOPES[i], false);
|
|
266
|
+
}
|
|
247
267
|
}
|
|
248
268
|
|
|
249
269
|
function setScope() {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
270
|
+
const list = getListScope();
|
|
271
|
+
const scopes = list.join(',');
|
|
272
|
+
sessionStorage.setItem(SCOPE_STATE_KEY, scopes);
|
|
273
|
+
shouldCheckAll(list);
|
|
254
274
|
}
|
|
255
275
|
|
|
256
276
|
function readScope() {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
+
const strScope = getScope();
|
|
278
|
+
if (strScope != null && strScope != '') {
|
|
279
|
+
// first clear all the scope checkboxes
|
|
280
|
+
let checkboxes = document.querySelectorAll('input[type=checkbox]');
|
|
281
|
+
checkboxes.forEach(checkbox => checkbox.removeAttribute('checked'));
|
|
282
|
+
|
|
283
|
+
// now check the appropriate scope checkboxes
|
|
284
|
+
let list = strScope.split(',');
|
|
285
|
+
for (let i = 0; i < list.length; i++) {
|
|
286
|
+
let id = 'cbx-' + list[i];
|
|
287
|
+
let checkbox = document.getElementById(id);
|
|
288
|
+
checkbox.setAttribute('checked', true);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// check the all box if all scopes have are active
|
|
292
|
+
shouldCheckAll(list);
|
|
293
|
+
} else {
|
|
294
|
+
showAllScopes();
|
|
295
|
+
}
|
|
277
296
|
}
|
|
278
297
|
|
|
279
298
|
function getScope() {
|
|
280
|
-
|
|
281
|
-
|
|
299
|
+
const scope = sessionStorage.getItem(SCOPE_STATE_KEY);
|
|
300
|
+
return scope ? scope : '';
|
|
282
301
|
}
|
|
283
302
|
|
|
284
303
|
function shouldCheckAll(list) {
|
|
285
|
-
|
|
304
|
+
const checkboxes = document.querySelectorAll('input[type=checkbox]');
|
|
286
305
|
|
|
287
|
-
|
|
306
|
+
let allBox = document.getElementById('cbx-all');
|
|
288
307
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
308
|
+
if (checkboxes.length - 1 === list.length) {
|
|
309
|
+
allBox.setAttribute('checked', true);
|
|
310
|
+
} else {
|
|
311
|
+
allBox.removeAttribute('checked');
|
|
312
|
+
}
|
|
294
313
|
}
|
|
295
314
|
|
|
296
315
|
function toggleScope(scope, isShow) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
316
|
+
setScope();
|
|
317
|
+
toggleTypeScope(scope, '.properties', '.property', isShow);
|
|
318
|
+
toggleTypeScope(scope, '.enums', '.enum', isShow);
|
|
319
|
+
toggleTypeScope(scope, '.methods', '.method', isShow);
|
|
320
|
+
toggleTypeScope(scope, null, '.class', isShow);
|
|
302
321
|
}
|
|
303
322
|
|
|
304
323
|
function toggleTypeScope(scope, tableSelector, itemSelector, isShow) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
324
|
+
const tables = tableSelector ? document.querySelectorAll(tableSelector) : null;
|
|
325
|
+
const items = document.querySelectorAll(`${itemSelector}.${scope}`);
|
|
326
|
+
|
|
327
|
+
if (isShow === true) {
|
|
328
|
+
if (tables && items.length) {
|
|
329
|
+
// show tables if they've been hidden
|
|
330
|
+
toggleVisibility(tables, true);
|
|
331
|
+
}
|
|
332
|
+
toggleVisibility(items, true);
|
|
333
|
+
} else {
|
|
334
|
+
toggleVisibility(items, false);
|
|
335
|
+
maybeHideElement(tableSelector, itemSelector); // hide tables if all its rows have been hidden
|
|
336
|
+
}
|
|
317
337
|
}
|
|
318
338
|
|
|
319
339
|
function toggleVisibility(elements, isShow) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
340
|
+
for (let elem of elements) {
|
|
341
|
+
if (isShow) {
|
|
342
|
+
elem.classList.remove('hide');
|
|
343
|
+
} else {
|
|
344
|
+
elem.classList.add('hide');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
327
347
|
}
|
|
328
348
|
|
|
329
349
|
function maybeHideElement(toHide, itemSelector) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
350
|
+
let elements,
|
|
351
|
+
container = document.querySelectorAll(toHide);
|
|
352
|
+
if ((elements = document.querySelectorAll(itemSelector))) {
|
|
353
|
+
for (let element of elements) {
|
|
354
|
+
if (!element.classList.contains('hide')) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
toggleVisibility(container, false);
|
|
359
|
+
}
|
|
339
360
|
}
|
|
340
361
|
|
|
341
362
|
function toggleActiveClass(elem) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
363
|
+
// remove isActive from current active element
|
|
364
|
+
let item = document.querySelector('.active');
|
|
365
|
+
item && item.classList.remove('active');
|
|
345
366
|
|
|
346
|
-
|
|
347
|
-
|
|
367
|
+
// add to new active element
|
|
368
|
+
elem && elem.classList.add('active');
|
|
348
369
|
}
|
|
349
370
|
|
|
350
371
|
// #endregion
|
|
351
372
|
// ==================================================================
|
|
352
373
|
|
|
353
|
-
|
|
354
374
|
// ==================================================================
|
|
355
375
|
// #region Global Functions
|
|
356
376
|
// ==================================================================
|
|
357
377
|
|
|
358
|
-
window.goToLocation =
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
378
|
+
window.goToLocation = url => {
|
|
379
|
+
// prevent collapsing / expanding menu
|
|
380
|
+
// when clicking on Class Group link
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
|
|
383
|
+
if (event.currentTarget.classList.contains('nav-item')) {
|
|
384
|
+
toggleActiveClass(event.currentTarget);
|
|
385
|
+
} else {
|
|
386
|
+
const target = document.querySelector(`#item-${url.replace('.html', '')}`);
|
|
387
|
+
if (target) {
|
|
388
|
+
toggleActiveClass(target);
|
|
389
|
+
const details = document.querySelectorAll('details');
|
|
390
|
+
const parentDetail = target.parentNode.previousElementSibling.parentNode;
|
|
391
|
+
|
|
392
|
+
// when navigating from search, open target
|
|
393
|
+
// details element and close all the others.
|
|
394
|
+
for (let detail of details) {
|
|
395
|
+
if (detail !== parentDetail) {
|
|
396
|
+
detail.removeAttribute('open');
|
|
397
|
+
} else {
|
|
398
|
+
parentDetail.setAttribute('open', ''); // same as true
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
toggleActiveClass();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (document.location.href.toLowerCase().indexOf(url.toLowerCase()) === -1) {
|
|
407
|
+
document.location.href = url;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
window.toggleAllScopes = isShow => {
|
|
412
|
+
const checkboxes = document.querySelectorAll('input[type=checkbox]');
|
|
413
|
+
// NOTE: for some reason, just checking or un-checking the checkboxes
|
|
414
|
+
// via attribute and then using hideAllScopes or showAllScopes wasn't
|
|
415
|
+
// working as expected, use click() to trigger the onclick funcs instead.
|
|
416
|
+
checkboxes.forEach(checkbox => {
|
|
417
|
+
if (checkbox.id !== 'cbx-all') {
|
|
418
|
+
if (isShow && !checkbox.checked) {
|
|
419
|
+
checkbox.click();
|
|
420
|
+
} else if (!isShow && checkbox.checked) {
|
|
421
|
+
checkbox.click();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
};
|
|
405
426
|
|
|
406
427
|
window.toggleScope = (scope, isShow) => {
|
|
407
|
-
|
|
408
|
-
}
|
|
428
|
+
toggleScope(scope, isShow);
|
|
429
|
+
};
|
|
409
430
|
|
|
410
431
|
// #endregion
|
|
411
|
-
// ==================================================================
|
|
432
|
+
// ==================================================================
|