Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Adapt JSDocs for new CЕM and Remove Redundancies #7829

Closed
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
04271de
docs: generate cem
Sep 20, 2023
ce8470f
chore: cleanup
Sep 20, 2023
53558c0
chore: migrate button
Sep 26, 2023
34fa365
chore: generate manifest for base
Sep 26, 2023
4271fab
chore: cleanup
Sep 26, 2023
2c02ab8
Merge remote-tracking branch 'origin/main' into new-cem
vladitasev Oct 4, 2023
91ba52e
chore: enhance
Oct 3, 2023
d9d58c4
chore: align storybook to use cem
Oct 9, 2023
7387bcc
chore: 09/10
Oct 9, 2023
96fdd35
chore: 10.10
Oct 10, 2023
cb0517b
chore: add validator for manifest
Oct 11, 2023
feae7c7
chore: add valid jsdoc tags
Oct 11, 2023
9c36b48
chore: improve validators
Oct 12, 2023
9c59c34
chore: migrate samples prepare to storybook
Oct 13, 2023
7ad3425
chore: ts
Oct 16, 2023
beb9d97
chore: fix missing tags
Oct 17, 2023
a7784a9
Merge branch 'main' into new-cem
Oct 17, 2023
161857c
chore: clean
Oct 17, 2023
19f59fb
chore: correct deps
Oct 17, 2023
7872477
chore: fix scripts
Oct 17, 2023
1a12b35
chore: validate tags
Oct 17, 2023
fa487fc
chore: optional execution of script
Oct 17, 2023
a1f7f14
chore: sampels docs
Oct 17, 2023
4394906
chore: restore previous scripts and enable cem for base
Oct 17, 2023
05b188f
chore: fix validation of @default
Oct 17, 2023
31ce716
chore: fix storybook build
Oct 17, 2023
2550a0b
chore: fix schema and add missing tags
Oct 18, 2023
38f4cce
Merge remote-tracking branch 'origin' into new-cem
Oct 19, 2023
6fa80f9
chore: restore bundle
Oct 19, 2023
a28e5f5
chore: add param type
Oct 19, 2023
5b5793d
Merge remote-tracking branch 'origin' into new-cem
Oct 19, 2023
3b2708a
chore: generate new manifest
Oct 20, 2023
b7ba762
fix: chore description
Oct 20, 2023
3923f9b
fix: param / unnamed slots privacy
Oct 20, 2023
0ebecca
chore: show css parts
Oct 23, 2023
00e28cb
chore: extract storybook
Oct 23, 2023
99bbfe3
chore: restore nps script
Oct 23, 2023
c60651c
chore: restore component migration
Oct 23, 2023
4483b88
Merge remote-tracking branch 'origin' into new-cem
Oct 23, 2023
61d9625
fix: default value
Oct 23, 2023
e9ed3e2
fix: enum schema validation
Oct 25, 2023
7d71521
fix: show interfaces
Oct 27, 2023
64f15d0
fix: ts files path
Oct 31, 2023
962816c
Merge remote-tracking branch 'origin' into new-cem
Nov 7, 2023
ab8d01b
docs: Adapt JSDocs for new CЕM and Remove Redundancies
NHristov-sap Nov 9, 2023
2582ea8
chore: refacotor, fix validation, add internal json
Nov 10, 2023
ec5d441
docs: fix merge conflict
NHristov-sap Nov 10, 2023
ecfa2bc
chore: update schema and validation
Nov 10, 2023
99e04af
Merge remote-tracking branch 'origin' into new-cem
Nov 10, 2023
1bdc15a
chore: add yarnlock
Nov 10, 2023
e10177e
Merge remote-tracking branch 'origin' into new-cem
Nov 10, 2023
cd086e3
chore: fix event param types
Nov 10, 2023
94a3f1d
fix: show event params
Nov 13, 2023
a0badba
fix: display only public ones
Nov 13, 2023
1484baf
chore: restore input paths
Nov 13, 2023
b7f91c0
Merge branch 'main' into BL_doc_change
NHristov-sap Nov 14, 2023
30308d2
Merge remote-tracking branch 'origin' into new-cem
Nov 14, 2023
22e0cac
chore: refactor
Nov 14, 2023
24039b5
chore: update schema
Nov 14, 2023
aadf607
chore: restore paths
Nov 14, 2023
4f8a400
docs: adapt docs to updated specs
NHristov-sap Nov 14, 2023
8ba84e9
docs: fix storybook errors
NHristov-sap Nov 15, 2023
ed08e7e
docs: add missing file
NHristov-sap Nov 15, 2023
621fb6c
docs: update interfaces
NHristov-sap Nov 16, 2023
231da31
Merge remote-tracking branch 'origin' into new-cem
Nov 20, 2023
c1965f5
chore: add override for getters, methods, props
Nov 20, 2023
a332a43
docs: fix comments
NHristov-sap Nov 21, 2023
7a3954f
docs: new cem for Topic-P components - Icon (#7810)
plamenivanov91 Nov 21, 2023
29ddd0b
Merge remote-tracking branch 'origin/main' into new-cem
Nov 21, 2023
8d79551
docs: new cem for Topic-P components - ShellBar (#7823)
plamenivanov91 Nov 21, 2023
af54a8c
Merge remote-tracking branch 'origin/new-cem' into new-cem
Nov 21, 2023
20ba50e
chore: add privacy for shellbar events
Nov 21, 2023
f895ef2
docs: fix more comments
NHristov-sap Nov 21, 2023
f843671
Merge branch 'main' into BL_doc_change
NHristov-sap Nov 21, 2023
d8de813
chore: ehnance validator
Nov 22, 2023
b675009
docs: another comments fix
NHristov-sap Nov 23, 2023
04598ad
chore: add storybook
Nov 23, 2023
ccb2eee
Merge branch 'BL_doc_change' of https://github.com/SAP/ui5-webcompone…
NHristov-sap Nov 23, 2023
0d84bbd
chore: migrate base package
Nov 23, 2023
75e62dd
chore: add correct export definition
Nov 26, 2023
61a24c2
Merge remote-tracking branch 'origin/main' into new-cem
Nov 26, 2023
531ed44
docs(ui5-rating-indicator): improve documentation (#7915)
niyap Nov 27, 2023
5f1a3f4
Merge remote-tracking branch 'origin/new-cem' into new-cem
Nov 27, 2023
3f9a02b
docs: fix more comments
NHristov-sap Nov 27, 2023
28b726b
docs(ui5-textarea): improve documentation (#7913)
niyap Nov 27, 2023
92ab975
chore: fix some components values and make storybook to work
Nov 27, 2023
0032fa6
docs(ui5-slider, ui5-range-slider): enhance documentation (#7910)
niyap Nov 27, 2023
3dabefe
chore: cleanup
Nov 27, 2023
1c71230
docs: new cem for Topic-P components - Toolbar (#7814)
plamenivanov91 Nov 28, 2023
eb847ea
docs: new cem for Topic-P components - List (#7824)
plamenivanov91 Nov 28, 2023
9d6ae8d
chore: fulfill list
Nov 28, 2023
b3eb83f
Merge branch 'new-cem' into BL_doc_change
NHristov-sap Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/6-contributing/04-writing-samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The above example includes only the `indeterminate`, `checked` properties in the


## Documentation
The documentation for each component is automatically produced using the `custom-elements.json` file. Additionally, there is an `argTypes.ts` file located beside each `.stories.ts` file. It is generated during build time and contains extra properties that enhance the documentation beyond what is available in the `custom-elements.json` file. This file should not be edited directly, as it can only be modified by the `packages/playground/build-scripts-storybook/samples-prepare.js` script.
The documentation for each component is automatically produced using the `custom-elements.json` file. Additionally, there is an `argTypes.ts` file located beside each `.stories.ts` file. It is generated during build time and contains extra properties that enhance the documentation beyond what is available in the `custom-elements.json` file. This file should not be edited directly, as it can only be modified by the `packages/playground/build-scripts-storybook/samples-prepare.ts` script.

### Docs page
Every story has a `docs` page in the storybook's sidebar. Usually, this page is generated automatically by storybook but it can be customized by adding a `docs` property to the story parameters.
Expand Down
2 changes: 2 additions & 0 deletions packages/base/package-scripts.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const scripts = {
generateTemplates: `mkdirp src/generated/templates && cross-env UI5_BASE=true UI5_TS=true node "${LIB}/hbs2ui5/index.js" -d test/elements -o src/generated/templates`,
generateAPI: {
default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup",
generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs"`,
validateCEM: `node "${LIB}/cem/validate.js"`,
prepare: `copy-and-watch "dist/**/*.js" jsdoc-dist/`,
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/`,
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
Expand Down
21 changes: 5 additions & 16 deletions packages/base/src/MediaRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ DEAFULT_RANGE_SET.set("XL", [1440, Infinity]);
/**
* Enumeration containing the names and settings of predefined screen width media query range sets.
*
* @namespace
* @name MediaRange.RANGESETS
* @public
*/
enum RANGESETS {
Expand All @@ -27,7 +25,6 @@ DEAFULT_RANGE_SET.set("XL", [1440, Infinity]);
* <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
* </ul>
*
* @name MediaRange.RANGESETS.RANGE_4STEPS
* @public
*/
RANGE_4STEPS = "4Step",
Expand All @@ -49,10 +46,9 @@ DEAFULT_RANGE_SET.set("XL", [1440, Infinity]);
* <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
* </ul>
*
* @param {string} name The name of the range set to be initialized.
* @param name The name of the range set to be initialized.
* The name must be a valid id and consist only of letters and numeric digits.
* @param {Range} [range] The given range set.
* @name MediaRange.initRangeSet
* @param range The given range set.
*/
const initRangeSet = (name: string, range: Range) => {
mediaRanges.set(name, range);
Expand All @@ -64,13 +60,10 @@ const initRangeSet = (name: string, range: Range) => {
* If the optional parameter <code>width</code> is given, the active range will be determined for that width,
* otherwise it is determined for the current window size.
*
* @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
* @param {number} [width] An optional width, based on which the range should be determined;
* @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
* @param [width] An optional width, based on which the range should be determined;
* If <code>width</code> is not provided, the window size will be used.
* @returns {string} The name of the current active interval of the range set.
*
* @name MediaRange.getCurrentRange
* @function
* @returns The name of the current active interval of the range set.
* @public
*/
const getCurrentRange = (name: string, width = window.innerWidth): string => {
Expand All @@ -94,11 +87,7 @@ const getCurrentRange = (name: string, width = window.innerWidth): string => {

/**
* API for screen width changes.
*
* @namespace
* @name MediaRange
*/

const MediaRange = {
RANGESETS,
initRangeSet,
Expand Down
6 changes: 2 additions & 4 deletions packages/base/src/StaticAreaItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const pureTagName = "ui5-static-area-item";
const popupIntegrationAttr = "data-sap-ui-integration-popup-content";

/**
*
* @class
* @author SAP SE
* @private
*/
class StaticAreaItem extends HTMLElement {
Expand All @@ -26,7 +24,7 @@ class StaticAreaItem extends HTMLElement {
}

/**
* @param {UI5Element} ownerElement the UI5Element instance that owns this static area item
* @param ownerElement the UI5Element instance that owns this static area item
*/
setOwnerElement(ownerElement: UI5Element) {
this.ownerElement = ownerElement;
Expand Down Expand Up @@ -83,8 +81,8 @@ class StaticAreaItem extends HTMLElement {
}

/**
* @protected
* Returns reference to the DOM element where the current fragment is added.
* @protected
*/
async getDomRef() {
this.updateAdditionalProperties();
Expand Down
83 changes: 36 additions & 47 deletions packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,9 @@ function _invalidate(this: UI5Element, changeInfo: ChangeInfo) {
}

/**
* @class
* Base class for all UI5 Web Components
*
* @class
* @constructor
* @author SAP SE
* @alias sap.ui.webc.base.UI5Element
* @extends HTMLElement
* @public
*/
Expand Down Expand Up @@ -230,25 +227,25 @@ abstract class UI5Element extends HTMLElement {
* Called every time before the component renders.
* @public
*/
onBeforeRendering() {}
onBeforeRendering(): void {}

/**
* Called every time after the component renders.
* @public
*/
onAfterRendering() {}
onAfterRendering(): void {}

/**
* Called on connectedCallback - added to the DOM.
* @public
*/
onEnterDOM() {}
onEnterDOM(): void {}

/**
* Called on disconnectedCallback - removed from the DOM.
* @public
*/
onExitDOM() {}
onExitDOM(): void {}

/**
* @private
Expand Down Expand Up @@ -438,28 +435,28 @@ abstract class UI5Element extends HTMLElement {
/**
* Attach a callback that will be executed whenever the component is invalidated
*
* @param {InvalidationInfo} callback
* @param callback
* @public
*/
attachInvalidate(callback: (param: InvalidationInfo) => void) {
attachInvalidate(callback: (param: InvalidationInfo) => void): void {
this._invalidationEventProvider.attachEvent("invalidate", callback);
}

/**
* Detach the callback that is executed whenever the component is invalidated
*
* @param {InvalidationInfo} callback
* @param callback
* @public
*/
detachInvalidate(callback: (param: InvalidationInfo) => void) {
detachInvalidate(callback: (param: InvalidationInfo) => void): void {
this._invalidationEventProvider.detachEvent("invalidate", callback);
}

/**
* Callback that is executed whenever a monitored child changes its state
*
* @param {sting} slotName the slot in which a child was invalidated
* @param { ChangeInfo } childChangeInfo the changeInfo object for the child in the given slot
* @param slotName the slot in which a child was invalidated
* @param childChangeInfo the changeInfo object for the child in the given slot
* @private
*/
_onChildChange(slotName: string, childChangeInfo: ChangeInfo) {
Expand Down Expand Up @@ -576,24 +573,22 @@ abstract class UI5Element extends HTMLElement {
* Returns a singleton event listener for the "change" event of a child in a given slot
*
* @param slotName the name of the slot, where the child is
* @returns {ChildChangeListener}
* @private
*/
_getChildChangeListener(slotName: string) {
_getChildChangeListener(slotName: string): ChildChangeListener {
if (!this._childChangeListeners.has(slotName)) {
this._childChangeListeners.set(slotName, this._onChildChange.bind(this, slotName));
}
return this._childChangeListeners.get(slotName);
return this._childChangeListeners.get(slotName)!;
}

/**
* Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
*
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
* @returns {SlotChangeListener}
* @private
*/
_getSlotChangeListener(slotName: string) {
_getSlotChangeListener(slotName: string): SlotChangeListener {
if (!this._slotChangeListeners.has(slotName)) {
this._slotChangeListeners.set(slotName, this._onSlotChange.bind(this, slotName));
}
Expand Down Expand Up @@ -658,7 +653,7 @@ abstract class UI5Element extends HTMLElement {
*
* @public
*/
onInvalidation(changeInfo: ChangeInfo) {} // eslint-disable-line
onInvalidation(changeInfo: ChangeInfo): void {} // eslint-disable-line

/**
* Do not call this method directly, only intended to be called by js
Expand Down Expand Up @@ -746,7 +741,7 @@ abstract class UI5Element extends HTMLElement {
*
* @public
*/
getDomRef() {
getDomRef(): HTMLElement | undefined {
// If a component set _getRealDomRef to its children, use the return value of this function
if (typeof this._getRealDomRef === "function") {
return this._getRealDomRef();
Expand All @@ -769,7 +764,7 @@ abstract class UI5Element extends HTMLElement {
* This is the element that will receive the focus by default.
* @public
*/
getFocusDomRef() {
getFocusDomRef(): HTMLElement | undefined {
const domRef = this.getDomRef();
if (domRef) {
const focusRef = domRef.querySelector("[data-sap-focus-ref]") as HTMLElement;
Expand All @@ -782,17 +777,17 @@ abstract class UI5Element extends HTMLElement {
* This is the element that will receive the focus by default.
* @public
*/
async getFocusDomRefAsync() {
async getFocusDomRefAsync(): Promise<HTMLElement | undefined> {
await this._waitForDomRef();
return this.getFocusDomRef();
}

/**
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
* @param {FocusOptions} focusOptions additional options for the focus
* @param focusOptions additional options for the focus
* @public
*/
async focus(focusOptions?: FocusOptions) {
async focus(focusOptions?: FocusOptions): Promise<void> {
await this._waitForDomRef();

const focusDomRef = this.getFocusDomRef();
Expand All @@ -809,9 +804,9 @@ abstract class UI5Element extends HTMLElement {
* @param data - additional data for the event
* @param cancelable - true, if the user can call preventDefault on the event object
* @param bubbles - true, if the event bubbles
* @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
* @returns false, if the event was cancelled (preventDefault called), true otherwise
*/
fireEvent<T>(name: string, data?: T, cancelable = false, bubbles = true) {
fireEvent<T>(name: string, data?: T, cancelable = false, bubbles = true): boolean {
const eventResult = this._fireEvent(name, data, cancelable, bubbles);
const camelCaseEventName = kebabToCamelCase(name);

Expand Down Expand Up @@ -856,27 +851,27 @@ abstract class UI5Element extends HTMLElement {
* Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
* @public
*/
getSlottedNodes<T = Node>(slotName: string) {
getSlottedNodes<T = Node>(slotName: string): Array<T> {
return getSlottedNodesList((this as unknown as Record<string, Array<SlotValue>>)[slotName]) as Array<T>;
}

/**
* Attach a callback that will be executed whenever the component's state is finalized
*
* @param {} callback
* @param callback
* @public
*/
attachComponentStateFinalized(callback: () => void) {
attachComponentStateFinalized(callback: () => void): void {
this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
}

/**
* Detach the callback that is executed whenever the component's state is finalized
*
* @param {} callback
* @param callback
* @public
*/
detachComponentStateFinalized(callback: () => void) {
detachComponentStateFinalized(callback: () => void): void {
this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
}

Expand All @@ -885,19 +880,19 @@ abstract class UI5Element extends HTMLElement {
* Returns: "rtl", "ltr" or undefined
*
* @public
* @returns {String|undefined}
* @default undefined
*/
get effectiveDir() {
get effectiveDir(): string | undefined {
markAsRtlAware(this.constructor as typeof UI5Element); // if a UI5 Element calls this method, it's considered to be rtl-aware
return getEffectiveDir(this);
}

/**
* Used to duck-type UI5 elements without using instanceof
* @returns {boolean}
* @public
* @default true
*/
get isUI5Element() {
get isUI5Element(): boolean {
return true;
}

Expand Down Expand Up @@ -930,7 +925,7 @@ abstract class UI5Element extends HTMLElement {
/**
* @public
*/
getStaticAreaItemDomRef() {
getStaticAreaItemDomRef(): Promise<ShadowRoot | null> {
if (!(this.constructor as typeof UI5Element)._needsStaticArea()) {
throw new Error("This component does not use the static area");
}
Expand Down Expand Up @@ -1093,7 +1088,7 @@ abstract class UI5Element extends HTMLElement {
*
* @public
*/
static getUniqueDependencies(this: typeof UI5Element) {
static getUniqueDependencies(this: typeof UI5Element): Array<typeof UI5Element> {
if (!uniqueDependenciesCache.has(this)) {
const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
uniqueDependenciesCache.set(this, filtered);
Expand All @@ -1104,8 +1099,6 @@ abstract class UI5Element extends HTMLElement {

/**
* Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
*
* @returns {Promise}
*/
static whenDependenciesDefined(): Promise<Array<typeof UI5Element>> {
return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
Expand All @@ -1115,18 +1108,16 @@ abstract class UI5Element extends HTMLElement {
* Hook that will be called upon custom element definition
*
* @protected
* @returns {Promise<void>}
*/
static async onDefine() {
static async onDefine(): Promise<void> {
return Promise.resolve();
}

/**
* Registers a UI5 Web Component in the browser window object
* @public
* @returns {Promise<UI5Element>}
*/
static async define() {
static async define(): Promise<typeof UI5Element> {
await boot();

await Promise.all([
Expand Down Expand Up @@ -1154,9 +1145,8 @@ abstract class UI5Element extends HTMLElement {
* Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
* Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
* @public
* @returns {UI5ElementMetadata}
*/
static getMetadata() {
static getMetadata(): UI5ElementMetadata {
if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
return this._metadata;
}
Expand All @@ -1176,7 +1166,6 @@ abstract class UI5Element extends HTMLElement {

/**
* Always use duck-typing to cover all runtimes on the page.
* @returns {boolean}
*/
const instanceOfUI5Element = (object: any): object is UI5Element => {
return "isUI5Element" in object;
Expand Down
Loading
Loading