Skip to content

Commit

Permalink
chore: cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Dec 7, 2022
1 parent 3a39532 commit 0160dba
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
6 changes: 0 additions & 6 deletions apis/nucleus/src/components/sheetGlue.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Sheet from './Sheet';
import uid from '../object/uid';

export default function glue({ halo, element, model, initialSnOptions, initialSnPlugins, onMount, initialError }) {
const { root } = halo;
const sheetRef = React.createRef();
const currentId = uid();
const portal = ReactDOM.createPortal(
<Sheet
ref={sheetRef}
halo={halo}
model={model}
currentId={currentId}
initialSnOptions={initialSnOptions}
initialSnPlugins={initialSnPlugins}
initialError={initialError}
Expand All @@ -30,8 +27,5 @@ export default function glue({ halo, element, model, initialSnOptions, initialSn
model.on('closed', unmount);

root.add(portal);
// Cannot use model.id as it is not unique in a given mashup
// root.addCell(currentId, sheetRef); // this is not needed, sheet is not part of the focus stuff

return [unmount, sheetRef];
}
9 changes: 7 additions & 2 deletions apis/nucleus/src/sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export default function sheet({ model, halo, initialError, onDestroy = async ()
* @type {string}
*/
id: model.id,
/**
* This sheets Enigma model, a representation of the generic object.
* @type {string}
*/
model,
/**
* Destroys the sheet and removes it from the the DOM.
* @example
Expand Down Expand Up @@ -114,10 +119,10 @@ export default function sheet({ model, halo, initialError, onDestroy = async ()
setSnPlugins(plugins);
},
exportImage() {
// return sheetRef.current.exportImage();
throw new Error('Not implemented');
},
takeSnapshot() {
// return sheetRef.current.takeSnapshot();
throw new Error('Not implemented');
},
getModel() {
return model;
Expand Down
2 changes: 1 addition & 1 deletion apis/nucleus/src/viz.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function viz({ model, halo, initialError, onDestroy = async () =>
*/
id: model.id,
/**
* This visualization's Enigma model, a representation of the generic object.
* This visualizations Enigma model, a representation of the generic object.
* @type {string}
*/
model,
Expand Down
6 changes: 5 additions & 1 deletion apis/stardust/api-spec/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,10 @@
"description": "The id of this sheets's generic object.",
"type": "string"
},
"model": {
"description": "This sheets Enigma model, a representation of the generic object.",
"type": "string"
},
"destroy": {
"description": "Destroys the sheet and removes it from the the DOM.",
"kind": "function",
Expand All @@ -1041,7 +1045,7 @@
"type": "string"
},
"model": {
"description": "This visualization's Enigma model, a representation of the generic object.",
"description": "This visualizations Enigma model, a representation of the generic object.",
"type": "string"
},
"destroy": {
Expand Down
2 changes: 2 additions & 0 deletions apis/stardust/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ declare namespace stardust {

id: string;

model: string;

/**
* Destroys the sheet and removes it from the the DOM.
*/
Expand Down

0 comments on commit 0160dba

Please sign in to comment.