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

@builder.io/react

Package Overview
Dependencies
Maintainers
1
Versions
1243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builder.io/react - npm Package Compare versions

Comparing version 0.1.62 to 0.1.63-0

39

dist/lib/blocks/Image.js

@@ -35,3 +35,3 @@ "use strict";

Image.prototype.render = function () {
var aspectRatio = this.props.aspectRatio;
var _a = this.props, aspectRatio = _a.aspectRatio, builderBlock = _a.builderBlock;
// TODO: add height and width params to image

@@ -80,3 +80,38 @@ return (react_1.default.createElement("div", { style: { position: 'relative', fontSize: 0 } },

// TODO: something better
defaultValue: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d'
defaultValue: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
onChange: function (options) {
function loadImage(url, timeout) {
if (timeout === void 0) { timeout = 60000; }
return new Promise(function (resolve, reject) {
var img = document.createElement('img');
var loaded = false;
img.onload = function () {
loaded = true;
resolve(img);
};
img.addEventListener('error', function (event) {
console.warn('Image load failed', event.error);
reject(event.error);
});
img.src = url;
setTimeout(function () {
if (!loaded) {
reject(new Error('Image load timed out'));
}
}, timeout);
});
}
// // TODO
var value = options.get('image');
var aspectRatio = options.get('aspectRatio');
if (value && !aspectRatio) {
return loadImage(value).then(function (img) {
if (options.get('image') === value && !options.get('aspectRatio')) {
if (img.width && img.height) {
options.set('aspectRatio', img.width / img.height);
}
}
});
}
}
},

@@ -83,0 +118,0 @@ {

19

dist/lib/decorators/builder-block.decorator.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_1 = require("@builder.io/sdk");
// import omit from 'lodash-es/omit';
var omit_1 = require("lodash-es/omit");
function BuilderBlock(options) {
options.type = 'react';
return function (target) {
if (!options.name) {
options.name = target.name;
}
options.class = target;
if (!sdk_1.Builder.components.find(function (item) { return item.name === options.name; })) {
sdk_1.Builder.components.push(options);
}
if (sdk_1.Builder.isIframe) {
window.parent.postMessage({
type: 'builder.registerComponent',
data: omit_1.default(options, 'class')
}, '*');
}
return target;
};
return sdk_1.Builder.Component(options);
}
exports.BuilderBlock = BuilderBlock;
//# sourceMappingURL=builder-block.decorator.js.map
import { Component } from '@builder.io/sdk';
interface ReactComponent extends Component {
}
export declare function BuilderBlock(options: ReactComponent): (target: any) => any;
export declare function BuilderBlock(options: ReactComponent): (component: import("../../node_modules/@builder.io/sdk/dist/clients/js/src/builder.class").Class) => void;
export {};
{
"name": "@builder.io/react",
"version": "0.1.62",
"version": "0.1.63-0",
"description": "",

@@ -120,3 +120,3 @@ "keywords": [],

"dependencies": {
"@builder.io/sdk": "^0.1.16",
"@builder.io/sdk": "^0.1.22",
"@types/react": "^16.4.1",

@@ -123,0 +123,0 @@ "core-js": "^2.5.7",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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