@fluid-topics/ft-size-watcher 2.2.56 → 2.2.57
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.
|
@@ -68,7 +68,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:r.extend("--ftds-con
|
|
|
68
68
|
width:auto;
|
|
69
69
|
height:auto;
|
|
70
70
|
}
|
|
71
|
-
`;var Pn={};I(Pn,{withAriaNotification:()=>vu});var Su={checkVisibility:!0},vu=j(Symbol("withAriaNotification"),function(t){class e extends t{sendAriaNotification(n,i){let{checkVisibility:a}={...Su,...i};setTimeout(()=>{(!a||this.checkVisibility())&&(n=typeof n=="string"?n:n?.message,n&&this.dispatchEvent(new Ct({type:"aria",message:n})))},20)}}return e});var Fn={};I(Fn,{withConditionalVisibility:()=>Ou});var nc=function(t,e,o,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(i<3?s(a):i>3?s(e,o,a):s(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};function Ou(t){class e extends t{constructor(){super(...arguments),this.forceVisible=!1,this.isVisible=!0,this.isElementWithConditionalVisibility=!0}calculateStyles(n,i){if(n){let a=document.createElement("style");a.classList.add("conditional-visibility-style"),a.innerHTML=i,this.shadowRoot.append(a)}}hideIfNecessary(){let n=!(this.forceVisible||this.isVisible);this.calculateStyles(n,":host { display: none !important; }")}highlightIfForceVisible(){this.calculateStyles(this.forceVisible,":host { box-shadow: 0px 0px 0px 8px rgba(227,119,59,0.4) inset; }")}willUpdate(n){super.willUpdate(n),this.updateComplete.then(()=>{this.shadowRoot.querySelectorAll(".conditional-visibility-style").forEach(i=>i.remove()),this.hideIfNecessary(),this.highlightIfForceVisible()})}}return nc([T({type:Boolean,attribute:!1})],e.prototype,"forceVisible",void 0),nc([H()],e.prototype,"isVisible",void 0),e}var Mn={};I(Mn,{FormController:()=>Dn});function Cu(t){let e={};for(let o of Object.keys(t))e[o]=t[o].initial;return e}var Dn=class{constructor(e,o){this.host=e,this.config=o,this.errors=new Map,this.submitting=!1,e.addController(this),this.initial=Cu(o),this.data={...this.initial}}hostDisconnected(){this.submitting=!1}get values(){return this.data}get fields(){return Object.keys(this.config)}get isSubmitting(){return this.submitting}get inError(){return this.errors.size>0}value(e){return this.data[e]}hasError(e){return this.errors.has(e)}errorFor(e){return this.errors.get(e)}setValue(e,o){if(this.data[e]===o)return;let n={...this.data};n[e]=o,this.data=n,this.
|
|
71
|
+
`;var Pn={};I(Pn,{withAriaNotification:()=>vu});var Su={checkVisibility:!0},vu=j(Symbol("withAriaNotification"),function(t){class e extends t{sendAriaNotification(n,i){let{checkVisibility:a}={...Su,...i};setTimeout(()=>{(!a||this.checkVisibility())&&(n=typeof n=="string"?n:n?.message,n&&this.dispatchEvent(new Ct({type:"aria",message:n})))},20)}}return e});var Fn={};I(Fn,{withConditionalVisibility:()=>Ou});var nc=function(t,e,o,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(i<3?s(a):i>3?s(e,o,a):s(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};function Ou(t){class e extends t{constructor(){super(...arguments),this.forceVisible=!1,this.isVisible=!0,this.isElementWithConditionalVisibility=!0}calculateStyles(n,i){if(n){let a=document.createElement("style");a.classList.add("conditional-visibility-style"),a.innerHTML=i,this.shadowRoot.append(a)}}hideIfNecessary(){let n=!(this.forceVisible||this.isVisible);this.calculateStyles(n,":host { display: none !important; }")}highlightIfForceVisible(){this.calculateStyles(this.forceVisible,":host { box-shadow: 0px 0px 0px 8px rgba(227,119,59,0.4) inset; }")}willUpdate(n){super.willUpdate(n),this.updateComplete.then(()=>{this.shadowRoot.querySelectorAll(".conditional-visibility-style").forEach(i=>i.remove()),this.hideIfNecessary(),this.highlightIfForceVisible()})}}return nc([T({type:Boolean,attribute:!1})],e.prototype,"forceVisible",void 0),nc([H()],e.prototype,"isVisible",void 0),e}var Mn={};I(Mn,{FormController:()=>Dn});function Cu(t){let e={};for(let o of Object.keys(t))e[o]=t[o].initial;return e}var Dn=class{constructor(e,o){this.host=e,this.config=o,this.errors=new Map,this.submitting=!1,e.addController(this),this.initial=Cu(o),this.data={...this.initial}}hostDisconnected(){this.submitting=!1}get values(){return this.data}get fields(){return Object.keys(this.config)}get isSubmitting(){return this.submitting}get inError(){return this.errors.size>0}value(e){return this.data[e]}hasError(e){return this.errors.has(e)}errorFor(e){return this.errors.get(e)}setValue(e,o){if(this.data[e]===o)return;let n={...this.data};n[e]=o,this.data=n,this.errors.delete(e),this.validateField(e),this.host.requestUpdate()}bind(e){return o=>this.setValue(e,o.detail)}setInitialValues(e){this.initial={...e},this.reset()}reset(){this.data={...this.initial},this.errors.clear(),this.submitting=!1,this.host.requestUpdate()}validateField(e,o){var n,i;let a=(i=(n=this.config[e]).validator)===null||i===void 0?void 0:i.call(n,this.value(e),this.data,o);a!==void 0&&this.errors.set(e,a)}checkValidity(e){return this.errors.clear(),this.fields.forEach(o=>{this.validateField(o,e)}),this.host.requestUpdate(),!this.inError}get firstFieldSelectorInError(){for(let e of this.fields){let o=this.config[e].selector;if(this.errors.has(e)&&o!==void 0)return o}}focusFirstFieldInError(){let e=this.firstFieldSelectorInError;if(e===void 0)return;let o=this.host.renderRoot.querySelector(e);o instanceof HTMLElement&&o.focus()}async submit(e){var o,n,i;if(!this.submitting){this.submitting=!0,this.host.requestUpdate();try{if(!this.checkValidity()){this.focusFirstFieldInError(),(o=e.onInvalid)===null||o===void 0||o.call(e);return}e.onSuccess(await e.request(this.data))}catch(a){let s=yo(a)?a:void 0;if(!this.checkValidity(s)){this.focusFirstFieldInError(),(n=e.onInvalid)===null||n===void 0||n.call(e);return}(i=e.onFailure)===null||i===void 0||i.call(e,s)}finally{this.submitting=!1,this.host.requestUpdate()}}}};var Bn={};I(Bn,{MetadataValueLocalizer:()=>Un});var Un=class{constructor(e){this.contentLocales=e}localize(e){var o,n;return e?.key!=="ft:locale"?e:{...e,displayValue:(o=this.findLocaleValue(e))!==null&&o!==void 0?o:e.displayValue,displayTooltipValue:(n=this.findLocaleValue(e))!==null&&n!==void 0?n:e.displayTooltipValue}}findLocaleValue(e){var o;return(o=this.contentLocales.find(n=>n.lang===e.value))===null||o===void 0?void 0:o.label}};function $n(t,e){return e.map(o=>o(t)).filter(o=>o!==!0).map(o=>o)}function ic(t,e,o){return t?e(t):o?.(t)}var B=function(t,e,o,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(i<3?s(a):i>3?s(e,o,a):s(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},Ge;(function(t){t.blur="blur",t.blurWithStatusResolutionOnInput="blurWithStatusResolutionOnInput",t.input="input"})(Ge||(Ge={}));var he;(function(t){t.default="default",t.warning="warning",t.error="error"})(he||(he={}));var Wt=class extends CustomEvent{constructor(e){super("input-validated",{detail:{level:e}})}};var Hb=j(Symbol("toFtInput"),function(t){class e extends t{constructor(){super(...arguments),this.warningRules=[],this.errorRules=[],this.validateOn=Ge.blurWithStatusResolutionOnInput,this.validateAtRender=!1,this.label="",this.hideLabel=!1,this.name="",this.disabled=!1,this.errorMessages=[],this.warningMessages=[],this.status=he.default,this.focused=!1,this.additionalWarningRules=[],this.additionalErrorRules=[],this.externalErrorMessages=[],this.ruleErrorMessages=[]}willUpdate(n){super.willUpdate(n),n.has("externalErrorMessages")&&(this.errorMessages=[...this.externalErrorMessages,...this.ruleErrorMessages],this.status=this.resolveStatus(),this.dispatchEvent(new Wt(this.status)))}connectedCallback(){super.connectedCallback(),this.validateAtRender&&this.triggerValidation()}onBlur(){this.focused=!1,(this.validateOn===Ge.blur||this.validateOn===Ge.blurWithStatusResolutionOnInput)&&this.triggerValidation()}onFocus(){this.focused=!0}onInput(){this.externalErrorMessages.length>0&&(this.externalErrorMessages=[]),(this.status!==he.default&&this.validateOn===Ge.blurWithStatusResolutionOnInput||this.validateOn===Ge.input)&&this.triggerValidation()}triggerValidation(){this.ruleErrorMessages=$n(this.value,[...this.errorRules,...this.additionalErrorRules]),this.errorMessages=[...this.externalErrorMessages,...this.ruleErrorMessages],this.warningMessages=$n(this.value,[...this.warningRules,...this.additionalWarningRules]),this.status=this.resolveStatus(),this.dispatchEvent(new Wt(this.status))}resetValidation(){this.externalErrorMessages=[],this.ruleErrorMessages=[],this.errorMessages=[],this.warningMessages=[],this.status=this.resolveStatus(),this.dispatchEvent(new Wt(this.status))}get messagesForScreenReaderElementId(){return"sr-helper-text-list"}renderMessagesForScreenReader(){return me`
|
|
72
72
|
<ul aria-live="polite" id="${this.messagesForScreenReaderElementId}"
|
|
73
73
|
style="position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;list-style:none;">
|
|
74
74
|
${nr(this.errorMessages,n=>me`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-size-watcher",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.57",
|
|
4
4
|
"description": "Pixel component used to get viewport size",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "2.2.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "2.2.57",
|
|
23
23
|
"lit": "3.3.3"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "a902c6335614244438e63b068a745c42f1bafda5"
|
|
26
26
|
}
|