@vibe-flags/core 0.1.1 → 0.1.2
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 +2 -2
- package/dist/vibe-flags.cdn.js +5 -5
- package/dist/vibe-flags.cdn.mjs +29 -29
- package/dist/vibe-flags.js +24 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const flagStore: FlagStore;
|
|
|
46
46
|
export declare type FlagValue = boolean | string;
|
|
47
47
|
|
|
48
48
|
export declare class VibeFlagBoolean extends LitElement {
|
|
49
|
-
|
|
49
|
+
name: string;
|
|
50
50
|
description: string;
|
|
51
51
|
value: string;
|
|
52
52
|
private isMatch;
|
|
@@ -71,7 +71,7 @@ export declare class VibeFlags extends LitElement {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export declare class VibeFlagSelect extends LitElement {
|
|
74
|
-
|
|
74
|
+
name: string;
|
|
75
75
|
description: string;
|
|
76
76
|
private ready;
|
|
77
77
|
connectedCallback(): void;
|
package/dist/vibe-flags.cdn.js
CHANGED
|
@@ -6,17 +6,17 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:me,defineProperty:_e,getOwnPropertyDescriptor:xe,getOwnPropertyNames:we,getOwnPropertySymbols:Se,getPrototypeOf:Ae}=Object,j=globalThis,re=j.trustedTypes,
|
|
9
|
+
*/const{is:me,defineProperty:_e,getOwnPropertyDescriptor:xe,getOwnPropertyNames:we,getOwnPropertySymbols:Se,getPrototypeOf:Ae}=Object,j=globalThis,re=j.trustedTypes,Ee=re?re.emptyScript:"",Ce=j.reactiveElementPolyfillSupport,O=(r,e)=>r,B={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}},J=(r,e)=>!me(r,e),oe={attribute:!0,type:String,converter:B,reflect:!1,useDefault:!1,hasChanged:J};Symbol.metadata??=Symbol("metadata"),j.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&&_e(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:o}=xe(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(O("elementProperties")))return;const e=Ae(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){const t=this.properties,s=[...we(t),...Se(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:B).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:B;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??J)(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[O("elementProperties")]=new Map,A[O("finalized")]=new Map,Ce?.({ReactiveElement:A}),(j.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const X=globalThis,ne=r=>r,I=X.trustedTypes,ae=I?I.createPolicy("lit-html",{createHTML:r=>r}):void 0,le="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,he="?"+y,
|
|
13
|
+
*/const X=globalThis,ne=r=>r,I=X.trustedTypes,ae=I?I.createPolicy("lit-html",{createHTML:r=>r}):void 0,le="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,he="?"+y,ke=`<${he}>`,_=document,P=()=>_.createComment(""),F=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]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ce=/-->/g,de=/>/g,x=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),pe=/'/g,fe=/"/g,ge=/^(?:script|style|textarea|title)$/i,Pe=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),g=Pe(1),
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),pe=/'/g,fe=/"/g,ge=/^(?:script|style|textarea|title)$/i,Pe=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),g=Pe(1),E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ue=new WeakMap,w=_.createTreeWalker(_,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 Fe=(r,e)=>{const t=r.length-1,s=[];let i,o=e===2?"<svg>":e===3?"<math>":"",n=M;for(let h=0;h<t;h++){const a=r[h];let p,f,c=-1,b=0;for(;b<a.length&&(n.lastIndex=b,f=n.exec(a),f!==null);)b=n.lastIndex,n===M?f[1]==="!--"?n=ce:f[1]!==void 0?n=de:f[2]!==void 0?(ge.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=x):f[3]!==void 0&&(n=x):n===x?f[0]===">"?(n=i??M,c=-1):f[1]===void 0?c=-2:(c=n.lastIndex-f[2].length,p=f[1],n=f[3]===void 0?x:f[3]==='"'?fe:pe):n===fe||n===pe?n=x:n===ce||n===de?n=M:(n=x,i=void 0);const m=n===x&&r[h+1].startsWith("/>")?" ":"";o+=n===M?a+ke:c>=0?(s.push(p),a.slice(0,c)+le+a.slice(c)+y+m):a+y+(c===-2?h:m)}return[ve(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class T{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]=Fe(e,t);if(this.el=T.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 b=f[n++],m=i.getAttribute(c).split(y),L=/([.?@])?(.*)/.exec(b);a.push({type:1,index:o,name:L[2],strings:m,ctor:L[1]==="."?Te:L[1]==="?"?Ve:L[1]==="@"?Ue:D}),i.removeAttribute(c)}else c.startsWith(y)&&(a.push({type:6,index:o}),i.removeAttribute(c));if(ge.test(i.tagName)){const c=i.textContent.split(y),b=c.length-1;if(b>0){i.textContent=I?I.emptyScript:"";for(let m=0;m<b;m++)i.append(c[m],P()),w.nextNode(),a.push({type:2,index:++o});i.append(c[b],P())}}}else if(i.nodeType===8)if(i.data===he)a.push({type:2,index:o});else{let c=-1;for(;(c=i.data.indexOf(y,c+1))!==-1;)a.push({type:7,index:o}),c+=y.length-1}o++}}static createElement(e,t){const s=_.createElement("template");return s.innerHTML=e,s}}function C(r,e,t=r,s){if(e===E)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const o=F(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=C(r,i._$AS(r,e.values),i,s)),e}class Me{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??_).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 V(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=_,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 V{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=C(this,e,t),F(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==E&&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&&F(this._$AH)?this._$AA.nextSibling.data=e:this.T(_.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=T.createElement(ve(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const o=new Me(i,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=ue.get(e.strings);return t===void 0&&ue.set(e.strings,t=new T(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 V(this.O(P()),this.O(P()),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 D{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=C(this,e,t,0),n=!F(e)||e!==this._$AH&&e!==E,n&&(this._$AH=e);else{const h=e;let a,p;for(e=o[0],a=0;a<o.length-1;a++)p=C(this,h[s+a],t,a),p===E&&(p=this._$AH[a]),n||=!F(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 Te extends D{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===d?void 0:e}}class Ve extends D{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==d)}}class Ue extends D{constructor(e,t,s,i,o){super(e,t,s,i,o),this.type=5}_$AI(e,t=this){if((e=C(this,e,t,0)??d)===E)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){C(this,e)}}const He=X.litHtmlPolyfillSupport;He?.(T,V),(X.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 V(e.insertBefore(P(),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 G=globalThis;class v 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
|
|
19
|
+
*/const G=globalThis;class v 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 E}}v._$litElement$=!0,v.finalized=!0,G.litElementHydrateSupport?.({LitElement:v});const je=G.litElementPolyfillSupport;je?.({LitElement:v}),(G.litElementVersions??=[]).push("4.2.2");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -28,7 +28,7 @@ var VibeFlags=(function(l){"use strict";/**
|
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function $(r){return S({...r,state:!0,attribute:!1})}var De=Object.getOwnPropertyDescriptor,ze=(r,e,t,s)=>{for(var i=s>1?void 0:s?De(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=n(i)||i);return i};l.VibeFlags=class extends v{render(){return g`<slot></slot>`}},l.VibeFlags=ze([U("vibe-flags")],l.VibeFlags);const N="vibe-flags:";function Q(r){return r.type==="boolean"?!1:r.options[0]||""}class Le extends EventTarget{constructor(){super(...arguments),this.configs=new Map,this.state={},this.listening=!1,this.onStorageEvent=e=>{if(!e.key?.startsWith(N))return;const t=e.key.slice(N.length),s=this.configs.get(t);if(s)try{const i=e.newValue?JSON.parse(e.newValue):Q(s);this.state[t]=i,this.dispatch(t)}catch{}}}register(e){this.configs.set(e.key,e);const t=this.readFromStorage(e.key);this.state[e.key]=t??Q(e),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]=Q(t),this.removeFromStorage(e);this.dispatch()}readFromStorage(e){if(typeof window>"u")return null;try{const t=localStorage.getItem(N+e);return t===null?null:JSON.parse(t)}catch{return null}}writeToStorage(e,t){if(!(typeof window>"u"))try{localStorage.setItem(N+e,JSON.stringify(t))}catch{}}removeFromStorage(e){if(!(typeof window>"u"))try{localStorage.removeItem(N+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 u=new Le;var qe=Object.defineProperty,We=Object.getOwnPropertyDescriptor,
|
|
31
|
+
*/function $(r){return S({...r,state:!0,attribute:!1})}var De=Object.getOwnPropertyDescriptor,ze=(r,e,t,s)=>{for(var i=s>1?void 0:s?De(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=n(i)||i);return i};l.VibeFlags=class extends v{render(){return g`<slot></slot>`}},l.VibeFlags=ze([U("vibe-flags")],l.VibeFlags);const N="vibe-flags:";function Q(r){return r.type==="boolean"?!1:r.options[0]||""}class Le extends EventTarget{constructor(){super(...arguments),this.configs=new Map,this.state={},this.listening=!1,this.onStorageEvent=e=>{if(!e.key?.startsWith(N))return;const t=e.key.slice(N.length),s=this.configs.get(t);if(s)try{const i=e.newValue?JSON.parse(e.newValue):Q(s);this.state[t]=i,this.dispatch(t)}catch{}}}register(e){this.configs.set(e.key,e);const t=this.readFromStorage(e.key);this.state[e.key]=t??Q(e),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]=Q(t),this.removeFromStorage(e);this.dispatch()}readFromStorage(e){if(typeof window>"u")return null;try{const t=localStorage.getItem(N+e);return t===null?null:JSON.parse(t)}catch{return null}}writeToStorage(e,t){if(!(typeof window>"u"))try{localStorage.setItem(N+e,JSON.stringify(t))}catch{}}removeFromStorage(e){if(!(typeof window>"u"))try{localStorage.removeItem(N+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 u=new Le;var qe=Object.defineProperty,We=Object.getOwnPropertyDescriptor,k=(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};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{visibility:hidden}",document.head.appendChild(r)}l.VibeFlagBoolean=class extends v{constructor(){super(...arguments),this.name="",this.description="",this.value="",this.isMatch=!1,this.ready=!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)}willUpdate(e){(e.has("name")||e.has("description"))&&this.registerFlag()}registerFlag(){this.name&&(u.getConfigForKey(this.name)||u.register({key:this.name,type:"boolean",label:this.description||void 0}),this.evaluate())}evaluate(){const e=u.get(this.name);e===void 0?this.isMatch=!1:this.value===""?this.isMatch=!0:this.isMatch=String(e)===this.value,this.ready||(this.ready=!0,this.style.visibility="visible")}render(){return this.isMatch?g`<slot></slot>`:d}},k([S({type:String})],l.VibeFlagBoolean.prototype,"name",2),k([S({type:String})],l.VibeFlagBoolean.prototype,"description",2),k([S({type:String})],l.VibeFlagBoolean.prototype,"value",2),k([$()],l.VibeFlagBoolean.prototype,"isMatch",2),k([$()],l.VibeFlagBoolean.prototype,"ready",2),l.VibeFlagBoolean=k([U("vibe-flag-boolean")],l.VibeFlagBoolean);var Ke=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,z=(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.VibeFlagSelect=class extends v{constructor(){super(...arguments),this.name="",this.description="",this.ready=!1,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)}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&&(u.getConfigForKey(this.name)||u.register({key:this.name,type:"select",options:e,label:this.description||void 0}),this.syncOptions())}syncOptions(){const e=u.get(this.name);for(const t of this.getOptions())t.active=t.value===e;this.ready||(this.ready=!0,this.style.visibility="visible")}render(){return g`<slot></slot>`}},z([S({type:String})],l.VibeFlagSelect.prototype,"name",2),z([S({type:String})],l.VibeFlagSelect.prototype,"description",2),z([$()],l.VibeFlagSelect.prototype,"ready",2),l.VibeFlagSelect=z([U("vibe-flag-select")],l.VibeFlagSelect);var Xe=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,ee=(r,e,t,s)=>{for(var i=s>1?void 0:s?Ye(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};l.VibeFlagOption=class extends v{constructor(){super(...arguments),this.value="",this.active=!1}render(){return this.active?g`<slot></slot>`:d}},ee([S({type:String})],l.VibeFlagOption.prototype,"value",2),ee([$()],l.VibeFlagOption.prototype,"active",2),l.VibeFlagOption=ee([U("vibe-flag-option")],l.VibeFlagOption);const Ze=K`
|
|
32
32
|
:host {
|
|
33
33
|
--vf-bg: #0a0a0a;
|
|
34
34
|
--vf-bg-muted: #171717;
|
package/dist/vibe-flags.cdn.mjs
CHANGED
|
@@ -45,7 +45,7 @@ const _e = (i) => new be(typeof i == "string" ? i : i + "", void 0, Z), G = (i,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Ae, defineProperty: Se, getOwnPropertyDescriptor:
|
|
48
|
+
const { is: Ae, defineProperty: Se, getOwnPropertyDescriptor: Ee, getOwnPropertyNames: Ce, getOwnPropertySymbols: ke, getPrototypeOf: Pe } = Object, q = globalThis, ne = q.trustedTypes, Oe = ne ? ne.emptyScript : "", Me = q.reactiveElementPolyfillSupport, T = (i, e) => i, B = { toAttribute(i, e) {
|
|
49
49
|
switch (e) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
i = i ? Oe : null;
|
|
@@ -75,7 +75,7 @@ const { is: Ae, defineProperty: Se, getOwnPropertyDescriptor: ke, getOwnProperty
|
|
|
75
75
|
return t;
|
|
76
76
|
} }, Q = (i, e) => !Ae(i, e), ae = { attribute: !0, type: String, converter: B, reflect: !1, useDefault: !1, hasChanged: Q };
|
|
77
77
|
Symbol.metadata ??= Symbol("metadata"), q.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
|
-
let
|
|
78
|
+
let E = class extends HTMLElement {
|
|
79
79
|
static addInitializer(e) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(e);
|
|
81
81
|
}
|
|
@@ -89,7 +89,7 @@ let k = class extends HTMLElement {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(e, t, s) {
|
|
92
|
-
const { get: r, set: o } =
|
|
92
|
+
const { get: r, set: o } = Ee(this.prototype, e) ?? { get() {
|
|
93
93
|
return this[t];
|
|
94
94
|
}, set(n) {
|
|
95
95
|
this[t] = n;
|
|
@@ -110,7 +110,7 @@ let k = class extends HTMLElement {
|
|
|
110
110
|
static finalize() {
|
|
111
111
|
if (this.hasOwnProperty(T("finalized"))) return;
|
|
112
112
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(T("properties"))) {
|
|
113
|
-
const t = this.properties, s = [...
|
|
113
|
+
const t = this.properties, s = [...Ce(t), ...ke(t)];
|
|
114
114
|
for (const r of s) this.createProperty(r, t[r]);
|
|
115
115
|
}
|
|
116
116
|
const e = this[Symbol.metadata];
|
|
@@ -256,7 +256,7 @@ let k = class extends HTMLElement {
|
|
|
256
256
|
firstUpdated(e) {
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
|
|
259
|
+
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[T("elementProperties")] = /* @__PURE__ */ new Map(), E[T("finalized")] = /* @__PURE__ */ new Map(), Me?.({ ReactiveElement: E }), (q.reactiveElementVersions ??= []).push("2.1.2");
|
|
260
260
|
/**
|
|
261
261
|
* @license
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
@@ -264,7 +264,7 @@ k.elementStyles = [], k.shadowRootOptions = { mode: "open" }, k[T("elementProper
|
|
|
264
264
|
*/
|
|
265
265
|
const ee = globalThis, le = (i) => i, L = ee.trustedTypes, he = L ? L.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ye = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, $e = "?" + y, Te = `<${$e}>`, w = document, U = () => w.createComment(""), F = (i) => i === null || typeof i != "object" && typeof i != "function", te = Array.isArray, Ue = (i) => te(i) || typeof i?.[Symbol.iterator] == "function", J = `[
|
|
266
266
|
\f\r]`, O = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ce = /-->/g, de = />/g, x = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
|
267
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), pe = /'/g, fe = /"/g, me = /^(?:script|style|textarea|title)$/i, Fe = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), f = Fe(1),
|
|
267
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), pe = /'/g, fe = /"/g, me = /^(?:script|style|textarea|title)$/i, Fe = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), f = Fe(1), C = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ue = /* @__PURE__ */ new WeakMap(), _ = w.createTreeWalker(w, 129);
|
|
268
268
|
function xe(i, e) {
|
|
269
269
|
if (!te(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
270
270
|
return he !== void 0 ? he.createHTML(e) : e;
|
|
@@ -318,11 +318,11 @@ class N {
|
|
|
318
318
|
return s.innerHTML = e, s;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
if (e ===
|
|
321
|
+
function k(i, e, t = i, s) {
|
|
322
|
+
if (e === C) return e;
|
|
323
323
|
let r = s !== void 0 ? t._$Co?.[s] : t._$Cl;
|
|
324
324
|
const o = F(e) ? void 0 : e._$litDirective$;
|
|
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 =
|
|
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 = k(i, r._$AS(i, e.values), r, s)), e;
|
|
326
326
|
}
|
|
327
327
|
class He {
|
|
328
328
|
constructor(e, t) {
|
|
@@ -371,7 +371,7 @@ class R {
|
|
|
371
371
|
return this._$AB;
|
|
372
372
|
}
|
|
373
373
|
_$AI(e, t = this) {
|
|
374
|
-
e =
|
|
374
|
+
e = k(this, e, t), F(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== C && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ue(e) ? this.k(e) : this._(e);
|
|
375
375
|
}
|
|
376
376
|
O(e) {
|
|
377
377
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -424,11 +424,11 @@ class W {
|
|
|
424
424
|
_$AI(e, t = this, s, r) {
|
|
425
425
|
const o = this.strings;
|
|
426
426
|
let n = !1;
|
|
427
|
-
if (o === void 0) e =
|
|
427
|
+
if (o === void 0) e = k(this, e, t, 0), n = !F(e) || e !== this._$AH && e !== C, n && (this._$AH = e);
|
|
428
428
|
else {
|
|
429
429
|
const l = e;
|
|
430
430
|
let a, d;
|
|
431
|
-
for (e = o[0], a = 0; a < o.length - 1; a++) d =
|
|
431
|
+
for (e = o[0], a = 0; a < o.length - 1; a++) d = k(this, l[s + a], t, a), d === C && (d = this._$AH[a]), n ||= !F(d) || d !== this._$AH[a], d === c ? e = c : e !== c && (e += (d ?? "") + o[a + 1]), this._$AH[a] = d;
|
|
432
432
|
}
|
|
433
433
|
n && !r && this.j(e);
|
|
434
434
|
}
|
|
@@ -457,7 +457,7 @@ class Ie extends W {
|
|
|
457
457
|
super(e, t, s, r, o), this.type = 5;
|
|
458
458
|
}
|
|
459
459
|
_$AI(e, t = this) {
|
|
460
|
-
if ((e =
|
|
460
|
+
if ((e = k(this, e, t, 0) ?? c) === C) return;
|
|
461
461
|
const s = this._$AH, r = e === c && s !== c || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, o = e !== c && (s === c || r);
|
|
462
462
|
r && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
463
463
|
}
|
|
@@ -473,7 +473,7 @@ class De {
|
|
|
473
473
|
return this._$AM._$AU;
|
|
474
474
|
}
|
|
475
475
|
_$AI(e) {
|
|
476
|
-
|
|
476
|
+
k(this, e);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
const ze = ee.litHtmlPolyfillSupport;
|
|
@@ -493,7 +493,7 @@ const Be = (i, e, t) => {
|
|
|
493
493
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
494
494
|
*/
|
|
495
495
|
const se = globalThis;
|
|
496
|
-
class v extends
|
|
496
|
+
class v extends E {
|
|
497
497
|
constructor() {
|
|
498
498
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
499
499
|
}
|
|
@@ -512,7 +512,7 @@ class v extends k {
|
|
|
512
512
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
513
513
|
}
|
|
514
514
|
render() {
|
|
515
|
-
return
|
|
515
|
+
return C;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
v._$litElement$ = !0, v.finalized = !0, se.litElementHydrateSupport?.({ LitElement: v });
|
|
@@ -671,7 +671,7 @@ if (typeof document < "u" && !document.getElementById("vibe-flag-fouc")) {
|
|
|
671
671
|
}
|
|
672
672
|
let A = class extends v {
|
|
673
673
|
constructor() {
|
|
674
|
-
super(...arguments), this.
|
|
674
|
+
super(...arguments), this.name = "", this.description = "", this.value = "", this.isMatch = !1, this.ready = !1, this.onFlagChange = () => {
|
|
675
675
|
this.evaluate();
|
|
676
676
|
};
|
|
677
677
|
}
|
|
@@ -682,17 +682,17 @@ let A = class extends v {
|
|
|
682
682
|
super.disconnectedCallback(), window.removeEventListener("vibe-flags-changed", this.onFlagChange);
|
|
683
683
|
}
|
|
684
684
|
willUpdate(i) {
|
|
685
|
-
(i.has("
|
|
685
|
+
(i.has("name") || i.has("description")) && this.registerFlag();
|
|
686
686
|
}
|
|
687
687
|
registerFlag() {
|
|
688
|
-
this.
|
|
689
|
-
key: this.
|
|
688
|
+
this.name && (u.getConfigForKey(this.name) || u.register({
|
|
689
|
+
key: this.name,
|
|
690
690
|
type: "boolean",
|
|
691
691
|
label: this.description || void 0
|
|
692
692
|
}), this.evaluate());
|
|
693
693
|
}
|
|
694
694
|
evaluate() {
|
|
695
|
-
const i = u.get(this.
|
|
695
|
+
const i = u.get(this.name);
|
|
696
696
|
i === void 0 ? this.isMatch = !1 : this.value === "" ? this.isMatch = !0 : this.isMatch = String(i) === this.value, this.ready || (this.ready = !0, this.style.visibility = "visible");
|
|
697
697
|
}
|
|
698
698
|
render() {
|
|
@@ -701,7 +701,7 @@ let A = class extends v {
|
|
|
701
701
|
};
|
|
702
702
|
P([
|
|
703
703
|
S({ type: String })
|
|
704
|
-
], A.prototype, "
|
|
704
|
+
], A.prototype, "name", 2);
|
|
705
705
|
P([
|
|
706
706
|
S({ type: String })
|
|
707
707
|
], A.prototype, "description", 2);
|
|
@@ -724,7 +724,7 @@ var Ze = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, K = (i, e,
|
|
|
724
724
|
};
|
|
725
725
|
let H = class extends v {
|
|
726
726
|
constructor() {
|
|
727
|
-
super(...arguments), this.
|
|
727
|
+
super(...arguments), this.name = "", this.description = "", this.ready = !1, this.onFlagChange = () => {
|
|
728
728
|
this.syncOptions();
|
|
729
729
|
};
|
|
730
730
|
}
|
|
@@ -735,23 +735,23 @@ let H = class extends v {
|
|
|
735
735
|
super.disconnectedCallback(), window.removeEventListener("vibe-flags-changed", this.onFlagChange);
|
|
736
736
|
}
|
|
737
737
|
willUpdate(i) {
|
|
738
|
-
(i.has("
|
|
738
|
+
(i.has("name") || i.has("description")) && this.registerFlag();
|
|
739
739
|
}
|
|
740
740
|
getOptions() {
|
|
741
741
|
return Array.from(this.querySelectorAll("vibe-flag-option"));
|
|
742
742
|
}
|
|
743
743
|
registerFlag() {
|
|
744
|
-
if (!this.
|
|
744
|
+
if (!this.name) return;
|
|
745
745
|
const i = this.getOptions().map((e) => e.value).filter(Boolean);
|
|
746
|
-
i.length !== 0 && (u.getConfigForKey(this.
|
|
747
|
-
key: this.
|
|
746
|
+
i.length !== 0 && (u.getConfigForKey(this.name) || u.register({
|
|
747
|
+
key: this.name,
|
|
748
748
|
type: "select",
|
|
749
749
|
options: i,
|
|
750
750
|
label: this.description || void 0
|
|
751
751
|
}), this.syncOptions());
|
|
752
752
|
}
|
|
753
753
|
syncOptions() {
|
|
754
|
-
const i = u.get(this.
|
|
754
|
+
const i = u.get(this.name);
|
|
755
755
|
for (const e of this.getOptions())
|
|
756
756
|
e.active = e.value === i;
|
|
757
757
|
this.ready || (this.ready = !0, this.style.visibility = "visible");
|
|
@@ -762,7 +762,7 @@ let H = class extends v {
|
|
|
762
762
|
};
|
|
763
763
|
K([
|
|
764
764
|
S({ type: String })
|
|
765
|
-
], H.prototype, "
|
|
765
|
+
], H.prototype, "name", 2);
|
|
766
766
|
K([
|
|
767
767
|
S({ type: String })
|
|
768
768
|
], H.prototype, "description", 2);
|
package/dist/vibe-flags.js
CHANGED
|
@@ -102,7 +102,7 @@ if (typeof document < "u" && !document.getElementById("vibe-flag-fouc")) {
|
|
|
102
102
|
}
|
|
103
103
|
let p = class extends u {
|
|
104
104
|
constructor() {
|
|
105
|
-
super(...arguments), this.
|
|
105
|
+
super(...arguments), this.name = "", this.description = "", this.value = "", this.isMatch = !1, this.ready = !1, this.onFlagChange = () => {
|
|
106
106
|
this.evaluate();
|
|
107
107
|
};
|
|
108
108
|
}
|
|
@@ -113,17 +113,17 @@ let p = class extends u {
|
|
|
113
113
|
super.disconnectedCallback(), window.removeEventListener("vibe-flags-changed", this.onFlagChange);
|
|
114
114
|
}
|
|
115
115
|
willUpdate(t) {
|
|
116
|
-
(t.has("
|
|
116
|
+
(t.has("name") || t.has("description")) && this.registerFlag();
|
|
117
117
|
}
|
|
118
118
|
registerFlag() {
|
|
119
|
-
this.
|
|
120
|
-
key: this.
|
|
119
|
+
this.name && (l.getConfigForKey(this.name) || l.register({
|
|
120
|
+
key: this.name,
|
|
121
121
|
type: "boolean",
|
|
122
122
|
label: this.description || void 0
|
|
123
123
|
}), this.evaluate());
|
|
124
124
|
}
|
|
125
125
|
evaluate() {
|
|
126
|
-
const t = l.get(this.
|
|
126
|
+
const t = l.get(this.name);
|
|
127
127
|
t === void 0 ? this.isMatch = !1 : this.value === "" ? this.isMatch = !0 : this.isMatch = String(t) === this.value, this.ready || (this.ready = !0, this.style.visibility = "visible");
|
|
128
128
|
}
|
|
129
129
|
render() {
|
|
@@ -132,7 +132,7 @@ let p = class extends u {
|
|
|
132
132
|
};
|
|
133
133
|
g([
|
|
134
134
|
f({ type: String })
|
|
135
|
-
], p.prototype, "
|
|
135
|
+
], p.prototype, "name", 2);
|
|
136
136
|
g([
|
|
137
137
|
f({ type: String })
|
|
138
138
|
], p.prototype, "description", 2);
|
|
@@ -148,14 +148,14 @@ g([
|
|
|
148
148
|
p = g([
|
|
149
149
|
b("vibe-flag-boolean")
|
|
150
150
|
], p);
|
|
151
|
-
var T = Object.defineProperty, j = Object.getOwnPropertyDescriptor,
|
|
151
|
+
var T = Object.defineProperty, j = Object.getOwnPropertyDescriptor, w = (t, e, r, o) => {
|
|
152
152
|
for (var s = o > 1 ? void 0 : o ? j(e, r) : e, i = t.length - 1, n; i >= 0; i--)
|
|
153
153
|
(n = t[i]) && (s = (o ? n(e, r, s) : n(s)) || s);
|
|
154
154
|
return o && s && T(e, r, s), s;
|
|
155
155
|
};
|
|
156
156
|
let v = class extends u {
|
|
157
157
|
constructor() {
|
|
158
|
-
super(...arguments), this.
|
|
158
|
+
super(...arguments), this.name = "", this.description = "", this.ready = !1, this.onFlagChange = () => {
|
|
159
159
|
this.syncOptions();
|
|
160
160
|
};
|
|
161
161
|
}
|
|
@@ -166,23 +166,23 @@ let v = class extends u {
|
|
|
166
166
|
super.disconnectedCallback(), window.removeEventListener("vibe-flags-changed", this.onFlagChange);
|
|
167
167
|
}
|
|
168
168
|
willUpdate(t) {
|
|
169
|
-
(t.has("
|
|
169
|
+
(t.has("name") || t.has("description")) && this.registerFlag();
|
|
170
170
|
}
|
|
171
171
|
getOptions() {
|
|
172
172
|
return Array.from(this.querySelectorAll("vibe-flag-option"));
|
|
173
173
|
}
|
|
174
174
|
registerFlag() {
|
|
175
|
-
if (!this.
|
|
175
|
+
if (!this.name) return;
|
|
176
176
|
const t = this.getOptions().map((e) => e.value).filter(Boolean);
|
|
177
|
-
t.length !== 0 && (l.getConfigForKey(this.
|
|
178
|
-
key: this.
|
|
177
|
+
t.length !== 0 && (l.getConfigForKey(this.name) || l.register({
|
|
178
|
+
key: this.name,
|
|
179
179
|
type: "select",
|
|
180
180
|
options: t,
|
|
181
181
|
label: this.description || void 0
|
|
182
182
|
}), this.syncOptions());
|
|
183
183
|
}
|
|
184
184
|
syncOptions() {
|
|
185
|
-
const t = l.get(this.
|
|
185
|
+
const t = l.get(this.name);
|
|
186
186
|
for (const e of this.getOptions())
|
|
187
187
|
e.active = e.value === t;
|
|
188
188
|
this.ready || (this.ready = !0, this.style.visibility = "visible");
|
|
@@ -191,16 +191,16 @@ let v = class extends u {
|
|
|
191
191
|
return a`<slot></slot>`;
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
|
|
194
|
+
w([
|
|
195
195
|
f({ type: String })
|
|
196
|
-
], v.prototype, "
|
|
197
|
-
|
|
196
|
+
], v.prototype, "name", 2);
|
|
197
|
+
w([
|
|
198
198
|
f({ type: String })
|
|
199
199
|
], v.prototype, "description", 2);
|
|
200
|
-
|
|
200
|
+
w([
|
|
201
201
|
c()
|
|
202
202
|
], v.prototype, "ready", 2);
|
|
203
|
-
v =
|
|
203
|
+
v = w([
|
|
204
204
|
b("vibe-flag-select")
|
|
205
205
|
], v);
|
|
206
206
|
var I = Object.defineProperty, z = Object.getOwnPropertyDescriptor, C = (t, e, r, o) => {
|
|
@@ -208,7 +208,7 @@ var I = Object.defineProperty, z = Object.getOwnPropertyDescriptor, C = (t, e, r
|
|
|
208
208
|
(n = t[i]) && (s = (o ? n(e, r, s) : n(s)) || s);
|
|
209
209
|
return o && s && I(e, r, s), s;
|
|
210
210
|
};
|
|
211
|
-
let
|
|
211
|
+
let m = class extends u {
|
|
212
212
|
constructor() {
|
|
213
213
|
super(...arguments), this.value = "", this.active = !1;
|
|
214
214
|
}
|
|
@@ -218,13 +218,13 @@ let w = class extends u {
|
|
|
218
218
|
};
|
|
219
219
|
C([
|
|
220
220
|
f({ type: String })
|
|
221
|
-
],
|
|
221
|
+
], m.prototype, "value", 2);
|
|
222
222
|
C([
|
|
223
223
|
c()
|
|
224
|
-
],
|
|
225
|
-
|
|
224
|
+
], m.prototype, "active", 2);
|
|
225
|
+
m = C([
|
|
226
226
|
b("vibe-flag-option")
|
|
227
|
-
],
|
|
227
|
+
], m);
|
|
228
228
|
const D = S`
|
|
229
229
|
:host {
|
|
230
230
|
--vf-bg: #0a0a0a;
|
|
@@ -768,7 +768,7 @@ d = x([
|
|
|
768
768
|
], d);
|
|
769
769
|
export {
|
|
770
770
|
p as VibeFlagBoolean,
|
|
771
|
-
|
|
771
|
+
m as VibeFlagOption,
|
|
772
772
|
v as VibeFlagSelect,
|
|
773
773
|
F as VibeFlags,
|
|
774
774
|
d as VibeToolbar,
|