@florid-kit/components 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button.d.ts +1 -1
- package/index.js +13 -17
- package/index.mjs +36 -40
- package/package.json +1 -1
package/components/button.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import { FormSubmitter, FormSubmitterType } from '../controllers/form-submitter';
|
|
3
3
|
|
|
4
4
|
declare const buttonBaseClass: import('../behaviors/mixin').MixinReturn<typeof LitElement, import('../behaviors/element-internals.js').WithElementInternals>;
|
|
5
|
-
declare const variants: readonly ["primary", "secondary"
|
|
5
|
+
declare const variants: readonly ["primary", "secondary"];
|
|
6
6
|
type ButtonVariant = (typeof variants)[number];
|
|
7
7
|
export declare class OccitaneButton extends buttonBaseClass implements FormSubmitter {
|
|
8
8
|
/** @nocollapse */
|
package/index.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const R=globalThis,
|
|
5
|
+
*/const R=globalThis,q=R.ShadowRoot&&(R.ShadyCSS===void 0||R.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,F=Symbol(),Q=new WeakMap;let lt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==F)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(q&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=Q.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Q.set(e,t))}return t}toString(){return this.cssText}};const ct=r=>new lt(typeof r=="string"?r:r+"",void 0,F),J=(r,...t)=>{const e=r.length===1?r[0]:t.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 lt(e,r,F)},ft=(r,t)=>{if(q)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=R.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},X=q?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return ct(e)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:bt,defineProperty:_t,getOwnPropertyDescriptor:mt,getOwnPropertyNames:gt,getOwnPropertySymbols:vt,getPrototypeOf:yt}=Object,_=globalThis,
|
|
9
|
+
*/const{is:bt,defineProperty:_t,getOwnPropertyDescriptor:mt,getOwnPropertyNames:gt,getOwnPropertySymbols:vt,getPrototypeOf:yt}=Object,_=globalThis,Y=_.trustedTypes,At=Y?Y.emptyScript:"",L=_.reactiveElementPolyfillSupport,P=(r,t)=>r,k={toAttribute(r,t){switch(t){case Boolean:r=r?At:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},K=(r,t)=>!bt(r,t),tt={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:K};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class A extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&_t(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=mt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i==null?void 0:i.call(this)},set(n){const h=i==null?void 0:i.call(this);o.call(this,n),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??tt}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=yt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){const e=this.properties,s=[...gt(e),...vt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(X(i))}else t!==void 0&&e.push(X(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var o;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const n=(((o=s.converter)==null?void 0:o.toAttribute)!==void 0?s.converter:k).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){var o;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),h=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:k;this._$Em=i,this[i]=h.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??K)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[o,n]of i)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var o;return(o=i.hostUpdate)==null?void 0:o.call(i)}),this.update(e)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[P("elementProperties")]=new Map,A[P("finalized")]=new Map,L==null||L({ReactiveElement:A}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const C=globalThis,z=C.trustedTypes,
|
|
14
|
-
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const C=globalThis,z=C.trustedTypes,et=z?z.createPolicy("lit-html",{createHTML:r=>r}):void 0,dt="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,ut="?"+b,Et=`<${ut}>`,v=document,O=()=>v.createComment(""),T=r=>r===null||typeof r!="object"&&typeof r!="function",Z=Array.isArray,St=r=>Z(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",j=`[
|
|
14
|
+
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,st=/-->/g,it=/>/g,m=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,nt=/"/g,pt=/^(?:script|style|textarea|title)$/i,wt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),B=wt(1),E=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ot=new WeakMap,g=v.createTreeWalker(v,129);function $t(r,t){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return et!==void 0?et.createHTML(t):t}const xt=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=x;for(let h=0;h<e;h++){const a=r[h];let d,u,l=-1,$=0;for(;$<a.length&&(n.lastIndex=$,u=n.exec(a),u!==null);)$=n.lastIndex,n===x?u[1]==="!--"?n=st:u[1]!==void 0?n=it:u[2]!==void 0?(pt.test(u[2])&&(i=RegExp("</"+u[2],"g")),n=m):u[3]!==void 0&&(n=m):n===m?u[0]===">"?(n=i??x,l=-1):u[1]===void 0?l=-2:(l=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?m:u[3]==='"'?nt:rt):n===nt||n===rt?n=m:n===st||n===it?n=x:(n=m,i=void 0);const f=n===m&&r[h+1].startsWith("/>")?" ":"";o+=n===x?a+Et:l>=0?(s.push(d),a.slice(0,l)+dt+a.slice(l)+b+f):a+b+(l===-2?h:f)}return[$t(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class H{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const h=t.length-1,a=this.parts,[d,u]=xt(t,e);if(this.el=H.createElement(d,s),g.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=g.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith(dt)){const $=u[n++],f=i.getAttribute(l).split(b),N=/([.?@])?(.*)/.exec($);a.push({type:1,index:o,name:N[2],strings:f,ctor:N[1]==="."?Ct:N[1]==="?"?Ut:N[1]==="@"?Ot:I}),i.removeAttribute(l)}else l.startsWith(b)&&(a.push({type:6,index:o}),i.removeAttribute(l));if(pt.test(i.tagName)){const l=i.textContent.split(b),$=l.length-1;if($>0){i.textContent=z?z.emptyScript:"";for(let f=0;f<$;f++)i.append(l[f],O()),g.nextNode(),a.push({type:2,index:++o});i.append(l[$],O())}}}else if(i.nodeType===8)if(i.data===ut)a.push({type:2,index:o});else{let l=-1;for(;(l=i.data.indexOf(b,l+1))!==-1;)a.push({type:7,index:o}),l+=b.length-1}o++}}static createElement(t,e){const s=v.createElement("template");return s.innerHTML=t,s}}function S(r,t,e=r,s){var n,h;if(t===E)return t;let i=s!==void 0?(n=e._$Co)==null?void 0:n[s]:e._$Cl;const o=T(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((h=i==null?void 0:i._$AO)==null||h.call(i,!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=S(r,i._$AS(r,t.values),i,s)),t}class Pt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??v).importNode(e,!0);g.currentNode=i;let o=g.nextNode(),n=0,h=0,a=s[0];for(;a!==void 0;){if(n===a.index){let d;a.type===2?d=new M(o,o.nextSibling,this,t):a.type===1?d=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(d=new Tt(o,this,t)),this._$AV.push(d),a=s[++h]}n!==(a==null?void 0:a.index)&&(o=g.nextNode(),n++)}return g.currentNode=v,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class M{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),T(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):St(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==c&&T(this._$AH)?this._$AA.nextSibling.data=t:this.T(v.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=H.createElement($t(s.h,s.h[0]),this.options)),s);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{const n=new Pt(i,this),h=n.u(this.options);n.p(e),this.T(h),this._$AH=n}}_$AC(t){let e=ot.get(t.strings);return e===void 0&&ot.set(t.strings,e=new H(t)),e}k(t){Z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new M(this.O(O()),this.O(O()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,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=c}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=S(this,t,e,0),n=!T(t)||t!==this._$AH&&t!==E,n&&(this._$AH=t);else{const h=t;let a,d;for(t=o[0],a=0;a<o.length-1;a++)d=S(this,h[s+a],e,a),d===E&&(d=this._$AH[a]),n||(n=!T(d)||d!==this._$AH[a]),d===c?t=c:t!==c&&(t+=(d??"")+o[a+1]),this._$AH[a]=d}n&&!i&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ct extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}}class Ut extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}}class Ot extends I{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??c)===E)return;const s=this._$AH,i=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==c&&(s===c||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}}const D=C.litHtmlPolyfillSupport;D==null||D(H,M),(C.litHtmlVersions??(C.litHtmlVersions=[])).push("3.2.1");const Ht=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new M(t.insertBefore(O(),o),o,void 0,e??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const Nt={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:
|
|
27
|
+
*/const Nt={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:K},Rt=(r=Nt,t,e)=>{const{kind:s,metadata:i}=e;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,r),s==="accessor"){const{name:n}=e;return{set(h){const a=t.get.call(this);t.set.call(this,h),this.requestUpdate(n,a,r)},init(h){return h!==void 0&&this.P(n,void 0,r),h}}}if(s==="setter"){const{name:n}=e;return function(h){const a=this[n];t.call(this,h),this.requestUpdate(n,a,r)}}throw Error("Unsupported decorator location: "+s)};function w(r){return(t,e)=>typeof e=="object"?Rt(r,t,e):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?{...s,wrapped:!0}:s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,t,e)}const kt=J`
|
|
28
28
|
outline: 1px dashed var(--button-border-color);
|
|
29
29
|
outline-offset: 2px;
|
|
30
30
|
outline: dashed black;
|
|
31
|
-
`;
|
|
31
|
+
`;J`
|
|
32
32
|
:host * {
|
|
33
33
|
box-sizing: border-box;
|
|
34
34
|
}
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2023 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
-
*/const
|
|
39
|
+
*/const G=Symbol("internals"),W=Symbol("privateInternals");function zt(r){var t;class e extends r{get[(t=G,t)](){return this[W]||(this[W]=this.attachInternals()),this[W]}}return e}/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2023 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: Apache-2.0
|
|
43
|
-
*/function It(r){r.addInitializer(t=>{const e=t;e.addEventListener("click",async s=>{const{type:i,[
|
|
43
|
+
*/function It(r){r.addInitializer(t=>{const e=t;e.addEventListener("click",async s=>{const{type:i,[G]:o}=e,{form:n}=o;if(!(!n||i==="button")&&(await new Promise(h=>{setTimeout(h)}),!s.defaultPrevented)){if(i==="reset"){n.reset();return}n.addEventListener("submit",h=>{Object.defineProperty(h,"submitter",{configurable:!0,enumerable:!0,get:()=>e})},{capture:!0,once:!0}),o.setFormValue(e.value),n.requestSubmit()}})})}var Lt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,y=(r,t,e,s)=>{for(var i=s>1?void 0:s?jt(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&Lt(t,e,i),i};const Bt=zt(U),at=r=>{const t=`
|
|
44
44
|
--button-bg-disabled: var(--color-content-disabled);
|
|
45
45
|
--button-bg-hover: var(--color-container-action-${r}-hover);
|
|
46
46
|
--button-bg: var(--color-container-action-${r}-default);
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
--button-text-disabled: var(--color-content-action-${r}-disabled);
|
|
53
53
|
--button-text-hover: var(--color-content-action-${r}-hover);
|
|
54
54
|
--button-text: var(--color-content-action-${r}-default);
|
|
55
|
-
`;return ct(t)},Dt=["primary","secondary"
|
|
55
|
+
`;return ct(t)},Dt=["primary","secondary"];let p=class extends Bt{constructor(){super(...arguments),this.type="submit",this.value="",this.variant="primary",this.disabled=!1,this.href="",this.target=""}get name(){return this.getAttribute("name")??""}set name(r){this.setAttribute("name",r)}get form(){return this[G].form}willUpdate(){const r=getComputedStyle(this).getPropertyValue("--button-variant");r&&Dt.some(t=>t===r)&&(this.variant=r)}render(){const r=this.href?this.renderLink():this.renderButton();return B`${r}`}renderLink(){return B`<a
|
|
56
56
|
href=${this.href}
|
|
57
57
|
target=${this.target||c}
|
|
58
58
|
class="button"
|
|
@@ -61,19 +61,15 @@
|
|
|
61
61
|
<slot />
|
|
62
62
|
</a>`}renderButton(){return B`<button class="button" ?disabled=${this.disabled}>
|
|
63
63
|
<slot />
|
|
64
|
-
</button>`}};It(p);p.formAssociated=!0;p.styles=
|
|
64
|
+
</button>`}};It(p);p.formAssociated=!0;p.styles=J`
|
|
65
65
|
:host {
|
|
66
66
|
display: inline-flex;
|
|
67
67
|
cursor: pointer;
|
|
68
|
-
${
|
|
68
|
+
${at("primary")}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
:host([variant="secondary"]) {
|
|
72
|
-
${
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
:host([variant="tertiary"]) {
|
|
76
|
-
${q("tertiary")}
|
|
72
|
+
${at("secondary")}
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
:host([disabled]) {
|
package/index.mjs
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const R = globalThis,
|
|
6
|
+
const R = globalThis, q = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, F = Symbol(), Q = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let lt = class {
|
|
8
8
|
constructor(t, e, s) {
|
|
9
|
-
if (this._$cssResult$ = !0, s !==
|
|
9
|
+
if (this._$cssResult$ = !0, s !== F) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = e;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const e = this.t;
|
|
15
|
-
if (
|
|
15
|
+
if (q && t === void 0) {
|
|
16
16
|
const s = e !== void 0 && e.length === 1;
|
|
17
|
-
s && (t =
|
|
17
|
+
s && (t = Q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Q.set(e, t));
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}
|
|
@@ -22,20 +22,20 @@ let lt = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const ct = (r) => new lt(typeof r == "string" ? r : r + "", void 0,
|
|
25
|
+
const ct = (r) => new lt(typeof r == "string" ? r : r + "", void 0, F), J = (r, ...t) => {
|
|
26
26
|
const e = r.length === 1 ? r[0] : t.reduce((s, i, 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
|
})(i) + r[o + 1], r[0]);
|
|
31
|
-
return new lt(e, r,
|
|
31
|
+
return new lt(e, r, F);
|
|
32
32
|
}, ft = (r, t) => {
|
|
33
|
-
if (
|
|
33
|
+
if (q) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
34
|
else for (const e of t) {
|
|
35
35
|
const s = document.createElement("style"), i = R.litNonce;
|
|
36
36
|
i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, X = q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let e = "";
|
|
40
40
|
for (const s of t.cssRules) e += s.cssText;
|
|
41
41
|
return ct(e);
|
|
@@ -45,7 +45,7 @@ const ct = (r) => new lt(typeof r == "string" ? r : r + "", void 0, J), K = (r,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: bt, defineProperty: _t, getOwnPropertyDescriptor: mt, getOwnPropertyNames: gt, getOwnPropertySymbols: vt, getPrototypeOf: yt } = Object, _ = globalThis,
|
|
48
|
+
const { is: bt, defineProperty: _t, getOwnPropertyDescriptor: mt, getOwnPropertyNames: gt, getOwnPropertySymbols: vt, getPrototypeOf: yt } = Object, _ = globalThis, Y = _.trustedTypes, At = Y ? Y.emptyScript : "", L = _.reactiveElementPolyfillSupport, P = (r, t) => r, k = { toAttribute(r, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
r = r ? At : null;
|
|
@@ -73,7 +73,7 @@ const { is: bt, defineProperty: _t, getOwnPropertyDescriptor: mt, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return e;
|
|
76
|
-
} },
|
|
76
|
+
} }, K = (r, t) => !bt(r, t), tt = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged: K };
|
|
77
77
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
class A extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
@@ -82,7 +82,7 @@ class A extends HTMLElement {
|
|
|
82
82
|
static get observedAttributes() {
|
|
83
83
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
84
|
}
|
|
85
|
-
static createProperty(t, e =
|
|
85
|
+
static createProperty(t, e = tt) {
|
|
86
86
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
87
87
|
const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
|
|
88
88
|
i !== void 0 && _t(this.prototype, t, i);
|
|
@@ -102,7 +102,7 @@ class A extends HTMLElement {
|
|
|
102
102
|
}, configurable: !0, enumerable: !0 };
|
|
103
103
|
}
|
|
104
104
|
static getPropertyOptions(t) {
|
|
105
|
-
return this.elementProperties.get(t) ??
|
|
105
|
+
return this.elementProperties.get(t) ?? tt;
|
|
106
106
|
}
|
|
107
107
|
static _$Ei() {
|
|
108
108
|
if (this.hasOwnProperty(P("elementProperties"))) return;
|
|
@@ -131,8 +131,8 @@ class A extends HTMLElement {
|
|
|
131
131
|
const e = [];
|
|
132
132
|
if (Array.isArray(t)) {
|
|
133
133
|
const s = new Set(t.flat(1 / 0).reverse());
|
|
134
|
-
for (const i of s) e.unshift(
|
|
135
|
-
} else t !== void 0 && e.push(
|
|
134
|
+
for (const i of s) e.unshift(X(i));
|
|
135
|
+
} else t !== void 0 && e.push(X(t));
|
|
136
136
|
return e;
|
|
137
137
|
}
|
|
138
138
|
static _$Eu(t, e) {
|
|
@@ -200,7 +200,7 @@ class A extends HTMLElement {
|
|
|
200
200
|
}
|
|
201
201
|
requestUpdate(t, e, s) {
|
|
202
202
|
if (t !== void 0) {
|
|
203
|
-
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ??
|
|
203
|
+
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? K)(this[t], e)) return;
|
|
204
204
|
this.P(t, e, s);
|
|
205
205
|
}
|
|
206
206
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
@@ -279,12 +279,12 @@ A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[P("elementProper
|
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const C = globalThis, z = C.trustedTypes,
|
|
283
|
-
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
284
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
282
|
+
const C = globalThis, z = C.trustedTypes, et = z ? z.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, dt = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, ut = "?" + b, Et = `<${ut}>`, v = document, O = () => v.createComment(""), T = (r) => r === null || typeof r != "object" && typeof r != "function", Z = Array.isArray, St = (r) => Z(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", j = `[
|
|
283
|
+
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, st = /-->/g, it = />/g, m = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, nt = /"/g, pt = /^(?:script|style|textarea|title)$/i, wt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), B = wt(1), E = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), g = v.createTreeWalker(v, 129);
|
|
285
285
|
function $t(r, t) {
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
286
|
+
if (!Z(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return et !== void 0 ? et.createHTML(t) : t;
|
|
288
288
|
}
|
|
289
289
|
const xt = (r, t) => {
|
|
290
290
|
const e = r.length - 1, s = [];
|
|
@@ -292,7 +292,7 @@ const xt = (r, t) => {
|
|
|
292
292
|
for (let h = 0; h < e; h++) {
|
|
293
293
|
const a = r[h];
|
|
294
294
|
let d, u, l = -1, $ = 0;
|
|
295
|
-
for (; $ < a.length && (n.lastIndex = $, u = n.exec(a), u !== null); ) $ = n.lastIndex, n === x ? u[1] === "!--" ? n =
|
|
295
|
+
for (; $ < a.length && (n.lastIndex = $, u = n.exec(a), u !== null); ) $ = n.lastIndex, n === x ? u[1] === "!--" ? n = st : u[1] !== void 0 ? n = it : u[2] !== void 0 ? (pt.test(u[2]) && (i = RegExp("</" + u[2], "g")), n = m) : u[3] !== void 0 && (n = m) : n === m ? u[0] === ">" ? (n = i ?? x, l = -1) : u[1] === void 0 ? l = -2 : (l = n.lastIndex - u[2].length, d = u[1], n = u[3] === void 0 ? m : u[3] === '"' ? nt : rt) : n === nt || n === rt ? n = m : n === st || n === it ? n = x : (n = m, i = void 0);
|
|
296
296
|
const f = n === m && r[h + 1].startsWith("/>") ? " " : "";
|
|
297
297
|
o += n === x ? a + Et : l >= 0 ? (s.push(d), a.slice(0, l) + dt + a.slice(l) + b + f) : a + b + (l === -2 ? h : f);
|
|
298
298
|
}
|
|
@@ -411,11 +411,11 @@ class M {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
_$AC(t) {
|
|
414
|
-
let e =
|
|
415
|
-
return e === void 0 &&
|
|
414
|
+
let e = ot.get(t.strings);
|
|
415
|
+
return e === void 0 && ot.set(t.strings, e = new H(t)), e;
|
|
416
416
|
}
|
|
417
417
|
k(t) {
|
|
418
|
-
|
|
418
|
+
Z(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
419
|
const e = this._$AH;
|
|
420
420
|
let s, i = 0;
|
|
421
421
|
for (const o of t) i === e.length ? e.push(s = new M(this.O(O()), this.O(O()), this, this.options)) : s = e[i], s._$AI(o), i++;
|
|
@@ -560,7 +560,7 @@ const Mt = (r) => (t, e) => {
|
|
|
560
560
|
* Copyright 2017 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
562
|
*/
|
|
563
|
-
const Nt = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged:
|
|
563
|
+
const Nt = { attribute: !0, type: String, converter: k, reflect: !1, hasChanged: K }, Rt = (r = Nt, t, e) => {
|
|
564
564
|
const { kind: s, metadata: i } = e;
|
|
565
565
|
let o = globalThis.litPropertyMetadata.get(i);
|
|
566
566
|
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(e.name, r), s === "accessor") {
|
|
@@ -587,12 +587,12 @@ function w(r) {
|
|
|
587
587
|
return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
588
588
|
})(r, t, e);
|
|
589
589
|
}
|
|
590
|
-
const kt =
|
|
590
|
+
const kt = J`
|
|
591
591
|
outline: 1px dashed var(--button-border-color);
|
|
592
592
|
outline-offset: 2px;
|
|
593
593
|
outline: dashed black;
|
|
594
594
|
`;
|
|
595
|
-
|
|
595
|
+
J`
|
|
596
596
|
:host * {
|
|
597
597
|
box-sizing: border-box;
|
|
598
598
|
}
|
|
@@ -602,11 +602,11 @@ K`
|
|
|
602
602
|
* Copyright 2023 Google LLC
|
|
603
603
|
* SPDX-License-Identifier: Apache-2.0
|
|
604
604
|
*/
|
|
605
|
-
const
|
|
605
|
+
const G = Symbol("internals"), W = Symbol("privateInternals");
|
|
606
606
|
function zt(r) {
|
|
607
607
|
var t;
|
|
608
608
|
class e extends r {
|
|
609
|
-
get [(t =
|
|
609
|
+
get [(t = G, t)]() {
|
|
610
610
|
return this[W] || (this[W] = this.attachInternals()), this[W];
|
|
611
611
|
}
|
|
612
612
|
}
|
|
@@ -621,7 +621,7 @@ function It(r) {
|
|
|
621
621
|
r.addInitializer((t) => {
|
|
622
622
|
const e = t;
|
|
623
623
|
e.addEventListener("click", async (s) => {
|
|
624
|
-
const { type: i, [
|
|
624
|
+
const { type: i, [G]: o } = e, { form: n } = o;
|
|
625
625
|
if (!(!n || i === "button") && (await new Promise((h) => {
|
|
626
626
|
setTimeout(h);
|
|
627
627
|
}), !s.defaultPrevented)) {
|
|
@@ -649,7 +649,7 @@ var Lt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, y = (r, t,
|
|
|
649
649
|
(n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i);
|
|
650
650
|
return s && i && Lt(t, e, i), i;
|
|
651
651
|
};
|
|
652
|
-
const Bt = zt(U),
|
|
652
|
+
const Bt = zt(U), at = (r) => {
|
|
653
653
|
const t = `
|
|
654
654
|
--button-bg-disabled: var(--color-content-disabled);
|
|
655
655
|
--button-bg-hover: var(--color-container-action-${r}-hover);
|
|
@@ -664,7 +664,7 @@ const Bt = zt(U), q = (r) => {
|
|
|
664
664
|
--button-text: var(--color-content-action-${r}-default);
|
|
665
665
|
`;
|
|
666
666
|
return ct(t);
|
|
667
|
-
}, Dt = ["primary", "secondary"
|
|
667
|
+
}, Dt = ["primary", "secondary"];
|
|
668
668
|
let p = class extends Bt {
|
|
669
669
|
constructor() {
|
|
670
670
|
super(...arguments), this.type = "submit", this.value = "", this.variant = "primary", this.disabled = !1, this.href = "", this.target = "";
|
|
@@ -679,7 +679,7 @@ let p = class extends Bt {
|
|
|
679
679
|
* The associated form element with which this element's value will submit.
|
|
680
680
|
*/
|
|
681
681
|
get form() {
|
|
682
|
-
return this[
|
|
682
|
+
return this[G].form;
|
|
683
683
|
}
|
|
684
684
|
// TODO: Add aria attributes support
|
|
685
685
|
// Adapt from: https://github.dev/material-components/material-web
|
|
@@ -709,19 +709,15 @@ let p = class extends Bt {
|
|
|
709
709
|
};
|
|
710
710
|
It(p);
|
|
711
711
|
p.formAssociated = !0;
|
|
712
|
-
p.styles =
|
|
712
|
+
p.styles = J`
|
|
713
713
|
:host {
|
|
714
714
|
display: inline-flex;
|
|
715
715
|
cursor: pointer;
|
|
716
|
-
${
|
|
716
|
+
${at("primary")}
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
:host([variant="secondary"]) {
|
|
720
|
-
${
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
:host([variant="tertiary"]) {
|
|
724
|
-
${q("tertiary")}
|
|
720
|
+
${at("secondary")}
|
|
725
721
|
}
|
|
726
722
|
|
|
727
723
|
:host([disabled]) {
|