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

api-viewer-element

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-viewer-element - npm Package Compare versions

Comparing version 0.3.10 to 0.3.11

lib/lib/element-updated.d.ts

10

CHANGELOG.md

@@ -19,2 +19,12 @@ # Change Log

## [0.3.11] - 2020-02-04
### Changed
- Demo: wait for LitElement / Stencil update
### Fixed
- Demo: sync property knobs when true by default
## [0.3.10] - 2020-02-04

@@ -21,0 +31,0 @@

7

lib/api-viewer-demo-layout.js

@@ -249,3 +249,8 @@ import { __decorate } from "tslib";

this.props
.filter(prop => component[prop.name] !== getDefault(prop))
.filter(prop => {
const { name, type } = prop;
const defaultValue = getDefault(prop);
return (component[name] !== defaultValue ||
(normalizeType(type) === 'boolean' && defaultValue));
})
.forEach(prop => {

@@ -252,0 +257,0 @@ this._syncKnob(component, prop);

@@ -42,2 +42,28 @@ import { directive, NodePart } from 'lit-html';

};
const isDefinedPromise = (action) => typeof action === 'object' && Promise.resolve(action) === action;
/**
* Awaits for "update complete promises" of elements
* - for [lit-element](https://github.com/polymer/lit-element) that is `el.updateComplete`;
* - for [stencil](https://github.com/ionic-team/stencil/) that is `el.componentOnReady()`;
*
* If none of those Promise hooks are found, it will wait for `setTimeout`.
*/
async function elementUpdated(element) {
let hasSpecificAwait = false;
const el = element;
const litPromise = el.updateComplete;
if (isDefinedPromise(litPromise)) {
await litPromise;
hasSpecificAwait = true;
}
const stencilPromise = el.componentOnReady ? el.componentOnReady() : false;
if (isDefinedPromise(stencilPromise)) {
await stencilPromise;
hasSpecificAwait = true;
}
if (!hasSpecificAwait) {
await new Promise(resolve => setTimeout(() => resolve()));
}
return el;
}
export const renderer = directive((tag, knobs, slots, cssProps) => (part) => {

@@ -66,3 +92,3 @@ if (!(part instanceof NodePart)) {

// wait for rendering
setTimeout(() => {
elementUpdated(instance).then(() => {
instance.dispatchEvent(new CustomEvent('rendered', {

@@ -69,0 +95,0 @@ detail: {

2

package.json
{
"name": "api-viewer-element",
"version": "0.3.10",
"version": "0.3.11",
"description": "Web Components API viewer element",

@@ -5,0 +5,0 @@ "author": "Serhii Kulykov <iamkulykov@gmail.com>",

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