@vibe-flags/core 0.1.5 → 0.1.6
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/dist/index.d.ts +0 -4
- package/dist/vibe-flags.cdn.js +11 -11
- package/dist/vibe-flags.cdn.mjs +109 -123
- package/dist/vibe-flags.js +73 -87
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -67,10 +67,6 @@ export declare class VibeFlagOption extends LitElement {
|
|
|
67
67
|
protected render(): TemplateResult<1> | typeof nothing;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export declare class VibeFlags extends LitElement {
|
|
71
|
-
protected render(): TemplateResult<1>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
70
|
export declare class VibeFlagSelect extends LitElement {
|
|
75
71
|
name: string;
|
|
76
72
|
description: string;
|
package/dist/vibe-flags.cdn.js
CHANGED
|
@@ -2,33 +2,33 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const H=globalThis,L=H.ShadowRoot&&(H.ShadyCSS===void 0||H.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,q=Symbol(),te=new WeakMap;let se=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(L&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=te.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&te.set(t,e))}return e}toString(){return this.cssText}};const ye=r=>new se(typeof r=="string"?r:r+"",void 0,q),W=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new se(t,r,q)},$e=(r,e)=>{if(L)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=H.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},ie=L?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return ye(t)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:me,defineProperty:xe,getOwnPropertyDescriptor:_e,getOwnPropertyNames:we,getOwnPropertySymbols:Ae,getPrototypeOf:Se}=Object,
|
|
9
|
+
*/const{is:me,defineProperty:xe,getOwnPropertyDescriptor:_e,getOwnPropertyNames:we,getOwnPropertySymbols:Ae,getPrototypeOf:Se}=Object,R=globalThis,re=R.trustedTypes,Ee=re?re.emptyScript:"",Ce=R.reactiveElementPolyfillSupport,C=(r,e)=>r,j={toAttribute(r,e){switch(e){case Boolean:r=r?Ee:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},K=(r,e)=>!me(r,e),oe={attribute:!0,type:String,converter:j,reflect:!1,useDefault:!1,hasChanged:K};Symbol.metadata??=Symbol("metadata"),R.litPropertyMetadata??=new WeakMap;let A=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=oe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&xe(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:o}=_e(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:i,set(n){const h=i?.call(this);o?.call(this,n),this.requestUpdate(e,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??oe}static _$Ei(){if(this.hasOwnProperty(C("elementProperties")))return;const e=Se(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const t=this.properties,s=[...we(t),...Ae(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(ie(i))}else e!==void 0&&t.push(ie(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $e(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const o=(s.converter?.toAttribute!==void 0?s.converter:j).toAttribute(t,s.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:j;this._$Em=i;const h=n.fromAttribute(t,o.type);this[i]=h??this._$Ej?.get(i)??h,this._$Em=null}}requestUpdate(e,t,s,i=!1,o){if(e!==void 0){const n=this.constructor;if(i===!1&&(o=this[e]),s??=n.getPropertyOptions(e),!((s.hasChanged??K)(o,t)||s.useDefault&&s.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:n}=o,h=this[i];n!==!0||this._$AL.has(i)||h===void 0||this.C(i,void 0,o,h)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[C("elementProperties")]=new Map,A[C("finalized")]=new Map,Ce?.({ReactiveElement:A}),(R.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const J=globalThis,ne=r=>r,
|
|
13
|
+
*/const J=globalThis,ne=r=>r,B=J.trustedTypes,ae=B?B.createPolicy("lit-html",{createHTML:r=>r}):void 0,le="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,he="?"+b,ke=`<${he}>`,x=document,k=()=>x.createComment(""),O=r=>r===null||typeof r!="object"&&typeof r!="function",Y=Array.isArray,Oe=r=>Y(r)||typeof r?.[Symbol.iterator]=="function",Z=`[
|
|
14
14
|
\f\r]`,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ce=/-->/g,de=/>/g,_=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),pe=/'/g,fe=/"/g,ue=/^(?:script|style|textarea|title)$/i,Pe=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),u=Pe(1),S=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ge=new WeakMap,w=x.createTreeWalker(x,129);function ve(r,e){if(!Y(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ae!==void 0?ae.createHTML(e):e}const
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),pe=/'/g,fe=/"/g,ue=/^(?:script|style|textarea|title)$/i,Pe=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),u=Pe(1),S=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ge=new WeakMap,w=x.createTreeWalker(x,129);function ve(r,e){if(!Y(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ae!==void 0?ae.createHTML(e):e}const Me=(r,e)=>{const t=r.length-1,s=[];let i,o=e===2?"<svg>":e===3?"<math>":"",n=P;for(let h=0;h<t;h++){const a=r[h];let p,f,c=-1,v=0;for(;v<a.length&&(n.lastIndex=v,f=n.exec(a),f!==null);)v=n.lastIndex,n===P?f[1]==="!--"?n=ce:f[1]!==void 0?n=de:f[2]!==void 0?(ue.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=_):f[3]!==void 0&&(n=_):n===_?f[0]===">"?(n=i??P,c=-1):f[1]===void 0?c=-2:(c=n.lastIndex-f[2].length,p=f[1],n=f[3]===void 0?_:f[3]==='"'?fe:pe):n===fe||n===pe?n=_:n===ce||n===de?n=P:(n=_,i=void 0);const m=n===_&&r[h+1].startsWith("/>")?" ":"";o+=n===P?a+ke:c>=0?(s.push(p),a.slice(0,c)+le+a.slice(c)+b+m):a+b+(c===-2?h:m)}return[ve(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class M{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let o=0,n=0;const h=e.length-1,a=this.parts,[p,f]=Me(e,t);if(this.el=M.createElement(p,s),w.currentNode=this.el.content,t===2||t===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=w.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(le)){const v=f[n++],m=i.getAttribute(c).split(b),D=/([.?@])?(.*)/.exec(v);a.push({type:1,index:o,name:D[2],strings:m,ctor:D[1]==="."?Fe:D[1]==="?"?Ue:D[1]==="@"?Ve:I}),i.removeAttribute(c)}else c.startsWith(b)&&(a.push({type:6,index:o}),i.removeAttribute(c));if(ue.test(i.tagName)){const c=i.textContent.split(b),v=c.length-1;if(v>0){i.textContent=B?B.emptyScript:"";for(let m=0;m<v;m++)i.append(c[m],k()),w.nextNode(),a.push({type:2,index:++o});i.append(c[v],k())}}}else if(i.nodeType===8)if(i.data===he)a.push({type:2,index:o});else{let c=-1;for(;(c=i.data.indexOf(b,c+1))!==-1;)a.push({type:7,index:o}),c+=b.length-1}o++}}static createElement(e,t){const s=x.createElement("template");return s.innerHTML=e,s}}function E(r,e,t=r,s){if(e===S)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const o=O(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=E(r,i._$AS(r,e.values),i,s)),e}class Te{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??x).importNode(t,!0);w.currentNode=i;let o=w.nextNode(),n=0,h=0,a=s[0];for(;a!==void 0;){if(n===a.index){let p;a.type===2?p=new T(o,o.nextSibling,this,e):a.type===1?p=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(p=new Ne(o,this,e)),this._$AV.push(p),a=s[++h]}n!==a?.index&&(o=w.nextNode(),n++)}return w.currentNode=x,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class T{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),O(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==S&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Oe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=M.createElement(ve(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const o=new Te(i,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=ge.get(e.strings);return t===void 0&&ge.set(e.strings,t=new M(e)),t}k(e){Y(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const o of e)i===t.length?t.push(s=new T(this.O(k()),this.O(k()),this,this.options)):s=t[i],s._$AI(o),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=ne(e).nextSibling;ne(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(e,t=this,s,i){const o=this.strings;let n=!1;if(o===void 0)e=E(this,e,t,0),n=!O(e)||e!==this._$AH&&e!==S,n&&(this._$AH=e);else{const h=e;let a,p;for(e=o[0],a=0;a<o.length-1;a++)p=E(this,h[s+a],t,a),p===S&&(p=this._$AH[a]),n||=!O(p)||p!==this._$AH[a],p===d?e=d:e!==d&&(e+=(p??"")+o[a+1]),this._$AH[a]=p}n&&!i&&this.j(e)}j(e){e===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Fe extends I{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===d?void 0:e}}class Ue extends I{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==d)}}class Ve extends I{constructor(e,t,s,i,o){super(e,t,s,i,o),this.type=5}_$AI(e,t=this){if((e=E(this,e,t,0)??d)===S)return;const s=this._$AH,i=e===d&&s!==d||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,o=e!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Ne{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){E(this,e)}}const He=J.litHtmlPolyfillSupport;He?.(M,T),(J.litHtmlVersions??=[]).push("3.3.2");const Re=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const o=t?.renderBefore??null;s._$litPart$=i=new T(e.insertBefore(k(),o),o,void 0,t??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const X=globalThis;class
|
|
19
|
+
*/const X=globalThis;class y extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return S}}y._$litElement$=!0,y.finalized=!0,X.litElementHydrateSupport?.({LitElement:y});const je=X.litElementPolyfillSupport;je?.({LitElement:y}),(X.litElementVersions??=[]).push("4.2.2");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const z=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const Be={attribute:!0,type:String,converter:
|
|
27
|
+
*/const Be={attribute:!0,type:String,converter:j,reflect:!1,hasChanged:K},Ie=(r=Be,e,t)=>{const{kind:s,metadata:i}=t;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),s==="accessor"){const{name:n}=t;return{set(h){const a=e.get.call(this);e.set.call(this,h),this.requestUpdate(n,a,r,!0,h)},init(h){return h!==void 0&&this.C(n,void 0,r,h),h}}}if(s==="setter"){const{name:n}=t;return function(h){const a=this[n];e.call(this,h),this.requestUpdate(n,a,r,!0,h)}}throw Error("Unsupported decorator location: "+s)};function $(r){return(e,t)=>typeof t=="object"?Ie(r,e,t):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function F(r){return $({...r,state:!0,attribute:!1})}const U="vibe-flags:";function G(r){return r.type==="boolean"?!1:r.options[0]||""}class ze extends EventTarget{constructor(){super(...arguments),this.configs=new Map,this.state={},this.listening=!1,this.onStorageEvent=e=>{if(!e.key?.startsWith(U))return;const t=e.key.slice(U.length),s=this.configs.get(t);if(s)try{const i=e.newValue?JSON.parse(e.newValue):G(s);this.state[t]=i,this.dispatch(t)}catch{}}}register(e){this.configs.set(e.key,e);const t=G(e),s=this.readFromStorage(e.key),i=s!==null&&(e.type==="boolean"&&typeof s=="boolean"||e.type==="select"&&typeof s=="string"&&e.options.includes(s));this.state[e.key]=i?s:t,this.listening||(this.listening=!0,typeof window<"u"&&window.addEventListener("storage",this.onStorageEvent)),this.dispatch(e.key)}unregister(e){this.configs.delete(e),delete this.state[e],this.dispatch()}get(e){return this.state[e]}set(e,t){const s=this.configs.get(e);s&&(s.type==="boolean"&&typeof t!="boolean"||s.type==="select"&&(typeof t!="string"||!s.options.includes(t))||(this.state[e]=t,this.writeToStorage(e,t),this.dispatch(e)))}getAll(){return{...this.state}}getConfig(){return Array.from(this.configs.values())}getConfigForKey(e){return this.configs.get(e)}reset(){for(const[e,t]of this.configs)this.state[e]=G(t),this.removeFromStorage(e);this.dispatch()}readFromStorage(e){if(typeof window>"u")return null;try{const t=localStorage.getItem(U+e);return t===null?null:JSON.parse(t)}catch{return null}}writeToStorage(e,t){if(!(typeof window>"u"))try{localStorage.setItem(U+e,JSON.stringify(t))}catch{}}removeFromStorage(e){if(!(typeof window>"u"))try{localStorage.removeItem(U+e)}catch{}}dispatch(e){const t={key:e,state:this.getAll()},s=new CustomEvent("vibe-flags-changed",{detail:t,bubbles:!0});this.dispatchEvent(s),typeof window<"u"&&window.dispatchEvent(new CustomEvent("vibe-flags-changed",{detail:t}))}}const g=new ze;var De=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,V=(r,e,t,s)=>{for(var i=s>1?void 0:s?Le(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(e,t,i):n(i))||i);return s&&i&&De(e,t,i),i};if(typeof document<"u"&&!document.getElementById("vibe-flag-fouc")){const r=document.createElement("style");r.id="vibe-flag-fouc",r.textContent="vibe-flag-boolean:not(:defined),vibe-flag-boolean:defined,vibe-flag-select:not(:defined),vibe-flag-select:defined,vibe-flag-option:not(:defined),vibe-flag-option:defined{display:none}",document.head.appendChild(r)}l.VibeFlagBoolean=class extends y{constructor(){super(...arguments),this.name="",this.description="",this.value="",this.isMatch=!1,this.onFlagChange=()=>{this.evaluate()}}connectedCallback(){super.connectedCallback(),window.addEventListener("vibe-flags-changed",this.onFlagChange),this.registerFlag()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("vibe-flags-changed",this.onFlagChange)}firstUpdated(){this.style.display="contents"}willUpdate(e){(e.has("name")||e.has("description"))&&this.registerFlag()}registerFlag(){this.name&&(g.getConfigForKey(this.name)||g.register({key:this.name,type:"boolean",label:this.description||void 0}),this.evaluate())}evaluate(){const e=g.get(this.name);e===void 0?this.isMatch=!1:this.value===""?this.isMatch=!0:this.isMatch=String(e)===this.value,this.isMatch?this.setAttribute("active",""):this.removeAttribute("active")}render(){return this.isMatch?u`<slot></slot>`:d}},V([$({type:String})],l.VibeFlagBoolean.prototype,"name",2),V([$({type:String})],l.VibeFlagBoolean.prototype,"description",2),V([$({type:String})],l.VibeFlagBoolean.prototype,"value",2),V([F()],l.VibeFlagBoolean.prototype,"isMatch",2),l.VibeFlagBoolean=V([z("vibe-flag-boolean")],l.VibeFlagBoolean);var qe=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Q=(r,e,t,s)=>{for(var i=s>1?void 0:s?We(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(e,t,i):n(i))||i);return s&&i&&qe(e,t,i),i};l.VibeFlagSelect=class extends y{constructor(){super(...arguments),this.name="",this.description="",this.onFlagChange=()=>{this.syncOptions()}}connectedCallback(){super.connectedCallback(),window.addEventListener("vibe-flags-changed",this.onFlagChange),queueMicrotask(()=>this.registerFlag())}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("vibe-flags-changed",this.onFlagChange)}firstUpdated(){this.style.display="contents"}willUpdate(e){(e.has("name")||e.has("description"))&&this.registerFlag()}getOptions(){return Array.from(this.querySelectorAll("vibe-flag-option"))}registerFlag(){if(!this.name)return;const e=this.getOptions().map(t=>t.value).filter(Boolean);e.length!==0&&(g.getConfigForKey(this.name)||g.register({key:this.name,type:"select",options:e,label:this.description||void 0}),this.syncOptions())}syncOptions(){const e=g.get(this.name);for(const t of this.getOptions())t.active=t.value===e}render(){return u`<slot></slot>`}},Q([$({type:String})],l.VibeFlagSelect.prototype,"name",2),Q([$({type:String})],l.VibeFlagSelect.prototype,"description",2),l.VibeFlagSelect=Q([z("vibe-flag-select")],l.VibeFlagSelect);var Ke=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,ee=(r,e,t,s)=>{for(var i=s>1?void 0:s?Je(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(e,t,i):n(i))||i);return s&&i&&Ke(e,t,i),i};l.VibeFlagOption=class extends y{constructor(){super(...arguments),this.value="",this.active=!1}firstUpdated(){this.style.display="contents"}render(){return this.active?u`<slot></slot>`:d}},ee([$({type:String})],l.VibeFlagOption.prototype,"value",2),ee([$({type:Boolean,reflect:!0})],l.VibeFlagOption.prototype,"active",2),l.VibeFlagOption=ee([z("vibe-flag-option")],l.VibeFlagOption);const Ye=W`
|
|
32
32
|
:host {
|
|
33
33
|
--vf-bg: #0a0a0a;
|
|
34
34
|
--vf-bg-muted: #171717;
|
|
@@ -52,7 +52,7 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
52
52
|
--vf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6),
|
|
53
53
|
0 8px 10px -6px rgba(0, 0, 0, 0.6);
|
|
54
54
|
}
|
|
55
|
-
`,
|
|
55
|
+
`,Ze=W`
|
|
56
56
|
:host {
|
|
57
57
|
--vf-bg: #ffffff;
|
|
58
58
|
--vf-bg-muted: #f5f5f5;
|
|
@@ -76,7 +76,7 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
76
76
|
--vf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
77
77
|
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
78
78
|
}
|
|
79
|
-
`;var
|
|
79
|
+
`;var Xe=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,N=(r,e,t,s)=>{for(var i=s>1?void 0:s?Ge(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(e,t,i):n(i))||i);return s&&i&&Xe(e,t,i),i};const be="vibeFlagsTheme";return l.VibeToolbar=class extends y{constructor(){super(...arguments),this.open=!1,this.flags={},this.configs=[],this.darkMode=!0,this.onFlagChange=()=>{this.syncFromStore()}}connectedCallback(){super.connectedCallback(),window.addEventListener("vibe-flags-changed",this.onFlagChange),this.syncFromStore(),this.loadTheme()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("vibe-flags-changed",this.onFlagChange)}loadTheme(){if(typeof window>"u")return;const e=localStorage.getItem(be);this.darkMode=e?e==="dark":!0,this.applyTheme()}toggleTheme(){this.darkMode=!this.darkMode,localStorage.setItem(be,this.darkMode?"dark":"light"),this.applyTheme()}applyTheme(){const e=this.darkMode?Ye:Ze,t=new CSSStyleSheet;t.replaceSync(e.cssText),this.shadowRoot.adoptedStyleSheets=[...l.VibeToolbar.elementStyles.map(s=>s.styleSheet),t]}syncFromStore(){this.configs=g.getConfig(),this.flags=g.getAll()}toggle(){this.open=!this.open}onToggle(e){const t=this.flags[e];g.set(e,!t)}onSelect(e,t){const s=t.target;g.set(e,s.value)}onReset(){g.reset()}renderFlagIcon(){return u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg>`}renderCloseIcon(){return u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`}renderChevronDown(){return u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>`}renderSunIcon(){return u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>`}renderMoonIcon(){return u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>`}renderBooleanFlag(e){const t=this.flags[e.key]===!0;return u`
|
|
80
80
|
<div class="flag-item">
|
|
81
81
|
<div class="flag-row">
|
|
82
82
|
<div class="flag-info">
|
|
@@ -446,4 +446,4 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
446
446
|
color: var(--vf-text-muted);
|
|
447
447
|
font-size: 12px;
|
|
448
448
|
}
|
|
449
|
-
`],
|
|
449
|
+
`],N([F()],l.VibeToolbar.prototype,"open",2),N([F()],l.VibeToolbar.prototype,"flags",2),N([F()],l.VibeToolbar.prototype,"configs",2),N([F()],l.VibeToolbar.prototype,"darkMode",2),l.VibeToolbar=N([z("vibe-toolbar")],l.VibeToolbar),l.flagStore=g,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),l})({});
|
package/dist/vibe-flags.cdn.mjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
7
|
-
let
|
|
6
|
+
const I = globalThis, Y = I.ShadowRoot && (I.ShadyCSS === void 0 || I.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Z = Symbol(), re = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let ve = class {
|
|
8
8
|
constructor(e, t, s) {
|
|
9
9
|
if (this._$cssResult$ = !0, s !== Z) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = e, this.t = t;
|
|
@@ -22,33 +22,33 @@ let be = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const xe = (i) => new ve(typeof i == "string" ? i : i + "", void 0, Z), X = (i, ...e) => {
|
|
26
26
|
const t = i.length === 1 ? i[0] : e.reduce((s, r, o) => s + ((n) => {
|
|
27
27
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
28
28
|
if (typeof n == "number") return n;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(r) + i[o + 1], i[0]);
|
|
31
|
-
return new
|
|
32
|
-
},
|
|
31
|
+
return new ve(t, i, Z);
|
|
32
|
+
}, _e = (i, e) => {
|
|
33
33
|
if (Y) i.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
34
34
|
else for (const t of e) {
|
|
35
|
-
const s = document.createElement("style"), r =
|
|
35
|
+
const s = document.createElement("style"), r = I.litNonce;
|
|
36
36
|
r !== void 0 && s.setAttribute("nonce", r), s.textContent = t.cssText, i.appendChild(s);
|
|
37
37
|
}
|
|
38
38
|
}, oe = Y ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
|
|
39
39
|
let t = "";
|
|
40
40
|
for (const s of e.cssRules) t += s.cssText;
|
|
41
|
-
return
|
|
41
|
+
return xe(t);
|
|
42
42
|
})(i) : i;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is:
|
|
48
|
+
const { is: we, defineProperty: Ae, getOwnPropertyDescriptor: Se, getOwnPropertyNames: Ee, getOwnPropertySymbols: Ce, getPrototypeOf: ke } = Object, V = globalThis, ne = V.trustedTypes, Pe = ne ? ne.emptyScript : "", Oe = V.reactiveElementPolyfillSupport, O = (i, e) => i, z = { toAttribute(i, e) {
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
i = i ?
|
|
51
|
+
i = i ? Pe : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,8 +73,8 @@ const { is: Ae, defineProperty: Se, getOwnPropertyDescriptor: Ee, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return t;
|
|
76
|
-
} }, G = (i, e) => !
|
|
77
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
76
|
+
} }, G = (i, e) => !we(i, e), ae = { attribute: !0, type: String, converter: z, reflect: !1, useDefault: !1, hasChanged: G };
|
|
77
|
+
Symbol.metadata ??= Symbol("metadata"), V.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
78
|
let A = class extends HTMLElement {
|
|
79
79
|
static addInitializer(e) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(e);
|
|
@@ -85,11 +85,11 @@ let A = class extends HTMLElement {
|
|
|
85
85
|
static createProperty(e, t = ae) {
|
|
86
86
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
87
87
|
const s = Symbol(), r = this.getPropertyDescriptor(e, s, t);
|
|
88
|
-
r !== void 0 &&
|
|
88
|
+
r !== void 0 && Ae(this.prototype, e, r);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(e, t, s) {
|
|
92
|
-
const { get: r, set: o } =
|
|
92
|
+
const { get: r, set: o } = Se(this.prototype, e) ?? { get() {
|
|
93
93
|
return this[t];
|
|
94
94
|
}, set(n) {
|
|
95
95
|
this[t] = n;
|
|
@@ -104,13 +104,13 @@ let A = class extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
106
|
if (this.hasOwnProperty(O("elementProperties"))) return;
|
|
107
|
-
const e =
|
|
107
|
+
const e = ke(this);
|
|
108
108
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
111
|
if (this.hasOwnProperty(O("finalized"))) return;
|
|
112
112
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) {
|
|
113
|
-
const t = this.properties, s = [...
|
|
113
|
+
const t = this.properties, s = [...Ee(t), ...Ce(t)];
|
|
114
114
|
for (const r of s) this.createProperty(r, t[r]);
|
|
115
115
|
}
|
|
116
116
|
const e = this[Symbol.metadata];
|
|
@@ -156,7 +156,7 @@ let A = class extends HTMLElement {
|
|
|
156
156
|
}
|
|
157
157
|
createRenderRoot() {
|
|
158
158
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
159
|
-
return
|
|
159
|
+
return _e(e, this.constructor.elementStyles), e;
|
|
160
160
|
}
|
|
161
161
|
connectedCallback() {
|
|
162
162
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
@@ -256,59 +256,59 @@ let A = class extends HTMLElement {
|
|
|
256
256
|
firstUpdated(e) {
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[O("elementProperties")] = /* @__PURE__ */ new Map(), A[O("finalized")] = /* @__PURE__ */ new Map(),
|
|
259
|
+
A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[O("elementProperties")] = /* @__PURE__ */ new Map(), A[O("finalized")] = /* @__PURE__ */ new Map(), Oe?.({ ReactiveElement: A }), (V.reactiveElementVersions ??= []).push("2.1.2");
|
|
260
260
|
/**
|
|
261
261
|
* @license
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
263
263
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
264
|
*/
|
|
265
|
-
const Q = globalThis, le = (i) => i,
|
|
265
|
+
const Q = globalThis, le = (i) => i, D = Q.trustedTypes, he = D ? D.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, be = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, ye = "?" + b, Me = `<${ye}>`, w = document, M = () => w.createComment(""), T = (i) => i === null || typeof i != "object" && typeof i != "function", ee = Array.isArray, Te = (i) => ee(i) || typeof i?.[Symbol.iterator] == "function", K = `[
|
|
266
266
|
\f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ce = /-->/g, de = />/g, x = RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
|
|
267
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), pe = /'/g, fe = /"/g,
|
|
268
|
-
function
|
|
267
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), pe = /'/g, fe = /"/g, $e = /^(?:script|style|textarea|title)$/i, Ue = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), f = Ue(1), S = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ue = /* @__PURE__ */ new WeakMap(), _ = w.createTreeWalker(w, 129);
|
|
268
|
+
function me(i, e) {
|
|
269
269
|
if (!ee(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
270
270
|
return he !== void 0 ? he.createHTML(e) : e;
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const Fe = (i, e) => {
|
|
273
273
|
const t = i.length - 1, s = [];
|
|
274
274
|
let r, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = k;
|
|
275
275
|
for (let l = 0; l < t; l++) {
|
|
276
276
|
const a = i[l];
|
|
277
277
|
let d, p, h = -1, g = 0;
|
|
278
|
-
for (; g < a.length && (n.lastIndex = g, p = n.exec(a), p !== null); ) g = n.lastIndex, n === k ? p[1] === "!--" ? n = ce : p[1] !== void 0 ? n = de : p[2] !== void 0 ? (
|
|
279
|
-
const
|
|
280
|
-
o += n === k ? a +
|
|
278
|
+
for (; g < a.length && (n.lastIndex = g, p = n.exec(a), p !== null); ) g = n.lastIndex, n === k ? p[1] === "!--" ? n = ce : p[1] !== void 0 ? n = de : p[2] !== void 0 ? ($e.test(p[2]) && (r = RegExp("</" + p[2], "g")), n = x) : p[3] !== void 0 && (n = x) : n === x ? p[0] === ">" ? (n = r ?? k, h = -1) : p[1] === void 0 ? h = -2 : (h = n.lastIndex - p[2].length, d = p[1], n = p[3] === void 0 ? x : p[3] === '"' ? fe : pe) : n === fe || n === pe ? n = x : n === ce || n === de ? n = k : (n = x, r = void 0);
|
|
279
|
+
const v = n === x && i[l + 1].startsWith("/>") ? " " : "";
|
|
280
|
+
o += n === k ? a + Me : h >= 0 ? (s.push(d), a.slice(0, h) + be + a.slice(h) + b + v) : a + b + (h === -2 ? l : v);
|
|
281
281
|
}
|
|
282
|
-
return [
|
|
282
|
+
return [me(i, o + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
283
283
|
};
|
|
284
284
|
class U {
|
|
285
285
|
constructor({ strings: e, _$litType$: t }, s) {
|
|
286
286
|
let r;
|
|
287
287
|
this.parts = [];
|
|
288
288
|
let o = 0, n = 0;
|
|
289
|
-
const l = e.length - 1, a = this.parts, [d, p] =
|
|
289
|
+
const l = e.length - 1, a = this.parts, [d, p] = Fe(e, t);
|
|
290
290
|
if (this.el = U.createElement(d, s), _.currentNode = this.el.content, t === 2 || t === 3) {
|
|
291
291
|
const h = this.el.content.firstChild;
|
|
292
292
|
h.replaceWith(...h.childNodes);
|
|
293
293
|
}
|
|
294
294
|
for (; (r = _.nextNode()) !== null && a.length < l; ) {
|
|
295
295
|
if (r.nodeType === 1) {
|
|
296
|
-
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(
|
|
297
|
-
const g = p[n++],
|
|
298
|
-
a.push({ type: 1, index: o, name:
|
|
299
|
-
} else h.startsWith(
|
|
300
|
-
if (
|
|
301
|
-
const h = r.textContent.split(
|
|
296
|
+
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(be)) {
|
|
297
|
+
const g = p[n++], v = r.getAttribute(h).split(b), j = /([.?@])?(.*)/.exec(g);
|
|
298
|
+
a.push({ type: 1, index: o, name: j[2], strings: v, ctor: j[1] === "." ? He : j[1] === "?" ? Re : j[1] === "@" ? je : q }), r.removeAttribute(h);
|
|
299
|
+
} else h.startsWith(b) && (a.push({ type: 6, index: o }), r.removeAttribute(h));
|
|
300
|
+
if ($e.test(r.tagName)) {
|
|
301
|
+
const h = r.textContent.split(b), g = h.length - 1;
|
|
302
302
|
if (g > 0) {
|
|
303
|
-
r.textContent =
|
|
304
|
-
for (let
|
|
303
|
+
r.textContent = D ? D.emptyScript : "";
|
|
304
|
+
for (let v = 0; v < g; v++) r.append(h[v], M()), _.nextNode(), a.push({ type: 2, index: ++o });
|
|
305
305
|
r.append(h[g], M());
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
} else if (r.nodeType === 8) if (r.data ===
|
|
308
|
+
} else if (r.nodeType === 8) if (r.data === ye) a.push({ type: 2, index: o });
|
|
309
309
|
else {
|
|
310
310
|
let h = -1;
|
|
311
|
-
for (; (h = r.data.indexOf(
|
|
311
|
+
for (; (h = r.data.indexOf(b, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += b.length - 1;
|
|
312
312
|
}
|
|
313
313
|
o++;
|
|
314
314
|
}
|
|
@@ -324,7 +324,7 @@ function E(i, e, t = i, s) {
|
|
|
324
324
|
const o = T(e) ? void 0 : e._$litDirective$;
|
|
325
325
|
return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = r : t._$Cl = r), r !== void 0 && (e = E(i, r._$AS(i, e.values), r, s)), e;
|
|
326
326
|
}
|
|
327
|
-
class
|
|
327
|
+
class Ne {
|
|
328
328
|
constructor(e, t) {
|
|
329
329
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
330
330
|
}
|
|
@@ -341,7 +341,7 @@ class He {
|
|
|
341
341
|
for (; a !== void 0; ) {
|
|
342
342
|
if (n === a.index) {
|
|
343
343
|
let d;
|
|
344
|
-
a.type === 2 ? d = new F(o, o.nextSibling, this, e) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (d = new
|
|
344
|
+
a.type === 2 ? d = new F(o, o.nextSibling, this, e) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (d = new Ie(o, this, e)), this._$AV.push(d), a = s[++l];
|
|
345
345
|
}
|
|
346
346
|
n !== a?.index && (o = _.nextNode(), n++);
|
|
347
347
|
}
|
|
@@ -371,7 +371,7 @@ class F {
|
|
|
371
371
|
return this._$AB;
|
|
372
372
|
}
|
|
373
373
|
_$AI(e, t = this) {
|
|
374
|
-
e = E(this, e, t), T(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== S && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) :
|
|
374
|
+
e = E(this, e, t), T(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== S && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Te(e) ? this.k(e) : this._(e);
|
|
375
375
|
}
|
|
376
376
|
O(e) {
|
|
377
377
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -383,10 +383,10 @@ class F {
|
|
|
383
383
|
this._$AH !== c && T(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
|
|
384
384
|
}
|
|
385
385
|
$(e) {
|
|
386
|
-
const { values: t, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = U.createElement(
|
|
386
|
+
const { values: t, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = U.createElement(me(s.h, s.h[0]), this.options)), s);
|
|
387
387
|
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
388
388
|
else {
|
|
389
|
-
const o = new
|
|
389
|
+
const o = new Ne(r, this), n = o.u(this.options);
|
|
390
390
|
o.p(t), this.T(n), this._$AH = o;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
@@ -411,7 +411,7 @@ class F {
|
|
|
411
411
|
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
class
|
|
414
|
+
class q {
|
|
415
415
|
get tagName() {
|
|
416
416
|
return this.element.tagName;
|
|
417
417
|
}
|
|
@@ -436,7 +436,7 @@ class W {
|
|
|
436
436
|
e === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
class
|
|
439
|
+
class He extends q {
|
|
440
440
|
constructor() {
|
|
441
441
|
super(...arguments), this.type = 3;
|
|
442
442
|
}
|
|
@@ -444,7 +444,7 @@ class Re extends W {
|
|
|
444
444
|
this.element[this.name] = e === c ? void 0 : e;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
class
|
|
447
|
+
class Re extends q {
|
|
448
448
|
constructor() {
|
|
449
449
|
super(...arguments), this.type = 4;
|
|
450
450
|
}
|
|
@@ -452,7 +452,7 @@ class je extends W {
|
|
|
452
452
|
this.element.toggleAttribute(this.name, !!e && e !== c);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class je extends q {
|
|
456
456
|
constructor(e, t, s, r, o) {
|
|
457
457
|
super(e, t, s, r, o), this.type = 5;
|
|
458
458
|
}
|
|
@@ -465,7 +465,7 @@ class Ie extends W {
|
|
|
465
465
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
class
|
|
468
|
+
class Ie {
|
|
469
469
|
constructor(e, t, s) {
|
|
470
470
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
471
471
|
}
|
|
@@ -478,7 +478,7 @@ class De {
|
|
|
478
478
|
}
|
|
479
479
|
const ze = Q.litHtmlPolyfillSupport;
|
|
480
480
|
ze?.(U, F), (Q.litHtmlVersions ??= []).push("3.3.2");
|
|
481
|
-
const
|
|
481
|
+
const De = (i, e, t) => {
|
|
482
482
|
const s = t?.renderBefore ?? e;
|
|
483
483
|
let r = s._$litPart$;
|
|
484
484
|
if (r === void 0) {
|
|
@@ -493,7 +493,7 @@ const Be = (i, e, t) => {
|
|
|
493
493
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
494
494
|
*/
|
|
495
495
|
const te = globalThis;
|
|
496
|
-
class
|
|
496
|
+
class y extends A {
|
|
497
497
|
constructor() {
|
|
498
498
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
499
499
|
}
|
|
@@ -503,7 +503,7 @@ class v extends A {
|
|
|
503
503
|
}
|
|
504
504
|
update(e) {
|
|
505
505
|
const t = this.render();
|
|
506
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
506
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = De(t, this.renderRoot, this.renderOptions);
|
|
507
507
|
}
|
|
508
508
|
connectedCallback() {
|
|
509
509
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -515,16 +515,16 @@ class v extends A {
|
|
|
515
515
|
return S;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
518
|
+
y._$litElement$ = !0, y.finalized = !0, te.litElementHydrateSupport?.({ LitElement: y });
|
|
519
|
+
const Be = te.litElementPolyfillSupport;
|
|
520
|
+
Be?.({ LitElement: y });
|
|
521
521
|
(te.litElementVersions ??= []).push("4.2.2");
|
|
522
522
|
/**
|
|
523
523
|
* @license
|
|
524
524
|
* Copyright 2017 Google LLC
|
|
525
525
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
526
526
|
*/
|
|
527
|
-
const
|
|
527
|
+
const W = (i) => (e, t) => {
|
|
528
528
|
t !== void 0 ? t.addInitializer(() => {
|
|
529
529
|
customElements.define(i, e);
|
|
530
530
|
}) : customElements.define(i, e);
|
|
@@ -534,7 +534,7 @@ const N = (i) => (e, t) => {
|
|
|
534
534
|
* Copyright 2017 Google LLC
|
|
535
535
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
536
536
|
*/
|
|
537
|
-
const
|
|
537
|
+
const Le = { attribute: !0, type: String, converter: z, reflect: !1, hasChanged: G }, Ve = (i = Le, e, t) => {
|
|
538
538
|
const { kind: s, metadata: r } = t;
|
|
539
539
|
let o = globalThis.litPropertyMetadata.get(r);
|
|
540
540
|
if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(t.name, i), s === "accessor") {
|
|
@@ -556,7 +556,7 @@ const Ve = { attribute: !0, type: String, converter: z, reflect: !1, hasChanged:
|
|
|
556
556
|
throw Error("Unsupported decorator location: " + s);
|
|
557
557
|
};
|
|
558
558
|
function m(i) {
|
|
559
|
-
return (e, t) => typeof t == "object" ?
|
|
559
|
+
return (e, t) => typeof t == "object" ? Ve(i, e, t) : ((s, r, o) => {
|
|
560
560
|
const n = r.hasOwnProperty(o);
|
|
561
561
|
return r.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
|
|
562
562
|
})(i, e, t);
|
|
@@ -566,27 +566,14 @@ function m(i) {
|
|
|
566
566
|
* Copyright 2017 Google LLC
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
|
-
function
|
|
569
|
+
function N(i) {
|
|
570
570
|
return m({ ...i, state: !0, attribute: !1 });
|
|
571
571
|
}
|
|
572
|
-
var We = Object.getOwnPropertyDescriptor, Ke = (i, e, t, s) => {
|
|
573
|
-
for (var r = s > 1 ? void 0 : s ? We(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
574
|
-
(n = i[o]) && (r = n(r) || r);
|
|
575
|
-
return r;
|
|
576
|
-
};
|
|
577
|
-
let ge = class extends v {
|
|
578
|
-
render() {
|
|
579
|
-
return f`<slot></slot>`;
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
ge = Ke([
|
|
583
|
-
N("vibe-flags")
|
|
584
|
-
], ge);
|
|
585
572
|
const P = "vibe-flags:";
|
|
586
573
|
function J(i) {
|
|
587
574
|
return i.type === "boolean" ? !1 : i.options[0] || "";
|
|
588
575
|
}
|
|
589
|
-
class
|
|
576
|
+
class qe extends EventTarget {
|
|
590
577
|
constructor() {
|
|
591
578
|
super(...arguments), this.configs = /* @__PURE__ */ new Map(), this.state = {}, this.listening = !1, this.onStorageEvent = (e) => {
|
|
592
579
|
if (!e.key?.startsWith(P)) return;
|
|
@@ -659,17 +646,17 @@ class Je extends EventTarget {
|
|
|
659
646
|
this.dispatchEvent(s), typeof window < "u" && window.dispatchEvent(new CustomEvent("vibe-flags-changed", { detail: t }));
|
|
660
647
|
}
|
|
661
648
|
}
|
|
662
|
-
const u = new
|
|
663
|
-
var
|
|
664
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
649
|
+
const u = new qe();
|
|
650
|
+
var We = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, H = (i, e, t, s) => {
|
|
651
|
+
for (var r = s > 1 ? void 0 : s ? Ke(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
665
652
|
(n = i[o]) && (r = (s ? n(e, t, r) : n(r)) || r);
|
|
666
|
-
return s && r &&
|
|
653
|
+
return s && r && We(e, t, r), r;
|
|
667
654
|
};
|
|
668
655
|
if (typeof document < "u" && !document.getElementById("vibe-flag-fouc")) {
|
|
669
656
|
const i = document.createElement("style");
|
|
670
657
|
i.id = "vibe-flag-fouc", i.textContent = "vibe-flag-boolean:not(:defined),vibe-flag-boolean:defined,vibe-flag-select:not(:defined),vibe-flag-select:defined,vibe-flag-option:not(:defined),vibe-flag-option:defined{display:none}", document.head.appendChild(i);
|
|
671
658
|
}
|
|
672
|
-
let C = class extends
|
|
659
|
+
let C = class extends y {
|
|
673
660
|
constructor() {
|
|
674
661
|
super(...arguments), this.name = "", this.description = "", this.value = "", this.isMatch = !1, this.onFlagChange = () => {
|
|
675
662
|
this.evaluate();
|
|
@@ -702,27 +689,27 @@ let C = class extends v {
|
|
|
702
689
|
return this.isMatch ? f`<slot></slot>` : c;
|
|
703
690
|
}
|
|
704
691
|
};
|
|
705
|
-
|
|
692
|
+
H([
|
|
706
693
|
m({ type: String })
|
|
707
694
|
], C.prototype, "name", 2);
|
|
708
|
-
|
|
695
|
+
H([
|
|
709
696
|
m({ type: String })
|
|
710
697
|
], C.prototype, "description", 2);
|
|
711
|
-
|
|
698
|
+
H([
|
|
712
699
|
m({ type: String })
|
|
713
700
|
], C.prototype, "value", 2);
|
|
714
|
-
|
|
715
|
-
|
|
701
|
+
H([
|
|
702
|
+
N()
|
|
716
703
|
], C.prototype, "isMatch", 2);
|
|
717
|
-
C =
|
|
718
|
-
|
|
704
|
+
C = H([
|
|
705
|
+
W("vibe-flag-boolean")
|
|
719
706
|
], C);
|
|
720
|
-
var
|
|
721
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
707
|
+
var Je = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, se = (i, e, t, s) => {
|
|
708
|
+
for (var r = s > 1 ? void 0 : s ? Ye(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
722
709
|
(n = i[o]) && (r = (s ? n(e, t, r) : n(r)) || r);
|
|
723
|
-
return s && r &&
|
|
710
|
+
return s && r && Je(e, t, r), r;
|
|
724
711
|
};
|
|
725
|
-
let
|
|
712
|
+
let B = class extends y {
|
|
726
713
|
constructor() {
|
|
727
714
|
super(...arguments), this.name = "", this.description = "", this.onFlagChange = () => {
|
|
728
715
|
this.syncOptions();
|
|
@@ -764,19 +751,19 @@ let L = class extends v {
|
|
|
764
751
|
};
|
|
765
752
|
se([
|
|
766
753
|
m({ type: String })
|
|
767
|
-
],
|
|
754
|
+
], B.prototype, "name", 2);
|
|
768
755
|
se([
|
|
769
756
|
m({ type: String })
|
|
770
|
-
],
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
],
|
|
774
|
-
var
|
|
775
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
757
|
+
], B.prototype, "description", 2);
|
|
758
|
+
B = se([
|
|
759
|
+
W("vibe-flag-select")
|
|
760
|
+
], B);
|
|
761
|
+
var Ze = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, ie = (i, e, t, s) => {
|
|
762
|
+
for (var r = s > 1 ? void 0 : s ? Xe(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
776
763
|
(n = i[o]) && (r = (s ? n(e, t, r) : n(r)) || r);
|
|
777
|
-
return s && r &&
|
|
764
|
+
return s && r && Ze(e, t, r), r;
|
|
778
765
|
};
|
|
779
|
-
let
|
|
766
|
+
let L = class extends y {
|
|
780
767
|
constructor() {
|
|
781
768
|
super(...arguments), this.value = "", this.active = !1;
|
|
782
769
|
}
|
|
@@ -789,14 +776,14 @@ let V = class extends v {
|
|
|
789
776
|
};
|
|
790
777
|
ie([
|
|
791
778
|
m({ type: String })
|
|
792
|
-
],
|
|
779
|
+
], L.prototype, "value", 2);
|
|
793
780
|
ie([
|
|
794
781
|
m({ type: Boolean, reflect: !0 })
|
|
795
|
-
],
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
],
|
|
799
|
-
const
|
|
782
|
+
], L.prototype, "active", 2);
|
|
783
|
+
L = ie([
|
|
784
|
+
W("vibe-flag-option")
|
|
785
|
+
], L);
|
|
786
|
+
const Ge = X`
|
|
800
787
|
:host {
|
|
801
788
|
--vf-bg: #0a0a0a;
|
|
802
789
|
--vf-bg-muted: #171717;
|
|
@@ -820,7 +807,7 @@ const tt = X`
|
|
|
820
807
|
--vf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6),
|
|
821
808
|
0 8px 10px -6px rgba(0, 0, 0, 0.6);
|
|
822
809
|
}
|
|
823
|
-
`,
|
|
810
|
+
`, Qe = X`
|
|
824
811
|
:host {
|
|
825
812
|
--vf-bg: #ffffff;
|
|
826
813
|
--vf-bg-muted: #f5f5f5;
|
|
@@ -845,13 +832,13 @@ const tt = X`
|
|
|
845
832
|
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
846
833
|
}
|
|
847
834
|
`;
|
|
848
|
-
var
|
|
849
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
835
|
+
var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, R = (i, e, t, s) => {
|
|
836
|
+
for (var r = s > 1 ? void 0 : s ? tt(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
850
837
|
(n = i[o]) && (r = (s ? n(e, t, r) : n(r)) || r);
|
|
851
|
-
return s && r &&
|
|
838
|
+
return s && r && et(e, t, r), r;
|
|
852
839
|
};
|
|
853
|
-
const
|
|
854
|
-
let $ = class extends
|
|
840
|
+
const ge = "vibeFlagsTheme";
|
|
841
|
+
let $ = class extends y {
|
|
855
842
|
constructor() {
|
|
856
843
|
super(...arguments), this.open = !1, this.flags = {}, this.configs = [], this.darkMode = !0, this.onFlagChange = () => {
|
|
857
844
|
this.syncFromStore();
|
|
@@ -865,14 +852,14 @@ let $ = class extends v {
|
|
|
865
852
|
}
|
|
866
853
|
loadTheme() {
|
|
867
854
|
if (typeof window > "u") return;
|
|
868
|
-
const i = localStorage.getItem(
|
|
855
|
+
const i = localStorage.getItem(ge);
|
|
869
856
|
this.darkMode = i ? i === "dark" : !0, this.applyTheme();
|
|
870
857
|
}
|
|
871
858
|
toggleTheme() {
|
|
872
|
-
this.darkMode = !this.darkMode, localStorage.setItem(
|
|
859
|
+
this.darkMode = !this.darkMode, localStorage.setItem(ge, this.darkMode ? "dark" : "light"), this.applyTheme();
|
|
873
860
|
}
|
|
874
861
|
applyTheme() {
|
|
875
|
-
const i = this.darkMode ?
|
|
862
|
+
const i = this.darkMode ? Ge : Qe, e = new CSSStyleSheet();
|
|
876
863
|
e.replaceSync(i.cssText), this.shadowRoot.adoptedStyleSheets = [
|
|
877
864
|
...$.elementStyles.map((t) => t.styleSheet),
|
|
878
865
|
e
|
|
@@ -1300,26 +1287,25 @@ $.styles = [
|
|
|
1300
1287
|
}
|
|
1301
1288
|
`
|
|
1302
1289
|
];
|
|
1303
|
-
|
|
1304
|
-
|
|
1290
|
+
R([
|
|
1291
|
+
N()
|
|
1305
1292
|
], $.prototype, "open", 2);
|
|
1306
|
-
|
|
1307
|
-
|
|
1293
|
+
R([
|
|
1294
|
+
N()
|
|
1308
1295
|
], $.prototype, "flags", 2);
|
|
1309
|
-
|
|
1310
|
-
|
|
1296
|
+
R([
|
|
1297
|
+
N()
|
|
1311
1298
|
], $.prototype, "configs", 2);
|
|
1312
|
-
|
|
1313
|
-
|
|
1299
|
+
R([
|
|
1300
|
+
N()
|
|
1314
1301
|
], $.prototype, "darkMode", 2);
|
|
1315
|
-
$ =
|
|
1316
|
-
|
|
1302
|
+
$ = R([
|
|
1303
|
+
W("vibe-toolbar")
|
|
1317
1304
|
], $);
|
|
1318
1305
|
export {
|
|
1319
1306
|
C as VibeFlagBoolean,
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
ge as VibeFlags,
|
|
1307
|
+
L as VibeFlagOption,
|
|
1308
|
+
B as VibeFlagSelect,
|
|
1323
1309
|
$ as VibeToolbar,
|
|
1324
1310
|
u as flagStore
|
|
1325
1311
|
};
|
package/dist/vibe-flags.js
CHANGED
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import {
|
|
3
|
-
var M = Object.getOwnPropertyDescriptor, O = (t, e, r, s) => {
|
|
4
|
-
for (var o = s > 1 ? void 0 : s ? M(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
5
|
-
(i = t[n]) && (o = i(o) || o);
|
|
6
|
-
return o;
|
|
7
|
-
};
|
|
8
|
-
let F = class extends g {
|
|
9
|
-
render() {
|
|
10
|
-
return a`<slot></slot>`;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
F = O([
|
|
14
|
-
h("vibe-flags")
|
|
15
|
-
], F);
|
|
1
|
+
import { LitElement as y, nothing as u, html as a, css as k } from "lit";
|
|
2
|
+
import { property as c, state as g, customElement as m } from "lit/decorators.js";
|
|
16
3
|
const f = "vibe-flags:";
|
|
17
4
|
function w(t) {
|
|
18
5
|
return t.type === "boolean" ? !1 : t.options[0] || "";
|
|
19
6
|
}
|
|
20
|
-
class
|
|
7
|
+
class $ extends EventTarget {
|
|
21
8
|
constructor() {
|
|
22
9
|
super(...arguments), this.configs = /* @__PURE__ */ new Map(), this.state = {}, this.listening = !1, this.onStorageEvent = (e) => {
|
|
23
10
|
if (!e.key?.startsWith(f)) return;
|
|
24
|
-
const r = e.key.slice(f.length),
|
|
25
|
-
if (
|
|
11
|
+
const r = e.key.slice(f.length), o = this.configs.get(r);
|
|
12
|
+
if (o)
|
|
26
13
|
try {
|
|
27
|
-
const
|
|
28
|
-
this.state[r] =
|
|
14
|
+
const s = e.newValue ? JSON.parse(e.newValue) : w(o);
|
|
15
|
+
this.state[r] = s, this.dispatch(r);
|
|
29
16
|
} catch {
|
|
30
17
|
}
|
|
31
18
|
};
|
|
32
19
|
}
|
|
33
20
|
register(e) {
|
|
34
21
|
this.configs.set(e.key, e);
|
|
35
|
-
const r = w(e),
|
|
36
|
-
this.state[e.key] =
|
|
22
|
+
const r = w(e), o = this.readFromStorage(e.key), s = o !== null && (e.type === "boolean" && typeof o == "boolean" || e.type === "select" && typeof o == "string" && e.options.includes(o));
|
|
23
|
+
this.state[e.key] = s ? o : r, this.listening || (this.listening = !0, typeof window < "u" && window.addEventListener("storage", this.onStorageEvent)), this.dispatch(e.key);
|
|
37
24
|
}
|
|
38
25
|
unregister(e) {
|
|
39
26
|
this.configs.delete(e), delete this.state[e], this.dispatch();
|
|
@@ -42,8 +29,8 @@ class _ extends EventTarget {
|
|
|
42
29
|
return this.state[e];
|
|
43
30
|
}
|
|
44
31
|
set(e, r) {
|
|
45
|
-
const
|
|
46
|
-
|
|
32
|
+
const o = this.configs.get(e);
|
|
33
|
+
o && (o.type === "boolean" && typeof r != "boolean" || o.type === "select" && (typeof r != "string" || !o.options.includes(r)) || (this.state[e] = r, this.writeToStorage(e, r), this.dispatch(e)));
|
|
47
34
|
}
|
|
48
35
|
getAll() {
|
|
49
36
|
return { ...this.state };
|
|
@@ -83,24 +70,24 @@ class _ extends EventTarget {
|
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
72
|
dispatch(e) {
|
|
86
|
-
const r = { key: e, state: this.getAll() },
|
|
73
|
+
const r = { key: e, state: this.getAll() }, o = new CustomEvent("vibe-flags-changed", {
|
|
87
74
|
detail: r,
|
|
88
75
|
bubbles: !0
|
|
89
76
|
});
|
|
90
|
-
this.dispatchEvent(
|
|
77
|
+
this.dispatchEvent(o), typeof window < "u" && window.dispatchEvent(new CustomEvent("vibe-flags-changed", { detail: r }));
|
|
91
78
|
}
|
|
92
79
|
}
|
|
93
|
-
const l = new
|
|
94
|
-
var
|
|
95
|
-
for (var
|
|
96
|
-
(i = t[n]) && (
|
|
97
|
-
return
|
|
80
|
+
const l = new $();
|
|
81
|
+
var M = Object.defineProperty, O = Object.getOwnPropertyDescriptor, h = (t, e, r, o) => {
|
|
82
|
+
for (var s = o > 1 ? void 0 : o ? O(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
83
|
+
(i = t[n]) && (s = (o ? i(e, r, s) : i(s)) || s);
|
|
84
|
+
return o && s && M(e, r, s), s;
|
|
98
85
|
};
|
|
99
86
|
if (typeof document < "u" && !document.getElementById("vibe-flag-fouc")) {
|
|
100
87
|
const t = document.createElement("style");
|
|
101
88
|
t.id = "vibe-flag-fouc", t.textContent = "vibe-flag-boolean:not(:defined),vibe-flag-boolean:defined,vibe-flag-select:not(:defined),vibe-flag-select:defined,vibe-flag-option:not(:defined),vibe-flag-option:defined{display:none}", document.head.appendChild(t);
|
|
102
89
|
}
|
|
103
|
-
let p = class extends
|
|
90
|
+
let p = class extends y {
|
|
104
91
|
constructor() {
|
|
105
92
|
super(...arguments), this.name = "", this.description = "", this.value = "", this.isMatch = !1, this.onFlagChange = () => {
|
|
106
93
|
this.evaluate();
|
|
@@ -130,30 +117,30 @@ let p = class extends g {
|
|
|
130
117
|
t === void 0 ? this.isMatch = !1 : this.value === "" ? this.isMatch = !0 : this.isMatch = String(t) === this.value, this.isMatch ? this.setAttribute("active", "") : this.removeAttribute("active");
|
|
131
118
|
}
|
|
132
119
|
render() {
|
|
133
|
-
return this.isMatch ? a`<slot></slot>` :
|
|
120
|
+
return this.isMatch ? a`<slot></slot>` : u;
|
|
134
121
|
}
|
|
135
122
|
};
|
|
136
|
-
|
|
123
|
+
h([
|
|
137
124
|
c({ type: String })
|
|
138
125
|
], p.prototype, "name", 2);
|
|
139
|
-
|
|
126
|
+
h([
|
|
140
127
|
c({ type: String })
|
|
141
128
|
], p.prototype, "description", 2);
|
|
142
|
-
|
|
129
|
+
h([
|
|
143
130
|
c({ type: String })
|
|
144
131
|
], p.prototype, "value", 2);
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
h([
|
|
133
|
+
g()
|
|
147
134
|
], p.prototype, "isMatch", 2);
|
|
148
|
-
p =
|
|
149
|
-
|
|
135
|
+
p = h([
|
|
136
|
+
m("vibe-flag-boolean")
|
|
150
137
|
], p);
|
|
151
|
-
var
|
|
152
|
-
for (var
|
|
153
|
-
(i = t[n]) && (
|
|
154
|
-
return
|
|
138
|
+
var _ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, S = (t, e, r, o) => {
|
|
139
|
+
for (var s = o > 1 ? void 0 : o ? E(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
140
|
+
(i = t[n]) && (s = (o ? i(e, r, s) : i(s)) || s);
|
|
141
|
+
return o && s && _(e, r, s), s;
|
|
155
142
|
};
|
|
156
|
-
let
|
|
143
|
+
let b = class extends y {
|
|
157
144
|
constructor() {
|
|
158
145
|
super(...arguments), this.name = "", this.description = "", this.onFlagChange = () => {
|
|
159
146
|
this.syncOptions();
|
|
@@ -195,19 +182,19 @@ let y = class extends g {
|
|
|
195
182
|
};
|
|
196
183
|
S([
|
|
197
184
|
c({ type: String })
|
|
198
|
-
],
|
|
185
|
+
], b.prototype, "name", 2);
|
|
199
186
|
S([
|
|
200
187
|
c({ type: String })
|
|
201
|
-
],
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
],
|
|
205
|
-
var
|
|
206
|
-
for (var
|
|
207
|
-
(i = t[n]) && (
|
|
208
|
-
return
|
|
188
|
+
], b.prototype, "description", 2);
|
|
189
|
+
b = S([
|
|
190
|
+
m("vibe-flag-select")
|
|
191
|
+
], b);
|
|
192
|
+
var T = Object.defineProperty, I = Object.getOwnPropertyDescriptor, C = (t, e, r, o) => {
|
|
193
|
+
for (var s = o > 1 ? void 0 : o ? I(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
194
|
+
(i = t[n]) && (s = (o ? i(e, r, s) : i(s)) || s);
|
|
195
|
+
return o && s && T(e, r, s), s;
|
|
209
196
|
};
|
|
210
|
-
let
|
|
197
|
+
let x = class extends y {
|
|
211
198
|
constructor() {
|
|
212
199
|
super(...arguments), this.value = "", this.active = !1;
|
|
213
200
|
}
|
|
@@ -215,19 +202,19 @@ let m = class extends g {
|
|
|
215
202
|
this.style.display = "contents";
|
|
216
203
|
}
|
|
217
204
|
render() {
|
|
218
|
-
return this.active ? a`<slot></slot>` :
|
|
205
|
+
return this.active ? a`<slot></slot>` : u;
|
|
219
206
|
}
|
|
220
207
|
};
|
|
221
208
|
C([
|
|
222
209
|
c({ type: String })
|
|
223
|
-
],
|
|
210
|
+
], x.prototype, "value", 2);
|
|
224
211
|
C([
|
|
225
212
|
c({ type: Boolean, reflect: !0 })
|
|
226
|
-
],
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
],
|
|
230
|
-
const
|
|
213
|
+
], x.prototype, "active", 2);
|
|
214
|
+
x = C([
|
|
215
|
+
m("vibe-flag-option")
|
|
216
|
+
], x);
|
|
217
|
+
const j = k`
|
|
231
218
|
:host {
|
|
232
219
|
--vf-bg: #0a0a0a;
|
|
233
220
|
--vf-bg-muted: #171717;
|
|
@@ -251,7 +238,7 @@ const A = k`
|
|
|
251
238
|
--vf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6),
|
|
252
239
|
0 8px 10px -6px rgba(0, 0, 0, 0.6);
|
|
253
240
|
}
|
|
254
|
-
`,
|
|
241
|
+
`, P = k`
|
|
255
242
|
:host {
|
|
256
243
|
--vf-bg: #ffffff;
|
|
257
244
|
--vf-bg-muted: #f5f5f5;
|
|
@@ -276,13 +263,13 @@ const A = k`
|
|
|
276
263
|
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
277
264
|
}
|
|
278
265
|
`;
|
|
279
|
-
var
|
|
280
|
-
for (var
|
|
281
|
-
(i = t[n]) && (
|
|
282
|
-
return
|
|
266
|
+
var z = Object.defineProperty, A = Object.getOwnPropertyDescriptor, v = (t, e, r, o) => {
|
|
267
|
+
for (var s = o > 1 ? void 0 : o ? A(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
268
|
+
(i = t[n]) && (s = (o ? i(e, r, s) : i(s)) || s);
|
|
269
|
+
return o && s && z(e, r, s), s;
|
|
283
270
|
};
|
|
284
|
-
const
|
|
285
|
-
let d = class extends
|
|
271
|
+
const F = "vibeFlagsTheme";
|
|
272
|
+
let d = class extends y {
|
|
286
273
|
constructor() {
|
|
287
274
|
super(...arguments), this.open = !1, this.flags = {}, this.configs = [], this.darkMode = !0, this.onFlagChange = () => {
|
|
288
275
|
this.syncFromStore();
|
|
@@ -296,14 +283,14 @@ let d = class extends g {
|
|
|
296
283
|
}
|
|
297
284
|
loadTheme() {
|
|
298
285
|
if (typeof window > "u") return;
|
|
299
|
-
const t = localStorage.getItem(
|
|
286
|
+
const t = localStorage.getItem(F);
|
|
300
287
|
this.darkMode = t ? t === "dark" : !0, this.applyTheme();
|
|
301
288
|
}
|
|
302
289
|
toggleTheme() {
|
|
303
|
-
this.darkMode = !this.darkMode, localStorage.setItem(
|
|
290
|
+
this.darkMode = !this.darkMode, localStorage.setItem(F, this.darkMode ? "dark" : "light"), this.applyTheme();
|
|
304
291
|
}
|
|
305
292
|
applyTheme() {
|
|
306
|
-
const t = this.darkMode ?
|
|
293
|
+
const t = this.darkMode ? j : P, e = new CSSStyleSheet();
|
|
307
294
|
e.replaceSync(t.cssText), this.shadowRoot.adoptedStyleSheets = [
|
|
308
295
|
...d.elementStyles.map((r) => r.styleSheet),
|
|
309
296
|
e
|
|
@@ -364,7 +351,7 @@ let d = class extends g {
|
|
|
364
351
|
`;
|
|
365
352
|
}
|
|
366
353
|
renderSelectFlag(t) {
|
|
367
|
-
if (t.type !== "select") return
|
|
354
|
+
if (t.type !== "select") return u;
|
|
368
355
|
const e = this.flags[t.key];
|
|
369
356
|
return a`
|
|
370
357
|
<div class="flag-item">
|
|
@@ -393,7 +380,7 @@ let d = class extends g {
|
|
|
393
380
|
}
|
|
394
381
|
render() {
|
|
395
382
|
return a`
|
|
396
|
-
${this.open ?
|
|
383
|
+
${this.open ? u : a`
|
|
397
384
|
<button class="fab" @click=${this.toggle} aria-label="Toggle feature flags">
|
|
398
385
|
${this.renderFlagIcon()}
|
|
399
386
|
</button>
|
|
@@ -731,26 +718,25 @@ d.styles = [
|
|
|
731
718
|
}
|
|
732
719
|
`
|
|
733
720
|
];
|
|
734
|
-
|
|
735
|
-
|
|
721
|
+
v([
|
|
722
|
+
g()
|
|
736
723
|
], d.prototype, "open", 2);
|
|
737
|
-
|
|
738
|
-
|
|
724
|
+
v([
|
|
725
|
+
g()
|
|
739
726
|
], d.prototype, "flags", 2);
|
|
740
|
-
|
|
741
|
-
|
|
727
|
+
v([
|
|
728
|
+
g()
|
|
742
729
|
], d.prototype, "configs", 2);
|
|
743
|
-
|
|
744
|
-
|
|
730
|
+
v([
|
|
731
|
+
g()
|
|
745
732
|
], d.prototype, "darkMode", 2);
|
|
746
|
-
d =
|
|
747
|
-
|
|
733
|
+
d = v([
|
|
734
|
+
m("vibe-toolbar")
|
|
748
735
|
], d);
|
|
749
736
|
export {
|
|
750
737
|
p as VibeFlagBoolean,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
F as VibeFlags,
|
|
738
|
+
x as VibeFlagOption,
|
|
739
|
+
b as VibeFlagSelect,
|
|
754
740
|
d as VibeToolbar,
|
|
755
741
|
l as flagStore
|
|
756
742
|
};
|