@patternfly/pfe-core 2.0.0-next.0 → 2.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/context.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["context.ts"],
4
4
  "sourcesContent": ["/**\n * Context Protocol\n * @link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md\n */\n\n/**\n * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.\n */\nexport type Context<T> = {\n name: string;\n initialValue?: T;\n};\n\n/**\n * An unknown context typeU\n */\nexport type UnknownContext = Context<unknown>;\n\n/**\n * A helper type which can extract a Context value type from a Context type\n */\nexport type ContextType<T extends UnknownContext> = T extends Context<infer Y>\n ? Y\n : never;\n\n/**\n * A function which creates a Context value object\n */\nexport function createContext<T>(\n name: string,\n initialValue?: T\n): Readonly<Context<T>> {\n return {\n name,\n initialValue,\n };\n}\n\n/**\n * A callback which is provided by a context requester and is called with the value satisfying the request.\n * This callback can be called multiple times by context providers as the requested value is changed.\n */\nexport type ContextCallback<ValueType> = (\n value: ValueType,\n dispose?: () => void\n) => void;\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `multiple` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass a `dispose`\n * method to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly multiple?: boolean\n ) {\n super('context-request', { bubbles: true, composed: true });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n 'context-request': ContextEvent<UnknownContext>;\n }\n}\n"],
