Socket
Socket
Sign inDemoInstall

@patternfly/pfe-core

Package Overview
Dependencies
Maintainers
16
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patternfly/pfe-core - npm Package Compare versions

Comparing version 2.0.0-next.0 to 2.0.0-next.1

1

controllers/color-context-controller.d.ts

@@ -6,2 +6,3 @@ import { ReactiveController, ReactiveElement } from 'lit';

private prefix;
private static contextEvents;
private callbacks;

@@ -8,0 +9,0 @@ private context;

55

controllers/color-context-controller.js

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

var f=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var r=(d,e,t,n)=>{for(var o=n>1?void 0:n?p(e,t):e,a=d.length-1,s;a>=0;a--)(s=d[a])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&f(e,t,o),o};import"lit";import{ContextEvent as k,createContext as m}from"../context.js";import{bound as c}from"../decorators/bound.js";import{Logger as u}from"./logger.js";import{StyleController as x}from"./style-controller.js";import{css as h}from"lit";var v=h`:host([context=dark]) {
--context: dark;
}
:host([context=light]) {
--context: light;
}
:host([context=accent]) {
--context: saturated;
}
:host([context=saturated]) {
--context: saturated;
}
:host([on=dark]) {
--pfe-broadcasted--text: var(--pfe-theme--color--text--on-dark, #fff);
--pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);
--pfe-broadcasted--link: var(--pfe-theme--color--link--on-dark, #73bcf7);
--pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-dark, #bee1f4);
--pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-dark, #bee1f4);
--pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-dark, #bee1f4);
--pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-dark, none);
--pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-dark, underline);
--pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-dark, underline);
--pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-dark, none);
}
:host([on=saturated]) {
--pfe-broadcasted--text: var(--pfe-theme--color--text--on-saturated, #fff);
--pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);
--pfe-broadcasted--link: var(--pfe-theme--color--link--on-saturated, #fff);
--pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-saturated, #fafafa);
--pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-saturated, #fafafa);
--pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);
--pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-saturated, underline);
--pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-saturated, underline);
--pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-saturated, underline);
--pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-saturated, underline);
}
:host([on=light]) {
--pfe-broadcasted--text: var(--pfe-theme--color--text, #151515);
--pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted, #6a6e73);
--pfe-broadcasted--link: var(--pfe-theme--color--link, #06c);
--pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover, #004080);
--pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus, #004080);
--pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited, #6753ac);
--pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration, none);
--pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover, underline);
--pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus, underline);
--pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited, none);
}`,l=v;var i=class{constructor(e,t="pfe"){this.host=e;this.prefix=t;this.callbacks=new Set;this.style=window.getComputedStyle(e),this.context=m(`${this.prefix}-color-context`,this.contextVariable),this.logger=new u(e),new x(e,l),e.addController(this)}hostConnected(){this.host.dispatchEvent(new k(this.context,this.contextCallback,!0)),this.host.addEventListener("context-request",this.onChildContextEvent),this.update()}hostDisconnected(){this.dispose?.(),this.dispose=void 0,this.callbacks.forEach(e=>this.callbacks.delete(e))}hostUpdate(){this.update()}isColorContextEvent(e){return e.context.name===`${this.prefix}-color-context`}get contextVariable(){return this.style.getPropertyValue("--context").trim()||null}contextCallback(e,t){t&&t!==this.dispose&&this.dispose?.(),this.update(e),this.dispose=t}onChildContextEvent(e){this.isColorContextEvent(e)&&(e.stopPropagation(),e.multiple&&this.callbacks.add(e.callback),e.callback(this.host.getAttribute("on")))}update(e){let t=this.contextVariable||e,n=this.host.getAttribute("on");if(t!==n){let o=t;this.logger.log(`Resetting context from ${n} to ${o}`),o!=null?this.host.setAttribute("on",o):this.host.removeAttribute("on");for(let a of this.callbacks)a(t)}}};r([c],i.prototype,"contextCallback",1),r([c],i.prototype,"onChildContextEvent",1),r([c],i.prototype,"update",1);export{i as ColorContextController};
var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=(l,e,t,n)=>{for(var o=n>1?void 0:n?h(e,t):e,a=l.length-1,s;a>=0;a--)(s=l[a])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&p(e,t,o),o};import"lit";import{ContextEvent as m,createContext as u}from"../context.js";import{bound as c}from"../decorators/bound.js";import{Logger as x}from"./logger.js";import{StyleController as b}from"./style-controller.js";import{css as v}from"lit";var k=v`:host([context=dark]){--context:dark}:host([context=light]){--context:light}:host([context=accent]){--context:saturated}:host([context=saturated]){--context:saturated}:host([on=dark]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-dark, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-dark, #73bcf7);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-dark, #bee1f4);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-dark, #bee1f4);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-dark, #bee1f4);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-dark, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-dark, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-dark, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-dark, none)}:host([on=saturated]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-saturated, #fff);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-saturated, #fafafa);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-saturated, #fafafa);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-saturated, underline);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-saturated, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-saturated, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-saturated, underline)}:host([on=light]){--pfe-broadcasted--text:var(--pfe-theme--color--text, #151515);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted, #6a6e73);--pfe-broadcasted--link:var(--pfe-theme--color--link, #06c);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover, #004080);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus, #004080);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited, #6753ac);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited, none)}`,f=k;var d=class{constructor(e,t="pfe"){this.host=e;this.prefix=t;this.callbacks=new Set;this.style=window.getComputedStyle(e),this.context=u(`${this.prefix}-color-context`,this.contextVariable),this.logger=new x(e),new b(e,f),e.addController(this)}hostConnected(){let e=new m(this.context,this.contextCallback,!0);this.host.dispatchEvent(e),d.contextEvents.add(e),this.host.addEventListener("context-request",this.onChildContextEvent);for(let t of d.contextEvents)t.target?.dispatchEvent(t);this.update()}hostDisconnected(){this.dispose?.(),this.dispose=void 0,this.callbacks.forEach(e=>this.callbacks.delete(e))}hostUpdate(){this.update()}isColorContextEvent(e){return e.target!==this.host&&e.context.name===`${this.prefix}-color-context`}get contextVariable(){return this.style.getPropertyValue("--context").trim()||null}contextCallback(e,t){t&&t!==this.dispose&&this.dispose?.(),this.update(e),this.dispose=t}onChildContextEvent(e){this.isColorContextEvent(e)&&(e.stopPropagation(),e.multiple&&this.callbacks.add(e.callback),e.callback(this.host.getAttribute("on")))}update(e){this.host.updateComplete.then(()=>{let t=this.contextVariable||e,n=this.host.getAttribute("on");if(t!==n){let o=t;this.logger.log(`Resetting context from ${n} to ${o}`),o!=null?this.host.setAttribute("on",o):this.host.removeAttribute("on");for(let a of this.callbacks)a(t)}})}},r=d;r.contextEvents=new Set,i([c],r.prototype,"contextCallback",1),i([c],r.prototype,"onChildContextEvent",1),i([c],r.prototype,"update",1);export{r as ColorContextController};
//# sourceMappingURL=color-context-controller.js.map
{
"name": "@patternfly/pfe-core",
"version": "2.0.0-next.0",
"version": "2.0.0-next.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "PatternFly Elements Core Library",

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

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

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

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

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

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