@simai-studio/ui 5.20261023.212 → 5.20261025.207
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/README.md +4 -4
- package/distr/component/button-group/css/button-group.min.css +1 -1
- package/distr/core/contracts/public-variables.v1.json +88 -0
- package/distr/core/contracts/third-party-notices.v1.json +1 -1
- package/distr/core/css/core.css +3 -2
- package/distr/core/js/composition/overlay.mjs +472 -24
- package/distr/core/js/composition/sortable-inserter.mjs +534 -0
- package/distr/core/js/core-loader.js +1 -1
- package/distr/core/js/core-loader.min.js +1 -1
- package/distr/core/js/core-rules.js +242 -185
- package/distr/core/js/core-rules.min.js +1 -1
- package/distr/core/js/open-surface-mark.js +88 -0
- package/distr/core/js/template-utilities.generated.json +3 -0
- package/distr/rule/js/rule.min.js +1 -1
- package/distr/rule/rule.json +47 -1
- package/distr/smart/color/css/color.min.css +1 -0
- package/distr/smart/color/js/color.min.js +36 -17
- package/distr/smart/color/smart.manifest.json +45 -4
- package/distr/smart/color/template/default.js +13 -2
- package/distr/smart/composition-overlay/css/composition-overlay.min.css +1 -1
- package/distr/smart/composition-overlay/js/composition-overlay.min.js +1 -1
- package/distr/smart/composition-overlay/smart.manifest.json +178 -11
- package/distr/smart/dropdown/css/dropdown.min.css +1 -0
- package/distr/smart/dropdown/js/dropdown.min.js +41 -21
- package/distr/smart/dropdown/smart.manifest.json +62 -3
- package/distr/smart/dropdown/template/default.js +5 -1
- package/distr/smart/field-renderers/js/field-renderers.min.js +54 -42
- package/distr/smart/image-field/css/image-field.min.css +1 -0
- package/distr/smart/image-field/js/image-field.min.js +62 -0
- package/distr/smart/image-field/smart.manifest.json +519 -0
- package/distr/smart/image-field/studio.fixture.json +15 -0
- package/distr/smart/image-field/studio.scenario.json +22 -0
- package/distr/smart/image-field/template/default.js +125 -0
- package/distr/smart/inputs/css/inputs.min.css +1 -0
- package/distr/smart/inputs/js/inputs.min.js +93 -75
- package/distr/smart/inputs/smart.manifest.json +62 -3
- package/distr/smart/inputs/template/default.js +8 -2
- package/distr/smart/sortable/css/sortable.min.css +1 -1
- package/distr/smart/sortable/js/sortable.min.js +1 -1
- package/distr/smart/sortable/smart.manifest.json +101 -14
- package/distr/smart/switch/css/switch.min.css +1 -0
- package/distr/smart/switch/js/switch.min.js +31 -13
- package/distr/smart/switch/smart.manifest.json +62 -3
- package/distr/smart/switch/template/default.js +2 -0
- package/distr/smart/textarea/css/textarea.min.css +1 -0
- package/distr/smart/textarea/js/textarea.min.js +51 -32
- package/distr/smart/textarea/smart.manifest.json +62 -3
- package/distr/smart/textarea/template/default.js +8 -1
- package/package-manifest.json +50 -39
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={"6064f55a0aa2"(e,t,s){s.a(e,async(e,t)=>{try{var n=s("7c1f9c2b36da"),i=e([n]);(0,(n=(i.then?(await i)():i)[0]).mH)(),globalThis.SF=globalThis.SF||{},globalThis.SF.Sortable=Object.freeze({SORTABLE_INTENT_EVENT:n.dd,SORTABLE_STATE_EVENT:n.WK,activeSortableSession:n.Ld,attach:n.q0,attachSortable:n.q0,registerSortableDropTarget:n.OE,sortableIndexAt:n.AI}),t()}catch(e){t(e)}})},"0d662e4d7d63"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"7c1f9c2b36da"(e,t,s){s.a(e,async(e,n)=>{try{s.d(t,{AI:()=>R,Ld:()=>y,OE:()=>T,mH:()=>P,q0:()=>D});var i=s("0d662e4d7d63"),o=e([i]),r=o.then?(await o)():o;i=r[0];const l="sf-sortable-intent",a="sf-sortable-state",c="[data-sf-sortable-item]",d="[data-sf-sortable-handle]",u='a[href],button,input,select,textarea,summary,[contenteditable]:not([contenteditable="false"])',h=/^[a-z][a-z0-9-]{0,31}$/u,g=4,f=32,p={ru:{instructions:"Пробел или Enter — взять, стрелки — переместить, Пробел или Enter — положить, Escape — отменить.",picked:"Взято: {item}. Позиция {index} из {total} в «{list}».",moved:"Позиция {index} из {total} в «{list}».",dropped:"Положено: {item}, позиция {index} в «{list}».",cancelled:"Перемещение отменено.",target:"Цель: {target}."},en:{instructions:"Space or Enter to pick up, arrows to move, Space or Enter to drop, Escape to cancel.",picked:"Picked up {item}. Position {index} of {total} in “{list}”.",moved:"Position {index} of {total} in “{list}”.",dropped:"Dropped {item} at position {index} in “{list}”.",cancelled:"Move cancelled.",target:"Target: {target}."}},b=(e,t)=>e.replace(/\{(\w+)\}/gu,(e,s)=>String(t[s]??"")),m=()=>Object.fromEntries(Object.keys(p.en).map(e=>[e,(0,i.pageText)(p,e,void 0,"sf-sortable")])),v=globalThis.__sfSortableSharedV1||(globalThis.__sfSortableSharedV1={targets:new Set,session:null}),x=v.targets;function y(){return v.session?Object.freeze({item:v.session.item,from:v.session.from,group:v.session.group,mode:v.session.mode,input:v.session.input}):null}function T(e){if(!e||"function"!=typeof e.resolve||"function"!=typeof e.drop)throw new TypeError("Drop target needs resolve and drop");return x.add(e),()=>x.delete(e)}function A(e){if(e.getAttribute("aria-label"))return e.getAttribute("aria-label");const t=e.cloneNode(!0);for(const e of t.querySelectorAll('[aria-hidden="true"]'))e.remove();return t.textContent.replace(/\s+/gu," ").trim()}function E(e){return e.getAttribute("label")||e.getAttribute("aria-label")||e.getAttribute("group")||""}function w(e){return[...e.querySelectorAll(c)].filter(t=>t.closest("sf-sortable")===e)}function S(e,t){if(!e||"copy"===e.getAttribute("mode"))return!1;const s=e.getAttribute("group"),n=(e.getAttribute("accepts")||"").split(/\s+/u).filter(Boolean);return t===s||n.includes(t)}function k(e){for(let t=e?.parentElement;t;t=t.parentElement){const e=globalThis.getComputedStyle(t);if(/(auto|scroll)/u.test(e.overflowY)&&t.scrollHeight>t.clientHeight)return t}return globalThis.document.scrollingElement}function C(){let e=globalThis.document.querySelector(".sf-sortable-indicator");return e||(e=globalThis.document.createElement("div"),e.className="sf-sortable-indicator",e.setAttribute("aria-hidden","true"),globalThis.document.body.append(e)),e}function L(e){const t=C();e?(t.hidden=!1,Object.assign(t.style,{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`})):t.hidden=!0}function O(e){return"line"!==e.getAttribute("preview")}function B(e){if(e.placeholder)return e.placeholder;const t=e.sourceBox,s=globalThis.document.createElement("div");return s.className="sf-sortable-placeholder",s.setAttribute("aria-hidden","true"),Object.assign(s.style,{inlineSize:`${t.width}px`,blockSize:`${t.height}px`}),e.placeholder=s,s}function I(e,t,s,n){const i="horizontal"===t.getAttribute("orientation"),o=w(t).filter(t=>t!==e.source);let r;if(!i&&(_(o)||e.wrappedLists?.has(t)))r=$(o,s,n);else{r=R(o.map(e=>{const t=e.getBoundingClientRect();return i?{start:t.left,end:t.right}:{start:t.top,end:t.bottom}}),i?s:n)}const l=B(e),a=o[r];if(a)l.nextElementSibling!==a&&a.before(l);else if(o.length){const e=o[o.length-1];e.nextElementSibling!==l&&e.after(l)}else l.parentElement!==t&&t.append(l);return r}function R(e,t,s=-1){let n=0;for(let i=0;i<e.length;i+=1){if(i===s)continue;const o=e[i];t>o.start+(o.end-o.start)/2&&(n=i+1)}return n}function _(e){for(let t=1;t<e.length;t+=1){const s=e[t-1].getBoundingClientRect(),n=e[t].getBoundingClientRect();if(n.top<s.bottom-1&&n.left>=s.right-1)return!0}return!1}function $(e,t,s){let n=0;for(let i=0;i<e.length;i+=1){const o=e[i].getBoundingClientRect();(s>o.bottom||!(s<o.top)&&t>o.left+o.width/2)&&(n=i+1)}return n}function F(e,t,s){const n=w(e),i="horizontal"===e.getAttribute("orientation");if(!i&&_(n)){const i=$(n,t,s);return{list:e,index:i,rect:j(e,n,i)}}const o=R(n.map(e=>{const t=e.getBoundingClientRect();return i?{start:t.left,end:t.right}:{start:t.top,end:t.bottom}}),i?t:s);return{list:e,index:o,rect:q(e,n,o,i)}}function j(e,t,s){const n=e.getBoundingClientRect(),i=t[s],o=t[s-1];if(i){const e=i.getBoundingClientRect();return{left:e.left-1,top:e.top,width:2,height:e.height}}if(o){const e=o.getBoundingClientRect();return{left:e.right-1,top:e.top,width:2,height:e.height}}return{left:n.left,top:n.top,width:2,height:n.height}}function q(e,t,s,n){const i=e.getBoundingClientRect(),o=t[s],r=t[s-1];if(n){return{left:(o?o.getBoundingClientRect().left:r?r.getBoundingClientRect().right:i.left)-1,top:i.top,width:2,height:i.height}}const l=o?o.getBoundingClientRect().top:r?r.getBoundingClientRect().bottom:i.top;return{left:i.left,top:l-1,width:i.width,height:2}}function N(e){const t=globalThis.document,s=e.item;if(!s||!t)return;const n=()=>{const n=t.activeElement;if(n&&n!==t.body&&t.contains(n))return;const i=(e.list&&t.contains(e.list)?e.list:t).querySelector(`[data-sf-sortable-item="${globalThis.CSS?.escape?globalThis.CSS.escape(s):s}"]`);i?.focus?.({preventScroll:!1})};"function"==typeof globalThis.requestAnimationFrame?globalThis.requestAnimationFrame(()=>globalThis.requestAnimationFrame(n)):n()}function M(e,t){if(!v.session)return;const s=v.session;v.session=null,s.cleanup?.abort(),s.scrollFrame&&globalThis.cancelAnimationFrame(s.scrollFrame),s.source?.removeAttribute("data-sf-sortable-dragging"),s.source?.removeAttribute("data-sf-sortable-lifted"),s.placeholder?.remove(),s.ghost?.remove(),L(null);for(const e of x)e.leave?.();globalThis.document.documentElement.removeAttribute("data-sf-sortable-active"),e.dispatchEvent(new globalThis.CustomEvent(a,{bubbles:!0,composed:!0,detail:Object.freeze({state:t,item:s.item})})),"dropped"===t&&"keyboard"===s.input&&N(s)}function P(e=globalThis.customElements){if(!e||"function"!=typeof globalThis.HTMLElement)return null;const t=e.get("sf-sortable");if(t)return t;class s extends globalThis.HTMLElement{constructor(){super(),this.connection=null,this.live=null,this.instructions=null}connectedCallback(){if(this.connection)return;this.connection=new AbortController;const e={signal:this.connection.signal};this.live||(this.live=globalThis.document.createElement("div"),this.live.className="sf-sortable-live",this.live.setAttribute("aria-live","polite"),this.instructions=globalThis.document.createElement("div"),this.instructions.className="sf-sortable-live",this.instructions.id=`sf-sortable-help-${Math.random().toString(36).slice(2,10)}`),this.instructions.textContent=m().instructions,this.append(this.live,this.instructions),this.addEventListener("pointerdown",e=>this.onPointerDown(e),e),this.addEventListener("keydown",e=>this.onKeyDown(e),e),this.addEventListener("focusin",e=>this.prepareItem(e.target.closest?.(c)),e);for(const e of w(this))this.prepareItem(e);this.observer=new globalThis.MutationObserver(()=>{this.ensureAccessibilityNodes();for(const e of w(this))this.prepareItem(e)}),this.observer.observe(this,{childList:!0,subtree:!0}),this.setAttribute("data-sf-sortable","connected")}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.connection?.abort(),this.connection=null,v.session?.fromList!==this&&v.session?.list!==this||M(this,"cancelled"),this.setAttribute("data-sf-sortable","disposed")}prepareItem(e){if(!e||e.closest("sf-sortable")!==this)return;e.hasAttribute("tabindex")||e.matches(u)||(e.tabIndex=0);const t=(e.getAttribute("aria-describedby")||"").split(/\s+/u);this.instructions&&!t.includes(this.instructions.id)&&e.setAttribute("aria-describedby",[...t.filter(Boolean),this.instructions.id].join(" ")),e.querySelector(d)||(e.style.touchAction="none")}ensureAccessibilityNodes(){this.live&&this.instructions&&(this.live.parentNode===this&&this.instructions.parentNode===this||(this.instructions.textContent=m().instructions,this.append(this.live,this.instructions)))}announce(e){this.ensureAccessibilityNodes(),this.live&&(this.live.textContent=e)}get group(){const e=this.getAttribute("group")||"";return h.test(e)?e:""}get mode(){return"copy"===this.getAttribute("mode")?"copy":"move"}begin(e,t){const s=e.getAttribute("data-sf-sortable-item");if(!s||!this.group||v.session)return!1;const n=w(this),i=e.getBoundingClientRect();return v.session={sourceBox:i,item:s,from:this.getAttribute("id")||this.group,group:this.group,mode:this.mode,input:t,source:e,fromList:this,sourceIndex:n.indexOf(e),list:"copy"===this.mode?null:this,index:n.indexOf(e),external:null,cleanup:new AbortController},e.setAttribute("data-sf-sortable-dragging",""),globalThis.document.documentElement.setAttribute("data-sf-sortable-active",""),this.dispatchEvent(new globalThis.CustomEvent(a,{bubbles:!0,composed:!0,detail:Object.freeze({state:"picked",item:s})})),!0}onPointerDown(e){if(0!==e.button||v.session)return;const t=e.target.closest?.(c);if(!t||t.closest("sf-sortable")!==this)return;const s=t.querySelector(d);if(s&&!s.contains(e.target))return;if(!s&&e.target.closest(u)&&e.target.closest(u)!==t)return;const n=e.clientX,i=e.clientY,o=e.pointerId;let r=!1;const l=new AbortController,a=()=>{l.abort(),r&&M(this,"cancelled")};globalThis.addEventListener("pointermove",e=>{if(e.pointerId===o){if(!r){if(Math.hypot(e.clientX-n,e.clientY-i)<g)return;if(!this.begin(t,e.pointerType||"mouse"))return void l.abort();r=!0,t.setPointerCapture?.(o),v.session.ghost=this.ghost(t,e),O(this)&&"copy"!==this.mode&&(v.session.silhouette=!0,v.session.wrappedLists=new Set(_(w(this))?[this]:[]),t.setAttribute("data-sf-sortable-lifted",""),this.retarget(e.clientX,e.clientY))}e.preventDefault(),this.track(e.clientX,e.clientY)}},{signal:l.signal,passive:!1}),globalThis.addEventListener("pointerup",e=>{e.pointerId===o&&(l.abort(),r&&this.drop())},{signal:l.signal}),globalThis.addEventListener("pointercancel",a,{signal:l.signal}),globalThis.addEventListener("keydown",e=>{"Escape"===e.key&&r&&(e.preventDefault(),e.stopPropagation(),a())},{signal:l.signal,capture:!0})}ghost(e,t){const s=e.getBoundingClientRect(),n=e.cloneNode(!0);n.removeAttribute("id");for(const e of n.querySelectorAll("[id]"))e.removeAttribute("id");return n.classList.add("sf-sortable-ghost"),n.setAttribute("aria-hidden","true"),n.inert=!0,Object.assign(n.style,{width:`${s.width}px`,left:`${s.left}px`,top:`${s.top}px`}),v.session.offset={x:t.clientX-s.left,y:t.clientY-s.top},globalThis.document.body.append(n),n}track(e,t){v.session&&(v.session.pointer={x:e,y:t},v.session.ghost&&Object.assign(v.session.ghost.style,{left:e-v.session.offset.x+"px",top:t-v.session.offset.y+"px"}),this.retarget(e,t),this.startAutoScroll())}retarget(e,t){const s=globalThis.document.elementFromPoint(e,t),n=s?.closest?.("sf-sortable");for(const s of x){const n=s.resolve(e,t,y());if(n)return v.session.list=null,v.session.external={target:s,...n},void L(n.rect)}if(v.session.external=null,n&&S(n,v.session.group)&&v.session.silhouette&&O(n))return v.session.list=n,v.session.index=I(v.session,n,e,t),void L(null);if(v.session.placeholder?.remove(),n&&S(n,v.session.group)){const s=F(n,e,t);v.session.list=n,v.session.index=n===v.session.fromList&&"move"===v.session.mode&&s.index>v.session.sourceIndex?s.index-1:s.index,L(s.rect)}else v.session.list=null,L(null)}startAutoScroll(){if(!v.session||v.session.scrollFrame)return;const e=()=>{if(!v.session?.pointer)return;v.session.scrollFrame=0;const{x:t,y:s}=v.session.pointer,n=k(globalThis.document.elementFromPoint(t,s));if(!n)return;const i=n===globalThis.document.scrollingElement?{top:0,bottom:globalThis.innerHeight}:n.getBoundingClientRect(),o=n.scrollHeight-n.clientHeight;let r=0;s<i.top+f&&n.scrollTop>0?r=-Math.ceil((i.top+f-s)/4):s>i.bottom-f&&n.scrollTop<o&&(r=Math.ceil((s-i.bottom+f)/4)),r&&(n.scrollBy({top:r,behavior:"instant"}),this.retarget(t,s),v.session.scrollFrame=globalThis.requestAnimationFrame(e))};v.session.scrollFrame=globalThis.requestAnimationFrame(e)}drop(){if(!v.session)return;const e=v.session;if(e.external)return e.external.target.drop(y(),e.external.descriptor),void M(this,"dropped");if(e.list){const n=e.index;if(!(e.list===e.fromList&&n===e.sourceIndex))return t=e.list,s={item:e.item,from:e.from,to:e.list.getAttribute("id")||e.list.group,index:n,mode:e.mode},t.dispatchEvent(new globalThis.CustomEvent(l,{bubbles:!0,composed:!0,detail:Object.freeze(s)})),e.list.announce?.(b(m().dropped,{item:A(e.source),index:n+1,list:E(e.list)})),void M(this,"dropped")}var t,s;M(this,"cancelled")}keyboardTargets(){return[...globalThis.document.querySelectorAll("sf-sortable")].filter(e=>e===v.session?.fromList?"move"===v.session.mode:S(e,v.session?.group))}describeKeyboard(e=!0){if(!v.session)return;if(v.session.external)return L(v.session.external.rect),void(e&&this.announce(b(m().target,{target:v.session.external.label||""})));const t=v.session.list,s=w(t),n=t===v.session.fromList&&"move"===v.session.mode,i=s.length+(n?0:1),o=n&&v.session.index>v.session.sourceIndex?v.session.index+1:v.session.index;L(q(t,s,Math.min(o,s.length),"horizontal"===t.getAttribute("orientation"))),e&&this.announce(b(m().moved,{index:v.session.index+1,total:i,list:E(t)}))}onKeyDown(e){const t=e.target.closest?.(c);if(!v.session){if(!t||t.closest("sf-sortable")!==this||e.target!==t)return;if(" "!==e.key&&"Enter"!==e.key)return;if(e.preventDefault(),!this.begin(t,"keyboard"))return;const s=()=>{v.session?.fromList===this&&(this.announce(m().cancelled),M(this,"cancelled"))},n={signal:v.session.cleanup.signal};if(this.addEventListener("focusout",e=>{e.relatedTarget&&this.contains(e.relatedTarget)||globalThis.setTimeout(()=>{this.contains(globalThis.document.activeElement)||s()},0)},n),globalThis.document.addEventListener("pointerdown",e=>{this.contains(e.target)||s()},{...n,capture:!0}),"copy"===v.session.mode){const[e]=this.keyboardTargets(),t=[...x].flatMap(e=>(e.keyboardTargets?.(y())||[]).map(t=>({target:e,...t})));if(e)v.session.list=e,v.session.index=w(e).length;else{if(!t.length)return void M(this,"cancelled");v.session.external=t[0]}}if(v.session.external)return this.describeKeyboard(!1),void this.announce(`${b(m().picked,{item:A(t),index:1,total:1,list:""}).split(".")[0]}. ${b(m().target,{target:v.session.external.label||""})}`);const i=w(v.session.list);return this.describeKeyboard(!1),void this.announce(b(m().picked,{item:A(t),index:v.session.index+1,total:i.length,list:E(v.session.list)}))}if("keyboard"!==v.session.input||v.session.fromList!==this)return;const s=this.keyboardTargets(),n=[...x].flatMap(e=>(e.keyboardTargets?.(y())||[]).map(t=>({target:e,...t})));if("Escape"===e.key||"Tab"===e.key)return"Escape"===e.key&&e.preventDefault(),this.announce(m().cancelled),void M(this,"cancelled");if(" "===e.key||"Enter"===e.key)return e.preventDefault(),void this.drop();const i={ArrowUp:-1,ArrowDown:1}[e.key],o={ArrowLeft:-1,ArrowRight:1}[e.key];if(void 0===i&&void 0===o)return;if(e.preventDefault(),v.session.external){const e=n.findIndex(e=>e.target===v.session.external.target&&JSON.stringify(e.descriptor)===JSON.stringify(v.session.external.descriptor)),t=n[e+(i??o)];return t?v.session.external=t:(i??o)<0&&s.length&&(v.session.external=null,v.session.list=s.at(-1),v.session.index=w(v.session.list).length-(v.session.list===v.session.fromList&&"move"===v.session.mode?1:0)),void this.describeKeyboard()}const r=v.session.list,l=w(r).length-(r===v.session.fromList&&"move"===v.session.mode?1:0);if(void 0!==i){const e=v.session.index+i;e>=0&&e<=l?v.session.index=e:e>l&&void 0===o&&n.length&&s.indexOf(r)===s.length-1&&(v.session.external=n[0])}else{const e=s[s.indexOf(r)+o];e?(v.session.list=e,v.session.index=Math.min(v.session.index,w(e).length-(e===v.session.fromList&&"move"===v.session.mode?1:0))):o>0&&n.length&&(v.session.external=n[0])}this.describeKeyboard()}}return e.define("sf-sortable",s),s}function D(e,t={}){if(!(e instanceof globalThis.Element)||"string"!=typeof t.items)throw new TypeError("attachSortable needs a container and an items selector");const s=globalThis.document,n="line"===t.preview?"line":"column",i="function"==typeof t.groupOf?t.groupOf:()=>"",o="function"==typeof t.canStart?t.canStart:()=>!0,r="function"==typeof t.cellsOf?t.cellsOf:e=>[e],l=s.createElement("div");l.className="sf-sortable-live",l.setAttribute("aria-live","polite"),s.body.append(l);const a=new AbortController;let c=null;const d=s=>[...e.querySelectorAll(t.items)].filter(e=>i(e)===s),u=i=>{const o=d(c.group).filter(e=>e!==c.item).map(e=>e.getBoundingClientRect());let r=o.length;for(let e=0;e<o.length;e+=1)if(i<o[e].left+o[e].width/2){r=e;break}c.index=r;const l=(t.extent?.isConnected?t.extent:e).getBoundingClientRect(),a=c.width,u=o[r],h=o[r-1];let g;g="column"===n?r>c.originalIndex&&h?h.right-a:u?u.left:h?h.right-a:l.left:(u?u.left:h?h.right:l.left)-1,Object.assign((()=>{if(c.outline)return c.outline;const e=s.createElement("div");return e.className="column"===n?"sf-sortable-column-outline":"sf-sortable-indicator",e.setAttribute("aria-hidden","true"),s.body.append(e),c.outline=e,e})().style,{left:`${g}px`,top:`${l.top}px`,width:"column"===n?`${a}px`:"2px",height:`${l.height}px`})},h=n=>{const i=c;if(c=null,!i)return;i.pending.abort(),i.ghost?.remove(),i.outline?.remove();for(const e of i.cells)e.removeAttribute("data-sf-sortable-column-source");if(s.documentElement.removeAttribute("data-sf-sortable-active"),!i.started)return;const o=e=>{e.preventDefault(),e.stopImmediatePropagation()};if(e.addEventListener("click",o,{capture:!0,once:!0}),globalThis.setTimeout(()=>e.removeEventListener("click",o,{capture:!0}),0),!n)return void(l.textContent=m().cancelled);if(void 0===i.index||i.index===i.originalIndex)return;const r=i.item.getAttribute("data-sf-sortable-item")||i.item.dataset.key||"";l.textContent=b(m().dropped,{item:A(i.item),index:i.index+1,list:t.label||""}),t.onIntent?.({item:r,from:i.group,index:i.index,group:i.group})};return e.addEventListener("pointerdown",n=>{if(0!==n.button||c||v.session)return;const l=n.target.closest?.(t.items);if(!l||!e.contains(l)||!o(n,l))return;const a=i(l),p=d(a);if(p.length<2)return;const b=n.clientX,m=n.clientY,x=new AbortController,y=l.getBoundingClientRect();c={item:l,group:a,pending:x,started:!1,cells:[],width:y.width,originalIndex:p.indexOf(l)};globalThis.addEventListener("pointermove",t=>{if(t.pointerId===n.pointerId&&c){if(!c.started){if(Math.hypot(t.clientX-b,t.clientY-m)<g)return;c.started=!0,s.documentElement.setAttribute("data-sf-sortable-active","");const e=l.cloneNode(!0);e.removeAttribute("id");for(const t of e.querySelectorAll("[id]"))t.removeAttribute("id");e.classList.add("sf-sortable-ghost"),e.setAttribute("aria-hidden","true"),e.inert=!0,Object.assign(e.style,{width:`${y.width}px`,height:`${y.height}px`,left:`${y.left}px`,top:`${y.top}px`}),s.body.append(e),c.ghost=e,c.offset={x:b-y.left,y:m-y.top},c.cells=r(l).filter(Boolean);for(const e of c.cells)e.setAttribute("data-sf-sortable-column-source","")}t.preventDefault(),Object.assign(c.ghost.style,{left:t.clientX-c.offset.x+"px",top:t.clientY-c.offset.y+"px"}),(t=>{for(let s=e.parentElement;s;s=s.parentElement){const e=globalThis.getComputedStyle(s);if(!/(auto|scroll)/u.test(e.overflowX)||s.scrollWidth<=s.clientWidth)continue;const n=s.getBoundingClientRect();return void(t<n.left+f?s.scrollBy({left:-Math.ceil((n.left+f-t)/4),behavior:"instant"}):t>n.right-f&&s.scrollBy({left:Math.ceil((t-n.right+f)/4),behavior:"instant"}))}})(t.clientX),u(t.clientX)}},{signal:x.signal,passive:!1}),globalThis.addEventListener("pointerup",e=>{e.pointerId===n.pointerId&&h(!0)},{signal:x.signal}),globalThis.addEventListener("pointercancel",()=>h(!1),{signal:x.signal}),globalThis.addEventListener("keydown",e=>{"Escape"===e.key&&c?.started&&(e.preventDefault(),e.stopPropagation(),h(!1))},{signal:x.signal,capture:!0})},{signal:a.signal}),()=>{h(!1),a.abort(),l.remove()}}s.d(t,["WK",0,a,"dd",0,l]),n()}catch(z){n(z)}})}};const t={};function s(n){const i=t[n];if(void 0!==i)return i.exports;const o=t[n]={exports:{}};return e[n](o,o.exports,s),o.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",n=e?Symbol("webpack exports"):"__webpack_exports__",i=e?Symbol("webpack error"):"__webpack_error__",o=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};s.a=(e,s,r)=>{let l;r&&((l=[]).d=-1);const a=new Set,c=e.exports;let d,u,h;const g=new Promise((e,t)=>{h=t,u=e});g[n]=c,g[t]=e=>(l&&e(l),a.forEach(e),g.catch(e=>{})),e.exports=g;s(e=>{let s;d=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const s=[];s.d=0,e.then(e=>{r[n]=e,o(s)},e=>{r[i]=e,o(s)});const r={};return r[t]=e=>e(s),r}}const s={};return s[t]=e=>{},s[n]=e,s}))(e);const r=()=>d.map(e=>{if(e[i])throw e[i];return e[n]}),c=new Promise(e=>{s=()=>e(r),s.r=0;const n=e=>e!==l&&!a.has(e)&&(a.add(e),e&&!e.d&&(s.r++,e.push(s)));d.map(e=>e[t](n))});return s.r?c:r()},e=>(e?h(g[i]=e):u(c),o(l))),l?.d<0&&(l.d=0)}})(),s.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var i=t[n++],o=t[n++];s.o(e,i)?0===o&&n++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);s("6064f55a0aa2")})();
|
|
1
|
+
(()=>{"use strict";var t={"6064f55a0aa2"(t,e,n){n.a(t,async(t,e)=>{try{var s=n("7c1f9c2b36da"),i=n("96c896bdd1c2"),o=t([s,i]);[s,i]=o.then?(await o)():o,(0,s.mH)((0,i.i4)()),globalThis.SF=globalThis.SF||{},globalThis.SF.Sortable=Object.freeze({SORTABLE_INSERT_EVENT:i.uW,SORTABLE_INTENT_EVENT:s.dd,SORTABLE_STATE_EVENT:s.WK,activeSortableSession:s.Ld,attach:s.q0,attachSortable:s.q0,registerSortableDropTarget:s.OE,sortableIndexAt:s.AI}),e()}catch(t){e(t)}})},"0d662e4d7d63"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"96c896bdd1c2"(t,e,n){n.a(t,async(t,s)=>{try{n.d(e,{i4:()=>y});var i=n("0d662e4d7d63"),o=n("7c1f9c2b36da"),r=t([i,o]);[i,o]=r.then?(await r)():r;const l="sf-sortable-insert",a="[data-sf-sortable-item]",c={ru:{point:"Вставить: позиция {index} из {total}",menu:"Вставить",search:"Найти",empty:"Ничего не найдено",inserted:"Вставлено: {item}, позиция {index} в «{list}».",hint:"Плюс — вставить после."},en:{point:"Insert: position {index} of {total}",menu:"Insert",search:"Find",empty:"Nothing found",inserted:"Inserted {item} at position {index} in “{list}”.",hint:"Plus to insert after."}},u=(t,e)=>t.replace(/\{(\w+)\}/gu,(t,n)=>String(e[n]??"")),d=t=>(0,i.pageText)(c,t,void 0,"sf-sortable");function h(t){return[...t.querySelectorAll(a)].filter(e=>e.closest("sf-sortable")===t)}function f(t){return t.getAttribute("label")||t.getAttribute("aria-label")||t.getAttribute("group")||""}function g(t){for(let e=1;e<t.length;e+=1){const n=t[e-1].getBoundingClientRect(),s=t[e].getBoundingClientRect();if(s.top<n.bottom-1&&s.left>=n.right-1)return!0}return!1}function p(t,e,n){const s=t.getBoundingClientRect(),i={left:s.left+t.clientLeft,top:s.top+t.clientTop,width:t.clientWidth,height:t.clientHeight},o="horizontal"===t.getAttribute("orientation"),r=e[n]?.getBoundingClientRect(),l=e[n-1]?.getBoundingClientRect();if(!o&&g(e)){const t=r??l;if(!t)return{axis:"y",at:i.top+i.height/2,start:i.left,end:i.left+i.width};const e=r&&l&&l.top<r.bottom-1&&r.left>=l.right-1;return{axis:"x",at:r?e?(l.right+r.left)/2:r.left:l.right,start:t.top,end:t.bottom}}if(o){return{axis:"x",at:r&&l?(l.right+r.left)/2:r?r.left:l?l.right:i.left+i.width/2,start:i.top,end:i.top+i.height}}return{axis:"y",at:r&&l?(l.bottom+r.top)/2:r?r.top:l?l.bottom:i.top+i.height/2,start:i.left,end:i.left+i.width}}function b(t,e,n,s){let i=null;for(let o=0;o<=e.length;o+=1){const r=p(t,e,o),l="y"===r.axis?s:n,a="y"===r.axis?n:s;if(a<r.start||a>r.end)continue;const c=Math.abs(l-r.at);(!i||c<i.distance)&&(i={index:o,distance:c,place:r})}return i}function m(t){return t.inserterItems.flatMap(t=>t&&"object"==typeof t?"separator"===t.type?[{type:"separator"}]:"heading"===t.type?[{type:"heading",text:String(t.label??"")}]:void 0===t.value||null===t.value?[]:[{id:String(t.value),text:String(t.label??t.value),icon:t.icon||void 0,caption:t.caption||void 0,keywords:t.keywords||void 0,disabled:Boolean(t.disabled)}]:[])}function v(t){let e=!1,n=!1,s=null,i=null,r=null,c=null,g=0,v=0,x=null,y=null;const A=()=>globalThis.document,w=()=>h(t).length,T=t=>Math.max(0,Math.min(w(),t));function E(){if(!n||!i)return;const e=h(t).at(-1);if(i.parentNode!==t||Boolean(e&&i.compareDocumentPosition(e)&globalThis.Node.DOCUMENT_POSITION_FOLLOWING)){const e=A().activeElement===r;t.append(i),e&&r.focus({preventScroll:!0})}C()}function C(){if(!n||!i)return;const e=(0,o.Ld)()?null:c?.isOpen?"menu":A().activeElement===r?"focus":null!==x?"hover":null!==y?"row":null;"hover"===e?v=x:"row"===e&&(v=y),v=T(v);const s=h(t),l=p(t,s,v),a=t.getBoundingClientRect(),f=a.left+t.clientLeft-t.scrollLeft,g=a.top+t.clientTop-t.scrollTop;i.dataset.axis=l.axis,"y"===l.axis?Object.assign(i.style,{left:l.start-f+"px",top:l.at-g+"px",width:l.end-l.start+"px",height:"0px"}):Object.assign(i.style,{left:l.at-f+"px",top:l.start-g+"px",width:"0px",height:l.end-l.start+"px"}),i.toggleAttribute("data-shown",Boolean(e)),i.dataset.index=String(v),r.setAttribute("aria-label",u(d("point"),{index:v+1,total:s.length+1}))}function S(e){if(e.buttons||(0,o.Ld)()||c?.isOpen)return;if(i.contains(e.target))return;const n=Math.max(r.offsetHeight,r.offsetWidth)/2,s=b(t,h(t),e.clientX,e.clientY),l=s&&s.distance<=n?s.index:null;l!==x&&(x=l,C())}function L(){null!==x&&(x=null,C())}function k(e){const n=e.target.closest?.(a);e.target!==r?(y=n&&n.closest("sf-sortable")===t?h(t).indexOf(n)+1:null,C()):C()}function O(){globalThis.setTimeout(()=>{e&&(t.contains(A().activeElement)||(y=null),C())},0)}function I(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;const n="horizontal"===t.getAttribute("orientation"),s="rtl"===globalThis.getComputedStyle(t).direction,i=n?{ArrowLeft:s?1:-1,ArrowRight:s?-1:1,ArrowUp:-1,ArrowDown:1}:{ArrowUp:-1,ArrowDown:1,ArrowLeft:-1,ArrowRight:1};let o=null;e.key in i?o=v+i[e.key]:"Home"===e.key?o=0:"End"===e.key&&(o=w()),null!==o&&(e.preventDefault(),x=null,y=null,v=T(o),C(),t.announce?.(u(d("point"),{index:v+1,total:w()+1})))}function B(t){t.preventDefault(),c?.isOpen?c.close():_(v)}async function _(e){if(!n||(0,o.Ld)())return!1;v=T(e),x=null,C();const s=await async function(){if(c?.isConnected)return c;const e=globalThis.customElements;return e.get("sf-context-menu")||(globalThis.SF?.Loader?.ensurePlugin?.("cl-context-menu"),await Promise.race([e.whenDefined("sf-context-menu"),new Promise(t=>{globalThis.setTimeout(t,3e3)})])),e.get("sf-context-menu")?(c=A().createElement("sf-context-menu"),c.setAttribute("popup",""),c.addEventListener("sf-context-menu-select",N),c.addEventListener("sf-context-menu-close",()=>{r?.setAttribute("aria-expanded","false"),C()}),c.addEventListener("keydown",t=>{"Enter"!==t.key||t.defaultPrevented||t.target!==c.searchField?.()||(t.preventDefault(),c.syncMenuItems?.(),c.availableMenuItems?.()[0]?.click())}),(t.closest("dialog[open]")||A().body).append(c),c):null}();if(!s||!n)return!1;g=v,s.setAttribute("aria-label",f(t)?`${d("menu")}: ${f(t)}`:d("menu")),s.search={placeholder:d("search"),empty:d("empty")},s.entries=m(t);const i=await s.openFor(r,{side:"block-end",align:"start",focus:"first"});return C(),i}function N(e){e.preventDefault();const n=e.detail?.entry;if(!n||void 0===n.id||null===n.id)return;const s=g;if(!t.dispatchEvent(new globalThis.CustomEvent(l,{bubbles:!0,composed:!0,cancelable:!0,detail:Object.freeze({index:s,item:n.id,to:t.getAttribute("id")||t.getAttribute("group")||""})})))return;t.announce?.(u(d("inserted"),{item:n.text??n.id,index:s+1,list:f(t)})),v=s+1;const i=!c.contains(A().activeElement);c.close({restoreFocus:!i})}function R(){x=null,C()}function D(){i||function(){i=A().createElement("div"),i.className="sf-sortable-insert",i.setAttribute("data-sf-sortable-insert",""),r=A().createElement("button"),r.type="button",r.className="sf-icon-button sf-icon-button--icon sf-icon-button--surface sf-icon-button--on-surface sf-icon-button--size-1/3 sf-sortable-insert-button",r.setAttribute("aria-haspopup","menu"),r.setAttribute("aria-expanded","false");const t=A().createElement("i");t.className="sf-icon",t.setAttribute("aria-hidden","true"),t.textContent="add",r.append(t),i.append(r)}(),s=new globalThis.AbortController;const e={signal:s.signal};t.setAttribute("data-sf-sortable-inserter",""),t.addEventListener("pointermove",S,e),t.addEventListener("pointerleave",L,e),t.addEventListener("focusin",k,e),t.addEventListener("focusout",O,e),t.addEventListener("sf-sortable-state",R,e),r.addEventListener("keydown",I,e),r.addEventListener("click",B,e),globalThis.SF?.Loader?.ensurePlugin?.("icon-buttons"),globalThis.SF?.Loader?.ensurePlugin?.("icons"),n=!0,E(),C()}function F(){n=!1,s?.abort(),s=null,c?.close?.({restoreFocus:!1}),i?.remove(),t.removeAttribute("data-sf-sortable-inserter"),x=null,y=null}function P(){const s=e&&t.inserterItems.length>0;s&&!n?D():!s&&n?F():s&&c?.isOpen&&(c.entries=m(t)),t.updateInstructions?.()}return{connect(){e=!0,P()},disconnect(){e=!1,n&&F(),c?.remove(),c=null},refresh:P,ensure:E,open:_,onItemKeyDown:function(e,s){return!(!n||"+"!==e.key||e.altKey||e.ctrlKey||e.metaKey)&&(e.preventDefault(),_(h(t).indexOf(s)+1),!0)},instructions:()=>n?d("hint"):"",get active(){return n},get index(){return v}}}function x(t){return class extends t{static get observedAttributes(){return[...super.observedAttributes??[],"inserter-items"]}constructor(){if(super(),this.inserterController=null,this._inserterHint="",Object.prototype.hasOwnProperty.call(this,"inserterItems")){const t=this.inserterItems;delete this.inserterItems,this._inserterItems=Array.isArray(t)?t:null}}get inserterItems(){if(Array.isArray(this._inserterItems))return this._inserterItems;const t=this.getAttribute("inserter-items");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}set inserterItems(t){this._inserterItems=Array.isArray(t)?t:null,this.inserterController?.refresh()}attributeChangedCallback(t,e,n){super.attributeChangedCallback?.(t,e,n),"inserter-items"===t&&e!==n&&this.inserterController?.refresh()}connectedCallback(){super.connectedCallback(),this.inserterController||(this.inserterController=v(this)),this.inserterController.connect()}disconnectedCallback(){this.inserterController?.disconnect(),super.disconnectedCallback()}updateInstructions(){if(!this.instructions)return;const t=this.instructions.textContent,e=this._inserterHint&&t.endsWith(` ${this._inserterHint}`)?t.slice(0,-(this._inserterHint.length+1)):t,n=this.inserterController?.instructions()||"",s=n?`${e} ${n}`:e;this._inserterHint=n,s!==t&&(this.instructions.textContent=s)}ensureAccessibilityNodes(){super.ensureAccessibilityNodes(),this.updateInstructions(),this.inserterController?.ensure()}onKeyDown(t){const e=t.target.closest?.(a);!(0,o.Ld)()&&e&&e.closest("sf-sortable")===this&&t.target===e&&this.inserterController?.onItemKeyDown(t,e)||super.onKeyDown(t)}}}function y(t=globalThis.customElements){return{get:e=>t.get(e),define:(e,n,s)=>t.define(e,x(n),s)}}n.d(e,["uW",0,l]),s()}catch(A){s(A)}})},"7c1f9c2b36da"(t,e,n){n.a(t,async(t,s)=>{try{n.d(e,{AI:()=>_,Ld:()=>y,OE:()=>A,mH:()=>j,q0:()=>q});var i=n("0d662e4d7d63"),o=t([i]),r=o.then?(await o)():o;i=r[0];const l="sf-sortable-intent",a="sf-sortable-state",c="[data-sf-sortable-item]",u="[data-sf-sortable-handle]",d='a[href],button,input,select,textarea,summary,[contenteditable]:not([contenteditable="false"])',h=/^[a-z][a-z0-9-]{0,31}$/u,f=4,g=32,p={ru:{instructions:"Пробел или Enter — взять, стрелки — переместить, Пробел или Enter — положить, Escape — отменить.",picked:"Взято: {item}. Позиция {index} из {total} в «{list}».",moved:"Позиция {index} из {total} в «{list}».",dropped:"Положено: {item}, позиция {index} в «{list}».",cancelled:"Перемещение отменено.",target:"Цель: {target}."},en:{instructions:"Space or Enter to pick up, arrows to move, Space or Enter to drop, Escape to cancel.",picked:"Picked up {item}. Position {index} of {total} in “{list}”.",moved:"Position {index} of {total} in “{list}”.",dropped:"Dropped {item} at position {index} in “{list}”.",cancelled:"Move cancelled.",target:"Target: {target}."}},b=(t,e)=>t.replace(/\{(\w+)\}/gu,(t,n)=>String(e[n]??"")),m=()=>Object.fromEntries(Object.keys(p.en).map(t=>[t,(0,i.pageText)(p,t,void 0,"sf-sortable")])),v=globalThis.__sfSortableSharedV1||(globalThis.__sfSortableSharedV1={targets:new Set,session:null}),x=v.targets;function y(){return v.session?Object.freeze({item:v.session.item,from:v.session.from,group:v.session.group,mode:v.session.mode,input:v.session.input}):null}function A(t){if(!t||"function"!=typeof t.resolve||"function"!=typeof t.drop)throw new TypeError("Drop target needs resolve and drop");return x.add(t),()=>x.delete(t)}function w(t){if(t.getAttribute("aria-label"))return t.getAttribute("aria-label");const e=t.cloneNode(!0);for(const t of e.querySelectorAll('[aria-hidden="true"]'))t.remove();return e.textContent.replace(/\s+/gu," ").trim()}function T(t){return t.getAttribute("label")||t.getAttribute("aria-label")||t.getAttribute("group")||""}function E(t){return[...t.querySelectorAll(c)].filter(e=>e.closest("sf-sortable")===t)}function C(t,e){if(!t||"copy"===t.getAttribute("mode"))return!1;const n=t.getAttribute("group"),s=(t.getAttribute("accepts")||"").split(/\s+/u).filter(Boolean);return e===n||s.includes(e)}function S(t){for(let e=t?.parentElement;e;e=e.parentElement){const t=globalThis.getComputedStyle(e);if(/(auto|scroll)/u.test(t.overflowY)&&e.scrollHeight>e.clientHeight)return e}return globalThis.document.scrollingElement}function L(){let t=globalThis.document.querySelector(".sf-sortable-indicator");return t||(t=globalThis.document.createElement("div"),t.className="sf-sortable-indicator",t.setAttribute("aria-hidden","true"),globalThis.document.body.append(t)),t}function k(t){const e=L();t?(e.hidden=!1,Object.assign(e.style,{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`})):e.hidden=!0}function O(t){return"line"!==t.getAttribute("preview")}function I(t){if(t.placeholder)return t.placeholder;const e=t.sourceBox,n=globalThis.document.createElement("div");return n.className="sf-sortable-placeholder",n.setAttribute("aria-hidden","true"),Object.assign(n.style,{inlineSize:`${e.width}px`,blockSize:`${e.height}px`}),t.placeholder=n,n}function B(t,e,n,s){const i="horizontal"===e.getAttribute("orientation"),o=E(e).filter(e=>e!==t.source);let r;if(!i&&(N(o)||t.wrappedLists?.has(e)))r=R(o,n,s);else{r=_(o.map(t=>{const e=t.getBoundingClientRect();return i?{start:e.left,end:e.right}:{start:e.top,end:e.bottom}}),i?n:s)}const l=I(t),a=o[r];if(a)l.nextElementSibling!==a&&a.before(l);else if(o.length){const t=o[o.length-1];t.nextElementSibling!==l&&t.after(l)}else l.parentElement!==e&&e.append(l);return r}function _(t,e,n=-1){let s=0;for(let i=0;i<t.length;i+=1){if(i===n)continue;const o=t[i];e>o.start+(o.end-o.start)/2&&(s=i+1)}return s}function N(t){for(let e=1;e<t.length;e+=1){const n=t[e-1].getBoundingClientRect(),s=t[e].getBoundingClientRect();if(s.top<n.bottom-1&&s.left>=n.right-1)return!0}return!1}function R(t,e,n){let s=0;for(let i=0;i<t.length;i+=1){const o=t[i].getBoundingClientRect();(n>o.bottom||!(n<o.top)&&e>o.left+o.width/2)&&(s=i+1)}return s}function D(t,e,n){const s=E(t),i="horizontal"===t.getAttribute("orientation");if(!i&&N(s)){const i=R(s,e,n);return{list:t,index:i,rect:F(t,s,i)}}const o=_(s.map(t=>{const e=t.getBoundingClientRect();return i?{start:e.left,end:e.right}:{start:e.top,end:e.bottom}}),i?e:n);return{list:t,index:o,rect:P(t,s,o,i)}}function F(t,e,n){const s=t.getBoundingClientRect(),i=e[n],o=e[n-1];if(i){const t=i.getBoundingClientRect();return{left:t.left-1,top:t.top,width:2,height:t.height}}if(o){const t=o.getBoundingClientRect();return{left:t.right-1,top:t.top,width:2,height:t.height}}return{left:s.left,top:s.top,width:2,height:s.height}}function P(t,e,n,s){const i=t.getBoundingClientRect(),o=e[n],r=e[n-1];if(s){return{left:(o?o.getBoundingClientRect().left:r?r.getBoundingClientRect().right:i.left)-1,top:i.top,width:2,height:i.height}}const l=o?o.getBoundingClientRect().top:r?r.getBoundingClientRect().bottom:i.top;return{left:i.left,top:l-1,width:i.width,height:2}}function $(t){const e=globalThis.document,n=t.item;if(!n||!e)return;const s=()=>{const s=e.activeElement;if(s&&s!==e.body&&e.contains(s))return;const i=(t.list&&e.contains(t.list)?t.list:e).querySelector(`[data-sf-sortable-item="${globalThis.CSS?.escape?globalThis.CSS.escape(n):n}"]`);i?.focus?.({preventScroll:!1})};"function"==typeof globalThis.requestAnimationFrame?globalThis.requestAnimationFrame(()=>globalThis.requestAnimationFrame(s)):s()}function M(t,e){if(!v.session)return;const n=v.session;v.session=null,n.cleanup?.abort(),n.scrollFrame&&globalThis.cancelAnimationFrame(n.scrollFrame),n.source?.removeAttribute("data-sf-sortable-dragging"),n.source?.removeAttribute("data-sf-sortable-lifted"),n.placeholder?.remove(),n.ghost?.remove(),k(null);for(const t of x)t.leave?.();globalThis.document.documentElement.removeAttribute("data-sf-sortable-active"),t.dispatchEvent(new globalThis.CustomEvent(a,{bubbles:!0,composed:!0,detail:Object.freeze({state:e,item:n.item})})),"dropped"===e&&"keyboard"===n.input&&$(n)}function j(t=globalThis.customElements){if(!t||"function"!=typeof globalThis.HTMLElement)return null;const e=t.get("sf-sortable");if(e)return e;class n extends globalThis.HTMLElement{constructor(){super(),this.connection=null,this.live=null,this.instructions=null}connectedCallback(){if(this.connection)return;this.connection=new AbortController;const t={signal:this.connection.signal};this.live||(this.live=globalThis.document.createElement("div"),this.live.className="sf-sortable-live",this.live.setAttribute("aria-live","polite"),this.instructions=globalThis.document.createElement("div"),this.instructions.className="sf-sortable-live",this.instructions.id=`sf-sortable-help-${Math.random().toString(36).slice(2,10)}`),this.instructions.textContent=m().instructions,this.append(this.live,this.instructions),this.addEventListener("pointerdown",t=>this.onPointerDown(t),t),this.addEventListener("keydown",t=>this.onKeyDown(t),t),this.addEventListener("focusin",t=>this.prepareItem(t.target.closest?.(c)),t);for(const t of E(this))this.prepareItem(t);this.observer=new globalThis.MutationObserver(()=>{this.ensureAccessibilityNodes();for(const t of E(this))this.prepareItem(t)}),this.observer.observe(this,{childList:!0,subtree:!0}),this.setAttribute("data-sf-sortable","connected")}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.connection?.abort(),this.connection=null,v.session?.fromList!==this&&v.session?.list!==this||M(this,"cancelled"),this.setAttribute("data-sf-sortable","disposed")}prepareItem(t){if(!t||t.closest("sf-sortable")!==this)return;t.hasAttribute("tabindex")||t.matches(d)||(t.tabIndex=0);const e=(t.getAttribute("aria-describedby")||"").split(/\s+/u);this.instructions&&!e.includes(this.instructions.id)&&t.setAttribute("aria-describedby",[...e.filter(Boolean),this.instructions.id].join(" ")),t.querySelector(u)||(t.style.touchAction="none")}ensureAccessibilityNodes(){this.live&&this.instructions&&(this.live.parentNode===this&&this.instructions.parentNode===this||(this.instructions.textContent=m().instructions,this.append(this.live,this.instructions)))}announce(t){this.ensureAccessibilityNodes(),this.live&&(this.live.textContent=t)}get group(){const t=this.getAttribute("group")||"";return h.test(t)?t:""}get mode(){return"copy"===this.getAttribute("mode")?"copy":"move"}begin(t,e){const n=t.getAttribute("data-sf-sortable-item");if(!n||!this.group||v.session)return!1;const s=E(this),i=t.getBoundingClientRect();return v.session={sourceBox:i,item:n,from:this.getAttribute("id")||this.group,group:this.group,mode:this.mode,input:e,source:t,fromList:this,sourceIndex:s.indexOf(t),list:"copy"===this.mode?null:this,index:s.indexOf(t),external:null,cleanup:new AbortController},t.setAttribute("data-sf-sortable-dragging",""),globalThis.document.documentElement.setAttribute("data-sf-sortable-active",""),this.dispatchEvent(new globalThis.CustomEvent(a,{bubbles:!0,composed:!0,detail:Object.freeze({state:"picked",item:n})})),!0}onPointerDown(t){if(0!==t.button||v.session)return;const e=t.target.closest?.(c);if(!e||e.closest("sf-sortable")!==this)return;const n=e.querySelector(u);if(n&&!n.contains(t.target))return;if(!n&&t.target.closest(d)&&t.target.closest(d)!==e)return;const s=t.clientX,i=t.clientY,o=t.pointerId;let r=!1;const l=new AbortController,a=()=>{l.abort(),r&&M(this,"cancelled")};globalThis.addEventListener("pointermove",t=>{if(t.pointerId===o){if(!r){if(Math.hypot(t.clientX-s,t.clientY-i)<f)return;if(!this.begin(e,t.pointerType||"mouse"))return void l.abort();r=!0,e.setPointerCapture?.(o),v.session.ghost=this.ghost(e,t),O(this)&&"copy"!==this.mode&&(v.session.silhouette=!0,v.session.wrappedLists=new Set(N(E(this))?[this]:[]),e.setAttribute("data-sf-sortable-lifted",""),this.retarget(t.clientX,t.clientY))}t.preventDefault(),this.track(t.clientX,t.clientY)}},{signal:l.signal,passive:!1}),globalThis.addEventListener("pointerup",t=>{t.pointerId===o&&(l.abort(),r&&this.drop())},{signal:l.signal}),globalThis.addEventListener("pointercancel",a,{signal:l.signal}),globalThis.addEventListener("keydown",t=>{"Escape"===t.key&&r&&(t.preventDefault(),t.stopPropagation(),a())},{signal:l.signal,capture:!0})}ghost(t,e){const n=t.getBoundingClientRect(),s=t.cloneNode(!0);s.removeAttribute("id");for(const t of s.querySelectorAll("[id]"))t.removeAttribute("id");return s.classList.add("sf-sortable-ghost"),s.setAttribute("aria-hidden","true"),s.inert=!0,Object.assign(s.style,{width:`${n.width}px`,left:`${n.left}px`,top:`${n.top}px`}),v.session.offset={x:e.clientX-n.left,y:e.clientY-n.top},globalThis.document.body.append(s),s}track(t,e){v.session&&(v.session.pointer={x:t,y:e},v.session.ghost&&Object.assign(v.session.ghost.style,{left:t-v.session.offset.x+"px",top:e-v.session.offset.y+"px"}),this.retarget(t,e),this.startAutoScroll())}retarget(t,e){const n=globalThis.document.elementFromPoint(t,e),s=n?.closest?.("sf-sortable");for(const n of x){const s=n.resolve(t,e,y());if(s)return v.session.list=null,v.session.external={target:n,...s},void k(s.rect)}if(v.session.external=null,s&&C(s,v.session.group)&&v.session.silhouette&&O(s))return v.session.list=s,v.session.index=B(v.session,s,t,e),void k(null);if(v.session.placeholder?.remove(),s&&C(s,v.session.group)){const n=D(s,t,e);v.session.list=s,v.session.index=s===v.session.fromList&&"move"===v.session.mode&&n.index>v.session.sourceIndex?n.index-1:n.index,k(n.rect)}else v.session.list=null,k(null)}startAutoScroll(){if(!v.session||v.session.scrollFrame)return;const t=()=>{if(!v.session?.pointer)return;v.session.scrollFrame=0;const{x:e,y:n}=v.session.pointer,s=S(globalThis.document.elementFromPoint(e,n));if(!s)return;const i=s===globalThis.document.scrollingElement?{top:0,bottom:globalThis.innerHeight}:s.getBoundingClientRect(),o=s.scrollHeight-s.clientHeight;let r=0;n<i.top+g&&s.scrollTop>0?r=-Math.ceil((i.top+g-n)/4):n>i.bottom-g&&s.scrollTop<o&&(r=Math.ceil((n-i.bottom+g)/4)),r&&(s.scrollBy({top:r,behavior:"instant"}),this.retarget(e,n),v.session.scrollFrame=globalThis.requestAnimationFrame(t))};v.session.scrollFrame=globalThis.requestAnimationFrame(t)}drop(){if(!v.session)return;const t=v.session;if(t.external)return t.external.target.drop(y(),t.external.descriptor),void M(this,"dropped");if(t.list){const s=t.index;if(!(t.list===t.fromList&&s===t.sourceIndex))return e=t.list,n={item:t.item,from:t.from,to:t.list.getAttribute("id")||t.list.group,index:s,mode:t.mode},e.dispatchEvent(new globalThis.CustomEvent(l,{bubbles:!0,composed:!0,detail:Object.freeze(n)})),t.list.announce?.(b(m().dropped,{item:w(t.source),index:s+1,list:T(t.list)})),void M(this,"dropped")}var e,n;M(this,"cancelled")}keyboardTargets(){return[...globalThis.document.querySelectorAll("sf-sortable")].filter(t=>t===v.session?.fromList?"move"===v.session.mode:C(t,v.session?.group))}describeKeyboard(t=!0){if(!v.session)return;if(v.session.external)return k(v.session.external.rect),void(t&&this.announce(b(m().target,{target:v.session.external.label||""})));const e=v.session.list,n=E(e),s=e===v.session.fromList&&"move"===v.session.mode,i=n.length+(s?0:1),o=s&&v.session.index>v.session.sourceIndex?v.session.index+1:v.session.index;k(P(e,n,Math.min(o,n.length),"horizontal"===e.getAttribute("orientation"))),t&&this.announce(b(m().moved,{index:v.session.index+1,total:i,list:T(e)}))}onKeyDown(t){const e=t.target.closest?.(c);if(!v.session){if(!e||e.closest("sf-sortable")!==this||t.target!==e)return;if(" "!==t.key&&"Enter"!==t.key)return;if(t.preventDefault(),!this.begin(e,"keyboard"))return;const n=()=>{v.session?.fromList===this&&(this.announce(m().cancelled),M(this,"cancelled"))},s={signal:v.session.cleanup.signal};if(this.addEventListener("focusout",t=>{t.relatedTarget&&this.contains(t.relatedTarget)||globalThis.setTimeout(()=>{this.contains(globalThis.document.activeElement)||n()},0)},s),globalThis.document.addEventListener("pointerdown",t=>{this.contains(t.target)||n()},{...s,capture:!0}),"copy"===v.session.mode){const[t]=this.keyboardTargets(),e=[...x].flatMap(t=>(t.keyboardTargets?.(y())||[]).map(e=>({target:t,...e})));if(t)v.session.list=t,v.session.index=E(t).length;else{if(!e.length)return void M(this,"cancelled");v.session.external=e[0]}}if(v.session.external)return this.describeKeyboard(!1),void this.announce(`${b(m().picked,{item:w(e),index:1,total:1,list:""}).split(".")[0]}. ${b(m().target,{target:v.session.external.label||""})}`);const i=E(v.session.list);return this.describeKeyboard(!1),void this.announce(b(m().picked,{item:w(e),index:v.session.index+1,total:i.length,list:T(v.session.list)}))}if("keyboard"!==v.session.input||v.session.fromList!==this)return;const n=this.keyboardTargets(),s=[...x].flatMap(t=>(t.keyboardTargets?.(y())||[]).map(e=>({target:t,...e})));if("Escape"===t.key||"Tab"===t.key)return"Escape"===t.key&&t.preventDefault(),this.announce(m().cancelled),void M(this,"cancelled");if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void this.drop();const i={ArrowUp:-1,ArrowDown:1}[t.key],o={ArrowLeft:-1,ArrowRight:1}[t.key];if(void 0===i&&void 0===o)return;if(t.preventDefault(),v.session.external){const t=s.findIndex(t=>t.target===v.session.external.target&&JSON.stringify(t.descriptor)===JSON.stringify(v.session.external.descriptor)),e=s[t+(i??o)];return e?v.session.external=e:(i??o)<0&&n.length&&(v.session.external=null,v.session.list=n.at(-1),v.session.index=E(v.session.list).length-(v.session.list===v.session.fromList&&"move"===v.session.mode?1:0)),void this.describeKeyboard()}const r=v.session.list,l=E(r).length-(r===v.session.fromList&&"move"===v.session.mode?1:0);if(void 0!==i){const t=v.session.index+i;t>=0&&t<=l?v.session.index=t:t>l&&void 0===o&&s.length&&n.indexOf(r)===n.length-1&&(v.session.external=s[0])}else{const t=n[n.indexOf(r)+o];t?(v.session.list=t,v.session.index=Math.min(v.session.index,E(t).length-(t===v.session.fromList&&"move"===v.session.mode?1:0))):o>0&&s.length&&(v.session.external=s[0])}this.describeKeyboard()}}return t.define("sf-sortable",n),n}function q(t,e={}){if(!(t instanceof globalThis.Element)||"string"!=typeof e.items)throw new TypeError("attachSortable needs a container and an items selector");const n=globalThis.document,s="line"===e.preview?"line":"column",i="function"==typeof e.groupOf?e.groupOf:()=>"",o="function"==typeof e.canStart?e.canStart:()=>!0,r="function"==typeof e.cellsOf?e.cellsOf:t=>[t],l=n.createElement("div");l.className="sf-sortable-live",l.setAttribute("aria-live","polite"),n.body.append(l);const a=new AbortController;let c=null;const u=n=>[...t.querySelectorAll(e.items)].filter(t=>i(t)===n),d=i=>{const o=u(c.group).filter(t=>t!==c.item).map(t=>t.getBoundingClientRect());let r=o.length;for(let t=0;t<o.length;t+=1)if(i<o[t].left+o[t].width/2){r=t;break}c.index=r;const l=(e.extent?.isConnected?e.extent:t).getBoundingClientRect(),a=c.width,d=o[r],h=o[r-1];let f;f="column"===s?r>c.originalIndex&&h?h.right-a:d?d.left:h?h.right-a:l.left:(d?d.left:h?h.right:l.left)-1,Object.assign((()=>{if(c.outline)return c.outline;const t=n.createElement("div");return t.className="column"===s?"sf-sortable-column-outline":"sf-sortable-indicator",t.setAttribute("aria-hidden","true"),n.body.append(t),c.outline=t,t})().style,{left:`${f}px`,top:`${l.top}px`,width:"column"===s?`${a}px`:"2px",height:`${l.height}px`})},h=s=>{const i=c;if(c=null,!i)return;i.pending.abort(),i.ghost?.remove(),i.outline?.remove();for(const t of i.cells)t.removeAttribute("data-sf-sortable-column-source");if(n.documentElement.removeAttribute("data-sf-sortable-active"),!i.started)return;const o=t=>{t.preventDefault(),t.stopImmediatePropagation()};if(t.addEventListener("click",o,{capture:!0,once:!0}),globalThis.setTimeout(()=>t.removeEventListener("click",o,{capture:!0}),0),!s)return void(l.textContent=m().cancelled);if(void 0===i.index||i.index===i.originalIndex)return;const r=i.item.getAttribute("data-sf-sortable-item")||i.item.dataset.key||"";l.textContent=b(m().dropped,{item:w(i.item),index:i.index+1,list:e.label||""}),e.onIntent?.({item:r,from:i.group,index:i.index,group:i.group})};return t.addEventListener("pointerdown",s=>{if(0!==s.button||c||v.session)return;const l=s.target.closest?.(e.items);if(!l||!t.contains(l)||!o(s,l))return;const a=i(l),p=u(a);if(p.length<2)return;const b=s.clientX,m=s.clientY,x=new AbortController,y=l.getBoundingClientRect();c={item:l,group:a,pending:x,started:!1,cells:[],width:y.width,originalIndex:p.indexOf(l)};globalThis.addEventListener("pointermove",e=>{if(e.pointerId===s.pointerId&&c){if(!c.started){if(Math.hypot(e.clientX-b,e.clientY-m)<f)return;c.started=!0,n.documentElement.setAttribute("data-sf-sortable-active","");const t=l.cloneNode(!0);t.removeAttribute("id");for(const e of t.querySelectorAll("[id]"))e.removeAttribute("id");t.classList.add("sf-sortable-ghost"),t.setAttribute("aria-hidden","true"),t.inert=!0,Object.assign(t.style,{width:`${y.width}px`,height:`${y.height}px`,left:`${y.left}px`,top:`${y.top}px`}),n.body.append(t),c.ghost=t,c.offset={x:b-y.left,y:m-y.top},c.cells=r(l).filter(Boolean);for(const t of c.cells)t.setAttribute("data-sf-sortable-column-source","")}e.preventDefault(),Object.assign(c.ghost.style,{left:e.clientX-c.offset.x+"px",top:e.clientY-c.offset.y+"px"}),(e=>{for(let n=t.parentElement;n;n=n.parentElement){const t=globalThis.getComputedStyle(n);if(!/(auto|scroll)/u.test(t.overflowX)||n.scrollWidth<=n.clientWidth)continue;const s=n.getBoundingClientRect();return void(e<s.left+g?n.scrollBy({left:-Math.ceil((s.left+g-e)/4),behavior:"instant"}):e>s.right-g&&n.scrollBy({left:Math.ceil((e-s.right+g)/4),behavior:"instant"}))}})(e.clientX),d(e.clientX)}},{signal:x.signal,passive:!1}),globalThis.addEventListener("pointerup",t=>{t.pointerId===s.pointerId&&h(!0)},{signal:x.signal}),globalThis.addEventListener("pointercancel",()=>h(!1),{signal:x.signal}),globalThis.addEventListener("keydown",t=>{"Escape"===t.key&&c?.started&&(t.preventDefault(),t.stopPropagation(),h(!1))},{signal:x.signal,capture:!0})},{signal:a.signal}),()=>{h(!1),a.abort(),l.remove()}}n.d(e,["WK",0,a,"dd",0,l]),s()}catch(K){s(K)}})}};const e={};function n(s){const i=e[s];if(void 0!==i)return i.exports;const o=e[s]={exports:{}};return t[s](o,o.exports,n),o.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",s=t?Symbol("webpack exports"):"__webpack_exports__",i=t?Symbol("webpack error"):"__webpack_error__",o=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};n.a=(t,n,r)=>{let l;r&&((l=[]).d=-1);const a=new Set,c=t.exports;let u,d,h;const f=new Promise((t,e)=>{h=e,d=t});f[s]=c,f[e]=t=>(l&&t(l),a.forEach(t),f.catch(t=>{})),t.exports=f;n(t=>{let n;u=(t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){const n=[];n.d=0,t.then(t=>{r[s]=t,o(n)},t=>{r[i]=t,o(n)});const r={};return r[e]=t=>t(n),r}}const n={};return n[e]=t=>{},n[s]=t,n}))(t);const r=()=>u.map(t=>{if(t[i])throw t[i];return t[s]}),c=new Promise(t=>{n=()=>t(r),n.r=0;const s=t=>t!==l&&!a.has(t)&&(a.add(t),t&&!t.d&&(n.r++,t.push(n)));u.map(t=>t[e](s))});return n.r?c:r()},t=>(t?h(f[i]=t):d(c),o(l))),l?.d<0&&(l.d=0)}})(),n.d=(t,e)=>{if(Array.isArray(e))for(var s=0;s<e.length;){var i=e[s++],o=e[s++];n.o(t,i)?0===o&&s++:0===o?Object.defineProperty(t,i,{enumerable:!0,value:e[s++]}):Object.defineProperty(t,i,{enumerable:!0,get:o})}else for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);n("6064f55a0aa2")})();
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
"id": "smart.sortable",
|
|
4
4
|
"version": "1.0.0",
|
|
5
5
|
"title": "Sortable",
|
|
6
|
-
"summary": "Drag-and-drop list primitive for reordering, moving between lists and copying from a library by mouse, pen, touch and keyboard; reports intent only.",
|
|
6
|
+
"summary": "Drag-and-drop list primitive for reordering, moving between lists and copying from a library by mouse, pen, touch and keyboard, with an optional insertion point that opens a searchable inserter; reports intent only.",
|
|
7
7
|
"kind": "smart",
|
|
8
8
|
"reuse_mode": "whole",
|
|
9
9
|
"lifecycle": "experimental",
|
|
10
10
|
"tags": [
|
|
11
11
|
"sortable",
|
|
12
12
|
"drag-and-drop",
|
|
13
|
-
"editor"
|
|
13
|
+
"editor",
|
|
14
|
+
"inserter"
|
|
14
15
|
],
|
|
15
16
|
"capabilities": [
|
|
16
17
|
"interaction",
|
|
@@ -23,7 +24,11 @@
|
|
|
23
24
|
],
|
|
24
25
|
"exported_parts": [],
|
|
25
26
|
"composition": {
|
|
26
|
-
"uses": [
|
|
27
|
+
"uses": [
|
|
28
|
+
"smart.context-menu",
|
|
29
|
+
"component.icon-buttons",
|
|
30
|
+
"component.icons"
|
|
31
|
+
],
|
|
27
32
|
"public_parts": []
|
|
28
33
|
},
|
|
29
34
|
"inputs": {
|
|
@@ -65,6 +70,11 @@
|
|
|
65
70
|
"line"
|
|
66
71
|
],
|
|
67
72
|
"description": "How a pointer drag shows where the item lands: silhouette lifts the item out of the list and opens an outline of its size at the place it would take, the list making room; line draws a thin line there and leaves the list as it is. Keyboard moves and external targets always use the line; a list that wraps into a grid opens the outline as one of its cells, in reading order."
|
|
73
|
+
},
|
|
74
|
+
"inserter-items": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"default": "",
|
|
77
|
+
"description": "Opt-in insertion point. JSON array (or the inserterItems property) of [{value, label, icon?, caption?, keywords?, disabled?}], with {type: \"heading\", label} and {type: \"separator\"} to group them. When it holds at least one item, a \"+\" on the gap between items (and before the first, after the last) opens a searchable inserter of these kinds; empty or absent, the list draws and does nothing more than before."
|
|
68
78
|
}
|
|
69
79
|
},
|
|
70
80
|
"additionalProperties": false
|
|
@@ -85,6 +95,45 @@
|
|
|
85
95
|
"drop_targets": {
|
|
86
96
|
"type": "object",
|
|
87
97
|
"description": "SF.Sortable.registerSortableDropTarget({resolve, keyboardTargets, drop, leave}) joins non-list targets such as sf-composition-overlay to the same drag session; the session is shared across Smart bundles. Once loaded, SF.Sortable exposes SORTABLE_INTENT_EVENT, SORTABLE_STATE_EVENT, activeSortableSession, registerSortableDropTarget and sortableIndexAt."
|
|
98
|
+
},
|
|
99
|
+
"inserter": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"description": "The insertion point is one native icon button (size 1/3), the list's last tab stop, placed on the gap a pointer is near, after a focused row, or where its arrow keys put it. It opens sf-context-menu (openFor, local search over label, caption and keywords) anchored to the point. The component never creates the inserted item: it raises sf-sortable-insert and the host adds the item. Escape closes only the inserter, the innermost open surface (core open-surface-mark). Once loaded, SF.Sortable exposes SORTABLE_INSERT_EVENT.",
|
|
102
|
+
"properties": {
|
|
103
|
+
"property": {
|
|
104
|
+
"const": "inserterItems"
|
|
105
|
+
},
|
|
106
|
+
"attribute": {
|
|
107
|
+
"const": "inserter-items"
|
|
108
|
+
},
|
|
109
|
+
"item": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"required": [
|
|
112
|
+
"value",
|
|
113
|
+
"label"
|
|
114
|
+
],
|
|
115
|
+
"properties": {
|
|
116
|
+
"value": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
119
|
+
"label": {
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"icon": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"caption": {
|
|
126
|
+
"type": "string"
|
|
127
|
+
},
|
|
128
|
+
"keywords": {
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"disabled": {
|
|
132
|
+
"type": "boolean"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
88
137
|
}
|
|
89
138
|
},
|
|
90
139
|
"methods": {},
|
|
@@ -140,6 +189,29 @@
|
|
|
140
189
|
}
|
|
141
190
|
}
|
|
142
191
|
}
|
|
192
|
+
},
|
|
193
|
+
"sf-sortable-insert": {
|
|
194
|
+
"summary": "The person chose a kind in the inserter for a place in the list; the host creates the item at index. Bubbles, is composed and is cancelable: preventDefault() refuses and keeps the inserter open.",
|
|
195
|
+
"payload": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"required": [
|
|
198
|
+
"index",
|
|
199
|
+
"item",
|
|
200
|
+
"to"
|
|
201
|
+
],
|
|
202
|
+
"properties": {
|
|
203
|
+
"index": {
|
|
204
|
+
"type": "integer",
|
|
205
|
+
"minimum": 0
|
|
206
|
+
},
|
|
207
|
+
"item": {
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"to": {
|
|
211
|
+
"type": "string"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
143
215
|
}
|
|
144
216
|
},
|
|
145
217
|
"state": {
|
|
@@ -149,11 +221,16 @@
|
|
|
149
221
|
"picked",
|
|
150
222
|
"dropped",
|
|
151
223
|
"cancelled"
|
|
224
|
+
],
|
|
225
|
+
"inserter": [
|
|
226
|
+
"closed",
|
|
227
|
+
"open"
|
|
152
228
|
]
|
|
153
229
|
},
|
|
154
230
|
"visual_states": [
|
|
155
231
|
"default",
|
|
156
|
-
"active"
|
|
232
|
+
"active",
|
|
233
|
+
"open"
|
|
157
234
|
]
|
|
158
235
|
},
|
|
159
236
|
"persistence": {
|
|
@@ -169,7 +246,8 @@
|
|
|
169
246
|
"forbidden_client_responsibilities": [
|
|
170
247
|
"backend access decisions",
|
|
171
248
|
"host route invention",
|
|
172
|
-
"saving or reordering host data"
|
|
249
|
+
"saving or reordering host data",
|
|
250
|
+
"creating the inserted item"
|
|
173
251
|
]
|
|
174
252
|
},
|
|
175
253
|
"security": {
|
|
@@ -191,9 +269,12 @@
|
|
|
191
269
|
"ArrowLeft",
|
|
192
270
|
"ArrowRight",
|
|
193
271
|
"Escape",
|
|
194
|
-
"Tab"
|
|
272
|
+
"Tab",
|
|
273
|
+
"+",
|
|
274
|
+
"Home",
|
|
275
|
+
"End"
|
|
195
276
|
],
|
|
196
|
-
"focus": "Items become focusable and describe the instructions. Space or Enter picks up, arrows move within a list and to other accepting lists or external targets, Space or Enter drops, Escape or Tab cancels. Every step is announced in a polite live region in the page language."
|
|
277
|
+
"focus": "Items become focusable and describe the instructions. Space or Enter picks up, arrows move within a list and to other accepting lists or external targets, Space or Enter drops, Escape or Tab cancels. Every step is announced in a polite live region in the page language. With inserter items, + on a focused row opens the inserter for the place after it, and the insertion point is the list's last tab stop: arrows move it between places, Home and End go to the first and the last, Enter or Space opens the inserter; in the inserter typing filters, arrows and Enter choose, Escape closes it and returns focus."
|
|
197
278
|
},
|
|
198
279
|
"presentation": {
|
|
199
280
|
"themes": [
|
|
@@ -261,41 +342,47 @@
|
|
|
261
342
|
"source_artifacts": [
|
|
262
343
|
{
|
|
263
344
|
"path": "src/smart/sortable/index.js",
|
|
264
|
-
"sha256": "
|
|
345
|
+
"sha256": "298c463e0d0c1634783614a4bbab59757767e984027041319f14dadb1cff2c61"
|
|
265
346
|
},
|
|
266
347
|
{
|
|
267
348
|
"path": "src/smart/sortable/scss/_smart__sortable.scss",
|
|
268
|
-
"sha256": "
|
|
349
|
+
"sha256": "4f85a0e023d17b1f7a6fd191fd12f4c87e5609e70476c69559c2e04dc7b1f0a2"
|
|
269
350
|
},
|
|
270
351
|
{
|
|
271
352
|
"path": "src/smart/sortable/rule.js",
|
|
272
|
-
"sha256": "
|
|
353
|
+
"sha256": "b57af898729e1a942d2097d75cffab5aaf17c28f479cddecb876c23e266a7781"
|
|
273
354
|
},
|
|
274
355
|
{
|
|
275
356
|
"path": "src/smart/sortable/docs.md",
|
|
276
|
-
"sha256": "
|
|
357
|
+
"sha256": "42b58f27a3bb1a34faf147ea1bf6eba31c9c944c6777a583b18fc0f0195371e9"
|
|
277
358
|
},
|
|
278
359
|
{
|
|
279
360
|
"path": "src/core/js/composition/sortable.mjs",
|
|
280
361
|
"sha256": "871e5e7c95e47ce43dbe7616a984cfdc0e7a048900f6d438121bd84f7a6bf056"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"path": "src/core/js/composition/sortable-inserter.mjs",
|
|
365
|
+
"sha256": "3fc947dc1dd8cbfd57a8f7c6204bf853053c8765421dc6fdec7bf234eff4d965"
|
|
281
366
|
}
|
|
282
367
|
],
|
|
283
368
|
"generated_runtime": []
|
|
284
369
|
},
|
|
285
370
|
"ai_guidance": {
|
|
286
|
-
"use_when": "Use sf-sortable when people reorder or move host items, or drag library entries onto an editor canvas. Apply sf-sortable-intent to the host model with an expected revision; a refusal leaves the page unchanged.",
|
|
371
|
+
"use_when": "Use sf-sortable when people reorder or move host items, or drag library entries onto an editor canvas. Apply sf-sortable-intent to the host model with an expected revision; a refusal leaves the page unchanged. Give inserter-items when people insert new items at a place in the list; create the item on sf-sortable-insert.",
|
|
287
372
|
"do_not": [
|
|
288
373
|
"Do not copy generated ui-smart code",
|
|
289
374
|
"Do not let the component move host DOM or save data",
|
|
290
375
|
"Do not rely on pointer dragging alone; keep the keyboard path",
|
|
291
|
-
"Do not bundle a private drag session; use SF.Sortable.registerSortableDropTarget"
|
|
376
|
+
"Do not bundle a private drag session; use SF.Sortable.registerSortableDropTarget",
|
|
377
|
+
"Do not let the component create the inserted item; add it on sf-sortable-insert"
|
|
292
378
|
],
|
|
293
379
|
"required_reads": [
|
|
294
380
|
"inputs",
|
|
295
381
|
"item_contract",
|
|
296
382
|
"events",
|
|
297
383
|
"ownership",
|
|
298
|
-
"provenance"
|
|
384
|
+
"provenance",
|
|
385
|
+
"contracts"
|
|
299
386
|
],
|
|
300
387
|
"minimal_example": "<sf-sortable id=\"sections\" group=\"sections\" label=\"Sections\"><div data-sf-sortable-item=\"s1\">Section 1</div><div data-sf-sortable-item=\"s2\">Section 2</div></sf-sortable>",
|
|
301
388
|
"owner_commands": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer sf.components{.sf-field-inherited-slot{flex:none;gap:var(--sf-space-1\/4);min-width:0;min-inline-size:0}.sf-field-inherited-slot--size-1\/2{--sf-field-inherited-slot--inset: calc((var(--sf-ui-1\/2--control-height) - var(--sf-ui-1\/3--control-height)) / 2 - var(--sf-px))}.sf-field-inherited-slot--size-1{--sf-field-inherited-slot--inset: calc((var(--sf-ui-1--control-height) - var(--sf-ui-1\/2--control-height)) / 2 - var(--sf-px))}.sf-field-inherited-slot--size-2{--sf-field-inherited-slot--inset: calc((var(--sf-ui-2--control-height) - var(--sf-ui-1--control-height)) / 2 - var(--sf-px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-field-inherited{padding-right:0px;padding-right:var(--sf-field-inherited-slot--inset, 0px)}@supports not (padding-inline-end: initial){html:not([dir="rtl"]) .sf-field-inherited{padding-right:0px;padding-right:var(--sf-field-inherited-slot--inset, 0px)}}.sf-field-inherited:where(:dir(ltr)){padding-right:0px;padding-right:var(--sf-field-inherited-slot--inset, 0px)}_:-ms-input-placeholder, [dir="rtl"] .sf-field-inherited{padding-left:0px;padding-left:var(--sf-field-inherited-slot--inset, 0px)}@supports not (padding-inline-end: initial){[dir="rtl"] .sf-field-inherited{padding-left:0px;padding-left:var(--sf-field-inherited-slot--inset, 0px)}}.sf-field-inherited:where(:dir(rtl)){padding-left:0px;padding-left:var(--sf-field-inherited-slot--inset, 0px)}.sf-field-inherited{color:var(--sf-on-surface-variant);white-space:nowrap;-webkit-padding-end:0px;padding-inline-end:0px;-webkit-padding-end:var(--sf-field-inherited-slot--inset, 0px);padding-inline-end:var(--sf-field-inherited-slot--inset, 0px)}.sf-field-inherited--size-1\/3{font-size:var(--sf-text-size-1\/3);line-height:var(--sf-text-height-1\/3)}.sf-field-inherited--size-1\/2{font-size:var(--sf-text-size-1\/2);line-height:var(--sf-text-height-1\/2)}.sf-field-inherited--size-1{font-size:var(--sf-text-size-1);line-height:var(--sf-text-height-1)}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-field-inherited-slot>.sf-field-reset{margin-right:0px;margin-right:var(--sf-field-inherited-slot--inset, 0px)}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-field-inherited-slot>.sf-field-reset{margin-right:0px;margin-right:var(--sf-field-inherited-slot--inset, 0px)}}.sf-field-inherited-slot>.sf-field-reset:where(:dir(ltr)){margin-right:0px;margin-right:var(--sf-field-inherited-slot--inset, 0px)}_:-ms-input-placeholder, [dir="rtl"] .sf-field-inherited-slot>.sf-field-reset{margin-left:0px;margin-left:var(--sf-field-inherited-slot--inset, 0px)}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-field-inherited-slot>.sf-field-reset{margin-left:0px;margin-left:var(--sf-field-inherited-slot--inset, 0px)}}.sf-field-inherited-slot>.sf-field-reset:where(:dir(rtl)){margin-left:0px;margin-left:var(--sf-field-inherited-slot--inset, 0px)}.sf-field-inherited-slot>.sf-field-reset{flex:none;-webkit-margin-end:0px;margin-inline-end:0px;-webkit-margin-end:var(--sf-field-inherited-slot--inset, 0px);margin-inline-end:var(--sf-field-inherited-slot--inset, 0px)}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-input-field>.sf-field-inherited-slot{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-input-field>.sf-field-inherited-slot{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}}.sf-input-field>.sf-field-inherited-slot:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-input-field>.sf-field-inherited-slot{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-input-field>.sf-field-inherited-slot{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}}.sf-input-field>.sf-field-inherited-slot:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}.sf-input-field>.sf-field-inherited-slot{align-self:center;-webkit-margin-end:calc(-1*0px);margin-inline-end:calc(-1*0px);-webkit-margin-end:calc(-1*var(--sf-input-field--padding-inline-end, 0px));margin-inline-end:calc(-1*var(--sf-input-field--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-input-field>.sf-field-inherited-slot>.sf-field-inherited{padding-right:0px;padding-right:var(--sf-input-field--padding-inline-end, 0px)}@supports not (padding-inline-end: initial){html:not([dir="rtl"]) .sf-input-field>.sf-field-inherited-slot>.sf-field-inherited{padding-right:0px;padding-right:var(--sf-input-field--padding-inline-end, 0px)}}.sf-input-field>.sf-field-inherited-slot>.sf-field-inherited:where(:dir(ltr)){padding-right:0px;padding-right:var(--sf-input-field--padding-inline-end, 0px)}_:-ms-input-placeholder, [dir="rtl"] .sf-input-field>.sf-field-inherited-slot>.sf-field-inherited{padding-left:0px;padding-left:var(--sf-input-field--padding-inline-end, 0px)}@supports not (padding-inline-end: initial){[dir="rtl"] .sf-input-field>.sf-field-inherited-slot>.sf-field-inherited{padding-left:0px;padding-left:var(--sf-input-field--padding-inline-end, 0px)}}.sf-input-field>.sf-field-inherited-slot>.sf-field-inherited:where(:dir(rtl)){padding-left:0px;padding-left:var(--sf-input-field--padding-inline-end, 0px)}.sf-input-field>.sf-field-inherited-slot>.sf-field-inherited{-webkit-padding-end:0px;padding-inline-end:0px;-webkit-padding-end:var(--sf-input-field--padding-inline-end, 0px);padding-inline-end:var(--sf-input-field--padding-inline-end, 0px)}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>input{--sf-dropdown-input--padding-inline-end: 0px;min-width:0;min-inline-size:0}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>input{--sf-dropdown-input--padding-inline-end: 0px;min-width:0;min-width:0;min-inline-size:0}.sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>input{--sf-dropdown-input--padding-inline-end: 0px;min-width:0;min-inline-size:0}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{position:static;flex:none;margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-block:calc(-1*var(--sf-dropdown-field--padding-top, 0px)) calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));-webkit-margin-end:calc(-1*0px);margin-inline-end:calc(-1*0px);-webkit-margin-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px));margin-inline-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{position:static;flex:none;margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-block:calc(-1*var(--sf-dropdown-field--padding-top, 0px)) calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));-webkit-margin-end:calc(-1*0px);margin-inline-end:calc(-1*0px);margin-inline-end:calc(-1*0px);-webkit-margin-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px));margin-inline-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(ltr)){margin-right:calc(-1*0px);margin-right:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button:where(:dir(rtl)){margin-left:calc(-1*0px);margin-left:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}.sf-dropdown .sf-dropdown-field[\:has\(\%3E.sf-field-inherited-slot\)]>button{position:static;flex:none;margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-block:calc(-1*var(--sf-dropdown-field--padding-top, 0px)) calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));-webkit-margin-end:calc(-1*0px);margin-inline-end:calc(-1*0px);margin-inline-end:calc(-1*0px);-webkit-margin-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px));margin-inline-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}.sf-dropdown .sf-dropdown-field:has(>.sf-field-inherited-slot)>button{position:static;flex:none;margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-block:calc(-1*var(--sf-dropdown-field--padding-top, 0px)) calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));-webkit-margin-end:calc(-1*0px);margin-inline-end:calc(-1*0px);-webkit-margin-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px));margin-inline-end:calc(-1*var(--sf-icon-button--padding-inline-end, 0px))}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot{margin-top:calc(-1*0px);margin-bottom:calc(-1*0px);margin-block:calc(-1*0px) calc(-1*0px);margin-top:calc(-1*0px);margin-top:calc(-1*var(--sf-dropdown-field--padding-top, 0px));margin-bottom:calc(-1*0px);margin-bottom:calc(-1*var(--sf-dropdown-field--padding-bottom, 0px));margin-block:calc(-1*var(--sf-dropdown-field--padding-top, 0px)) calc(-1*var(--sf-dropdown-field--padding-bottom, 0px))}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited{padding-right:var(--sf-space-1\/4)}@supports not (padding-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited{padding-right:var(--sf-space-1\/4)}}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited:where(:dir(ltr)){padding-right:var(--sf-space-1\/4)}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited{padding-left:var(--sf-space-1\/4)}@supports not (padding-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited{padding-left:var(--sf-space-1\/4)}}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited:where(:dir(rtl)){padding-left:var(--sf-space-1\/4)}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-inherited{-webkit-padding-end:var(--sf-space-1\/4);padding-inline-end:var(--sf-space-1\/4)}_:-ms-input-placeholder, html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{margin-right:0}@supports not (margin-inline-end: initial){html:not([dir="rtl"]) .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{margin-right:0}}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset:where(:dir(ltr)){margin-right:0}_:-ms-input-placeholder, [dir="rtl"] .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{margin-left:0}@supports not (margin-inline-end: initial){[dir="rtl"] .sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{margin-left:0}}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset:where(:dir(rtl)){margin-left:0}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{-webkit-margin-end:0;margin-inline-end:0}.sf-dropdown.sf-dropdown--size-1\/2 .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{--sf-field-reset--padding: var(--sf-ui-1\/3--space-y-tightness-default)}.sf-dropdown.sf-dropdown--size-1 .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{--sf-field-reset--padding: var(--sf-ui-1\/2--space-y-tightness-default)}.sf-dropdown.sf-dropdown--size-2 .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{--sf-field-reset--padding: var(--sf-ui-1--space-y-tightness-default)}.sf-dropdown .sf-dropdown-field>.sf-field-inherited-slot>.sf-field-reset{--sf-icon-button--padding-top: var(--sf-field-reset--padding);--sf-icon-button--padding-bottom: var(--sf-field-reset--padding);--sf-icon-button--padding-inline-start: var(--sf-field-reset--padding);--sf-icon-button--padding-inline-end: var(--sf-field-reset--padding)}.sf-textarea-inherited,.sf-switch-inherited,.sf-color-inherited-slot{--sf-field-inherited-slot--inset: 0px}.sf-textarea-inherited{justify-content:flex-end}sf-switch[data-inherited] .sf-switch-toggler{opacity:.64}}
|
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
(()=>{"use strict";var t={"67eed2647f47"(t,e,s){s.d(e,{z:()=>a});const n=new WeakMap,i=new WeakSet;function a(t,e){const s=t.ownerDocument;i.has(s)||(s.addEventListener("reset",t=>{const e=t.target;if("FORM"!==e?.tagName)return;const s=Array.from(e.elements);setTimeout(()=>{if(!t.defaultPrevented)for(const t of s)if(t.isConnected&&t.form===e)for(const e of n.get(t)||[])e()},0)},!0),i.add(s));let a=n.get(t);return a||n.set(t,a=new Set),a.add(e),()=>a.delete(e)}},d21a38718c5d(t,e,s){s.d(e,{QS:()=>d,UL:()=>f,DR:()=>u});class n{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const s=t.match(/\(([^)]+)\)/g);s&&s.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const s=this.getUtilityMap();if(!s||!s[e])return;this.extractUtilityClasses(s[e]).forEach(e=>t.classList.add(e))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const i=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)};var a=s("67eed2647f47");const o="label.sf-switch",r="sfSwitchBound";function c(t,e=!1){if(null==t||""===t)return e;if("boolean"==typeof t)return t;const s=String(t).toLowerCase();return["1","true","yes","on","checked","disabled"].includes(s)}function l(t){if(!t)return{};return{input:t.querySelector('input[type="checkbox"]'),toggler:t.querySelector(".sf-switch-toggler"),inner:t.querySelector(".sf-switch-inner"),description:t.querySelector(".sf-switch-description")}}function h(t){const{input:e,toggler:s,inner:n,description:i}=l(t);if(!e||!s||!n)return;const a=!!e.checked,o=!!e.disabled,r=t.dataset.sfSwitchOnText||"",c=t.dataset.sfSwitchOffText||"",h=!(!r||!c);t.classList.toggle("active",a),t.classList.toggle("disabled",o),s.removeAttribute("aria-hidden"),n.setAttribute("aria-hidden","true"),i&&h&&(i.textContent=a?r:c)}function d(t){if(!t||"1"===t.dataset[r])return;const{input:e}=l(t);if(!e)return;const s=()=>h(t);t.__sfSwitchHandleChange=s,e.addEventListener("change",s),t.__sfSwitchReleaseReset=(0,a.z)(e,s),t.dataset[r]="1",h(t)}function u(t){if(!t)return;t.__sfSwitchReleaseReset?.(),delete t.__sfSwitchReleaseReset;const{input:e}=l(t);e&&t.__sfSwitchHandleChange&&e.removeEventListener("change",t.__sfSwitchHandleChange),delete t.__sfSwitchHandleChange,delete t.dataset[r]}function p(t){(t instanceof Element||t===document)&&(t instanceof Element&&t.matches?.(o)&&d(t),t.querySelectorAll?.(o).forEach(d))}function f(t,e={}){if(!(t instanceof HTMLInputElement)||"checkbox"!==t.type)return!1;Object.prototype.hasOwnProperty.call(e,"checked")&&(t.checked=c(e.checked)),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=c(e.disabled));const s=t.closest(o);return s&&h(s),!0}function m(t=document){p(t)}i("Switch",class extends n{static componentName="Switch";html=null;constructor(t){super(t);const{size:e="1",title:s="",label:n=s,description:i="",help:a="",checked:o=!1,disabled:r=!1,name:l="",on:h,off:d,value:u}=this.params||{},p=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-switch",`sf-switch--size-${e}`,"flex"),p&&this.template.classList.add(...`${p}`.split(" ").filter(Boolean)),this.toggler=document.createElement("span"),this.toggler.classList.add("sf-switch-toggler","flex","items-cross-center"),this.input=document.createElement("input"),this.input.type="checkbox",this.input.setAttribute("role","switch"),l&&(this.input.name=l),void 0!==u&&(this.input.value=u),this.hasToggleText=!(!d||!h),this.onText=h||"",this.offText=d||"";const f=this.hasToggleText?c(o)?this.onText:this.offText:i;this.input.checked=c(o),this.input.defaultChecked=this.input.checked,this.input.disabled=c(r),this.hasToggleText&&(this.template.dataset.sfSwitchOnText=this.onText,this.template.dataset.sfSwitchOffText=this.offText),Object.entries(this.attrs).filter(([t])=>!["class","className","on","off"].includes(t)).forEach(([t,e])=>{null!=e&&this.input.setAttribute(t,e)}),this.inner=document.createElement("span"),this.inner.classList.add("sf-switch-inner"),this.inner.setAttribute("aria-hidden","true"),this.toggler.append(this.input,this.inner),this.template.append(this.toggler),(n||f||a)&&(this.containerWrap=document.createElement("span"),this.containerWrap.classList.add("sf-switch-container-wrap","flex","flex-col","text-start","flex-1"),(n||a)&&(this.top=document.createElement("span"),this.top.classList.add("sf-switch-top","flex"),n&&(this.container=document.createElement("span"),this.container.classList.add("sf-switch-container","flex","items-cross-center","content-main-center"),this.text=document.createElement("span"),this.text.classList.add("sf-switch-text"),this.text.textContent=n,this.container.append(this.text),this.top.append(this.container)),a&&(this.helpIcon=document.createElement("i"),this.helpIcon.classList.add("sf-icon"),this.helpIcon.setAttribute("aria-hidden","true"),this.helpIcon.textContent=a,this.top.append(this.helpIcon)),this.containerWrap.append(this.top)),f&&(this.description=document.createElement("span"),this.description.classList.add("sf-switch-description"),this.description.textContent=f,this.containerWrap.append(this.description)),this.template.append(this.containerWrap))}init(){d(this.template)}destroyInternal(){this.template&&u(this.template)}}),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Switch=window.SF.Switch||{},window.SF.Switch.setState=f),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>m()):m();new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&p(t)})})}).observe(document.documentElement,{childList:!0,subtree:!0})},"078aa87e580e"(t,e,s){s.d(e,{n:()=>i});var n=s("67eed2647f47");function i(t,e){Object.prototype.hasOwnProperty.call(t,"_resetChecked")||(t._resetChecked=!!t.checked);const s=e.checked;return e.defaultChecked=t._resetChecked,e.checked=s,(0,n.z)(e,()=>{t.getInputElement()===e&&t._handleChange()})}},"70333283d751"(t,e,s){s.a(t,async(t,e)=>{try{var n=s("fbe0570fcc69"),i=s("d21a38718c5d"),a=s("d39911485561"),o=s("078aa87e580e"),r=t([n,a]);[n,a]=r.then?(await r)():r;var c=s.n(n);class l extends(c()){static get props(){return{size:{default:"1"},label:{default:""},description:{default:""},help:{default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},name:{default:""},value:{default:""},ariaLabel:{attribute:"aria-label",default:""}}}constructor(){super(),this._boundRoot=null}get size(){return this.getAttribute("size")||"1"}get label(){return this.getAttribute("label")||""}get ariaLabel(){return this.getProp("ariaLabel")||""}get description(){return this.getAttribute("description")||""}get help(){return this.getAttribute("help")||""}get checked(){return this.getBooleanAttr("checked",!1)}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}get disabled(){return this.getBooleanAttr("disabled",!1)}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get name(){return this.getAttribute("name")||""}get value(){return this.getAttribute("value")||""}set value(t){null!=t?this.setAttribute("value",String(t)):this.removeAttribute("value")}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this})}template(){return(0,a.$)(this.templateContext())}afterRender(){if(this._releaseReset?.(),this._releaseReset=null,this._boundRoot&&((0,i.DR)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(".sf-switch"),this._boundRoot){(0,i.QS)(this._boundRoot);const t=this.getInputElement();t&&((0,i.UL)(t,{checked:this.checked,disabled:this.disabled}),t.addEventListener("change",this._handleChange),this._releaseReset=(0,o.n)(this,t))}}onDisconnected(){this._releaseReset?.(),this._releaseReset=null;const t=this.getInputElement();t&&t.removeEventListener("change",this._handleChange),this._boundRoot&&((0,i.DR)(this._boundRoot),this._boundRoot=null)}_handleChange=()=>{const t=this.getInputElement();t&&(t.checked?this.setAttribute("checked",""):this.removeAttribute("checked"))};getInputElement(){return this.querySelector('.sf-switch input[type="checkbox"]')}isChecked(){return!!this.getInputElement()?.checked}setChecked(t=!1){return this.checked=!!t,this.setState({checked:!!t}),this}setDisabled(t=!1){return this.disabled=!!t,this.setState({disabled:!!t}),this}get state(){const t=this.getInputElement();return{checked:!!t?.checked,disabled:!!t?.disabled,name:t?.name||"",value:t?.value||""}}setState(t={}){const e=this.getInputElement();return e?((0,i.UL)(e,t),Object.prototype.hasOwnProperty.call(t,"checked")&&(this.toBoolean(t.checked)?this.setAttribute("checked",""):this.removeAttribute("checked")),Object.prototype.hasOwnProperty.call(t,"disabled")&&(this.toBoolean(t.disabled)?this.setAttribute("disabled",""):this.removeAttribute("disabled")),this):(super.setState(t),this)}onChange(t,e){return"function"==typeof t&&this.addEventListener("change",t,e),this}onFocus(t,e){return"function"==typeof t&&this.addEventListener("focusin",t,e),this}onBlur(t,e){return"function"==typeof t&&this.addEventListener("focusout",t,e),this}}l.define("sf-switch"),e()}catch(t){e(t)}})},d39911485561(t,e,s){s.a(t,async(t,n)=>{try{s.d(e,{$:()=>r});var i=s("ddf1cdb42ecc"),a=t([i]),o=a.then?(await a)():a;i=o[0];function r(t){const{size:e,label:s,description:n,help:a,checked:o,disabled:r,name:c,value:l,ariaLabel:h}=t,d=["sf-switch",`sf-switch--size-${e}`,"flex",t.rootClass],u=t.component?.hasSlotContent?.("label")?t.component.getSlotContent("label"):s?i.html`<span class="sf-switch-text">${s}</span>`:"",p=t.component?.hasSlotContent?.("description")?t.component.getSlotContent("description"):n?i.html`<span class="sf-switch-description">${n}</span>`:"",f=t.component?.hasSlotContent?.("help")?t.component.getSlotContent("help"):a?i.html`<i class="sf-icon" aria-hidden="true">${a}</i>`:"",m=!!(u||p||f);return i.html`
|
|
2
|
-
<
|
|
1
|
+
(()=>{"use strict";var e={"67eed2647f47"(e,t,i){i.d(t,{z:()=>r});const s=new WeakMap,n=new WeakSet;function r(e,t){const i=e.ownerDocument;n.has(i)||(i.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const i=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of i)if(e.isConnected&&e.form===t)for(const t of s.get(e)||[])t()},0)},!0),n.add(i));let r=s.get(e);return r||s.set(e,r=new Set),r.add(t),()=>r.delete(t)}},d21a38718c5d(e,t,i){i.d(t,{QS:()=>l,UL:()=>f,DR:()=>u});class s{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(e){this.props=e,this.id=e?.id,this.params=e?.param,this.attrs=e?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(e){if(!Array.isArray(e))return[];const t=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const i=e.match(/\(([^)]+)\)/g);i&&i.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&t.add(e.slice(1))})})}),Array.from(t)}applyLayoutUtilities(e,t){if(!e||!t)return;const i=this.getUtilityMap();if(!i||!i[t])return;this.extractUtilityClasses(i[t]).forEach(t=>e.classList.add(t))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const n=function(e,t){if(e&&t)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,t);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,t])}}else window.registerSfComponent(e,t)};var r=i("67eed2647f47");const a="label.sf-switch",h="sfSwitchBound";function o(e,t=!1){if(null==e||""===e)return t;if("boolean"==typeof e)return e;const i=String(e).toLowerCase();return["1","true","yes","on","checked","disabled"].includes(i)}function c(e){if(!e)return{};return{input:e.querySelector('input[type="checkbox"]'),toggler:e.querySelector(".sf-switch-toggler"),inner:e.querySelector(".sf-switch-inner"),description:e.querySelector(".sf-switch-description")}}function d(e){const{input:t,toggler:i,inner:s,description:n}=c(e);if(!t||!i||!s)return;const r=!!t.checked,a=!!t.disabled,h=e.dataset.sfSwitchOnText||"",o=e.dataset.sfSwitchOffText||"",d=!(!h||!o);e.classList.toggle("active",r),e.classList.toggle("disabled",a),i.removeAttribute("aria-hidden"),s.setAttribute("aria-hidden","true"),n&&d&&(n.textContent=r?h:o)}function l(e){if(!e||"1"===e.dataset[h])return;const{input:t}=c(e);if(!t)return;const i=()=>d(e);e.__sfSwitchHandleChange=i,t.addEventListener("change",i),e.__sfSwitchReleaseReset=(0,r.z)(t,i),e.dataset[h]="1",d(e)}function u(e){if(!e)return;e.__sfSwitchReleaseReset?.(),delete e.__sfSwitchReleaseReset;const{input:t}=c(e);t&&e.__sfSwitchHandleChange&&t.removeEventListener("change",e.__sfSwitchHandleChange),delete e.__sfSwitchHandleChange,delete e.dataset[h]}function p(e){(e instanceof Element||e===document)&&(e instanceof Element&&e.matches?.(a)&&l(e),e.querySelectorAll?.(a).forEach(l))}function f(e,t={}){if(!(e instanceof HTMLInputElement)||"checkbox"!==e.type)return!1;Object.prototype.hasOwnProperty.call(t,"checked")&&(e.checked=o(t.checked)),Object.prototype.hasOwnProperty.call(t,"disabled")&&(e.disabled=o(t.disabled));const i=e.closest(a);return i&&d(i),!0}function m(e=document){p(e)}n("Switch",class extends s{static componentName="Switch";html=null;constructor(e){super(e);const{size:t="1",title:i="",label:s=i,description:n="",help:r="",checked:a=!1,disabled:h=!1,name:c="",on:d,off:l,value:u}=this.params||{},p=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-switch",`sf-switch--size-${t}`,"flex"),p&&this.template.classList.add(...`${p}`.split(" ").filter(Boolean)),this.toggler=document.createElement("span"),this.toggler.classList.add("sf-switch-toggler","flex","items-cross-center"),this.input=document.createElement("input"),this.input.type="checkbox",this.input.setAttribute("role","switch"),c&&(this.input.name=c),void 0!==u&&(this.input.value=u),this.hasToggleText=!(!l||!d),this.onText=d||"",this.offText=l||"";const f=this.hasToggleText?o(a)?this.onText:this.offText:n;this.input.checked=o(a),this.input.defaultChecked=this.input.checked,this.input.disabled=o(h),this.hasToggleText&&(this.template.dataset.sfSwitchOnText=this.onText,this.template.dataset.sfSwitchOffText=this.offText),Object.entries(this.attrs).filter(([e])=>!["class","className","on","off"].includes(e)).forEach(([e,t])=>{null!=t&&this.input.setAttribute(e,t)}),this.inner=document.createElement("span"),this.inner.classList.add("sf-switch-inner"),this.inner.setAttribute("aria-hidden","true"),this.toggler.append(this.input,this.inner),this.template.append(this.toggler),(s||f||r)&&(this.containerWrap=document.createElement("span"),this.containerWrap.classList.add("sf-switch-container-wrap","flex","flex-col","text-start","flex-1"),(s||r)&&(this.top=document.createElement("span"),this.top.classList.add("sf-switch-top","flex"),s&&(this.container=document.createElement("span"),this.container.classList.add("sf-switch-container","flex","items-cross-center","content-main-center"),this.text=document.createElement("span"),this.text.classList.add("sf-switch-text"),this.text.textContent=s,this.container.append(this.text),this.top.append(this.container)),r&&(this.helpIcon=document.createElement("i"),this.helpIcon.classList.add("sf-icon"),this.helpIcon.setAttribute("aria-hidden","true"),this.helpIcon.textContent=r,this.top.append(this.helpIcon)),this.containerWrap.append(this.top)),f&&(this.description=document.createElement("span"),this.description.classList.add("sf-switch-description"),this.description.textContent=f,this.containerWrap.append(this.description)),this.template.append(this.containerWrap))}init(){l(this.template)}destroyInternal(){this.template&&u(this.template)}}),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Switch=window.SF.Switch||{},window.SF.Switch.setState=f),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>m()):m();new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&p(e)})})}).observe(document.documentElement,{childList:!0,subtree:!0})},"078aa87e580e"(e,t,i){i.d(t,{n:()=>n});var s=i("67eed2647f47");function n(e,t){Object.prototype.hasOwnProperty.call(e,"_resetChecked")||(e._resetChecked=!!e.checked);const i=t.checked;return t.defaultChecked=e._resetChecked,t.checked=i,(0,s.z)(t,()=>{e.getInputElement()===t&&e._handleChange()})}},"778671c79fa6"(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{vZ:()=>u});var n=i("ddf1cdb42ecc"),r=i("0d662e4d7d63"),a=e([n,r]);[n,r]=a.then?(await a)():a;const h="sf-field:reset",o={en:{inherited:"inherited",reset:"Reset to inherited",described:"Inherited: {value}"},ru:{inherited:"наследуется",reset:"Сбросить к наследуемому",described:"Наследуется: {value}"}},c=Object.freeze({"1/2":"1/3",1:"1/2",2:"1"}),d=e=>c[String(e)]||"1/2",l=e=>class extends e{constructor(){super(),this.__sfInheritedSync=()=>this.syncInheritedState(),this.addEventListener("input",this.__sfInheritedSync),this.addEventListener("change",this.__sfInheritedSync)}get inheritedValue(){return this.getAttribute("inherited-value")||""}set inheritedValue(e){null==e||""===e?this.removeAttribute("inherited-value"):this.setAttribute("inherited-value",String(e))}get inheritedText(){return this.getAttribute("inherited-text")||(0,r.pageText)(o,"inherited",this)}get resetLabel(){return this.getAttribute("reset-label")||(0,r.pageText)(o,"reset",this)}get hasInheritedValue(){return""!==this.inheritedValue}get isInherited(){return this.hasInheritedValue&&""===this.inheritedOwnValue()}inheritedOwnValue(){return String(this.value??"")}inheritedDisplayValue(){return this.inheritedValue}inheritedFocusTarget(){return null}clearOwnValue(){this.value=""}inheritedDescription(){return(0,r.pageText)(o,"described",this).replace("{value}",this.inheritedDisplayValue())}resetToInherited(){if(!this.hasInheritedValue||""===this.inheritedOwnValue())return!1;if(this.hasAttribute("disabled")||this.hasAttribute("readonly"))return!1;const e=new CustomEvent(h,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:this.inheritedOwnValue(),inheritedValue:this.inheritedValue,name:this.getAttribute("name")||""}});if(!this.dispatchEvent(e))return!1;this.clearOwnValue(),this.syncInheritedState();const t=()=>this.inheritedFocusTarget()?.focus?.({preventScroll:!0});return t(),this.contains(document.activeElement)||requestAnimationFrame(t),!0}syncInheritedState(){if(!this.hasInheritedValue&&!this.__sfInheritedDescribed)return void this.removeAttribute("data-inherited");const e=this.isInherited,t=this.hasInheritedValue&&!e;e?this.setAttribute("data-inherited","true"):this.removeAttribute("data-inherited"),this.querySelectorAll(":scope [data-inherited-marker]").forEach(t=>{t.hidden=!e}),this.querySelectorAll(":scope [data-inherited-reset]").forEach(e=>{e.hidden=!t});const i=this.inheritedFocusTarget();i&&(e?(i.setAttribute("aria-description",this.inheritedDescription()),this.__sfInheritedDescribed=i):this.__sfInheritedDescribed===i&&(i.removeAttribute("aria-description"),this.__sfInheritedDescribed=null))}};function u(e,{size:t="1",disabled:i=!1,className:s=""}={}){if(!e?.hasInheritedValue)return n.nothing;const r=d(t),a=e.isInherited;return n.html`
|
|
2
|
+
<span class="sf-field-inherited-slot sf-field-inherited-slot--size-${t} flex items-cross-center ${s}">
|
|
3
|
+
<span class="sf-field-inherited sf-field-inherited--size-${r}"
|
|
4
|
+
data-inherited-marker
|
|
5
|
+
aria-hidden="true"
|
|
6
|
+
?hidden=${!a}>${e.inheritedText}</span>
|
|
7
|
+
<button
|
|
8
|
+
type="button"
|
|
9
|
+
class="sf-field-reset sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${r}"
|
|
10
|
+
data-inherited-reset
|
|
11
|
+
aria-label=${e.resetLabel}
|
|
12
|
+
title=${e.resetLabel}
|
|
13
|
+
?hidden=${a}
|
|
14
|
+
?disabled=${i}
|
|
15
|
+
@click=${t=>{t.preventDefault(),t.stopPropagation(),e.resetToInherited()}}
|
|
16
|
+
><i class="sf-icon" aria-hidden="true">restart_alt</i></button>
|
|
17
|
+
</span>
|
|
18
|
+
`}i.d(t,["kU",0,l]),s()}catch(p){s(p)}})},"70333283d751"(e,t,i){i.a(e,async(e,t)=>{try{var s=i("fbe0570fcc69"),n=i("d21a38718c5d"),r=i("d39911485561"),a=i("078aa87e580e"),h=i("0d662e4d7d63"),o=i("778671c79fa6"),c=e([s,r,h,o]);[s,r,h,o]=c.then?(await c)():c;var d=i.n(s);const l={en:{on:"on",off:"off"},ru:{on:"включено",off:"выключено"}};class u extends((0,o.kU)(d())){static get props(){return{size:{default:"1"},label:{default:""},description:{default:""},help:{default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},name:{default:""},value:{default:""},ariaLabel:{attribute:"aria-label",default:""},inheritedValue:{attribute:"inherited-value",default:""},inheritedText:{attribute:"inherited-text",default:""},resetLabel:{attribute:"reset-label",default:""}}}constructor(){super(),this._boundRoot=null}get size(){return this.getAttribute("size")||"1"}get label(){return this.getAttribute("label")||""}get ariaLabel(){return this.getProp("ariaLabel")||""}get description(){return this.getAttribute("description")||""}get help(){return this.getAttribute("help")||""}get checked(){return this.getBooleanAttr("checked",!1)}set checked(e){this._writeChecked(!!e)}_writeChecked(e){e?this.setAttribute("checked",""):this.hasInheritedValue?this.setAttribute("checked","false"):this.removeAttribute("checked")}get inheritedOn(){return this.toBoolean(this.inheritedValue,!1)}inheritedOwnValue(){return this.hasAttribute("checked")?this.checked?"on":"off":""}inheritedDisplayValue(){return(0,h.pageText)(l,this.inheritedOn?"on":"off",this)}inheritedFocusTarget(){return this.getInputElement()}clearOwnValue(){this.removeAttribute("checked");const e=this.getInputElement();e&&(e.checked=this.inheritedOn),this.dispatchEvent(new Event("change",{bubbles:!0}))}get disabled(){return this.getBooleanAttr("disabled",!1)}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get name(){return this.getAttribute("name")||""}get value(){return this.getAttribute("value")||""}set value(e){null!=e?this.setAttribute("value",String(e)):this.removeAttribute("value")}templateContext(){const e=this.getPropsContext(),t=this.isInherited;return this.createTemplateContext({...e,checked:t?this.inheritedOn:e.checked,name:t?"":e.name,component:this})}template(){return(0,r.$)(this.templateContext())}afterRender(){if(this._releaseReset?.(),this._releaseReset=null,this._boundRoot&&((0,n.DR)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(".sf-switch"),this._boundRoot){(0,n.QS)(this._boundRoot);const e=this.getInputElement();e&&((0,n.UL)(e,{checked:this.isInherited?this.inheritedOn:this.checked,disabled:this.disabled}),e.addEventListener("change",this._handleChange),this._releaseReset=(0,a.n)(this,e))}this.syncInheritedState()}onDisconnected(){this._releaseReset?.(),this._releaseReset=null;const e=this.getInputElement();e&&e.removeEventListener("change",this._handleChange),this._boundRoot&&((0,n.DR)(this._boundRoot),this._boundRoot=null)}_handleChange=()=>{const e=this.getInputElement();e&&(this._writeChecked(e.checked),this.hasInheritedValue&&this.name&&e.name!==this.name&&(e.name=this.name))};getInputElement(){return this.querySelector('.sf-switch input[type="checkbox"]')}isChecked(){return!!this.getInputElement()?.checked}setChecked(e=!1){return this.checked=!!e,this.setState({checked:!!e}),this}setDisabled(e=!1){return this.disabled=!!e,this.setState({disabled:!!e}),this}get state(){const e=this.getInputElement();return{checked:!!e?.checked,disabled:!!e?.disabled,name:e?.name||"",value:e?.value||""}}setState(e={}){const t=this.getInputElement();return t?((0,n.UL)(t,e),Object.prototype.hasOwnProperty.call(e,"checked")&&this._writeChecked(this.toBoolean(e.checked)),Object.prototype.hasOwnProperty.call(e,"disabled")&&(this.toBoolean(e.disabled)?this.setAttribute("disabled",""):this.removeAttribute("disabled")),this):(super.setState(e),this)}onChange(e,t){return"function"==typeof e&&this.addEventListener("change",e,t),this}onFocus(e,t){return"function"==typeof e&&this.addEventListener("focusin",e,t),this}onBlur(e,t){return"function"==typeof e&&this.addEventListener("focusout",e,t),this}}u.define("sf-switch"),t()}catch(e){t(e)}})},d39911485561(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{$:()=>h});var n=i("ddf1cdb42ecc"),r=i("778671c79fa6"),a=e([n,r]);[n,r]=a.then?(await a)():a;function h(e){const{size:t,label:i,description:s,help:a,checked:h,disabled:o,name:c,value:d,ariaLabel:l}=e,u=["sf-switch",`sf-switch--size-${t}`,"flex",e.rootClass],p=e.component?.hasSlotContent?.("label")?e.component.getSlotContent("label"):i?n.html`<span class="sf-switch-text">${i}</span>`:"",f=e.component?.hasSlotContent?.("description")?e.component.getSlotContent("description"):s?n.html`<span class="sf-switch-description">${s}</span>`:"",m=e.component?.hasSlotContent?.("help")?e.component.getSlotContent("help"):a?n.html`<i class="sf-icon" aria-hidden="true">${a}</i>`:"",b=!!(p||f||m);return n.html`
|
|
19
|
+
<label class=${u.filter(Boolean).join(" ")} style=${e.rootStyle||n.nothing}>
|
|
3
20
|
<span class="sf-switch-toggler transition flex items-cross-center content-main-start">
|
|
4
21
|
<input
|
|
5
22
|
type="checkbox"
|
|
6
23
|
role="switch"
|
|
7
24
|
name=${c||""}
|
|
8
|
-
.value=${
|
|
9
|
-
.checked=${
|
|
10
|
-
?disabled=${
|
|
11
|
-
aria-label=${!
|
|
25
|
+
.value=${d||""}
|
|
26
|
+
.checked=${h}
|
|
27
|
+
?disabled=${o}
|
|
28
|
+
aria-label=${!p&&l?l:n.nothing}
|
|
12
29
|
/>
|
|
13
30
|
<span class="sf-switch-inner transition" aria-hidden="true"></span>
|
|
14
31
|
</span>
|
|
15
32
|
|
|
16
|
-
${
|
|
33
|
+
${b?n.html`
|
|
17
34
|
<span class="sf-switch-container-wrap flex flex-col">
|
|
18
|
-
${
|
|
35
|
+
${p||m?n.html`
|
|
19
36
|
<span class="sf-switch-top flex">
|
|
20
|
-
${
|
|
37
|
+
${p?n.html`
|
|
21
38
|
<span class="sf-switch-container flex items-cross-center content-main-center">
|
|
22
|
-
${
|
|
39
|
+
${p}
|
|
23
40
|
</span>
|
|
24
41
|
`:""}
|
|
25
|
-
${
|
|
42
|
+
${m}
|
|
26
43
|
</span>
|
|
27
44
|
`:""}
|
|
28
|
-
${
|
|
45
|
+
${f}
|
|
29
46
|
</span>
|
|
30
47
|
`:""}
|
|
48
|
+
${(0,r.vZ)(e.component,{size:t,disabled:o,className:"sf-switch-inherited"})}
|
|
31
49
|
</label>
|
|
32
|
-
`}
|
|
50
|
+
`}s()}catch(o){s(o)}})},ddf1cdb42ecc(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("page-language")),{once:!0}))},fbe0570fcc69(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const t={};function i(s){const n=t[s];if(void 0!==n)return n.exports;const r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",s=e?Symbol("webpack exports"):"__webpack_exports__",n=e?Symbol("webpack error"):"__webpack_error__",r=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};i.a=(e,i,a)=>{let h;a&&((h=[]).d=-1);const o=new Set,c=e.exports;let d,l,u;const p=new Promise((e,t)=>{u=t,l=e});p[s]=c,p[t]=e=>(h&&e(h),o.forEach(e),p.catch(e=>{})),e.exports=p;i(e=>{let i;d=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const i=[];i.d=0,e.then(e=>{a[s]=e,r(i)},e=>{a[n]=e,r(i)});const a={};return a[t]=e=>e(i),a}}const i={};return i[t]=e=>{},i[s]=e,i}))(e);const a=()=>d.map(e=>{if(e[n])throw e[n];return e[s]}),c=new Promise(e=>{i=()=>e(a),i.r=0;const s=e=>e!==h&&!o.has(e)&&(o.add(e),e&&!e.d&&(i.r++,e.push(i)));d.map(e=>e[t](s))});return i.r?c:a()},e=>(e?u(p[n]=e):l(c),r(h))),h?.d<0&&(h.d=0)}})(),i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{if(Array.isArray(t))for(var s=0;s<t.length;){var n=t[s++],r=t[s++];i.o(e,n)?0===r&&s++:0===r?Object.defineProperty(e,n,{enumerable:!0,value:t[s++]}):Object.defineProperty(e,n,{enumerable:!0,get:r})}else for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);i("70333283d751")})();
|