chore: import editorial review (#592)

* chore: import editorial review

* chore: make spec compliant
This commit is contained in:
Tobias Åström
2021-04-08 08:39:11 +02:00
committed by GitHub
parent bb6f647111
commit bd39cb4b4d
11 changed files with 96 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
/** /**
* Used for exporting and importing properties between backend models. An object that exports to * Used for exporting and importing properties between backend models. An object that exports to
* ExportFormat should put dimensions and measures inside one data group. If an object has two hypercubes * ExportFormat should put dimensions and measures inside one data group. If an object has two hypercubes,
* each of the cubes should export dimensions and measures in two separate data groups. * each of the cubes should export dimensions and measures in two separate data groups.
* An object that imports from this structure is responsible for putting the existing properties where they should be * An object that imports from this structure is responsible for putting the existing properties where they should be
* in the new model. * in the new model.

View File

@@ -87,7 +87,7 @@ export const convertTo = async ({ halo, model, cellRef, newType }) => {
* @alias Conversion * @alias Conversion
* @experimental * @experimental
* @since 1.1.0 * @since 1.1.0
* @description Provides conversion functionality to extensions * @description Provides conversion functionality to extensions.
* @example * @example
* import { conversion } from '@nebula.js/stardust'; * import { conversion } from '@nebula.js/stardust';
* *
@@ -108,7 +108,7 @@ const conversion = {
* @type {hyperCubeConversion} * @type {hyperCubeConversion}
* @experimental * @experimental
* @since 1.1.0 * @since 1.1.0
* @description Provides conversion functionality for extensions with hyperCubes * @description Provides conversion functionality to extensions with hyperCubes.
*/ */
hypercube, hypercube,
}; };

View File

