Socket
Socket
Sign inDemoInstall

@salesforcedevs/docs-components

Package Overview
Dependencies
Maintainers
12
Versions
625
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salesforcedevs/docs-components - npm Package Compare versions

Comparing version 1.3.296 to 1.3.300-amf-fix-alpha

src/modules/doc/amfTopic/cloneAmfObject.ts

4

package.json
{
"name": "@salesforcedevs/docs-components",
"version": "1.3.296",
"version": "1.3.300-amf-fix-alpha",
"description": "Docs Lightning web components for DSC",

@@ -27,3 +27,3 @@ "license": "MIT",

},
"gitHead": "7a3e47bb11802dbded4c5bd3814b408cbeedecd7"
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
}

@@ -12,3 +12,2 @@ import { LightningElement, api } from "lwc";

import { Json } from "typings/custom";
const TABLE_SIZE_MATCH = "769px";

@@ -19,3 +18,3 @@

private amf: Json;
private type: string | undefined;
private type: any;

@@ -32,3 +31,3 @@ @api

) {
this.amf = value && clone(value.amf);
this.amf = value && this.clone(value.amf);
}

@@ -39,3 +38,3 @@ if (

) {
this.type = value && clone(value.type);
this.type = value && this.getTypeCloned(value.type);
}

@@ -50,2 +49,48 @@

cloneWithWorker(value) {
return new Promise((resolve, reject) => {
const worker = new Worker("./cloneAmfObject.ts");
worker.onmessage = (event) => {
resolve(event.data);
worker.terminate();
};
worker.onerror = (error) => {
reject(error);
worker.terminate();
};
worker.postMessage(value);
});
}
/**
* The underlying web components we use from api-console mutate their models we pass in.
* Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
* @param value JSON Serializable object to clone.
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
*/
// function clone(value: any): any {
// return JSON.parse(JSON.stringify(value));
// }
async clone(value: any) {
try {
const clonedObject = await this.cloneWithWorker(value);
return clonedObject;
} catch (error) {
console.error("Error cloning value:", error);
return null;
}
}
async getTypeCloned(value: any) {
const typeObj = await this.clone(value.type);
if (typeObj) {
return typeObj;
}
return "";
}
update(): void {

@@ -113,11 +158,1 @@ if (!this.model) {

}
/**
* The underlying web components we use from api-console mutate their models we pass in.
* Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
* @param value JSON Serializable object to clone.
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
*/
function clone(value: any): any {
return JSON.parse(JSON.stringify(value));
}

@@ -115,12 +115,19 @@ import { LightningElement, api } from "lwc";

if (!this.observer) {
this.observer = new ResizeObserver((entries) => {
const [nav] = entries;
if (this.navWidth === nav.contentRect.width) {
return;
}
this.navWidth = nav.contentRect.width;
this.updateDropdownOptionAmount();
});
try {
this.observer = new ResizeObserver((entries) => {
const [nav] = entries;
if (this.navWidth === nav.contentRect.width) {
return;
}
this.navWidth = nav.contentRect.width;
this.updateDropdownOptionAmount();
});
this.observer.observe(this.template.querySelector("nav")!);
this.observer.observe(this.template.querySelector("nav")!);
} catch (error) {
console.error(
"Error occured while setting up ResizeObserver on breadcrumbs",
error
);
}
}

@@ -127,0 +134,0 @@ }

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