Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (serializer.deserialize === unpack_models) {
// There's a widget serializer, but it is not a direct ref
// Should be nested widget then
this.nestedKeys.push(key);
} else if (serializer === data_union_serialization || serializer === array_serialization) {
this.dataWidgetKeys.push(key);
}
}
}
nestedKeys: string[];
dataWidgetKeys: string[];
static serializers: ISerializers = {
...WidgetModel.serializers,
}
}
// are supposed to be (and are in chrome) but those event properties have
// red box warnings in the MDN documentation that they are not part of any
// standard and are not on any standards tracks, so get what we need here.
var bounding_rect = view.el.getBoundingClientRect();
var y_offset = bounding_rect.top;
var x_offset = bounding_rect.left;
return {
'x': Math.round(event.clientX - x_offset),
'y': Math.round(event.clientY - y_offset)
}
}
export
class EventModel extends WidgetModel {
static serializers = {
...WidgetModel.serializers,
source: {deserialize: unpack_models}
}
defaults() {
return _.extend(super.defaults(), {
_model_name: 'EventModel',
_model_module: 'ipyevents',
_model_module_version: EXTENSION_SPEC_VERSION,
source: null,
watched_events: [],
ignore_modifier_key_events: false,
prevent_default_action: false,
xy_coordinate_system: null,
xy: [],
wait: 0,
throttle_or_debounce: null,
}
export
class VtkWidget extends WidgetModel {
defaults() {
return {...super.defaults(),
_model_module: VtkWidget.model_module,
_model_module_version: VtkWidget.model_module_version,
_view_module: VtkWidget.view_module,
_view_module_version: VtkWidget.view_module_version,
};
}
static serializers: ISerializers = {
...WidgetModel.serializers,
// Add any extra serializers here
}
static model_module = 'jupyter-vtk-datawidgets';
static model_module_version = JUPYTER_EXTENSION_VERSION;
static view_module = 'jupyter-vtk-datawidgets'; // Set to null if no view
static view_module_version = JUPYTER_EXTENSION_VERSION;
}
export
class DataArray extends VtkWidget {
defaults() {
return {...super.defaults(),
_model_name: DataArray.model_name,
name: null,
const themeName = this.get('_theme_name');
this.keys()
.filter(prop => !prop.startsWith('_'))
.forEach((prop) => {
vuetify.framework.theme.themes[themeName][prop] = convertColor(this.get(prop));
this.on(`change:${prop}`, () => {
vuetify.framework.theme.themes[themeName][prop] = convertColor(this.get(prop));
});
});
}
}
ThemeColorsModel.serializers = {
...WidgetModel.serializers,
};
function convertColor(colorStr) {
if (colorStr == null) {
return null;
}
if (colorStr.startsWith('colors')) {
const parts = colorStr.split('.').slice(1);
let result = colors;
parts.forEach(part => {
result = result[part];
});
return result;
* @param bundle The command bundle.
*/
private _removeCommand(bundle: { id: string }): void {
const { id } = bundle;
if (Private.customCommands.has(id)) {
Private.customCommands.get(id).dispose();
}
const commands = this.get('_commands').slice();
ArrayExt.removeAllWhere(commands, (w: any) => w.id === id);
this.set('_commands', commands);
this.save_changes();
this._sendCommandList();
}
static serializers: ISerializers = {
...WidgetModel.serializers,
};
static model_name = 'CommandRegistryModel';
static model_module = MODULE_NAME;
static model_module_version = MODULE_VERSION;
static view_name: string = null;
static view_module: string = null;
static view_module_version = MODULE_VERSION;
private _commands: CommandRegistry;
static commands: CommandRegistry;
}
/**
* A namespace for private data
}
case 'expandLeft': {
this._shell.expandLeft();
break;
}
case 'expandRight': {
this._shell.expandRight();
break;
}
default:
break;
}
}
static serializers: ISerializers = {
...WidgetModel.serializers,
};
static model_name = 'ShellModel';
static model_module = MODULE_NAME;
static model_module_version = MODULE_VERSION;
static view_name: string = null;
static view_module: string = null;
static view_module_version = MODULE_VERSION;
private _shell: ILabShell;
static shell: ILabShell;
}
private _sendSessions(): void {
this.set('sessions', toArray(this._sessions.running()));
this.save_changes();
}
/**
* send current session to backend
*/
private _sendCurrent(): void {
this._current_session = this._getSessionContext(this._shell.currentWidget);
this.set('current_session', this._current_session);
this.save_changes();
}
static serializers: ISerializers = {
...WidgetModel.serializers,
};
static model_name = 'SessionManagerModel';
static model_module = MODULE_NAME;
static model_module_version = MODULE_VERSION;
static view_name: string = null;
static view_module: string = null;
static view_module_version = MODULE_VERSION;
private _current_session: Session.IModel | {};
private _sessions: SessionManager;
static sessions: SessionManager;
private _shell: ILabShell;
static shell: ILabShell;
}