Files
nebula.js/apis/nucleus/spec/spec.json
2020-02-13 12:39:51 +01:00

287 lines
6.7 KiB
JSON

{
"scriptappy": "1.0.0",
"info": {
"name": "@nebula.js/nucleus",
"version": "0.1.0-alpha.26",
"license": "MIT",
"stability": "experimental",
"x-qlik-visibility": "public"
},
"entries": {
"nucleus": {
"description": "Initiates a new `nebbie` instance using the specified `app`.",
"kind": "function",
"params": [
{
"name": "app",
"type": "EnigmaAppModel"
},
{
"name": "instanceConfig",
"optional": true,
"type": "#/definitions/Configuration"
}
],
"returns": {
"type": "#/definitions/Nebbie"
},
"examples": ["import nucleus from '@nebula.js/nucleus'\nconst nebbie = nucleus(app);"],
"entries": {
"configured": {
"description": "Creates a new `nucleus` instance using the specified configuration.\n\nThe configuration is merged with all previous instances.",
"kind": "function",
"params": [
{
"name": "configuration",
"type": "#/definitions/Configuration"
}
],
"returns": {
"type": "#/entries/nucleus"
},
"examples": [
"import nucleus from '@nebula.js/nucleus';\n// create a 'master' config which registers all types\nconst m = nucleus.configured({\n types: [{\n name: 'mekko',\n version: '1.0.0',\n }],\n});\n\n// create an alternate config with dark theme\n// and inherit the config from the previous\nconst d = m.configured({\n theme: 'dark'\n});\n\nm(app).create({ type: 'mekko' }); // will render the object with default theme\nd(app).create({ type: 'mekko' }); // will render the object with 'dark' theme\nnucleus(app).create({ type: 'mekko' }); // will throw error since 'mekko' is not a register type on the default instance"
]
}
}
}
},
"definitions": {
"AppSelections": {
"kind": "interface",
"params": [],
"entries": {
"mount": {
"kind": "function",
"params": [
{
"name": "element",
"type": "HTMLElement"
}
]
},
"unmount": {
"kind": "function",
"params": []
}
}
},
"Configuration": {
"kind": "object",
"entries": {
"env": {
"kind": "object",
"entries": {}
},
"load": {
"kind": "function",
"params": []
},
"themes": {
"kind": "array",
"items": {
"type": "ThemeInfo"
}
},
"types": {
"kind": "array",
"items": {
"type": "#/definitions/TypeInfo"
}
}
}
},
"CreateObjectConfig": {
"kind": "object",
"entries": {
"type": {
"type": "string"
},
"version": {
"type": "string"
},
"fields": {
"kind": "array",
"items": {
"type": "object"
}
}
}
},
"GetObjectConfig": {
"kind": "object",
"entries": {
"id": {
"type": "string"
}
}
},
"loadType": {
"kind": "function",
"params": [
{
"name": "type",
"kind": "object",
"entries": {
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
{
"name": "env",
"type": "object"
}
],
"returns": {
"type": "Promise",
"generics": [
{
"type": "Supernova"
}
]
}
},
"Nebbie": {
"kind": "interface",
"params": [],
"entries": {
"context": {
"kind": "function",
"params": [
{
"name": "ctx",
"kind": "object",
"entries": {
"theme": {
"type": "string"
},
"language": {
"type": "string"
},
"constraints": {
"kind": "array",
"items": {
"type": "string"
}
}
}
}
]
},
"create": {
"kind": "function",
"params": [
{
"name": "createCfg",
"type": "#/definitions/CreateObjectConfig"
},
{
"name": "vizConfig",
"optional": true,
"type": "#/definitions/VizConfig"
}
],
"returns": {
"type": "#/definitions/Viz"
}
},
"get": {
"kind": "function",
"params": [
{
"name": "getCfg",
"type": "#/definitions/GetObjectConfig"
},
{
"name": "vizConfig",
"optional": true,
"type": "#/definitions/VizConfig"
}
],
"returns": {
"type": "#/definitions/Viz"
}
},
"selections": {
"kind": "function",
"params": [],
"returns": {
"type": "#/definitions/AppSelections"
}
}
}
},
"TypeInfo": {
"kind": "object",
"entries": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"meta": {
"optional": true,
"type": "object"
},
"load": {
"optional": true,
"type": "#/definitions/loadType"
}
}
},
"Viz": {
"kind": "interface",
"params": [],
"entries": {
"close": {
"kind": "function",
"params": []
},
"model": {
"type": "EnigmaObjectModel"
},
"mount": {
"kind": "function",
"params": [
{
"name": "element",
"type": "HTMLElement"
}
],
"returns": {
"type": "Promise"
}
}
}
},
"VizConfig": {
"kind": "object",
"entries": {
"element": {
"optional": true,
"type": "HTMLElement"
},
"optional": {
"optional": true,
"kind": "object",
"entries": {
"options": {
"optional": true,
"type": "object"
},
"properties": {
"optional": true,
"type": "object"
}
}
}
}
}
}
}