@rogieking/figui3 6.8.3 → 6.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fig.js CHANGED
@@ -1,4 +1,4 @@
1
- var A1=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var F1={};var L0=A1(()=>{/*! Vendored from @ungap/custom-elements-builtin@0.6.5 (ISC). */(function(Q,Z,$){if(Q.importNode.length!=1||Z.get("ungap-li"))return;var J="extends";try{var j={};j[J]="li";var _=HTMLLIElement,q=function(){return Reflect.construct(_,[],q)};if(q.prototype=$.create(_.prototype),Z.define("ungap-li",q,j),!/is="ungap-li"/.test(new q().outerHTML))throw j}catch(G){(function(){var X="attributeChangedCallback",K="connectedCallback",N="disconnectedCallback",B=Element.prototype,L=$.assign,A=$.create,U=$.defineProperties,W=$.getOwnPropertyDescriptor,R=$.setPrototypeOf,z=Z.define,M=Z.get,O=Z.upgrade,T=Z.whenDefined,C=A(null),k=new WeakMap,I={childList:!0,subtree:!0};Reflect.ownKeys(self).filter(function(Y){return typeof Y=="string"&&/^HTML(?!Element)/.test(Y)}).forEach(function(Y){function F(){}var D=self[Y];R(F,D),(F.prototype=D.prototype).constructor=F,D={},D[Y]={value:F},U(self,D)}),new MutationObserver(K0).observe(Q,I),U0(Document.prototype,"importNode"),U0(Node.prototype,"cloneNode"),U(Z,{define:{value:function(Y,F,D){if(Y=Y.toLowerCase(),D&&J in D){C[Y]=L({},D,{Class:F});var E=D[J]+'[is="'+Y+'"]',P=Q.querySelectorAll(E);for(var f=0,x=P.length;f<x;f++)s(P[f])}else z.apply(Z,arguments)}},get:{value:function(Y){return Y in C?C[Y].Class:M.call(Z,Y)}},upgrade:{value:function(Y){var F=Z0(Y);if(F&&!(Y instanceof F.Class))W0(Y,F);else O.call(Z,Y)}},whenDefined:{value:function(Y){return Y in C?Promise.resolve():T.call(Z,Y)}}});var S=Q.createElement;U(Q,{createElement:{value:function(Y,F){var D=S.call(Q,Y);if(F&&"is"in F)D.setAttribute("is",F.is),Z.upgrade(D);return D}}});var w=W(B,"attachShadow").value,d=W(B,"innerHTML");U(B,{attachShadow:{value:function(){var Y=w.apply(this,arguments);return new MutationObserver(K0).observe(Y,I),Y}},innerHTML:{get:d.get,set:function(Y){if(d.set.call(this,Y),/\bis=("|')?[a-z0-9_-]+\1/i.test(Y))o(this,s)}}});function K0(Y){for(var F=0,D=Y.length;F<D;F++){var E=Y[F],P=E.addedNodes,f=E.removedNodes;for(var x=0,l=P.length;x<l;x++)s(P[x]);for(var $0=0,O1=f.length;$0<O1;$0++)N0(f[$0])}}function Y0(Y){for(var F=0,D=Y.length;F<D;F++){var E=Y[F],P=E.attributeName,f=E.oldValue,x=E.target,l=x.getAttribute(P);if(X in x&&!(f==l&&l==null))x[X](P,f,x.getAttribute(P),null)}}function N0(Y){if(Y.nodeType!==1)return;var F=Z0(Y);if(F&&Y instanceof F.Class&&N in Y&&k.get(Y)!==N)k.set(Y,N),Promise.resolve(Y).then(M1);o(Y,N0)}function Z0(Y){var F=Y.getAttribute("is");if(F){if(F=F.toLowerCase(),F in C)return C[F]}return null}function B1(Y){Y[K]()}function M1(Y){Y[N]()}function W0(Y,F){var D=F.Class,E=D.observedAttributes||[];if(R(Y,D.prototype),E.length){new MutationObserver(Y0).observe(Y,{attributes:!0,attributeFilter:E,attributeOldValue:!0});var P=[];for(var f=0,x=E.length;f<x;f++)P.push({attributeName:E[f],oldValue:null,target:Y});Y0(P)}}function s(Y){if(Y.nodeType!==1)return;var F=Z0(Y);if(F){if(!(Y instanceof F.Class))W0(Y,F);if(K in Y&&Y.isConnected&&k.get(Y)!==K)k.set(Y,K),Promise.resolve(Y).then(B1)}o(Y,s)}function o(Y,F){for(var D=Y.content,E=(D&&D.nodeType==11?D:Y).querySelectorAll("[is]"),P=0,f=E.length;P<f;P++)F(E[P])}function U0(Y,F){var D=Y[F],E={};E[F]={value:function(){var P=D.apply(this,arguments);switch(P.nodeType){case 1:case 11:o(P,s)}return P}},U(Y,E)}})()}})(document,customElements,Object)});function z1(){if(typeof navigator>"u")return!1;let Q=navigator.userAgent||"",Z=/\b(iPad|iPhone|iPod)\b/.test(Q)||/\bMacintosh\b/.test(Q)&&/\bMobile\b/.test(Q),$=/\bAppleWebKit\b/.test(Q)&&!/\b(Chrome|Chromium|Edg|OPR|SamsungBrowser)\b/.test(Q);return Z||$}function v(Q,Z={}){let $=document.createElement("fig-icon");if(Q)$.setAttribute("name",Q);if(Z.size)$.setAttribute("size",Z.size);if(Z.className)$.className=Z.className;return $}function b(Q,Z){requestAnimationFrame(()=>{if(Q&&!Q.isConnected)return;Z()})}function A0({owner:Q,onStart:Z,onEnd:$,startClass:J="",endClass:j="",chevronClass:_=""}={}){let q=(G,X)=>{let K=document.createElement("button");if(K.className=["fig-overflow",`fig-overflow-${G}`,G==="start"?J:j].filter(Boolean).join(" "),K.dataset.figOverflow=G,Q)K.setAttribute(`data-fig-${Q}-nav`,G);return K.setAttribute("tabindex","-1"),K.setAttribute("aria-label",G==="start"?"Scroll back":"Scroll forward"),K.appendChild(v("chevron",{size:"small",className:["fig-overflow-chevron",_].filter(Boolean).join(" ")})),K.addEventListener("pointerdown",(N)=>{N.preventDefault(),N.stopPropagation(),X?.(N)}),K};return{start:q("start",Z),end:q("end",$)}}function F0(Q,Z,$="x",J=2){if(!Q||!Z)return!1;let j=$==="x",_=j?Z.scrollWidth:Z.scrollHeight,q=j?Z.clientWidth:Z.clientHeight,G=j?Z.scrollLeft:Z.scrollTop,X=_-q>J,K=!X||G<=J,N=!X||G+q>=_-J;return Q.classList.toggle("overflow-start",!K),Q.classList.toggle("overflow-end",!N),X}function J0(Q,Z="x",$=1){if(!Q)return;let J=Z==="x",_=(J?Q.clientWidth:Q.clientHeight)*0.8*$;Q.scrollBy({[J?"left":"top"]:_,behavior:"smooth"})}function u(){return typeof customElements<"u"&&!!customElements.get("fig-fill-picker")}function H1(){if(typeof window>"u"||!window.customElements||typeof HTMLButtonElement>"u")return!1;let Q=`fig-builtin-probe-${Math.random().toString(36).slice(2)}`;class Z extends HTMLButtonElement{}try{return customElements.define(Q,Z,{extends:"button"}),document.createElement("button",{is:Q})instanceof Z}catch($){return!1}}var z0=z1()&&!H1(),D1=(z0?Promise.resolve().then(() => (L0(),F1)):Promise.resolve()).then(()=>{}).catch((Q)=>{throw Q});function j0(Q,Z,$){let J=()=>{if(!customElements.get(Q))customElements.define(Q,Z,$)};if(!z0){J();return}D1.then(J).catch((j)=>{console.error(`[figui3] Failed to load customized built-in polyfill for "${Q}".`,j)})}function y(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function a(){if(!document.body)return null;let Q="data-figui-overlay-root",Z=document.body.querySelector(`:scope > [${Q}]`);if(!Z)Z=document.createElement("div"),Z.setAttribute(Q,""),document.body.append(Z);return Z}var R1=1e4;function T1(){return R1++}function V(Q,Z,$){if($&&$.trim())Q.style.setProperty(Z,$.trim());else Q.style.removeProperty(Z)}var m=null,B0=null;function _0(Q=1,Z=1){if(!m)m=document.createElement("canvas"),B0=m.getContext("2d");if(m.width!==Q)m.width=Q;if(m.height!==Z)m.height=Z;return{canvas:m,ctx:B0}}class H0 extends HTMLElement{type;#Z;#Q=["aria-label","aria-labelledby","aria-describedby","title"];#J=this.#Y.bind(this);#$=this.#G.bind(this);#j=()=>{if(this.button?.matches(":focus-visible"))this.setAttribute("data-focus-visible","")};#q=()=>{this.removeAttribute("data-focus-visible")};constructor(){super();this.attachShadow({mode:"open",delegatesFocus:!0})}connectedCallback(){if(this.type=this.getAttribute("type")||"button",!this.button){let Q=this.type==="select"||this.type==="upload",Z=Q?"span":"button",$=Q?"":` type="${this.type}"`;this.shadowRoot.innerHTML=`
1
+ var A1=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var F1={};var L0=A1(()=>{/*! Vendored from @ungap/custom-elements-builtin@0.6.5 (ISC). */(function(Q,Z,$){if(Q.importNode.length!=1||Z.get("ungap-li"))return;var J="extends";try{var j={};j[J]="li";var _=HTMLLIElement,q=function(){return Reflect.construct(_,[],q)};if(q.prototype=$.create(_.prototype),Z.define("ungap-li",q,j),!/is="ungap-li"/.test(new q().outerHTML))throw j}catch(G){(function(){var X="attributeChangedCallback",K="connectedCallback",N="disconnectedCallback",B=Element.prototype,L=$.assign,A=$.create,U=$.defineProperties,W=$.getOwnPropertyDescriptor,R=$.setPrototypeOf,z=Z.define,M=Z.get,O=Z.upgrade,T=Z.whenDefined,C=A(null),k=new WeakMap,I={childList:!0,subtree:!0};Reflect.ownKeys(self).filter(function(Y){return typeof Y=="string"&&/^HTML(?!Element)/.test(Y)}).forEach(function(Y){function F(){}var D=self[Y];R(F,D),(F.prototype=D.prototype).constructor=F,D={},D[Y]={value:F},U(self,D)}),new MutationObserver(K0).observe(Q,I),U0(Document.prototype,"importNode"),U0(Node.prototype,"cloneNode"),U(Z,{define:{value:function(Y,F,D){if(Y=Y.toLowerCase(),D&&J in D){C[Y]=L({},D,{Class:F});var E=D[J]+'[is="'+Y+'"]',P=Q.querySelectorAll(E);for(var f=0,x=P.length;f<x;f++)s(P[f])}else z.apply(Z,arguments)}},get:{value:function(Y){return Y in C?C[Y].Class:M.call(Z,Y)}},upgrade:{value:function(Y){var F=Z0(Y);if(F&&!(Y instanceof F.Class))W0(Y,F);else O.call(Z,Y)}},whenDefined:{value:function(Y){return Y in C?Promise.resolve():T.call(Z,Y)}}});var S=Q.createElement;U(Q,{createElement:{value:function(Y,F){var D=S.call(Q,Y);if(F&&"is"in F)D.setAttribute("is",F.is),Z.upgrade(D);return D}}});var w=W(B,"attachShadow").value,d=W(B,"innerHTML");U(B,{attachShadow:{value:function(){var Y=w.apply(this,arguments);return new MutationObserver(K0).observe(Y,I),Y}},innerHTML:{get:d.get,set:function(Y){if(d.set.call(this,Y),/\bis=("|')?[a-z0-9_-]+\1/i.test(Y))o(this,s)}}});function K0(Y){for(var F=0,D=Y.length;F<D;F++){var E=Y[F],P=E.addedNodes,f=E.removedNodes;for(var x=0,l=P.length;x<l;x++)s(P[x]);for(var $0=0,O1=f.length;$0<O1;$0++)N0(f[$0])}}function Y0(Y){for(var F=0,D=Y.length;F<D;F++){var E=Y[F],P=E.attributeName,f=E.oldValue,x=E.target,l=x.getAttribute(P);if(X in x&&!(f==l&&l==null))x[X](P,f,x.getAttribute(P),null)}}function N0(Y){if(Y.nodeType!==1)return;var F=Z0(Y);if(F&&Y instanceof F.Class&&N in Y&&k.get(Y)!==N)k.set(Y,N),Promise.resolve(Y).then(M1);o(Y,N0)}function Z0(Y){var F=Y.getAttribute("is");if(F){if(F=F.toLowerCase(),F in C)return C[F]}return null}function B1(Y){Y[K]()}function M1(Y){Y[N]()}function W0(Y,F){var D=F.Class,E=D.observedAttributes||[];if(R(Y,D.prototype),E.length){new MutationObserver(Y0).observe(Y,{attributes:!0,attributeFilter:E,attributeOldValue:!0});var P=[];for(var f=0,x=E.length;f<x;f++)P.push({attributeName:E[f],oldValue:null,target:Y});Y0(P)}}function s(Y){if(Y.nodeType!==1)return;var F=Z0(Y);if(F){if(!(Y instanceof F.Class))W0(Y,F);if(K in Y&&Y.isConnected&&k.get(Y)!==K)k.set(Y,K),Promise.resolve(Y).then(B1)}o(Y,s)}function o(Y,F){for(var D=Y.content,E=(D&&D.nodeType==11?D:Y).querySelectorAll("[is]"),P=0,f=E.length;P<f;P++)F(E[P])}function U0(Y,F){var D=Y[F],E={};E[F]={value:function(){var P=D.apply(this,arguments);switch(P.nodeType){case 1:case 11:o(P,s)}return P}},U(Y,E)}})()}})(document,customElements,Object)});function z1(){if(typeof navigator>"u")return!1;let Q=navigator.userAgent||"",Z=/\b(iPad|iPhone|iPod)\b/.test(Q)||/\bMacintosh\b/.test(Q)&&/\bMobile\b/.test(Q),$=/\bAppleWebKit\b/.test(Q)&&!/\b(Chrome|Chromium|Edg|OPR|SamsungBrowser)\b/.test(Q);return Z||$}function v(Q,Z={}){let $=document.createElement("fig-icon");if(Q)$.setAttribute("name",Q);if(Z.size)$.setAttribute("size",Z.size);if(Z.className)$.className=Z.className;return $}function b(Q,Z){requestAnimationFrame(()=>{if(Q&&!Q.isConnected)return;Z()})}function A0({owner:Q,onStart:Z,onEnd:$,startClass:J="",endClass:j="",chevronClass:_=""}={}){let q=(G,X)=>{let K=document.createElement("button");if(K.className=["fig-overflow",`fig-overflow-${G}`,G==="start"?J:j].filter(Boolean).join(" "),K.dataset.figOverflow=G,Q)K.setAttribute(`data-fig-${Q}-nav`,G);return K.setAttribute("tabindex","-1"),K.setAttribute("aria-label",G==="start"?"Scroll back":"Scroll forward"),K.appendChild(v("chevron",{size:"small",className:["fig-overflow-chevron",_].filter(Boolean).join(" ")})),K.addEventListener("click",(N)=>{N.preventDefault(),N.stopPropagation(),X?.(N)}),K};return{start:q("start",Z),end:q("end",$)}}function F0(Q,Z,$="x",J=2){if(!Q||!Z)return!1;let j=$==="x",_=j?Z.scrollWidth:Z.scrollHeight,q=j?Z.clientWidth:Z.clientHeight,G=j?Z.scrollLeft:Z.scrollTop,X=_-q>J,K=!X||G<=J,N=!X||G+q>=_-J;return Q.classList.toggle("overflow-start",!K),Q.classList.toggle("overflow-end",!N),X}function J0(Q,Z="x",$=1){if(!Q)return;let J=Z==="x",_=(J?Q.clientWidth:Q.clientHeight)*0.8*$;Q.scrollBy({[J?"left":"top"]:_,behavior:"smooth"})}function u(){return typeof customElements<"u"&&!!customElements.get("fig-fill-picker")}function H1(){if(typeof window>"u"||!window.customElements||typeof HTMLButtonElement>"u")return!1;let Q=`fig-builtin-probe-${Math.random().toString(36).slice(2)}`;class Z extends HTMLButtonElement{}try{return customElements.define(Q,Z,{extends:"button"}),document.createElement("button",{is:Q})instanceof Z}catch($){return!1}}var z0=z1()&&!H1(),D1=(z0?Promise.resolve().then(() => (L0(),F1)):Promise.resolve()).then(()=>{}).catch((Q)=>{throw Q});function j0(Q,Z,$){let J=()=>{if(!customElements.get(Q))customElements.define(Q,Z,$)};if(!z0){J();return}D1.then(J).catch((j)=>{console.error(`[figui3] Failed to load customized built-in polyfill for "${Q}".`,j)})}function y(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function a(){if(!document.body)return null;let Q="data-figui-overlay-root",Z=document.body.querySelector(`:scope > [${Q}]`);if(!Z)Z=document.createElement("div"),Z.setAttribute(Q,""),document.body.append(Z);return Z}var R1=1e4;function T1(){return R1++}function V(Q,Z,$){if($&&$.trim())Q.style.setProperty(Z,$.trim());else Q.style.removeProperty(Z)}var m=null,B0=null;function _0(Q=1,Z=1){if(!m)m=document.createElement("canvas"),B0=m.getContext("2d");if(m.width!==Q)m.width=Q;if(m.height!==Z)m.height=Z;return{canvas:m,ctx:B0}}class H0 extends HTMLElement{type;#Z;#Q=["aria-label","aria-labelledby","aria-describedby","title"];#J=this.#Y.bind(this);#$=this.#G.bind(this);#j=()=>{if(this.button?.matches(":focus-visible"))this.setAttribute("data-focus-visible","")};#q=()=>{this.removeAttribute("data-focus-visible")};constructor(){super();this.attachShadow({mode:"open",delegatesFocus:!0})}connectedCallback(){if(this.type=this.getAttribute("type")||"button",!this.button){let Q=this.type==="select"||this.type==="upload",Z=Q?"span":"button",$=Q?"":` type="${this.type}"`;this.shadowRoot.innerHTML=`
2
2
  <style>
3
3
  button, button:hover, button:active, .fig-button-control {
4
4
  padding: 0 var(--spacer-2);
package/fig.js CHANGED
@@ -62,7 +62,7 @@ function createFigOverflowButtons({
62
62
  className: ["fig-overflow-chevron", chevronClass].filter(Boolean).join(" "),
63
63
  }),
64
64
  );
65
- button.addEventListener("pointerdown", (event) => {
65
+ button.addEventListener("click", (event) => {
66
66
  event.preventDefault();
67
67
  event.stopPropagation();
68
68
  onPointerDown?.(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.8.3",
3
+ "version": "6.8.5",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "MIT",