5
- "mappings": "AA4BO,WACL,EACA,EACsB,CACtB,MAAO,CACL,OACA,gBAuBG,mBAAqD,MAAM,CACzD,YACW,EACA,EACA,EAChB,CACA,MAAM,kBAAmB,CAAE,QAAS,GAAM,SAAU,KAJpC,eACA,gBACA",
5
+ "mappings": "AA4BO,WACL,EACA,EACsB,CACtB,MAAO,CACL,OACA,cACF,CACF,CAqBO,mBAAqD,MAAM,CACzD,YACW,EACA,EACA,EAChB,CACA,MAAM,kBAAmB,CAAE,QAAS,GAAM,SAAU,EAAK,CAAC,EAJ1C,eACA,gBACA,eAGlB,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["cascade-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { bound } from '../decorators/bound.js';\nimport { debounce } from '../functions/debounce.js';\nimport { Logger } from './logger.js';\n\nexport interface Options<E extends ReactiveElement> {\n properties: Partial<Record<keyof E, string|string[]>>;\n prefix?: string;\n}\n\nexport class CascadeController<E extends ReactiveElement> implements ReactiveController {\n private class: typeof ReactiveElement;\n\n private logger: Logger;\n\n static instances: WeakMap<ReactiveElement, CascadeController<ReactiveElement>> = new WeakMap();\n\n mo = new MutationObserver(this.parse);\n\n cache = new Map<string, string[]>();\n\n constructor(public host: E, public options?: Options<E>) {\n this.class = host.constructor as typeof ReactiveElement;\n this.logger = new Logger(this.host);\n CascadeController.instances.set(host, this);\n const properties = this.options?.properties ?? {} as Options<E>['properties'];\n for (const [propName, cascade] of Object.entries(properties)) {\n this.initProp(propName, cascade);\n }\n host.addController(this);\n this.cascadeProperties = debounce(this.cascadeProperties, 1);\n }\n\n hostUpdated() {\n this.cascadeProperties();\n }\n\n hostConnected() {\n this.mo.observe(this.host, { attributes: true, childList: true });\n this.cascadeProperties();\n }\n\n hostDisconnected() {\n this.mo.disconnect();\n }\n\n /**\n * Handles the cascading of properties to nested components when new elements are added\n * Attribute updates/additions are handled by the attribute callback\n */\n cascadeProperties(nodeList: HTMLCollection|NodeList = this.host.children) {\n if (this.host.isConnected) {\n const selectors = this.cache.keys();\n\n // Find out if anything in the nodeList matches any of the observed selectors for cacading properties\n if (!nodeList) {\n return this._cascadeAttributes(selectors, this.cache);\n }\n\n\n for (const node of nodeList) {\n // if this node has a match function (i.e., it's an HTMLElement, not a text node),\n if (node instanceof Element) {\n // see if it matches one of the selectors, otherwise drop it (like it's hot).\n for (const selector of selectors) {\n // console.log('_copyAttribute', name, value, el.getAttribute(name));\n if (node.matches(selector)) {\n const attrNames = this.cache.get(selector);\n // each selector can match multiple properties/attributes, so\n // copy each of them\n for (const attrName of attrNames ?? []) {\n this._copyAttribute(attrName, node);\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Gets the configured attribute name for the decorated property,\n * falling back to the lowercased property name, and caches the attribute name\n * with it's designated child selectors for value-propagation on change\n */\n initProp(propName: string, cascade: string|string[]) {\n for (const nodeItem of [cascade].flat(Infinity).filter(Boolean) as string[]) {\n const { attribute } = this.class.getPropertyOptions(propName);\n\n const attr =\n typeof attribute === 'string' ? attribute\n : propName.toLowerCase();\n\n // Create an object with the node as the key and an array of attributes\n // that are to be cascaded down to it\n if (!this.cache.get(nodeItem)) {\n this.cache.set(nodeItem, [attr]);\n } else {\n this.cache.get(nodeItem)?.push(attr);\n }\n }\n }\n\n @bound private parse(mutations: MutationRecord[]) {\n // Iterate over the mutation list, look for cascade updates\n for (const mutation of mutations ?? []) {\n // If a new node is added, attempt to cascade attributes to it\n if (mutation.type === 'childList' && mutation.addedNodes.length) {\n this.cascadeProperties(mutation.addedNodes);\n } else if (mutation.type === 'attributes') {\n this._cascadeAttributes(this.cache.keys(), this.cache);\n }\n }\n }\n\n /**\n * Copy the named attribute to a target element.\n */\n private async _copyAttribute(name: string, el: Element) {\n this.logger.log(`copying ${name} to ${el}`);\n const value = this.host.getAttribute(name);\n if (el.isConnected) {\n if (value == null) {\n el.removeAttribute(name);\n } else {\n el.setAttribute(name, value);\n }\n }\n }\n\n private _cascadeAttributes(selectors: IterableIterator<string>, set: this['cache']) {\n for (const selector of selectors) {\n for (const attr of set.get(selector) ?? []) {\n this._cascadeAttribute(attr, selector);\n }\n }\n }\n\n /**\n * Trigger a cascade of the named attribute to any child elements that match\n * the `to` selector. The selector can match elements in the light DOM and\n * shadow DOM.\n * @param name The name of the attribute to cascade (not necessarily the same as the property name).\n * @param to A CSS selector that matches the elements that should received the cascaded attribute. The selector will be applied within `this` element's light and shadow DOM trees.\n */\n private _cascadeAttribute(name: string, to: string) {\n const recipients = [\n ...this.host.querySelectorAll(to),\n ...this.host.shadowRoot?.querySelectorAll(to) ?? [],\n ];\n\n for (const node of recipients) {\n this._copyAttribute(name, node);\n }\n }\n}\n"],
5
- "mappings": "wMAEA,+CACA,oDACA,qCAOO,WAAiF,CAWtF,YAAmB,EAAgB,EAAsB,CAAtC,YAAgB,eAJnC,QAAK,GAAI,kBAAiB,KAAK,OAE/B,WAAQ,GAAI,KAGV,KAAK,MAAQ,EAAK,YAClB,KAAK,OAAS,GAAI,GAAO,KAAK,MAC9B,EAAkB,UAAU,IAAI,EAAM,MACtC,GAAM,GAAa,KAAK,SAAS,YAAc,GAC/C,OAAW,CAAC,EAAU,IAAY,QAAO,QAAQ,GAC/C,KAAK,SAAS,EAAU,GAE1B,EAAK,cAAc,MACnB,KAAK,kBAAoB,EAAS,KAAK,kBAAmB,GAG5D,aAAc,CACZ,KAAK,oBAGP,eAAgB,CACd,KAAK,GAAG,QAAQ,KAAK,KAAM,CAAE,WAAY,GAAM,UAAW,KAC1D,KAAK,oBAGP,kBAAmB,CACjB,KAAK,GAAG,aAOV,kBAAkB,EAAoC,KAAK,KAAK,SAAU,CACxE,GAAI,KAAK,KAAK,YAAa,CACzB,GAAM,GAAY,KAAK,MAAM,OAG7B,GAAI,CAAC,EACH,MAAO,MAAK,mBAAmB,EAAW,KAAK,OAIjD,OAAW,KAAQ,GAEjB,GAAI,YAAgB,UAElB,OAAW,KAAY,GAErB,GAAI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AAI,CAAC,CAInC,CACF,CAEe,MAAM,EAA6B,CAEhD,OAAW,KAAY,IAAa,CAAC,EAEnC,AAAI,EAAS,OAAS,aAAe,EAAS,WAAW,OACvD,KAAK,kBAAkB,EAAS,UAAU,EACjC,EAAS,OAAS,cAC3B,KAAK,mBAAmB,KAAK,MAAM,KAAK,EAAG,KAAK,KAAK,CAG3D,MAKc,gBAAe,EAAc,EAAa,CACtD,KAAK,OAAO,IAAI,WAAW,QAAW,GAAI,EAC1C,GAAM,GAAQ,KAAK,KAAK,aAAa,CAAI,EACzC,AAAI,EAAG,aACL,CAAI,GAAS,KACX,EAAG,gBAAgB,CAAI,EAEvB,EAAG,aAAa,EAAM,CAAK,EAGjC,CAEQ,mBAAmB,EAAqC,EAAoB,CAClF,OAAW,KAAY,GACrB,OAAW,KAAQ,GAAI,IAAI,CAAQ,GAAK,CAAC,EACvC,KAAK,kBAAkB,EAAM,CAAQ,CAG3C,CASQ,kBAAkB,EAAc,EAAY,CAClD,GAAM,GAAa,CACjB,GAAG,KAAK,KAAK,iBAAiB,CAAE,EAChC,GAAG,KAAK,KAAK,YAAY,iBAAiB,CAAE,GAAK,CAAC,CACpD,EAEA,OAAW,KAAQ,GACjB,KAAK,eAAe,EAAM,CAAI,CAElC,CACF,EAjJO,IAKE,AALF,EAKE,UAA0E,GAAI,SAwFtE,GAAf,GAAe,AA7FV,EA6FU",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ import type { ContextTheme } from '../core.js';
3
3
  export declare class ColorContextController implements ReactiveController {
4
4
  protected host: ReactiveElement;
5
5
  private prefix;
6
+ private static contextEvents;
6
7
  private callbacks;
7
8
  private context;
8
9
  private style;
@@ -1,55 +1,2 @@
1
- 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]) {
2
- --context: dark;
3
- }
4
-
5
- :host([context=light]) {
6
- --context: light;
7
- }
8
-
9
- :host([context=accent]) {
10
- --context: saturated;
11
- }
12
-
13
- :host([context=saturated]) {
14
- --context: saturated;
15
- }
16
-
17
- :host([on=dark]) {
18
- --pfe-broadcasted--text: var(--pfe-theme--color--text--on-dark, #fff);
19
- --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);
20
- --pfe-broadcasted--link: var(--pfe-theme--color--link--on-dark, #73bcf7);
21
- --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-dark, #bee1f4);
22
- --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-dark, #bee1f4);
23
- --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-dark, #bee1f4);
24
- --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-dark, none);
25
- --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-dark, underline);
26
- --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-dark, underline);
27
- --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-dark, none);
28
- }
29
-
30
- :host([on=saturated]) {
31
- --pfe-broadcasted--text: var(--pfe-theme--color--text--on-saturated, #fff);
32
- --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);
33
- --pfe-broadcasted--link: var(--pfe-theme--color--link--on-saturated, #fff);
34
- --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-saturated, #fafafa);
35
- --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-saturated, #fafafa);
36
- --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);
37
- --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-saturated, underline);
38
- --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-saturated, underline);
39
- --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-saturated, underline);
40
- --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-saturated, underline);
41
- }
42
-
43
- :host([on=light]) {
44
- --pfe-broadcasted--text: var(--pfe-theme--color--text, #151515);
45
- --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted, #6a6e73);
46
- --pfe-broadcasted--link: var(--pfe-theme--color--link, #06c);
47
- --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover, #004080);
48
- --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus, #004080);
49
- --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited, #6753ac);
50
- --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration, none);
51
- --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover, underline);
52
- --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus, underline);
53
- --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited, none);
54
- }`,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};
1
+ 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};
55
2
  //# sourceMappingURL=color-context-controller.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["color-context-controller.ts", "color-context-controller.scss"],
4
- "sourcesContent": ["import { ReactiveController, ReactiveElement } from 'lit';\nimport type { ContextTheme } from '../core.js';\nimport type { Context, UnknownContext } from '../context.js';\n\nimport { ContextEvent, createContext } from '../context.js';\nimport { bound } from '../decorators/bound.js';\nimport { Logger } from './logger.js';\nimport { StyleController } from './style-controller.js';\n\nimport CONTEXT_BASE_STYLES from './color-context-controller.scss';\n\nexport class ColorContextController implements ReactiveController {\n private callbacks = new Set<ColorContextController['update']>();\n\n private context: Context<ContextTheme|null>;\n\n private style: CSSStyleDeclaration;\n\n private logger: Logger;\n\n private dispose?: () => void;\n\n constructor(protected host: ReactiveElement, private prefix = 'pfe') {\n this.style = window.getComputedStyle(host);\n this.context = createContext(`${this.prefix}-color-context`, this.contextVariable);\n this.logger = new Logger(host);\n new StyleController(host, CONTEXT_BASE_STYLES);\n host.addController(this);\n }\n\n /**\n * When a context-aware component connects:\n * 1. Request Context from the closest context provider (being another context-aware component)\n * 2. Listen for child components' context-request events (become a provider)\n */\n hostConnected() {\n // register as a context consumer on the nearest context-aware ancestor\n this.host.dispatchEvent(new ContextEvent(this.context, this.contextCallback, true));\n // become a context provider\n this.host.addEventListener('context-request', this.onChildContextEvent);\n // \uD83D\uDC83 \uD83D\uDD7A\n this.update();\n }\n\n /**\n * When a context-aware component disconnects:\n * 1. Remove all the components children from the cache of connected components\n */\n hostDisconnected() {\n this.dispose?.();\n this.dispose = undefined;\n this.callbacks.forEach(x => this.callbacks.delete(x));\n }\n\n /**\n * On every host update (i.e. render), update the host's and all it's children's context\n */\n hostUpdate() {\n this.update();\n }\n\n /** Was the context event fired requesting our colour-context context? */\n private isColorContextEvent(\n event: ContextEvent<UnknownContext>\n ): event is ContextEvent<Context<ContextTheme|null>> {\n return event.context.name === `${this.prefix}-color-context`;\n }\n\n /** Return the current CSS `--context` value, or null */\n private get contextVariable(): ContextTheme | null {\n return this.style.getPropertyValue('--context').trim() as ContextTheme || null;\n }\n\n /** Register the dispose callback for hosts that requested multiple updates, then update the colour-context */\n @bound private contextCallback(value?: ContextTheme|null, dispose?: () => void) {\n // protect against changing providers\n if (dispose && dispose !== this.dispose) {\n this.dispose?.();\n }\n this.update(value);\n this.dispose = dispose;\n }\n\n /**\n * Provider part of context API\n * When a child connects, claim its context-request event\n * and add its callback to the Set of children if it requests multiple updates\n */\n @bound private onChildContextEvent(event: ContextEvent<UnknownContext>) {\n // only handle ContextEvents relevant to colour context\n if (this.isColorContextEvent(event)) {\n // claim the context-request event for ourselves (required by context protocol)\n event.stopPropagation();\n // Cache the callback for future updates, if requested\n if (event.multiple) {\n this.callbacks.add(event.callback);\n }\n\n // Run the callback to initialize the child's colour-context\n event.callback(this.host.getAttribute('on') as ContextTheme);\n }\n }\n\n /** Sets the `on` attribute on the host and any children that requested multiple updates */\n @bound public update(fallback?: ContextTheme|null) {\n // NB: We query the existing CSSStyleDeclaration on _every_. _single_. _update_.\n const incoming = this.contextVariable || fallback;\n const current = this.host.getAttribute('on');\n if (incoming !== current) {\n const next = incoming;\n this.logger.log(`Resetting context from ${current} to ${next}`);\n\n if (next != null) {\n this.host.setAttribute('on', next);\n } else {\n this.host.removeAttribute('on');\n }\n\n for (const cb of this.callbacks) {\n cb(incoming);\n }\n }\n }\n}\n", "import {css} from 'lit';\nexport const styles = css`:host([context=dark]) {\n --context: dark;\n}\n\n:host([context=light]) {\n --context: light;\n}\n\n:host([context=accent]) {\n --context: saturated;\n}\n\n:host([context=saturated]) {\n --context: saturated;\n}\n\n:host([on=dark]) {\n --pfe-broadcasted--text: var(--pfe-theme--color--text--on-dark, #fff);\n --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);\n --pfe-broadcasted--link: var(--pfe-theme--color--link--on-dark, #73bcf7);\n --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-dark, #bee1f4);\n --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-dark, #bee1f4);\n --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-dark, #bee1f4);\n --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-dark, none);\n --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-dark, underline);\n --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-dark, underline);\n --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-dark, none);\n}\n\n:host([on=saturated]) {\n --pfe-broadcasted--text: var(--pfe-theme--color--text--on-saturated, #fff);\n --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);\n --pfe-broadcasted--link: var(--pfe-theme--color--link--on-saturated, #fff);\n --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover--on-saturated, #fafafa);\n --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus--on-saturated, #fafafa);\n --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);\n --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration--on-saturated, underline);\n --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover--on-saturated, underline);\n --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus--on-saturated, underline);\n --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited--on-saturated, underline);\n}\n\n:host([on=light]) {\n --pfe-broadcasted--text: var(--pfe-theme--color--text, #151515);\n --pfe-broadcasted--text--muted: var(--pfe-theme--color--text--muted, #6a6e73);\n --pfe-broadcasted--link: var(--pfe-theme--color--link, #06c);\n --pfe-broadcasted--link--hover: var(--pfe-theme--color--link--hover, #004080);\n --pfe-broadcasted--link--focus: var(--pfe-theme--color--link--focus, #004080);\n --pfe-broadcasted--link--visited: var(--pfe-theme--color--link--visited, #6753ac);\n --pfe-broadcasted--link-decoration: var(--pfe-theme--link-decoration, none);\n --pfe-broadcasted--link-decoration--hover: var(--pfe-theme--link-decoration--hover, underline);\n --pfe-broadcasted--link-decoration--focus: var(--pfe-theme--link-decoration--focus, underline);\n --pfe-broadcasted--link-decoration--visited: var(--pfe-theme--link-decoration--visited, none);\n}`;\nexport default styles;\n"],
5
- "mappings": "wMAAA,YAIA,gEACA,+CACA,qCACA,wDCPA,0BACO,GAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAsDf,EAAQ,ED5CR,WAA2D,CAWhE,YAAsB,EAA+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import { ReactiveController, ReactiveElement } from 'lit';\nimport type { ContextTheme } from '../core.js';\nimport type { Context, UnknownContext } from '../context.js';\n\nimport { ContextEvent, createContext } from '../context.js';\nimport { bound } from '../decorators/bound.js';\nimport { Logger } from './logger.js';\nimport { StyleController } from './style-controller.js';\n\nimport CONTEXT_BASE_STYLES from './color-context-controller.scss';\n\nexport class ColorContextController implements ReactiveController {\n private static contextEvents = new Set<ContextEvent<UnknownContext>>();\n\n private callbacks = new Set<ColorContextController['update']>();\n\n private context: Context<ContextTheme|null>;\n\n private style: CSSStyleDeclaration;\n\n private logger: Logger;\n\n private dispose?: () => void;\n\n constructor(protected host: ReactiveElement, private prefix = 'pfe') {\n this.style = window.getComputedStyle(host);\n this.context = createContext(`${this.prefix}-color-context`, this.contextVariable);\n this.logger = new Logger(host);\n new StyleController(host, CONTEXT_BASE_STYLES);\n host.addController(this);\n }\n\n /**\n * When a context-aware component connects:\n * 1. Request Context from the closest context provider (being another context-aware component)\n * 2. Listen for child components' context-request events (become a provider)\n */\n hostConnected() {\n // register as a context consumer on the nearest context-aware ancestor\n const event = new ContextEvent(this.context, this.contextCallback, true);\n this.host.dispatchEvent(event);\n\n ColorContextController.contextEvents.add(event);\n\n // become a context provider\n this.host.addEventListener('context-request', this.onChildContextEvent);\n\n // re-fire all context events, in case this host upgraded after the previous one\n for (const fired of ColorContextController.contextEvents) {\n fired.target?.dispatchEvent(fired);\n }\n\n // \uD83D\uDC83 \uD83D\uDD7A\n this.update();\n }\n\n /**\n * When a context-aware component disconnects:\n * 1. Remove all the components children from the cache of connected components\n */\n hostDisconnected() {\n this.dispose?.();\n this.dispose = undefined;\n this.callbacks.forEach(x => this.callbacks.delete(x));\n }\n\n /**\n * On every host update (i.e. render), update the host's and all it's children's context\n */\n hostUpdate() {\n this.update();\n }\n\n /** Was the context event fired requesting our colour-context context? */\n private isColorContextEvent(\n event: ContextEvent<UnknownContext>\n ): event is ContextEvent<Context<ContextTheme|null>> {\n return (\n event.target !== this.host &&\n event.context.name === `${this.prefix}-color-context`\n );\n }\n\n /** Return the current CSS `--context` value, or null */\n private get contextVariable(): ContextTheme | null {\n return this.style.getPropertyValue('--context').trim() as ContextTheme || null;\n }\n\n /** Register the dispose callback for hosts that requested multiple updates, then update the colour-context */\n @bound private contextCallback(value?: ContextTheme|null, dispose?: () => void) {\n // protect against changing providers\n if (dispose && dispose !== this.dispose) {\n this.dispose?.();\n }\n this.update(value);\n this.dispose = dispose;\n }\n\n /**\n * Provider part of context API\n * When a child connects, claim its context-request event\n * and add its callback to the Set of children if it requests multiple updates\n */\n @bound private onChildContextEvent(event: ContextEvent<UnknownContext>) {\n // only handle ContextEvents relevant to colour context\n if (this.isColorContextEvent(event)) {\n // claim the context-request event for ourselves (required by context protocol)\n event.stopPropagation();\n // Cache the callback for future updates, if requested\n if (event.multiple) {\n this.callbacks.add(event.callback);\n }\n\n // Run the callback to initialize the child's colour-context\n event.callback(this.host.getAttribute('on') as ContextTheme);\n }\n }\n\n /** Sets the `on` attribute on the host and any children that requested multiple updates */\n @bound public update(fallback?: ContextTheme|null) {\n // ordinarily we'd prefer async/await for this,\n // but in this case, we use `.then` to maintain the synchronous interface of ContextCallback\n this.host.updateComplete.then(() => {\n // NB: We query the existing CSSStyleDeclaration on _every_. _single_. _update_.\n const incoming = this.contextVariable || fallback;\n const current = this.host.getAttribute('on');\n if (incoming !== current) {\n const next = incoming;\n this.logger.log(`Resetting context from ${current} to ${next}`);\n\n if (next != null) {\n this.host.setAttribute('on', next);\n } else {\n this.host.removeAttribute('on');\n }\n\n for (const cb of this.callbacks) {\n cb(incoming);\n }\n }\n });\n }\n}\n", "import {css} from 'lit';\nexport const styles = css`: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)}`;\nexport default styles;\n"],
5
+ "mappings": "wMAAA,YAIA,gEACA,+CACA,qCACA,wDCPA,0BACO,GAAM,GAAS,sxFACf,EAAQ,EDSR,WAA2D,CAahE,YAAsB,EAA+B,EAAS,MAAO,CAA/C,YAA+B,cAV7C,eAAY,GAAI,KAWtB,KAAK,MAAQ,OAAO,iBAAiB,CAAI,EACzC,KAAK,QAAU,EAAc,GAAG,KAAK,uBAAwB,KAAK,eAAe,EACjF,KAAK,OAAS,GAAI,GAAO,CAAI,EAC7B,GAAI,GAAgB,EAAM,CAAmB,EAC7C,EAAK,cAAc,IAAI,CACzB,CAOA,eAAgB,CAEd,GAAM,GAAQ,GAAI,GAAa,KAAK,QAAS,KAAK,gBAAiB,EAAI,EACvE,KAAK,KAAK,cAAc,CAAK,EAE7B,EAAuB,cAAc,IAAI,CAAK,EAG9C,KAAK,KAAK,iBAAiB,kBAAmB,KAAK,mBAAmB,EAGtE,OAAW,KAAS,GAAuB,cACzC,EAAM,QAAQ,cAAc,CAAK,EAInC,KAAK,OAAO,CACd,CAMA,kBAAmB,CACjB,KAAK,UAAU,EACf,KAAK,QAAU,OACf,KAAK,UAAU,QAAQ,GAAK,KAAK,UAAU,OAAO,CAAC,CAAC,CACtD,CAKA,YAAa,CACX,KAAK,OAAO,CACd,CAGQ,oBACN,EACmD,CACnD,MACE,GAAM,SAAW,KAAK,MACtB,EAAM,QAAQ,OAAS,GAAG,KAAK,sBAEnC,IAGY,kBAAuC,CACjD,MAAO,MAAK,MAAM,iBAAiB,WAAW,EAAE,KAAK,GAAqB,IAC5E,CAGe,gBAAgB,EAA2B,EAAsB,CAE9E,AAAI,GAAW,IAAY,KAAK,SAC9B,KAAK,UAAU,EAEjB,KAAK,OAAO,CAAK,EACjB,KAAK,QAAU,CACjB,CAOe,oBAAoB,EAAqC,CAEtE,AAAI,KAAK,oBAAoB,CAAK,GAEhC,GAAM,gBAAgB,EAElB,EAAM,UACR,KAAK,UAAU,IAAI,EAAM,QAAQ,EAInC,EAAM,SAAS,KAAK,KAAK,aAAa,IAAI,CAAiB,EAE/D,CAGc,OAAO,EAA8B,CAGjD,KAAK,KAAK,eAAe,KAAK,IAAM,CAElC,GAAM,GAAW,KAAK,iBAAmB,EACnC,EAAU,KAAK,KAAK,aAAa,IAAI,EAC3C,GAAI,IAAa,EAAS,CACxB,GAAM,GAAO,EACb,KAAK,OAAO,IAAI,0BAA0B,QAAc,GAAM,EAE9D,AAAI,GAAQ,KACV,KAAK,KAAK,aAAa,KAAM,CAAI,EAEjC,KAAK,KAAK,gBAAgB,IAAI,EAGhC,OAAW,KAAM,MAAK,UACpB,EAAG,CAAQ,CAEf,CACF,CAAC,CACH,CACF,EAnIO,IACU,AADV,EACU,cAAgB,GAAI,KA6EpB,GAAf,GAAe,AA9EV,EA8EU,+BAcA,GAAf,GAAe,AA5FV,EA4FU,mCAgBD,GAAd,GAAc,AA5GT,EA4GS",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["css-variable-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveElement, ReactiveController } from 'lit';\n\nexport class CssVariableController implements ReactiveController {\n style: CSSStyleDeclaration;\n\n constructor(public host: ReactiveElement) {\n this.style = window.getComputedStyle(host);\n }\n\n private parseProperty(name: string) {\n return name.substr(0, 2) !== '--' ? `--${name}` : name;\n }\n\n getVariable(name: string) {\n return this.style.getPropertyValue(this.parseProperty(name)).trim() || null;\n }\n\n hostConnected?(): void\n}\n"],
5
- "mappings": "AAEO,WAA0D,CAG/D,YAAmB,EAAuB,CAAvB,YACjB,KAAK,MAAQ,OAAO,iBAAiB,GAG/B,cAAc,EAAc,CAClC,MAAO,GAAK,OAAO,EAAG,KAAO,KAAO,KAAK,IAAS,EAGpD,YAAY,EAAc,CACxB,MAAO,MAAK,MAAM,iBAAiB,KAAK,cAAc,IAAO,QAAU",
5
+ "mappings": "AAEO,WAA0D,CAG/D,YAAmB,EAAuB,CAAvB,YACjB,KAAK,MAAQ,OAAO,iBAAiB,CAAI,CAC3C,CAEQ,cAAc,EAAc,CAClC,MAAO,GAAK,OAAO,EAAG,CAAC,IAAM,KAAO,KAAK,IAAS,CACpD,CAEA,YAAY,EAAc,CACxB,MAAO,MAAK,MAAM,iBAAiB,KAAK,cAAc,CAAI,CAAC,EAAE,KAAK,GAAK,IACzE,CAGF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["light-dom-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { Logger } from './logger.js';\n\nexport interface Options {\n observe?: boolean|MutationObserverInit;\n emptyWarning?: string;\n}\n\nexport class LightDOMController implements ReactiveController {\n private mo: MutationObserver;\n private logger: Logger;\n private initializer: () => void;\n\n constructor(private host: ReactiveElement, initializer: () => void, private options?: Options) {\n this.initializer = initializer.bind(host);\n this.mo = new MutationObserver(this.initializer);\n this.logger = new Logger(this.host);\n host.addController(this);\n }\n\n hostConnected() {\n if (this.hasLightDOM()) {\n this.initializer();\n } else if (this.options?.emptyWarning) {\n this.logger.warn(this.options?.emptyWarning);\n }\n\n this.initObserver();\n }\n\n hostDisconnected() {\n this.mo.disconnect();\n }\n\n private initObserver() {\n if (this.options?.observe ?? true) {\n // Use the provided options, or their defaults\n this.mo.observe(\n this.host,\n typeof this.options?.observe !== 'object' ? { childList: true }\n : this.options?.observe as MutationObserverInit\n );\n }\n }\n\n /**\n * Returns a boolean statement of whether or not this component contains any light DOM.\n */\n hasLightDOM(): boolean {\n return !!(\n this.host.children.length > 0 ||\n (this.host.textContent ?? '').trim().length > 0\n );\n }\n}\n"],
5
- "mappings": "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,EAAE,OAAS,CAElD,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["logger.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nexport class Logger implements ReactiveController {\n private static logDebug: boolean;\n\n private static instances: WeakMap<HTMLElement, Logger> = new WeakMap();\n\n private get prefix() {\n return `[${this.host.localName}${this.host.id ? `#${this.host.id}` : ''}]`;\n }\n\n /**\n * A boolean value that indicates if the logging should be printed to the console; used for debugging.\n * For use in a JS file or script tag; can also be added in the constructor of a component during development.\n * @example Logger.debugLog(true);\n * @tags debug\n */\n static debugLog(preference = null) {\n // wrap localStorage references in a try/catch; merely referencing it can\n // throw errors in some locked down environments\n try {\n if (preference !== null) {\n Logger.logDebug = !!preference;\n localStorage.pfeLog = !!preference;\n }\n return localStorage.pfeLog === 'true';\n } catch (e) {\n return Logger.logDebug;\n }\n }\n\n /**\n * A logging wrapper which checks the debugLog boolean and prints to the console if true.\n *\n * @example Logger.log(\"Hello\");\n */\n static log(...msgs: unknown[]) {\n if (Logger.debugLog()) {\n // eslint-disable-next-line no-console\n console.log(...msgs);\n }\n }\n\n /**\n * A console warning wrapper which formats your output with useful debugging information.\n *\n * @example Logger.warn(\"Hello\");\n */\n static warn(...msgs: unknown[]) {\n console.warn(...msgs); // eslint-disable-line no-console\n }\n\n /**\n * A console error wrapper which formats your output with useful debugging information.\n * For use inside a component's function.\n * @example Logger.error(\"Hello\");\n */\n static error(...msgs: unknown[]) {\n throw new Error([...msgs].join(' '));\n }\n\n /**\n * Local logging that outputs the tag name as a prefix automatically\n *\n * @example this.logger.log(\"Hello\");\n */\n log(...msgs: unknown[]) {\n Logger.log(this.prefix, ...msgs);\n }\n\n /**\n * Local warning wrapper that outputs the tag name as a prefix automatically.\n * For use inside a component's function.\n * @example this.logger.warn(\"Hello\");\n */\n warn(...msgs: unknown[]) {\n Logger.warn(this.prefix, ...msgs);\n }\n\n /**\n * Local error wrapper that outputs the tag name as a prefix automatically.\n * For use inside a component's function.\n * @example this.logger.error(\"Hello\");\n */\n error(...msgs: unknown[]) {\n Logger.error(this.prefix, ...msgs);\n }\n\n constructor(private host: ReactiveElement) {\n // We only need one logger instance per host\n if (Logger.instances.get(host)) {\n return Logger.instances.get(host) as Logger;\n }\n host.addController(this);\n Logger.instances.set(host, this);\n }\n\n hostConnected() {\n this.log('connected');\n }\n}\n"],
5
- "mappings": "AAEO,WAA2C,CAsFhD,YAAoB,EAAuB,CAAvB,YAElB,GAAI,EAAO,UAAU,IAAI,GACvB,MAAO,GAAO,UAAU,IAAI,GAE9B,EAAK,cAAc,MACnB,EAAO,UAAU,IAAI,EAAM,SAvFjB,SAAS,CACnB,MAAO,IAAI,KAAK,KAAK,YAAY,KAAK,KAAK,GAAK,IAAI,KAAK,KAAK,KAAO,YAShE,UAAS,EAAa,KAAM,CAGjC,GAAI,CACF,MAAI,KAAe,MACjB,GAAO,SAAW,CAAC,CAAC,EACpB,aAAa,OAAS,CAAC,CAAC,GAEnB,aAAa,SAAW,YAC/B,CACA,MAAO,GAAO,gBASX,QAAO,EAAiB,CAC7B,AAAI,EAAO,YAET,QAAQ,IAAI,GAAG,SASZ,SAAQ,EAAiB,CAC9B,QAAQ,KAAK,GAAG,SAQX,UAAS,EAAiB,CAC/B,KAAM,IAAI,OAAM,CAAC,GAAG,GAAM,KAAK,MAQjC,OAAO,EAAiB,CACtB,EAAO,IAAI,KAAK,OAAQ,GAAG,GAQ7B,QAAQ,EAAiB,CACvB,EAAO,KAAK,KAAK,OAAQ,GAAG,GAQ9B,SAAS,EAAiB,CACxB,EAAO,MAAM,KAAK,OAAQ,GAAG,GAY/B,eAAgB,CACd,KAAK,IAAI,eAhGN,IAGU,AAHV,EAGU,UAA0C,GAAI",
5
+ "mappings": "AAEO,WAA2C,CAsFhD,YAAoB,EAAuB,CAAvB,YAElB,GAAI,EAAO,UAAU,IAAI,CAAI,EAC3B,MAAO,GAAO,UAAU,IAAI,CAAI,EAElC,EAAK,cAAc,IAAI,EACvB,EAAO,UAAU,IAAI,EAAM,IAAI,CACjC,IAxFY,SAAS,CACnB,MAAO,IAAI,KAAK,KAAK,YAAY,KAAK,KAAK,GAAK,IAAI,KAAK,KAAK,KAAO,KACvE,OAQO,UAAS,EAAa,KAAM,CAGjC,GAAI,CACF,MAAI,KAAe,MACjB,GAAO,SAAW,CAAC,CAAC,EACpB,aAAa,OAAS,CAAC,CAAC,GAEnB,aAAa,SAAW,MACjC,MAAE,CACA,MAAO,GAAO,QAChB,CACF,OAOO,QAAO,EAAiB,CAC7B,AAAI,EAAO,SAAS,GAElB,QAAQ,IAAI,GAAG,CAAI,CAEvB,OAOO,SAAQ,EAAiB,CAC9B,QAAQ,KAAK,GAAG,CAAI,CACtB,OAOO,UAAS,EAAiB,CAC/B,KAAM,IAAI,OAAM,CAAC,GAAG,CAAI,EAAE,KAAK,GAAG,CAAC,CACrC,CAOA,OAAO,EAAiB,CACtB,EAAO,IAAI,KAAK,OAAQ,GAAG,CAAI,CACjC,CAOA,QAAQ,EAAiB,CACvB,EAAO,KAAK,KAAK,OAAQ,GAAG,CAAI,CAClC,CAOA,SAAS,EAAiB,CACxB,EAAO,MAAM,KAAK,OAAQ,GAAG,CAAI,CACnC,CAWA,eAAgB,CACd,KAAK,IAAI,WAAW,CACtB,CACF,EAlGO,IAGU,AAHV,EAGU,UAA0C,GAAI",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["perf-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { getRandomId } from '../functions/random.js';\n\nexport class PerfController implements ReactiveController {\n hasMeasured = false;\n\n markId: string;\n\n constructor(private host: ReactiveElement) {\n host.addController(this);\n\n // Set up the mark ID based on existing ID on component if it exists\n if (!host.id) {\n this.markId = getRandomId(host.localName);\n } else if (host.id.startsWith('pfe-') && !host.id.startsWith(host.localName)) {\n this.markId = host.id.replace('pfe', host.localName);\n } else {\n this.markId = `${host.localName}-${host.id}`;\n }\n\n performance.mark(`${this.markId}-defined`);\n }\n\n hostUpdate() {\n if (!this.hasMeasured) {\n this.measure();\n }\n }\n\n measure() {\n this.hasMeasured = true;\n\n performance.mark(`${this.markId}-rendered`);\n\n // Navigation start, i.e., the browser first sees that the user has navigated to the page\n performance.measure(`${this.markId}-from-navigation-to-first-render`, undefined, `${this.markId}-rendered`);\n\n // Render is run before connection unless delayRender is used\n performance.measure(\n `${this.markId}-from-defined-to-first-render`,\n `${this.markId}-defined`,\n `${this.markId}-rendered`\n );\n\n // Once we've measured time to render, we no longer need the controller,\n // so we allow it to be garbage-collected\n this.host.removeController(this);\n }\n}\n"],
5
- "mappings": "AAEA,qDAEO,WAAmD,CAKxD,YAAoB,EAAuB,CAAvB,YAJpB,iBAAc,GAKZ,EAAK,cAAc,MAGnB,AAAK,EAAK,GAEH,AAAI,EAAK,GAAG,WAAW,SAAW,CAAC,EAAK,GAAG,WAAW,EAAK,WAChE,KAAK,OAAS,EAAK,GAAG,QAAQ,MAAO,EAAK,WAE1C,KAAK,OAAS,GAAG,EAAK,aAAa,EAAK,KAJxC,KAAK,OAAS,EAAY,EAAK,WAOjC,YAAY,KAAK,GAAG,KAAK,kBAG3B,YAAa,CACX,AAAK,KAAK,aACR,KAAK,UAIT,SAAU,CACR,KAAK,YAAc,GAEnB,YAAY,KAAK,GAAG,KAAK,mBAGzB,YAAY,QAAQ,GAAG,KAAK,yCAA0C,OAAW,GAAG,KAAK,mBAGzF,YAAY,QACV,GAAG,KAAK,sCACR,GAAG,KAAK,iBACR,GAAG,KAAK,mBAKV,KAAK,KAAK,iBAAiB",
5
+ "mappings": "AAEA,qDAEO,WAAmD,CAKxD,YAAoB,EAAuB,CAAvB,YAJpB,iBAAc,GAKZ,EAAK,cAAc,IAAI,EAGvB,AAAK,EAAK,GAEH,AAAI,EAAK,GAAG,WAAW,MAAM,GAAK,CAAC,EAAK,GAAG,WAAW,EAAK,SAAS,EACzE,KAAK,OAAS,EAAK,GAAG,QAAQ,MAAO,EAAK,SAAS,EAEnD,KAAK,OAAS,GAAG,EAAK,aAAa,EAAK,KAJxC,KAAK,OAAS,EAAY,EAAK,SAAS,EAO1C,YAAY,KAAK,GAAG,KAAK,gBAAgB,CAC3C,CAEA,YAAa,CACX,AAAK,KAAK,aACR,KAAK,QAAQ,CAEjB,CAEA,SAAU,CACR,KAAK,YAAc,GAEnB,YAAY,KAAK,GAAG,KAAK,iBAAiB,EAG1C,YAAY,QAAQ,GAAG,KAAK,yCAA0C,OAAW,GAAG,KAAK,iBAAiB,EAG1G,YAAY,QACV,GAAG,KAAK,sCACR,GAAG,KAAK,iBACR,GAAG,KAAK,iBACV,EAIA,KAAK,KAAK,iBAAiB,IAAI,CACjC,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["property-observer-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nexport const observedController = Symbol('observed properties controller');\n\nexport type ChangeCallback<T = ReactiveElement> = (\n this: T,\n old?: T[keyof T],\n newV?: T[keyof T],\n) => void;\n\nexport type ChangeCallbackName = `_${string}Changed`;\n\nexport type PropertyObserverHost<T> = T & Record<ChangeCallbackName, ChangeCallback<T>> & {\n [observedController]: PropertyObserverController;\n}\n\n/** This controller holds a cache of observed property values which were set before the element updated */\nexport class PropertyObserverController implements ReactiveController {\n private static hosts: WeakMap<HTMLElement, PropertyObserverController> = new WeakMap();\n\n private values = new Map<string, [methodName: string, values: [unknown, unknown]]>();\n\n private delete(key: string) {\n this.values.delete(key);\n }\n\n constructor(private host: ReactiveElement) {\n if (PropertyObserverController.hosts.get(host)) {\n return PropertyObserverController.hosts.get(host) as PropertyObserverController;\n }\n host.addController(this);\n (host as PropertyObserverHost<ReactiveElement>)[observedController] = this;\n }\n\n /** Set any cached valued accumulated between constructor and connectedCallback */\n hostUpdate() {\n for (const [key, [methodName, [oldVal, newVal]]] of this.values) {\n // @ts-expect-error: be cool, typescript\n this.host[methodName as keyof ReactiveElement]?.(oldVal, newVal);\n this.delete(key);\n }\n }\n\n /** Once the element has updated, we no longer need this controller, so we remove it */\n hostUpdated() {\n this.host.removeController(this);\n }\n\n cache(key: string, methodName: string, ...vals: [unknown, unknown]) {\n this.values.set(key, [methodName, vals]);\n }\n}\n"],
5
- "mappings": "AAEO,GAAM,GAAqB,OAAO,kCAelC,OAA+D,CASpE,YAAoB,EAAuB,CAAvB,YANZ,YAAS,GAAI,KAOnB,GAAI,EAA2B,MAAM,IAAI,GACvC,MAAO,GAA2B,MAAM,IAAI,GAE9C,EAAK,cAAc,MAClB,EAA+C,GAAsB,KAThE,OAAO,EAAa,CAC1B,KAAK,OAAO,OAAO,GAYrB,YAAa,CACX,OAAW,CAAC,EAAK,CAAC,EAAY,CAAC,EAAQ,MAAa,MAAK,OAEvD,KAAK,KAAK,KAAuC,EAAQ,GACzD,KAAK,OAAO,GAKhB,aAAc,CACZ,KAAK,KAAK,iBAAiB,MAG7B,MAAM,EAAa,KAAuB,EAA0B,CAClE,KAAK,OAAO,IAAI,EAAK,CAAC,EAAY,MAhC/B,IACU,AADV,EACU,MAA0D,GAAI",
5
+ "mappings": "AAEO,GAAM,GAAqB,OAAO,gCAAgC,EAelE,OAA+D,CASpE,YAAoB,EAAuB,CAAvB,YANZ,YAAS,GAAI,KAOnB,GAAI,EAA2B,MAAM,IAAI,CAAI,EAC3C,MAAO,GAA2B,MAAM,IAAI,CAAI,EAElD,EAAK,cAAc,IAAI,EACtB,EAA+C,GAAsB,IACxE,CAVQ,OAAO,EAAa,CAC1B,KAAK,OAAO,OAAO,CAAG,CACxB,CAWA,YAAa,CACX,OAAW,CAAC,EAAK,CAAC,EAAY,CAAC,EAAQ,MAAa,MAAK,OAEvD,KAAK,KAAK,KAAuC,EAAQ,CAAM,EAC/D,KAAK,OAAO,CAAG,CAEnB,CAGA,aAAc,CACZ,KAAK,KAAK,iBAAiB,IAAI,CACjC,CAEA,MAAM,EAAa,KAAuB,EAA0B,CAClE,KAAK,OAAO,IAAI,EAAK,CAAC,EAAY,CAAI,CAAC,CACzC,CACF,EAlCO,IACU,AADV,EACU,MAA0D,GAAI",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["slot-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { bound } from '../decorators/bound.js';\nimport { Logger } from './logger.js';\n\ninterface AnonymousSlot {\n hasContent: boolean;\n elements: Element[];\n slot: HTMLSlotElement|null;\n}\n\ninterface NamedSlot extends AnonymousSlot {\n name: string;\n initialized: true;\n}\n\nexport type Slot = NamedSlot|AnonymousSlot;\n\nexport interface SlotsConfig {\n slots: (string|null)[];\n /**\n * Object mapping new slot name keys to deprecated slot name values\n * @example `pfe-modal--header` is deprecated in favour of `header`\n * ```js\n * new SlotController(this, {\n * slots: ['header'],\n * deprecations: {\n * 'header': 'pfe-modal--header'\n * }\n * })\n * ```\n */\n deprecations?: Record<string, string>;\n}\n\nfunction isObjectConfigSpread(config: ([SlotsConfig]|(string|null)[])): config is [SlotsConfig] {\n return config.length === 1 && config[0] !== null;\n}\n\n/**\n * If it's a named slot, return its children,\n * for the default slot, look for direct children not assigned to a slot\n */\nconst isSlot =\n <T extends Element = Element>(n: string|typeof SlotController.anonymous) =>\n (child: Element): child is T =>\n n === SlotController.anonymous ? !child.hasAttribute('slot')\n : child.getAttribute('slot') === n;\n\nexport class SlotController implements ReactiveController {\n public static anonymous = Symbol('anonymous slot');\n\n private nodes = new Map<string|typeof SlotController.anonymous, Slot>();\n\n private logger: Logger;\n\n private firstUpdated = false;\n\n private mo = new MutationObserver(this.onMutation);\n\n private slotNames: (string|null)[];\n\n private deprecations: Record<string, string> = {};\n\n constructor(public host: ReactiveElement, ...config: ([SlotsConfig]|(string|null)[])) {\n this.logger = new Logger(this.host);\n\n if (isObjectConfigSpread(config)) {\n const [{ slots, deprecations }] = config;\n this.slotNames = slots;\n this.deprecations = deprecations ?? {};\n } else if (config.length > 1) {\n this.slotNames = config;\n this.deprecations = {};\n } else {\n this.slotNames = [null];\n }\n\n\n host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('slotchange', this.onSlotChange as EventListener);\n this.firstUpdated = false;\n this.mo.observe(this.host, { childList: true });\n this.init();\n }\n\n hostUpdated() {\n if (!this.firstUpdated) {\n this.slotNames.forEach(this.initSlot);\n this.firstUpdated = true;\n }\n }\n\n hostDisconnected() {\n this.mo.disconnect();\n }\n\n /**\n * Returns a boolean statement of whether or not any of those slots exists in the light DOM.\n *\n * @param {String|Array} name The slot name.\n * @example this.hasSlotted(\"header\");\n */\n hasSlotted(...names: string[]): boolean {\n if (!names.length) {\n this.logger.warn(`Please provide at least one slot name for which to search.`);\n return false;\n } else {\n return names.some(x =>\n this.nodes.get(x)?.hasContent ?? false);\n }\n }\n\n /**\n * Given a slot name or slot names, returns elements assigned to the requested slots as an array.\n * If no value is provided, it returns all children not assigned to a slot (without a slot attribute).\n *\n * @example Get header-slotted elements\n * ```js\n * this.getSlotted('header')\n * ```\n *\n * @example Get header- and footer-slotted elements\n * ```js\n * this.getSlotted('header', 'footer')\n * ```\n *\n * @example Get default-slotted elements\n * ```js\n * this.getSlotted();\n * ```\n */\n getSlotted<T extends Element = Element>(...slotNames: string[]): T[] {\n if (!slotNames.length) {\n return (this.nodes.get(SlotController.anonymous)?.elements ?? []) as T[];\n } else {\n return slotNames.flatMap(slotName =>\n this.nodes.get(slotName)?.elements ?? []) as T[];\n }\n }\n\n @bound private onSlotChange(event: Event & { target: HTMLSlotElement }) {\n const slotName = event.target.name;\n this.initSlot(slotName);\n this.host.requestUpdate();\n }\n\n @bound private async onMutation(records: MutationRecord[]) {\n const changed = [];\n for (const { addedNodes, removedNodes } of records) {\n for (const node of [...addedNodes, ...removedNodes]) {\n if (node instanceof HTMLElement && node.slot) {\n this.initSlot(node.slot);\n changed.push(node.slot);\n }\n }\n }\n if (changed.length) {\n this.host.requestUpdate();\n }\n }\n\n private getChildrenForSlot<T extends Element = Element>(name: string|typeof SlotController.anonymous): T[] {\n const children = Array.from(this.host.children) as T[];\n return children.filter(isSlot(name));\n }\n\n @bound private initSlot(slotName: string|null) {\n const name = slotName || SlotController.anonymous;\n const elements = this.nodes.get(name)?.slot?.assignedElements?.() ?? this.getChildrenForSlot(name);\n const selector = slotName ? `slot[name=\"${slotName}\"]` : 'slot:not([name])';\n const slot = this.host.shadowRoot?.querySelector?.<HTMLSlotElement>(selector) ?? null;\n const hasContent = !!elements.length;\n this.nodes.set(name, { elements, name: slotName ?? '', hasContent, slot });\n this.logger.log(slotName, hasContent);\n }\n\n /**\n * Maps the defined slots into an object that is easier to query\n */\n @bound private init() {\n this.nodes.clear();\n // Loop over the properties provided by the schema\n this.slotNames.forEach(this.initSlot);\n Object.values(this.deprecations).forEach(this.initSlot);\n this.host.requestUpdate();\n }\n}\n"],
5
- "mappings": "wMAEA,+CACA,qCAgCA,WAA8B,EAAkE,CAC9F,MAAO,GAAO,SAAW,GAAK,EAAO,KAAO,KAO9C,GAAM,GACJ,AAA8B,GAC5B,AAAC,GACG,IAAM,EAAe,UAAY,CAAC,EAAM,aAAa,QACrD,EAAM,aAAa,UAAY,EAEhC,OAAmD,CAexD,YAAmB,KAA0B,EAAyC,CAAnE,YAZX,WAAQ,GAAI,KAIZ,kBAAe,GAEf,QAAK,GAAI,kBAAiB,KAAK,YAI/B,kBAAuC,GAK7C,GAFA,KAAK,OAAS,GAAI,GAAO,KAAK,MAE1B,EAAqB,GAAS,CAChC,GAAM,CAAC,CAAE,QAAO,iBAAkB,EAClC,KAAK,UAAY,EACjB,KAAK,aAAe,GAAgB,OAC/B,AAAI,GAAO,OAAS,EACzB,MAAK,UAAY,EACjB,KAAK,aAAe,IAEpB,KAAK,UAAY,CAAC,MAIpB,EAAK,cAAc,MAGrB,eAAgB,CACd,KAAK,KAAK,iBAAiB,aAAc,KAAK,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C,OAAO,OAAO,KAAK,YAAY,EAAE,QAAQ,KAAK,QAAQ,EACtD,KAAK,KAAK,cAAc,CAC1B,CACF,EA7IO,IACS,AADT,EACS,UAAY,OAAO,gBAAgB,EA8FlC,GAAf,GAAe,AA/FV,EA+FU,4BAMM,GAArB,GAAqB,AArGhB,EAqGgB,0BAoBN,GAAf,GAAe,AAzHV,EAyHU,wBAaA,GAAf,GAAe,AAtIV,EAsIU",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["style-controller.ts"],
4
4
  "sourcesContent": ["import type { ReactiveController, ReactiveElement, CSSResultGroup, CSSResultOrNative, CSSResult } from 'lit';\nimport { getCompatibleStyle, supportsAdoptingStyleSheets } from 'lit';\n\ndeclare global {\n interface ShadowRoot {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n}\n\n/**\n * Controller which adds styles to it's host element.\n * Like `static styles = []`, except a controller.\n * Should typically only be used within other controllers.\n */\nexport class StyleController implements ReactiveController {\n private stylesAdopted = false;\n\n constructor(\n private host: ReactiveElement,\n /** These styles will be applied to the host element */\n private styles: CSSResultGroup,\n ) {\n host.addController(this);\n }\n\n hostConnected(): void {\n if (this.stylesAdopted || !(this.host.renderRoot instanceof ShadowRoot)) {\n return;\n }\n\n const styles = [this.styles].flatMap(x => getCompatibleStyle(x as CSSResultOrNative)).filter(x => !!x);\n\n if (supportsAdoptingStyleSheets) {\n this.host.renderRoot.adoptedStyleSheets = [\n ...this.host.renderRoot.adoptedStyleSheets ?? [],\n ...styles.map(x => x instanceof CSSStyleSheet ? x : x.styleSheet as CSSStyleSheet),\n ];\n } else {\n styles.forEach(s => {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (window as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n this.host.renderRoot.appendChild(style);\n });\n }\n\n this.stylesAdopted = true;\n }\n}\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,WAAW,YAAY,CAAK,CACxC,CAAC,EAGH,KAAK,cAAgB,EACvB,CACF",
6
6
  "names": []
7
7
  }
package/core.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["core.ts"],
4
4
  "sourcesContent": ["import type { ComplexAttributeConverter } from 'lit';\n\n/** PatternFly Elements global config object */\nexport interface PfeConfig {\n /** Set to false to disable client-side page load performance tracking */\n trackPerformance?: boolean;\n /** Set to false to disable various debug logs */\n log?: boolean;\n /** Set to false to disable automatically removing `unresolved` attr from body */\n autoReveal?: boolean;\n}\n\nexport type ColorTheme = (\n | 'base'\n | 'accent'\n | 'complement'\n | 'lighter'\n | 'lightest'\n | 'darker'\n | 'darkest'\n);\n\nexport type ContextTheme = (\n | 'dark'\n | 'light'\n | 'saturated'\n);\n\nconst noPref = Symbol();\n\n/** Retrieve an HTML metadata item */\nfunction getMeta(name: string): string|undefined {\n return document.head.querySelector<HTMLMetaElement>(`meta[name=\"${name}\"]`)?.content;\n}\n\n/**\n * A boolean value that indicates if the performance should be tracked.\n * For use in a JS file or script tag; can also be added in the constructor of a component during development.\n * @example trackPerformance(true);\n */\nexport function trackPerformance(preference: boolean | typeof noPref = noPref) {\n if (preference !== noPref) {\n window.PfeConfig.trackPerformance = !!preference;\n }\n return window.PfeConfig.trackPerformance;\n}\n\n/**\n * A LitElement property converter which represents a list of numbers as a comma separated string\n * @see https://lit.dev/docs/components/properties/#conversion-converter\n */\nexport const NumberListConverter: ComplexAttributeConverter<null|number[]> = {\n fromAttribute(value: string) {\n if (typeof value !== 'string') {\n return null;\n } else {\n return value.split(',').map(x => x.trim()).map(x => parseInt(x, 10));\n }\n },\n toAttribute(value: number[]) {\n return value.join(',');\n },\n};\n\n/**\n * A composed, bubbling event for UI interactions\n * e.g. when an accordion panel opens.\n */\nexport class ComposedEvent extends Event {\n constructor(type: string, init?: EventInit) {\n super(type, {\n bubbles: true,\n composed: true,\n ...init\n });\n }\n}\n\n// \uD83D\uDC47 SIDE EFFECTS \uD83D\uDC47\n\ndeclare global {\n interface Window {\n /** Global configuration settings for PatternFly Elements */\n PfeConfig: PfeConfig;\n }\n}\n\nconst bodyNoAutoReveal = document.body.hasAttribute('no-auto-reveal');\n\n/** Global patternfly elements config */\nwindow.PfeConfig = Object.assign(window.PfeConfig ?? {}, {\n trackPerformance: window.PfeConfig?.trackPerformance ?? getMeta('pfe-track-performance') === 'true',\n autoReveal: window.PfeConfig?.autoReveal ?? bodyNoAutoReveal ? !bodyNoAutoReveal : getMeta('pfe-auto-reveal') === 'true',\n get log() {\n return !!localStorage.pfeLog;\n },\n set log(v: boolean) {\n if (v) {\n localStorage.setItem('pfeLog', `${true}`);\n } else {\n localStorage.removeItem('pfeLog');\n }\n },\n});\n"],
5
- "mappings": "AA4BA,GAAM,GAAS,SAGf,WAAiB,EAAgC,CAC/C,MAAO,UAAS,KAAK,cAA+B,cAAc,QAAW,QAQxE,WAA0B,EAAsC,EAAQ,CAC7E,MAAI,KAAe,GACjB,QAAO,UAAU,iBAAmB,CAAC,CAAC,GAEjC,OAAO,UAAU,iBAOnB,GAAM,GAAgE,CAC3E,cAAc,EAAe,CAC3B,MAAI,OAAO,IAAU,SACZ,KAEA,EAAM,MAAM,KAAK,IAAI,GAAK,EAAE,QAAQ,IAAI,GAAK,SAAS,EAAG,MAGpE,YAAY,EAAiB,CAC3B,MAAO,GAAM,KAAK,OAQf,eAA4B,MAAM,CACvC,YAAY,EAAc,EAAkB,CAC1C,MAAM,EAAM,CACV,QAAS,GACT,SAAU,MACP,MAcH,EAAmB,SAAS,KAAK,aAAa,kBAGpD,OAAO,UAAY,OAAO,OAAO,OAAO,WAAa,GAAI,CACvD,iBAAkB,OAAO,WAAW,kBAAoB,EAAQ,2BAA6B,OAC7F,WAAY,OAAO,WAAW,YAAc,EAAmB,CAAC,EAAmB,EAAQ,qBAAuB,UAC9G,MAAM,CACR,MAAO,CAAC,CAAC,aAAa,WAEpB,KAAI,EAAY,CAClB,AAAI,EACF,aAAa,QAAQ,SAAU,GAAG,MAElC,aAAa,WAAW",
5
+ "mappings": "AA4BA,GAAM,GAAS,OAAO,EAGtB,WAAiB,EAAgC,CAC/C,MAAO,UAAS,KAAK,cAA+B,cAAc,KAAQ,GAAG,OAC/E,CAOO,WAA0B,EAAsC,EAAQ,CAC7E,MAAI,KAAe,GACjB,QAAO,UAAU,iBAAmB,CAAC,CAAC,GAEjC,OAAO,UAAU,gBAC1B,CAMO,GAAM,GAAgE,CAC3E,cAAc,EAAe,CAC3B,MAAI,OAAO,IAAU,SACZ,KAEA,EAAM,MAAM,GAAG,EAAE,IAAI,GAAK,EAAE,KAAK,CAAC,EAAE,IAAI,GAAK,SAAS,EAAG,EAAE,CAAC,CAEvE,EACA,YAAY,EAAiB,CAC3B,MAAO,GAAM,KAAK,GAAG,CACvB,CACF,EAMO,eAA4B,MAAM,CACvC,YAAY,EAAc,EAAkB,CAC1C,MAAM,EAAM,CACV,QAAS,GACT,SAAU,MACP,CACL,CAAC,CACH,CACF,EAWM,EAAmB,SAAS,KAAK,aAAa,gBAAgB,EAGpE,OAAO,UAAY,OAAO,OAAO,OAAO,WAAa,CAAC,EAAG,CACvD,iBAAkB,OAAO,WAAW,kBAAoB,EAAQ,uBAAuB,IAAM,OAC7F,WAAY,OAAO,WAAW,YAAc,EAAmB,CAAC,EAAmB,EAAQ,iBAAiB,IAAM,UAC9G,MAAM,CACR,MAAO,CAAC,CAAC,aAAa,MACxB,KACI,KAAI,EAAY,CAClB,AAAI,EACF,aAAa,QAAQ,SAAU,GAAG,IAAM,EAExC,aAAa,WAAW,QAAQ,CAEpC,CACF,CAAC",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["bound.ts"],
4
4
  "sourcesContent": ["const configurable = true;\n\n/**\n * Binds a class method to the instance\n *\n * @example Binding an event listener\n * ```ts\n * private mo = new MutationObserver(this.onMutation);\n *\n * @bound onMutation(records: MutationRecord[]) {\n * this.count = this.children.length;\n * }\n * ```\n */\nexport function bound(_: unknown, key: string, descriptor: PropertyDescriptor): PropertyDescriptor {\n if (typeof descriptor?.value !== 'function') {\n throw new TypeError(`Only methods can be decorated with @bound. <${key ?? (_ as () => void).name}> is not a method!`);\n } /* c8 ignore next */\n return {\n configurable,\n get() {\n const value = descriptor.value.bind(this);\n Object.defineProperty(this, key, { value, configurable, writable: true });\n return value;\n },\n };\n}\n"],
5
- "mappings": "AAcO,WAAe,EAAY,EAAa,EAAoD,CACjG,GAAI,MAAO,IAAY,OAAU,WAC/B,KAAM,IAAI,WAAU,+CAA+C,GAAQ,EAAiB,0BAE9F,MAAO,CACL,gBACA,KAAM,CACJ,GAAM,GAAQ,EAAW,MAAM,KAAK,MACpC,cAAO,eAAe,KAAM,EAAK,CAAE,QAAO,gBAAc,SAAU,KAC3D",
5
+ "mappings": "AAcO,WAAe,EAAY,EAAa,EAAoD,CACjG,GAAI,MAAO,IAAY,OAAU,WAC/B,KAAM,IAAI,WAAU,+CAA+C,GAAQ,EAAiB,wBAAwB,EAEtH,MAAO,CACL,gBACA,KAAM,CACJ,GAAM,GAAQ,EAAW,MAAM,KAAK,IAAI,EACxC,cAAO,eAAe,KAAM,EAAK,CAAE,QAAO,gBAAc,SAAU,EAAK,CAAC,EACjE,CACT,CACF,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["cascades.ts"],
4
4
  "sourcesContent": ["import type { ReactiveElement } from 'lit';\n\nimport { CascadeController } from '../controllers/cascade-controller.js';\n\n/**\n * Cascades the decorated attribute to children\n */\nexport function cascades<T extends ReactiveElement>(...items: string[]): PropertyDecorator {\n return function(proto: T, key: string & keyof T) {\n (proto.constructor as typeof ReactiveElement).addInitializer(x => {\n const instance = x as ReactiveElement;\n // You can have multiple `@cascades` decorators on an element\n // and it will only get one CascadeController for all of them\n if (!CascadeController.instances.has(instance)) {\n CascadeController.instances.set(instance, new CascadeController(instance));\n }\n\n CascadeController.instances.get(instance)?.initProp(key, items);\n });\n } as PropertyDecorator;\n}\n"],
5
- "mappings": "AAEA,yEAKO,cAAgD,EAAoC,CACzF,MAAO,UAAS,EAAU,EAAuB,CAC/C,AAAC,EAAM,YAAuC,eAAe,GAAK,CAChE,GAAM,GAAW,EAGjB,AAAK,EAAkB,UAAU,IAAI,IACnC,EAAkB,UAAU,IAAI,EAAU,GAAI,GAAkB,IAGlE,EAAkB,UAAU,IAAI,IAAW,SAAS,EAAK",
5
+ "mappings": "AAEA,yEAKO,cAAgD,EAAoC,CACzF,MAAO,UAAS,EAAU,EAAuB,CAC/C,AAAC,EAAM,YAAuC,eAAe,GAAK,CAChE,GAAM,GAAW,EAGjB,AAAK,EAAkB,UAAU,IAAI,CAAQ,GAC3C,EAAkB,UAAU,IAAI,EAAU,GAAI,GAAkB,CAAQ,CAAC,EAG3E,EAAkB,UAAU,IAAI,CAAQ,GAAG,SAAS,EAAK,CAAK,CAChE,CAAC,CACH,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["initializer.ts"],
4
4
  "sourcesContent": ["import type { ReactiveElement } from 'lit';\nimport type { Options } from '../controllers/light-dom-controller.js';\n\nimport { LightDOMController } from '../controllers/light-dom-controller.js';\n\n/**\n * Runs the decorated method in `connectedCallback`,\n * provided the element has light children, and sets\n * up a mutation observer to re-run the callback,\n * unless opted-out with `{ observe: false }`\n * @param options Set `observe` to `false` to skip mutation observer setup, or pass a MutationObserverInit as options\n */\nexport function initializer<T extends ReactiveElement>(options?: Options) {\n return function(proto: T, key: string) {\n // @TODO: allow multiple initializers\n (proto.constructor as typeof ReactiveElement).addInitializer(instance => {\n const initializer = proto[key as keyof T] as unknown as () => void;\n const controller = new LightDOMController(instance as ReactiveElement, initializer, options);\n if (instance.isConnected) {\n controller.hostConnected();\n }\n });\n };\n}\n"],
5
- "mappings": "AAGA,4EASO,WAAgD,EAAmB,CACxE,MAAO,UAAS,EAAU,EAAa,CAErC,AAAC,EAAM,YAAuC,eAAe,GAAY,CACvE,GAAM,GAAc,EAAM,GACpB,EAAa,GAAI,GAAmB,EAA6B,EAAa,GACpF,AAAI,EAAS,aACX,EAAW",
5
+ "mappings": "AAGA,4EASO,WAAgD,EAAmB,CACxE,MAAO,UAAS,EAAU,EAAa,CAErC,AAAC,EAAM,YAAuC,eAAe,GAAY,CACvE,GAAM,GAAc,EAAM,GACpB,EAAa,GAAI,GAAmB,EAA6B,EAAa,CAAO,EAC3F,AAAI,EAAS,aACX,EAAW,cAAc,CAE7B,CAAC,CACH,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["observed.ts"],
4
4
  "sourcesContent": ["import type { ReactiveElement } from 'lit';\nimport type {\n ChangeCallback,\n ChangeCallbackName,\n PropertyObserverHost,\n} from '../controllers/property-observer-controller.js';\n\nimport {\n observedController,\n PropertyObserverController,\n} from '../controllers/property-observer-controller.js';\n\ntype TypedFieldDecorator<T> = (proto: T, key: string | keyof T) => void ;\n\n/**\n * Calls a _fooChanged method on the instance when the value changes.\n * Works on any class field. When using on lit observed properties,\n * Make sure `@observed` is to the left (i.e. called after) the `@property`\n * or `@state` decorator.\n *\n * @example observing a lit property\n * ```ts\n * @observed @property() foo = 'bar';\n *\n * protected _fooChanged(oldValue?: string, newValue?: string) {}\n * ```\n *\n * @example using a custom callback\n * ```ts\n * @observed('_myCallback') size = 'lg';\n *\n * _myCallback(_, size) {...}\n * ```\n *\n * @example using an arrow function\n * ```ts\n * @observed((oldVal, newVal) => console.log(`Size changed from ${oldVal} to ${newVal}`))\n * ```\n */\nexport function observed<T extends ReactiveElement>(methodName: string): TypedFieldDecorator<T>\nexport function observed<T extends ReactiveElement>(cb: ChangeCallback<T>): TypedFieldDecorator<T>\nexport function observed<T extends ReactiveElement>(proto: T, key: string): void\nexport function observed<T extends ReactiveElement>(...as: any[]): void|TypedFieldDecorator<T> {\n /** @observed('_myCustomChangeCallback') */\n if (as.length === 1) {\n const [methodNameOrCallback] = as;\n return function(proto, key) {\n (proto.constructor as typeof ReactiveElement)\n .addInitializer(x => new PropertyObserverController(x));\n observeProperty(proto, key, methodNameOrCallback);\n };\n } else {\n const [proto, key] = as;\n (proto.constructor as typeof ReactiveElement)\n .addInitializer(x => new PropertyObserverController(x));\n observeProperty(proto, key);\n }\n}\n\nexport function observeProperty<T extends ReactiveElement>(\n proto: T,\n key: string | keyof T,\n callbackOrMethod?: ChangeCallback<T>\n) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n Object.defineProperty(proto, key, {\n ...descriptor,\n configurable: true,\n set(this: PropertyObserverHost<T>, newVal: T[keyof T]) {\n const oldVal = this[key as keyof T];\n // first, call any pre-existing setters, e.g. `@property`\n descriptor?.set?.call(this, newVal);\n\n // if the user passed a callback, call it\n // e.g. `@observed((_, newVal) => console.log(newVal))`\n // safe to call before connectedCallback, because it's impossible to get a `this` ref.\n if (typeof callbackOrMethod === 'function') {\n callbackOrMethod.call(this, oldVal, newVal);\n } else {\n // if the user passed a string method name, call it on `this`\n // e.g. `@observed('_renderOptions')`\n // otherwise, use a default method name e.g. `_fooChanged`\n const actualMethodName = callbackOrMethod || `_${key}Changed`;\n\n // if the component has already connected to the DOM, run the callback\n // otherwise, If the component has not yet connected to the DOM,\n // cache the old and new values. See PropertyObserverController above\n if (this.hasUpdated) {\n this[actualMethodName as ChangeCallbackName]?.(oldVal, newVal);\n } else {\n this[observedController].cache(key as string, actualMethodName, oldVal, newVal);\n }\n }\n },\n });\n}\n"],
5
- "mappings": "AAOA,oHAmCO,cAAgD,EAAwC,CAE7F,GAAI,EAAG,SAAW,EAAG,CACnB,GAAM,CAAC,GAAwB,EAC/B,MAAO,UAAS,EAAO,EAAK,CAC1B,AAAC,EAAM,YACJ,eAAe,GAAK,GAAI,GAA2B,IACtD,EAAgB,EAAO,EAAK,QAEzB,CACL,GAAM,CAAC,EAAO,GAAO,EACrB,AAAC,EAAM,YACJ,eAAe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7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["pfelement.ts"],
4
4
  "sourcesContent": ["import type { ReactiveElement } from 'lit';\n\nimport { trackPerformance } from '../core.js';\n\nimport { ColorContextController } from '../controllers/color-context-controller.js';\nimport { PerfController } from '../controllers/perf-controller.js';\n\nfunction isReactiveElementClass(\n klass: Function // eslint-disable-line @typescript-eslint/ban-types\n): klass is typeof ReactiveElement {\n return typeof klass['addInitializer' as keyof typeof klass] === 'function';\n}\n\nlet waiting = false;\nconst queue = new Set<ReactiveElement>();\n\nasync function enqueue(instance: ReactiveElement) {\n queue.add(instance);\n\n // only the first call kicks off the 'timer'\n // but because of the while loop, subsequent calls will still cause an `await`\n if (!waiting) {\n waiting = true;\n while (queue.size) {\n const enqueued: Promise<boolean>[] = [];\n for (const instance of queue) {\n enqueued.push(instance.updateComplete);\n queue.delete(instance);\n }\n await Promise.all(enqueued);\n }\n document.body.removeAttribute('unresolved');\n }\n}\n\n/**\n * Adds pfelement APIs to the decorated custom-element class\n * 1. Adds readonly `version` field to the element constructor (class)\n * 2. Adds `[pfelement]` attr and `.PFElement` class in connectedCallback\n */\nexport function pfelement(): ClassDecorator {\n return function(klass) {\n if (!isReactiveElementClass(klass)) {\n throw new Error(`@pfelement may only decorate ReactiveElements. ${klass.name} is does not implement ReactiveElement.`);\n }\n\n klass.addInitializer(instance => {\n if (window.PfeConfig.autoReveal) {\n enqueue(instance);\n }\n\n // Set some global host DOM when it connects\n // by way of an ad-hoc controller\n instance.addController({\n hostConnected() {\n instance.setAttribute('pfelement', '');\n instance.classList.add('PFElement');\n },\n });\n\n // look mah, no instance property\n new ColorContextController(instance);\n\n if (trackPerformance()) {\n new PerfController(instance);\n }\n });\n };\n}\n"],
5
- "mappings": "AAEA,8CAEA,oFACA,mEAEA,WACE,EACiC,CACjC,MAAO,OAAO,GAAM,gBAA4C,WAGlE,GAAI,GAAU,GACR,EAAQ,GAAI,KAElB,iBAAuB,EAA2B,CAKhD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AQ,EAE/B,EAAiB,GACnB,GAAI,GAAe,CAAQ,CAE/B,CAAC,CACH,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["time.ts"],
4
4
  "sourcesContent": ["/**\n * Tracks the time a method takes to complete using the [performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance)\n */\nexport function time(tag?: string) {\n return function(_: unknown, key: string, descriptor: PropertyDescriptor) {\n const { value: f } = descriptor ?? {};\n\n if (!(typeof f === 'function')) {\n throw new Error('@time() may only decorate class methods');\n }\n\n descriptor.value = function(...args: any[]) {\n const TAG = tag ?? `${this.constructor.name}-${key}`;\n const START_TAG = `start-${TAG}`;\n const END_TAG = `end-${TAG}`;\n\n if (window.PfeConfig.trackPerformance) {\n performance.mark(START_TAG);\n }\n\n const x = f.call(this, ...args);\n\n const ret = () => {\n if (window.PfeConfig.trackPerformance) {\n performance.mark(END_TAG);\n performance.measure(TAG, START_TAG, END_TAG);\n // eslint-disable-next-line no-console\n console.log(Array.from(performance.getEntriesByName(TAG)).pop());\n }\n return x;\n };\n\n if (x instanceof Promise) {\n return x.then(ret);\n } else {\n return ret();\n }\n };\n };\n}\n"],
5
- "mappings": "AAGO,WAAc,EAAc,CACjC,MAAO,UAAS,EAAY,EAAa,EAAgC,CACvE,GAAM,CAAE,MAAO,GAAM,GAAc,GAEnC,GAAM,MAAO,IAAM,WACjB,KAAM,IAAI,OAAM,2CAGlB,EAAW,MAAQ,YAAY,EAAa,CAC1C,GAAM,GAAM,GAAO,GAAG,KAAK,YAAY,QAAQ,IACzC,EAAY,SAAS,IACrB,EAAU,OAAO,IAEvB,AAAI,OAAO,UAAU,kBACnB,YAAY,KAAK,GAGnB,GAAM,GAAI,EAAE,KAAK,KAAM,GAAG,GAEpB,EAAM,IACN,QAAO,UAAU,kBACnB,aAAY,KAAK,GACjB,YAAY,QAAQ,EAAK,EAAW,GAEpC,QAAQ,IAAI,MAAM,KAAK,YAAY,iBAAiB,IAAM,QAErD,GAGT,MAAI,aAAa,SACR,EAAE,KAAK,GAEP",
5
+ "mappings": "AAGO,WAAc,EAAc,CACjC,MAAO,UAAS,EAAY,EAAa,EAAgC,CACvE,GAAM,CAAE,MAAO,GAAM,GAAc,CAAC,EAEpC,GAAM,MAAO,IAAM,WACjB,KAAM,IAAI,OAAM,yCAAyC,EAG3D,EAAW,MAAQ,YAAY,EAAa,CAC1C,GAAM,GAAM,GAAO,GAAG,KAAK,YAAY,QAAQ,IACzC,EAAY,SAAS,IACrB,EAAU,OAAO,IAEvB,AAAI,OAAO,UAAU,kBACnB,YAAY,KAAK,CAAS,EAG5B,GAAM,GAAI,EAAE,KAAK,KAAM,GAAG,CAAI,EAExB,EAAM,IACN,QAAO,UAAU,kBACnB,aAAY,KAAK,CAAO,EACxB,YAAY,QAAQ,EAAK,EAAW,CAAO,EAE3C,QAAQ,IAAI,MAAM,KAAK,YAAY,iBAAiB,CAAG,CAAC,EAAE,IAAI,CAAC,GAE1D,GAGT,MAAI,aAAa,SACR,EAAE,KAAK,CAAG,EAEV,EAAI,CAEf,CACF,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["trace.ts"],
4
4
  "sourcesContent": ["/** Logs the result of a class method */\nexport function trace(tag?: string) {\n return function(_: unknown, key: string, descriptor: PropertyDescriptor) {\n const { value: f } = descriptor;\n descriptor.value = function(...args: any[]) {\n const x = f.call(this, ...args);\n\n const ret = () => {\n // eslint-disable-next-line no-console\n console.log(tag ?? key, x);\n return x;\n };\n\n if (x instanceof Promise) {\n return x.then(ret);\n } else {\n return ret();\n }\n };\n };\n}\n"],
5
- "mappings": "AACO,WAAe,EAAc,CAClC,MAAO,UAAS,EAAY,EAAa,EAAgC,CACvE,GAAM,CAAE,MAAO,GAAM,EACrB,EAAW,MAAQ,YAAY,EAAa,CAC1C,GAAM,GAAI,EAAE,KAAK,KAAM,GAAG,GAEpB,EAAM,IAEV,SAAQ,IAAI,GAAO,EAAK,GACjB,GAGT,MAAI,aAAa,SACR,EAAE,KAAK,GAEP",
5
+ "mappings": "AACO,WAAe,EAAc,CAClC,MAAO,UAAS,EAAY,EAAa,EAAgC,CACvE,GAAM,CAAE,MAAO,GAAM,EACrB,EAAW,MAAQ,YAAY,EAAa,CAC1C,GAAM,GAAI,EAAE,KAAK,KAAM,GAAG,CAAI,EAExB,EAAM,IAEV,SAAQ,IAAI,GAAO,EAAK,CAAC,EAClB,GAGT,MAAI,aAAa,SACR,EAAE,KAAK,CAAG,EAEV,EAAI,CAEf,CACF,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["debounce.ts"],
4
4
  "sourcesContent": ["/**\n * Debounce helper function\n * @see https://davidwalsh.name/javascript-debounce-function\n *\n * @param func Function to be debounced\n * @param delay How long until it will be run\n * @param immediate Whether it should be run at the start instead of the end of the debounce\n */\nexport function debounce(\n func: (...args: any[]) => unknown,\n delay: number,\n immediate = false\n) {\n let timeout: number|null;\n return function(this: unknown, ...args: any[]) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const context = this;\n const later = function() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout as number);\n timeout = window.setTimeout(later, delay);\n if (callNow) {\n func.apply(context, args);\n }\n };\n}\n"],
5
- "mappings": "AAQO,WACL,EACA,EACA,EAAY,GACZ,CACA,GAAI,GACJ,MAAO,aAA2B,EAAa,CAE7C,GAAM,GAAU,KACV,EAAQ,UAAW,CACvB,EAAU,KACL,GACH,EAAK,MAAM,EAAS,IAGlB,EAAU,GAAa,CAAC,EAC9B,aAAa,GACb,EAAU,OAAO,WAAW,EAAO,GAC/B,GACF,EAAK,MAAM,EAAS",
5
+ "mappings": "AAQO,WACL,EACA,EACA,EAAY,GACZ,CACA,GAAI,GACJ,MAAO,aAA2B,EAAa,CAE7C,GAAM,GAAU,KACV,EAAQ,UAAW,CACvB,EAAU,KACL,GACH,EAAK,MAAM,EAAS,CAAI,CAE5B,EACM,EAAU,GAAa,CAAC,EAC9B,aAAa,CAAiB,EAC9B,EAAU,OAAO,WAAW,EAAO,CAAK,EACpC,GACF,EAAK,MAAM,EAAS,CAAI,CAE5B,CACF",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["deprecatedCustomEvent.ts"],
4
4
  "sourcesContent": ["/**\n * Construct a CustomEvent with the given name and detail.\n * The event bubbles and is composed.\n */\nexport function deprecatedCustomEvent<T>(name: string, detail?: T): CustomEvent<T> {\n return new CustomEvent(name, {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n"],
5
- "mappings": "AAIO,WAAkC,EAAc,EAA4B,CACjF,MAAO,IAAI,aAAY,EAAM,CAC3B,QAAS,GACT,SAAU,GACV",
5
+ "mappings": "AAIO,WAAkC,EAAc,EAA4B,CACjF,MAAO,IAAI,aAAY,EAAM,CAC3B,QAAS,GACT,SAAU,GACV,QACF,CAAC,CACH",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["random.ts"],
4
4
  "sourcesContent": ["/**\n * A quick way to fetch a random ID value.\n * _Note:_ All values are prefixed automatically to ensure an ID-safe value is returned.\n * @param prefix id-safe string prefix\n */\nexport function getRandomId(prefix = 'pfe') {\n return `${prefix}-${Math.random().toString(36).substr(2, 9)}`;\n}\n"],
5
- "mappings": "AAKO,WAAqB,EAAS,MAAO,CAC1C,MAAO,GAAG,KAAU,KAAK,SAAS,SAAS,IAAI,OAAO,EAAG",
5
+ "mappings": "AAKO,WAAqB,EAAS,MAAO,CAC1C,MAAO,GAAG,KAAU,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,EAAG,CAAC,GAC5D",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/pfe-core",
3
- "version": "2.0.0-next.0",
3
+ "version": "2.0.0-next.1",
4
4
  "license": "MIT",
5
5
  "description": "PatternFly Elements Core Library",
6
6
  "customElements": "custom-elements.json",