solely 0.4.1 → 0.4.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/compiler/ir/buildIR.cjs +1 -1
- package/dist/compiler/ir/buildIR.js +1 -1
- package/dist/components/elements/checkbox/index.cjs +1 -1
- package/dist/components/elements/checkbox/index.js +1 -1
- package/dist/components/elements/fab/style.css.cjs +1 -1
- package/dist/components/elements/fab/style.css.js +1 -1
- package/dist/components/elements/input/index.cjs +1 -1
- package/dist/components/elements/input/index.d.ts +8 -0
- package/dist/components/elements/input/index.html.cjs +1 -1
- package/dist/components/elements/input/index.html.js +1 -1
- package/dist/components/elements/input/index.js +1 -1
- package/dist/components/elements/input/style.css.cjs +1 -1
- package/dist/components/elements/input/style.css.js +1 -1
- package/dist/components/elements/radio/index.cjs +1 -1
- package/dist/components/elements/radio/index.js +1 -1
- package/dist/components/elements/select/index.cjs +1 -1
- package/dist/components/elements/select/index.d.ts +43 -7
- package/dist/components/elements/select/index.html.cjs +1 -1
- package/dist/components/elements/select/index.html.js +1 -1
- package/dist/components/elements/select/index.js +1 -1
- package/dist/components/elements/select/style.css.cjs +1 -1
- package/dist/components/elements/select/style.css.js +1 -1
- package/dist/components/elements/select/types.d.ts +35 -11
- package/dist/components/elements/steps/index.cjs +1 -1
- package/dist/components/elements/steps/index.d.ts +38 -1
- package/dist/components/elements/steps/index.html.cjs +1 -1
- package/dist/components/elements/steps/index.html.js +1 -1
- package/dist/components/elements/steps/index.js +1 -1
- package/dist/components/elements/steps/style.css.cjs +1 -1
- package/dist/components/elements/steps/style.css.js +1 -1
- package/dist/components/elements/switch/index.cjs +1 -1
- package/dist/components/elements/switch/index.d.ts +6 -1
- package/dist/components/elements/switch/index.js +1 -1
- package/dist/runtime/component/base-element.cjs +1 -1
- package/dist/runtime/component/base-element.js +1 -1
- package/dist/runtime/component/decorators.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../shared/gen-function.cjs"),o=require("../../shared/env.cjs"),c=require("../../types/ast.cjs"),
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../shared/gen-function.cjs"),o=require("../../shared/env.cjs"),c=require("../../types/ast.cjs"),l=require("../../types/lifecycle.cjs"),i=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},r=new class{constructor(){t(this,"compilers",new Map)}get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new a,this.compilers.set(e,t)),t}clear(e){var t;if(e)null==(t=this.compilers.get(e))||t.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class a{constructor(){t(this,"cache",new Map),t(this,"functions",[])}makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>Object.keys(e).sort().join(",")).join(";")}`}compile(e,t,c){const l=null==t?void 0:t.trim();if(!l)return 0;const i=this.makeCacheKey(e,l,c),s=this.cache.get(i);if(void 0!==s)return s;let r;try{r=n.genFunction(l,e,c)}catch(u){o.IS_DEV&&console.error(`[IR Compile Error] Type: ${e}, Expr: "${l}"`,u),r=()=>""}const a=this.functions.push(r);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function u(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:l.isLifecycleKind(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function f(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function d(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n="$data."+t.value.replace("this.","").replace("$data.",""),o=t.loc,c=(e.tag||"").toLowerCase(),l=e.attrs.find(e=>"type"===e.key),i=(null==l?void 0:l.value)??"text";e.attrs=e.attrs.filter(e=>e!==t);const r=(t,n,c)=>{var l;null==(l=e.attrs)||l.push({key:t,value:n,role:c,loc:o})};if("input"===c){if("checkbox"===i){const t=e.attrs.find(e=>"value"===e.key),o=t?JSON.stringify(t.value):'"on"';return r(":checked",`Array.isArray(${n}) ? ${n}.includes(${o}) : ${n}`),void r("@change",`\n const _v = ${o};\n if(Array.isArray(${n})) {\n const _i = ${n}.indexOf(_v);\n if(checked && _i === -1) ${n}.push(_v);\n else if(!checked && _i > -1) ${n}.splice(_i,1);\n } else {\n ${n} = checked;\n }`,"model")}if("radio"===i){const t=e.attrs.find(e=>"value"===e.key),o=(null==t?void 0:t.value)??"null";return r(":checked",`${n} == ${JSON.stringify(o)}`),void r("@change",`if (checked) ${n} = ${JSON.stringify(o)}`,"model")}return r(":value",n),void r("@input",`${n} = value`,"model")}if("textarea"===c)return r(":value",n),void r("@input",`${n} = value`,"model");if("select"===c)return void(e.attrs.some(e=>"multiple"===e.key)?(r("updated",`\n const values = Array.isArray(${n}) ? ${n} : ${n} != null ? [${n}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`),r("@change",`${n} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(r(":value",n),r("@change",`${n} = value`,"model")));const a=s[c],u=(null==a?void 0:a.prop)??"value",f=(null==a?void 0:a.event)??"change";r(`:${u}`,n),r(`@${f}`,`${n} = ${"checked"===u?"checked":"value"===u?"value":`event.target.${u}`}`,"model")}function p(e,t,n,o=null){if(!e.attrs||0===e.attrs.length)return[];const c=[];for(const l of e.attrs){if(o&&o.has(l.key))continue;const{key:i,value:s,role:r}=l,{isDynamic:a,type:d}=u(i);if(a&&d){const o={k:i,f:n.compile(d,s??"",t),d:1,r:r};f(o,s,l.loc??e.loc),c.push(o)}else c.push({k:i,v:s,d:0,r:r})}return c}function h(e){if(1===e.d)return!1;if(e.c&&e.c.length>0)for(const t of e.c)if(!h(t))return!1;if(e.b&&e.b.length>0)for(const t of e.b)if(t.c&&t.c.length>0)for(const e of t.c)if(!h(e))return!1;return!0}function y(e){if(e.c&&e.c.length>0)for(const t of e.c)y(t);if(e.b&&e.b.length>0)for(const t of e.b)if(t.c&&t.c.length>0)for(const e of t.c)y(e);e.t!==c.ASTType.Element&&e.t!==c.ASTType.Text||0===e.d&&h(e)&&(e.s=1)}function v(e,t,n){var l,s,r,a,h,y;const v={t:e.type,d:0};let g=!1;var T;switch(e.type===c.ASTType.Text?(T=e.content)&&i.test(T)&&(g=!0):((null==(l=e.attrs)?void 0:l.some(e=>"s-model"===e.key||u(e.key).isDynamic))&&(g=!0),e.type===c.ASTType.For&&(g=!0)),v.d=g?1:0,e.type){case c.ASTType.Text:{const o=e.content??"";g?(v.f=n.compile("template",o,t),f(v,o,e.loc)):v.x=o;break}case c.ASTType.Element:v.g=e.tag,d(e),v.a=p(e,t,n),e.children&&(v.c=m(e.children,t,n));break;case c.ASTType.For:{const o=null==(s=e.attrs)?void 0:s.find(e=>"each"===e.key),c=(null==o?void 0:o.value)??"";v.f=n.compile("expression",c,t),v.i=(null==(a=null==(r=e.attrs)?void 0:r.find(e=>"item"===e.key))?void 0:a.value)??"item",v.n=(null==(y=null==(h=e.attrs)?void 0:h.find(e=>"index"===e.key))?void 0:y.value)??"index",f(v,c,(null==o?void 0:o.loc)??e.loc);const l=new Set(["each","item","index"]);v.a=p(e,t,n,l);const i=[...t,{i:v.i,x:v.n}];e.children&&(v.c=m(e.children,i,n));break}case c.ASTType.If:case c.ASTType.ElseIf:case c.ASTType.Else:o.IS_DEV&&console.warn(`[IR] Orphaned conditional node found: ${c.ASTType[e.type]}`),v.a=p(e,t,n),e.children&&(v.c=m(e.children,t,n));break;case c.ASTType.Comment:v.x=e.content??""}return v}function m(e,t,n){var o;const l=[];let i=0;for(;i<e.length;){const s=e[i];if(s.type===c.ASTType.If){const r=[];let a=i;for(;a<e.length;){const l=e[a],i=l.type;if(i!==c.ASTType.If&&i!==c.ASTType.ElseIf&&i!==c.ASTType.Else)break;if(i===c.ASTType.If&&r.length>0)break;let s,u=null,f="";if(i!==c.ASTType.Else){const e=null==(o=l.attrs)?void 0:o.find(e=>"test"===e.key||"condition"===e.key);f=(null==e?void 0:e.value)??"false",u=n.compile("expression",f,t),s=(null==e?void 0:e.loc)??l.loc}const d=l.children?m(l.children,t,n):[],h=p(l,t,n,new Set(["test","condition"]));if(r.push({f:u,c:d,a:h.length>0?h:void 0,__m:{expr:f,loc:s}}),a++,i===c.ASTType.Else)break}l.push({t:c.ASTType.Conditional,d:1,b:r,__m:{loc:s.loc}}),i=a}else l.push(v(s,t,n)),i++}return l}exports.buildIR=function(e,t={}){const{filename:n="anonymous",source:c}=t,l=r.get(n);l.clear();const i=performance.now(),s=m(e,[],l);for(const o of s)y(o);const a=performance.now(),u=l.getStats(),f=s.filter(e=>1===e.d).length,d=s.filter(e=>1===e.s).length,p={t:"root",v:"1.2.0",fns:l.getFunctions(),n:s,s:{tf:u.total,cf:u.cached,dn:f,tn:s.length,sn:d},m:{t:(new Date).toISOString(),as:e.length,fn:n,...c&&{src:c}}};return o.IS_DEV&&console.info(`[Solely] Compiled <${n}> in ${(a-i).toFixed(2)}ms | Nodes: ${s.length} | Fns: ${u.total} | StaticSubtrees: ${d}`),p},exports.clearIRCache=function(e){r.clear(e)},exports.transformModel=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);import{genFunction as n}from"../../shared/gen-function.js";import{IS_DEV as o}from"../../shared/env.js";import{ASTType as c}from"../../types/ast.js";import{isLifecycleKind as
|
|
1
|
+
var e=Object.defineProperty,t=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);import{genFunction as n}from"../../shared/gen-function.js";import{IS_DEV as o}from"../../shared/env.js";import{ASTType as c}from"../../types/ast.js";import{isLifecycleKind as l}from"../../types/lifecycle.js";const i=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},r=new class{constructor(){t(this,"compilers",new Map)}get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new a,this.compilers.set(e,t)),t}clear(e){var t;if(e)null==(t=this.compilers.get(e))||t.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class a{constructor(){t(this,"cache",new Map),t(this,"functions",[])}makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>Object.keys(e).sort().join(",")).join(";")}`}compile(e,t,c){const l=null==t?void 0:t.trim();if(!l)return 0;const i=this.makeCacheKey(e,l,c),s=this.cache.get(i);if(void 0!==s)return s;let r;try{r=n(l,e,c)}catch(u){o&&console.error(`[IR Compile Error] Type: ${e}, Expr: "${l}"`,u),r=()=>""}const a=this.functions.push(r);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function u(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:l(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function f(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function d(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n="$data."+t.value.replace("this.","").replace("$data.",""),o=t.loc,c=(e.tag||"").toLowerCase(),l=e.attrs.find(e=>"type"===e.key),i=(null==l?void 0:l.value)??"text";e.attrs=e.attrs.filter(e=>e!==t);const r=(t,n,c)=>{var l;null==(l=e.attrs)||l.push({key:t,value:n,role:c,loc:o})};if("input"===c){if("checkbox"===i){const t=e.attrs.find(e=>"value"===e.key),o=t?JSON.stringify(t.value):'"on"';return r(":checked",`Array.isArray(${n}) ? ${n}.includes(${o}) : ${n}`),void r("@change",`\n const _v = ${o};\n if(Array.isArray(${n})) {\n const _i = ${n}.indexOf(_v);\n if(checked && _i === -1) ${n}.push(_v);\n else if(!checked && _i > -1) ${n}.splice(_i,1);\n } else {\n ${n} = checked;\n }`,"model")}if("radio"===i){const t=e.attrs.find(e=>"value"===e.key),o=(null==t?void 0:t.value)??"null";return r(":checked",`${n} == ${JSON.stringify(o)}`),void r("@change",`if (checked) ${n} = ${JSON.stringify(o)}`,"model")}return r(":value",n),void r("@input",`${n} = value`,"model")}if("textarea"===c)return r(":value",n),void r("@input",`${n} = value`,"model");if("select"===c)return void(e.attrs.some(e=>"multiple"===e.key)?(r("updated",`\n const values = Array.isArray(${n}) ? ${n} : ${n} != null ? [${n}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`),r("@change",`${n} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(r(":value",n),r("@change",`${n} = value`,"model")));const a=s[c],u=(null==a?void 0:a.prop)??"value",f=(null==a?void 0:a.event)??"change";r(`:${u}`,n),r(`@${f}`,`${n} = ${"checked"===u?"checked":"value"===u?"value":`event.target.${u}`}`,"model")}function h(e,t,n,o=null){if(!e.attrs||0===e.attrs.length)return[];const c=[];for(const l of e.attrs){if(o&&o.has(l.key))continue;const{key:i,value:s,role:r}=l,{isDynamic:a,type:d}=u(i);if(a&&d){const o={k:i,f:n.compile(d,s??"",t),d:1,r:r};f(o,s,l.loc??e.loc),c.push(o)}else c.push({k:i,v:s,d:0,r:r})}return c}function p(e){if(1===e.d)return!1;if(e.c&&e.c.length>0)for(const t of e.c)if(!p(t))return!1;if(e.b&&e.b.length>0)for(const t of e.b)if(t.c&&t.c.length>0)for(const e of t.c)if(!p(e))return!1;return!0}function v(e){if(e.c&&e.c.length>0)for(const t of e.c)v(t);if(e.b&&e.b.length>0)for(const t of e.b)if(t.c&&t.c.length>0)for(const e of t.c)v(e);e.t!==c.Element&&e.t!==c.Text||0===e.d&&p(e)&&(e.s=1)}function m(e,t,n){var l,s,r,a,p,v;const m={t:e.type,d:0};let g=!1;var $;switch(e.type===c.Text?($=e.content)&&i.test($)&&(g=!0):((null==(l=e.attrs)?void 0:l.some(e=>"s-model"===e.key||u(e.key).isDynamic))&&(g=!0),e.type===c.For&&(g=!0)),m.d=g?1:0,e.type){case c.Text:{const o=e.content??"";g?(m.f=n.compile("template",o,t),f(m,o,e.loc)):m.x=o;break}case c.Element:m.g=e.tag,d(e),m.a=h(e,t,n),e.children&&(m.c=y(e.children,t,n));break;case c.For:{const o=null==(s=e.attrs)?void 0:s.find(e=>"each"===e.key),c=(null==o?void 0:o.value)??"";m.f=n.compile("expression",c,t),m.i=(null==(a=null==(r=e.attrs)?void 0:r.find(e=>"item"===e.key))?void 0:a.value)??"item",m.n=(null==(v=null==(p=e.attrs)?void 0:p.find(e=>"index"===e.key))?void 0:v.value)??"index",f(m,c,(null==o?void 0:o.loc)??e.loc);const l=new Set(["each","item","index"]);m.a=h(e,t,n,l);const i=[...t,{i:m.i,x:m.n}];e.children&&(m.c=y(e.children,i,n));break}case c.If:case c.ElseIf:case c.Else:o&&console.warn(`[IR] Orphaned conditional node found: ${c[e.type]}`),m.a=h(e,t,n),e.children&&(m.c=y(e.children,t,n));break;case c.Comment:m.x=e.content??""}return m}function y(e,t,n){var o;const l=[];let i=0;for(;i<e.length;){const s=e[i];if(s.type===c.If){const r=[];let a=i;for(;a<e.length;){const l=e[a],i=l.type;if(i!==c.If&&i!==c.ElseIf&&i!==c.Else)break;if(i===c.If&&r.length>0)break;let s,u=null,f="";if(i!==c.Else){const e=null==(o=l.attrs)?void 0:o.find(e=>"test"===e.key||"condition"===e.key);f=(null==e?void 0:e.value)??"false",u=n.compile("expression",f,t),s=(null==e?void 0:e.loc)??l.loc}const d=l.children?y(l.children,t,n):[],p=h(l,t,n,new Set(["test","condition"]));if(r.push({f:u,c:d,a:p.length>0?p:void 0,__m:{expr:f,loc:s}}),a++,i===c.Else)break}l.push({t:c.Conditional,d:1,b:r,__m:{loc:s.loc}}),i=a}else l.push(m(s,t,n)),i++}return l}function g(e,t={}){const{filename:n="anonymous",source:c}=t,l=r.get(n);l.clear();const i=performance.now(),s=y(e,[],l);for(const o of s)v(o);const a=performance.now(),u=l.getStats(),f=s.filter(e=>1===e.d).length,d=s.filter(e=>1===e.s).length,h={t:"root",v:"1.2.0",fns:l.getFunctions(),n:s,s:{tf:u.total,cf:u.cached,dn:f,tn:s.length,sn:d},m:{t:(new Date).toISOString(),as:e.length,fn:n,...c&&{src:c}}};return o&&console.info(`[Solely] Compiled <${n}> in ${(a-i).toFixed(2)}ms | Nodes: ${s.length} | Fns: ${u.total} | StaticSubtrees: ${d}`),h}function $(e){r.clear(e)}export{g as buildIR,$ as clearIRCache,d as transformModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyCheckbox=class extends a.default{getCheckboxClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["checkbox--sm"]=!0:"large"===t?e["checkbox--lg"]=!0:e["checkbox--md"]=!0,e[`checkbox--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-indeterminate"]=!!this.$data.indeterminate,e["is-disabled"]=!!this.$data.disabled,e["checkbox--block"]=!!this.$data.block,e}handleClick(e){this.$data.disabled||(this.toggle(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleKeyDown(e){this.$data.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))}toggle(){if(this.$data.disabled)return;const e=!this.$data.checked;this.$data.checked=e,this.$data.indeterminate&&(this.$data.indeterminate=!1),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e,this.$data.indeterminate=!1}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}setIndeterminate(e){this.$data.indeterminate=e}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}},exports.SolelyCheckbox=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-checkbox",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"indeterminate",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"block",type:"boolean",default:!1},{name:"name",type:"string",default:""}]})],exports.SolelyCheckbox);
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyCheckbox=class extends a.default{getCheckboxClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["checkbox--sm"]=!0:"large"===t?e["checkbox--lg"]=!0:e["checkbox--md"]=!0,e[`checkbox--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-indeterminate"]=!!this.$data.indeterminate,e["is-disabled"]=!!this.$data.disabled,e["checkbox--block"]=!!this.$data.block,e}handleClick(e){this.$data.disabled||(this.toggle(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleKeyDown(e){this.$data.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))}toggle(){if(this.$data.disabled)return;const e=!this.$data.checked;this.$data.checked=e,this.$data.indeterminate&&(this.$data.indeterminate=!1),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e,this.$data.indeterminate=!1}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}setIndeterminate(e){this.$data.indeterminate=e}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}},exports.SolelyCheckbox=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-checkbox",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"indeterminate",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"block",type:"boolean",default:!1},{name:"name",type:"string",default:""}],model:{prop:"checked",event:"change"}})],exports.SolelyCheckbox);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{getCheckboxClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["checkbox--sm"]=!0:"large"===t?e["checkbox--lg"]=!0:e["checkbox--md"]=!0,e[`checkbox--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-indeterminate"]=!!this.$data.indeterminate,e["is-disabled"]=!!this.$data.disabled,e["checkbox--block"]=!!this.$data.block,e}handleClick(e){this.$data.disabled||(this.toggle(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleKeyDown(e){this.$data.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))}toggle(){if(this.$data.disabled)return;const e=!this.$data.checked;this.$data.checked=e,this.$data.indeterminate&&(this.$data.indeterminate=!1),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e,this.$data.indeterminate=!1}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}setIndeterminate(e){this.$data.indeterminate=e}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-checkbox",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"indeterminate",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"block",type:"boolean",default:!1},{name:"name",type:"string",default:""}]})],d);export{d as SolelyCheckbox};
|
|
1
|
+
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{getCheckboxClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["checkbox--sm"]=!0:"large"===t?e["checkbox--lg"]=!0:e["checkbox--md"]=!0,e[`checkbox--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-indeterminate"]=!!this.$data.indeterminate,e["is-disabled"]=!!this.$data.disabled,e["checkbox--block"]=!!this.$data.block,e}handleClick(e){this.$data.disabled||(this.toggle(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleKeyDown(e){this.$data.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))}toggle(){if(this.$data.disabled)return;const e=!this.$data.checked;this.$data.checked=e,this.$data.indeterminate&&(this.$data.indeterminate=!1),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e,this.$data.indeterminate=!1}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}setIndeterminate(e){this.$data.indeterminate=e}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".checkbox");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-checkbox",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"indeterminate",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"block",type:"boolean",default:!1},{name:"name",type:"string",default:""}],model:{prop:"checked",event:"change"}})],d);export{d as SolelyCheckbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=':host{display:contents}.fab,.fab:before,.fab:after{box-sizing:border-box}.fab{position:fixed;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;box-shadow:0 4px 12px #00000026;transition:all .3s cubic-bezier(.4,0,.2,1);z-index:var(--solely-z-index-fixed);outline:none;padding:0}.fab--absolute{position:absolute}.fab:hover{box-shadow:0 6px 20px #0003;transform:var(--fab-position-transform, none) scale(1.05)}.fab:active{transform:var(--fab-position-transform, none) scale(.95)}.fab:disabled{opacity:.6;cursor:not-allowed;box-shadow:0 2px 8px #0000001a}.fab:disabled:hover{transform:var(--fab-position-transform, none)}.fab__icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.fab__icon svg{width:60%;height:60%}.fab--sm{width:40px;height:40px}.fab--sm .fab__icon{font-size:16px}.fab--md{width:56px;height:56px}.fab--md .fab__icon{font-size:24px}.fab--lg{width:72px;height:72px}.fab--lg .fab__icon{font-size:32px}.fab--circle{border-radius:50%}.fab--square{border-radius:8px}.fab--rounded{border-radius:16px}.fab--primary{background:linear-gradient(135deg,var(--solely-primary) 0%,var(--solely-primary-hover) 100%);color:#fff}.fab--primary:hover{background:linear-gradient(135deg,var(--solely-primary-hover) 0%,var(--solely-primary-active) 100%)}.fab--secondary{background:linear-gradient(135deg,var(--solely-secondary) 0%,var(--solely-secondary-hover) 100%);color:#fff}.fab--secondary:hover{background:linear-gradient(135deg,var(--solely-secondary-hover) 0%,var(--solely-secondary-active) 100%)}.fab--success{background:linear-gradient(135deg,var(--solely-success) 0%,var(--solely-success-hover) 100%);color:#fff}.fab--success:hover{background:linear-gradient(135deg,var(--solely-success-hover) 0%,var(--solely-success-active) 100%)}.fab--warning{background:linear-gradient(135deg,var(--solely-warning) 0%,var(--solely-warning-hover) 100%);color:#fff}.fab--warning:hover{background:linear-gradient(135deg,var(--solely-warning-hover) 0%,var(--solely-warning-active) 100%)}.fab--error{background:linear-gradient(135deg,var(--solely-error) 0%,var(--solely-error-hover) 100%);color:#fff}.fab--error:hover{background:linear-gradient(135deg,var(--solely-error-hover) 0%,var(--solely-error-active) 100%)}.fab--default{background:var(--solely-component-bg);color:var(--solely-text-primary);border:1px solid var(--solely-border-color)}.fab--default:hover{color:var(--solely-primary);border-color:var(--solely-primary)}.fab--top-left{top:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--top-center{top:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--top-right{top:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--left-center{left:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--center{left:50%;top:50%;--fab-position-transform: translate(-50%, -50%);transform:translate(-50%,-50%)}.fab--right-center{right:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--bottom-left{bottom:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--bottom-center{bottom:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--bottom-right{bottom:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--hidden{opacity:0;pointer-events:none}.fab:after{content:"";position:absolute;top:50%;left:50%;width:0;height:0;background:var(--solely-component-bg);opacity:.3;border-radius:50%;transform:translate(-50%,-50%);transition:width .6s,height .6s}.fab:active:after{width:200%;height:200%}';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=':host{display:contents}.fab,.fab:before,.fab:after{box-sizing:border-box}.fab{position:fixed;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;box-shadow:0 4px 12px #00000026;transition:all .3s cubic-bezier(.4,0,.2,1);z-index:var(--solely-z-index-fixed);outline:none;padding:0}.fab--absolute{position:absolute}.fab:hover{box-shadow:0 6px 20px #0003;transform:var(--fab-position-transform, none) scale(1.05)}.fab:active{transform:var(--fab-position-transform, none) scale(.95)}.fab:disabled{opacity:.6;cursor:not-allowed;box-shadow:0 2px 8px #0000001a}.fab:disabled:hover{transform:var(--fab-position-transform, none)}.fab__icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.fab__icon svg{width:60%;height:60%}.fab--sm{width:40px;height:40px}.fab--sm .fab__icon{font-size:16px}.fab--md{width:56px;height:56px}.fab--md .fab__icon{font-size:24px}.fab--lg{width:72px;height:72px}.fab--lg .fab__icon{font-size:32px}.fab--circle{border-radius:50%}.fab--square{border-radius:8px}.fab--rounded{border-radius:16px}.fab--primary{background:linear-gradient(135deg,var(--solely-primary) 0%,var(--solely-primary-hover) 100%);color:#fff}.fab--primary:hover{background:linear-gradient(135deg,var(--solely-primary-hover) 0%,var(--solely-primary-active) 100%)}.fab--secondary{background:linear-gradient(135deg,var(--solely-secondary) 0%,var(--solely-secondary-hover) 100%);color:#fff}.fab--secondary:hover{background:linear-gradient(135deg,var(--solely-secondary-hover) 0%,var(--solely-secondary-active) 100%)}.fab--success{background:linear-gradient(135deg,var(--solely-success) 0%,var(--solely-success-hover) 100%);color:#fff}.fab--success:hover{background:linear-gradient(135deg,var(--solely-success-hover) 0%,var(--solely-success-active) 100%)}.fab--warning{background:linear-gradient(135deg,var(--solely-warning) 0%,var(--solely-warning-hover) 100%);color:#fff}.fab--warning:hover{background:linear-gradient(135deg,var(--solely-warning-hover) 0%,var(--solely-warning-active) 100%)}.fab--error{background:linear-gradient(135deg,var(--solely-error) 0%,var(--solely-error-hover) 100%);color:#fff}.fab--error:hover{background:linear-gradient(135deg,var(--solely-error-hover) 0%,var(--solely-error-active) 100%)}.fab--default{background:var(--solely-component-bg);color:var(--solely-text-primary);border:1px solid var(--solely-border-color)}.fab--default:hover{color:var(--solely-primary);border-color:var(--solely-primary)}.fab--top-left{top:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--top-center{top:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--top-right{top:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--left-center{left:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--center{left:50%;top:50%;--fab-position-transform: translate(-50%, -50%);transform:translate(-50%,-50%)}.fab--right-center{right:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--bottom-left{bottom:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--bottom-center{bottom:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--bottom-right{bottom:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--hidden{opacity:0;pointer-events:none}.fab:after{content:"";position:absolute;top:50%;left:50%;width:0;height:0;background:var(--solely-component-bg);opacity:.3;border-radius:50%;transform:translate(-50%,-50%);transition:width .6s,height .6s}.fab:active:after{width:200%;height:200%}.fab__icon ::slotted(*){display:inline-flex;align-items:center;justify-content:center}';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r=':host{display:contents}.fab,.fab:before,.fab:after{box-sizing:border-box}.fab{position:fixed;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;box-shadow:0 4px 12px #00000026;transition:all .3s cubic-bezier(.4,0,.2,1);z-index:var(--solely-z-index-fixed);outline:none;padding:0}.fab--absolute{position:absolute}.fab:hover{box-shadow:0 6px 20px #0003;transform:var(--fab-position-transform, none) scale(1.05)}.fab:active{transform:var(--fab-position-transform, none) scale(.95)}.fab:disabled{opacity:.6;cursor:not-allowed;box-shadow:0 2px 8px #0000001a}.fab:disabled:hover{transform:var(--fab-position-transform, none)}.fab__icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.fab__icon svg{width:60%;height:60%}.fab--sm{width:40px;height:40px}.fab--sm .fab__icon{font-size:16px}.fab--md{width:56px;height:56px}.fab--md .fab__icon{font-size:24px}.fab--lg{width:72px;height:72px}.fab--lg .fab__icon{font-size:32px}.fab--circle{border-radius:50%}.fab--square{border-radius:8px}.fab--rounded{border-radius:16px}.fab--primary{background:linear-gradient(135deg,var(--solely-primary) 0%,var(--solely-primary-hover) 100%);color:#fff}.fab--primary:hover{background:linear-gradient(135deg,var(--solely-primary-hover) 0%,var(--solely-primary-active) 100%)}.fab--secondary{background:linear-gradient(135deg,var(--solely-secondary) 0%,var(--solely-secondary-hover) 100%);color:#fff}.fab--secondary:hover{background:linear-gradient(135deg,var(--solely-secondary-hover) 0%,var(--solely-secondary-active) 100%)}.fab--success{background:linear-gradient(135deg,var(--solely-success) 0%,var(--solely-success-hover) 100%);color:#fff}.fab--success:hover{background:linear-gradient(135deg,var(--solely-success-hover) 0%,var(--solely-success-active) 100%)}.fab--warning{background:linear-gradient(135deg,var(--solely-warning) 0%,var(--solely-warning-hover) 100%);color:#fff}.fab--warning:hover{background:linear-gradient(135deg,var(--solely-warning-hover) 0%,var(--solely-warning-active) 100%)}.fab--error{background:linear-gradient(135deg,var(--solely-error) 0%,var(--solely-error-hover) 100%);color:#fff}.fab--error:hover{background:linear-gradient(135deg,var(--solely-error-hover) 0%,var(--solely-error-active) 100%)}.fab--default{background:var(--solely-component-bg);color:var(--solely-text-primary);border:1px solid var(--solely-border-color)}.fab--default:hover{color:var(--solely-primary);border-color:var(--solely-primary)}.fab--top-left{top:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--top-center{top:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--top-right{top:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--left-center{left:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--center{left:50%;top:50%;--fab-position-transform: translate(-50%, -50%);transform:translate(-50%,-50%)}.fab--right-center{right:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--bottom-left{bottom:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--bottom-center{bottom:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--bottom-right{bottom:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--hidden{opacity:0;pointer-events:none}.fab:after{content:"";position:absolute;top:50%;left:50%;width:0;height:0;background:var(--solely-component-bg);opacity:.3;border-radius:50%;transform:translate(-50%,-50%);transition:width .6s,height .6s}.fab:active:after{width:200%;height:200%}';export{r as default};
|
|
1
|
+
const r=':host{display:contents}.fab,.fab:before,.fab:after{box-sizing:border-box}.fab{position:fixed;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;box-shadow:0 4px 12px #00000026;transition:all .3s cubic-bezier(.4,0,.2,1);z-index:var(--solely-z-index-fixed);outline:none;padding:0}.fab--absolute{position:absolute}.fab:hover{box-shadow:0 6px 20px #0003;transform:var(--fab-position-transform, none) scale(1.05)}.fab:active{transform:var(--fab-position-transform, none) scale(.95)}.fab:disabled{opacity:.6;cursor:not-allowed;box-shadow:0 2px 8px #0000001a}.fab:disabled:hover{transform:var(--fab-position-transform, none)}.fab__icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.fab__icon svg{width:60%;height:60%}.fab--sm{width:40px;height:40px}.fab--sm .fab__icon{font-size:16px}.fab--md{width:56px;height:56px}.fab--md .fab__icon{font-size:24px}.fab--lg{width:72px;height:72px}.fab--lg .fab__icon{font-size:32px}.fab--circle{border-radius:50%}.fab--square{border-radius:8px}.fab--rounded{border-radius:16px}.fab--primary{background:linear-gradient(135deg,var(--solely-primary) 0%,var(--solely-primary-hover) 100%);color:#fff}.fab--primary:hover{background:linear-gradient(135deg,var(--solely-primary-hover) 0%,var(--solely-primary-active) 100%)}.fab--secondary{background:linear-gradient(135deg,var(--solely-secondary) 0%,var(--solely-secondary-hover) 100%);color:#fff}.fab--secondary:hover{background:linear-gradient(135deg,var(--solely-secondary-hover) 0%,var(--solely-secondary-active) 100%)}.fab--success{background:linear-gradient(135deg,var(--solely-success) 0%,var(--solely-success-hover) 100%);color:#fff}.fab--success:hover{background:linear-gradient(135deg,var(--solely-success-hover) 0%,var(--solely-success-active) 100%)}.fab--warning{background:linear-gradient(135deg,var(--solely-warning) 0%,var(--solely-warning-hover) 100%);color:#fff}.fab--warning:hover{background:linear-gradient(135deg,var(--solely-warning-hover) 0%,var(--solely-warning-active) 100%)}.fab--error{background:linear-gradient(135deg,var(--solely-error) 0%,var(--solely-error-hover) 100%);color:#fff}.fab--error:hover{background:linear-gradient(135deg,var(--solely-error-hover) 0%,var(--solely-error-active) 100%)}.fab--default{background:var(--solely-component-bg);color:var(--solely-text-primary);border:1px solid var(--solely-border-color)}.fab--default:hover{color:var(--solely-primary);border-color:var(--solely-primary)}.fab--top-left{top:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--top-center{top:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--top-right{top:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--left-center{left:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--center{left:50%;top:50%;--fab-position-transform: translate(-50%, -50%);transform:translate(-50%,-50%)}.fab--right-center{right:var(--fab-offset-x, 24px);top:50%;--fab-position-transform: translateY(-50%);transform:translateY(-50%)}.fab--bottom-left{bottom:var(--fab-offset-y, 24px);left:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--bottom-center{bottom:var(--fab-offset-y, 24px);left:50%;--fab-position-transform: translateX(-50%);transform:translate(-50%)}.fab--bottom-right{bottom:var(--fab-offset-y, 24px);right:var(--fab-offset-x, 24px);--fab-position-transform: none}.fab--hidden{opacity:0;pointer-events:none}.fab:after{content:"";position:absolute;top:50%;left:50%;width:0;height:0;background:var(--solely-component-bg);opacity:.3;border-radius:50%;transform:translate(-50%,-50%);transition:width .6s,height .6s}.fab:active:after{width:200%;height:200%}.fab__icon ::slotted(*){display:inline-flex;align-items:center;justify-content:center}';export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),l=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyInput=class extends r.default{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}},exports.SolelyInput=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([l.CustomElement({tagName:"solely-input",template:s.default,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],exports.SolelyInput);
|
|
@@ -15,6 +15,14 @@ declare class SolelyInput extends BaseElement<InputProps, InputRefs> {
|
|
|
15
15
|
* 组件挂载后
|
|
16
16
|
*/
|
|
17
17
|
mounted(): void;
|
|
18
|
+
/**
|
|
19
|
+
* 检查是否有 prefix 插槽
|
|
20
|
+
*/
|
|
21
|
+
hasPrefixSlot(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 检查是否有 suffix 插槽
|
|
24
|
+
*/
|
|
25
|
+
hasSuffixSlot(): boolean;
|
|
18
26
|
protected afterMount(): void;
|
|
19
27
|
/**
|
|
20
28
|
* 获取 wrapper class 对象
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="form-control"\n :class="this.getWrapperClasses()"\n>\n <If test="$data.prefix">\n <span class="form-control__prefix">{{$data.prefix}}</span>\n </
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="form-control"\n :class="this.getWrapperClasses()"\n>\n \x3c!-- prefix 插槽 --\x3e\n <If test="this.hasPrefixSlot()">\n <span class="form-control__prefix">\n <slot name="prefix"></slot>\n </span>\n </If>\n <ElseIf test="$data.prefix">\n <span class="form-control__prefix">{{$data.prefix}}</span>\n </ElseIf>\n\n <If test="$data.type === \'textarea\'">\n <textarea\n class="form-control__input form-control__textarea"\n :value="$data.value"\n :placeholder="$data.placeholder"\n :disabled="$data.disabled"\n :readonly="$data.readonly"\n :maxlength="$data.maxlength"\n :minlength="$data.minlength"\n :rows="$data.rows"\n @input="this.handleInput(event)"\n @focus="this.handleFocus(event)"\n @blur="this.handleBlur(event)"\n @change="this.handleChange(event)"\n @keydown="this.handleKeydown(event)"\n ></textarea>\n </If>\n <Else>\n <input\n class="form-control__input"\n :type="$data.passwordVisible && $data.type === \'password\' ? \'text\' : $data.type"\n :value="$data.value"\n :placeholder="$data.placeholder"\n :disabled="$data.disabled"\n :readonly="$data.readonly"\n :maxlength="$data.maxlength"\n :minlength="$data.minlength"\n @input="this.handleInput(event)"\n @focus="this.handleFocus(event)"\n @blur="this.handleBlur(event)"\n @change="this.handleChange(event)"\n @keydown="this.handleKeydown(event)"\n />\n </Else>\n\n <If test="$data.clearable && $data.value && !$data.disabled">\n <span\n class="close-btn form-control__clear"\n @click="this.handleClear(event)"\n >×</span>\n </If>\n <ElseIf test="$data.type === \'password\' && $data.showpassword">\n <span\n class="form-control__password-toggle"\n @click="this.togglePassword(event)"\n >{{$data.passwordVisible ? \'🙈\' : \'👁\'}}</span>\n </ElseIf>\n <ElseIf test="$data.copyable && $data.value">\n <span\n class="form-control__copy"\n @click="this.handleCopy(event)"\n >📋</span>\n </ElseIf>\n <ElseIf test="this.hasSuffixSlot()">\n <span class="form-control__suffix">\n <slot name="suffix"></slot>\n </span>\n </ElseIf>\n <ElseIf test="$data.suffix">\n <span class="form-control__suffix">{{$data.suffix}}</span>\n </ElseIf>\n\n <If test="$data.suggestions && $data.suggestions.length > 0 && this.filteredSuggestions && this.filteredSuggestions.length > 0">\n <div class="dropdown">\n <For each="this.filteredSuggestions" item="suggestion">\n <div\n class="dropdown__item"\n @click="this.selectSuggestion(suggestion)"\n >{{suggestion}}</div>\n </For>\n </div>\n </If>\n</div>\n\n<If test="$data.showcount && $data.maxlength">\n <div class="form-control__count">\n <span class="form-control__count-current">{{this.getCharCount()}}</span>\n <span class="form-control__count-separator">/</span>\n <span class="form-control__count-max">{{$data.maxlength}}</span>\n </div>\n</If>\n\n<If test="$data.message">\n <div class="form-control__message form-control__message--{{$data.status || \'default\'}}">\n {{$data.message}}\n </div>\n</If>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const n='<div\n class="form-control"\n :class="this.getWrapperClasses()"\n>\n <If test="$data.prefix">\n <span class="form-control__prefix">{{$data.prefix}}</span>\n </
|
|
1
|
+
const n='<div\n class="form-control"\n :class="this.getWrapperClasses()"\n>\n \x3c!-- prefix 插槽 --\x3e\n <If test="this.hasPrefixSlot()">\n <span class="form-control__prefix">\n <slot name="prefix"></slot>\n </span>\n </If>\n <ElseIf test="$data.prefix">\n <span class="form-control__prefix">{{$data.prefix}}</span>\n </ElseIf>\n\n <If test="$data.type === \'textarea\'">\n <textarea\n class="form-control__input form-control__textarea"\n :value="$data.value"\n :placeholder="$data.placeholder"\n :disabled="$data.disabled"\n :readonly="$data.readonly"\n :maxlength="$data.maxlength"\n :minlength="$data.minlength"\n :rows="$data.rows"\n @input="this.handleInput(event)"\n @focus="this.handleFocus(event)"\n @blur="this.handleBlur(event)"\n @change="this.handleChange(event)"\n @keydown="this.handleKeydown(event)"\n ></textarea>\n </If>\n <Else>\n <input\n class="form-control__input"\n :type="$data.passwordVisible && $data.type === \'password\' ? \'text\' : $data.type"\n :value="$data.value"\n :placeholder="$data.placeholder"\n :disabled="$data.disabled"\n :readonly="$data.readonly"\n :maxlength="$data.maxlength"\n :minlength="$data.minlength"\n @input="this.handleInput(event)"\n @focus="this.handleFocus(event)"\n @blur="this.handleBlur(event)"\n @change="this.handleChange(event)"\n @keydown="this.handleKeydown(event)"\n />\n </Else>\n\n <If test="$data.clearable && $data.value && !$data.disabled">\n <span\n class="close-btn form-control__clear"\n @click="this.handleClear(event)"\n >×</span>\n </If>\n <ElseIf test="$data.type === \'password\' && $data.showpassword">\n <span\n class="form-control__password-toggle"\n @click="this.togglePassword(event)"\n >{{$data.passwordVisible ? \'🙈\' : \'👁\'}}</span>\n </ElseIf>\n <ElseIf test="$data.copyable && $data.value">\n <span\n class="form-control__copy"\n @click="this.handleCopy(event)"\n >📋</span>\n </ElseIf>\n <ElseIf test="this.hasSuffixSlot()">\n <span class="form-control__suffix">\n <slot name="suffix"></slot>\n </span>\n </ElseIf>\n <ElseIf test="$data.suffix">\n <span class="form-control__suffix">{{$data.suffix}}</span>\n </ElseIf>\n\n <If test="$data.suggestions && $data.suggestions.length > 0 && this.filteredSuggestions && this.filteredSuggestions.length > 0">\n <div class="dropdown">\n <For each="this.filteredSuggestions" item="suggestion">\n <div\n class="dropdown__item"\n @click="this.selectSuggestion(suggestion)"\n >{{suggestion}}</div>\n </For>\n </div>\n </If>\n</div>\n\n<If test="$data.showcount && $data.maxlength">\n <div class="form-control__count">\n <span class="form-control__count-current">{{this.getCharCount()}}</span>\n <span class="form-control__count-separator">/</span>\n <span class="form-control__count-max">{{$data.maxlength}}</span>\n </div>\n</If>\n\n<If test="$data.message">\n <div class="form-control__message form-control__message--{{$data.status || \'default\'}}">\n {{$data.message}}\n </div>\n</If>\n';export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.$data.autofocus&&this.focus()}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}};n=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],n);export{n as SolelyInput};
|
|
1
|
+
var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}};n=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],n);export{n as SolelyInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([hidden]){display:none!important}.form-control{display:inline-flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);position:relative;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.form-control:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.form-control--sm{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.form-control--lg{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.form-control__input{flex:1;width:100%;height:100%;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:var(--solely-text-primary);background:transparent;border:none;outline:none}.form-control__input::placeholder{color:var(--solely-text-tertiary)}.form-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([hidden]){display:none!important}.form-control{display:inline-flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);position:relative;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.form-control:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.form-control--sm{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.form-control--lg{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.form-control__input{flex:1;width:100%;height:100%;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:var(--solely-text-primary);background:transparent;border:none;outline:none}.form-control__input::placeholder{color:var(--solely-text-tertiary)}.form-control--textarea{height:auto;min-height:var(--solely-height-xl);padding:var(--solely-spacing-sm) var(--solely-spacing-md);align-items:flex-start}.form-control__textarea{resize:vertical;min-height:var(--solely-height-lg);padding:var(--solely-spacing-xs) 0}.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.is-readonly{cursor:default}.is-focused{outline:none;box-shadow:0 0 0 2px var(--solely-primary-light)}.is-error{border-color:var(--solely-error)}.is-error.is-focused{box-shadow:0 0 0 2px var(--solely-error-light)}.is-warning{border-color:var(--solely-warning)}.is-warning.is-focused{box-shadow:0 0 0 2px var(--solely-warning-light)}.is-success{border-color:var(--solely-success)}.is-success.is-focused{box-shadow:0 0 0 2px var(--solely-success-light)}.form-control__clear{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:16px}.form-control__password-toggle{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0;-webkit-user-select:none;user-select:none}.form-control__password-toggle:hover{color:var(--solely-text-secondary)}.form-control__copy{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:12px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0;-webkit-user-select:none;user-select:none}.form-control__copy:hover{color:var(--solely-text-secondary)}.form-control__count{display:flex;justify-content:flex-end;align-items:center;margin-top:var(--solely-spacing-xs);font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary);gap:2px}.form-control__count-current{color:var(--solely-text-secondary)}.form-control__count-separator,.form-control__count-max{color:var(--solely-text-tertiary)}.form-control__message{margin-top:var(--solely-spacing-xs);font-size:var(--solely-font-size-sm);line-height:var(--solely-line-height-md)}.form-control__message--error{color:var(--solely-error)}.form-control__message--warning{color:var(--solely-warning)}.form-control__message--success{color:var(--solely-success)}.form-control__message--default{color:var(--solely-text-tertiary)}.form-control--block{display:flex;width:100%}.dropdown{position:absolute;top:100%;left:0;right:0;margin-top:4px;padding:var(--solely-spacing-xs) 0;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown);max-height:200px;overflow-y:auto}.dropdown__item{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:background-color var(--solely-transition-duration)}.dropdown__item:hover{background-color:var(--solely-gray-3)}.close-btn{display:inline-flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0}.form-control__prefix,.form-control__suffix{display:inline-flex;align-items:center;color:var(--solely-text-tertiary);flex-shrink:0}.form-control__prefix{margin-right:var(--solely-spacing-xs)}.form-control__suffix{margin-left:var(--solely-spacing-xs)}.form-control__prefix ::slotted(*),.form-control__suffix ::slotted(*){display:inline-flex;align-items:center}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([hidden]){display:none!important}.form-control{display:inline-flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);position:relative;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.form-control:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.form-control--sm{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.form-control--lg{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.form-control__input{flex:1;width:100%;height:100%;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:var(--solely-text-primary);background:transparent;border:none;outline:none}.form-control__input::placeholder{color:var(--solely-text-tertiary)}.form-
|
|
1
|
+
const o="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([hidden]){display:none!important}.form-control{display:inline-flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);position:relative;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.form-control:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.form-control--sm{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.form-control--lg{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.form-control__input{flex:1;width:100%;height:100%;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:var(--solely-text-primary);background:transparent;border:none;outline:none}.form-control__input::placeholder{color:var(--solely-text-tertiary)}.form-control--textarea{height:auto;min-height:var(--solely-height-xl);padding:var(--solely-spacing-sm) var(--solely-spacing-md);align-items:flex-start}.form-control__textarea{resize:vertical;min-height:var(--solely-height-lg);padding:var(--solely-spacing-xs) 0}.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.is-readonly{cursor:default}.is-focused{outline:none;box-shadow:0 0 0 2px var(--solely-primary-light)}.is-error{border-color:var(--solely-error)}.is-error.is-focused{box-shadow:0 0 0 2px var(--solely-error-light)}.is-warning{border-color:var(--solely-warning)}.is-warning.is-focused{box-shadow:0 0 0 2px var(--solely-warning-light)}.is-success{border-color:var(--solely-success)}.is-success.is-focused{box-shadow:0 0 0 2px var(--solely-success-light)}.form-control__clear{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:16px}.form-control__password-toggle{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0;-webkit-user-select:none;user-select:none}.form-control__password-toggle:hover{color:var(--solely-text-secondary)}.form-control__copy{width:20px;height:20px;margin-left:var(--solely-spacing-xs);font-size:12px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0;-webkit-user-select:none;user-select:none}.form-control__copy:hover{color:var(--solely-text-secondary)}.form-control__count{display:flex;justify-content:flex-end;align-items:center;margin-top:var(--solely-spacing-xs);font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary);gap:2px}.form-control__count-current{color:var(--solely-text-secondary)}.form-control__count-separator,.form-control__count-max{color:var(--solely-text-tertiary)}.form-control__message{margin-top:var(--solely-spacing-xs);font-size:var(--solely-font-size-sm);line-height:var(--solely-line-height-md)}.form-control__message--error{color:var(--solely-error)}.form-control__message--warning{color:var(--solely-warning)}.form-control__message--success{color:var(--solely-success)}.form-control__message--default{color:var(--solely-text-tertiary)}.form-control--block{display:flex;width:100%}.dropdown{position:absolute;top:100%;left:0;right:0;margin-top:4px;padding:var(--solely-spacing-xs) 0;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown);max-height:200px;overflow-y:auto}.dropdown__item{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:background-color var(--solely-transition-duration)}.dropdown__item:hover{background-color:var(--solely-gray-3)}.close-btn{display:inline-flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);flex-shrink:0}.form-control__prefix,.form-control__suffix{display:inline-flex;align-items:center;color:var(--solely-text-tertiary);flex-shrink:0}.form-control__prefix{margin-right:var(--solely-spacing-xs)}.form-control__suffix{margin-left:var(--solely-spacing-xs)}.form-control__prefix ::slotted(*),.form-control__suffix ::slotted(*){display:inline-flex;align-items:center}";export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRadio=class extends a.default{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}},exports.SolelyRadio=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-radio",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}]})],exports.SolelyRadio);
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRadio=class extends a.default{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}},exports.SolelyRadio=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-radio",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],exports.SolelyRadio);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-radio",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}]})],d);export{d as SolelyRadio};
|
|
1
|
+
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-radio",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],d);export{d as SolelyRadio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),l=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySelect=class extends l.default{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver")}get value(){return this.$data.value||""}set value(t){this.$data.disabled||this.setValue(t)}getSelectClasses(){const t={};return"small"===this.$data.size?t["select--sm"]=!0:"large"===this.$data.size?t["select--lg"]=!0:t["select--md"]=!0,t["is-disabled"]=!!this.$data.disabled,t["is-focused"]=!!this.$data.focused,t["is-open"]=!!this.$data.isOpen,t["use-slot"]=this.$data.useSlot,t}getDropdownClasses(){return{"select__dropdown--closing":!!this.$data.closing,"select__dropdown--top":"top"===this.$data.dropdownPlacement,"select__dropdown--bottom":"bottom"===this.$data.dropdownPlacement}}getOptionClasses(t){return{"select__option--selected":t.value===this.$data.value,"select__option--disabled":!!t.disabled}}calculateDropdownPlacement(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,a=t.top;this.$data.dropdownPlacement=e<256&&a>e?"top":"bottom"}collectSlotOptions(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-value"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotOptions=t.map(t=>{var e;const a=t;return{value:a.getAttribute("data-value")||"",label:a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"",disabled:a.hasAttribute("disabled"),element:t}}),this.updateSelectedLabelFromSlot()):this.$data.useSlot=!1}updateSelectedLabelFromSlot(){if(!this.$data.slotOptions.length)return;const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}mounted(){this.parseOptions(),this.setupSlotObserver(),this.clickOutsideHandler=t=>{t.composedPath().some(t=>t===this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler)}setupSlotObserver(){setTimeout(()=>{this.collectSlotOptions()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotOptions()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-value","data-label","disabled"]})}unmounted(){this.clickOutsideHandler&&document.removeEventListener("click",this.clickOutsideHandler),this.slotObserver&&this.slotObserver.disconnect()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}getCurrentLabel(){if(this.$data.useSlot){const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}{const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}}parseOptions(){this.$data.parsedOptions=Array.isArray(this.$data.options)?this.$data.options:[],this.$data.useSlot||this.updateSelectedLabel()}updateSelectedLabel(){if(!this.$data.parsedOptions.length)return;const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}handleClick(){if(this.$data.disabled)return;const t=!this.$data.isOpen;this.$data.isOpen=t,this.$data.focused=t,t&&this.calculateDropdownPlacement()}handleSelect(t,e){t.disabled||(this.$data.value=t.value,this.updateSelectedLabel(),this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleSlotClick(t){var e;const a=t.target.closest("[data-value]");if(!a)return;const s=a.getAttribute("data-value")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,this.$data.selectedLabel=l,this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClear(t){t.stopPropagation(),this.$data.value="",this.$data.selectedLabel="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}closeDropdown(){this.$data.isOpen&&(this.$data.closing=!0,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},200))}setValue(t,e=!1){this.$data.value=t,this.$data.useSlot?this.updateSelectedLabelFromSlot():this.updateSelectedLabel(),e||this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getValue(){return this.$data.value||""}setOptions(t){this.$data.options=t,this.$data.useSlot=!1,this.parseOptions()}},exports.SolelySelect=((t,e)=>{for(var a,s=e,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-select",template:s.default,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:"请选择"},{name:"disabled",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"clearable",type:"boolean",default:!1},{name:"options",type:"array",default:[]},{name:"multiple",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],exports.SolelySelect);
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { BaseElement } from '../../../runtime/component';
|
|
2
|
-
import { SelectProps, SelectOption } from './types';
|
|
2
|
+
import { SelectProps, SelectOption as SelectOptionType } from './types';
|
|
3
3
|
declare class SolelySelect extends BaseElement<SelectProps & {
|
|
4
4
|
focused: boolean;
|
|
5
5
|
isOpen: boolean;
|
|
6
6
|
closing: boolean;
|
|
7
7
|
selectedLabel: string;
|
|
8
|
-
parsedOptions:
|
|
8
|
+
parsedOptions: SelectOptionType[];
|
|
9
9
|
dropdownPlacement: 'top' | 'bottom';
|
|
10
|
+
useSlot: boolean;
|
|
11
|
+
slotOptions: Array<{
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
element: Element;
|
|
16
|
+
}>;
|
|
10
17
|
}> {
|
|
11
18
|
clickOutsideHandler?: (event: MouseEvent) => void;
|
|
19
|
+
slotObserver?: MutationObserver;
|
|
12
20
|
/**
|
|
13
21
|
* 暴露 value 属性,使外部可通过 event.target.value 访问
|
|
14
22
|
*/
|
|
@@ -22,17 +30,41 @@ declare class SolelySelect extends BaseElement<SelectProps & {
|
|
|
22
30
|
* 获取 dropdown class 对象
|
|
23
31
|
*/
|
|
24
32
|
getDropdownClasses(): Record<string, boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* 获取 option class 对象
|
|
35
|
+
*/
|
|
36
|
+
getOptionClasses(option: SelectOptionType | {
|
|
37
|
+
value: string;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
}): Record<string, boolean>;
|
|
25
40
|
/**
|
|
26
41
|
* 计算下拉框位置
|
|
27
42
|
* 根据视口空间自动决定向上或向下展开
|
|
28
43
|
*/
|
|
29
44
|
calculateDropdownPlacement(): void;
|
|
30
45
|
/**
|
|
31
|
-
*
|
|
46
|
+
* 从插槽收集选项
|
|
32
47
|
*/
|
|
33
|
-
|
|
48
|
+
collectSlotOptions(): void;
|
|
49
|
+
/**
|
|
50
|
+
* 从插槽更新选中的标签
|
|
51
|
+
*/
|
|
52
|
+
updateSelectedLabelFromSlot(): void;
|
|
34
53
|
mounted(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 设置插槽观察器
|
|
56
|
+
*/
|
|
57
|
+
setupSlotObserver(): void;
|
|
35
58
|
unmounted(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 数据更新后同步显示标签
|
|
61
|
+
* 当 s-model 等外部方式修改 value 时,需要更新 selectedLabel
|
|
62
|
+
*/
|
|
63
|
+
updated(): void;
|
|
64
|
+
/**
|
|
65
|
+
* 获取当前选中值对应的标签
|
|
66
|
+
*/
|
|
67
|
+
private getCurrentLabel;
|
|
36
68
|
/**
|
|
37
69
|
* 解析选项
|
|
38
70
|
*/
|
|
@@ -46,9 +78,13 @@ declare class SolelySelect extends BaseElement<SelectProps & {
|
|
|
46
78
|
*/
|
|
47
79
|
handleClick(): void;
|
|
48
80
|
/**
|
|
49
|
-
*
|
|
81
|
+
* 选择选项(来自 options 属性)
|
|
82
|
+
*/
|
|
83
|
+
handleSelect(option: SelectOptionType, _event: Event): void;
|
|
84
|
+
/**
|
|
85
|
+
* 处理插槽选项点击
|
|
50
86
|
*/
|
|
51
|
-
|
|
87
|
+
handleSlotClick(event: Event): void;
|
|
52
88
|
/**
|
|
53
89
|
* 清除选择
|
|
54
90
|
*/
|
|
@@ -68,7 +104,7 @@ declare class SolelySelect extends BaseElement<SelectProps & {
|
|
|
68
104
|
/**
|
|
69
105
|
* 设置选项
|
|
70
106
|
*/
|
|
71
|
-
setOptions(options:
|
|
107
|
+
setOptions(options: SelectOptionType[]): void;
|
|
72
108
|
}
|
|
73
109
|
export default SolelySelect;
|
|
74
110
|
export { SolelySelect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="select" :class="this.getSelectClasses()" @click="this.handleClick(event)">\n <div class="select__selector">\n <If test="!$data.selectedLabel">\n <span class="select__placeholder">{{$data.placeholder || \'请选择\'}}</span>\n </If>\n <If test="$data.selectedLabel">\n <span class="select__value">{{$data.selectedLabel}}</span>\n </If>\n <If test="$data.clearable && $data.selectedLabel && !$data.disabled">\n <span class="select__clear" @click="this.handleClear(event)">×</span>\n </If>\n <span class="select__arrow">▼</span>\n </div>\n\n \x3c!-- 下拉菜单 --\x3e\n <If test="$data.isOpen">\n <div class="select__dropdown
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="select" :class="this.getSelectClasses()" @click="this.handleClick(event)">\n <div class="select__selector">\n <If test="!$data.selectedLabel">\n <span class="select__placeholder">{{$data.placeholder || \'请选择\'}}</span>\n </If>\n <If test="$data.selectedLabel">\n <span class="select__value">{{$data.selectedLabel}}</span>\n </If>\n <If test="$data.clearable && $data.selectedLabel && !$data.disabled">\n <span class="select__clear" @click="this.handleClear(event)">×</span>\n </If>\n <span class="select__arrow">▼</span>\n </div>\n\n \x3c!-- 下拉菜单 --\x3e\n <If test="$data.isOpen">\n <div class="select__dropdown" :class="this.getDropdownClasses()">\n \x3c!-- 使用 options 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <If test="$data.parsedOptions.length === 0">\n <div class="select__empty">暂无数据</div>\n </If>\n <For each="$data.parsedOptions" item="option">\n <div class="select__option" :class="this.getOptionClasses(option)" @click="this.handleSelect(option, event)">\n <span class="select__option-label">{{option.label}}</span>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <div class="select__slot-options" @click="this.handleSlotClick(event)">\n <slot></slot>\n </div>\n </If>\n </div>\n </If>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e='<div class="select" :class="this.getSelectClasses()" @click="this.handleClick(event)">\n <div class="select__selector">\n <If test="!$data.selectedLabel">\n <span class="select__placeholder">{{$data.placeholder || \'请选择\'}}</span>\n </If>\n <If test="$data.selectedLabel">\n <span class="select__value">{{$data.selectedLabel}}</span>\n </If>\n <If test="$data.clearable && $data.selectedLabel && !$data.disabled">\n <span class="select__clear" @click="this.handleClear(event)">×</span>\n </If>\n <span class="select__arrow">▼</span>\n </div>\n\n \x3c!-- 下拉菜单 --\x3e\n <If test="$data.isOpen">\n <div class="select__dropdown
|
|
1
|
+
const e='<div class="select" :class="this.getSelectClasses()" @click="this.handleClick(event)">\n <div class="select__selector">\n <If test="!$data.selectedLabel">\n <span class="select__placeholder">{{$data.placeholder || \'请选择\'}}</span>\n </If>\n <If test="$data.selectedLabel">\n <span class="select__value">{{$data.selectedLabel}}</span>\n </If>\n <If test="$data.clearable && $data.selectedLabel && !$data.disabled">\n <span class="select__clear" @click="this.handleClear(event)">×</span>\n </If>\n <span class="select__arrow">▼</span>\n </div>\n\n \x3c!-- 下拉菜单 --\x3e\n <If test="$data.isOpen">\n <div class="select__dropdown" :class="this.getDropdownClasses()">\n \x3c!-- 使用 options 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <If test="$data.parsedOptions.length === 0">\n <div class="select__empty">暂无数据</div>\n </If>\n <For each="$data.parsedOptions" item="option">\n <div class="select__option" :class="this.getOptionClasses(option)" @click="this.handleSelect(option, event)">\n <span class="select__option-label">{{option.label}}</span>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <div class="select__slot-options" @click="this.handleSlotClick(event)">\n <slot></slot>\n </div>\n </If>\n </div>\n </If>\n</div>\n';export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s from"./index.html.js";import l from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends l{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver")}get value(){return this.$data.value||""}set value(t){this.$data.disabled||this.setValue(t)}getSelectClasses(){const t={};return"small"===this.$data.size?t["select--sm"]=!0:"large"===this.$data.size?t["select--lg"]=!0:t["select--md"]=!0,t["is-disabled"]=!!this.$data.disabled,t["is-focused"]=!!this.$data.focused,t["is-open"]=!!this.$data.isOpen,t["use-slot"]=this.$data.useSlot,t}getDropdownClasses(){return{"select__dropdown--closing":!!this.$data.closing,"select__dropdown--top":"top"===this.$data.dropdownPlacement,"select__dropdown--bottom":"bottom"===this.$data.dropdownPlacement}}getOptionClasses(t){return{"select__option--selected":t.value===this.$data.value,"select__option--disabled":!!t.disabled}}calculateDropdownPlacement(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,a=t.top;this.$data.dropdownPlacement=e<256&&a>e?"top":"bottom"}collectSlotOptions(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-value"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotOptions=t.map(t=>{var e;const a=t;return{value:a.getAttribute("data-value")||"",label:a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"",disabled:a.hasAttribute("disabled"),element:t}}),this.updateSelectedLabelFromSlot()):this.$data.useSlot=!1}updateSelectedLabelFromSlot(){if(!this.$data.slotOptions.length)return;const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}mounted(){this.parseOptions(),this.setupSlotObserver(),this.clickOutsideHandler=t=>{t.composedPath().some(t=>t===this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler)}setupSlotObserver(){setTimeout(()=>{this.collectSlotOptions()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotOptions()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-value","data-label","disabled"]})}unmounted(){this.clickOutsideHandler&&document.removeEventListener("click",this.clickOutsideHandler),this.slotObserver&&this.slotObserver.disconnect()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}getCurrentLabel(){if(this.$data.useSlot){const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}{const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}}parseOptions(){this.$data.parsedOptions=Array.isArray(this.$data.options)?this.$data.options:[],this.$data.useSlot||this.updateSelectedLabel()}updateSelectedLabel(){if(!this.$data.parsedOptions.length)return;const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}handleClick(){if(this.$data.disabled)return;const t=!this.$data.isOpen;this.$data.isOpen=t,this.$data.focused=t,t&&this.calculateDropdownPlacement()}handleSelect(t,e){t.disabled||(this.$data.value=t.value,this.updateSelectedLabel(),this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleSlotClick(t){var e;const a=t.target.closest("[data-value]");if(!a)return;const s=a.getAttribute("data-value")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,this.$data.selectedLabel=l,this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClear(t){t.stopPropagation(),this.$data.value="",this.$data.selectedLabel="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}closeDropdown(){this.$data.isOpen&&(this.$data.closing=!0,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},200))}setValue(t,e=!1){this.$data.value=t,this.$data.useSlot?this.updateSelectedLabelFromSlot():this.updateSelectedLabel(),e||this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getValue(){return this.$data.value||""}setOptions(t){this.$data.options=t,this.$data.useSlot=!1,this.parseOptions()}};o=((t,e)=>{for(var a,s=e,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i({tagName:"solely-select",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:"请选择"},{name:"disabled",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"clearable",type:"boolean",default:!1},{name:"options",type:"array",default:[]},{name:"multiple",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],o);export{o as SolelySelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block;position:relative}:host([block]){display:block;width:100%}.select{cursor:pointer}.select__selector{display:flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.select__selector:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.select--sm .select__selector{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.select--lg .select__selector{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__placeholder{color:var(--solely-text-tertiary)}.select__arrow{margin-left:auto;font-size:12px;color:var(--solely-text-tertiary);transition:transform var(--solely-transition-duration);flex-shrink:0}.select.is-open .select__arrow{transform:rotate(180deg)}.select.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.select.is-focused .select__selector{border-color:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.select__clear{margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration)}.select__clear:hover{color:var(--solely-text-secondary)}.select__dropdown{position:absolute;left:0;right:0;max-height:256px;overflow-y:auto;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown)}.select__dropdown--bottom{top:100%;margin-top:4px;animation:dropdown-in-bottom .2s ease-out}.select__dropdown--bottom.select__dropdown--closing{animation:dropdown-out-bottom .2s ease-in forwards}.select__dropdown--top{bottom:100%;margin-bottom:4px;animation:dropdown-in-top .2s ease-out}.select__dropdown--top.select__dropdown--closing{animation:dropdown-out-top .2s ease-in forwards}.select__option{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary)}.select__option:hover:not(.select__option--disabled){background-color:var(--solely-primary-light)}.select__option--selected{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__option--disabled{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__empty{padding:var(--solely-spacing-md);text-align:center;color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm)}@keyframes dropdown-in-bottom{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-bottom{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes dropdown-in-top{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-top{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block;position:relative}:host([block]){display:block;width:100%}.select{cursor:pointer}.select__selector{display:flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.select__selector:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.select--sm .select__selector{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.select--lg .select__selector{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__placeholder{color:var(--solely-text-tertiary)}.select__arrow{margin-left:auto;font-size:12px;color:var(--solely-text-tertiary);transition:transform var(--solely-transition-duration);flex-shrink:0}.select.is-open .select__arrow{transform:rotate(180deg)}.select.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.select.is-focused .select__selector{border-color:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.select__clear{margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration)}.select__clear:hover{color:var(--solely-text-secondary)}.select__dropdown{position:absolute;left:0;right:0;max-height:256px;overflow-y:auto;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown)}.select__dropdown--bottom{top:100%;margin-top:4px;animation:dropdown-in-bottom .2s ease-out}.select__dropdown--bottom.select__dropdown--closing{animation:dropdown-out-bottom .2s ease-in forwards}.select__dropdown--top{bottom:100%;margin-bottom:4px;animation:dropdown-in-top .2s ease-out}.select__dropdown--top.select__dropdown--closing{animation:dropdown-out-top .2s ease-in forwards}.select__option{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary)}.select__option:hover:not(.select__option--disabled){background-color:var(--solely-primary-light)}.select__option--selected{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__option--disabled{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__option{display:flex;align-items:center;gap:8px}.select__option-icon{flex-shrink:0}.select__option-icon--img{width:20px;height:20px;object-fit:cover;border-radius:4px}.select__option-icon--class{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;font-size:16px}.select__option-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__slot-options{display:flex;flex-direction:column}.select__slot-options ::slotted([data-value]),.select__slot-options>[data-value]{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary);display:flex;align-items:center;gap:8px}.select__slot-options ::slotted([data-value]:hover:not([disabled])),.select__slot-options>[data-value]:hover:not([disabled]){background-color:var(--solely-primary-light)}.select__slot-options ::slotted([data-value][data-selected]),.select__slot-options>[data-value][data-selected]{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__slot-options ::slotted([data-value][disabled]),.select__slot-options>[data-value][disabled]{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__empty{padding:var(--solely-spacing-md);text-align:center;color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm)}@keyframes dropdown-in-bottom{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-bottom{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes dropdown-in-top{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-top{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block;position:relative}:host([block]){display:block;width:100%}.select{cursor:pointer}.select__selector{display:flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.select__selector:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.select--sm .select__selector{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.select--lg .select__selector{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__placeholder{color:var(--solely-text-tertiary)}.select__arrow{margin-left:auto;font-size:12px;color:var(--solely-text-tertiary);transition:transform var(--solely-transition-duration);flex-shrink:0}.select.is-open .select__arrow{transform:rotate(180deg)}.select.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.select.is-focused .select__selector{border-color:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.select__clear{margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration)}.select__clear:hover{color:var(--solely-text-secondary)}.select__dropdown{position:absolute;left:0;right:0;max-height:256px;overflow-y:auto;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown)}.select__dropdown--bottom{top:100%;margin-top:4px;animation:dropdown-in-bottom .2s ease-out}.select__dropdown--bottom.select__dropdown--closing{animation:dropdown-out-bottom .2s ease-in forwards}.select__dropdown--top{bottom:100%;margin-bottom:4px;animation:dropdown-in-top .2s ease-out}.select__dropdown--top.select__dropdown--closing{animation:dropdown-out-top .2s ease-in forwards}.select__option{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary)}.select__option:hover:not(.select__option--disabled){background-color:var(--solely-primary-light)}.select__option--selected{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__option--disabled{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__empty{padding:var(--solely-spacing-md);text-align:center;color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm)}@keyframes dropdown-in-bottom{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-bottom{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes dropdown-in-top{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-top{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}";export{o as default};
|
|
1
|
+
const o="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block;position:relative}:host([block]){display:block;width:100%}.select{cursor:pointer}.select__selector{display:flex;align-items:center;height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.select__selector:hover:not(.is-disabled){border-color:var(--solely-primary-hover)}.select--sm .select__selector{height:var(--solely-height-sm);padding:0 var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.select--lg .select__selector{height:var(--solely-height-lg);padding:0 var(--solely-spacing-lg);font-size:var(--solely-font-size-lg)}.select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__placeholder{color:var(--solely-text-tertiary)}.select__arrow{margin-left:auto;font-size:12px;color:var(--solely-text-tertiary);transition:transform var(--solely-transition-duration);flex-shrink:0}.select.is-open .select__arrow{transform:rotate(180deg)}.select.is-disabled{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.select.is-focused .select__selector{border-color:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.select__clear{margin-left:var(--solely-spacing-xs);font-size:14px;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration)}.select__clear:hover{color:var(--solely-text-secondary)}.select__dropdown{position:absolute;left:0;right:0;max-height:256px;overflow-y:auto;background-color:var(--solely-component-bg);border:1px solid var(--solely-border-color);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);z-index:var(--solely-z-index-dropdown)}.select__dropdown--bottom{top:100%;margin-top:4px;animation:dropdown-in-bottom .2s ease-out}.select__dropdown--bottom.select__dropdown--closing{animation:dropdown-out-bottom .2s ease-in forwards}.select__dropdown--top{bottom:100%;margin-bottom:4px;animation:dropdown-in-top .2s ease-out}.select__dropdown--top.select__dropdown--closing{animation:dropdown-out-top .2s ease-in forwards}.select__option{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary)}.select__option:hover:not(.select__option--disabled){background-color:var(--solely-primary-light)}.select__option--selected{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__option--disabled{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__option{display:flex;align-items:center;gap:8px}.select__option-icon{flex-shrink:0}.select__option-icon--img{width:20px;height:20px;object-fit:cover;border-radius:4px}.select__option-icon--class{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;font-size:16px}.select__option-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__slot-options{display:flex;flex-direction:column}.select__slot-options ::slotted([data-value]),.select__slot-options>[data-value]{padding:var(--solely-spacing-sm) var(--solely-spacing-md);cursor:pointer;transition:all var(--solely-transition-duration);color:var(--solely-text-primary);display:flex;align-items:center;gap:8px}.select__slot-options ::slotted([data-value]:hover:not([disabled])),.select__slot-options>[data-value]:hover:not([disabled]){background-color:var(--solely-primary-light)}.select__slot-options ::slotted([data-value][data-selected]),.select__slot-options>[data-value][data-selected]{background-color:var(--solely-primary-light);color:var(--solely-primary);font-weight:500}.select__slot-options ::slotted([data-value][disabled]),.select__slot-options>[data-value][disabled]{cursor:not-allowed;color:var(--solely-text-tertiary);opacity:var(--solely-disabled-opacity)}.select__empty{padding:var(--solely-spacing-md);text-align:center;color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm)}@keyframes dropdown-in-bottom{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-bottom{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes dropdown-in-top{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-out-top{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}";export{o as default};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Select 组件类型定义
|
|
3
3
|
*/
|
|
4
4
|
export type SelectSize = 'small' | 'medium' | 'large';
|
|
5
|
+
/**
|
|
6
|
+
* 选项数据
|
|
7
|
+
* 用于 options 属性方式
|
|
8
|
+
*/
|
|
5
9
|
export interface SelectOption {
|
|
6
10
|
/** 选项标签 */
|
|
7
11
|
label: string;
|
|
@@ -10,21 +14,41 @@ export interface SelectOption {
|
|
|
10
14
|
/** 是否禁用 */
|
|
11
15
|
disabled?: boolean;
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Select 组件属性
|
|
19
|
+
*/
|
|
13
20
|
export interface SelectProps {
|
|
14
21
|
/** 选中的值 */
|
|
15
|
-
value
|
|
16
|
-
/**
|
|
17
|
-
placeholder
|
|
22
|
+
value?: string;
|
|
23
|
+
/** 占位符文本 */
|
|
24
|
+
placeholder?: string;
|
|
18
25
|
/** 是否禁用 */
|
|
19
|
-
disabled
|
|
26
|
+
disabled?: boolean;
|
|
20
27
|
/** 尺寸 */
|
|
21
|
-
size
|
|
22
|
-
/**
|
|
23
|
-
clearable
|
|
24
|
-
/**
|
|
25
|
-
options
|
|
28
|
+
size?: SelectSize;
|
|
29
|
+
/** 是否可清空 */
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
/** 选项数据 */
|
|
32
|
+
options?: SelectOption[];
|
|
26
33
|
/** 是否多选 */
|
|
27
|
-
multiple
|
|
34
|
+
multiple?: boolean;
|
|
28
35
|
/** 是否块级显示 */
|
|
29
|
-
block
|
|
36
|
+
block?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Select 组件方法接口
|
|
40
|
+
*/
|
|
41
|
+
export interface SelectMethods {
|
|
42
|
+
/** 设置值 */
|
|
43
|
+
setValue(value: string, silent?: boolean): void;
|
|
44
|
+
/** 获取值 */
|
|
45
|
+
getValue(): string;
|
|
46
|
+
/** 设置选项 */
|
|
47
|
+
setOptions(options: SelectOption[]): void;
|
|
48
|
+
/** 打开下拉菜单 */
|
|
49
|
+
open(): void;
|
|
50
|
+
/** 关闭下拉菜单 */
|
|
51
|
+
close(): void;
|
|
52
|
+
/** 清空选择 */
|
|
53
|
+
clear(): void;
|
|
30
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),
|
|
1
|
+
"use strict";var t=Object.defineProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");var o,n,l,d=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends a.default{constructor(){var e,s;super(...arguments),((e,s,r)=>{s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r})(this,"symbol"!=typeof(e="slotObserver")?e+"":e,s)}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&exports.SolelySteps.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?exports.SolelySteps.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.parseItems(),this.setupSlotObserver()}setupSlotObserver(){setTimeout(()=>{this.collectSlotItems()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect()}parseItems(){this.$data.parsedItems=r.safeJsonParse(this.$data.items,[])}getStepStatus(t){const e=this.$data.current||0;if(!Array.isArray(this.$data.parsedItems)||t<0||t>=this.$data.parsedItems.length)return"wait";const s=this.$data.parsedItems[t];return(null==s?void 0:s.status)?s.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.$data.parsedItems.length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.parseItems()}},o=exports.SolelySteps,l=["blue","green","red","orange","gray"],(n="PRESET_COLORS")in o?d(o,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[n]=l,exports.SolelySteps=((t,e)=>{for(var s,r=e,a=t.length-1;a>=0;a--)(s=t[a])&&(r=s(r)||r);return r})([i.CustomElement({tagName:"solely-steps",template:s.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],exports.SolelySteps);
|
|
@@ -2,12 +2,29 @@ import { BaseElement } from '../../../runtime/component';
|
|
|
2
2
|
import { StepsProps, StepItem, StepStatus } from './types';
|
|
3
3
|
declare class SolelySteps extends BaseElement<StepsProps & {
|
|
4
4
|
parsedItems: StepItem[];
|
|
5
|
+
useSlot: boolean;
|
|
6
|
+
slotItems: Array<{
|
|
7
|
+
step: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
iconHtml: string;
|
|
12
|
+
}>;
|
|
5
13
|
}> {
|
|
6
14
|
private static readonly PRESET_COLORS;
|
|
15
|
+
slotObserver?: MutationObserver;
|
|
7
16
|
get current(): number;
|
|
8
17
|
set current(value: number);
|
|
9
18
|
getStepsClasses(): Record<string, boolean>;
|
|
10
|
-
getStepClasses(item: StepItem
|
|
19
|
+
getStepClasses(item: StepItem | {
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}, index: number): Record<string, boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* 获取插槽步骤的类名
|
|
24
|
+
*/
|
|
25
|
+
getSlotStepClasses(slotItem: {
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}, index: number): Record<string, boolean>;
|
|
11
28
|
/**
|
|
12
29
|
* 获取图标包裹器的类名(用于预设颜色)
|
|
13
30
|
*/
|
|
@@ -16,11 +33,31 @@ declare class SolelySteps extends BaseElement<StepsProps & {
|
|
|
16
33
|
* 获取图标包裹器的内联样式(仅处理自定义颜色)
|
|
17
34
|
*/
|
|
18
35
|
getIconStyle(item: StepItem): string;
|
|
36
|
+
/**
|
|
37
|
+
* 从插槽收集步骤
|
|
38
|
+
*/
|
|
39
|
+
collectSlotItems(): void;
|
|
19
40
|
mounted(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 设置插槽观察器
|
|
43
|
+
*/
|
|
44
|
+
setupSlotObserver(): void;
|
|
45
|
+
unmounted(): void;
|
|
20
46
|
parseItems(): void;
|
|
21
47
|
getStepStatus(index: number): StepStatus;
|
|
48
|
+
/**
|
|
49
|
+
* 获取插槽步骤的状态
|
|
50
|
+
*/
|
|
51
|
+
getSlotStepStatus(index: number): StepStatus;
|
|
22
52
|
getStepIcon(item: StepItem, index: number): string;
|
|
23
53
|
handleStepClick(item: StepItem, index: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* 处理插槽步骤点击
|
|
56
|
+
*/
|
|
57
|
+
handleSlotStepClick(slotItem: {
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
iconHtml?: string;
|
|
60
|
+
}, index: number): void;
|
|
24
61
|
setCurrent(current: number): void;
|
|
25
62
|
getCurrent(): number;
|
|
26
63
|
next(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="steps" :class="this.getStepsClasses()">\n <For each="$data.parsedItems" item="item" index="index">\n
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="steps" :class="this.getStepsClasses()">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="$data.parsedItems" item="item" index="index">\n <div class="step" :class="this.getStepClasses(item, index)" @click="this.handleStepClick(item, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div class="step" :class="this.getSlotStepClasses(slotItem, index)" @click="this.handleSlotStepClick(slotItem, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper">\n <div class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const s='<div class="steps" :class="this.getStepsClasses()">\n <For each="$data.parsedItems" item="item" index="index">\n
|
|
1
|
+
const s='<div class="steps" :class="this.getStepsClasses()">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="$data.parsedItems" item="item" index="index">\n <div class="step" :class="this.getStepClasses(item, index)" @click="this.handleStepClick(item, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div class="step" :class="this.getSlotStepClasses(slotItem, index)" @click="this.handleSlotStepClick(slotItem, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper">\n <div class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t=Object.defineProperty;import e from"./style.css.js";import s from"./index.html.js";import{safeJsonParse as r}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";var o=Object.defineProperty;Object.getOwnPropertyDescriptor;let n=class extends a{constructor(){var e,s;super(...arguments),((e,s,r)=>{s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r})(this,"symbol"!=typeof(e="slotObserver")?e+"":e,s)}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&n.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?n.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.parseItems(),this.setupSlotObserver()}setupSlotObserver(){setTimeout(()=>{this.collectSlotItems()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect()}parseItems(){this.$data.parsedItems=r(this.$data.items,[])}getStepStatus(t){const e=this.$data.current||0;if(!Array.isArray(this.$data.parsedItems)||t<0||t>=this.$data.parsedItems.length)return"wait";const s=this.$data.parsedItems[t];return(null==s?void 0:s.status)?s.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.$data.parsedItems.length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.parseItems()}};var l,d,c;c=["blue","green","red","orange","gray"],(d="PRESET_COLORS")in(l=n)?o(l,d,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[d]=c,n=((t,e)=>{for(var s,r=e,a=t.length-1;a>=0;a--)(s=t[a])&&(r=s(r)||r);return r})([i({tagName:"solely-steps",template:s,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],n);export{n as SolelySteps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%}.steps{--step-icon-size: 32px;--step-icon-inner: 26px;--step-dot-size: 8px;--step-tail-thickness: 2px;--step-gap: 8px;--step-tail-offset: 12px;width:100%;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:var(--solely-line-height-md);box-sizing:border-box}.step{position:relative;cursor:pointer}.step__wrapper{position:relative;z-index:1;display:flex}.step__icon-wrapper{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--step-icon-size);height:var(--step-icon-size)}.step__icon{display:flex;align-items:center;justify-content:center;width:var(--step-icon-inner);height:var(--step-icon-inner);font-size:var(--solely-font-size-md);line-height:1;border-radius:var(--solely-border-radius-circle);border:2px solid transparent;transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.step__title{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-md);line-height:22px}.step__description{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm);line-height:20px;margin-top:4px}.steps--horizontal{display:flex;text-align:center}.steps--horizontal .step{flex:1;overflow:visible}.steps--horizontal .step__wrapper{flex-direction:column;align-items:center;width:100%}.steps--horizontal .step__tail{position:absolute;top:calc(var(--step-icon-size) / 2);left:calc(50% + var(--step-tail-offset));width:calc(100% - 2 * var(--step-tail-offset));height:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--horizontal .step:last-child .step__tail{display:none}.steps--horizontal .step__content{margin-top:var(--step-gap);word-break:break-word}.steps--vertical{display:flex;flex-direction:column}.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px);min-height:var(--step-icon-size)}.steps--vertical .step__wrapper{flex-direction:row;align-items:flex-start}.steps--vertical .step__icon-wrapper{position:absolute;left:calc(-1 * (var(--step-icon-size) + 4px));top:0}.steps--vertical .step__tail{position:absolute;left:calc(var(--step-icon-size) / 2 - 1px);top:var(--step-icon-size);bottom:0;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--vertical .step:last-child .step__tail{display:none}.steps--vertical .step__content{flex:1;min-width:0}.steps--vertical .step__title{line-height:var(--step-icon-size)}.step--wait .step__icon{background:var(--solely-gray-4);border-color:var(--solely-text-quaternary);color:var(--solely-text-quaternary)}.step--process .step__icon{background:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.step--process .step__title{color:var(--solely-text-primary);font-weight:500}.step--finish .step__icon{background:var(--solely-gray-4);border-color:var(--solely-primary);color:var(--solely-primary)}.step--finish .step__title{color:var(--solely-text-primary)}.step--finish .step__tail{background:var(--solely-primary)!important}.step--error .step__icon{background:var(--solely-gray-4);border-color:var(--solely-error);color:var(--solely-error)}.step--error .step__title{color:var(--solely-error)}.step--disabled,.step--disabled *{cursor:not-allowed}.step:not(.step--disabled):hover .step__title{color:var(--solely-primary)}.step:not(.step--disabled):hover .step__icon{border-color:var(--solely-primary)}.step--has-icon:not(.step--disabled):hover .step__icon{color:var(--solely-primary)}.step--has-icon .step__icon{background:transparent!important;border:none!important;width:auto;height:auto;margin:0;font-size:24px}.step--has-icon .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary);border-radius:var(--solely-border-radius-circle)}.step--has-icon.step--finish .step__icon-wrapper,.step--has-icon.step--process .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary)}.step--has-icon.step--error .step__icon-wrapper{background:var(--solely-error-light);color:var(--solely-error)}.step--has-icon.step--wait .step__icon-wrapper{background:#0000000a;color:var(--solely-text-quaternary)}.step--has-icon.step--process .step__icon,.step--has-icon.step--finish .step__icon{color:var(--solely-primary)}.step--has-icon.step--error .step__icon{color:var(--solely-error)}.step--has-icon.step--wait .step__icon{color:var(--solely-text-quaternary)}.step__icon-wrapper--blue{background-color:var(--solely-primary-light)!important;color:var(--solely-primary)!important}.step__icon-wrapper--green{background-color:var(--solely-success-light)!important;color:var(--solely-success)!important}.step__icon-wrapper--red{background-color:var(--solely-error-light)!important;color:var(--solely-error)!important}.step__icon-wrapper--orange{background-color:var(--solely-warning-light)!important;color:var(--solely-warning)!important}.step__icon-wrapper--gray{background-color:#0000000a!important;color:var(--solely-text-tertiary)!important}.steps--dot{--step-icon-size: 8px;--step-icon-inner: 8px;--step-gap: 6px;--step-tail-offset: 6px}.steps--dot .step__icon{border:none;background:var(--solely-text-quaternary);font-size:0}.steps--dot .step__icon-text,.steps--dot .step__icon-substitution{display:none}.steps--dot .step--process .step__icon{background:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.steps--dot .step--finish .step__icon{background:var(--solely-primary)}.steps--dot .step--error .step__icon{background:var(--solely-error)}.steps--dot.steps--horizontal .step__tail{top:calc(var(--step-icon-size) / 2 - 1px)}.steps--dot.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 12px);min-height:calc(var(--step-icon-size) + 8px)}.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 12px))}.steps--dot.steps--vertical .step__tail{left:calc(var(--step-icon-size) / 2 - 1px);top:calc(var(--step-icon-size) + 4px);bottom:4px;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--dot.steps--vertical .step__title{line-height:var(--step-icon-size);padding-bottom:4px}.steps--sm{--step-icon-size: 24px;--step-icon-inner: 20px;--step-dot-size: 6px;--step-gap: 6px;--step-tail-offset: 8px}.steps--sm .step__title{font-size:var(--solely-font-size-sm);line-height:20px}.steps--sm .step__description,.steps--sm .step__icon{font-size:var(--solely-font-size-sm)}.steps--sm .step__icon-substitution{font-size:14px}.steps--sm.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px)}.steps--sm.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 4px))}.steps--sm.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--sm.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 8px);min-height:calc(var(--step-dot-size) + 6px)}.steps--sm.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 8px))}.steps--sm.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--sm.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:2px}.steps--sm.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps--lg{--step-icon-size: 40px;--step-icon-inner: 32px;--step-dot-size: 10px;--step-gap: 10px;--step-tail-offset: 16px}.steps--lg .step__title{font-size:var(--solely-font-size-lg);line-height:24px}.steps--lg .step__description{font-size:var(--solely-font-size-md);line-height:22px}.steps--lg .step__icon{font-size:var(--solely-font-size-lg)}.steps--lg .step__icon-substitution{font-size:20px}.steps--lg.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 6px)}.steps--lg.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 6px))}.steps--lg.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--lg.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 14px);min-height:calc(var(--step-dot-size) + 10px)}.steps--lg.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 14px))}.steps--lg.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--lg.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:6px}.steps--lg.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%}.steps{--step-icon-size: 32px;--step-icon-inner: 26px;--step-dot-size: 8px;--step-tail-thickness: 2px;--step-gap: 8px;--step-tail-offset: 12px;width:100%;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:var(--solely-line-height-md);box-sizing:border-box}.step{position:relative;cursor:pointer}.step__wrapper{position:relative;z-index:1;display:flex}.step__icon-wrapper{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--step-icon-size);height:var(--step-icon-size)}.step__icon{display:flex;align-items:center;justify-content:center;width:var(--step-icon-inner);height:var(--step-icon-inner);font-size:var(--solely-font-size-md);line-height:1;border-radius:var(--solely-border-radius-circle);border:2px solid transparent;transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.step__title{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-md);line-height:22px}.step__description{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm);line-height:20px;margin-top:4px}.steps--horizontal{display:flex;text-align:center}.steps--horizontal .step{flex:1;overflow:visible}.steps--horizontal .step__wrapper{flex-direction:column;align-items:center;width:100%}.steps--horizontal .step__tail{position:absolute;top:calc(var(--step-icon-size) / 2);left:calc(50% + var(--step-tail-offset));width:calc(100% - 2 * var(--step-tail-offset));height:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--horizontal .step:last-child .step__tail{display:none}.steps--horizontal .step__content{margin-top:var(--step-gap);word-break:break-word}.steps--vertical{display:flex;flex-direction:column}.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px);min-height:var(--step-icon-size)}.steps--vertical .step__wrapper{flex-direction:row;align-items:flex-start}.steps--vertical .step__icon-wrapper{position:absolute;left:calc(-1 * (var(--step-icon-size) + 4px));top:0}.steps--vertical .step__tail{position:absolute;left:calc(var(--step-icon-size) / 2 - 1px);top:var(--step-icon-size);bottom:0;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--vertical .step:last-child .step__tail{display:none}.steps--vertical .step__content{flex:1;min-width:0}.steps--vertical .step__title{line-height:var(--step-icon-size)}.step--wait .step__icon{background:var(--solely-gray-4);border-color:var(--solely-text-quaternary);color:var(--solely-text-quaternary)}.step--process .step__icon{background:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.step--process .step__title{color:var(--solely-text-primary);font-weight:500}.step--finish .step__icon{background:var(--solely-gray-4);border-color:var(--solely-primary);color:var(--solely-primary)}.step--finish .step__title{color:var(--solely-text-primary)}.step--finish .step__tail{background:var(--solely-primary)!important}.step--error .step__icon{background:var(--solely-gray-4);border-color:var(--solely-error);color:var(--solely-error)}.step--error .step__title{color:var(--solely-error)}.step--disabled,.step--disabled *{cursor:not-allowed}.step:not(.step--disabled):hover .step__title{color:var(--solely-primary)}.step:not(.step--disabled):hover .step__icon{border-color:var(--solely-primary)}.step--has-icon:not(.step--disabled):hover .step__icon{color:var(--solely-primary)}.step--has-icon .step__icon{background:transparent!important;border:none!important;width:auto;height:auto;margin:0;font-size:24px}.step--has-icon .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary);border-radius:var(--solely-border-radius-circle)}.step--has-icon.step--finish .step__icon-wrapper,.step--has-icon.step--process .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary)}.step--has-icon.step--error .step__icon-wrapper{background:var(--solely-error-light);color:var(--solely-error)}.step--has-icon.step--wait .step__icon-wrapper{background:#0000000a;color:var(--solely-text-quaternary)}.step--has-icon.step--process .step__icon,.step--has-icon.step--finish .step__icon{color:var(--solely-primary)}.step--has-icon.step--error .step__icon{color:var(--solely-error)}.step--has-icon.step--wait .step__icon{color:var(--solely-text-quaternary)}.step__icon-wrapper--blue{background-color:var(--solely-primary-light)!important;color:var(--solely-primary)!important}.step__icon-wrapper--green{background-color:var(--solely-success-light)!important;color:var(--solely-success)!important}.step__icon-wrapper--red{background-color:var(--solely-error-light)!important;color:var(--solely-error)!important}.step__icon-wrapper--orange{background-color:var(--solely-warning-light)!important;color:var(--solely-warning)!important}.step__icon-wrapper--gray{background-color:#0000000a!important;color:var(--solely-text-tertiary)!important}.steps--dot{--step-icon-size: 8px;--step-icon-inner: 8px;--step-gap: 6px;--step-tail-offset: 6px}.steps--dot .step__icon{border:none;background:var(--solely-text-quaternary);font-size:0}.steps--dot .step__icon-text,.steps--dot .step__icon-substitution{display:none}.steps--dot .step--process .step__icon{background:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.steps--dot .step--finish .step__icon{background:var(--solely-primary)}.steps--dot .step--error .step__icon{background:var(--solely-error)}.steps--dot.steps--horizontal .step__tail{top:calc(var(--step-icon-size) / 2 - 1px)}.steps--dot.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 12px);min-height:calc(var(--step-icon-size) + 8px)}.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 12px))}.steps--dot.steps--vertical .step__tail{left:calc(var(--step-icon-size) / 2 - 1px);top:calc(var(--step-icon-size) + 4px);bottom:4px;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--dot.steps--vertical .step__title{line-height:var(--step-icon-size);padding-bottom:4px}.steps--sm{--step-icon-size: 24px;--step-icon-inner: 20px;--step-dot-size: 6px;--step-gap: 6px;--step-tail-offset: 8px}.steps--sm .step__title{font-size:var(--solely-font-size-sm);line-height:20px}.steps--sm .step__description,.steps--sm .step__icon{font-size:var(--solely-font-size-sm)}.steps--sm .step__icon-substitution{font-size:14px}.steps--sm.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px)}.steps--sm.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 4px))}.steps--sm.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--sm.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 8px);min-height:calc(var(--step-dot-size) + 6px)}.steps--sm.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 8px))}.steps--sm.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--sm.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:2px}.steps--sm.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps--lg{--step-icon-size: 40px;--step-icon-inner: 32px;--step-dot-size: 10px;--step-gap: 10px;--step-tail-offset: 16px}.steps--lg .step__title{font-size:var(--solely-font-size-lg);line-height:24px}.steps--lg .step__description{font-size:var(--solely-font-size-md);line-height:22px}.steps--lg .step__icon{font-size:var(--solely-font-size-lg)}.steps--lg .step__icon-substitution{font-size:20px}.steps--lg.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 6px)}.steps--lg.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 6px))}.steps--lg.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--lg.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 14px);min-height:calc(var(--step-dot-size) + 10px)}.steps--lg.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 14px))}.steps--lg.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--lg.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:6px}.steps--lg.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps__slot-content{display:flex;flex-direction:row}.steps--vertical .steps__slot-content{flex-direction:column}.steps__slot-content ::slotted([data-step]),.steps__slot-content>[data-step]{display:flex;flex:1;position:relative;cursor:pointer}.steps__slot-content ::slotted([data-step][disabled]),.steps__slot-content>[data-step][disabled]{cursor:not-allowed;opacity:.5}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%}.steps{--step-icon-size: 32px;--step-icon-inner: 26px;--step-dot-size: 8px;--step-tail-thickness: 2px;--step-gap: 8px;--step-tail-offset: 12px;width:100%;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:var(--solely-line-height-md);box-sizing:border-box}.step{position:relative;cursor:pointer}.step__wrapper{position:relative;z-index:1;display:flex}.step__icon-wrapper{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--step-icon-size);height:var(--step-icon-size)}.step__icon{display:flex;align-items:center;justify-content:center;width:var(--step-icon-inner);height:var(--step-icon-inner);font-size:var(--solely-font-size-md);line-height:1;border-radius:var(--solely-border-radius-circle);border:2px solid transparent;transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.step__title{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-md);line-height:22px}.step__description{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm);line-height:20px;margin-top:4px}.steps--horizontal{display:flex;text-align:center}.steps--horizontal .step{flex:1;overflow:visible}.steps--horizontal .step__wrapper{flex-direction:column;align-items:center;width:100%}.steps--horizontal .step__tail{position:absolute;top:calc(var(--step-icon-size) / 2);left:calc(50% + var(--step-tail-offset));width:calc(100% - 2 * var(--step-tail-offset));height:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--horizontal .step:last-child .step__tail{display:none}.steps--horizontal .step__content{margin-top:var(--step-gap);word-break:break-word}.steps--vertical{display:flex;flex-direction:column}.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px);min-height:var(--step-icon-size)}.steps--vertical .step__wrapper{flex-direction:row;align-items:flex-start}.steps--vertical .step__icon-wrapper{position:absolute;left:calc(-1 * (var(--step-icon-size) + 4px));top:0}.steps--vertical .step__tail{position:absolute;left:calc(var(--step-icon-size) / 2 - 1px);top:var(--step-icon-size);bottom:0;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--vertical .step:last-child .step__tail{display:none}.steps--vertical .step__content{flex:1;min-width:0}.steps--vertical .step__title{line-height:var(--step-icon-size)}.step--wait .step__icon{background:var(--solely-gray-4);border-color:var(--solely-text-quaternary);color:var(--solely-text-quaternary)}.step--process .step__icon{background:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.step--process .step__title{color:var(--solely-text-primary);font-weight:500}.step--finish .step__icon{background:var(--solely-gray-4);border-color:var(--solely-primary);color:var(--solely-primary)}.step--finish .step__title{color:var(--solely-text-primary)}.step--finish .step__tail{background:var(--solely-primary)!important}.step--error .step__icon{background:var(--solely-gray-4);border-color:var(--solely-error);color:var(--solely-error)}.step--error .step__title{color:var(--solely-error)}.step--disabled,.step--disabled *{cursor:not-allowed}.step:not(.step--disabled):hover .step__title{color:var(--solely-primary)}.step:not(.step--disabled):hover .step__icon{border-color:var(--solely-primary)}.step--has-icon:not(.step--disabled):hover .step__icon{color:var(--solely-primary)}.step--has-icon .step__icon{background:transparent!important;border:none!important;width:auto;height:auto;margin:0;font-size:24px}.step--has-icon .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary);border-radius:var(--solely-border-radius-circle)}.step--has-icon.step--finish .step__icon-wrapper,.step--has-icon.step--process .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary)}.step--has-icon.step--error .step__icon-wrapper{background:var(--solely-error-light);color:var(--solely-error)}.step--has-icon.step--wait .step__icon-wrapper{background:#0000000a;color:var(--solely-text-quaternary)}.step--has-icon.step--process .step__icon,.step--has-icon.step--finish .step__icon{color:var(--solely-primary)}.step--has-icon.step--error .step__icon{color:var(--solely-error)}.step--has-icon.step--wait .step__icon{color:var(--solely-text-quaternary)}.step__icon-wrapper--blue{background-color:var(--solely-primary-light)!important;color:var(--solely-primary)!important}.step__icon-wrapper--green{background-color:var(--solely-success-light)!important;color:var(--solely-success)!important}.step__icon-wrapper--red{background-color:var(--solely-error-light)!important;color:var(--solely-error)!important}.step__icon-wrapper--orange{background-color:var(--solely-warning-light)!important;color:var(--solely-warning)!important}.step__icon-wrapper--gray{background-color:#0000000a!important;color:var(--solely-text-tertiary)!important}.steps--dot{--step-icon-size: 8px;--step-icon-inner: 8px;--step-gap: 6px;--step-tail-offset: 6px}.steps--dot .step__icon{border:none;background:var(--solely-text-quaternary);font-size:0}.steps--dot .step__icon-text,.steps--dot .step__icon-substitution{display:none}.steps--dot .step--process .step__icon{background:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.steps--dot .step--finish .step__icon{background:var(--solely-primary)}.steps--dot .step--error .step__icon{background:var(--solely-error)}.steps--dot.steps--horizontal .step__tail{top:calc(var(--step-icon-size) / 2 - 1px)}.steps--dot.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 12px);min-height:calc(var(--step-icon-size) + 8px)}.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 12px))}.steps--dot.steps--vertical .step__tail{left:calc(var(--step-icon-size) / 2 - 1px);top:calc(var(--step-icon-size) + 4px);bottom:4px;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--dot.steps--vertical .step__title{line-height:var(--step-icon-size);padding-bottom:4px}.steps--sm{--step-icon-size: 24px;--step-icon-inner: 20px;--step-dot-size: 6px;--step-gap: 6px;--step-tail-offset: 8px}.steps--sm .step__title{font-size:var(--solely-font-size-sm);line-height:20px}.steps--sm .step__description,.steps--sm .step__icon{font-size:var(--solely-font-size-sm)}.steps--sm .step__icon-substitution{font-size:14px}.steps--sm.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px)}.steps--sm.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 4px))}.steps--sm.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--sm.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 8px);min-height:calc(var(--step-dot-size) + 6px)}.steps--sm.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 8px))}.steps--sm.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--sm.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:2px}.steps--sm.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps--lg{--step-icon-size: 40px;--step-icon-inner: 32px;--step-dot-size: 10px;--step-gap: 10px;--step-tail-offset: 16px}.steps--lg .step__title{font-size:var(--solely-font-size-lg);line-height:24px}.steps--lg .step__description{font-size:var(--solely-font-size-md);line-height:22px}.steps--lg .step__icon{font-size:var(--solely-font-size-lg)}.steps--lg .step__icon-substitution{font-size:20px}.steps--lg.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 6px)}.steps--lg.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 6px))}.steps--lg.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--lg.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 14px);min-height:calc(var(--step-dot-size) + 10px)}.steps--lg.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 14px))}.steps--lg.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--lg.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:6px}.steps--lg.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}";export{e as default};
|
|
1
|
+
const e="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%}.steps{--step-icon-size: 32px;--step-icon-inner: 26px;--step-dot-size: 8px;--step-tail-thickness: 2px;--step-gap: 8px;--step-tail-offset: 12px;width:100%;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:var(--solely-line-height-md);box-sizing:border-box}.step{position:relative;cursor:pointer}.step__wrapper{position:relative;z-index:1;display:flex}.step__icon-wrapper{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--step-icon-size);height:var(--step-icon-size)}.step__icon{display:flex;align-items:center;justify-content:center;width:var(--step-icon-inner);height:var(--step-icon-inner);font-size:var(--solely-font-size-md);line-height:1;border-radius:var(--solely-border-radius-circle);border:2px solid transparent;transition:all var(--solely-transition-duration) var(--solely-transition-timing);box-sizing:border-box}.step__title{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-md);line-height:22px}.step__description{color:var(--solely-text-tertiary);font-size:var(--solely-font-size-sm);line-height:20px;margin-top:4px}.steps--horizontal{display:flex;text-align:center}.steps--horizontal .step{flex:1;overflow:visible}.steps--horizontal .step__wrapper{flex-direction:column;align-items:center;width:100%}.steps--horizontal .step__tail{position:absolute;top:calc(var(--step-icon-size) / 2);left:calc(50% + var(--step-tail-offset));width:calc(100% - 2 * var(--step-tail-offset));height:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--horizontal .step:last-child .step__tail{display:none}.steps--horizontal .step__content{margin-top:var(--step-gap);word-break:break-word}.steps--vertical{display:flex;flex-direction:column}.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px);min-height:var(--step-icon-size)}.steps--vertical .step__wrapper{flex-direction:row;align-items:flex-start}.steps--vertical .step__icon-wrapper{position:absolute;left:calc(-1 * (var(--step-icon-size) + 4px));top:0}.steps--vertical .step__tail{position:absolute;left:calc(var(--step-icon-size) / 2 - 1px);top:var(--step-icon-size);bottom:0;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--vertical .step:last-child .step__tail{display:none}.steps--vertical .step__content{flex:1;min-width:0}.steps--vertical .step__title{line-height:var(--step-icon-size)}.step--wait .step__icon{background:var(--solely-gray-4);border-color:var(--solely-text-quaternary);color:var(--solely-text-quaternary)}.step--process .step__icon{background:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.step--process .step__title{color:var(--solely-text-primary);font-weight:500}.step--finish .step__icon{background:var(--solely-gray-4);border-color:var(--solely-primary);color:var(--solely-primary)}.step--finish .step__title{color:var(--solely-text-primary)}.step--finish .step__tail{background:var(--solely-primary)!important}.step--error .step__icon{background:var(--solely-gray-4);border-color:var(--solely-error);color:var(--solely-error)}.step--error .step__title{color:var(--solely-error)}.step--disabled,.step--disabled *{cursor:not-allowed}.step:not(.step--disabled):hover .step__title{color:var(--solely-primary)}.step:not(.step--disabled):hover .step__icon{border-color:var(--solely-primary)}.step--has-icon:not(.step--disabled):hover .step__icon{color:var(--solely-primary)}.step--has-icon .step__icon{background:transparent!important;border:none!important;width:auto;height:auto;margin:0;font-size:24px}.step--has-icon .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary);border-radius:var(--solely-border-radius-circle)}.step--has-icon.step--finish .step__icon-wrapper,.step--has-icon.step--process .step__icon-wrapper{background:var(--solely-primary-light);color:var(--solely-primary)}.step--has-icon.step--error .step__icon-wrapper{background:var(--solely-error-light);color:var(--solely-error)}.step--has-icon.step--wait .step__icon-wrapper{background:#0000000a;color:var(--solely-text-quaternary)}.step--has-icon.step--process .step__icon,.step--has-icon.step--finish .step__icon{color:var(--solely-primary)}.step--has-icon.step--error .step__icon{color:var(--solely-error)}.step--has-icon.step--wait .step__icon{color:var(--solely-text-quaternary)}.step__icon-wrapper--blue{background-color:var(--solely-primary-light)!important;color:var(--solely-primary)!important}.step__icon-wrapper--green{background-color:var(--solely-success-light)!important;color:var(--solely-success)!important}.step__icon-wrapper--red{background-color:var(--solely-error-light)!important;color:var(--solely-error)!important}.step__icon-wrapper--orange{background-color:var(--solely-warning-light)!important;color:var(--solely-warning)!important}.step__icon-wrapper--gray{background-color:#0000000a!important;color:var(--solely-text-tertiary)!important}.steps--dot{--step-icon-size: 8px;--step-icon-inner: 8px;--step-gap: 6px;--step-tail-offset: 6px}.steps--dot .step__icon{border:none;background:var(--solely-text-quaternary);font-size:0}.steps--dot .step__icon-text,.steps--dot .step__icon-substitution{display:none}.steps--dot .step--process .step__icon{background:var(--solely-primary);box-shadow:0 0 0 2px var(--solely-primary-light)}.steps--dot .step--finish .step__icon{background:var(--solely-primary)}.steps--dot .step--error .step__icon{background:var(--solely-error)}.steps--dot.steps--horizontal .step__tail{top:calc(var(--step-icon-size) / 2 - 1px)}.steps--dot.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 12px);min-height:calc(var(--step-icon-size) + 8px)}.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 12px))}.steps--dot.steps--vertical .step__tail{left:calc(var(--step-icon-size) / 2 - 1px);top:calc(var(--step-icon-size) + 4px);bottom:4px;width:var(--step-tail-thickness);background:var(--solely-border-color);transition:background var(--solely-transition-duration);z-index:0}.steps--dot.steps--vertical .step__title{line-height:var(--step-icon-size);padding-bottom:4px}.steps--sm{--step-icon-size: 24px;--step-icon-inner: 20px;--step-dot-size: 6px;--step-gap: 6px;--step-tail-offset: 8px}.steps--sm .step__title{font-size:var(--solely-font-size-sm);line-height:20px}.steps--sm .step__description,.steps--sm .step__icon{font-size:var(--solely-font-size-sm)}.steps--sm .step__icon-substitution{font-size:14px}.steps--sm.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 4px)}.steps--sm.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 4px))}.steps--sm.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--sm.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 8px);min-height:calc(var(--step-dot-size) + 6px)}.steps--sm.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 8px))}.steps--sm.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--sm.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:2px}.steps--sm.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps--lg{--step-icon-size: 40px;--step-icon-inner: 32px;--step-dot-size: 10px;--step-gap: 10px;--step-tail-offset: 16px}.steps--lg .step__title{font-size:var(--solely-font-size-lg);line-height:24px}.steps--lg .step__description{font-size:var(--solely-font-size-md);line-height:22px}.steps--lg .step__icon{font-size:var(--solely-font-size-lg)}.steps--lg .step__icon-substitution{font-size:20px}.steps--lg.steps--vertical .step{padding-left:calc(var(--step-icon-size) + 6px)}.steps--lg.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-icon-size) + 6px))}.steps--lg.steps--vertical .step__title{line-height:var(--step-icon-size)}.steps--lg.steps--dot.steps--vertical .step{padding-left:calc(var(--step-dot-size) + 14px);min-height:calc(var(--step-dot-size) + 10px)}.steps--lg.steps--dot.steps--vertical .step__icon-wrapper{left:calc(-1 * (var(--step-dot-size) + 14px))}.steps--lg.steps--dot.steps--vertical .step__tail{top:calc(var(--step-dot-size) + 4px)}.steps--lg.steps--dot.steps--vertical .step__title{line-height:var(--step-dot-size);padding-bottom:6px}.steps--lg.steps--dot.steps--horizontal .step__icon{width:var(--step-dot-size);height:var(--step-dot-size)}.steps__slot-content{display:flex;flex-direction:row}.steps--vertical .steps__slot-content{flex-direction:column}.steps__slot-content ::slotted([data-step]),.steps__slot-content>[data-step]{display:flex;flex:1;position:relative;cursor:pointer}.steps__slot-content ::slotted([data-step][disabled]),.steps__slot-content>[data-step][disabled]{cursor:not-allowed;opacity:.5}";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySwitch=class extends a.default{getSwitchClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["switch--sm"]=!0:"large"===t?e["switch--lg"]=!0:e["switch--md"]=!0,e[`switch--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-disabled"]=!!this.$data.disabled,e["is-loading"]=!!this.$data.loading,e}handleClick(){this.$data.disabled||this.$data.loading||this.toggle()}handleKeyDown(e){this.$data.disabled||this.$data.loading||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}toggle(){if(this.$data.disabled||this.$data.loading)return;const e=!this.$data.checked;this.setChecked(e),this.dispatchChangeEvent()}dispatchChangeEvent(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}},exports.SolelySwitch=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-switch",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"type",type:"string",default:"primary"},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"checkedChildren",type:"string",default:""},{name:"unCheckedChildren",type:"string",default:""}],model:{prop:"checked",event:"change"}})],exports.SolelySwitch);
|
|
@@ -15,10 +15,15 @@ declare class SolelySwitch extends BaseElement<SwitchProps, SwitchRefs> {
|
|
|
15
15
|
handleKeyDown(event: KeyboardEvent): void;
|
|
16
16
|
/**
|
|
17
17
|
* 切换开关状态
|
|
18
|
+
* 用户交互时调用,会检查 disabled/loading 并派发事件
|
|
18
19
|
*/
|
|
19
20
|
toggle(): void;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* 派发 change 事件
|
|
23
|
+
*/
|
|
24
|
+
private dispatchChangeEvent;
|
|
25
|
+
/**
|
|
26
|
+
* 设置开关状态(仅更新数据,不派发事件)
|
|
22
27
|
* @param checked - 新的开关状态
|
|
23
28
|
*/
|
|
24
29
|
setChecked(checked: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{getSwitchClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["switch--sm"]=!0:"large"===t?e["switch--lg"]=!0:e["switch--md"]=!0,e[`switch--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-disabled"]=!!this.$data.disabled,e["is-loading"]=!!this.$data.loading,e}handleClick(){this.$data.disabled||this.$data.loading||this.toggle()}handleKeyDown(e){this.$data.disabled||this.$data.loading||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}toggle(){const e=!this.$data.checked;this.setChecked(e)}
|
|
1
|
+
import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{getSwitchClasses(){const e={},t=this.$data.size||"medium",a=this.$data.type||"primary";return"small"===t?e["switch--sm"]=!0:"large"===t?e["switch--lg"]=!0:e["switch--md"]=!0,e[`switch--${a}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-disabled"]=!!this.$data.disabled,e["is-loading"]=!!this.$data.loading,e}handleClick(){this.$data.disabled||this.$data.loading||this.toggle()}handleKeyDown(e){this.$data.disabled||this.$data.loading||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}toggle(){if(this.$data.disabled||this.$data.loading)return;const e=!this.$data.checked;this.setChecked(e),this.dispatchChangeEvent()}dispatchChangeEvent(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.blur()}mounted(){this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-switch",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"type",type:"string",default:"primary"},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"checkedChildren",type:"string",default:""},{name:"unCheckedChildren",type:"string",default:""}],model:{prop:"checked",event:"change"}})],d);export{d as SolelySwitch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e,s,i,a,n,o,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,S,$,k=Object.defineProperty,O=t=>{throw TypeError(t)},j=(t,e,s)=>e.has(t)||O("Cannot "+s),C=(t,e,s)=>(j(t,e,"read from private field"),s?s.call(t):e.get(t)),A=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),W=(t,e,s,i)=>(j(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(j(t,e,"access private method"),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("../../shared/is-object.cjs"),D=require("../../shared/env.cjs"),P=require("../reactivity/observe.cjs"),U=require("../renderer/renderIR.cjs"),q=Symbol.for("solely.manifest"),I=class m extends HTMLElement{constructor(d={}){var f,m;super(),A(this,p),((t,e,s)=>{e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),A(this,t),A(this,e),A(this,s),A(this,i),A(this,a),A(this,n),A(this,o,!1),A(this,r,!1),A(this,h,!1),A(this,l,!1),A(this,c,!1),A(this,u,!1);const v=this.constructor;W(this,t,v[q]||{tagName:"base-element"});const w=C(this,t);W(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,$).call(this))}static get observedAttributes(){const t=this[q];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return C(this,i)}set $data(t){var e;E.isObject(t)||(t={}),t!==C(this,i)&&(null==(e=C(this,n))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;W(this,c,!0);const n=C(this,t);if(N(this,p,$).call(this),(n.className||n.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,S).call(this),n.attributeMap&&E.isObject(this.$data)){N(this,p,v).call(this);for(const[t,e]of n.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),C(this,s)&&!C(this,e)&&W(this,e,U.createRender(C(this,s),C(this,a),this)),C(this,u)&&(W(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;W(this,c,!1);const i=C(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=C(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),C(m,d).delete(t)):C(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E.isObject(this.$data))return;const n=null==(a=C(this,t).attributeMap)?void 0:a.get(e);if(!n)return;const o=n.name,r=this.$data[o],l=N(this,p,w).call(this,i,n.default??r,n.type);this.$data[o]=l,W(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,n=new WeakMap,o=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let n,o=this;for(;o&&(n=Object.getOwnPropertyDescriptor(o,i),!(null==n?void 0:n.set));)o=Object.getPrototypeOf(o);(null==n?void 0:n.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=P.observe(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,n=C(this,t),o=String(i),r=null==(s=n.propMap)?void 0:s.get(o);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});W(this,i,s),W(this,n,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}},y=function(t){t.ir&&W(this,s,t.ir)},v=function(){const e=C(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){C(this,c)?!C(this,r)&&C(this,e)&&(W(this,r,!0),queueMicrotask(()=>{W(this,r,!1),N(this,p,M).call(this)})):W(this,u,!0)},M=function(){if(!C(this,o)&&C(this,c)){W(this,o,!0);try{C(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),C(this,e).update(),this.updated(),C(this,h)&&(this.afterAttributesUpdate(),W(this,h,!1))}finally{W(this,o,!1)}}},S=function(){var e;const s=C(this,t);if(!s.styles)return;const i=C(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const n=i instanceof ShadowRoot?i:document.head,o=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!n.querySelector(`#${o}`)){const t=document.createElement("style");t.id=o,t.textContent=s.styles,n.appendChild(t)}if(r){const t=C(I,d).get(o)||0;C(I,d).set(o,t+1)}},$=function(){C(this,l)||(W(this,l,!0),this.created())},A(I,d,new Map),(()=>{if(D.IS_DEV&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(I.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==I.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let _=I;exports.default=_;
|
|
1
|
+
"use strict";var t,e,s,i,a,n,o,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,S,$,k=Object.defineProperty,O=t=>{throw TypeError(t)},j=(t,e,s)=>e.has(t)||O("Cannot "+s),C=(t,e,s)=>(j(t,e,"read from private field"),s?s.call(t):e.get(t)),A=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),W=(t,e,s,i)=>(j(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(j(t,e,"access private method"),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("../../shared/is-object.cjs"),D=require("../../shared/env.cjs"),P=require("../reactivity/observe.cjs"),U=require("../renderer/renderIR.cjs"),q=Symbol.for("solely.manifest"),I=class m extends HTMLElement{constructor(d={}){var f,m;super(),A(this,p),((t,e,s)=>{e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),A(this,t),A(this,e),A(this,s),A(this,i),A(this,a),A(this,n),A(this,o,!1),A(this,r,!1),A(this,h,!1),A(this,l,!1),A(this,c,!1),A(this,u,!1);const v=this.constructor;W(this,t,v[q]||{tagName:"base-element"});const w=C(this,t);W(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,$).call(this))}static get observedAttributes(){const t=this[q];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return C(this,i)}set $data(t){var e;E.isObject(t)||(t={}),t!==C(this,i)&&(null==(e=C(this,n))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;W(this,c,!0);const n=C(this,t);if(N(this,p,$).call(this),(n.className||n.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,S).call(this),n.attributeMap&&E.isObject(this.$data)){N(this,p,v).call(this);for(const[t,e]of n.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),C(this,s)&&!C(this,e)&&W(this,e,U.createRender(C(this,s),C(this,a),this)),C(this,u)&&(W(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;W(this,c,!1);const i=C(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=C(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),C(m,d).delete(t)):C(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E.isObject(this.$data))return;const n=null==(a=C(this,t).attributeMap)?void 0:a.get(e);if(!n)return;const o=n.name,r=this.$data[o],l=N(this,p,w).call(this,i,n.default??r,n.type);this.$data[o]=l,W(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,n=new WeakMap,o=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let n,o=this;for(;o&&(n=Object.getOwnPropertyDescriptor(o,i),!(null==n?void 0:n.set));)o=Object.getPrototypeOf(o);(null==n?void 0:n.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=P.observe(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,n=C(this,t),o=String(i),r=null==(s=n.propMap)?void 0:s.get(o);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});W(this,i,s),W(this,n,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}},y=function(t){t.ir&&W(this,s,t.ir)},v=function(){const e=C(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){C(this,c)?!C(this,r)&&C(this,e)&&(W(this,r,!0),queueMicrotask(()=>{W(this,r,!1),N(this,p,M).call(this)})):W(this,u,!0)},M=function(){if(!C(this,o)&&C(this,c)){W(this,o,!0);try{C(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),C(this,e).update(),this.updated(),C(this,h)&&(this.afterAttributesUpdate(),W(this,h,!1))}finally{W(this,o,!1)}}},S=function(){var e;const s=C(this,t);if(!s.styles)return;const i=C(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const n=i instanceof ShadowRoot?i:document.head,o=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!n.querySelector(`#${o}`)){const t=document.createElement("style");t.id=o,t.textContent=s.styles,n.appendChild(t)}if(r){const t=C(I,d).get(o)||0;C(I,d).set(o,t+1)}},$=function(){C(this,l)||(W(this,l,!0),this.created())},A(I,d,new Map),(()=>{if(D.IS_DEV&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(I.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==I.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let _=I;exports.default=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e,s,i,a,o,n,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,$,k,S=Object.defineProperty,O=t=>{throw TypeError(t)},C=(t,e,s)=>e.has(t)||O("Cannot "+s),A=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),W=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),j=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(C(t,e,"access private method"),s);import{isObject as E}from"../../shared/is-object.js";import{IS_DEV as P}from"../../shared/env.js";import{observe as U}from"../reactivity/observe.js";import{createRender as D}from"../renderer/renderIR.js";const L=Symbol.for("solely.manifest"),q=class m extends HTMLElement{constructor(d={}){var f,m;super(),W(this,p),((t,e,s)=>{e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),W(this,t),W(this,e),W(this,s),W(this,i),W(this,a),W(this,o),W(this,n,!1),W(this,r,!1),W(this,h,!1),W(this,l,!1),W(this,c,!1),W(this,u,!1);const v=this.constructor;j(this,t,v[L]||{tagName:"base-element"});const w=A(this,t);j(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,k).call(this))}static get observedAttributes(){const t=this[L];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return A(this,i)}set $data(t){var e;E(t)||(t={}),t!==A(this,i)&&(null==(e=A(this,o))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;j(this,c,!0);const o=A(this,t);if(N(this,p,k).call(this),(o.className||o.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,$).call(this),o.attributeMap&&E(this.$data)){N(this,p,v).call(this);for(const[t,e]of o.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),A(this,s)&&!A(this,e)&&j(this,e,D(A(this,s),A(this,a),this)),A(this,u)&&(j(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;j(this,c,!1);const i=A(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=A(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),A(m,d).delete(t)):A(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E(this.$data))return;const o=null==(a=A(this,t).attributeMap)?void 0:a.get(e);if(!o)return;const n=o.name,r=this.$data[n],l=N(this,p,w).call(this,i,o.default??r,o.type);this.$data[n]=l,j(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let o,n=this;for(;n&&(o=Object.getOwnPropertyDescriptor(n,i),!(null==o?void 0:o.set));)n=Object.getPrototypeOf(n);(null==o?void 0:o.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=U(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,o=A(this,t),n=String(i),r=null==(s=o.propMap)?void 0:s.get(n);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});j(this,i,s),j(this,o,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}},y=function(t){t.ir&&j(this,s,t.ir)},v=function(){const e=A(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){A(this,c)?!A(this,r)&&A(this,e)&&(j(this,r,!0),queueMicrotask(()=>{j(this,r,!1),N(this,p,M).call(this)})):j(this,u,!0)},M=function(){if(!A(this,n)&&A(this,c)){j(this,n,!0);try{A(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,e).update(),this.updated(),A(this,h)&&(this.afterAttributesUpdate(),j(this,h,!1))}finally{j(this,n,!1)}}},$=function(){var e;const s=A(this,t);if(!s.styles)return;const i=A(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const o=i instanceof ShadowRoot?i:document.head,n=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!o.querySelector(`#${n}`)){const t=document.createElement("style");t.id=n,t.textContent=s.styles,o.appendChild(t)}if(r){const t=A(q,d).get(n)||0;A(q,d).set(n,t+1)}},k=function(){A(this,l)||(j(this,l,!0),this.created())},W(q,d,new Map),(()=>{if(P&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(q.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==q.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let x=q;export{x as default};
|
|
1
|
+
var t,e,s,i,a,o,n,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,$,k,S=Object.defineProperty,O=t=>{throw TypeError(t)},C=(t,e,s)=>e.has(t)||O("Cannot "+s),A=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),W=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),j=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(C(t,e,"access private method"),s);import{isObject as E}from"../../shared/is-object.js";import{IS_DEV as P}from"../../shared/env.js";import{observe as U}from"../reactivity/observe.js";import{createRender as D}from"../renderer/renderIR.js";const L=Symbol.for("solely.manifest"),q=class m extends HTMLElement{constructor(d={}){var f,m;super(),W(this,p),((t,e,s)=>{e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),W(this,t),W(this,e),W(this,s),W(this,i),W(this,a),W(this,o),W(this,n,!1),W(this,r,!1),W(this,h,!1),W(this,l,!1),W(this,c,!1),W(this,u,!1);const v=this.constructor;j(this,t,v[L]||{tagName:"base-element"});const w=A(this,t);j(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,k).call(this))}static get observedAttributes(){const t=this[L];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return A(this,i)}set $data(t){var e;E(t)||(t={}),t!==A(this,i)&&(null==(e=A(this,o))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;j(this,c,!0);const o=A(this,t);if(N(this,p,k).call(this),(o.className||o.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,$).call(this),o.attributeMap&&E(this.$data)){N(this,p,v).call(this);for(const[t,e]of o.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),A(this,s)&&!A(this,e)&&j(this,e,D(A(this,s),A(this,a),this)),A(this,u)&&(j(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;j(this,c,!1);const i=A(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=A(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),A(m,d).delete(t)):A(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E(this.$data))return;const o=null==(a=A(this,t).attributeMap)?void 0:a.get(e);if(!o)return;const n=o.name,r=this.$data[n],l=N(this,p,w).call(this,i,o.default??r,o.type);this.$data[n]=l,j(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let o,n=this;for(;n&&(o=Object.getOwnPropertyDescriptor(n,i),!(null==o?void 0:o.set));)n=Object.getPrototypeOf(n);(null==o?void 0:o.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=U(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,o=A(this,t),n=String(i),r=null==(s=o.propMap)?void 0:s.get(n);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});j(this,i,s),j(this,o,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}},y=function(t){t.ir&&j(this,s,t.ir)},v=function(){const e=A(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){A(this,c)?!A(this,r)&&A(this,e)&&(j(this,r,!0),queueMicrotask(()=>{j(this,r,!1),N(this,p,M).call(this)})):j(this,u,!0)},M=function(){if(!A(this,n)&&A(this,c)){j(this,n,!0);try{A(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,e).update(),this.updated(),A(this,h)&&(this.afterAttributesUpdate(),j(this,h,!1))}finally{j(this,n,!1)}}},$=function(){var e;const s=A(this,t);if(!s.styles)return;const i=A(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const o=i instanceof ShadowRoot?i:document.head,n=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!o.querySelector(`#${n}`)){const t=document.createElement("style");t.id=n,t.textContent=s.styles,o.appendChild(t)}if(r){const t=A(q,d).get(n)||0;A(q,d).set(n,t+1)}},k=function(){A(this,l)||(j(this,l,!0),this.created())},W(q,d,new Map),(()=>{if(P&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(q.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==q.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let x=q;export{x as default};
|
|
@@ -19,6 +19,15 @@ export interface PropDescriptor {
|
|
|
19
19
|
*/
|
|
20
20
|
reactive?: boolean;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Model 配置:定义 s-model 双向绑定的属性名和事件名
|
|
24
|
+
*/
|
|
25
|
+
export interface ModelConfig {
|
|
26
|
+
/** 要绑定的属性名,默认为 'value' */
|
|
27
|
+
prop?: string;
|
|
28
|
+
/** 监听的事件名,默认为 'change' */
|
|
29
|
+
event?: string;
|
|
30
|
+
}
|
|
22
31
|
/**
|
|
23
32
|
* Manifest:组件声明配置
|
|
24
33
|
* -------------------------------------------------------
|
|
@@ -40,6 +49,8 @@ export interface Manifest {
|
|
|
40
49
|
className?: string;
|
|
41
50
|
/** 注册的自定义元素标签名 */
|
|
42
51
|
tagName: string;
|
|
52
|
+
/** s-model 双向绑定配置 */
|
|
53
|
+
model?: ModelConfig;
|
|
43
54
|
}
|
|
44
55
|
/** 框架内部使用的运行时版本 */
|
|
45
56
|
export interface InternalManifest extends Manifest {
|
package/package.json
CHANGED