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

@belle-icon/component

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@belle-icon/component - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/belle-icon/p-2d8ce54c.js

2

dist/belle-icon/belle-icon.esm.js

@@ -1,1 +0,1 @@

import{p as o,b as r}from"./p-f3f414f0.js";(()=>{const r=import.meta.url,a={};return""!==r&&(a.resourcesUrl=new URL(".",r).href),o(a)})().then((o=>r([["p-777a3dab",[[0,"be-icon",{name:[1],stroke:[2],size:[2],color:[1],cap:[1],join:[1]}]]]],o)));
import{p as o,b as e}from"./p-2d8ce54c.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),o(r)})().then((o=>e([["p-b716d9a5",[[0,"be-icon",{name:[1],stroke:[2],size:[2],color:[1],cap:[1],join:[1]}]]]],o)));

@@ -5,22 +5,12 @@ 'use strict';

const index = require('./index-7455e682.js');
const index = require('./index-a93cd328.js');
class Store {
class HttpBackend {
constructor() {
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
this.baseUrl = this.getBaseUrl();
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
getBaseUrl() {
const el = document.querySelector(`[${Store.URL_ATTR}]`);
const el = document.querySelector(`[${HttpBackend.URL_ATTR}]`);
if (el) {
return el.getAttribute(Store.URL_ATTR);
return el.getAttribute(HttpBackend.URL_ATTR);
}

@@ -50,2 +40,21 @@ return 'https://unpkg.com/@belle-icon/icons/svg';

}
}
HttpBackend.URL_ATTR = 'bi-src';
const httpBackend = new HttpBackend();
class Store {
constructor() {
var _a;
this.backend = (_a = window.biBackend) !== null && _a !== void 0 ? _a : httpBackend;
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
async requestSymbol(name) {

@@ -55,3 +64,3 @@ if (this.symbolKeySet.has(name))

this.symbolKeySet.add(name);
const iconText = await this.fetchIcon(name);
const iconText = await this.backend.fetchIcon(name);
const symbol = document.createElement('symbol');

@@ -65,3 +74,2 @@ symbol.id = name;

Store.CLS_NAME = 'belle-icon-svg';
Store.URL_ATTR = 'bi-src';
const store = new Store();

@@ -71,3 +79,3 @@

const BelleIcon = class {
let BelleIcon = class {
constructor(hostRef) {

@@ -74,0 +82,0 @@ index.registerInstance(this, hostRef);

'use strict';
const index = require('./index-7455e682.js');
const index = require('./index-a93cd328.js');
/*
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Browser v2.10.0 | MIT Licensed | https://stenciljs.com
*/

@@ -8,0 +8,0 @@ const patchBrowser = () => {

@@ -5,6 +5,6 @@ 'use strict';

const index = require('./index-7455e682.js');
const index = require('./index-a93cd328.js');
/*
Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Esm v2.10.0 | MIT Licensed | https://stenciljs.com
*/

@@ -11,0 +11,0 @@ const patchEsm = () => {

@@ -7,4 +7,4 @@ {

"name": "@stencil/core",
"version": "2.8.1",
"typescriptVersion": "4.2.3"
"version": "2.10.0",
"typescriptVersion": "4.3.5"
},

@@ -11,0 +11,0 @@ "collections": [],

@@ -0,3 +1,6 @@

import { httpBackend } from "./backend";
class Store {
constructor() {
var _a;
this.backend = (_a = window.biBackend) !== null && _a !== void 0 ? _a : httpBackend;
this.symbolKeySet = new Set();

@@ -10,3 +13,2 @@ this.clearExpiredElements();

this.$container.classList.add(Store.CLS_NAME);
this.baseUrl = this.getBaseUrl();
}

@@ -16,30 +18,2 @@ clearExpiredElements() {

}
getBaseUrl() {
const el = document.querySelector(`[${Store.URL_ATTR}]`);
if (el) {
return el.getAttribute(Store.URL_ATTR);
}
return 'https://unpkg.com/@belle-icon/icons/svg';
}
async fetchIcon(name) {
// TODO: temp disable cache
// const cache = window.localStorage.getItem('belle:' + name)
// if (cache) return cache
const [pack, key] = name.split(':');
const url = `${this.baseUrl}/${pack}/${key}.svg`;
const res = await fetch(url, {
method: 'GET',
mode: 'cors',
credentials: 'omit',
});
if (!res.ok)
return '';
const data = await res.text();
// Remove self-closing tag
const clean = data.replace(/<(([a-z]+) [^\/>]+)\/>/g, '<$1></$2>');
window.localStorage.setItem('belle:' + name, clean);
// TODO: cache invalidation
// TODO: cached icon cannot be displayed when offline
return clean;
}
async requestSymbol(name) {

@@ -49,3 +23,3 @@ if (this.symbolKeySet.has(name))

this.symbolKeySet.add(name);
const iconText = await this.fetchIcon(name);
const iconText = await this.backend.fetchIcon(name);
const symbol = document.createElement('symbol');

@@ -59,3 +33,2 @@ symbol.id = name;

Store.CLS_NAME = 'belle-icon-svg';
Store.URL_ATTR = 'bi-src';
export const store = new Store();
/* BelleIcon custom elements bundle */
import type { Components, JSX } from "../types/components";
import type { Components, JSX } from "../types/global";

@@ -5,0 +5,0 @@ interface BeIcon extends Components.BeIcon, HTMLElement {}

import { h, proxyCustomElement } from '@stencil/core/internal/client';
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
class Store {
class HttpBackend {
constructor() {
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
this.baseUrl = this.getBaseUrl();
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
getBaseUrl() {
const el = document.querySelector(`[${Store.URL_ATTR}]`);
const el = document.querySelector(`[${HttpBackend.URL_ATTR}]`);
if (el) {
return el.getAttribute(Store.URL_ATTR);
return el.getAttribute(HttpBackend.URL_ATTR);
}

@@ -46,2 +36,21 @@ return 'https://unpkg.com/@belle-icon/icons/svg';

}
}
HttpBackend.URL_ATTR = 'bi-src';
const httpBackend = new HttpBackend();
class Store {
constructor() {
var _a;
this.backend = (_a = window.biBackend) !== null && _a !== void 0 ? _a : httpBackend;
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
async requestSymbol(name) {

@@ -51,3 +60,3 @@ if (this.symbolKeySet.has(name))

this.symbolKeySet.add(name);
const iconText = await this.fetchIcon(name);
const iconText = await this.backend.fetchIcon(name);
const symbol = document.createElement('symbol');

@@ -61,3 +70,2 @@ symbol.id = name;

Store.CLS_NAME = 'belle-icon-svg';
Store.URL_ATTR = 'bi-src';
const store = new Store();

@@ -67,3 +75,3 @@

const BelleIcon = class extends HTMLElement {
let BelleIcon = class extends HTMLElement {
constructor() {

@@ -70,0 +78,0 @@ super();

@@ -1,21 +0,11 @@

import { r as registerInstance, h } from './index-e69c5d53.js';
import { r as registerInstance, h } from './index-460bf030.js';
class Store {
class HttpBackend {
constructor() {
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
this.baseUrl = this.getBaseUrl();
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
getBaseUrl() {
const el = document.querySelector(`[${Store.URL_ATTR}]`);
const el = document.querySelector(`[${HttpBackend.URL_ATTR}]`);
if (el) {
return el.getAttribute(Store.URL_ATTR);
return el.getAttribute(HttpBackend.URL_ATTR);
}

@@ -45,2 +35,21 @@ return 'https://unpkg.com/@belle-icon/icons/svg';

}
}
HttpBackend.URL_ATTR = 'bi-src';
const httpBackend = new HttpBackend();
class Store {
constructor() {
var _a;
this.backend = (_a = window.biBackend) !== null && _a !== void 0 ? _a : httpBackend;
this.symbolKeySet = new Set();
this.clearExpiredElements();
this.$container = document.createElement('div');
this.$el = document.createElement('svg');
document.body.appendChild(this.$container);
this.$container.style.display = 'none';
this.$container.classList.add(Store.CLS_NAME);
}
clearExpiredElements() {
Array.from(document.getElementsByClassName(Store.CLS_NAME)).forEach(el => el.parentElement.removeChild(el));
}
async requestSymbol(name) {

@@ -50,3 +59,3 @@ if (this.symbolKeySet.has(name))

this.symbolKeySet.add(name);
const iconText = await this.fetchIcon(name);
const iconText = await this.backend.fetchIcon(name);
const symbol = document.createElement('symbol');

@@ -60,3 +69,2 @@ symbol.id = name;

Store.CLS_NAME = 'belle-icon-svg';
Store.URL_ATTR = 'bi-src';
const store = new Store();

@@ -66,3 +74,3 @@

const BelleIcon = class {
let BelleIcon = class {
constructor(hostRef) {

@@ -69,0 +77,0 @@ registerInstance(this, hostRef);

@@ -1,5 +0,5 @@

import { p as promiseResolve, b as bootstrapLazy } from './index-e69c5d53.js';
import { p as promiseResolve, b as bootstrapLazy } from './index-460bf030.js';
/*
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Browser v2.10.0 | MIT Licensed | https://stenciljs.com
*/

@@ -6,0 +6,0 @@ const patchBrowser = () => {

@@ -1,5 +0,5 @@

import { p as promiseResolve, b as bootstrapLazy } from './index-e69c5d53.js';
import { p as promiseResolve, b as bootstrapLazy } from './index-460bf030.js';
/*
Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Esm v2.10.0 | MIT Licensed | https://stenciljs.com
*/

@@ -6,0 +6,0 @@ const patchEsm = () => {

declare class Store {
private static CLS_NAME;
private static URL_ATTR;
private $el;
private $container;
private baseUrl;
private backend;
constructor();
private symbolKeySet;
private clearExpiredElements;
private getBaseUrl;
fetchIcon(name: string): Promise<string>;
requestSymbol(name: string): Promise<void>;

@@ -13,0 +10,0 @@ }

@@ -1,2 +0,1 @@

export * from '../dist/types/components';

@@ -3,0 +2,0 @@ export interface CustomElementsDefineOptions {

{
"name": "@belle-icon/component",
"version": "0.0.2",
"version": "0.0.3",
"description": "Stencil Component Starter",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

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