Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shapediver/viewer.shared.types

Package Overview
Dependencies
Maintainers
5
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapediver/viewer.shared.types - npm Package Compare versions

Comparing version 1.12.1 to 1.12.2

dist/events/ITaskEvent.d.ts

100

dist/data/HTMLElementAnchorData.d.ts
import { Box } from '@shapediver/viewer.shared.math';
import { AbstractTreeNodeData, ITreeNodeData } from '@shapediver/viewer.shared.node-tree';
import { vec3 } from 'gl-matrix';
interface AnchorDataImage {
import { vec2, vec3 } from 'gl-matrix';
export interface AnchorDataImage {
alt: string;

@@ -15,3 +15,3 @@ height: number;

}
interface AnchorDataText {
export interface AnchorDataText {
color: string | number | vec3;

@@ -26,9 +26,18 @@ hidden?: boolean;

}
export declare class HTMLElementAnchorData extends AbstractTreeNodeData {
export declare abstract class HTMLElementAnchorData extends AbstractTreeNodeData {
#private;
constructor(location: vec3, data: AnchorDataImage | AnchorDataText, format: 'text' | 'image', hideable?: boolean, viewers?: string[], intersectionTarget?: Box | string | string[], id?: string);
get data(): AnchorDataImage | AnchorDataText;
set data(value: AnchorDataImage | AnchorDataText);
get format(): 'text' | 'image';
set format(value: 'text' | 'image');
protected internalHtmlElement: HTMLDivElement;
constructor(properties: {
location: vec3;
data: AnchorDataImage | AnchorDataText | any;
format: 'text' | 'image' | 'custom';
hideable?: boolean;
viewers?: string[];
intersectionTarget?: Box | string | string[];
id?: string;
});
get data(): AnchorDataImage | AnchorDataText | any;
set data(value: AnchorDataImage | AnchorDataText | any);
get format(): 'text' | 'image' | 'custom';
set format(value: 'text' | 'image' | 'custom');
get hideable(): boolean;

@@ -42,10 +51,73 @@ set hideable(value: boolean);

set viewers(value: string[]);
clone(): ITreeNodeData;
createViewerHtmlElement(viewer: string): HTMLDivElement | null;
getViewerHtmlElement(viewer: string): HTMLDivElement | null;
update(): void;
private createImageElement;
private createTextElement;
update(properties: {
anchor: HTMLElementAnchorData;
htmlElement: HTMLDivElement;
page: vec2;
container: vec2;
client: vec2;
scale: vec2;
hidden: boolean;
}): void;
abstract clone(): ITreeNodeData;
}
export {};
export declare class HTMLElementAnchorTextData extends HTMLElementAnchorData {
constructor(properties: {
location: vec3;
data: AnchorDataText;
hideable?: boolean;
viewers?: string[];
intersectionTarget?: Box | string | string[];
id?: string;
});
clone(): ITreeNodeData;
private create;
}
export declare class HTMLElementAnchorImageData extends HTMLElementAnchorData {
constructor(properties: {
location: vec3;
data: AnchorDataImage;
hideable?: boolean;
viewers?: string[];
intersectionTarget?: Box | string | string[];
id?: string;
});
clone(): ITreeNodeData;
private create;
}
export declare class HTMLElementAnchorCustomData extends HTMLElementAnchorData {
#private;
constructor(properties: {
location: vec3;
data: any;
hideable?: boolean;
viewers?: string[];
intersectionTarget?: Box | string | string[];
id?: string;
create: (properties: {
anchor: HTMLElementAnchorData;
parent: HTMLDivElement;
}) => void;
update: (properties: {
anchor: HTMLElementAnchorData;
htmlElement: HTMLDivElement;
page: vec2;
container: vec2;
client: vec2;
scale: vec2;
hidden: boolean;
}) => void;
});
update(properties: {
anchor: HTMLElementAnchorData;
htmlElement: HTMLDivElement;
page: vec2;
container: vec2;
client: vec2;
scale: vec2;
hidden: boolean;
}): void;
clone(): ITreeNodeData;
}
//# sourceMappingURL=HTMLElementAnchorData.d.ts.map

199

dist/data/HTMLElementAnchorData.js

@@ -13,10 +13,9 @@ "use strict";

};
var _HTMLElementAnchorData_htmlElement, _HTMLElementAnchorData_viewerHtmlElement, _HTMLElementAnchorData_data, _HTMLElementAnchorData_format, _HTMLElementAnchorData_hideable, _HTMLElementAnchorData_intersectionTarget, _HTMLElementAnchorData_location, _HTMLElementAnchorData_viewers;
var _HTMLElementAnchorData_viewerHtmlElement, _HTMLElementAnchorData_data, _HTMLElementAnchorData_format, _HTMLElementAnchorData_hideable, _HTMLElementAnchorData_intersectionTarget, _HTMLElementAnchorData_location, _HTMLElementAnchorData_viewers, _HTMLElementAnchorCustomData_create, _HTMLElementAnchorCustomData_update;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HTMLElementAnchorData = void 0;
exports.HTMLElementAnchorCustomData = exports.HTMLElementAnchorImageData = exports.HTMLElementAnchorTextData = exports.HTMLElementAnchorData = void 0;
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
class HTMLElementAnchorData extends viewer_shared_node_tree_1.AbstractTreeNodeData {
constructor(location, data, format, hideable = true, viewers = [], intersectionTarget, id) {
super(id);
_HTMLElementAnchorData_htmlElement.set(this, void 0);
constructor(properties) {
super(properties.id);
_HTMLElementAnchorData_viewerHtmlElement.set(this, {});

@@ -29,22 +28,18 @@ _HTMLElementAnchorData_data.set(this, void 0);

_HTMLElementAnchorData_viewers.set(this, []);
__classPrivateFieldSet(this, _HTMLElementAnchorData_location, location, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_data, data, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_format, format, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_hideable, hideable, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_viewers, viewers, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_intersectionTarget, intersectionTarget, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_htmlElement, document.createElement('div'), "f");
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.display = 'none';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.userSelect = 'none';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.cursor = 'default';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.pointerEvents = 'none';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.position = 'absolute';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.fontFamily = '"Helvetica Neue", Helvetica, Arial, sans-serif';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.whiteSpace = 'nowrap';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").style.textOverflow = 'clip';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").classList.add('shapediver-domElement');
if (this.format === 'text')
this.createTextElement(this.data);
if (this.format === 'image')
this.createImageElement(this.data);
__classPrivateFieldSet(this, _HTMLElementAnchorData_location, properties.location, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_data, properties.data, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_format, properties.format, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_hideable, properties.hideable === undefined ? true : properties.hideable, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_viewers, properties.viewers || [], "f");
__classPrivateFieldSet(this, _HTMLElementAnchorData_intersectionTarget, properties.intersectionTarget, "f");
this.internalHtmlElement = document.createElement('div');
this.internalHtmlElement.style.display = 'none';
this.internalHtmlElement.style.userSelect = 'none';
this.internalHtmlElement.style.cursor = 'default';
this.internalHtmlElement.style.pointerEvents = 'none';
this.internalHtmlElement.style.position = 'absolute';
this.internalHtmlElement.style.fontFamily = '"Helvetica Neue", Helvetica, Arial, sans-serif';
this.internalHtmlElement.style.whiteSpace = 'nowrap';
this.internalHtmlElement.style.textOverflow = 'clip';
this.internalHtmlElement.classList.add('shapediver-domElement');
}

@@ -87,5 +82,2 @@ get data() {

}
clone() {
return new HTMLElementAnchorData(this.location, this.data, this.format, this.hideable, this.viewers, this.intersectionTarget, this.id);
}
createViewerHtmlElement(viewer) {

@@ -95,3 +87,3 @@ if (__classPrivateFieldGet(this, _HTMLElementAnchorData_viewerHtmlElement, "f")[viewer])

if (this.viewers.includes(viewer) || this.viewers.length === 0) {
__classPrivateFieldGet(this, _HTMLElementAnchorData_viewerHtmlElement, "f")[viewer] = __classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").cloneNode(true);
__classPrivateFieldGet(this, _HTMLElementAnchorData_viewerHtmlElement, "f")[viewer] = this.internalHtmlElement.cloneNode(true);
return __classPrivateFieldGet(this, _HTMLElementAnchorData_viewerHtmlElement, "f")[viewer];

@@ -106,26 +98,67 @@ }

}
update() {
update(properties) {
properties.htmlElement.style.display = '';
if (this.hideable && properties.hidden)
properties.htmlElement.style.display = 'none';
let x, y;
if (this.data.position && this.data.position.horizontal === 'right') {
x = properties.container[0] - properties.htmlElement.offsetWidth;
}
else if (this.data.position && this.data.position.horizontal === 'left') {
x = properties.container[0];
}
else {
x = properties.container[0] - properties.htmlElement.offsetWidth / 2;
}
if (this.data.position && this.data.position.vertical === 'bottom') {
y = properties.container[1] - properties.htmlElement.offsetHeight;
}
else if (this.data.position && this.data.position.vertical === 'top') {
y = properties.container[1];
}
else {
y = properties.container[1] - properties.htmlElement.offsetHeight / 2;
}
x = x / properties.scale[0];
y = y / properties.scale[1];
properties.htmlElement.style.left = x + 'px';
properties.htmlElement.style.top = y + 'px';
}
createImageElement(data) {
const img = document.createElement('img');
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").appendChild(img);
img.src = data.src;
if (data.height)
img.height = data.height;
if (data.width)
img.width = data.width;
if (data.alt)
img.alt = data.alt;
}
exports.HTMLElementAnchorData = HTMLElementAnchorData;
_HTMLElementAnchorData_viewerHtmlElement = new WeakMap(), _HTMLElementAnchorData_data = new WeakMap(), _HTMLElementAnchorData_format = new WeakMap(), _HTMLElementAnchorData_hideable = new WeakMap(), _HTMLElementAnchorData_intersectionTarget = new WeakMap(), _HTMLElementAnchorData_location = new WeakMap(), _HTMLElementAnchorData_viewers = new WeakMap();
class HTMLElementAnchorTextData extends HTMLElementAnchorData {
constructor(properties) {
super({
location: properties.location,
data: properties.data,
format: 'text',
hideable: properties.hideable,
viewers: properties.viewers,
intersectionTarget: properties.intersectionTarget,
id: properties.id,
});
this.create({ anchor: this, parent: this.internalHtmlElement });
}
createTextElement(data) {
clone() {
return new HTMLElementAnchorTextData({
location: this.location,
data: this.data,
hideable: this.hideable,
viewers: this.viewers,
intersectionTarget: this.intersectionTarget,
id: this.id,
});
}
create(properties) {
var _a;
const span = document.createElement('span');
span.style.color = (_a = data.color) === null || _a === void 0 ? void 0 : _a.toString();
span.innerHTML = data.text;
span.style.color = (_a = properties.anchor.data.color) === null || _a === void 0 ? void 0 : _a.toString();
span.innerHTML = properties.anchor.data.text;
span.style.display = 'block';
span.style.textOverflow = 'clip';
span.style.overflow = 'hidden';
__classPrivateFieldGet(this, _HTMLElementAnchorData_htmlElement, "f").appendChild(span);
if (data.textAlign && (data.textAlign === 'right' || data.textAlign === 'center')) {
span.style.textAlign = data.textAlign;
properties.parent.appendChild(span);
if (properties.anchor.data.textAlign && (properties.anchor.data.textAlign === 'right' || properties.anchor.data.textAlign === 'center')) {
span.style.textAlign = properties.anchor.data.textAlign;
}

@@ -137,4 +170,74 @@ else {

}
exports.HTMLElementAnchorData = HTMLElementAnchorData;
_HTMLElementAnchorData_htmlElement = new WeakMap(), _HTMLElementAnchorData_viewerHtmlElement = new WeakMap(), _HTMLElementAnchorData_data = new WeakMap(), _HTMLElementAnchorData_format = new WeakMap(), _HTMLElementAnchorData_hideable = new WeakMap(), _HTMLElementAnchorData_intersectionTarget = new WeakMap(), _HTMLElementAnchorData_location = new WeakMap(), _HTMLElementAnchorData_viewers = new WeakMap();
exports.HTMLElementAnchorTextData = HTMLElementAnchorTextData;
class HTMLElementAnchorImageData extends HTMLElementAnchorData {
constructor(properties) {
super({
location: properties.location,
data: properties.data,
format: 'image',
hideable: properties.hideable,
viewers: properties.viewers,
intersectionTarget: properties.intersectionTarget,
id: properties.id,
});
this.create({ anchor: this, parent: this.internalHtmlElement });
}
clone() {
return new HTMLElementAnchorImageData({
location: this.location,
data: this.data,
hideable: this.hideable,
viewers: this.viewers,
intersectionTarget: this.intersectionTarget,
id: this.id,
});
}
create(properties) {
const img = document.createElement('img');
properties.parent.appendChild(img);
img.src = properties.anchor.data.src;
if (properties.anchor.data.height)
img.height = properties.anchor.data.height;
if (properties.anchor.data.width)
img.width = properties.anchor.data.width;
if (properties.anchor.data.alt)
img.alt = properties.anchor.data.alt;
}
}
exports.HTMLElementAnchorImageData = HTMLElementAnchorImageData;
class HTMLElementAnchorCustomData extends HTMLElementAnchorData {
constructor(properties) {
super({
location: properties.location,
data: properties.data,
format: 'custom',
hideable: properties.hideable,
viewers: properties.viewers,
intersectionTarget: properties.intersectionTarget,
id: properties.id,
});
_HTMLElementAnchorCustomData_create.set(this, void 0);
_HTMLElementAnchorCustomData_update.set(this, void 0);
__classPrivateFieldSet(this, _HTMLElementAnchorCustomData_create, properties.create, "f");
__classPrivateFieldSet(this, _HTMLElementAnchorCustomData_update, properties.update, "f");
__classPrivateFieldGet(this, _HTMLElementAnchorCustomData_create, "f").call(this, { anchor: this, parent: this.internalHtmlElement });
}
update(properties) {
__classPrivateFieldGet(this, _HTMLElementAnchorCustomData_update, "f").call(this, properties);
}
clone() {
return new HTMLElementAnchorCustomData({
location: this.location,
data: this.data,
hideable: this.hideable,
viewers: this.viewers,
intersectionTarget: this.intersectionTarget,
id: this.id,
create: __classPrivateFieldGet(this, _HTMLElementAnchorCustomData_create, "f"),
update: __classPrivateFieldGet(this, _HTMLElementAnchorCustomData_update, "f"),
});
}
}
exports.HTMLElementAnchorCustomData = HTMLElementAnchorCustomData;
_HTMLElementAnchorCustomData_create = new WeakMap(), _HTMLElementAnchorCustomData_update = new WeakMap();
//# sourceMappingURL=HTMLElementAnchorData.js.map
import { CustomData } from './data/CustomData';
import { AttributeData, GeometryData, PRIMITIVE_MODE, PrimitiveData } from './data/GeometryData';
import { MapData, MATERIAL_ALPHA, MATERIAL_SHADING, MATERIAL_SIDE, MaterialData, TEXTURE_FILTERING, TEXTURE_WRAPPING } from './data/MaterialData';
import { HTMLElementAnchorData } from './data/HTMLElementAnchorData';
import { AnchorDataImage, AnchorDataText, HTMLElementAnchorCustomData, HTMLElementAnchorData, HTMLElementAnchorImageData, HTMLElementAnchorTextData } from './data/HTMLElementAnchorData';
import { GEOMETRYTYPEHINT, PRIMITIVETYPEHINT, SDTFAttributeData, SDTFAttributesData } from './data/sdtf/SDTFAttributesData';

@@ -16,8 +16,9 @@ import { SDTFItemData } from './data/sdtf/SDTFItemData';

import { ISettingsEvent } from './events/ISettingsEvent';
import { ITaskEvent, TASKTYPE } from './events/ITaskEvent';
export { MaterialData, MapData, MATERIAL_SIDE, MATERIAL_ALPHA, MATERIAL_SHADING, TEXTURE_WRAPPING, TEXTURE_FILTERING };
export { AnimationData, AnimationTrack, GeometryData, AttributeData, PrimitiveData, PRIMITIVE_MODE };
export { HTMLElementAnchorData };
export { AnchorDataImage, AnchorDataText, HTMLElementAnchorCustomData, HTMLElementAnchorTextData, HTMLElementAnchorImageData, HTMLElementAnchorData };
export { CustomData };
export { IViewerEvent, ISessionEvent, ICameraEvent, IEnvironmentEvent, ISceneEvent, ISettingsEvent };
export { IViewerEvent, ISessionEvent, ICameraEvent, IEnvironmentEvent, ISceneEvent, ISettingsEvent, ITaskEvent, TASKTYPE };
export { SDTFAttributeOverview, SDTFOverview, SDTFAttributesData, SDTFAttributeVisualizationData, SDTFAttributeVisualization, ATTRIBUTEVISUALIZATION, SDTFAttributeData, SDTFItemData, PRIMITIVETYPEHINT, GEOMETRYTYPEHINT };
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GEOMETRYTYPEHINT = exports.PRIMITIVETYPEHINT = exports.SDTFItemData = exports.SDTFAttributeData = exports.ATTRIBUTEVISUALIZATION = exports.SDTFAttributeVisualization = exports.SDTFAttributesData = exports.SDTFAttributeOverview = exports.CustomData = exports.HTMLElementAnchorData = exports.PRIMITIVE_MODE = exports.PrimitiveData = exports.AttributeData = exports.GeometryData = exports.AnimationData = exports.TEXTURE_FILTERING = exports.TEXTURE_WRAPPING = exports.MATERIAL_SHADING = exports.MATERIAL_ALPHA = exports.MATERIAL_SIDE = exports.MapData = exports.MaterialData = void 0;
exports.GEOMETRYTYPEHINT = exports.PRIMITIVETYPEHINT = exports.SDTFItemData = exports.SDTFAttributeData = exports.ATTRIBUTEVISUALIZATION = exports.SDTFAttributeVisualization = exports.SDTFAttributesData = exports.SDTFAttributeOverview = exports.TASKTYPE = exports.CustomData = exports.HTMLElementAnchorData = exports.HTMLElementAnchorImageData = exports.HTMLElementAnchorTextData = exports.HTMLElementAnchorCustomData = exports.PRIMITIVE_MODE = exports.PrimitiveData = exports.AttributeData = exports.GeometryData = exports.AnimationData = exports.TEXTURE_FILTERING = exports.TEXTURE_WRAPPING = exports.MATERIAL_SHADING = exports.MATERIAL_ALPHA = exports.MATERIAL_SIDE = exports.MapData = exports.MaterialData = void 0;
const CustomData_1 = require("./data/CustomData");

@@ -20,3 +20,6 @@ Object.defineProperty(exports, "CustomData", { enumerable: true, get: function () { return CustomData_1.CustomData; } });

const HTMLElementAnchorData_1 = require("./data/HTMLElementAnchorData");
Object.defineProperty(exports, "HTMLElementAnchorCustomData", { enumerable: true, get: function () { return HTMLElementAnchorData_1.HTMLElementAnchorCustomData; } });
Object.defineProperty(exports, "HTMLElementAnchorData", { enumerable: true, get: function () { return HTMLElementAnchorData_1.HTMLElementAnchorData; } });
Object.defineProperty(exports, "HTMLElementAnchorImageData", { enumerable: true, get: function () { return HTMLElementAnchorData_1.HTMLElementAnchorImageData; } });
Object.defineProperty(exports, "HTMLElementAnchorTextData", { enumerable: true, get: function () { return HTMLElementAnchorData_1.HTMLElementAnchorTextData; } });
const SDTFAttributesData_1 = require("./data/sdtf/SDTFAttributesData");

@@ -36,2 +39,4 @@ Object.defineProperty(exports, "GEOMETRYTYPEHINT", { enumerable: true, get: function () { return SDTFAttributesData_1.GEOMETRYTYPEHINT; } });

Object.defineProperty(exports, "AnimationData", { enumerable: true, get: function () { return AnimationData_1.AnimationData; } });
const ITaskEvent_1 = require("./events/ITaskEvent");
Object.defineProperty(exports, "TASKTYPE", { enumerable: true, get: function () { return ITaskEvent_1.TASKTYPE; } });
//# sourceMappingURL=index.js.map
{
"name": "@shapediver/viewer.shared.types",
"version": "1.12.1",
"version": "1.12.2",
"description": "",

@@ -39,9 +39,9 @@ "keywords": [],

"dependencies": {
"@shapediver/viewer.shared.math": "1.12.1",
"@shapediver/viewer.shared.node-tree": "1.12.1",
"@shapediver/viewer.shared.services": "1.12.1",
"@shapediver/viewer.shared.math": "1.12.2",
"@shapediver/viewer.shared.node-tree": "1.12.2",
"@shapediver/viewer.shared.services": "1.12.2",
"gl-matrix": "3.3.0",
"tsyringe": "^4.5.0"
},
"gitHead": "a7b934141141a8bef0f74e689fef76ac27a14427"
"gitHead": "ab7cbbb2e4fd03e657793e48df89ec218ce51a00"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc