docs: better docs and types for the API (#7796)

* docs: fix type imports in openmct.js

* docs: fix type imports

* docs: fix types for eventHelpers

* docs: types for TypeRegistry

* docs: types for StatusAPI

* docs: fix ObjectAPI types and docs

* docs: more types

* docs: improved types for main entry

* docs: improved types

* fix: unbreak the linting

* chore: remove EventEmitter webpack alias as it hide types

* fix: return type

* fix: parameter type

* fix: types for composables

* chore: add webpack consts to eslintrc

* fix: remove usage of deprecated timeAPI methods and add a ton of docs and types

* docs: update README.md

* lint: clean up API.md

* chore: upgrade eventemitter to v5.0.2

* refactor: update imports for EventEmitter to remove alias

* format: lint

* docs: update types for Views and ViewProviders

* docs: expose common types at the base import level

* docs(types): remove unnecessary tsconfig options

* docs: ActionAPI

* docs: AnnotationAPI

* docs: import common types from the same origin

* docs: FormsAPI & TelemetryAPI types

* docs: FormController, IndicatorAPI

* docs: MenuAPI, ActionsAPI

* docs: `@memberof` is not supported by `tsc` and JSDoc generation so remove it

* docs: RootRegistry and RootObjectProvider

* docs: Transaction + Overlay

* lint: words for the word god

* fix: review comments
This commit is contained in:
Jesse Mazzella
2024-07-31 10:46:16 -07:00
committed by GitHub
parent e3fcbe1a35
commit 4ee68cccd6
117 changed files with 1494 additions and 1089 deletions

View File

@ -28,7 +28,6 @@
*
* For internal use by the mobile support bundle.
*
* @memberof src/plugins/DeviceClassifier
* @private
*/

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { markRaw } from 'vue';
export default class LADTableConfiguration extends EventEmitter {
constructor(domainObject, openmct) {

View File

@ -24,7 +24,7 @@ import { ACTIVITY_STATES_KEY } from './createActivityStatesIdentifier.js';
/**
* @typedef {Object} ActivityStatesInterceptorOptions
* @property {import('../../api/objects/ObjectAPI').Identifier} identifier the {namespace, key} to use for the activity states object.
* @property {import('openmct').Identifier} identifier the {namespace, key} to use for the activity states object.
* @property {string} name The name of the activity states model.
* @property {number} priority the priority of the interceptor. By default, it is low.
*/

View File

@ -21,7 +21,7 @@
*****************************************************************************/
// import BarGraph from './BarGraphPlot.vue';
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { v4 as uuid } from 'uuid';
import AllTelemetryCriterion from './criterion/AllTelemetryCriterion.js';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { v4 as uuid } from 'uuid';
import Condition from './Condition.js';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
export default class StyleRuleManager extends EventEmitter {
constructor(styleConfiguration, openmct, callback, suppressSubscriptionOnEdit) {

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import StalenessUtils from '@/utils/staleness';

View File

@ -45,7 +45,6 @@
* @param {number[]} dimFactor the dimensions factor
* @param {number[]} the size of each grid element, in pixels
* @constructor
* @memberof platform/features/layout
*/
export default function LayoutDrag(rawPosition, posFactor, dimFactor, gridSize) {
this.rawPosition = rawPosition;

View File

@ -108,7 +108,7 @@ class ExportAsJSONAction {
/**
* @private
* @param {import('../../api/objects/ObjectAPI').DomainObject} parent
* @param {import('openmct').DomainObject} parent
*/
async #write(parent) {
this.totalToExport++;

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -20,6 +20,9 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/**
* @type {EventHelpers}
*/
const helperFunctions = {
listenTo: function (object, event, callback, context) {
if (!this._listeningTo) {
@ -95,3 +98,8 @@ const helperFunctions = {
};
export default helperFunctions;
/**
* @typedef {Object} EventHelpers
* @property {(object: any, event: string, callback: Function, context?: any) => void} listenTo
* @property {(object: any, event?: string, callback?: Function, context?: any) => void} stopListening
*/

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
const LOCAL_STORAGE_KEY = 'mct-saved-styles';
const LIMIT = 20;

View File

@ -38,7 +38,6 @@ const DATE_FORMATS = [DATE_FORMAT, 'YYYY-MM-DD h:mm:ss a', 'YYYY-MM-DD h:mm a',
*
* @implements {Format}
* @constructor
* @memberof platform/commonUI/formats
*/
export default function LocalTimeFormat() {
this.key = 'local-format';

View File

@ -61,7 +61,7 @@ describe('The local time', () => {
});
it('can be set to be the main time system', () => {
expect(openmct.time.timeSystem().key).toBe(LOCAL_SYSTEM_KEY);
expect(openmct.time.getTimeSystem().key).toBe(LOCAL_SYSTEM_KEY);
});
it('uses the local-format time format', () => {

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { EVENT_SNAPSHOTS_UPDATED } from './notebook-constants.js';
const NOTEBOOK_SNAPSHOT_STORAGE = 'notebook-snapshot-storage';

View File

@ -27,7 +27,6 @@
* metadata field which contains a subset of information found
* in the model itself (to support search optimization with
* CouchDB views.)
* @memberof platform/persistence/couch
* @constructor
* @param {string} id the id under which to store this mode
* @param {Object} model the model to store

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
export const DEFAULT_CONFIGURATION = {
clipActivityNames: false,

View File

@ -77,7 +77,7 @@ export default {
inject: ['openmct'],
data() {
const selection = this.openmct.selection.get();
/** @type {import('../../../api/objects/ObjectAPI').DomainObject} */
/** @type {import('openmct').DomainObject} */
const domainObject = selection[0][0].context.item;
const planViewConfiguration = markRaw(new PlanViewConfiguration(domainObject, this.openmct));

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'eventemitter3';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
import eventHelpers from '../lib/eventHelpers.js';

View File

@ -126,7 +126,7 @@ export default class PlotConfigurationModel extends Model {
}
/**
* Retrieve the persisted series config for a given identifier.
* @param {import('./PlotSeries').Identifier} identifier
* @param {import('openmct').Identifier} identifier
* @returns {import('./PlotSeries').PlotSeriesModelType=}
*/
getPersistedSeriesConfig(identifier) {

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import eventHelpers from '../lib/eventHelpers.js';
import { MARKER_SHAPES } from './MarkerShapes.js';
@ -138,5 +138,4 @@ class Draw2D extends EventEmitter {
}
}
}
export default Draw2D;

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import eventHelpers from '../lib/eventHelpers.js';
import { MARKER_SHAPES } from './MarkerShapes.js';
@ -297,5 +297,4 @@ class DrawWebGL extends EventEmitter {
}
}
}
export default DrawWebGL;

View File

@ -19,8 +19,10 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*jscs:disable disallowDanglingUnderscores */
/**
* @type {EventHelpers}
*/
const helperFunctions = {
listenTo: function (object, event, callback, context) {
if (!this._listeningTo) {
@ -94,7 +96,7 @@ export default helperFunctions;
/**
@typedef {{
listenTo: (object: any, event: any, callback: any, context: any) => void
listenTo: (object: any, event: any, callback: any, context: any) => void,
stopListening: (object: any, event: any, callback: any, context: any) => void
}} EventHelpers
*/

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import mount from 'utils/mount';
import {
createMouseEvent,

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import mount from 'utils/mount';
import {
createMouseEvent,

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import mount from 'utils/mount';
import {
createMouseEvent,

View File

@ -87,6 +87,9 @@ import ViewDatumAction from './viewDatumAction/plugin.js';
import ViewLargeAction from './viewLargeAction/plugin.js';
import WebPagePlugin from './webPage/plugin.js';
/**
* @type {Object}
*/
const plugins = {};
plugins.example = {};

View File

@ -149,8 +149,6 @@ export default class RemoteClock extends DefaultClock {
/**
* Waits for the clock to have a non-default tick value.
*
* @private
*/
#waitForReady() {
const waitForInitialTick = (resolve) => {

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import * as templateHelpers from '../../../utils/template/templateHelpers.js';
import conditionTemplate from '../res/conditionTemplate.html';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
import { makeKeyString } from 'objectUtils';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
import * as templateHelpers from '../../../utils/template/templateHelpers.js';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import * as templateHelpers from '../../../utils/template/templateHelpers.js';
import itemTemplate from '../res/testDataItemTemplate.html';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import * as templateHelpers from '../../../utils/template/templateHelpers.js';
import ruleImageTemplate from '../res/ruleImageTemplate.html';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import * as templateHelpers from '../../../../utils/template/templateHelpers.js';
import paletteTemplate from '../../res/input/paletteTemplate.html';

View File

@ -1,4 +1,4 @@
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import * as templateHelpers from '../../../../utils/template/templateHelpers.js';
import selectTemplate from '../../res/input/selectTemplate.html';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -611,7 +611,7 @@ describe('The Mean Telemetry Provider', function () {
}
function createMockTimeApi() {
return jasmine.createSpyObj('timeApi', ['getTimeSystem']);
return jasmine.createSpyObj('timeApi', ['getTimeSystem', 'setTimeSystem']);
}
function setTimeSystemTo(timeSystemKey) {

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
import StalenessUtils from '../../utils/staleness.js';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
export default class TelemetryTableConfiguration extends EventEmitter {

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import _ from 'lodash';
/**

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { nextTick } from 'vue';
import { createOpenMct, resetApplicationState } from '@/utils/testing';

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
import { EventEmitter } from 'eventemitter3';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import { nextTick } from 'vue';

View File

@ -26,6 +26,7 @@ import StartTimerAction from './actions/StartTimerAction.js';
import StopTimerAction from './actions/StopTimerAction.js';
import TimerViewProvider from './TimerViewProvider.js';
/** @type {OpenMCTPlugin} */
export default function TimerPlugin() {
return function install(openmct) {
openmct.types.addType('timer', {

View File

@ -12,7 +12,6 @@ const DATE_FORMATS = [DATE_FORMAT];
*
* @implements {Format}
* @constructor
* @memberof platform/commonUI/formats
*/
class DurationFormat {
constructor() {

View File

@ -28,7 +28,6 @@ import moment from 'moment';
*
* @implements {Format}
* @constructor
* @memberof platform/commonUI/formats
*/
export default class UTCTimeFormat {
constructor() {