UNPKG

@shapediver/viewer.session

Version:

This is the npm package for the ShapeDiver Viewer Session API. For more information on ShapeDiver, please visit our [homepage](https://shapediver.com/).

169 lines 9.46 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _OutputApi_inputValidator, _OutputApi_logger, _OutputApi_output; Object.defineProperty(exports, "__esModule", { value: true }); exports.isOutputApi = exports.OutputApi = void 0; const viewer_shared_services_1 = require("@shapediver/viewer.shared.services"); const OutputApiData_1 = require("./data/OutputApiData"); class OutputApi { // #endregion Properties (3) // #region Constructors (1) constructor(output) { // #region Properties (3) _OutputApi_inputValidator.set(this, viewer_shared_services_1.InputValidator.instance); _OutputApi_logger.set(this, viewer_shared_services_1.Logger.instance); _OutputApi_output.set(this, void 0); __classPrivateFieldSet(this, _OutputApi_output, output, "f"); __classPrivateFieldGet(this, _OutputApi_output, "f").updateCallback = (newNode) => { if (newNode && newNode.data.findIndex((d) => d instanceof OutputApiData_1.OutputApiData) === -1) newNode.addData(new OutputApiData_1.OutputApiData(this)); }; __classPrivateFieldGet(this, _OutputApi_output, "f").updateCallback(this.node); } // #endregion Constructors (1) // #region Public Getters And Setters (28) get bbmax() { return __classPrivateFieldGet(this, _OutputApi_output, "f").bbmax; } get bbmin() { return __classPrivateFieldGet(this, _OutputApi_output, "f").bbmin; } get chunks() { return __classPrivateFieldGet(this, _OutputApi_output, "f").chunks; } get content() { return __classPrivateFieldGet(this, _OutputApi_output, "f").content; } get delay() { return __classPrivateFieldGet(this, _OutputApi_output, "f").delay; } get dependency() { return __classPrivateFieldGet(this, _OutputApi_output, "f").dependency; } get displayname() { return __classPrivateFieldGet(this, _OutputApi_output, "f").displayname; } set displayname(value) { const scope = "displayname"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "string", false); __classPrivateFieldGet(this, _OutputApi_output, "f").displayname = value; __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${__classPrivateFieldGet(this, _OutputApi_output, "f").displayname}.`); } get format() { return __classPrivateFieldGet(this, _OutputApi_output, "f").format; } get freeze() { return __classPrivateFieldGet(this, _OutputApi_output, "f").freeze; } set freeze(value) { const scope = "freeze"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "boolean"); __classPrivateFieldGet(this, _OutputApi_output, "f").freeze = value; __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${__classPrivateFieldGet(this, _OutputApi_output, "f").freeze}.`); } get hidden() { return __classPrivateFieldGet(this, _OutputApi_output, "f").hidden; } set hidden(value) { const scope = "hidden"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "boolean"); __classPrivateFieldGet(this, _OutputApi_output, "f").hidden = value; __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${__classPrivateFieldGet(this, _OutputApi_output, "f").hidden}.`); } get id() { return __classPrivateFieldGet(this, _OutputApi_output, "f").id; } get material() { return __classPrivateFieldGet(this, _OutputApi_output, "f").material; } get msg() { return __classPrivateFieldGet(this, _OutputApi_output, "f").msg; } get name() { return __classPrivateFieldGet(this, _OutputApi_output, "f").name; } get node() { return __classPrivateFieldGet(this, _OutputApi_output, "f").node; } get order() { return __classPrivateFieldGet(this, _OutputApi_output, "f").order; } set order(value) { const scope = "order"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "number", false); __classPrivateFieldGet(this, _OutputApi_output, "f").order = value; __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${__classPrivateFieldGet(this, _OutputApi_output, "f").order}.`); } get status_collect() { return __classPrivateFieldGet(this, _OutputApi_output, "f").status_collect; } get status_computation() { return __classPrivateFieldGet(this, _OutputApi_output, "f").status_computation; } get tooltip() { return __classPrivateFieldGet(this, _OutputApi_output, "f").tooltip; } set tooltip(value) { const scope = "tooltip"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "string", false); __classPrivateFieldGet(this, _OutputApi_output, "f").tooltip = value; __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${__classPrivateFieldGet(this, _OutputApi_output, "f").tooltip}.`); } get uid() { return __classPrivateFieldGet(this, _OutputApi_output, "f").uid; } get updateCallback() { return __classPrivateFieldGet(this, _OutputApi_output, "f").updateCallback; } set updateCallback(value) { const scope = "updateCallback"; if (value) __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, value, "function", false); __classPrivateFieldGet(this, _OutputApi_output, "f").updateCallback = (newNode, oldNode) => __awaiter(this, void 0, void 0, function* () { if (newNode && newNode.data.findIndex((d) => d instanceof OutputApiData_1.OutputApiData) === -1) newNode.addData(new OutputApiData_1.OutputApiData(this)); if (value) yield Promise.resolve(value(newNode, oldNode)); }); __classPrivateFieldGet(this, _OutputApi_logger, "f").debug(`OutputApi.${scope}: ${scope} was updated to ${value}.`); } get version() { return __classPrivateFieldGet(this, _OutputApi_output, "f").version; } // #endregion Public Getters And Setters (28) // #region Public Methods (1) updateOutputContent(outputContent, preventUpdate = false) { return __awaiter(this, void 0, void 0, function* () { const scope = "updateOutputContent"; __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, outputContent, "array"); __classPrivateFieldGet(this, _OutputApi_inputValidator, "f").validateAndError(`OutputApi.${scope}`, preventUpdate, "boolean"); return __classPrivateFieldGet(this, _OutputApi_output, "f").updateOutputContent(outputContent, preventUpdate); }); } } exports.OutputApi = OutputApi; _OutputApi_inputValidator = new WeakMap(), _OutputApi_logger = new WeakMap(), _OutputApi_output = new WeakMap(); const isOutputApi = (obj) => obj instanceof OutputApi; exports.isOutputApi = isOutputApi; //# sourceMappingURL=OutputApi.js.map