@@ -10,7 +10,6 @@ export default function translator({ initial = 'en-US', fallback = 'en-US' } = {
/** /**
* @class Translator * @class Translator
* @hideconstructor
*/ */
const api = /** @lends Translator# */ { const api = /** @lends Translator# */ {
language: (lang) => { language: (lang) => {
@@ -45,10 +44,10 @@ export default function translator({ initial = 'en-US', fallback = 'en-US' } = {
}); });
}, },
/** /**
* Translates a string for current locale * Translates a string for current locale.
* @param {string} str - Id of the registered string * @param {string} str - ID of the registered string.
* @param {Array<string>=} args - Values passed down for string interpolation * @param {Array<string>=} args - Values passed down for string interpolation.
* @returns {string} The translated string * @returns {string} The translated string.
*/ */
get(str, args) { get(str, args) {
let v; let v;

View File

@@ -59,7 +59,6 @@ function createAppSelections({ app, currentSelectionsLayout, navState }) {
/** /**
* @class * @class
* @hideconstructor
* @alias AppSelections * @alias AppSelections
*/ */
const appSelections = { const appSelections = {

View File

@@ -23,7 +23,6 @@ function createObjectSelections({ appSelections, appModal, model }) {
/** /**
* @class * @class
* @alias ObjectSelections * @alias ObjectSelections
* @hideconstructor
*/ */
const api = /** @lends ObjectSelections# */ { const api = /** @lends ObjectSelections# */ {
// model, // model,

View File

@@ -193,7 +193,6 @@ function nuked(configuration = {}) {
/** /**
* @class * @class
* @alias Embed * @alias Embed
* @hideconstructor
*/ */
const api = /** @lends Embed# */ { const api = /** @lends Embed# */ {
/** /**
@@ -329,7 +328,6 @@ function nuked(configuration = {}) {
/** /**
* @class * @class
* @hideconstructor
* @alias FieldInstance * @alias FieldInstance
* @experimental * @experimental
* @since 1.1.0 * @since 1.1.0
@@ -430,7 +428,7 @@ function nuked(configuration = {}) {
/** /**
* @interface ThemeInfo * @interface ThemeInfo
* @property {string} id Theme identifier * @property {string} id Theme identifier
* @property {function(): Promise<ThemeJSON>} load A function that should return a Promise that resolve to a raw JSON theme * @property {function(): Promise<ThemeJSON>} load A function that should return a Promise that resolves to a raw JSON theme.
*/ */
export default nuked(DEFAULT_CONFIG); export default nuked(DEFAULT_CONFIG);

View File

@@ -37,7 +37,6 @@ export default function viz({ model, halo, initialError, onDestroy = async () =>
/** /**
* @class * @class
* @alias Viz * @alias Viz
* @hideconstructor
* @classdesc A controller to further modify a visualization after it has been rendered. * @classdesc A controller to further modify a visualization after it has been rendered.
* @example * @example
* const viz = await embed(app).render({ * const viz = await embed(app).render({
@@ -53,7 +52,7 @@ export default function viz({ model, halo, initialError, onDestroy = async () =>
*/ */
id: model.id, id: model.id,
/** /**
* Destroys the visualization and removes if from the the DOM. * Destroys the visualization and removes it from the the DOM.
* @example * @example
* const viz = await embed(app).render({ * const viz = await embed(app).render({
* element, * element,
@@ -67,12 +66,12 @@ export default function viz({ model, halo, initialError, onDestroy = async () =>
unmountCell = noopi; unmountCell = noopi;
}, },
/** /**
* Converts the visualization to a different registred type * Converts the visualization to a different registered type
* @experimental * @experimental
* @since 1.1.0 * @since 1.1.0
* @param {string} newType - Which registered type to convert to * @param {string} newType - Which registered type to convert to.
* @param {boolean=} forceUpdate - Whether to run setProperties or not, defaults to true. * @param {boolean=} forceUpdate - Whether to run setProperties or not, defaults to true.
* @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualizatiom * @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualization.
* @example * @example
* const viz = await embed(app).render({ * const viz = await embed(app).render({
* element, * element,

View File

@@ -95,7 +95,7 @@
] ]
}, },
"useEffect": { "useEffect": {
"description": "Triggers a callback function when a dependant value changes.", "description": "Triggers a callback function when a dependent value changes.",
"kind": "function", "kind": "function",
"params": [ "params": [
{ {
@@ -105,7 +105,7 @@
}, },
{ {
"name": "deps", "name": "deps",
"description": "The dependencies which should trigger the callback.", "description": "The dependencies that should trigger the callback.",
"optional": true, "optional": true,
"kind": "array", "kind": "array",
"items": { "items": {
@@ -118,7 +118,7 @@
] ]
}, },
"useMemo": { "useMemo": {
"description": "Creates a stateful value when a dependant changes.", "description": "Creates a stateful value when a dependent changes.",
"templates": [ "templates": [
{ {
"name": "T" "name": "T"
@@ -153,7 +153,7 @@
] ]
}, },
"usePromise": { "usePromise": {
"description": "Runs a callback function when a dependant changes.", "description": "Runs a callback function when a dependent changes.",
"templates": [ "templates": [
{ {
"name": "P" "name": "P"
@@ -353,6 +353,18 @@
"import { useTranslator } from '@nebula.js/stardust';\n// ...\nconst translator = useTranslator();\nconsole.log(translator.get('SomeString'));" "import { useTranslator } from '@nebula.js/stardust';\n// ...\nconst translator = useTranslator();\nconsole.log(translator.get('SomeString'));"
] ]
}, },
"useDeviceType": {
"description": "Gets the device type. ('touch' or 'desktop')",
"kind": "function",
"params": [],
"returns": {
"description": "device type.",
"type": "string"
},
"examples": [
"import { useDeviceType } from '@nebula.js/stardust';\n// ...\nconst deviceType = useDeviceType();\nif (deviceType === 'touch') { ... };"
]
},
"useAction": { "useAction": {
"description": "Registers a custom action.", "description": "Registers a custom action.",
"templates": [ "templates": [
@@ -450,10 +462,6 @@
"optional": true, "optional": true,
"kind": "object", "kind": "object",
"entries": { "entries": {
"select": {
"optional": true,
"type": "boolean"
},
"active": { "active": {
"optional": true, "optional": true,
"type": "boolean" "type": "boolean"
@@ -461,6 +469,10 @@
"passive": { "passive": {
"optional": true, "optional": true,
"type": "boolean" "type": "boolean"
},
"select": {
"optional": true,
"type": "boolean"
} }
} }
}, },
@@ -473,6 +485,11 @@
"optional": true, "optional": true,
"defaultValue": "en-US", "defaultValue": "en-US",
"type": "string" "type": "string"
},
"deviceType": {
"optional": true,
"defaultValue": "auto",
"type": "string"
} }
} }
}, },
@@ -512,6 +529,9 @@
"flags": { "flags": {
"type": "#/definitions/Flags" "type": "#/definitions/Flags"
}, },
"deviceType": {
"type": "string"
},
"anything": { "anything": {
"type": "object" "type": "object"
} }
@@ -519,6 +539,10 @@
}, },
"Embed": { "Embed": {
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"render": { "render": {
"description": "Renders a visualization into an HTMLElement.", "description": "Renders a visualization into an HTMLElement.",
@@ -631,6 +655,10 @@
"since": "1.1.0" "since": "1.1.0"
}, },
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": {}, "entries": {},
"staticEntries": { "staticEntries": {
"mount": { "mount": {
@@ -705,7 +733,7 @@
"type": "string" "type": "string"
}, },
"load": { "load": {
"description": "A function that should return a Promise that resolve to a raw JSON theme", "description": "A function that should return a Promise that resolves to a raw JSON theme.",
"kind": "function", "kind": "function",
"params": [], "params": [],
"returns": { "returns": {
@@ -722,19 +750,23 @@
"Viz": { "Viz": {
"description": "A controller to further modify a visualization after it has been rendered.", "description": "A controller to further modify a visualization after it has been rendered.",
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"id": { "id": {
"description": "The id of this visualization's generic object.", "description": "The id of this visualization's generic object.",
"type": "string" "type": "string"
}, },
"destroy": { "destroy": {
"description": "Destroys the visualization and removes if from the the DOM.", "description": "Destroys the visualization and removes it from the the DOM.",
"kind": "function", "kind": "function",
"params": [], "params": [],
"examples": ["const viz = await embed(app).render({\n element,\n id: 'abc'\n});\nviz.destroy();"] "examples": ["const viz = await embed(app).render({\n element,\n id: 'abc'\n});\nviz.destroy();"]
}, },
"convertTo": { "convertTo": {
"description": "Converts the visualization to a different registred type", "description": "Converts the visualization to a different registered type",
"stability": "experimental", "stability": "experimental",
"availability": { "availability": {
"since": "1.1.0" "since": "1.1.0"
@@ -743,7 +775,7 @@
"params": [ "params": [
{ {
"name": "newType", "name": "newType",
"description": "Which registered type to convert to", "description": "Which registered type to convert to.",
"type": "string" "type": "string"
}, },
{ {
@@ -754,7 +786,7 @@
} }
], ],
"returns": { "returns": {
"description": "Promise object that resolves to the full property tree of the converted visualizatiom", "description": "Promise object that resolves to the full property tree of the converted visualization.",
"type": "Promise", "type": "Promise",
"generics": [ "generics": [
{ {
@@ -791,6 +823,10 @@
}, },
"AppSelections": { "AppSelections": {
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"mount": { "mount": {
"description": "Mounts the app selection UI into the provided HTMLElement.", "description": "Mounts the app selection UI into the provided HTMLElement.",
@@ -813,6 +849,10 @@
}, },
"ObjectSelections": { "ObjectSelections": {
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"begin": { "begin": {
"kind": "function", "kind": "function",
@@ -1501,6 +1541,10 @@
}, },
"Translator": { "Translator": {
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"add": { "add": {
"description": "Registers a string in multiple locales", "description": "Registers a string in multiple locales",
@@ -1532,17 +1576,17 @@
] ]
}, },
"get": { "get": {
"description": "Translates a string for current locale", "description": "Translates a string for current locale.",
"kind": "function", "kind": "function",
"params": [ "params": [
{ {
"name": "str", "name": "str",
"description": "Id of the registered string", "description": "ID of the registered string.",
"type": "string" "type": "string"
}, },
{ {
"name": "args", "name": "args",
"description": "Values passed down for string interpolation", "description": "Values passed down for string interpolation.",
"optional": true, "optional": true,
"kind": "array", "kind": "array",
"items": { "items": {
@@ -1551,7 +1595,7 @@
} }
], ],
"returns": { "returns": {
"description": "The translated string", "description": "The translated string.",
"type": "string" "type": "string"
} }
} }
@@ -1559,6 +1603,10 @@
}, },
"Theme": { "Theme": {
"kind": "class", "kind": "class",
"constructor": {
"kind": "function",
"params": []
},
"entries": { "entries": {
"getDataColorScales": { "getDataColorScales": {
"kind": "function", "kind": "function",
@@ -1639,22 +1687,22 @@
"examples": ["theme.getContrastingColorTo('#400');"] "examples": ["theme.getContrastingColorTo('#400');"]
}, },
"getStyle": { "getStyle": {
"description": "Get the value of a style attribute in the theme by searching in the theme's json structure.\nThe search starts at the specified base path and continue upwards until the value is found.\nIf possible it will get the attribute's value using the given path.", "description": "Get the value of a style attribute in the theme by searching in the theme's JSON structure.\nThe search starts at the specified base path and continues upwards until the value is found.\nIf possible it will get the attribute's value using the given path.",
"kind": "function", "kind": "function",
"params": [ "params": [
{ {
"name": "basePath", "name": "basePath",
"description": "Base path in the theme's json structure to start the search in (specified as a name path separated by dots)", "description": "Base path in the theme's JSON structure to start the search in (specified as a name path separated by dots).",
"type": "string" "type": "string"
}, },
{ {
"name": "path", "name": "path",
"description": "Expected path for the attribute (specified as a name path separated by dots)", "description": "Expected path for the attribute (specified as a name path separated by dots).",
"type": "string" "type": "string"
}, },
{ {
"name": "attribute", "name": "attribute",
"description": "Name of the style attribute", "description": "Name of the style attribute.",
"type": "string" "type": "string"
} }
], ],
@@ -1779,7 +1827,7 @@
} }
}, },
"ExportFormat": { "ExportFormat": {
"description": "Used for exporting and importing properties between backend models. An object that exports to\nExportFormat should put dimensions and measures inside one data group. If an object has two hypercubes\neach of the cubes should export dimensions and measures in two separate data groups.\nAn object that imports from this structure is responsible for putting the existing properties where they should be\nin the new model.", "description": "Used for exporting and importing properties between backend models. An object that exports to\nExportFormat should put dimensions and measures inside one data group. If an object has two hypercubes,\neach of the cubes should export dimensions and measures in two separate data groups.\nAn object that imports from this structure is responsible for putting the existing properties where they should be\nin the new model.",
"stability": "experimental", "stability": "experimental",
"availability": { "availability": {
"since": "1.1.0" "since": "1.1.0"
@@ -1859,7 +1907,7 @@
} }
}, },
"Conversion": { "Conversion": {
"description": "Provides conversion functionality to extensions", "description": "Provides conversion functionality to extensions.",
"stability": "experimental", "stability": "experimental",
"availability": { "availability": {
"since": "1.1.0" "since": "1.1.0"
@@ -1867,7 +1915,7 @@
"kind": "interface", "kind": "interface",
"entries": { "entries": {
"hypercube": { "hypercube": {
"description": "Provides conversion functionality for extensions with hyperCubes", "description": "Provides conversion functionality to extensions with hyperCubes.",
"stability": "experimental", "stability": "experimental",
"availability": { "availability": {
"since": "1.1.0" "since": "1.1.0"

View File

@@ -292,10 +292,10 @@ export function useState(initial) {
*/ */
/** /**
* Triggers a callback function when a dependant value changes. * Triggers a callback function when a dependent value changes.
* @entry * @entry
* @param {EffectCallback} effect - The callback. * @param {EffectCallback} effect - The callback.
* @param {Array<any>=} deps - The dependencies which should trigger the callback. * @param {Array<any>=} deps - The dependencies that should trigger the callback.
* @example * @example
* import { useEffect } from '@nebula.js/stardust'; * import { useEffect } from '@nebula.js/stardust';
* // ... * // ...
@@ -336,7 +336,7 @@ function useLayoutEffect(cb, deps) {
} }
/** /**
* Creates a stateful value when a dependant changes. * Creates a stateful value when a dependent changes.
* @entry * @entry
* @template T * @template T
* @param {function():T} factory - The factory function. * @param {function():T} factory - The factory function.
@@ -363,7 +363,7 @@ export function useMemo(fn, deps) {
} }
/** /**
* Runs a callback function when a dependant changes. * Runs a callback function when a dependent changes.
* @entry * @entry
* @template P * @template P
* @param {function():Promise<P>} factory - The factory function that calls the promise. * @param {function():Promise<P>} factory - The factory function that calls the promise.

View File

@@ -17,7 +17,6 @@ export default function theme() {
/** /**
* @class * @class
* @alias Theme * @alias Theme
* @hideconstructor
*/ */
const externalAPI = /** @lends Theme# */ { const externalAPI = /** @lends Theme# */ {
/** /**
@@ -74,13 +73,13 @@ export default function theme() {
}, },
/** /**
* Get the value of a style attribute in the theme by searching in the theme's json structure. * Get the value of a style attribute in the theme by searching in the theme's JSON structure.
* The search starts at the specified base path and continue upwards until the value is found. * The search starts at the specified base path and continues upwards until the value is found.
* If possible it will get the attribute's value using the given path. * If possible it will get the attribute's value using the given path.
* *
* @param {string} basePath - Base path in the theme's json structure to start the search in (specified as a name path separated by dots) * @param {string} basePath - Base path in the theme's JSON structure to start the search in (specified as a name path separated by dots).
* @param {string} path - Expected path for the attribute (specified as a name path separated by dots) * @param {string} path - Expected path for the attribute (specified as a name path separated by dots).
* @param {string} attribute - Name of the style attribute * @param {string} attribute - Name of the style attribute.
* @returns {string} The style value * @returns {string} The style value
* *
* @example * @example

View File

@@ -167,7 +167,7 @@ const [value, setValue] = useState(() => heavy());
- `effect` <[EffectCallback]> The callback. - `effect` <[EffectCallback]> The callback.
- `deps` <[Array]<`any`>> The dependencies which should trigger the callback. - `deps` <[Array]<`any`>> The dependencies which should trigger the callback.
Triggers a callback function when a dependant value changes. Triggers a callback function when a dependent value changes.
```js ```js
import { useEffect } from '@nebula.js/stardust'; import { useEffect } from '@nebula.js/stardust';
@@ -186,7 +186,7 @@ useEffect(() => {
- `deps` <[Array]<`any`>> The dependencies. - `deps` <[Array]<`any`>> The dependencies.
- `returns:` <`T`> The value returned from the factory function. - `returns:` <`T`> The value returned from the factory function.
Creates a stateful value when a dependant changes. Creates a stateful value when a dependent changes.
```js ```js
import { useMemo } from '@nebula.js/stardust'; import { useMemo } from '@nebula.js/stardust';
@@ -202,7 +202,7 @@ const v = useMemo(() => {
- `deps` <[Array]<`any`>> The dependencies. - `deps` <[Array]<`any`>> The dependencies.
- `returns:` <[Array]> The resolved value. - `returns:` <[Array]> The resolved value.
Runs a callback function when a dependant changes. Runs a callback function when a dependent changes.
```js ```js
import { usePromise } from '@nebula.js/stardust'; import { usePromise } from '@nebula.js/stardust';