@gmetrixr/rjson
Version:
(R)ecursive Json
239 lines (238 loc) • 8.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sourcePropertyNames = exports.BasicElement = exports.isElementType = exports.elementTypeByCategory = exports.elementsWithLinkedVariables = exports.elementCategoryDisplayNames = exports.ElementCategory = exports.elementDisplayNames = exports.ElementType = void 0;
const Element_1 = require("../../recordTypes/Element");
const Item_1 = require("../../recordTypes/Item");
const rules_1 = require("../rules");
const rules_2 = require("../rules");
var ElementType;
(function (ElementType) {
ElementType["basic_element"] = "basic_element";
ElementType["image_flat"] = "image_flat";
ElementType["video_flat"] = "video_flat";
ElementType["audio"] = "audio";
ElementType["audio_ssml"] = "audio_ssml";
ElementType["text"] = "text";
ElementType["object_3d"] = "object_3d";
ElementType["collider_mesh"] = "collider_mesh";
ElementType["score"] = "score";
ElementType["timer"] = "timer";
ElementType["menu"] = "menu";
ElementType["gif"] = "gif";
ElementType["pano_image"] = "pano_image";
ElementType["pano_video"] = "pano_video";
ElementType["polygon"] = "polygon";
ElementType["cube"] = "cube";
ElementType["sphere"] = "sphere";
ElementType["cone"] = "cone";
ElementType["torus"] = "torus";
ElementType["cylinder"] = "cylinder";
ElementType["carousel"] = "carousel";
ElementType["wayfinder"] = "wayfinder";
ElementType["icon"] = "icon";
ElementType["speech"] = "speech";
ElementType["actionbar"] = "actionbar";
ElementType["product_card"] = "product_card";
ElementType["quiz"] = "quiz";
ElementType["group"] = "group";
ElementType["qrcode_browser"] = "qrcode_browser";
ElementType["qrcode_matcher"] = "qrcode_matcher";
ElementType["media_upload"] = "media_upload";
ElementType["web_state"] = "web_state";
ElementType["capture_input"] = "capture_input";
ElementType["share"] = "share";
ElementType["embed_html"] = "embed_html";
ElementType["ar"] = "ar";
ElementType["embed_scorm"] = "embed_scorm";
ElementType["instruction"] = "instruction";
ElementType["shopping_item"] = "shopping_item";
ElementType["popup"] = "popup";
ElementType["light"] = "light";
ElementType["hotspot"] = "hotspot";
ElementType["environment"] = "environment";
ElementType["zone"] = "zone";
ElementType["collider_box"] = "collider_box";
ElementType["collider_volume"] = "collider_volume";
ElementType["workspace_logo"] = "workspace_logo";
ElementType["screenshare"] = "screenshare";
ElementType["character"] = "character";
ElementType["embed_3d"] = "embed_3d";
})(ElementType = exports.ElementType || (exports.ElementType = {}));
exports.elementDisplayNames = {
basic_element: "Basic Element",
pano_image: "Image 360",
pano_video: "Video 360",
image_flat: "Image",
video_flat: "Video",
text: "Text",
gif: "GIF",
icon: "Emoji",
audio: "Audio",
audio_ssml: "Text-to-Speech",
object_3d: "3D Model",
collider_mesh: "Collider Mesh",
polygon: "Polygon",
cube: "Cube",
sphere: "Sphere",
cone: "Cone",
torus: "Torus",
cylinder: "Cylinder",
light: "Light",
ar: "AR",
qrcode_browser: "QR Browser",
qrcode_matcher: "QR Matcher",
wayfinder: "Wayfinder",
score: "Score",
timer: "Timer",
quiz: "Quiz",
speech: "Voice Recognition",
capture_input: "Capture Input",
media_upload: "Media Upload",
actionbar: "Actionbar",
popup: "Pop-up",
product_card: "Product Card",
instruction: "Story",
embed_html: "Embed HTML",
share: "Share",
embed_scorm: "SCORM",
shopping_item: "Shopping Item",
menu: "Menu",
carousel: "Pop-up",
group: "Group",
web_state: "Web State",
hotspot: "Hotspot",
environment: "Environment",
zone: "Zone",
collider_box: "Collider Volume",
collider_volume: "Collider Volume",
workspace_logo: "Workspace Logo",
screenshare: "Screenshare",
character: "Character",
embed_3d: "Embed 3D",
};
var ElementCategory;
(function (ElementCategory) {
ElementCategory["panorama"] = "panorama";
ElementCategory["standard"] = "standard";
ElementCategory["audio"] = "audio";
ElementCategory["three_d"] = "three_d";
ElementCategory["spatial"] = "spatial";
ElementCategory["gamification"] = "gamification";
ElementCategory["user_input"] = "user_input";
ElementCategory["user_interface"] = "user_interface";
ElementCategory["connect"] = "connect";
ElementCategory["ecommerce"] = "ecommerce";
})(ElementCategory = exports.ElementCategory || (exports.ElementCategory = {}));
exports.elementCategoryDisplayNames = {
panorama: "Panorama",
standard: "Standard",
audio: "Audio",
three_d: "3D",
spatial: "Spatial",
gamification: "Gamification",
user_input: "User Input",
user_interface: "User Interface",
connect: "Connect",
ecommerce: "E-Commerce",
};
exports.elementsWithLinkedVariables = [
ElementType.embed_scorm,
ElementType.media_upload
];
exports.elementTypeByCategory = {
panorama: [
ElementType.pano_image,
ElementType.pano_video,
],
standard: [
ElementType.image_flat,
ElementType.video_flat,
ElementType.text,
ElementType.gif,
ElementType.icon,
ElementType.hotspot,
ElementType.workspace_logo,
],
audio: [
ElementType.audio,
ElementType.audio_ssml,
],
three_d: [
ElementType.object_3d,
ElementType.polygon,
ElementType.cube,
ElementType.sphere,
ElementType.cone,
ElementType.torus,
ElementType.cylinder,
ElementType.light,
ElementType.zone,
ElementType.collider_volume,
ElementType.collider_mesh,
ElementType.screenshare,
ElementType.character,
ElementType.embed_3d,
],
spatial: [
ElementType.ar,
ElementType.qrcode_browser,
ElementType.qrcode_matcher,
],
gamification: [
ElementType.score,
ElementType.timer,
ElementType.quiz,
],
user_input: [
ElementType.speech,
ElementType.capture_input,
ElementType.media_upload,
],
user_interface: [
ElementType.actionbar,
ElementType.popup,
ElementType.product_card,
ElementType.instruction,
],
connect: [
ElementType.embed_html,
ElementType.share,
ElementType.embed_scorm,
],
ecommerce: [
ElementType.shopping_item,
],
};
/**
* https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates
* Useful while trying to use the ".type" property of an "untyped" json
*/
function isElementType(type) {
return ElementType[type] !== undefined;
}
exports.isElementType = isElementType;
exports.BasicElement = {
element_type: ElementType.basic_element,
elementDefaultName: "Basic Element",
properties: [Element_1.ElementProperty.element_type],
defaultOverrides: {},
events: [
rules_2.RuleEvent.on_click,
rules_2.RuleEvent.on_been_clicked,
rules_2.RuleEvent.on_hover
],
actions: [
rules_1.RuleAction.show,
rules_1.RuleAction.hide,
rules_1.RuleAction.toggle_showhide,
]
};
/** A list of properties that contain the type en.Source or en.Source[] */
exports.sourcePropertyNames = {
/** A list of all ElementProperties that end with the word "source". Use to understand which properties contain file source objects */
elementProperties: [Element_1.ElementProperty.source, Element_1.ElementProperty.background_source, Element_1.ElementProperty.threed_source],
/** A list of all ElementProperties that end with the word "sources". Use to understand which properties contain file source object arrays */
elementArrayProperties: [Element_1.ElementProperty.image_sources],
/** A list of all ItemProperties that end with the word "source". Use to understand which properties contain file source objects */
itemProperties: [Item_1.ItemProperty.item_source],
};