Socket
Socket
Sign inDemoInstall

frosted-glass

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.0.6

dist/frostedglass/frostedglass.akk64pig.js

12

dist/collection/collection-manifest.json

@@ -16,7 +16,7 @@ {

{
"name": "backgroundSelector",
"name": "blurAmount",
"type": "string"
},
{
"name": "blurAmount",
"name": "glassSelector",
"type": "string"

@@ -31,8 +31,2 @@ }

],
"propsDidChange": [
{
"name": "backgroundSelector",
"method": "backgroundChangeHandler"
}
],
"methods": [

@@ -58,5 +52,5 @@ {

"name": "@stencil/core",
"version": "0.0.8-0",
"version": "0.0.8-6",
"typescriptVersion": "2.6.1"
}
}

@@ -12,30 +12,28 @@ /**

interface HTMLFrostedGlassElement extends FrostedGlass, HTMLElement {
}
declare var HTMLFrostedGlassElement: {
prototype: HTMLFrostedGlassElement;
new (): HTMLFrostedGlassElement;
};
declare global {
interface HTMLFrostedGlassElement extends FrostedGlass, HTMLElement {
}
var HTMLFrostedGlassElement: {
prototype: HTMLFrostedGlassElement;
new (): HTMLFrostedGlassElement;
};
interface HTMLElementTagNameMap {
"frosted-glass": HTMLFrostedGlassElement;
"frosted-glass": HTMLFrostedGlassElement;
}
interface ElementTagNameMap {
"frosted-glass": HTMLFrostedGlassElement;
"frosted-glass": HTMLFrostedGlassElement;
}
namespace JSX {
interface IntrinsicElements {
"frosted-glass": JSXElements.FrostedGlassAttributes;
}
interface IntrinsicElements {
"frosted-glass": JSXElements.FrostedGlassAttributes;
}
}
namespace JSXElements {
export interface FrostedGlassAttributes extends HTMLAttributes {
mode?: string,
color?: string,
backgroundSelector?: string,
blurAmount?: string
}
export interface FrostedGlassAttributes extends HTMLAttributes {
glassSelector?: string,
blurAmount?: string
}
}
}
export declare class FrostedGlass {
backgroundSelector: string;
glassSelector: string;
blurAmount: string;
updateBackground(): void;
backgroundChangeHandler(): void;
blurAmountChangeHandler(newValue: string): void;

@@ -12,6 +11,5 @@ el: HTMLElement;

private blurContent;
private background;
private ticking;
private blurId;
private latestKnownScrollY;
private glassElement;
componentDidLoad(): void;

@@ -32,3 +30,2 @@ componentDidUnload(): void;

private backgroundUpdate();
private setBlurId();
}
import { } from '@stencil/core';
var FrostedGlass = /** @class */ (function () {
function FrostedGlass() {
export class FrostedGlass {
constructor() {
this.blurAmount = '5px';

@@ -9,34 +9,30 @@ this.directions = ['top', 'left', 'right'];

}
FrostedGlass.prototype.updateBackground = function () {
updateBackground() {
this.requestTick('backgroundUpdate');
};
FrostedGlass.prototype.backgroundChangeHandler = function () {
this.backgroundUpdate();
};
FrostedGlass.prototype.blurAmountChangeHandler = function (newValue) {
}
blurAmountChangeHandler(newValue) {
this.updateFilter(newValue);
};
FrostedGlass.prototype.componentDidLoad = function () {
this.setBlurId();
}
componentDidLoad() {
this.glassElement = this.el.querySelector(this.glassSelector);
this.createNewElements();
this.addBaseStyles();
this.initListeners();
};
FrostedGlass.prototype.componentDidUnload = function () {
}
componentDidUnload() {
this.removeElements();
this.removeListeners();
};
FrostedGlass.prototype.onResize = function () {
}
onResize() {
this.requestTick('resizeUpdate');
};
FrostedGlass.prototype.onScroll = function () {
}
onScroll() {
this.latestKnownScrollY = window.scrollY;
this.requestTick('scrollUpdate');
};
FrostedGlass.prototype.render = function () {
}
render() {
return (h("slot", null));
};
FrostedGlass.prototype.createNewElements = function () {
}
createNewElements() {
this.blurContainer = document.createElement('div');
this.blurContainer.setAttribute('id', "blur-container-" + this.blurId);
this.blurContent = document.createElement('div');

@@ -46,11 +42,11 @@ this.blurContainer.appendChild(this.blurContent);

this.requestTick('backgroundUpdate');
};
FrostedGlass.prototype.removeElements = function () {
}
removeElements() {
this.blurContainer.remove();
};
FrostedGlass.prototype.removeListeners = function () {
}
removeListeners() {
window.removeEventListener('scroll', this.onScroll);
window.removeEventListener('resize', this.onResize);
};
FrostedGlass.prototype.addBaseStyles = function () {
}
addBaseStyles() {
Object.assign(this.blurContainer.style, {

@@ -62,8 +58,8 @@ overflow: 'hidden',

this.updateFilter(this.blurAmount);
};
FrostedGlass.prototype.updateFilter = function (blurAmount) {
this.blurContent.style.filter = "blur(" + blurAmount + ")";
};
FrostedGlass.prototype.initListeners = function () {
if (window.getComputedStyle(this.el).position === 'fixed') {
}
updateFilter(blurAmount) {
this.blurContent.style.filter = `blur(${blurAmount})`;
}
initListeners() {
if (this.glassSelector && this.glassElement && window.getComputedStyle(this.glassElement).position === 'fixed') {
this.onScroll = this.onScroll.bind(this);

@@ -76,23 +72,22 @@ window.addEventListener('scroll', this.onScroll);

this.onScroll();
};
}
// @ts-ignore
FrostedGlass.prototype.resizeUpdate = function () {
var _this = this;
var elementStyle = window.getComputedStyle(this.el);
var appStyle = window.getComputedStyle(this.background);
resizeUpdate() {
const elementStyle = window.getComputedStyle(this.glassElement);
const appStyle = window.getComputedStyle(this.el.firstElementChild);
this.topOffset = parseInt(elementStyle.top, 10);
['position', 'height'].concat(this.directions).forEach(function (item) {
_this.blurContainer.style[item] = elementStyle[item];
['position', 'height', ...this.directions].forEach((item) => {
this.blurContainer.style[item] = elementStyle[item];
});
this.directions.forEach(function (item) { _this.blurContent.style[item] = "-" + elementStyle[item]; });
this.directions.forEach((item) => { this.blurContent.style[item] = `-${elementStyle[item]}`; });
this.blurContent.style.width = appStyle.width;
this.scrollUpdate();
this.ticking.resizeUpdate = false;
};
FrostedGlass.prototype.scrollUpdate = function () {
var scrollOffset = this.latestKnownScrollY + this.topOffset;
this.blurContent.style.top = "-" + scrollOffset + "px";
}
scrollUpdate() {
const scrollOffset = this.latestKnownScrollY + this.topOffset;
this.blurContent.style.top = `-${scrollOffset}px`;
this.ticking.scrollUpdate = false;
};
FrostedGlass.prototype.requestTick = function (functionName) {
}
requestTick(functionName) {
if (!this.ticking[functionName]) {

@@ -102,24 +97,15 @@ requestAnimationFrame(this[functionName].bind(this));

this.ticking[functionName] = true;
};
}
// @ts-ignore
FrostedGlass.prototype.backgroundUpdate = function () {
if (!this.backgroundSelector) {
backgroundUpdate() {
if (!this.glassSelector) {
return;
}
this.background = document.querySelector(this.backgroundSelector);
var backgroundClone = document.importNode(this.background, true);
var selfClone = backgroundClone.querySelector("[data-blur-id=\"" + this.blurId + "\"]");
if (selfClone) {
selfClone.remove();
this.blurContent.innerHTML = this.el.innerHTML;
const glassClone = this.blurContent.querySelector(this.glassSelector);
if (glassClone) {
glassClone.remove();
}
this.blurContent.innerHTML = '';
this.blurContent.appendChild(backgroundClone);
this.ticking.backgroundUpdate = false;
};
FrostedGlass.prototype.setBlurId = function () {
this.blurId = "" + Math.random();
this.el.dataset.blurId = this.blurId;
};
return FrostedGlass;
}());
export { FrostedGlass };
}
}

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

/*! Built with http://stenciljs.com */
!function(t,e,s,r,i,n,a,o,l){"use strict";for((t[s]=t[s]||{}).components=a=a||[],(l=a.filter(function(t){return t[2]}).map(function(t){return t[0]})).length&&((o=e.createElement("style")).innerHTML=l.join()+"{visibility:hidden}",o.setAttribute("data-visibility",""),e.head.insertBefore(o,e.head.firstChild)),s=s.toLowerCase(),l=(o=e.scripts).length-1;l>=0;l--)if(o[l].src&&o[l].src.split("/").pop()===s+".js"){r=o[l].src.replace(s+".js",s+"/");break}(o=e.createElement("script")).src=r+(t.customElements&&t.fetch?i:"frostedglass.oslyszfk.js"),o.setAttribute("data-path",r),o.setAttribute("data-core",i),e.head.appendChild(o)}(window,document,"frostedglass","/build/frostedglass/","frostedglass.vbebs1hu.js",0,[["frosted-glass","gcfyy0ms",1,[["backgroundSelector",1,1,2],["blurAmount",1,1,2],["el",7],["updateBackground",6]],0,1]]);
!function(t,e,s,r,i,a,n,l,o,d){"use strict";for((t[s]=t[s]||{}).components=l=l||[],(d=l.filter(function(t){return t[2]}).map(function(t){return t[0]})).length&&((o=e.createElement("style")).innerHTML=d.join()+"{visibility:hidden}",o.setAttribute("data-visibility",""),e.head.insertBefore(o,e.head.firstChild)),s=s.toLowerCase(),d=(o=e.scripts).length-1;d>=0;d--)if(o[d].src&&o[d].src.split("/").pop()===s+".js"){r=o[d].src.replace(s+".js",s+"/");break}(o=e.createElement("script")).src=r+("noModule"in o&&t.customElements&&t.fetch?e.documentElement.hasAttribute("data-ssr")?"frostedglass.akk64pig.js":"frostedglass.stetvy8x.js":"frostedglass.yprc2qik.js"),o.setAttribute("data-path",r),o.setAttribute("data-namespace",s),e.head.appendChild(o)}(window,document,"frostedglass","/build/frostedglass/",0,0,0,[["frosted-glass",["gmcuuxrm","s95m5ksg"],1,[["blurAmount",1,1,2],["el",7],["glassSelector",1,1,2],["updateBackground",6]],0,1]]);

@@ -6,7 +6,10 @@ {

"frosted-glass",
"gcfyy0ms",
[
"gmcuuxrm",
"s95m5ksg"
],
1,
[
[
"backgroundSelector",
"blurAmount",
1,

@@ -17,3 +20,7 @@ 1,

[
"blurAmount",
"el",
7
],
[
"glassSelector",
1,

@@ -24,6 +31,2 @@ 1,

[
"el",
7
],
[
"updateBackground",

@@ -37,5 +40,5 @@ 6

],
"loader": "../frostedglass.js",
"core": "frostedglass.vbebs1hu.js",
"corePolyfilled": "frostedglass.oslyszfk.js"
"core": "frostedglass.stetvy8x.js",
"coreSsr": "frostedglass.akk64pig.js",
"corePolyfilled": "frostedglass.yprc2qik.js"
}
{
"name": "frosted-glass",
"version": "0.0.5",
"version": "0.0.6",
"description": "Frosted Glass",

@@ -42,3 +42,4 @@ "main": "dist/collection/index.js",

},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
"testRegex": "(/src/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
"testPathIgnorePatterns": ["/node_modules/", "/demos/"],
"moduleFileExtensions": [

@@ -45,0 +46,0 @@ "ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc