@pictogrammers/components 0.4.7 → 0.4.9
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/index.html +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
- package/pg/app/app.css +1 -1
- package/pg/app/app.ts +8 -2
- package/pg/inputPixelEditor/inputPixelEditor.ts +3 -2
- package/pg/inputPixelEditor/utils/getEllipsePixels.ts +131 -19
- package/pg/modal/README.md +29 -0
- package/pg/modal/__examples__/basic/basic.html +4 -0
- package/pg/modal/__examples__/basic/basic.ts +42 -0
- package/pg/modal/index.ts +3 -0
- package/pg/modal/modal.css +40 -0
- package/pg/modal/modal.html +9 -0
- package/pg/modal/modal.ts +14 -0
- package/pg/tree/README.md +10 -1
- package/pg/tree/__examples__/basic/basic.html +1 -0
- package/pg/tree/__examples__/basic/basic.ts +6 -0
- package/pg/tree/tree.css +1 -0
- package/pgAnnoy.js +1 -1
- package/pgApp.js +1 -1
- package/pgAvatar.js +1 -1
- package/pgButton.js +1 -1
- package/pgButtonGroup.js +1 -1
- package/pgButtonLink.js +1 -1
- package/pgButtonMenu.js +1 -1
- package/pgButtonToggle.js +1 -1
- package/pgCard.js +1 -1
- package/pgCardUser.js +1 -1
- package/pgColor.js +1 -1
- package/pgDatabase.js +1 -1
- package/pgDropdown.js +1 -1
- package/pgGrid.js +1 -1
- package/pgHeader.js +1 -1
- package/pgIcon.js +1 -1
- package/pgInputCheck.js +1 -1
- package/pgInputCheckList.js +1 -1
- package/pgInputFileLocal.js +1 -1
- package/pgInputHexRgb.js +1 -1
- package/pgInputPixelEditor.js +1 -1
- package/pgInputRange.js +1 -1
- package/pgInputSelect.js +1 -1
- package/pgInputText.js +1 -1
- package/pgInputTextIcon.js +1 -1
- package/pgInputUserSelect.js +1 -1
- package/pgListTag.js +1 -1
- package/pgMarkdown.js +1 -1
- package/pgMenu.js +1 -1
- package/pgMenuDivider.js +1 -1
- package/pgMenuIcon.js +1 -1
- package/pgMenuItem.js +1 -1
- package/pgMenuItemIcon.js +1 -1
- package/pgModal.js +1 -0
- package/pgModalAlert.js +1 -1
- package/pgModification.js +1 -1
- package/pgNav.js +1 -1
- package/pgOverlay.js +1 -1
- package/pgOverlayContextMenu.js +1 -1
- package/pgOverlayMenu.js +1 -1
- package/pgOverlaySelectMenu.js +1 -1
- package/pgOverlaySubMenu.js +1 -1
- package/pgPicker.js +1 -1
- package/pgPreview.js +1 -1
- package/pgScroll.js +1 -1
- package/pgSearch.js +1 -1
- package/pgTab.js +1 -1
- package/pgTabs.js +1 -1
- package/pgToast.js +1 -1
- package/pgToasts.js +1 -1
- package/pgTooltip.js +1 -1
- package/pgTree.js +1 -1
- package/pgTreeButtonIcon.js +1 -1
- package/pgTreeItem.js +1 -1
package/pgGrid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);i&&o[h[0]]||(void 0!==r&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=r),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),s&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=s):h[4]="".concat(s)),e.push(h))}},e}},601:t=>{t.exports=function(t){return t[1]}},967:(t,e,n)=>{n.d(e,{A:()=>l});var i=n(601),s=n.n(i),r=n(314),o=n.n(r)()(s());o.push([t.id,"* {\n font-family: var(--pg-font-family);\n}\n\n:host {\n display: block;\n}\n\n[part~=none] {\n display: none;\n}\n\n[part~=none].show {\n display: block;\n}\n\n[part~=grid] {\n position: relative;\n}\n\n[part~=grid] > button {\n border: 0;\n background: transparent;\n padding: 0.625rem;\n outline: none;\n width: 2.75rem;\n height: 2.75rem;\n position: absolute;\n left: 0;\n top: 0;\n border: 0;\n border-radius: 0.25rem;\n}\n\n[part~=grid] > button.hover {\n background: rgba(0, 0, 0, 0.1);\n}\n\n[part~=grid] > button:focus,\n[part~=grid] > button:active {\n background: rgba(0, 0, 0, 0.15);\n box-shadow: 0 0.0125rem 0.25rem rgba(0, 0, 0, 0.2) inset;\n}\n\n[part~=grid] > button > svg {\n fill: #453C4F;\n width: 1.5rem;\n height: 1.5rem;\n}\n\n[part~=grid] > button > svg {\n fill: #453C4F;\n}\n\n[part~=grid]::-webkit-scrollbar {\n width: 1em;\n}\n\n[part~=grid]::-webkit-scrollbar-track {\n box-shadow: inset 0 0 6px rgba(0,0,0,0.2);\n border-radius: 0.25rem;\n}\n\n[part~=grid]::-webkit-scrollbar-thumb {\n background-color: #453C4F;\n outline: 1px solid slategrey;\n border-radius: 0.25rem;\n}",""]);var a=new CSSStyleSheet;a.replaceSync(o.toString());const l=a}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{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);const i=Symbol("addObserver"),s=Symbol("removeObserver"),r=Symbol("getObservers"),o=Symbol("swapObserver"),a=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],h=new Map;function d(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case a:return!0;case l:return e;case r:return h.has(t);case o:return(e,n)=>{const i=h.get(t);i.forEach(((s,r)=>{if(r.getRootNode().host===e){const e=i.get(r);h.has(n)?h.get(n).has(r)?h.get(n).get(r).push(i.get(r)):h.get(n).set(r,i.get(r)):h.set(n,new Map([[r,e]])),h.delete(t),e.forEach((t=>{t(null,u.swap,[n])}))}}))};case i:return(e,n)=>{h.has(t)?h.get(t).has(e)?h.get(t).get(e).push(n):h.get(t).set(e,[n]):h.set(t,new Map([[e,[n]]]))};case s:return e=>{h.has(t)&&(h.get(t).delete(e),0===h.get(t).size&&h.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?d(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(c.includes(n))return h.has(e)?function(){const t=Array.prototype[n].apply(e,arguments);return h.get(e).forEach(((t,i)=>{t.forEach((t=>{t(e,n,arguments)}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return d(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(h.has(t)){h.get(t).forEach(((t,i)=>{t.forEach((t=>{t(e,n)}))}))}return Reflect.set(t,e,n)}})}window.observers=h;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const p=Symbol("init"),g=Symbol("template"),m=Symbol("style"),f=Symbol("parent");function y(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function w(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var i,s;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[f]||e.prototype[f][e.prototype[f].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[f]=[e.prototype],e.prototype[m]=t.style?[t.style]:[],e.prototype[g]=t.template||""):(e.prototype[f].push(e.prototype),e.prototype[m].push(t.style),e.prototype[g]=(i=e.prototype[g],(s=t.template||null)&&s.match(/<parent\/>/)?s.replace(/<parent\/>/,i):`${i}${s||""}`));const r=e.prototype.connectedCallback||(()=>{}),o=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[p]||void 0!==t.template||void 0!==t.style)if(this[p]){if(this[p]&&t.style);else if(this[p]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[g]||"";const n=document.importNode(t.content,!0),i=this.attachShadow({mode:"open"});i.adoptedStyleSheets=e.prototype[m].map((t=>{if(t instanceof CSSStyleSheet)return t;var e=new CSSStyleSheet;return e.replaceSync(t.toString()),e})),i.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const i=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),s=()=>{this[f].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===i.length?(this[p]=!0,r.call(this),s()):Promise.all(i).then((()=>{this[p]=!0,r.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));s()}))},e.prototype.disconnectedCallback=function(){o.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[v(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function b(t){return!!t&&t.constructor===Array}function x(t,e){t[p]&&t[f].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function S(t){return null===t?"null":b(t)?"array":typeof t}function E(t){return function(e,n){const i=n.name,s=Symbol(i),c=Symbol(`${i}:type`),h=Symbol(`${i}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,i,{get:()=>"object"===this[c]||"array"===this[c]?this[s][a]?this[s]:d(this[s]):this[s],set:e=>{const n=S(t?t(e):e);if("index"!==i&&this[c]!==n&&"null"!==this[c]&&"null"!==n)throw new Error(`@Prop() ${i} with type '${this[c]}' cannot be set to ${n}.`);if("array"===this[c]){if(!b(e))throw new PropError(`Array "${i}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,i)?.set);if(this[s]===e)throw new Error("Setting an array to itself is not allowed.");const t=d(this[s]);if(t[r]){const n=e[a]?e[l]:e;t[o](this,n),this[s]=e,console.log(">>> trigger render???",this,i)}else this[s]=e}else this[s]=t?t(e):e,x(this,i)}})})),function(e){if(void 0===e&&"index"!==i)throw new Error(`@Prop() ${i} must have an initial value defined.`);if(void 0!==e&&"index"===i)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${i} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=y(i);e[i]||(t.observedAttributes.push(n),e[i]=s)}return this[c]=S(e),"array"===this[c]?(this[s]=e,new Proxy(e,{get:(t,e)=>e===C?this[h]:(console.log("errr???"),Reflect.get(this[s],e)),set:(t,e,n)=>{if(e===C)return this[h]=n,!0;const r=Reflect.set(t,e,n);return"length"===e&&this[s].length===n||x(this,i),this[s]=n,r}})):(this[s]=t?t(this.getAttribute(i)??e):this.getAttribute(i)??e,this[s])}}}function $(){return function(t,e){const n=e.name,i=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${i}]`))}})}))}}Symbol("hasProxy");const C=Symbol("meta");var k=n(967),R=function(t,e,n,i,s,r){function o(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",h=!e&&t?i.static?t:t.prototype:null,d=e||(h?Object.getOwnPropertyDescriptor(h,i.name):{}),u=!1,p=n.length-1;p>=0;p--){var g={};for(var m in i)g[m]="access"===m?{}:i[m];for(var m in i.access)g.access[m]=i.access[m];g.addInitializer=function(t){if(u)throw new TypeError("Cannot add initializers after decoration has completed");r.push(o(t||null))};var f=(0,n[p])("accessor"===l?{get:d.get,set:d.set}:d[c],g);if("accessor"===l){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw new TypeError("Object expected");(a=o(f.get))&&(d.get=a),(a=o(f.set))&&(d.set=a),(a=o(f.init))&&s.unshift(a)}else(a=o(f))&&("field"===l?s.unshift(a):d[c]=a)}h&&Object.defineProperty(h,i.name,d),u=!0},P=function(t,e,n){for(var i=arguments.length>2,s=0;s<e.length;s++)n=i?e[s].call(t,n):e[s].call(t);return i?n:void 0};const M="ArrowUp",A="ArrowRight",z="ArrowDown",O="ArrowLeft";(()=>{let t,e,n,i,s,r,o,a,l,c,h,d=[w({selector:"pg-grid",style:k.A,template:'<div part="none"> <slot></slot> </div> <pg-scroll part="scroll"> <div part="grid"></div> </pg-scroll>'})],u=[],p=HTMLElement,g=[],m=[],f=[],y=[],v=[],b=[],x=[],S=[],C=[],T=[],L=[],H=[],j=[],F=[],I=[],D=[],N=[],W=[];(class extends p{static{e=this}static{const w="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;n=[E()],i=[E()],s=[E()],r=[E()],o=[E()],a=[E()],l=[$()],c=[$()],h=[$()],R(null,null,n,{kind:"field",name:"icons",static:!1,private:!1,access:{has:t=>"icons"in t,get:t=>t.icons,set:(t,e)=>{t.icons=e}},metadata:w},g,m),R(null,null,i,{kind:"field",name:"size",static:!1,private:!1,access:{has:t=>"size"in t,get:t=>t.size,set:(t,e)=>{t.size=e}},metadata:w},f,y),R(null,null,s,{kind:"field",name:"padding",static:!1,private:!1,access:{has:t=>"padding"in t,get:t=>t.padding,set:(t,e)=>{t.padding=e}},metadata:w},v,b),R(null,null,r,{kind:"field",name:"gap",static:!1,private:!1,access:{has:t=>"gap"in t,get:t=>t.gap,set:(t,e)=>{t.gap=e}},metadata:w},x,S),R(null,null,o,{kind:"field",name:"width",static:!1,private:!1,access:{has:t=>"width"in t,get:t=>t.width,set:(t,e)=>{t.width=e}},metadata:w},C,T),R(null,null,a,{kind:"field",name:"height",static:!1,private:!1,access:{has:t=>"height"in t,get:t=>t.height,set:(t,e)=>{t.height=e}},metadata:w},L,H),R(null,null,l,{kind:"field",name:"$none",static:!1,private:!1,access:{has:t=>"$none"in t,get:t=>t.$none,set:(t,e)=>{t.$none=e}},metadata:w},j,F),R(null,null,c,{kind:"field",name:"$scroll",static:!1,private:!1,access:{has:t=>"$scroll"in t,get:t=>t.$scroll,set:(t,e)=>{t.$scroll=e}},metadata:w},I,D),R(null,null,h,{kind:"field",name:"$grid",static:!1,private:!1,access:{has:t=>"$grid"in t,get:t=>t.$grid,set:(t,e)=>{t.$grid=e}},metadata:w},N,W),R(null,t={value:e},d,{kind:"class",name:e.name,metadata:w},null,u),e=t.value,w&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w}),P(e,u)}icons=P(this,g,[]);size=(P(this,m),P(this,f,24));padding=(P(this,y),P(this,v,8));gap=(P(this,b),P(this,x,4));width=(P(this,S),P(this,C,"auto"));height=(P(this,T),P(this,L,"auto"));$none=(P(this,H),P(this,j,void 0));$scroll=(P(this,F),P(this,I,void 0));$grid=(P(this,D),P(this,N,void 0));currentCount=(P(this,W),0);currentSize=0;currentPadding=0;currentGap=0;rowHeight=0;items=[];svg="http://www.w3.org/2000/svg";columns;debounceRender=((t,e)=>{let n;return(...i)=>new Promise((s=>{n&&clearTimeout(n),n=setTimeout((()=>s(t(...i))),e)}))})((()=>this.render({})),300);color="svg";resizeObserver=new ResizeObserver((()=>{this.debounceRender()}));connectedCallback(){this.resizeObserver.observe(this.$grid),this.addEventListener("mousemove",this.handleTooltip.bind(this)),this.addEventListener("mouseleave",(t=>{this.index=-2,this.handleTooltip(t)})),this.$scroll.addEventListener("calculate",(t=>{const{offsetY:e,height:n,viewWidth:i,viewHeight:s}=t.detail;this.calculate(e,n,i,s)}))}getMetaFromMouse(t){const{width:e,height:n,gap:i,extra:s}=this.getIconMetrics();var r=t.target.getBoundingClientRect();const o=t.clientX-r.left,a=t.clientY-r.top;console.log(o,a);const l=this.getColumnFromX(o,e,i,s),c=this.getRowFromY(a,n,i,s),h=-1!==l&&-1!==c?l+c*this.columns:-1,d=e+i+(l-1)*e+l*(i+s),u=c*n+(c+1)*i;return{gridX:d,gridY:u,x:d+r.left,y:u+r.top,width:e,height:n,column:l,row:c,gap:i,extra:s,index:h,icon:this.icons[h]}}getColumnFromX(t,e,n,i){if((t=Math.round(t))<n)return-1;if(t<=e+n)return 0;const s=Math.floor((t-e-n)/(e+n+i))+1;return t-s*(e+n+i)<n+i?-1:s}getRowFromY(t,e,n,i){if(t<n)return-1;if(t<=e+n)return 0;const s=Math.floor((t-e-n)/(e+n))+1;return t-s*(e+n)<n?-1:s}index=0;hoverLast=0;handleTooltip(t){const e=this.getMetaFromMouse(t),{column:n,index:i}=e;this.hoverLast>=0&&this.items[this.hoverLast][0].classList.toggle("hover",!1);var s=i-this.currentRow*this.columns;s>=0&&(this.items[s][0].classList.toggle("hover",!0),this.hoverLast=s),this.index!==i&&(-1===i||-2===this.index?(e.index=this.index,this.hideTooltip(this.icons[this.index],e),this.index=-1):this.icons[i]&&(n>this.columns-1?(e.index=this.index,this.hideTooltip(this.icons[this.index],e),this.index=-1):(this.showTooltip(this.icons[i],e),this.index=i)))}updateHover(){this.items[this.index][0].classList.toggle("hover",!1)}syncVirtual(t){for(let e=this.currentCount;e<t;e++){this.currentCount=e+1;const t=document.createElement("button");t.dataset.index=`${e}`,t.addEventListener("click",(()=>{const t=e+this.columns*this.currentRow;this.handleClick(this.icons[t])})),t.addEventListener("keydown",(t=>{const n=e+this.columns*this.currentRow;this.moveFocus(t,n)})),t.addEventListener("contextmenu",(t=>{var n=this.$grid.getBoundingClientRect();const i=Math.floor(t.clientX-n.left),s=Math.floor(t.clientY-n.top);this.showContextMenu(e,i,s),t.preventDefault()}));const n=document.createElementNS(this.svg,"svg");n.setAttribute("viewBox","0 0 24 24");const i=document.createElementNS(this.svg,"path");n.appendChild(i),t.appendChild(n),this.$grid.appendChild(t),this.items.push([t,n,i])}for(let e=this.currentCount;e>t;e--){const t=this.items.pop();this.$grid.removeChild(t[0]),this.currentCount--}const{size:e,padding:n,gap:i,width:s,height:r,rowHeight:o,scrollWidth:a,extra:l}=this.getIconMetrics();let c=i,h=i;this.items.forEach((([t,o],a)=>{t.style.padding=`${n}px`,t.style.width=`${s}px`,t.style.height=`${r}px`,t.style.transform=`translate(${c}px, ${h}px)`,o.style.width=`${e}px`,o.style.height=`${e}px`,c+=s+i+l,a%this.columns==this.columns-1&&(h+=r+i,c=i)}))}currentRow=0;timeouts=[];cacheHeight=0;cacheViewWidth=0;calculate(t,e,n,i){const s=this.rowHeight,r=this.icons.length,o=Math.ceil(i/s)+1,a=Math.floor(t/s);this.$grid.style.transform=`translateY(${-1*t%s}px)`,this.cacheHeight===e&&this.cacheViewWidth===n||(this.syncVirtual(o*this.columns),this.cacheHeight=e,this.cacheViewWidth=n),this.currentRow!==a&&(this.items.forEach((([t,e,n],i)=>{const s=i+a*this.columns;s<r?(n.setAttribute("d",this.icons[s].data),t.style.display="block"):t.style.display="none"})),this.currentRow=a)}getIconMetrics(){const t=parseInt(this.size,10),e=parseInt(this.padding,10),n=parseInt(this.gap,10),{width:i}=this.$scroll.getBoundingClientRect(),s=t+2*e,r=s+n;return{size:t,padding:e,gap:n,width:s,height:s,rowHeight:r,extra:(i-n-r*this.columns)/(this.columns-1),scrollWidth:i}}calculateColumns(t,e){const n=t-this.currentGap,i=Math.floor(n/e);return i>0?i:1}render(t){const{size:e,padding:n,gap:i,rowHeight:s,scrollWidth:r}=this.getIconMetrics();this.currentSize===e&&this.currentPadding===n&&this.currentGap===i||(this.currentSize=e,this.currentPadding=n,this.currentGap=i,this.rowHeight=s);const o=this.calculateColumns(r,s);this.columns!==o&&(this.columns=o);const a=this.icons.length;if(a){const t=Math.ceil(a/this.columns);this.currentRow=-1,console.log("---",i+t*s),console.log("init",this.$scroll.height),this.$scroll.setAttribute("height",(i+t*s).toString())}else this.$scroll.setAttribute("height","0");this.$none.classList.toggle("show",0===a)}moveFocus(t,e){let n;switch(t.key){case O:n=e-1,n>=0&&(this.items[n][0].focus(),t.preventDefault());break;case M:n=e-this.columns,n>=0&&(this.items[n][0].focus(),t.preventDefault());break;case A:n=e+1,n<this.icons.length&&(this.items[n][0].focus(),t.preventDefault());break;case z:n=e+this.columns,n<this.icons.length?(this.items[n][0].focus(),t.preventDefault()):n!==this.icons.length-1&&(this.items[this.icons.length-1][0].focus(),t.preventDefault())}}handleClick(t){this.dispatchEvent(new CustomEvent("select",{detail:t}))}canOpenTooltip=!0;preventClose=!1;currentIndex=0;showContextMenu(t,e,n){this.dispatchEvent(new CustomEvent("openmenu"))}hideContextMenu(){this.dispatchEvent(new CustomEvent("closemenu")),this.canOpenTooltip=!0}showTooltip(t,e){this.canOpenTooltip&&this.dispatchEvent(new CustomEvent("entericon",{detail:e}))}hideTooltip(t,e){this.dispatchEvent(new CustomEvent("leaveicon",{detail:e}))}getPositionFromIndex(t){return{x:t%this.columns,y:Math.floor(t/this.columns)}}})})()})();
|
|
1
|
+
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,o){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(i)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(r[c]=!0)}for(var l=0;l<t.length;l++){var h=[].concat(t[l]);i&&r[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),s&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=s):h[4]="".concat(s)),e.push(h))}},e}},601:t=>{t.exports=function(t){return t[1]}},967:(t,e,n)=>{n.d(e,{A:()=>c});var i=n(601),s=n.n(i),o=n(314),r=n.n(o)()(s());r.push([t.id,"* {\n font-family: var(--pg-font-family);\n}\n\n:host {\n display: block;\n}\n\n[part~=none] {\n display: none;\n}\n\n[part~=none].show {\n display: block;\n}\n\n[part~=grid] {\n position: relative;\n}\n\n[part~=grid] > button {\n border: 0;\n background: transparent;\n padding: 0.625rem;\n outline: none;\n width: 2.75rem;\n height: 2.75rem;\n position: absolute;\n left: 0;\n top: 0;\n border: 0;\n border-radius: 0.25rem;\n}\n\n[part~=grid] > button.hover {\n background: rgba(0, 0, 0, 0.1);\n}\n\n[part~=grid] > button:focus,\n[part~=grid] > button:active {\n background: rgba(0, 0, 0, 0.15);\n box-shadow: 0 0.0125rem 0.25rem rgba(0, 0, 0, 0.2) inset;\n}\n\n[part~=grid] > button > svg {\n fill: #453C4F;\n width: 1.5rem;\n height: 1.5rem;\n}\n\n[part~=grid] > button > svg {\n fill: #453C4F;\n}\n\n[part~=grid]::-webkit-scrollbar {\n width: 1em;\n}\n\n[part~=grid]::-webkit-scrollbar-track {\n box-shadow: inset 0 0 6px rgba(0,0,0,0.2);\n border-radius: 0.25rem;\n}\n\n[part~=grid]::-webkit-scrollbar-thumb {\n background-color: #453C4F;\n outline: 1px solid slategrey;\n border-radius: 0.25rem;\n}",""]);var a=new CSSStyleSheet;a.replaceSync(r.toString());const c=a}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var o=e[i]={id:i,exports:{}};return t[i](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{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);const i=Symbol("addObserver"),s=Symbol("removeObserver"),o=Symbol("getObservers"),r=Symbol("swapObserver"),a=Symbol("isProxy"),c=Symbol("getTarget"),l=["fill","pop","push","reverse","shift","sort","splice","unshift"],h=new Map;function d(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case a:return!0;case c:return e;case o:return e=>{const n=h.get(t);return n?.has(e)};case r:return(e,n)=>{const i=h.get(t);if(i){const t=i.get(e);t&&t.forEach(((i,s)=>{if(!i)throw new Error("Unreachable");{const t=h.get(n);if(t){const n=t.get(e);n?n.set(s,i):t.set(e,new Map([[s,i]]))}else h.set(n,new Map([[e,new Map([[s,i]])]]))}t.delete(s),i.forEach((t=>{t(null,u.swap,[n])}))}))}};case i:return(e,n)=>{const i=e.getRootNode().host,s=h.get(t);if(s){const t=s.get(i);if(t){const i=t.get(e);i?i.push(n):t.set(e,[n])}else s.set(i,new Map([[e,[n]]]))}else h.set(t,new Map([[i,new Map([[e,[n]]])]]))};case s:return e=>{const n=e.getRootNode().host,i=h.get(t);i&&(i.delete(n),0===i.size&&h.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?d(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(l.includes(n))return h.has(e)?function(){const t=Array.prototype[n].apply(e,arguments),i=h.get(e);return i?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n,arguments)}))}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return d(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(h.has(t)){const i=h.get(t);i?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n)}))}))}))}return Reflect.set(t,e,n)}})}window.observers=h;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const p=Symbol("init"),g=Symbol("template"),m=Symbol("style"),f=Symbol("parent");function w(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function y(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function v(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var i,s;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[f]||e.prototype[f][e.prototype[f].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[f]=[e.prototype],e.prototype[m]=t.style?[t.style]:[],e.prototype[g]=t.template||""):(e.prototype[f].push(e.prototype),e.prototype[m].push(t.style),e.prototype[g]=(i=e.prototype[g],(s=t.template||null)&&s.match(/<parent\/>/)?s.replace(/<parent\/>/,i):i.match(/<child\/>/)?i.replace(/<child\/>/,s||""):`${i}${s||""}`));const o=e.prototype.connectedCallback||(()=>{}),r=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[p]||void 0!==t.template||void 0!==t.style)if(this[p]){if(this[p]&&t.style);else if(this[p]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[g]||"";const n=document.importNode(t.content,!0),i=this.attachShadow({mode:"open"});i.adoptedStyleSheets=e.prototype[m].reduce(((t,e)=>{if(!e)return t;if(e instanceof CSSStyleSheet)return t.push(e),t;var n=new CSSStyleSheet;return n.replaceSync(e.toString()),t.push(n),t}),[]),i.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const i=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),s=()=>{this[f].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[y(e)]=!0,t)),{}):{})}))};0===i.length?(this[p]=!0,o.call(this),s()):Promise.all(i).then((()=>{this[p]=!0,o.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));s()}))},e.prototype.disconnectedCallback=function(){r.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[y(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function b(t){return!!t&&t.constructor===Array}function x(t,e){t[p]&&t[f].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function S(t){return null===t?"null":b(t)?"array":typeof t}function E(t){return function(e,n){const i=n.name,s=Symbol(i),l=Symbol(`${i}:type`),h=Symbol(`${i}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,i,{get:()=>"object"===this[l]||"array"===this[l]?this[s][a]?this[s]:d(this[s]):this[s],set:e=>{const n=S(t?t(e):e);if("index"!==i&&this[l]!==n&&"null"!==this[l]&&"null"!==n)throw new Error(`@Prop() ${i} with type '${this[l]}' cannot be set to ${n}.`);if("array"===this[l]){if(!b(e))throw new PropError(`Array "${i}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,i)?.set);if(this[s]===e)throw new Error("Setting an array to itself is not allowed.");const t=d(this[s]);if(t[o](this)){const n=e[a]?e[c]:e;t[r](this,n),this[s]=e}else this[s]=e}else this[s]=t?t(e):e,x(this,i)}})})),function(e){if(void 0===e&&"index"!==i)throw new Error(`@Prop() ${i} must have an initial value defined.`);if(void 0!==e&&"index"===i)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${i} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=w(i);e[i]||(t.observedAttributes.push(n),e[i]=s)}return this[l]=S(e),"array"===this[l]?(this[s]=e,new Proxy(e,{get:(t,e)=>e===C?this[h]:(console.log("errr???"),Reflect.get(this[s],e)),set:(t,e,n)=>{if(e===C)return this[h]=n,!0;const o=Reflect.set(t,e,n);return"length"===e&&this[s].length===n||x(this,i),this[s]=n,o}})):(this[s]=t?t(this.getAttribute(i)??e):this.getAttribute(i)??e,this[s])}}}function $(){return function(t,e){const n=e.name,i=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${i}]`))}})}))}}Symbol("hasProxy");const C=Symbol("meta");var k=n(967),M=function(t,e,n,i,s,o){function r(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",h=!e&&t?i.static?t:t.prototype:null,d=e||(h?Object.getOwnPropertyDescriptor(h,i.name):{}),u=!1,p=n.length-1;p>=0;p--){var g={};for(var m in i)g[m]="access"===m?{}:i[m];for(var m in i.access)g.access[m]=i.access[m];g.addInitializer=function(t){if(u)throw new TypeError("Cannot add initializers after decoration has completed");o.push(r(t||null))};var f=(0,n[p])("accessor"===c?{get:d.get,set:d.set}:d[l],g);if("accessor"===c){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw new TypeError("Object expected");(a=r(f.get))&&(d.get=a),(a=r(f.set))&&(d.set=a),(a=r(f.init))&&s.unshift(a)}else(a=r(f))&&("field"===c?s.unshift(a):d[l]=a)}h&&Object.defineProperty(h,i.name,d),u=!0},R=function(t,e,n){for(var i=arguments.length>2,s=0;s<e.length;s++)n=i?e[s].call(t,n):e[s].call(t);return i?n:void 0};const P="ArrowUp",A="ArrowRight",z="ArrowDown",O="ArrowLeft";(()=>{let t,e,n,i,s,o,r,a,c,l,h,d=[v({selector:"pg-grid",style:k.A,template:'<div part="none"> <slot></slot> </div> <pg-scroll part="scroll"> <div part="grid"></div> </pg-scroll>'})],u=[],p=HTMLElement,g=[],m=[],f=[],w=[],y=[],b=[],x=[],S=[],C=[],T=[],L=[],H=[],j=[],F=[],I=[],N=[],D=[],W=[];(class extends p{static{e=this}static{const v="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;n=[E()],i=[E()],s=[E()],o=[E()],r=[E()],a=[E()],c=[$()],l=[$()],h=[$()],M(null,null,n,{kind:"field",name:"icons",static:!1,private:!1,access:{has:t=>"icons"in t,get:t=>t.icons,set:(t,e)=>{t.icons=e}},metadata:v},g,m),M(null,null,i,{kind:"field",name:"size",static:!1,private:!1,access:{has:t=>"size"in t,get:t=>t.size,set:(t,e)=>{t.size=e}},metadata:v},f,w),M(null,null,s,{kind:"field",name:"padding",static:!1,private:!1,access:{has:t=>"padding"in t,get:t=>t.padding,set:(t,e)=>{t.padding=e}},metadata:v},y,b),M(null,null,o,{kind:"field",name:"gap",static:!1,private:!1,access:{has:t=>"gap"in t,get:t=>t.gap,set:(t,e)=>{t.gap=e}},metadata:v},x,S),M(null,null,r,{kind:"field",name:"width",static:!1,private:!1,access:{has:t=>"width"in t,get:t=>t.width,set:(t,e)=>{t.width=e}},metadata:v},C,T),M(null,null,a,{kind:"field",name:"height",static:!1,private:!1,access:{has:t=>"height"in t,get:t=>t.height,set:(t,e)=>{t.height=e}},metadata:v},L,H),M(null,null,c,{kind:"field",name:"$none",static:!1,private:!1,access:{has:t=>"$none"in t,get:t=>t.$none,set:(t,e)=>{t.$none=e}},metadata:v},j,F),M(null,null,l,{kind:"field",name:"$scroll",static:!1,private:!1,access:{has:t=>"$scroll"in t,get:t=>t.$scroll,set:(t,e)=>{t.$scroll=e}},metadata:v},I,N),M(null,null,h,{kind:"field",name:"$grid",static:!1,private:!1,access:{has:t=>"$grid"in t,get:t=>t.$grid,set:(t,e)=>{t.$grid=e}},metadata:v},D,W),M(null,t={value:e},d,{kind:"class",name:e.name,metadata:v},null,u),e=t.value,v&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v}),R(e,u)}icons=R(this,g,[]);size=(R(this,m),R(this,f,24));padding=(R(this,w),R(this,y,8));gap=(R(this,b),R(this,x,4));width=(R(this,S),R(this,C,"auto"));height=(R(this,T),R(this,L,"auto"));$none=(R(this,H),R(this,j,void 0));$scroll=(R(this,F),R(this,I,void 0));$grid=(R(this,N),R(this,D,void 0));currentCount=(R(this,W),0);currentSize=0;currentPadding=0;currentGap=0;rowHeight=0;items=[];svg="http://www.w3.org/2000/svg";columns;debounceRender=((t,e)=>{let n;return(...i)=>new Promise((s=>{n&&clearTimeout(n),n=setTimeout((()=>s(t(...i))),e)}))})((()=>this.render({})),300);color="svg";resizeObserver=new ResizeObserver((()=>{this.debounceRender()}));connectedCallback(){this.resizeObserver.observe(this.$grid),this.addEventListener("mousemove",this.handleTooltip.bind(this)),this.addEventListener("mouseleave",(t=>{this.index=-2,this.handleTooltip(t)})),this.$scroll.addEventListener("calculate",(t=>{const{offsetY:e,height:n,viewWidth:i,viewHeight:s}=t.detail;this.calculate(e,n,i,s)}))}getMetaFromMouse(t){const{width:e,height:n,gap:i,extra:s}=this.getIconMetrics();var o=t.target.getBoundingClientRect();const r=t.clientX-o.left,a=t.clientY-o.top;console.log(r,a);const c=this.getColumnFromX(r,e,i,s),l=this.getRowFromY(a,n,i,s),h=-1!==c&&-1!==l?c+l*this.columns:-1,d=e+i+(c-1)*e+c*(i+s),u=l*n+(l+1)*i;return{gridX:d,gridY:u,x:d+o.left,y:u+o.top,width:e,height:n,column:c,row:l,gap:i,extra:s,index:h,icon:this.icons[h]}}getColumnFromX(t,e,n,i){if((t=Math.round(t))<n)return-1;if(t<=e+n)return 0;const s=Math.floor((t-e-n)/(e+n+i))+1;return t-s*(e+n+i)<n+i?-1:s}getRowFromY(t,e,n,i){if(t<n)return-1;if(t<=e+n)return 0;const s=Math.floor((t-e-n)/(e+n))+1;return t-s*(e+n)<n?-1:s}index=0;hoverLast=0;handleTooltip(t){const e=this.getMetaFromMouse(t),{column:n,index:i}=e;this.hoverLast>=0&&this.items[this.hoverLast][0].classList.toggle("hover",!1);var s=i-this.currentRow*this.columns;s>=0&&(this.items[s][0].classList.toggle("hover",!0),this.hoverLast=s),this.index!==i&&(-1===i||-2===this.index?(e.index=this.index,this.hideTooltip(this.icons[this.index],e),this.index=-1):this.icons[i]&&(n>this.columns-1?(e.index=this.index,this.hideTooltip(this.icons[this.index],e),this.index=-1):(this.showTooltip(this.icons[i],e),this.index=i)))}updateHover(){this.items[this.index][0].classList.toggle("hover",!1)}syncVirtual(t){for(let e=this.currentCount;e<t;e++){this.currentCount=e+1;const t=document.createElement("button");t.dataset.index=`${e}`,t.addEventListener("click",(()=>{const t=e+this.columns*this.currentRow;this.handleClick(this.icons[t])})),t.addEventListener("keydown",(t=>{const n=e+this.columns*this.currentRow;this.moveFocus(t,n)})),t.addEventListener("contextmenu",(t=>{var n=this.$grid.getBoundingClientRect();const i=Math.floor(t.clientX-n.left),s=Math.floor(t.clientY-n.top);this.showContextMenu(e,i,s),t.preventDefault()}));const n=document.createElementNS(this.svg,"svg");n.setAttribute("viewBox","0 0 24 24");const i=document.createElementNS(this.svg,"path");n.appendChild(i),t.appendChild(n),this.$grid.appendChild(t),this.items.push([t,n,i])}for(let e=this.currentCount;e>t;e--){const t=this.items.pop();this.$grid.removeChild(t[0]),this.currentCount--}const{size:e,padding:n,gap:i,width:s,height:o,rowHeight:r,scrollWidth:a,extra:c}=this.getIconMetrics();let l=i,h=i;this.items.forEach((([t,r],a)=>{t.style.padding=`${n}px`,t.style.width=`${s}px`,t.style.height=`${o}px`,t.style.transform=`translate(${l}px, ${h}px)`,r.style.width=`${e}px`,r.style.height=`${e}px`,l+=s+i+c,a%this.columns==this.columns-1&&(h+=o+i,l=i)}))}currentRow=0;timeouts=[];cacheHeight=0;cacheViewWidth=0;calculate(t,e,n,i){const s=this.rowHeight,o=this.icons.length,r=Math.ceil(i/s)+1,a=Math.floor(t/s);this.$grid.style.transform=`translateY(${-1*t%s}px)`,this.cacheHeight===e&&this.cacheViewWidth===n||(this.syncVirtual(r*this.columns),this.cacheHeight=e,this.cacheViewWidth=n),this.currentRow!==a&&(this.items.forEach((([t,e,n],i)=>{const s=i+a*this.columns;s<o?(n.setAttribute("d",this.icons[s].data),t.style.display="block"):t.style.display="none"})),this.currentRow=a)}getIconMetrics(){const t=parseInt(this.size,10),e=parseInt(this.padding,10),n=parseInt(this.gap,10),{width:i}=this.$scroll.getBoundingClientRect(),s=t+2*e,o=s+n;return{size:t,padding:e,gap:n,width:s,height:s,rowHeight:o,extra:(i-n-o*this.columns)/(this.columns-1),scrollWidth:i}}calculateColumns(t,e){const n=t-this.currentGap,i=Math.floor(n/e);return i>0?i:1}render(t){const{size:e,padding:n,gap:i,rowHeight:s,scrollWidth:o}=this.getIconMetrics();this.currentSize===e&&this.currentPadding===n&&this.currentGap===i||(this.currentSize=e,this.currentPadding=n,this.currentGap=i,this.rowHeight=s);const r=this.calculateColumns(o,s);this.columns!==r&&(this.columns=r);const a=this.icons.length;if(a){const t=Math.ceil(a/this.columns);this.currentRow=-1,console.log("---",i+t*s),console.log("init",this.$scroll.height),this.$scroll.setAttribute("height",(i+t*s).toString())}else this.$scroll.setAttribute("height","0");this.$none.classList.toggle("show",0===a)}moveFocus(t,e){let n;switch(t.key){case O:n=e-1,n>=0&&(this.items[n][0].focus(),t.preventDefault());break;case P:n=e-this.columns,n>=0&&(this.items[n][0].focus(),t.preventDefault());break;case A:n=e+1,n<this.icons.length&&(this.items[n][0].focus(),t.preventDefault());break;case z:n=e+this.columns,n<this.icons.length?(this.items[n][0].focus(),t.preventDefault()):n!==this.icons.length-1&&(this.items[this.icons.length-1][0].focus(),t.preventDefault())}}handleClick(t){this.dispatchEvent(new CustomEvent("select",{detail:t}))}canOpenTooltip=!0;preventClose=!1;currentIndex=0;showContextMenu(t,e,n){this.dispatchEvent(new CustomEvent("openmenu"))}hideContextMenu(){this.dispatchEvent(new CustomEvent("closemenu")),this.canOpenTooltip=!0}showTooltip(t,e){this.canOpenTooltip&&this.dispatchEvent(new CustomEvent("entericon",{detail:e}))}hideTooltip(t,e){this.dispatchEvent(new CustomEvent("leaveicon",{detail:e}))}getPositionFromIndex(t){return{x:t%this.columns,y:Math.floor(t/this.columns)}}})})()})();
|
package/pgHeader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var i=0;i<this.length;i++){var l=this[i][0];null!=l&&(s[l]=!0)}for(var c=0;c<e.length;c++){var p=[].concat(e[c]);n&&s[p[0]]||(void 0!==a&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=a),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),o&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=o):p[4]="".concat(o)),t.push(p))}},t}},537:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(601),o=r.n(n),a=r(314),s=r.n(a)()(o());s.push([e.id,":host {\n display: block;\n}\nheader {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-rows: 1fr;\n grid-row: 1;\n grid-column: 1 / span 2;\n background: var(--pg-header-background, #fff);\n color: var(--pg-header-color, #453C4F);\n font-family: var(--pg-font-family);\n height: 3rem;\n}\nheader > a {\n grid-column: 1;\n display: inline-flex;\n color: var(--pg-header-color, #453C4F);\n text-decoration: none;\n align-items: center;\n}\nheader > a svg,\nheader > a slot::slotted(svg) {\n display: inline-flex;\n width: 1.75rem;\n height: 1.75rem;\n margin: 0 0.75rem 0 1rem;\n}\nheader > a > span {\n display: inline-flex;\n color: var(--pg-header-color, #453C4F);\n font-size: 1.5rem;\n margin: 0;\n font-weight: normal;\n padding-bottom: 1px;\n}\nheader > div {\n display: flex;\n grid-column: 2;\n justify-self: right;\n margin-right: 1rem;\n}",""]);var i=new CSSStyleSheet;i.replaceSync(s.toString());const l=i},601:e=>{e.exports=function(e){return e[1]}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=Symbol("addObserver"),o=Symbol("removeObserver"),a=Symbol("getObservers"),s=Symbol("swapObserver"),i=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function h(e){return new Proxy(e,{get(t,r){if("symbol"==typeof r){switch(r){case i:return!0;case l:return t;case a:return p.has(e);case s:return(t,r)=>{const n=p.get(e);n.forEach(((o,a)=>{if(a.getRootNode().host===t){const t=n.get(a);p.has(r)?p.get(r).has(a)?p.get(r).get(a).push(n.get(a)):p.get(r).set(a,n.get(a)):p.set(r,new Map([[a,t]])),p.delete(e),t.forEach((e=>{e(null,u.swap,[r])}))}}))};case n:return(t,r)=>{p.has(e)?p.get(e).has(t)?p.get(e).get(t).push(r):p.get(e).set(t,[r]):p.set(e,new Map([[t,[r]]]))};case o:return t=>{p.has(e)&&(p.get(e).delete(t),0===p.get(e).size&&p.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,r)}throw new Error("Unsupported symbol")}if(r in t){if(!Number.isNaN(Number(r)))return"object"==typeof t[r]?h(t[r]):t[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return p.has(t)?function(){const e=Array.prototype[r].apply(t,arguments);return p.get(t).forEach(((e,n)=>{e.forEach((e=>{e(t,r,arguments)}))})),e}:Reflect.get(t,r);if(t[r]instanceof Array)return h(t[r])}return Reflect.get(t,r)},set(e,t,r){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,r);if(p.has(e)){p.get(e).forEach(((e,n)=>{e.forEach((e=>{e(t,r)}))}))}return Reflect.set(e,t,r)}})}window.observers=p;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),m=Symbol("style"),y=Symbol("parent");function g(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function b(e={}){return function(t,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var n,o;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[y]||t.prototype[y][t.prototype[y].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[y]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[f]=e.template||""):(t.prototype[y].push(t.prototype),t.prototype[m].push(e.style),t.prototype[f]=(n=t.prototype[f],(o=e.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,n):`${n}${o||""}`));const a=t.prototype.connectedCallback||(()=>{}),s=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[d]||void 0!==e.template||void 0!==e.style)if(this[d]){if(this[d]&&e.style);else if(this[d]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[f]||"";const r=document.importNode(e.content,!0),n=this.attachShadow({mode:"open"});n.adoptedStyleSheets=t.prototype[m].map((e=>{if(e instanceof CSSStyleSheet)return e;var t=new CSSStyleSheet;return t.replaceSync(e.toString()),t})),n.appendChild(r)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&r.add(e.localName);const n=Array.from(r.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),o=()=>{this[y].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[v(t)]=!0,e)),{}):{})}))};0===n.length?(this[d]=!0,a.call(this),o()):Promise.all(n).then((()=>{this[d]=!0,a.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));o()}))},t.prototype.disconnectedCallback=function(){s.call(this)},t.prototype.attributeChangedCallback=function(e,t,r){this[v(e)]=r},r.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${r.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function S(e,t){e[d]&&e[y].map((r=>{r.render&&r.render.call(e,{[t]:!0})}))}function E(e){return null===e?"null":w(e)?"array":typeof e}function x(e){return function(t,r){const n=r.name,o=Symbol(n),c=Symbol(`${n}:type`),p=Symbol(`${n}:meta`);return r.addInitializer((function(){Reflect.defineProperty(this,n,{get:()=>"object"===this[c]||"array"===this[c]?this[o][i]?this[o]:h(this[o]):this[o],set:t=>{const r=E(e?e(t):t);if("index"!==n&&this[c]!==r&&"null"!==this[c]&&"null"!==r)throw new Error(`@Prop() ${n} with type '${this[c]}' cannot be set to ${r}.`);if("array"===this[c]){if(!w(t))throw new PropError(`Array "${n}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,n)?.set);if(this[o]===t)throw new Error("Setting an array to itself is not allowed.");const e=h(this[o]);if(e[a]){const r=t[i]?t[l]:t;e[s](this,r),this[o]=t,console.log(">>> trigger render???",this,n)}else this[o]=t}else this[o]=e?e(t):t,S(this,n)}})})),function(t){if(void 0===t&&"index"!==n)throw new Error(`@Prop() ${n} must have an initial value defined.`);if(void 0!==t&&"index"===n)throw new Error("@Prop() index must not have an initial value defined.");if(!0===t)throw new Error(`@Prop() ${n} boolean must initialize to false.`);if(!r.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,r=g(n);t[n]||(e.observedAttributes.push(r),t[n]=o)}return this[c]=E(t),"array"===this[c]?(this[o]=t,new Proxy(t,{get:(e,t)=>t===P?this[p]:(console.log("errr???"),Reflect.get(this[o],t)),set:(e,t,r)=>{if(t===P)return this[p]=r,!0;const a=Reflect.set(e,t,r);return"length"===t&&this[o].length===r||S(this,n),this[o]=r,a}})):(this[o]=e?e(this.getAttribute(n)??t):this.getAttribute(n)??t,this[o])}}}function $(){return function(e,t){const r=t.name,n=r.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,r,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${n}]`))}})}))}}Symbol("hasProxy");const P=Symbol("meta");var A=r(537),C=function(e,t,r,n,o,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?n.static?e:e.prototype:null,h=t||(p?Object.getOwnPropertyDescriptor(p,n.name):{}),u=!1,d=r.length-1;d>=0;d--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var y=(0,r[d])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(i=s(y.get))&&(h.get=i),(i=s(y.set))&&(h.set=i),(i=s(y.init))&&o.unshift(i)}else(i=s(y))&&("field"===l?o.unshift(i):h[c]=i)}p&&Object.defineProperty(p,n.name,h),u=!0},O=function(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0};(()=>{let e,t,r,n,o,a,s=[b({selector:"pg-header",style:A.A,template:'<header> <a href="/"> <slot name="logo"> <svg viewBox="0 0 24 24"> <path part="path" fill="currentColor" d=""></path> </svg> </slot> <span part="name"></span> </a> <div> <slot name="nav"></slot> <slot name="search"></slot> <slot name="menu"></slot> </div> </header>'})],i=[],l=HTMLElement,c=[],p=[],h=[],u=[],d=[],f=[],m=[],y=[];(class extends l{static{t=this}static{const g="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;r=[x()],n=[x()],o=[$()],a=[$()],C(null,null,r,{kind:"field",name:"logo",static:!1,private:!1,access:{has:e=>"logo"in e,get:e=>e.logo,set:(e,t)=>{e.logo=t}},metadata:g},c,p),C(null,null,n,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:g},h,u),C(null,null,o,{kind:"field",name:"$path",static:!1,private:!1,access:{has:e=>"$path"in e,get:e=>e.$path,set:(e,t)=>{e.$path=t}},metadata:g},d,f),C(null,null,a,{kind:"field",name:"$name",static:!1,private:!1,access:{has:e=>"$name"in e,get:e=>e.$name,set:(e,t)=>{e.$name=t}},metadata:g},m,y),C(null,e={value:t},s,{kind:"class",name:t.name,metadata:g},null,i),t=e.value,g&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g}),O(t,i)}logo=O(this,c,"M0 0h24v24H0V0zm2 2v20h20V2H2z");name=(O(this,p),O(this,h,"Default"));$path=(O(this,u),O(this,d,void 0));$name=(O(this,f),O(this,m,void 0));render(e){e.logo&&this.$path.setAttribute("d",this.logo),e.name&&(this.$name.innerText=this.name)}constructor(){super(...arguments),O(this,y)}})})()})();
|
|
1
|
+
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var i=0;i<this.length;i++){var l=this[i][0];null!=l&&(s[l]=!0)}for(var c=0;c<e.length;c++){var p=[].concat(e[c]);n&&s[p[0]]||(void 0!==a&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=a),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),o&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=o):p[4]="".concat(o)),t.push(p))}},t}},537:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(601),o=r.n(n),a=r(314),s=r.n(a)()(o());s.push([e.id,":host {\n display: block;\n}\nheader {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-rows: 1fr;\n grid-row: 1;\n grid-column: 1 / span 2;\n background: var(--pg-header-background, #fff);\n color: var(--pg-header-color, #453C4F);\n font-family: var(--pg-font-family);\n height: 3rem;\n}\nheader > a {\n grid-column: 1;\n display: inline-flex;\n color: var(--pg-header-color, #453C4F);\n text-decoration: none;\n align-items: center;\n}\nheader > a svg,\nheader > a slot::slotted(svg) {\n display: inline-flex;\n width: 1.75rem;\n height: 1.75rem;\n margin: 0 0.75rem 0 1rem;\n}\nheader > a > span {\n display: inline-flex;\n color: var(--pg-header-color, #453C4F);\n font-size: 1.5rem;\n margin: 0;\n font-weight: normal;\n padding-bottom: 1px;\n}\nheader > div {\n display: flex;\n grid-column: 2;\n justify-self: right;\n margin-right: 1rem;\n}",""]);var i=new CSSStyleSheet;i.replaceSync(s.toString());const l=i},601:e=>{e.exports=function(e){return e[1]}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=Symbol("addObserver"),o=Symbol("removeObserver"),a=Symbol("getObservers"),s=Symbol("swapObserver"),i=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function h(e){return new Proxy(e,{get(t,r){if("symbol"==typeof r){switch(r){case i:return!0;case l:return t;case a:return t=>{const r=p.get(e);return r?.has(t)};case s:return(t,r)=>{const n=p.get(e);if(n){const e=n.get(t);e&&e.forEach(((n,o)=>{if(!n)throw new Error("Unreachable");{const e=p.get(r);if(e){const r=e.get(t);r?r.set(o,n):e.set(t,new Map([[o,n]]))}else p.set(r,new Map([[t,new Map([[o,n]])]]))}e.delete(o),n.forEach((e=>{e(null,u.swap,[r])}))}))}};case n:return(t,r)=>{const n=t.getRootNode().host,o=p.get(e);if(o){const e=o.get(n);if(e){const n=e.get(t);n?n.push(r):e.set(t,[r])}else o.set(n,new Map([[t,[r]]]))}else p.set(e,new Map([[n,new Map([[t,[r]]])]]))};case o:return t=>{const r=t.getRootNode().host,n=p.get(e);n&&(n.delete(r),0===n.size&&p.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,r)}throw new Error("Unsupported symbol")}if(r in t){if(!Number.isNaN(Number(r)))return"object"==typeof t[r]?h(t[r]):t[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return p.has(t)?function(){const e=Array.prototype[r].apply(t,arguments),n=p.get(t);return n?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,r,arguments)}))}))})),e}:Reflect.get(t,r);if(t[r]instanceof Array)return h(t[r])}return Reflect.get(t,r)},set(e,t,r){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,r);if(p.has(e)){const n=p.get(e);n?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,r)}))}))}))}return Reflect.set(e,t,r)}})}window.observers=p;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),m=Symbol("style"),y=Symbol("parent");function g(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function b(e={}){return function(t,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var n,o;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[y]||t.prototype[y][t.prototype[y].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[y]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[f]=e.template||""):(t.prototype[y].push(t.prototype),t.prototype[m].push(e.style),t.prototype[f]=(n=t.prototype[f],(o=e.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,n):n.match(/<child\/>/)?n.replace(/<child\/>/,o||""):`${n}${o||""}`));const a=t.prototype.connectedCallback||(()=>{}),s=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[d]||void 0!==e.template||void 0!==e.style)if(this[d]){if(this[d]&&e.style);else if(this[d]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[f]||"";const r=document.importNode(e.content,!0),n=this.attachShadow({mode:"open"});n.adoptedStyleSheets=t.prototype[m].reduce(((e,t)=>{if(!t)return e;if(t instanceof CSSStyleSheet)return e.push(t),e;var r=new CSSStyleSheet;return r.replaceSync(t.toString()),e.push(r),e}),[]),n.appendChild(r)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&r.add(e.localName);const n=Array.from(r.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),o=()=>{this[y].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[v(t)]=!0,e)),{}):{})}))};0===n.length?(this[d]=!0,a.call(this),o()):Promise.all(n).then((()=>{this[d]=!0,a.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));o()}))},t.prototype.disconnectedCallback=function(){s.call(this)},t.prototype.attributeChangedCallback=function(e,t,r){this[v(e)]=r},r.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${r.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function S(e,t){e[d]&&e[y].map((r=>{r.render&&r.render.call(e,{[t]:!0})}))}function E(e){return null===e?"null":w(e)?"array":typeof e}function x(e){return function(t,r){const n=r.name,o=Symbol(n),c=Symbol(`${n}:type`),p=Symbol(`${n}:meta`);return r.addInitializer((function(){Reflect.defineProperty(this,n,{get:()=>"object"===this[c]||"array"===this[c]?this[o][i]?this[o]:h(this[o]):this[o],set:t=>{const r=E(e?e(t):t);if("index"!==n&&this[c]!==r&&"null"!==this[c]&&"null"!==r)throw new Error(`@Prop() ${n} with type '${this[c]}' cannot be set to ${r}.`);if("array"===this[c]){if(!w(t))throw new PropError(`Array "${n}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,n)?.set);if(this[o]===t)throw new Error("Setting an array to itself is not allowed.");const e=h(this[o]);if(e[a](this)){const r=t[i]?t[l]:t;e[s](this,r),this[o]=t}else this[o]=t}else this[o]=e?e(t):t,S(this,n)}})})),function(t){if(void 0===t&&"index"!==n)throw new Error(`@Prop() ${n} must have an initial value defined.`);if(void 0!==t&&"index"===n)throw new Error("@Prop() index must not have an initial value defined.");if(!0===t)throw new Error(`@Prop() ${n} boolean must initialize to false.`);if(!r.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,r=g(n);t[n]||(e.observedAttributes.push(r),t[n]=o)}return this[c]=E(t),"array"===this[c]?(this[o]=t,new Proxy(t,{get:(e,t)=>t===P?this[p]:(console.log("errr???"),Reflect.get(this[o],t)),set:(e,t,r)=>{if(t===P)return this[p]=r,!0;const a=Reflect.set(e,t,r);return"length"===t&&this[o].length===r||S(this,n),this[o]=r,a}})):(this[o]=e?e(this.getAttribute(n)??t):this.getAttribute(n)??t,this[o])}}}function $(){return function(e,t){const r=t.name,n=r.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,r,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${n}]`))}})}))}}Symbol("hasProxy");const P=Symbol("meta");var A=r(537),C=function(e,t,r,n,o,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?n.static?e:e.prototype:null,h=t||(p?Object.getOwnPropertyDescriptor(p,n.name):{}),u=!1,d=r.length-1;d>=0;d--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var y=(0,r[d])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(i=s(y.get))&&(h.get=i),(i=s(y.set))&&(h.set=i),(i=s(y.init))&&o.unshift(i)}else(i=s(y))&&("field"===l?o.unshift(i):h[c]=i)}p&&Object.defineProperty(p,n.name,h),u=!0},O=function(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0};(()=>{let e,t,r,n,o,a,s=[b({selector:"pg-header",style:A.A,template:'<header> <a href="/"> <slot name="logo"> <svg viewBox="0 0 24 24"> <path part="path" fill="currentColor" d=""></path> </svg> </slot> <span part="name"></span> </a> <div> <slot name="nav"></slot> <slot name="search"></slot> <slot name="menu"></slot> </div> </header>'})],i=[],l=HTMLElement,c=[],p=[],h=[],u=[],d=[],f=[],m=[],y=[];(class extends l{static{t=this}static{const g="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;r=[x()],n=[x()],o=[$()],a=[$()],C(null,null,r,{kind:"field",name:"logo",static:!1,private:!1,access:{has:e=>"logo"in e,get:e=>e.logo,set:(e,t)=>{e.logo=t}},metadata:g},c,p),C(null,null,n,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:g},h,u),C(null,null,o,{kind:"field",name:"$path",static:!1,private:!1,access:{has:e=>"$path"in e,get:e=>e.$path,set:(e,t)=>{e.$path=t}},metadata:g},d,f),C(null,null,a,{kind:"field",name:"$name",static:!1,private:!1,access:{has:e=>"$name"in e,get:e=>e.$name,set:(e,t)=>{e.$name=t}},metadata:g},m,y),C(null,e={value:t},s,{kind:"class",name:t.name,metadata:g},null,i),t=e.value,g&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g}),O(t,i)}logo=O(this,c,"M0 0h24v24H0V0zm2 2v20h20V2H2z");name=(O(this,p),O(this,h,"Default"));$path=(O(this,u),O(this,d,void 0));$name=(O(this,f),O(this,m,void 0));render(e){e.logo&&this.$path.setAttribute("d",this.logo),e.name&&(this.$name.innerText=this.name)}constructor(){super(...arguments),O(this,y)}})})()})();
|
package/pgIcon.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",o=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),o&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),o&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,o,n,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(i[l]=!0)}for(var c=0;c<t.length;c++){var p=[].concat(t[c]);o&&i[p[0]]||(void 0!==s&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=s),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),n&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=n):p[4]="".concat(n)),e.push(p))}},e}},441:(t,e,r)=>{r.d(e,{A:()=>l});var o=r(601),n=r.n(o),s=r(314),i=r.n(s)()(n());i.push([t.id,':host {\n display: inline-flex;\n color: var(--pg-icon-color, #453C4F);\n}\n\n[part="svg"] {\n width: var(--pg-icon-width, 1.5rem);\n height: var(--pg-icon-height, 1.5rem);\n}',""]);var a=new CSSStyleSheet;a.replaceSync(i.toString());const l=a},601:t=>{t.exports=function(t){return t[1]}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var s=e[o]={id:o,exports:{}};return t[o](s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const o=Symbol("addObserver"),n=Symbol("removeObserver"),s=Symbol("getObservers"),i=Symbol("swapObserver"),a=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function h(t){return new Proxy(t,{get(e,r){if("symbol"==typeof r){switch(r){case a:return!0;case l:return e;case s:return p.has(t);case i:return(e,r)=>{const o=p.get(t);o.forEach(((n,s)=>{if(s.getRootNode().host===e){const e=o.get(s);p.has(r)?p.get(r).has(s)?p.get(r).get(s).push(o.get(s)):p.get(r).set(s,o.get(s)):p.set(r,new Map([[s,e]])),p.delete(t),e.forEach((t=>{t(null,u.swap,[r])}))}}))};case o:return(e,r)=>{p.has(t)?p.get(t).has(e)?p.get(t).get(e).push(r):p.get(t).set(e,[r]):p.set(t,new Map([[e,[r]]]))};case n:return e=>{p.has(t)&&(p.get(t).delete(e),0===p.get(t).size&&p.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,r)}throw new Error("Unsupported symbol")}if(r in e){if(!Number.isNaN(Number(r)))return"object"==typeof e[r]?h(e[r]):e[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return p.has(e)?function(){const t=Array.prototype[r].apply(e,arguments);return p.get(e).forEach(((t,o)=>{t.forEach((t=>{t(e,r,arguments)}))})),t}:Reflect.get(e,r);if(e[r]instanceof Array)return h(e[r])}return Reflect.get(e,r)},set(t,e,r){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,r);if(p.has(t)){p.get(t).forEach(((t,o)=>{t.forEach((t=>{t(e,r)}))}))}return Reflect.set(t,e,r)}})}window.observers=p;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const f=Symbol("init"),d=Symbol("template"),y=Symbol("style"),m=Symbol("parent");function g(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function b(t={}){return function(e,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var o,n;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[m]||e.prototype[m][e.prototype[m].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[m]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[d]=t.template||""):(e.prototype[m].push(e.prototype),e.prototype[y].push(t.style),e.prototype[d]=(o=e.prototype[d],(n=t.template||null)&&n.match(/<parent\/>/)?n.replace(/<parent\/>/,o):`${o}${n||""}`));const s=e.prototype.connectedCallback||(()=>{}),i=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[f]||void 0!==t.template||void 0!==t.style)if(this[f]){if(this[f]&&t.style);else if(this[f]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[d]||"";const r=document.importNode(t.content,!0),o=this.attachShadow({mode:"open"});o.adoptedStyleSheets=e.prototype[y].map((t=>{if(t instanceof CSSStyleSheet)return t;var e=new CSSStyleSheet;return e.replaceSync(t.toString()),e})),o.appendChild(r)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&r.add(t.localName);const o=Array.from(r.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),n=()=>{this[m].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===o.length?(this[f]=!0,s.call(this),n()):Promise.all(o).then((()=>{this[f]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));n()}))},e.prototype.disconnectedCallback=function(){i.call(this)},e.prototype.attributeChangedCallback=function(t,e,r){this[v(t)]=r},r.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${r.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function w(t){return!!t&&t.constructor===Array}function S(t,e){t[f]&&t[m].map((r=>{r.render&&r.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":w(t)?"array":typeof t}function $(){return function(t,e){const r=e.name,o=r.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,r,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${o}]`))}})}))}}Symbol("hasProxy");const P=Symbol("meta");var x=r(441),A=function(t,e,r,o,n,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,l=o.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!e&&t?o.static?t:t.prototype:null,h=e||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),u=!1,f=r.length-1;f>=0;f--){var d={};for(var y in o)d[y]="access"===y?{}:o[y];for(var y in o.access)d.access[y]=o.access[y];d.addInitializer=function(t){if(u)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var m=(0,r[f])("accessor"===l?{get:h.get,set:h.set}:h[c],d);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(h.get=a),(a=i(m.set))&&(h.set=a),(a=i(m.init))&&n.unshift(a)}else(a=i(m))&&("field"===l?n.unshift(a):h[c]=a)}p&&Object.defineProperty(p,o.name,h),u=!0},C=function(t,e,r){for(var o=arguments.length>2,n=0;n<e.length;n++)r=o?e[n].call(t,r):e[n].call(t);return o?r:void 0};(()=>{let t,e,r,o,n,c=[b({selector:"pg-icon",style:x.A,template:'<svg part="svg" viewBox="0 0 24 24"> <path part="path" fill="currentColor" d="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"/> </svg>'})],p=[],u=HTMLElement,f=[],d=[],y=[],m=[],v=[],O=[];(class extends u{static{e=this}static{const b="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;var x;r=[function(t,e){const r=e.name,o=Symbol(r),n=Symbol(`${r}:type`),c=Symbol(`${r}:meta`);return e.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[n]||"array"===this[n]?this[o][a]?this[o]:h(this[o]):this[o],set:t=>{const e=E(x?x(t):t);if("index"!==r&&this[n]!==e&&"null"!==this[n]&&"null"!==e)throw new Error(`@Prop() ${r} with type '${this[n]}' cannot be set to ${e}.`);if("array"===this[n]){if(!w(t))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===t)throw new Error("Setting an array to itself is not allowed.");const e=h(this[o]);if(e[s]){const n=t[a]?t[l]:t;e[i](this,n),this[o]=t,console.log(">>> trigger render???",this,r)}else this[o]=t}else this[o]=x?x(t):t,S(this,r)}})})),function(t){if(void 0===t&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==t&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===t)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!e.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=g(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[n]=E(t),"array"===this[n]?(this[o]=t,new Proxy(t,{get:(t,e)=>e===P?this[c]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===P)return this[c]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=x?x(this.getAttribute(r)??t):this.getAttribute(r)??t,this[o])}}],o=[$()],n=[$()],A(null,null,r,{kind:"field",name:"path",static:!1,private:!1,access:{has:t=>"path"in t,get:t=>t.path,set:(t,e)=>{t.path=e}},metadata:b},f,d),A(null,null,o,{kind:"field",name:"$svg",static:!1,private:!1,access:{has:t=>"$svg"in t,get:t=>t.$svg,set:(t,e)=>{t.$svg=e}},metadata:b},y,m),A(null,null,n,{kind:"field",name:"$path",static:!1,private:!1,access:{has:t=>"$path"in t,get:t=>t.$path,set:(t,e)=>{t.$path=e}},metadata:b},v,O),A(null,t={value:e},c,{kind:"class",name:e.name,metadata:b},null,p),e=t.value,b&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b}),C(e,p)}path=C(this,f,"M0 0h24v24H0V0zm2 2v20h20V2H2z");$svg=(C(this,d),C(this,y,void 0));$path=(C(this,m),C(this,v,void 0));render(t){if(t.path){const t=getComputedStyle(this).getPropertyValue("--pg-icon-viewbox");if(this.$svg.setAttribute("viewBox",t||"0 0 24 24"),!this.path)throw new Error("invalid path set on pg-icon");this.$path.setAttribute("d",this.path)}}constructor(){super(...arguments),C(this,O)}})})()})();
|
|
1
|
+
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",o=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),o&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),o&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,o,n,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(i[c]=!0)}for(var l=0;l<t.length;l++){var p=[].concat(t[l]);o&&i[p[0]]||(void 0!==s&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=s),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),n&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=n):p[4]="".concat(n)),e.push(p))}},e}},441:(t,e,r)=>{r.d(e,{A:()=>c});var o=r(601),n=r.n(o),s=r(314),i=r.n(s)()(n());i.push([t.id,':host {\n display: inline-flex;\n color: var(--pg-icon-color, #453C4F);\n}\n\n[part="svg"] {\n width: var(--pg-icon-width, 1.5rem);\n height: var(--pg-icon-height, 1.5rem);\n}',""]);var a=new CSSStyleSheet;a.replaceSync(i.toString());const c=a},601:t=>{t.exports=function(t){return t[1]}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var s=e[o]={id:o,exports:{}};return t[o](s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const o=Symbol("addObserver"),n=Symbol("removeObserver"),s=Symbol("getObservers"),i=Symbol("swapObserver"),a=Symbol("isProxy"),c=Symbol("getTarget"),l=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function h(t){return new Proxy(t,{get(e,r){if("symbol"==typeof r){switch(r){case a:return!0;case c:return e;case s:return e=>{const r=p.get(t);return r?.has(e)};case i:return(e,r)=>{const o=p.get(t);if(o){const t=o.get(e);t&&t.forEach(((o,n)=>{if(!o)throw new Error("Unreachable");{const t=p.get(r);if(t){const r=t.get(e);r?r.set(n,o):t.set(e,new Map([[n,o]]))}else p.set(r,new Map([[e,new Map([[n,o]])]]))}t.delete(n),o.forEach((t=>{t(null,u.swap,[r])}))}))}};case o:return(e,r)=>{const o=e.getRootNode().host,n=p.get(t);if(n){const t=n.get(o);if(t){const o=t.get(e);o?o.push(r):t.set(e,[r])}else n.set(o,new Map([[e,[r]]]))}else p.set(t,new Map([[o,new Map([[e,[r]]])]]))};case n:return e=>{const r=e.getRootNode().host,o=p.get(t);o&&(o.delete(r),0===o.size&&p.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,r)}throw new Error("Unsupported symbol")}if(r in e){if(!Number.isNaN(Number(r)))return"object"==typeof e[r]?h(e[r]):e[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(l.includes(r))return p.has(e)?function(){const t=Array.prototype[r].apply(e,arguments),o=p.get(e);return o?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,r,arguments)}))}))})),t}:Reflect.get(e,r);if(e[r]instanceof Array)return h(e[r])}return Reflect.get(e,r)},set(t,e,r){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,r);if(p.has(t)){const o=p.get(t);o?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,r)}))}))}))}return Reflect.set(t,e,r)}})}window.observers=p;const u={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const f=Symbol("init"),d=Symbol("template"),y=Symbol("style"),m=Symbol("parent");function v(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function g(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function w(t={}){return function(e,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var o,n;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[m]||e.prototype[m][e.prototype[m].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[m]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[d]=t.template||""):(e.prototype[m].push(e.prototype),e.prototype[y].push(t.style),e.prototype[d]=(o=e.prototype[d],(n=t.template||null)&&n.match(/<parent\/>/)?n.replace(/<parent\/>/,o):o.match(/<child\/>/)?o.replace(/<child\/>/,n||""):`${o}${n||""}`));const s=e.prototype.connectedCallback||(()=>{}),i=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[f]||void 0!==t.template||void 0!==t.style)if(this[f]){if(this[f]&&t.style);else if(this[f]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[d]||"";const r=document.importNode(t.content,!0),o=this.attachShadow({mode:"open"});o.adoptedStyleSheets=e.prototype[y].reduce(((t,e)=>{if(!e)return t;if(e instanceof CSSStyleSheet)return t.push(e),t;var r=new CSSStyleSheet;return r.replaceSync(e.toString()),t.push(r),t}),[]),o.appendChild(r)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&r.add(t.localName);const o=Array.from(r.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),n=()=>{this[m].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[g(e)]=!0,t)),{}):{})}))};0===o.length?(this[f]=!0,s.call(this),n()):Promise.all(o).then((()=>{this[f]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));n()}))},e.prototype.disconnectedCallback=function(){i.call(this)},e.prototype.attributeChangedCallback=function(t,e,r){this[g(t)]=r},r.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${r.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function b(t){return!!t&&t.constructor===Array}function S(t,e){t[f]&&t[m].map((r=>{r.render&&r.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":b(t)?"array":typeof t}function $(){return function(t,e){const r=e.name,o=r.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,r,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${o}]`))}})}))}}Symbol("hasProxy");const P=Symbol("meta");var x=r(441),A=function(t,e,r,o,n,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,c=o.kind,l="getter"===c?"get":"setter"===c?"set":"value",p=!e&&t?o.static?t:t.prototype:null,h=e||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),u=!1,f=r.length-1;f>=0;f--){var d={};for(var y in o)d[y]="access"===y?{}:o[y];for(var y in o.access)d.access[y]=o.access[y];d.addInitializer=function(t){if(u)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var m=(0,r[f])("accessor"===c?{get:h.get,set:h.set}:h[l],d);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(h.get=a),(a=i(m.set))&&(h.set=a),(a=i(m.init))&&n.unshift(a)}else(a=i(m))&&("field"===c?n.unshift(a):h[l]=a)}p&&Object.defineProperty(p,o.name,h),u=!0},C=function(t,e,r){for(var o=arguments.length>2,n=0;n<e.length;n++)r=o?e[n].call(t,r):e[n].call(t);return o?r:void 0};(()=>{let t,e,r,o,n,l=[w({selector:"pg-icon",style:x.A,template:'<svg part="svg" viewBox="0 0 24 24"> <path part="path" fill="currentColor" d="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"/> </svg>'})],p=[],u=HTMLElement,f=[],d=[],y=[],m=[],g=[],O=[];(class extends u{static{e=this}static{const w="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;var x;r=[function(t,e){const r=e.name,o=Symbol(r),n=Symbol(`${r}:type`),l=Symbol(`${r}:meta`);return e.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[n]||"array"===this[n]?this[o][a]?this[o]:h(this[o]):this[o],set:t=>{const e=E(x?x(t):t);if("index"!==r&&this[n]!==e&&"null"!==this[n]&&"null"!==e)throw new Error(`@Prop() ${r} with type '${this[n]}' cannot be set to ${e}.`);if("array"===this[n]){if(!b(t))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===t)throw new Error("Setting an array to itself is not allowed.");const e=h(this[o]);if(e[s](this)){const r=t[a]?t[c]:t;e[i](this,r),this[o]=t}else this[o]=t}else this[o]=x?x(t):t,S(this,r)}})})),function(t){if(void 0===t&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==t&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===t)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!e.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=v(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[n]=E(t),"array"===this[n]?(this[o]=t,new Proxy(t,{get:(t,e)=>e===P?this[l]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===P)return this[l]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=x?x(this.getAttribute(r)??t):this.getAttribute(r)??t,this[o])}}],o=[$()],n=[$()],A(null,null,r,{kind:"field",name:"path",static:!1,private:!1,access:{has:t=>"path"in t,get:t=>t.path,set:(t,e)=>{t.path=e}},metadata:w},f,d),A(null,null,o,{kind:"field",name:"$svg",static:!1,private:!1,access:{has:t=>"$svg"in t,get:t=>t.$svg,set:(t,e)=>{t.$svg=e}},metadata:w},y,m),A(null,null,n,{kind:"field",name:"$path",static:!1,private:!1,access:{has:t=>"$path"in t,get:t=>t.$path,set:(t,e)=>{t.$path=e}},metadata:w},g,O),A(null,t={value:e},l,{kind:"class",name:e.name,metadata:w},null,p),e=t.value,w&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w}),C(e,p)}path=C(this,f,"M0 0h24v24H0V0zm2 2v20h20V2H2z");$svg=(C(this,d),C(this,y,void 0));$path=(C(this,m),C(this,g,void 0));render(t){if(t.path){const t=getComputedStyle(this).getPropertyValue("--pg-icon-viewbox");if(this.$svg.setAttribute("viewBox",t||"0 0 24 24"),!this.path)throw new Error("invalid path set on pg-icon");this.$path.setAttribute("d",this.path)}}constructor(){super(...arguments),C(this,O)}})})()})();
|
package/pgInputCheck.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={175:(t,e,n)=>{n.d(e,{A:()=>l});var r=n(601),o=n.n(r),s=n(314),a=n.n(s)()(o());a.push([t.id,':host {\n display: inline-flex;\n}\n\n.blank {\n color: var(--pg-input-check-blank-color, #453C4F);\n}\n.blank [part="check"] {\n visibility: hidden;\n}\n\n.checked {\n color: var(--pg-input-check-checked-color, #453C4F);\n}\n\n[part="button"] {\n display: flex;\n padding: 0;\n border: 0;\n outline: 0;\n border-radius: 0.25rem;\n background: transparent;\n}\n\n[part="svg"] {\n width: var(--pg-icon-check-size, 1.5rem);\n height: var(--pg-icon-check-size, 1.5rem);\n}\n\n[part="button"]:not(:hover):active {\n box-shadow: 0 0 0 3px var(--pg-input-check-active-glow, rgb(79, 143, 249, 0.6));\n}\n[part="button"]:not(:hover):focus:not(:focus-visible) {\n box-shadow: none;\n}\n[part="button"]:not(:hover):focus {\n box-shadow: 0 0 0 3px var(--pg-input-check-focus-glow, rgb(79, 143, 249, 0.5));\n}\n[part="button"]:not(:disabled):hover [part="path"] {\n fill: #4f8ff9;\n}\n\n[part="button"]:disabled {\n color: #AAA;\n}',""]);var i=new CSSStyleSheet;i.replaceSync(a.toString());const l=i},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var i=0;i<this.length;i++){var l=this[i][0];null!=l&&(a[l]=!0)}for(var c=0;c<t.length;c++){var u=[].concat(t[c]);r&&a[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={id:r,exports:{}};return t[r](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=Symbol("addObserver"),o=Symbol("removeObserver"),s=Symbol("getObservers"),a=Symbol("swapObserver"),i=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],u=new Map;function p(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case i:return!0;case l:return e;case s:return u.has(t);case a:return(e,n)=>{const r=u.get(t);r.forEach(((o,s)=>{if(s.getRootNode().host===e){const e=r.get(s);u.has(n)?u.get(n).has(s)?u.get(n).get(s).push(r.get(s)):u.get(n).set(s,r.get(s)):u.set(n,new Map([[s,e]])),u.delete(t),e.forEach((t=>{t(null,h.swap,[n])}))}}))};case r:return(e,n)=>{u.has(t)?u.get(t).has(e)?u.get(t).get(e).push(n):u.get(t).set(e,[n]):u.set(t,new Map([[e,[n]]]))};case o:return e=>{u.has(t)&&(u.get(t).delete(e),0===u.get(t).size&&u.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?p(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(c.includes(n))return u.has(e)?function(){const t=Array.prototype[n].apply(e,arguments);return u.get(e).forEach(((t,r)=>{t.forEach((t=>{t(e,n,arguments)}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return p(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(u.has(t)){u.get(t).forEach(((t,r)=>{t.forEach((t=>{t(e,n)}))}))}return Reflect.set(t,e,n)}})}window.observers=u;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),y=Symbol("style"),b=Symbol("parent");function m(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function g(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var r,o;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[b]||e.prototype[b][e.prototype[b].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[b]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[f]=t.template||""):(e.prototype[b].push(e.prototype),e.prototype[y].push(t.style),e.prototype[f]=(r=e.prototype[f],(o=t.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,r):`${r}${o||""}`));const s=e.prototype.connectedCallback||(()=>{}),a=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[d]||void 0!==t.template||void 0!==t.style)if(this[d]){if(this[d]&&t.style);else if(this[d]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[f]||"";const n=document.importNode(t.content,!0),r=this.attachShadow({mode:"open"});r.adoptedStyleSheets=e.prototype[y].map((t=>{if(t instanceof CSSStyleSheet)return t;var e=new CSSStyleSheet;return e.replaceSync(t.toString()),e})),r.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const r=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),o=()=>{this[b].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===r.length?(this[d]=!0,s.call(this),o()):Promise.all(r).then((()=>{this[d]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));o()}))},e.prototype.disconnectedCallback=function(){a.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[v(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function w(t){return!!t&&t.constructor===Array}function S(t,e){t[d]&&t[b].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":w(t)?"array":typeof t}function k(t){return function(e,n){const r=n.name,o=Symbol(r),c=Symbol(`${r}:type`),u=Symbol(`${r}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[c]||"array"===this[c]?this[o][i]?this[o]:p(this[o]):this[o],set:e=>{const n=E(t?t(e):e);if("index"!==r&&this[c]!==n&&"null"!==this[c]&&"null"!==n)throw new Error(`@Prop() ${r} with type '${this[c]}' cannot be set to ${n}.`);if("array"===this[c]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=p(this[o]);if(t[s]){const n=e[i]?e[l]:e;t[a](this,n),this[o]=e,console.log(">>> trigger render???",this,r)}else this[o]=e}else this[o]=t?t(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=m(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[c]=E(e),"array"===this[c]?(this[o]=e,new Proxy(e,{get:(t,e)=>e===$?this[u]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===$)return this[u]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=t?t(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}}function C(){return function(t,e){const n=e.name,r=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${r}]`))}})}))}}Symbol("hasProxy");const $=Symbol("meta");var x=n(175),A=function(t,e,n,r,o,s){function a(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var i,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!e&&t?r.static?t:t.prototype:null,p=e||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var y in r)f[y]="access"===y?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(t||null))};var b=(0,n[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(i=a(b.get))&&(p.get=i),(i=a(b.set))&&(p.set=i),(i=a(b.init))&&o.unshift(i)}else(i=a(b))&&("field"===l?o.unshift(i):p[c]=i)}u&&Object.defineProperty(u,r.name,p),h=!0},P=function(t,e,n){for(var r=arguments.length>2,o=0;o<e.length;o++)n=r?e[o].call(t,n):e[o].call(t);return r?n:void 0};(()=>{let t,e,n,r,o,s,a=[g({selector:"pg-input-check",style:x.A,template:'<button part="button"> <svg part="svg" viewBox="0 0 24 24"> <path part="path" fill="currentColor" d="M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19"/> <path part="check" fill="currentColor" d="M7.91 10.08L6.5 11.5L11 16L21 6L19.59 4.58L11 13.17L7.91 10.08Z"/> </svg> </button>'})],i=[],l=HTMLElement,c=[],u=[],p=[],h=[],d=[],f=[],y=[],b=[];(class extends l{static{e=this}static{const m="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;n=[k()],r=[k()],o=[C()],s=[C()],A(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:t=>"value"in t,get:t=>t.value,set:(t,e)=>{t.value=e}},metadata:m},c,u),A(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:t=>"disabled"in t,get:t=>t.disabled,set:(t,e)=>{t.disabled=e}},metadata:m},p,h),A(null,null,o,{kind:"field",name:"$button",static:!1,private:!1,access:{has:t=>"$button"in t,get:t=>t.$button,set:(t,e)=>{t.$button=e}},metadata:m},d,f),A(null,null,s,{kind:"field",name:"$path",static:!1,private:!1,access:{has:t=>"$path"in t,get:t=>t.$path,set:(t,e)=>{t.$path=e}},metadata:m},y,b),A(null,t={value:e},a,{kind:"class",name:e.name,metadata:m},null,i),e=t.value,m&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m}),P(e,i)}value=P(this,c,!1);disabled=(P(this,u),P(this,p,!1));$button=(P(this,h),P(this,d,void 0));$path=(P(this,f),P(this,y,void 0));connectedCallback(){this.$button.addEventListener("click",this.handleClick.bind(this))}handleClick(){const t=[!0,"true"].includes(this.value);this.value=!t,this.dispatchEvent(new CustomEvent("change"))}render(t){if(t.value){const t=[!0,"true"].includes(this.value);this.$path.setAttribute("d",t?"M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"),this.$button.classList.toggle("blank",!t),this.$button.classList.toggle("checked",t)}t.disabled&&(this.$button.disabled=["",!0,"true"].includes(this.disabled))}constructor(){super(...arguments),P(this,b)}})})()})();
|
|
1
|
+
(()=>{"use strict";var t={175:(t,e,n)=>{n.d(e,{A:()=>c});var r=n(601),o=n.n(r),s=n(314),i=n.n(s)()(o());i.push([t.id,':host {\n display: inline-flex;\n}\n\n.blank {\n color: var(--pg-input-check-blank-color, #453C4F);\n}\n.blank [part="check"] {\n visibility: hidden;\n}\n\n.checked {\n color: var(--pg-input-check-checked-color, #453C4F);\n}\n\n[part="button"] {\n display: flex;\n padding: 0;\n border: 0;\n outline: 0;\n border-radius: 0.25rem;\n background: transparent;\n}\n\n[part="svg"] {\n width: var(--pg-icon-check-size, 1.5rem);\n height: var(--pg-icon-check-size, 1.5rem);\n}\n\n[part="button"]:not(:hover):active {\n box-shadow: 0 0 0 3px var(--pg-input-check-active-glow, rgb(79, 143, 249, 0.6));\n}\n[part="button"]:not(:hover):focus:not(:focus-visible) {\n box-shadow: none;\n}\n[part="button"]:not(:hover):focus {\n box-shadow: 0 0 0 3px var(--pg-input-check-focus-glow, rgb(79, 143, 249, 0.5));\n}\n[part="button"]:not(:disabled):hover [part="path"] {\n fill: #4f8ff9;\n}\n\n[part="button"]:disabled {\n color: #AAA;\n}',""]);var a=new CSSStyleSheet;a.replaceSync(i.toString());const c=a},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(i[c]=!0)}for(var l=0;l<t.length;l++){var u=[].concat(t[l]);r&&i[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},e}},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={id:r,exports:{}};return t[r](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=Symbol("addObserver"),o=Symbol("removeObserver"),s=Symbol("getObservers"),i=Symbol("swapObserver"),a=Symbol("isProxy"),c=Symbol("getTarget"),l=["fill","pop","push","reverse","shift","sort","splice","unshift"],u=new Map;function p(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case a:return!0;case c:return e;case s:return e=>{const n=u.get(t);return n?.has(e)};case i:return(e,n)=>{const r=u.get(t);if(r){const t=r.get(e);t&&t.forEach(((r,o)=>{if(!r)throw new Error("Unreachable");{const t=u.get(n);if(t){const n=t.get(e);n?n.set(o,r):t.set(e,new Map([[o,r]]))}else u.set(n,new Map([[e,new Map([[o,r]])]]))}t.delete(o),r.forEach((t=>{t(null,h.swap,[n])}))}))}};case r:return(e,n)=>{const r=e.getRootNode().host,o=u.get(t);if(o){const t=o.get(r);if(t){const r=t.get(e);r?r.push(n):t.set(e,[n])}else o.set(r,new Map([[e,[n]]]))}else u.set(t,new Map([[r,new Map([[e,[n]]])]]))};case o:return e=>{const n=e.getRootNode().host,r=u.get(t);r&&(r.delete(n),0===r.size&&u.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?p(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(l.includes(n))return u.has(e)?function(){const t=Array.prototype[n].apply(e,arguments),r=u.get(e);return r?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n,arguments)}))}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return p(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(u.has(t)){const r=u.get(t);r?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n)}))}))}))}return Reflect.set(t,e,n)}})}window.observers=u;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),y=Symbol("style"),b=Symbol("parent");function m(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function g(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var r,o;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[b]||e.prototype[b][e.prototype[b].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[b]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[f]=t.template||""):(e.prototype[b].push(e.prototype),e.prototype[y].push(t.style),e.prototype[f]=(r=e.prototype[f],(o=t.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,r):r.match(/<child\/>/)?r.replace(/<child\/>/,o||""):`${r}${o||""}`));const s=e.prototype.connectedCallback||(()=>{}),i=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[d]||void 0!==t.template||void 0!==t.style)if(this[d]){if(this[d]&&t.style);else if(this[d]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[f]||"";const n=document.importNode(t.content,!0),r=this.attachShadow({mode:"open"});r.adoptedStyleSheets=e.prototype[y].reduce(((t,e)=>{if(!e)return t;if(e instanceof CSSStyleSheet)return t.push(e),t;var n=new CSSStyleSheet;return n.replaceSync(e.toString()),t.push(n),t}),[]),r.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const r=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),o=()=>{this[b].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===r.length?(this[d]=!0,s.call(this),o()):Promise.all(r).then((()=>{this[d]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));o()}))},e.prototype.disconnectedCallback=function(){i.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[v(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function w(t){return!!t&&t.constructor===Array}function S(t,e){t[d]&&t[b].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":w(t)?"array":typeof t}function k(t){return function(e,n){const r=n.name,o=Symbol(r),l=Symbol(`${r}:type`),u=Symbol(`${r}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[l]||"array"===this[l]?this[o][a]?this[o]:p(this[o]):this[o],set:e=>{const n=E(t?t(e):e);if("index"!==r&&this[l]!==n&&"null"!==this[l]&&"null"!==n)throw new Error(`@Prop() ${r} with type '${this[l]}' cannot be set to ${n}.`);if("array"===this[l]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=p(this[o]);if(t[s](this)){const n=e[a]?e[c]:e;t[i](this,n),this[o]=e}else this[o]=e}else this[o]=t?t(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=m(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[l]=E(e),"array"===this[l]?(this[o]=e,new Proxy(e,{get:(t,e)=>e===$?this[u]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===$)return this[u]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=t?t(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}}function C(){return function(t,e){const n=e.name,r=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${r}]`))}})}))}}Symbol("hasProxy");const $=Symbol("meta");var x=n(175),A=function(t,e,n,r,o,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,c=r.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!e&&t?r.static?t:t.prototype:null,p=e||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var y in r)f[y]="access"===y?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var b=(0,n[d])("accessor"===c?{get:p.get,set:p.set}:p[l],f);if("accessor"===c){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(a=i(b.get))&&(p.get=a),(a=i(b.set))&&(p.set=a),(a=i(b.init))&&o.unshift(a)}else(a=i(b))&&("field"===c?o.unshift(a):p[l]=a)}u&&Object.defineProperty(u,r.name,p),h=!0},P=function(t,e,n){for(var r=arguments.length>2,o=0;o<e.length;o++)n=r?e[o].call(t,n):e[o].call(t);return r?n:void 0};(()=>{let t,e,n,r,o,s,i=[g({selector:"pg-input-check",style:x.A,template:'<button part="button"> <svg part="svg" viewBox="0 0 24 24"> <path part="path" fill="currentColor" d="M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19"/> <path part="check" fill="currentColor" d="M7.91 10.08L6.5 11.5L11 16L21 6L19.59 4.58L11 13.17L7.91 10.08Z"/> </svg> </button>'})],a=[],c=HTMLElement,l=[],u=[],p=[],h=[],d=[],f=[],y=[],b=[];(class extends c{static{e=this}static{const m="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;n=[k()],r=[k()],o=[C()],s=[C()],A(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:t=>"value"in t,get:t=>t.value,set:(t,e)=>{t.value=e}},metadata:m},l,u),A(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:t=>"disabled"in t,get:t=>t.disabled,set:(t,e)=>{t.disabled=e}},metadata:m},p,h),A(null,null,o,{kind:"field",name:"$button",static:!1,private:!1,access:{has:t=>"$button"in t,get:t=>t.$button,set:(t,e)=>{t.$button=e}},metadata:m},d,f),A(null,null,s,{kind:"field",name:"$path",static:!1,private:!1,access:{has:t=>"$path"in t,get:t=>t.$path,set:(t,e)=>{t.$path=e}},metadata:m},y,b),A(null,t={value:e},i,{kind:"class",name:e.name,metadata:m},null,a),e=t.value,m&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m}),P(e,a)}value=P(this,l,!1);disabled=(P(this,u),P(this,p,!1));$button=(P(this,h),P(this,d,void 0));$path=(P(this,f),P(this,y,void 0));connectedCallback(){this.$button.addEventListener("click",this.handleClick.bind(this))}handleClick(){const t=[!0,"true"].includes(this.value);this.value=!t,this.dispatchEvent(new CustomEvent("change"))}render(t){if(t.value){const t=[!0,"true"].includes(this.value);this.$path.setAttribute("d",t?"M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"),this.$button.classList.toggle("blank",!t),this.$button.classList.toggle("checked",t)}t.disabled&&(this.$button.disabled=["",!0,"true"].includes(this.disabled))}constructor(){super(...arguments),P(this,b)}})})()})();
|
package/pgInputCheckList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(i[l]=!0)}for(var c=0;c<t.length;c++){var p=[].concat(t[c]);r&&i[p[0]]||(void 0!==s&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=s),n&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=n):p[2]=n),o&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=o):p[4]="".concat(o)),e.push(p))}},e}},359:(t,e,n)=>{n.d(e,{A:()=>l});var r=n(601),o=n.n(r),s=n(314),i=n.n(s)()(o());i.push([t.id,':host {\n display: flex;\n flex-direction: column;\n}\n\n.blank {\n color: var(--pg-input-check-blank-color, #453C4F);\n}\n.blank [part="check"] {\n visibility: hidden;\n}\n\n.checked {\n color: var(--pg-input-check-checked-color, #453C4F);\n}\n\n[part="list"] {\n display: flex;\n flex-direction: column;\n list-style: none;\n margin: 0;\n padding: 0.25rem 0;\n}\n\n[part="list"] li {\n display: flex;\n flex-direction: column;\n}\n\n[part="list"] li:not(:last-child) {\n margin-bottom: 0.25rem;\n}\n\n[part="list"] button {\n display: flex;\n padding: 0;\n border: 0;\n outline: 0;\n border-radius: 0.25rem;\n align-items: center;\n background: transparent;\n}\n\n[part="svg"] {\n width: var(--pg-icon-check-size, 1.5rem);\n height: var(--pg-icon-check-size, 1.5rem);\n}\n\n[part="list"] button span {\n margin-left: 0.25rem;\n}\n\n[part="list"] button:not(:hover):active {\n box-shadow: 0 0 0 3px var(--pg-input-check-active-glow, rgb(79, 143, 249, 0.6));\n}\n[part="list"] button:not(:hover):focus:not(:focus-visible) {\n box-shadow: none;\n}\n[part="list"] button:not(:hover):focus-visible {\n box-shadow: 0 0 0 3px var(--pg-input-check-focus-glow, rgb(79, 143, 249, 0.5));\n}\n[part="list"] button:not(:disabled):hover [part="path"] {\n fill: #4f8ff9;\n}\n[part="list"] button:not(:disabled):hover span {\n color: #4f8ff9;\n}\n[part="list"] button:disabled {\n color: #AAA;\n}',""]);var a=new CSSStyleSheet;a.replaceSync(i.toString());const l=a},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={id:r,exports:{}};return t[r](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=Symbol("addObserver"),o=Symbol("removeObserver"),s=Symbol("getObservers"),i=Symbol("swapObserver"),a=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function u(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case a:return!0;case l:return e;case s:return p.has(t);case i:return(e,n)=>{const r=p.get(t);r.forEach(((o,s)=>{if(s.getRootNode().host===e){const e=r.get(s);p.has(n)?p.get(n).has(s)?p.get(n).get(s).push(r.get(s)):p.get(n).set(s,r.get(s)):p.set(n,new Map([[s,e]])),p.delete(t),e.forEach((t=>{t(null,h.swap,[n])}))}}))};case r:return(e,n)=>{p.has(t)?p.get(t).has(e)?p.get(t).get(e).push(n):p.get(t).set(e,[n]):p.set(t,new Map([[e,[n]]]))};case o:return e=>{p.has(t)&&(p.get(t).delete(e),0===p.get(t).size&&p.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?u(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(c.includes(n))return p.has(e)?function(){const t=Array.prototype[n].apply(e,arguments);return p.get(e).forEach(((t,r)=>{t.forEach((t=>{t(e,n,arguments)}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return u(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(p.has(t)){p.get(t).forEach(((t,r)=>{t.forEach((t=>{t(e,n)}))}))}return Reflect.set(t,e,n)}})}window.observers=p;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),y=Symbol("style"),m=Symbol("parent");function b(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function g(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var r,o;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[m]||e.prototype[m][e.prototype[m].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[m]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[f]=t.template||""):(e.prototype[m].push(e.prototype),e.prototype[y].push(t.style),e.prototype[f]=(r=e.prototype[f],(o=t.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,r):`${r}${o||""}`));const s=e.prototype.connectedCallback||(()=>{}),i=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[d]||void 0!==t.template||void 0!==t.style)if(this[d]){if(this[d]&&t.style);else if(this[d]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[f]||"";const n=document.importNode(t.content,!0),r=this.attachShadow({mode:"open"});r.adoptedStyleSheets=e.prototype[y].map((t=>{if(t instanceof CSSStyleSheet)return t;var e=new CSSStyleSheet;return e.replaceSync(t.toString()),e})),r.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const r=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),o=()=>{this[m].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===r.length?(this[d]=!0,s.call(this),o()):Promise.all(r).then((()=>{this[d]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));o()}))},e.prototype.disconnectedCallback=function(){i.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[v(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function w(t){return!!t&&t.constructor===Array}function S(t,e){t[d]&&t[m].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":w(t)?"array":typeof t}function x(t){return function(e,n){const r=n.name,o=Symbol(r),c=Symbol(`${r}:type`),p=Symbol(`${r}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[c]||"array"===this[c]?this[o][a]?this[o]:u(this[o]):this[o],set:e=>{const n=E(t?t(e):e);if("index"!==r&&this[c]!==n&&"null"!==this[c]&&"null"!==n)throw new Error(`@Prop() ${r} with type '${this[c]}' cannot be set to ${n}.`);if("array"===this[c]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=u(this[o]);if(t[s]){const n=e[a]?e[l]:e;t[i](this,n),this[o]=e,console.log(">>> trigger render???",this,r)}else this[o]=e}else this[o]=t?t(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=b(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[c]=E(e),"array"===this[c]?(this[o]=e,new Proxy(e,{get:(t,e)=>e===k?this[p]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===k)return this[p]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=t?t(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}}Symbol("hasProxy");const k=Symbol("meta");var A=n(359);var C=function(t,e,n,r,o,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!e&&t?r.static?t:t.prototype:null,u=e||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var y in r)f[y]="access"===y?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var m=(0,n[d])("accessor"===l?{get:u.get,set:u.set}:u[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(u.get=a),(a=i(m.set))&&(u.set=a),(a=i(m.init))&&o.unshift(a)}else(a=i(m))&&("field"===l?o.unshift(a):u[c]=a)}p&&Object.defineProperty(p,r.name,u),h=!0},P=function(t,e,n){for(var r=arguments.length>2,o=0;o<e.length;o++)n=r?e[o].call(t,n):e[o].call(t);return r?n:void 0};(()=>{let t,e,n,r,o,s=[g({selector:"pg-input-check-list",style:A.A,template:'<ul part="list"></ul>'})],i=[],a=HTMLElement,l=[],c=[],p=[],u=[],h=[],d=[];(class extends a{static{e=this}static{const f="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;n=[x()],r=[x()],o=[function(t,e){const n=e.name,r=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${r}]`))}})}))}],C(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:t=>"value"in t,get:t=>t.value,set:(t,e)=>{t.value=e}},metadata:f},l,c),C(null,null,r,{kind:"field",name:"options",static:!1,private:!1,access:{has:t=>"options"in t,get:t=>t.options,set:(t,e)=>{t.options=e}},metadata:f},p,u),C(null,null,o,{kind:"field",name:"$list",static:!1,private:!1,access:{has:t=>"$list"in t,get:t=>t.$list,set:(t,e)=>{t.$list=e}},metadata:f},h,d),C(null,t={value:e},s,{kind:"class",name:e.name,metadata:f},null,i),e=t.value,f&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f}),P(e,i)}value=P(this,l,[]);options=(P(this,c),P(this,p,[]));$list=(P(this,u),P(this,h,void 0));connectedCallback(){}handleClick(t){const e=this.value.includes(t.value),n=function(t,e,n){return Array.from(t.children).find((t=>t.dataset.key===e[n]))}(this.$list,t,"value"),r=n.querySelector("button");r?.classList.toggle("blank",e),r?.classList.toggle("checked",!e),n.querySelector('[part="path"]')?.setAttribute("d",e?"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z":"M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19"),e?this.value.splice(this.value.findIndex((e=>e===t.value)),1):this.value.push(t.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))}render(t){t.options,t.value}constructor(){super(...arguments),P(this,d)}})})()})();
|
|
1
|
+
(()=>{"use strict";var t={314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(i[l]=!0)}for(var c=0;c<t.length;c++){var p=[].concat(t[c]);r&&i[p[0]]||(void 0!==s&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=s),n&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=n):p[2]=n),o&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=o):p[4]="".concat(o)),e.push(p))}},e}},359:(t,e,n)=>{n.d(e,{A:()=>l});var r=n(601),o=n.n(r),s=n(314),i=n.n(s)()(o());i.push([t.id,':host {\n display: flex;\n flex-direction: column;\n}\n\n.blank {\n color: var(--pg-input-check-blank-color, #453C4F);\n}\n.blank [part="check"] {\n visibility: hidden;\n}\n\n.checked {\n color: var(--pg-input-check-checked-color, #453C4F);\n}\n\n[part="list"] {\n display: flex;\n flex-direction: column;\n list-style: none;\n margin: 0;\n padding: 0.25rem 0;\n}\n\n[part="list"] li {\n display: flex;\n flex-direction: column;\n}\n\n[part="list"] li:not(:last-child) {\n margin-bottom: 0.25rem;\n}\n\n[part="list"] button {\n display: flex;\n padding: 0;\n border: 0;\n outline: 0;\n border-radius: 0.25rem;\n align-items: center;\n background: transparent;\n}\n\n[part="svg"] {\n width: var(--pg-icon-check-size, 1.5rem);\n height: var(--pg-icon-check-size, 1.5rem);\n}\n\n[part="list"] button span {\n margin-left: 0.25rem;\n}\n\n[part="list"] button:not(:hover):active {\n box-shadow: 0 0 0 3px var(--pg-input-check-active-glow, rgb(79, 143, 249, 0.6));\n}\n[part="list"] button:not(:hover):focus:not(:focus-visible) {\n box-shadow: none;\n}\n[part="list"] button:not(:hover):focus-visible {\n box-shadow: 0 0 0 3px var(--pg-input-check-focus-glow, rgb(79, 143, 249, 0.5));\n}\n[part="list"] button:not(:disabled):hover [part="path"] {\n fill: #4f8ff9;\n}\n[part="list"] button:not(:disabled):hover span {\n color: #4f8ff9;\n}\n[part="list"] button:disabled {\n color: #AAA;\n}',""]);var a=new CSSStyleSheet;a.replaceSync(i.toString());const l=a},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={id:r,exports:{}};return t[r](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=Symbol("addObserver"),o=Symbol("removeObserver"),s=Symbol("getObservers"),i=Symbol("swapObserver"),a=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function u(t){return new Proxy(t,{get(e,n){if("symbol"==typeof n){switch(n){case a:return!0;case l:return e;case s:return e=>{const n=p.get(t);return n?.has(e)};case i:return(e,n)=>{const r=p.get(t);if(r){const t=r.get(e);t&&t.forEach(((r,o)=>{if(!r)throw new Error("Unreachable");{const t=p.get(n);if(t){const n=t.get(e);n?n.set(o,r):t.set(e,new Map([[o,r]]))}else p.set(n,new Map([[e,new Map([[o,r]])]]))}t.delete(o),r.forEach((t=>{t(null,h.swap,[n])}))}))}};case r:return(e,n)=>{const r=e.getRootNode().host,o=p.get(t);if(o){const t=o.get(r);if(t){const r=t.get(e);r?r.push(n):t.set(e,[n])}else o.set(r,new Map([[e,[n]]]))}else p.set(t,new Map([[r,new Map([[e,[n]]])]]))};case o:return e=>{const n=e.getRootNode().host,r=p.get(t);r&&(r.delete(n),0===r.size&&p.delete(t))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(e,n)}throw new Error("Unsupported symbol")}if(n in e){if(!Number.isNaN(Number(n)))return"object"==typeof e[n]?u(e[n]):e[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(c.includes(n))return p.has(e)?function(){const t=Array.prototype[n].apply(e,arguments),r=p.get(e);return r?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n,arguments)}))}))})),t}:Reflect.get(e,n);if(e[n]instanceof Array)return u(e[n])}return Reflect.get(e,n)},set(t,e,n){if("symbol"==typeof e)throw new Error("Setting symbols not allowed.");if(Array.isArray(t))return Reflect.set(t,e,n);if(p.has(t)){const r=p.get(t);r?.forEach((t=>{t.forEach((t=>{t.forEach((t=>{t(e,n)}))}))}))}return Reflect.set(t,e,n)}})}window.observers=p;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(t,e){super(t),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),y=Symbol("style"),m=Symbol("parent");function b(t){return t.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function v(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function g(t={}){return function(e,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var r,o;Reflect.defineProperty(e,"name",{value:t.selector,writable:!1,configurable:!1}),!e.prototype[m]||e.prototype[m][e.prototype[m].length-1]instanceof Object.getPrototypeOf(e)?e.prototype instanceof HTMLElement&&(e.prototype[m]=[e.prototype],e.prototype[y]=t.style?[t.style]:[],e.prototype[f]=t.template||""):(e.prototype[m].push(e.prototype),e.prototype[y].push(t.style),e.prototype[f]=(r=e.prototype[f],(o=t.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,r):r.match(/<child\/>/)?r.replace(/<child\/>/,o||""):`${r}${o||""}`));const s=e.prototype.connectedCallback||(()=>{}),i=e.prototype.disconnectedCallback||(()=>{});e.prototype.connectedCallback=function(){if(this[d]||void 0!==t.template||void 0!==t.style)if(this[d]){if(this[d]&&t.style);else if(this[d]&&t.selector&&!t.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===t.useShadow)throw new Error("unsupported");{const t=document.createElement("template");t.innerHTML=e.prototype[f]||"";const n=document.importNode(t.content,!0),r=this.attachShadow({mode:"open"});r.adoptedStyleSheets=e.prototype[y].reduce(((t,e)=>{if(!e)return t;if(e instanceof CSSStyleSheet)return t.push(e),t;var n=new CSSStyleSheet;return n.replaceSync(e.toString()),t.push(n),t}),[]),r.appendChild(n)}}else!1===t.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const t of this.shadowRoot.querySelectorAll("*"))-1!==t.localName.indexOf("-")&&n.add(t.localName);const r=Array.from(n.values()).map((t=>customElements.get(t)?Promise.resolve():customElements.whenDefined(t))),o=()=>{this[m].map((t=>{t.render&&t.render.call(this,e.observedAttributes?e.observedAttributes.reduce(((t,e)=>(t[v(e)]=!0,t)),{}):{})}))};0===r.length?(this[d]=!0,s.call(this),o()):Promise.all(r).then((()=>{this[d]=!0,s.call(this);for(const t of this.shadowRoot.querySelectorAll("slot"))t.dispatchEvent(new CustomEvent("slotchange"));o()}))},e.prototype.disconnectedCallback=function(){i.call(this)},e.prototype.attributeChangedCallback=function(t,e,n){this[v(t)]=n},n.addInitializer((function(){if(t.selector){if(window.customElements.get(t.selector))throw new Error(`@Component() ${n.name} duplicate selector '${t.selector}'`);window.customElements.define(t.selector,e)}}))}}Symbol("transmute");function w(t){return!!t&&t.constructor===Array}function S(t,e){t[d]&&t[m].map((n=>{n.render&&n.render.call(t,{[e]:!0})}))}function E(t){return null===t?"null":w(t)?"array":typeof t}function x(t){return function(e,n){const r=n.name,o=Symbol(r),c=Symbol(`${r}:type`),p=Symbol(`${r}:meta`);return n.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[c]||"array"===this[c]?this[o][a]?this[o]:u(this[o]):this[o],set:e=>{const n=E(t?t(e):e);if("index"!==r&&this[c]!==n&&"null"!==this[c]&&"null"!==n)throw new Error(`@Prop() ${r} with type '${this[c]}' cannot be set to ${n}.`);if("array"===this[c]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=u(this[o]);if(t[s](this)){const n=e[a]?e[l]:e;t[i](this,n),this[o]=e}else this[o]=e}else this[o]=t?t(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!n.private){const{constructor:t}=this;t.observedAttributes??=[],t.symbols||(t.symbols={});const{symbols:e}=t,n=b(r);e[r]||(t.observedAttributes.push(n),e[r]=o)}return this[c]=E(e),"array"===this[c]?(this[o]=e,new Proxy(e,{get:(t,e)=>e===k?this[p]:(console.log("errr???"),Reflect.get(this[o],e)),set:(t,e,n)=>{if(e===k)return this[p]=n,!0;const s=Reflect.set(t,e,n);return"length"===e&&this[o].length===n||S(this,r),this[o]=n,s}})):(this[o]=t?t(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}}Symbol("hasProxy");const k=Symbol("meta");var A=n(359);var C=function(t,e,n,r,o,s){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!e&&t?r.static?t:t.prototype:null,u=e||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var y in r)f[y]="access"===y?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(t||null))};var m=(0,n[d])("accessor"===l?{get:u.get,set:u.set}:u[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(u.get=a),(a=i(m.set))&&(u.set=a),(a=i(m.init))&&o.unshift(a)}else(a=i(m))&&("field"===l?o.unshift(a):u[c]=a)}p&&Object.defineProperty(p,r.name,u),h=!0},P=function(t,e,n){for(var r=arguments.length>2,o=0;o<e.length;o++)n=r?e[o].call(t,n):e[o].call(t);return r?n:void 0};(()=>{let t,e,n,r,o,s=[g({selector:"pg-input-check-list",style:A.A,template:'<ul part="list"></ul>'})],i=[],a=HTMLElement,l=[],c=[],p=[],u=[],h=[],d=[];(class extends a{static{e=this}static{const f="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;n=[x()],r=[x()],o=[function(t,e){const n=e.name,r=n.replace(/^\$/,"");e.addInitializer((function(){let t=null;Reflect.defineProperty(this,n,{get(){return t??(t=this.shadowRoot?.querySelector(`[part~=${r}]`))}})}))}],C(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:t=>"value"in t,get:t=>t.value,set:(t,e)=>{t.value=e}},metadata:f},l,c),C(null,null,r,{kind:"field",name:"options",static:!1,private:!1,access:{has:t=>"options"in t,get:t=>t.options,set:(t,e)=>{t.options=e}},metadata:f},p,u),C(null,null,o,{kind:"field",name:"$list",static:!1,private:!1,access:{has:t=>"$list"in t,get:t=>t.$list,set:(t,e)=>{t.$list=e}},metadata:f},h,d),C(null,t={value:e},s,{kind:"class",name:e.name,metadata:f},null,i),e=t.value,f&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f}),P(e,i)}value=P(this,l,[]);options=(P(this,c),P(this,p,[]));$list=(P(this,u),P(this,h,void 0));connectedCallback(){}handleClick(t){const e=this.value.includes(t.value),n=function(t,e,n){return Array.from(t.children).find((t=>t.dataset.key===e[n]))}(this.$list,t,"value"),r=n.querySelector("button");r?.classList.toggle("blank",e),r?.classList.toggle("checked",!e),n.querySelector('[part="path"]')?.setAttribute("d",e?"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z":"M19 19L5 19V5H15V3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.89 21 5 21H19C20.1 21 21 20.1 21 19V11H19"),e?this.value.splice(this.value.findIndex((e=>e===t.value)),1):this.value.push(t.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))}render(t){t.options,t.value}constructor(){super(...arguments),P(this,d)}})})()})();
|
package/pgInputFileLocal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",o=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),o&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),o&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,o,n,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(o)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var p=[].concat(e[c]);o&&a[p[0]]||(void 0!==i&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=i),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),n&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=n):p[4]="".concat(n)),t.push(p))}},t}},601:e=>{e.exports=function(e){return e[1]}},945:(e,t,r)=>{r.d(t,{A:()=>l});var o=r(601),n=r.n(o),i=r(314),a=r.n(i)()(n());a.push([e.id,':host {\n display: block;\n}\n\n[part="label"] {\n display: grid;\n grid-template-columns: 1.5rem auto;\n grid-template-rows: auto;\n font-family: var(--pg-font-family);\n font-size: 1rem;\n line-height: 1.5rem;\n border: 1px solid var(--pg-button-border-color, #453C4F);\n background-color: var(--pg-button-background-color, #fff);\n color: var(--pg-button-color, #453C4F);\n padding: var(--pg-button-padding, 0.25rem 0.5rem);\n border-radius: 0.25rem;\n outline: none;\n --pg-icon-color: var(--pg-button-color, #453C4F);\n}\n\n[part="label"]:hover {\n border: 1px solid var(--pg-button-hover-border-color, #453C4F);\n background-color: var(--pg-button-hover-background-color, #453C4F);\n color: var(--pg-button-hover-color, #fff);\n --pg-icon-color: var(--pg-button-hover-color, #fff);\n}\n\n[part="label"]:active {\n box-shadow: 0 1px 0.25rem rgba(0, 0, 0, 0.5) inset;\n position: relative;\n}\n\n[part="label"]:focus {\n position: relative;\n}\n\n[part="label"]:active::before {\n content: \'\';\n position: absolute;\n top: -1px;\n right: -1px;\n bottom: -1px;\n left: -1px;\n border-radius: 0.25rem;\n box-shadow: 0 0 0 3px var(--pg-focus-color, rgb(79, 143, 249, 0.6));\n}\n\n[part="label"]:focus::before {\n pointer-events: none;\n content: \'\';\n position: absolute;\n top: -1px;\n right: -1px;\n bottom: -1px;\n left: -1px;\n border-radius: 0.25rem;\n box-shadow: 0 0 0 3px var(--pg-focus-color, rgb(79, 143, 249, 0.5));\n}\n\n[part="file"] {\n width: 100%;\n border: 0;\n outline: 0;\n height: 1.5rem;\n grid-row: 1;\n grid-column: 1 / span 2;\n visibility: hidden;\n}\n\n[part="icon"] {\n grid-row: 1;\n grid-column: 1;\n transform: translate(-0.25rem, 0.075rem);\n pointer-events: none;\n}\n\n[part="text"] {\n grid-row: 1;\n grid-column: 2;\n pointer-events: none;\n}',""]);var s=new CSSStyleSheet;s.replaceSync(a.toString());const l=s}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=Symbol("addObserver"),n=Symbol("removeObserver"),i=Symbol("getObservers"),a=Symbol("swapObserver"),s=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function u(e){return new Proxy(e,{get(t,r){if("symbol"==typeof r){switch(r){case s:return!0;case l:return t;case i:return p.has(e);case a:return(t,r)=>{const o=p.get(e);o.forEach(((n,i)=>{if(i.getRootNode().host===t){const t=o.get(i);p.has(r)?p.get(r).has(i)?p.get(r).get(i).push(o.get(i)):p.get(r).set(i,o.get(i)):p.set(r,new Map([[i,t]])),p.delete(e),t.forEach((e=>{e(null,d.swap,[r])}))}}))};case o:return(t,r)=>{p.has(e)?p.get(e).has(t)?p.get(e).get(t).push(r):p.get(e).set(t,[r]):p.set(e,new Map([[t,[r]]]))};case n:return t=>{p.has(e)&&(p.get(e).delete(t),0===p.get(e).size&&p.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,r)}throw new Error("Unsupported symbol")}if(r in t){if(!Number.isNaN(Number(r)))return"object"==typeof t[r]?u(t[r]):t[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return p.has(t)?function(){const e=Array.prototype[r].apply(t,arguments);return p.get(t).forEach(((e,o)=>{e.forEach((e=>{e(t,r,arguments)}))})),e}:Reflect.get(t,r);if(t[r]instanceof Array)return u(t[r])}return Reflect.get(t,r)},set(e,t,r){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,r);if(p.has(e)){p.get(e).forEach(((e,o)=>{e.forEach((e=>{e(t,r)}))}))}return Reflect.set(e,t,r)}})}window.observers=p;const d={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const h=Symbol("init"),f=Symbol("template"),m=Symbol("style"),y=Symbol("parent");function g(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function b(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function v(e={}){return function(t,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var o,n;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[y]||t.prototype[y][t.prototype[y].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[y]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[f]=e.template||""):(t.prototype[y].push(t.prototype),t.prototype[m].push(e.style),t.prototype[f]=(o=t.prototype[f],(n=e.template||null)&&n.match(/<parent\/>/)?n.replace(/<parent\/>/,o):`${o}${n||""}`));const i=t.prototype.connectedCallback||(()=>{}),a=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[h]||void 0!==e.template||void 0!==e.style)if(this[h]){if(this[h]&&e.style);else if(this[h]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[f]||"";const r=document.importNode(e.content,!0),o=this.attachShadow({mode:"open"});o.adoptedStyleSheets=t.prototype[m].map((e=>{if(e instanceof CSSStyleSheet)return e;var t=new CSSStyleSheet;return t.replaceSync(e.toString()),t})),o.appendChild(r)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&r.add(e.localName);const o=Array.from(r.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),n=()=>{this[y].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[b(t)]=!0,e)),{}):{})}))};0===o.length?(this[h]=!0,i.call(this),n()):Promise.all(o).then((()=>{this[h]=!0,i.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));n()}))},t.prototype.disconnectedCallback=function(){a.call(this)},t.prototype.attributeChangedCallback=function(e,t,r){this[b(e)]=r},r.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${r.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function S(e,t){e[h]&&e[y].map((r=>{r.render&&r.render.call(e,{[t]:!0})}))}function E(e){return null===e?"null":w(e)?"array":typeof e}Symbol("hasProxy");const x=Symbol("meta");var $=r(945),C=function(e,t,r,o,n,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=o.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?o.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),d=!1,h=r.length-1;h>=0;h--){var f={};for(var m in o)f[m]="access"===m?{}:o[m];for(var m in o.access)f.access[m]=o.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,r[h])("accessor"===l?{get:u.get,set:u.set}:u[c],f);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(u.get=s),(s=a(y.set))&&(u.set=s),(s=a(y.init))&&n.unshift(s)}else(s=a(y))&&("field"===l?n.unshift(s):u[c]=s)}p&&Object.defineProperty(p,o.name,u),d=!0},P=function(e,t,r){for(var o=arguments.length>2,n=0;n<t.length;n++)r=o?t[n].call(e,r):t[n].call(e);return o?r:void 0};(()=>{let e,t,r,o,n=[v({selector:"pg-input-file-local",style:$.A,template:'<label part="label"> <input type="file" part="file"/> <svg part="icon" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z"/></svg> <span part="text">Upload a File...</span> </label>'})],c=[],p=HTMLElement,d=[],h=[],f=[],m=[];(class extends p{static{t=this}static{const y="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;var b;r=[function(e,t){const r=t.name,o=Symbol(r),n=Symbol(`${r}:type`),c=Symbol(`${r}:meta`);return t.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[n]||"array"===this[n]?this[o][s]?this[o]:u(this[o]):this[o],set:e=>{const t=E(b?b(e):e);if("index"!==r&&this[n]!==t&&"null"!==this[n]&&"null"!==t)throw new Error(`@Prop() ${r} with type '${this[n]}' cannot be set to ${t}.`);if("array"===this[n]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=u(this[o]);if(t[i]){const n=e[s]?e[l]:e;t[a](this,n),this[o]=e,console.log(">>> trigger render???",this,r)}else this[o]=e}else this[o]=b?b(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!t.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,n=g(r);t[r]||(e.observedAttributes.push(n),t[r]=o)}return this[n]=E(e),"array"===this[n]?(this[o]=e,new Proxy(e,{get:(e,t)=>t===x?this[c]:(console.log("errr???"),Reflect.get(this[o],t)),set:(e,t,n)=>{if(t===x)return this[c]=n,!0;const i=Reflect.set(e,t,n);return"length"===t&&this[o].length===n||S(this,r),this[o]=n,i}})):(this[o]=b?b(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}],o=[function(e,t){const r=t.name,o=r.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,r,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${o}]`))}})}))}],C(null,null,r,{kind:"field",name:"acceptsFileType",static:!1,private:!1,access:{has:e=>"acceptsFileType"in e,get:e=>e.acceptsFileType,set:(e,t)=>{e.acceptsFileType=t}},metadata:y},d,h),C(null,null,o,{kind:"field",name:"$file",static:!1,private:!1,access:{has:e=>"$file"in e,get:e=>e.$file,set:(e,t)=>{e.$file=t}},metadata:y},f,m),C(null,e={value:t},n,{kind:"class",name:t.name,metadata:y},null,c),t=e.value,y&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:y}),P(t,c)}acceptsFileType=P(this,d,"");$file=(P(this,h),P(this,f,void 0));connectedCallback(){this.$file.addEventListener("change",(()=>{if(null!==this.$file.files&&0!==this.$file.files.length){var e=this.$file.files[0];if(this.acceptsFileType){var t=this.acceptsFileType.split(",").join("|"),r=new RegExp(`(${t})$`,"i");if(null===e.name.match(r))return void alert(`${this.acceptsFileType} file only`)}var o=new FileReader;o.addEventListener("loadstart",(function(){})),o.addEventListener("load",(t=>{var r=t.target.result;this.dispatchEvent(new CustomEvent("change",{detail:{value:r,name:e.name}}))})),o.addEventListener("error",(function(){alert("Error : Failed to read file")})),o.addEventListener("progress",(function(e){if(1==e.lengthComputable)Math.floor(e.loaded/e.total*100)})),o.readAsText(e)}else alert("Error : No file selected")}))}render(e){}constructor(){super(...arguments),P(this,m)}})})()})();
|
|
1
|
+
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",o=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),o&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),o&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,o,n,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(o)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var p=[].concat(e[c]);o&&a[p[0]]||(void 0!==i&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=i),r&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=r):p[2]=r),n&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=n):p[4]="".concat(n)),t.push(p))}},t}},601:e=>{e.exports=function(e){return e[1]}},945:(e,t,r)=>{r.d(t,{A:()=>l});var o=r(601),n=r.n(o),i=r(314),a=r.n(i)()(n());a.push([e.id,':host {\n display: block;\n}\n\n[part="label"] {\n display: grid;\n grid-template-columns: 1.5rem auto;\n grid-template-rows: auto;\n font-family: var(--pg-font-family);\n font-size: 1rem;\n line-height: 1.5rem;\n border: 1px solid var(--pg-button-border-color, #453C4F);\n background-color: var(--pg-button-background-color, #fff);\n color: var(--pg-button-color, #453C4F);\n padding: var(--pg-button-padding, 0.25rem 0.5rem);\n border-radius: 0.25rem;\n outline: none;\n --pg-icon-color: var(--pg-button-color, #453C4F);\n}\n\n[part="label"]:hover {\n border: 1px solid var(--pg-button-hover-border-color, #453C4F);\n background-color: var(--pg-button-hover-background-color, #453C4F);\n color: var(--pg-button-hover-color, #fff);\n --pg-icon-color: var(--pg-button-hover-color, #fff);\n}\n\n[part="label"]:active {\n box-shadow: 0 1px 0.25rem rgba(0, 0, 0, 0.5) inset;\n position: relative;\n}\n\n[part="label"]:focus {\n position: relative;\n}\n\n[part="label"]:active::before {\n content: \'\';\n position: absolute;\n top: -1px;\n right: -1px;\n bottom: -1px;\n left: -1px;\n border-radius: 0.25rem;\n box-shadow: 0 0 0 3px var(--pg-focus-color, rgb(79, 143, 249, 0.6));\n}\n\n[part="label"]:focus::before {\n pointer-events: none;\n content: \'\';\n position: absolute;\n top: -1px;\n right: -1px;\n bottom: -1px;\n left: -1px;\n border-radius: 0.25rem;\n box-shadow: 0 0 0 3px var(--pg-focus-color, rgb(79, 143, 249, 0.5));\n}\n\n[part="file"] {\n width: 100%;\n border: 0;\n outline: 0;\n height: 1.5rem;\n grid-row: 1;\n grid-column: 1 / span 2;\n visibility: hidden;\n}\n\n[part="icon"] {\n grid-row: 1;\n grid-column: 1;\n transform: translate(-0.25rem, 0.075rem);\n pointer-events: none;\n}\n\n[part="text"] {\n grid-row: 1;\n grid-column: 2;\n pointer-events: none;\n}',""]);var s=new CSSStyleSheet;s.replaceSync(a.toString());const l=s}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=Symbol("addObserver"),n=Symbol("removeObserver"),i=Symbol("getObservers"),a=Symbol("swapObserver"),s=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],p=new Map;function u(e){return new Proxy(e,{get(t,r){if("symbol"==typeof r){switch(r){case s:return!0;case l:return t;case i:return t=>{const r=p.get(e);return r?.has(t)};case a:return(t,r)=>{const o=p.get(e);if(o){const e=o.get(t);e&&e.forEach(((o,n)=>{if(!o)throw new Error("Unreachable");{const e=p.get(r);if(e){const r=e.get(t);r?r.set(n,o):e.set(t,new Map([[n,o]]))}else p.set(r,new Map([[t,new Map([[n,o]])]]))}e.delete(n),o.forEach((e=>{e(null,d.swap,[r])}))}))}};case o:return(t,r)=>{const o=t.getRootNode().host,n=p.get(e);if(n){const e=n.get(o);if(e){const o=e.get(t);o?o.push(r):e.set(t,[r])}else n.set(o,new Map([[t,[r]]]))}else p.set(e,new Map([[o,new Map([[t,[r]]])]]))};case n:return t=>{const r=t.getRootNode().host,o=p.get(e);o&&(o.delete(r),0===o.size&&p.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,r)}throw new Error("Unsupported symbol")}if(r in t){if(!Number.isNaN(Number(r)))return"object"==typeof t[r]?u(t[r]):t[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return p.has(t)?function(){const e=Array.prototype[r].apply(t,arguments),o=p.get(t);return o?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,r,arguments)}))}))})),e}:Reflect.get(t,r);if(t[r]instanceof Array)return u(t[r])}return Reflect.get(t,r)},set(e,t,r){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,r);if(p.has(e)){const o=p.get(e);o?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,r)}))}))}))}return Reflect.set(e,t,r)}})}window.observers=p;const d={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const f=Symbol("init"),h=Symbol("template"),m=Symbol("style"),y=Symbol("parent");function b(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function g(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function v(e={}){return function(t,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var o,n;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[y]||t.prototype[y][t.prototype[y].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[y]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[h]=e.template||""):(t.prototype[y].push(t.prototype),t.prototype[m].push(e.style),t.prototype[h]=(o=t.prototype[h],(n=e.template||null)&&n.match(/<parent\/>/)?n.replace(/<parent\/>/,o):o.match(/<child\/>/)?o.replace(/<child\/>/,n||""):`${o}${n||""}`));const i=t.prototype.connectedCallback||(()=>{}),a=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[f]||void 0!==e.template||void 0!==e.style)if(this[f]){if(this[f]&&e.style);else if(this[f]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[h]||"";const r=document.importNode(e.content,!0),o=this.attachShadow({mode:"open"});o.adoptedStyleSheets=t.prototype[m].reduce(((e,t)=>{if(!t)return e;if(t instanceof CSSStyleSheet)return e.push(t),e;var r=new CSSStyleSheet;return r.replaceSync(t.toString()),e.push(r),e}),[]),o.appendChild(r)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&r.add(e.localName);const o=Array.from(r.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),n=()=>{this[y].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[g(t)]=!0,e)),{}):{})}))};0===o.length?(this[f]=!0,i.call(this),n()):Promise.all(o).then((()=>{this[f]=!0,i.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));n()}))},t.prototype.disconnectedCallback=function(){a.call(this)},t.prototype.attributeChangedCallback=function(e,t,r){this[g(e)]=r},r.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${r.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function S(e,t){e[f]&&e[y].map((r=>{r.render&&r.render.call(e,{[t]:!0})}))}function E(e){return null===e?"null":w(e)?"array":typeof e}Symbol("hasProxy");const x=Symbol("meta");var $=r(945),C=function(e,t,r,o,n,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=o.kind,c="getter"===l?"get":"setter"===l?"set":"value",p=!t&&e?o.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),d=!1,f=r.length-1;f>=0;f--){var h={};for(var m in o)h[m]="access"===m?{}:o[m];for(var m in o.access)h.access[m]=o.access[m];h.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,r[f])("accessor"===l?{get:u.get,set:u.set}:u[c],h);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(u.get=s),(s=a(y.set))&&(u.set=s),(s=a(y.init))&&n.unshift(s)}else(s=a(y))&&("field"===l?n.unshift(s):u[c]=s)}p&&Object.defineProperty(p,o.name,u),d=!0},P=function(e,t,r){for(var o=arguments.length>2,n=0;n<t.length;n++)r=o?t[n].call(e,r):t[n].call(e);return o?r:void 0};(()=>{let e,t,r,o,n=[v({selector:"pg-input-file-local",style:$.A,template:'<label part="label"> <input type="file" part="file"/> <svg part="icon" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z"/></svg> <span part="text">Upload a File...</span> </label>'})],c=[],p=HTMLElement,d=[],f=[],h=[],m=[];(class extends p{static{t=this}static{const y="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;var g;r=[function(e,t){const r=t.name,o=Symbol(r),n=Symbol(`${r}:type`),c=Symbol(`${r}:meta`);return t.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[n]||"array"===this[n]?this[o][s]?this[o]:u(this[o]):this[o],set:e=>{const t=E(g?g(e):e);if("index"!==r&&this[n]!==t&&"null"!==this[n]&&"null"!==t)throw new Error(`@Prop() ${r} with type '${this[n]}' cannot be set to ${t}.`);if("array"===this[n]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[o]===e)throw new Error("Setting an array to itself is not allowed.");const t=u(this[o]);if(t[i](this)){const r=e[s]?e[l]:e;t[a](this,r),this[o]=e}else this[o]=e}else this[o]=g?g(e):e,S(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!t.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,n=b(r);t[r]||(e.observedAttributes.push(n),t[r]=o)}return this[n]=E(e),"array"===this[n]?(this[o]=e,new Proxy(e,{get:(e,t)=>t===x?this[c]:(console.log("errr???"),Reflect.get(this[o],t)),set:(e,t,n)=>{if(t===x)return this[c]=n,!0;const i=Reflect.set(e,t,n);return"length"===t&&this[o].length===n||S(this,r),this[o]=n,i}})):(this[o]=g?g(this.getAttribute(r)??e):this.getAttribute(r)??e,this[o])}}],o=[function(e,t){const r=t.name,o=r.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,r,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${o}]`))}})}))}],C(null,null,r,{kind:"field",name:"acceptsFileType",static:!1,private:!1,access:{has:e=>"acceptsFileType"in e,get:e=>e.acceptsFileType,set:(e,t)=>{e.acceptsFileType=t}},metadata:y},d,f),C(null,null,o,{kind:"field",name:"$file",static:!1,private:!1,access:{has:e=>"$file"in e,get:e=>e.$file,set:(e,t)=>{e.$file=t}},metadata:y},h,m),C(null,e={value:t},n,{kind:"class",name:t.name,metadata:y},null,c),t=e.value,y&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:y}),P(t,c)}acceptsFileType=P(this,d,"");$file=(P(this,f),P(this,h,void 0));connectedCallback(){this.$file.addEventListener("change",(()=>{if(null!==this.$file.files&&0!==this.$file.files.length){var e=this.$file.files[0];if(this.acceptsFileType){var t=this.acceptsFileType.split(",").join("|"),r=new RegExp(`(${t})$`,"i");if(null===e.name.match(r))return void alert(`${this.acceptsFileType} file only`)}var o=new FileReader;o.addEventListener("loadstart",(function(){})),o.addEventListener("load",(t=>{var r=t.target.result;this.dispatchEvent(new CustomEvent("change",{detail:{value:r,name:e.name}}))})),o.addEventListener("error",(function(){alert("Error : Failed to read file")})),o.addEventListener("progress",(function(e){if(1==e.lengthComputable)Math.floor(e.loaded/e.total*100)})),o.readAsText(e)}else alert("Error : No file selected")}))}render(e){}constructor(){super(...arguments),P(this,m)}})})()})();
|
package/pgInputHexRgb.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&a[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),r&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=r):u[2]=r),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},457:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(601),o=r.n(n),i=r(314),a=r.n(i)()(o());a.push([e.id,':host {\n display: block;\n}\n\n:host > div {\n display: grid;\n grid-template-rows: auto 1rem 2rem 1rem 2rem 1rem 2rem;\n grid-template-rows: 1fr;\n}\n\n[part~="hex"] {\n grid-row: 1;\n grid-column: 1;\n}\n\n[part~="labelRed"] {\n grid-row: 1;\n grid-column: 2;\n background: red;\n}\n\n[part~="red"] {\n grid-row: 1;\n grid-column: 3;\n}\n\n[part~="labelGreen"] {\n grid-row: 1;\n grid-column: 4;\n background: green;\n color: white;\n}\n\n[part~="green"] {\n grid-row: 1;\n grid-column: 5;\n}\n\n[part~="labelBlue"] {\n grid-row: 1;\n grid-column: 6;\n background: blue;\n color: white;\n}\n\n[part~="blue"] {\n grid-row: 1;\n grid-column: 7;\n}\n\n[part~="labelRed"],\n[part~="labelGreen"],\n[part~="labelBlue"] {\n display: flex;\n margin-left: 0.25rem;\n align-items: center;\n justify-content: center;\n border-radius: 0.25rem 0 0 0.25rem;\n color: white;\n min-width: 1rem;\n}\n\n[part~="hex"] {\n border-radius: 0.25rem;\n min-width: 4rem;\n}\n\n[part~="hex"],\n[part~="red"],\n[part~="green"],\n[part~="blue"] {\n outline: none;\n font-size: 1rem;\n padding: 0.25rem 0.5rem;\n border: 0;\n width: calc(100% - 1rem);\n}\n\n[part~="red"],\n[part~="green"],\n[part~="blue"] {\n border-radius: 0 0.25rem 0.25rem 0;\n -moz-appearance: textfield;\n width: calc(100% - 1rem);\n min-width: 2rem;\n}\n\n[part~="red"]::-webkit-inner-spin-button,\n[part~="red"]::-webkit-outer-spin-button,\n[part~="green"]::-webkit-inner-spin-button,\n[part~="green"]::-webkit-outer-spin-button,\n[part~="blue"]::-webkit-inner-spin-button,\n[part~="blue"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}',""]);var s=new CSSStyleSheet;s.replaceSync(a.toString());const l=s},601:e=>{e.exports=function(e){return e[1]}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=Symbol("addObserver"),o=Symbol("removeObserver"),i=Symbol("getObservers"),a=Symbol("swapObserver"),s=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],u=new Map;function p(e){return new Proxy(e,{get(t,r){if("symbol"==typeof r){switch(r){case s:return!0;case l:return t;case i:return u.has(e);case a:return(t,r)=>{const n=u.get(e);n.forEach(((o,i)=>{if(i.getRootNode().host===t){const t=n.get(i);u.has(r)?u.get(r).has(i)?u.get(r).get(i).push(n.get(i)):u.get(r).set(i,n.get(i)):u.set(r,new Map([[i,t]])),u.delete(e),t.forEach((e=>{e(null,h.swap,[r])}))}}))};case n:return(t,r)=>{u.has(e)?u.get(e).has(t)?u.get(e).get(t).push(r):u.get(e).set(t,[r]):u.set(e,new Map([[t,[r]]]))};case o:return t=>{u.has(e)&&(u.get(e).delete(t),0===u.get(e).size&&u.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,r)}throw new Error("Unsupported symbol")}if(r in t){if(!Number.isNaN(Number(r)))return"object"==typeof t[r]?p(t[r]):t[r];if("copyWithin"===r)throw new Error("Unsupported array method copyWithin");if(c.includes(r))return u.has(t)?function(){const e=Array.prototype[r].apply(t,arguments);return u.get(t).forEach(((e,n)=>{e.forEach((e=>{e(t,r,arguments)}))})),e}:Reflect.get(t,r);if(t[r]instanceof Array)return p(t[r])}return Reflect.get(t,r)},set(e,t,r){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,r);if(u.has(e)){u.get(e).forEach(((e,n)=>{e.forEach((e=>{e(t,r)}))}))}return Reflect.set(e,t,r)}})}window.observers=u;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),m=Symbol("style"),b=Symbol("parent");function g(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function y(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function v(e={}){return function(t,r){if("class"!==r.kind)throw new Error("@Component() can only decorate a class");var n,o;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[b]||t.prototype[b][t.prototype[b].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[b]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[f]=e.template||""):(t.prototype[b].push(t.prototype),t.prototype[m].push(e.style),t.prototype[f]=(n=t.prototype[f],(o=e.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,n):`${n}${o||""}`));const i=t.prototype.connectedCallback||(()=>{}),a=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[d]||void 0!==e.template||void 0!==e.style)if(this[d]){if(this[d]&&e.style);else if(this[d]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[f]||"";const r=document.importNode(e.content,!0),n=this.attachShadow({mode:"open"});n.adoptedStyleSheets=t.prototype[m].map((e=>{if(e instanceof CSSStyleSheet)return e;var t=new CSSStyleSheet;return t.replaceSync(e.toString()),t})),n.appendChild(r)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const r=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&r.add(e.localName);const n=Array.from(r.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),o=()=>{this[b].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[y(t)]=!0,e)),{}):{})}))};0===n.length?(this[d]=!0,i.call(this),o()):Promise.all(n).then((()=>{this[d]=!0,i.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));o()}))},t.prototype.disconnectedCallback=function(){a.call(this)},t.prototype.attributeChangedCallback=function(e,t,r){this[y(e)]=r},r.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${r.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function $(e,t){e[d]&&e[b].map((r=>{r.render&&r.render.call(e,{[t]:!0})}))}function S(e){return null===e?"null":w(e)?"array":typeof e}function x(){return function(e,t){const r=t.name,n=r.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,r,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${n}]`))}})}))}}Symbol("hasProxy");const E=Symbol("meta");function k(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function P(e){const t=e.toUpperCase();return 7===t.length?t:4===t.length?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:"#000000"}function R(e){var t=e.toString(16);return 1==t.length?"0"+t:t}function A(e,t,r){return"#"+R(e)+R(t)+R(r)}var C=r(457),O=function(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),h=!1,d=r.length-1;d>=0;d--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var b=(0,r[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(s=a(b.get))&&(p.get=s),(s=a(b.set))&&(p.set=s),(s=a(b.init))&&o.unshift(s)}else(s=a(b))&&("field"===l?o.unshift(s):p[c]=s)}u&&Object.defineProperty(u,n.name,p),h=!0},j=function(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0};(()=>{let e,t,r,n,o,c,u,h=[v({selector:"pg-input-hex-rgb",style:C.A,template:'<div> <input part="hex" type="text"/> <label part="labelRed">R</label> <input part="red" type="number" step="1" min="0" max="255"/> <label part="labelGreen">G</label> <input part="green" type="number" step="1" min="0" max="255"/> <label part="labelBlue">B</label> <input part="blue" type="number" step="1" min="0" max="255"/> </div>'})],d=[],f=HTMLElement,m=[],b=[],y=[],R=[],I=[],z=[],T=[],D=[],L=[],N=[];(class extends f{static{t=this}static{const v="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;var k;r=[function(e,t){const r=t.name,n=Symbol(r),o=Symbol(`${r}:type`),c=Symbol(`${r}:meta`);return t.addInitializer((function(){Reflect.defineProperty(this,r,{get:()=>"object"===this[o]||"array"===this[o]?this[n][s]?this[n]:p(this[n]):this[n],set:e=>{const t=S(k?k(e):e);if("index"!==r&&this[o]!==t&&"null"!==this[o]&&"null"!==t)throw new Error(`@Prop() ${r} with type '${this[o]}' cannot be set to ${t}.`);if("array"===this[o]){if(!w(e))throw new PropError(`Array "${r}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,r)?.set);if(this[n]===e)throw new Error("Setting an array to itself is not allowed.");const t=p(this[n]);if(t[i]){const o=e[s]?e[l]:e;t[a](this,o),this[n]=e,console.log(">>> trigger render???",this,r)}else this[n]=e}else this[n]=k?k(e):e,$(this,r)}})})),function(e){if(void 0===e&&"index"!==r)throw new Error(`@Prop() ${r} must have an initial value defined.`);if(void 0!==e&&"index"===r)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${r} boolean must initialize to false.`);if(!t.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,o=g(r);t[r]||(e.observedAttributes.push(o),t[r]=n)}return this[o]=S(e),"array"===this[o]?(this[n]=e,new Proxy(e,{get:(e,t)=>t===E?this[c]:(console.log("errr???"),Reflect.get(this[n],t)),set:(e,t,o)=>{if(t===E)return this[c]=o,!0;const i=Reflect.set(e,t,o);return"length"===t&&this[n].length===o||$(this,r),this[n]=o,i}})):(this[n]=k?k(this.getAttribute(r)??e):this.getAttribute(r)??e,this[n])}}],n=[x()],o=[x()],c=[x()],u=[x()],O(null,null,r,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:v},m,b),O(null,null,n,{kind:"field",name:"$hex",static:!1,private:!1,access:{has:e=>"$hex"in e,get:e=>e.$hex,set:(e,t)=>{e.$hex=t}},metadata:v},y,R),O(null,null,o,{kind:"field",name:"$red",static:!1,private:!1,access:{has:e=>"$red"in e,get:e=>e.$red,set:(e,t)=>{e.$red=t}},metadata:v},I,z),O(null,null,c,{kind:"field",name:"$green",static:!1,private:!1,access:{has:e=>"$green"in e,get:e=>e.$green,set:(e,t)=>{e.$green=t}},metadata:v},T,D),O(null,null,u,{kind:"field",name:"$blue",static:!1,private:!1,access:{has:e=>"$blue"in e,get:e=>e.$blue,set:(e,t)=>{e.$blue=t}},metadata:v},L,N),O(null,e={value:t},h,{kind:"class",name:t.name,metadata:v},null,d),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v}),j(t,d)}value=j(this,m,"#000000");$hex=(j(this,b),j(this,y,void 0));$red=(j(this,R),j(this,I,void 0));$green=(j(this,z),j(this,T,void 0));$blue=(j(this,D),j(this,L,void 0));connectedCallback(){this.$hex.value=this.value,this.updateRgb(),this.$hex.addEventListener("input",this.updateRgbDispatch.bind(this)),this.$red.addEventListener("input",this.updateHexDispatch.bind(this)),this.$green.addEventListener("input",this.updateHexDispatch.bind(this)),this.$blue.addEventListener("input",this.updateHexDispatch.bind(this))}updateRgb(){const e=k(P(this.$hex.value));null!==e&&(this.$red.value=e.r.toString(),this.$green.value=e.g.toString(),this.$blue.value=e.b.toString())}updateRgbDispatch(){this.updateRgb(),this.dispatchSelect()}updateHexDispatch(){this.$hex.value=A(parseInt(this.$red.value||"0",10),parseInt(this.$green.value||"0",10),parseInt(this.$blue.value||"0",10)),this.dispatchSelect()}dispatchSelect(){const e=P(this.$hex.value),t=A(parseInt(this.$red.value||"0",10),parseInt(this.$green.value||"0"),parseInt(this.$blue.value||"0"));this.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{hex:e,rgb:t}}))}render(){const e=P(this.value),t=k(e);this.$hex.value=e,this.$red.value=`${t?t.r:0}`,this.$green.value=`${t?t.g:0}`,this.$blue.value=`${t?t.b:0}`}constructor(){super(...arguments),j(this,N)}})})()})();
|
|
1
|
+
(()=>{"use strict";var e={314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);r&&a[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},457:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([e.id,':host {\n display: block;\n}\n\n:host > div {\n display: grid;\n grid-template-rows: auto 1rem 2rem 1rem 2rem 1rem 2rem;\n grid-template-rows: 1fr;\n}\n\n[part~="hex"] {\n grid-row: 1;\n grid-column: 1;\n}\n\n[part~="labelRed"] {\n grid-row: 1;\n grid-column: 2;\n background: red;\n}\n\n[part~="red"] {\n grid-row: 1;\n grid-column: 3;\n}\n\n[part~="labelGreen"] {\n grid-row: 1;\n grid-column: 4;\n background: green;\n color: white;\n}\n\n[part~="green"] {\n grid-row: 1;\n grid-column: 5;\n}\n\n[part~="labelBlue"] {\n grid-row: 1;\n grid-column: 6;\n background: blue;\n color: white;\n}\n\n[part~="blue"] {\n grid-row: 1;\n grid-column: 7;\n}\n\n[part~="labelRed"],\n[part~="labelGreen"],\n[part~="labelBlue"] {\n display: flex;\n margin-left: 0.25rem;\n align-items: center;\n justify-content: center;\n border-radius: 0.25rem 0 0 0.25rem;\n color: white;\n min-width: 1rem;\n}\n\n[part~="hex"] {\n border-radius: 0.25rem;\n min-width: 4rem;\n}\n\n[part~="hex"],\n[part~="red"],\n[part~="green"],\n[part~="blue"] {\n outline: none;\n font-size: 1rem;\n padding: 0.25rem 0.5rem;\n border: 0;\n width: calc(100% - 1rem);\n}\n\n[part~="red"],\n[part~="green"],\n[part~="blue"] {\n border-radius: 0 0.25rem 0.25rem 0;\n -moz-appearance: textfield;\n width: calc(100% - 1rem);\n min-width: 2rem;\n}\n\n[part~="red"]::-webkit-inner-spin-button,\n[part~="red"]::-webkit-outer-spin-button,\n[part~="green"]::-webkit-inner-spin-button,\n[part~="green"]::-webkit-outer-spin-button,\n[part~="blue"]::-webkit-inner-spin-button,\n[part~="blue"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}',""]);var s=new CSSStyleSheet;s.replaceSync(a.toString());const l=s},601:e=>{e.exports=function(e){return e[1]}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const r=Symbol("addObserver"),o=Symbol("removeObserver"),i=Symbol("getObservers"),a=Symbol("swapObserver"),s=Symbol("isProxy"),l=Symbol("getTarget"),c=["fill","pop","push","reverse","shift","sort","splice","unshift"],u=new Map;function p(e){return new Proxy(e,{get(t,n){if("symbol"==typeof n){switch(n){case s:return!0;case l:return t;case i:return t=>{const n=u.get(e);return n?.has(t)};case a:return(t,n)=>{const r=u.get(e);if(r){const e=r.get(t);e&&e.forEach(((r,o)=>{if(!r)throw new Error("Unreachable");{const e=u.get(n);if(e){const n=e.get(t);n?n.set(o,r):e.set(t,new Map([[o,r]]))}else u.set(n,new Map([[t,new Map([[o,r]])]]))}e.delete(o),r.forEach((e=>{e(null,h.swap,[n])}))}))}};case r:return(t,n)=>{const r=t.getRootNode().host,o=u.get(e);if(o){const e=o.get(r);if(e){const r=e.get(t);r?r.push(n):e.set(t,[n])}else o.set(r,new Map([[t,[n]]]))}else u.set(e,new Map([[r,new Map([[t,[n]]])]]))};case o:return t=>{const n=t.getRootNode().host,r=u.get(e);r&&(r.delete(n),0===r.size&&u.delete(e))};case Symbol.toPrimitive:case Symbol.toStringTag:return Reflect.get(t,n)}throw new Error("Unsupported symbol")}if(n in t){if(!Number.isNaN(Number(n)))return"object"==typeof t[n]?p(t[n]):t[n];if("copyWithin"===n)throw new Error("Unsupported array method copyWithin");if(c.includes(n))return u.has(t)?function(){const e=Array.prototype[n].apply(t,arguments),r=u.get(t);return r?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,n,arguments)}))}))})),e}:Reflect.get(t,n);if(t[n]instanceof Array)return p(t[n])}return Reflect.get(t,n)},set(e,t,n){if("symbol"==typeof t)throw new Error("Setting symbols not allowed.");if(Array.isArray(e))return Reflect.set(e,t,n);if(u.has(e)){const r=u.get(e);r?.forEach((e=>{e.forEach((e=>{e.forEach((e=>{e(t,n)}))}))}))}return Reflect.set(e,t,n)}})}window.observers=u;const h={fill:"fill",pop:"pop",push:"push",reverse:"reverse",shift:"shift",sort:"sort",splice:"splice",unshift:"unshift",swap:"swap"};class PropError extends Error{constructor(e,t){super(e),this.name="PropError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}}Symbol("index");const d=Symbol("init"),f=Symbol("template"),m=Symbol("style"),b=Symbol("parent");function g(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function y(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function v(e={}){return function(t,n){if("class"!==n.kind)throw new Error("@Component() can only decorate a class");var r,o;Reflect.defineProperty(t,"name",{value:e.selector,writable:!1,configurable:!1}),!t.prototype[b]||t.prototype[b][t.prototype[b].length-1]instanceof Object.getPrototypeOf(t)?t.prototype instanceof HTMLElement&&(t.prototype[b]=[t.prototype],t.prototype[m]=e.style?[e.style]:[],t.prototype[f]=e.template||""):(t.prototype[b].push(t.prototype),t.prototype[m].push(e.style),t.prototype[f]=(r=t.prototype[f],(o=e.template||null)&&o.match(/<parent\/>/)?o.replace(/<parent\/>/,r):r.match(/<child\/>/)?r.replace(/<child\/>/,o||""):`${r}${o||""}`));const i=t.prototype.connectedCallback||(()=>{}),a=t.prototype.disconnectedCallback||(()=>{});t.prototype.connectedCallback=function(){if(this[d]||void 0!==e.template||void 0!==e.style)if(this[d]){if(this[d]&&e.style);else if(this[d]&&e.selector&&!e.template)throw new Error("You need to pass a template for an extended element.")}else{if(!1===e.useShadow)throw new Error("unsupported");{const e=document.createElement("template");e.innerHTML=t.prototype[f]||"";const n=document.importNode(e.content,!0),r=this.attachShadow({mode:"open"});r.adoptedStyleSheets=t.prototype[m].reduce(((e,t)=>{if(!t)return e;if(t instanceof CSSStyleSheet)return e.push(t),e;var n=new CSSStyleSheet;return n.replaceSync(t.toString()),e.push(n),e}),[]),r.appendChild(n)}}else!1===e.useShadow||this.attachShadow({mode:"open"});const n=new Set;for(const e of this.shadowRoot.querySelectorAll("*"))-1!==e.localName.indexOf("-")&&n.add(e.localName);const r=Array.from(n.values()).map((e=>customElements.get(e)?Promise.resolve():customElements.whenDefined(e))),o=()=>{this[b].map((e=>{e.render&&e.render.call(this,t.observedAttributes?t.observedAttributes.reduce(((e,t)=>(e[y(t)]=!0,e)),{}):{})}))};0===r.length?(this[d]=!0,i.call(this),o()):Promise.all(r).then((()=>{this[d]=!0,i.call(this);for(const e of this.shadowRoot.querySelectorAll("slot"))e.dispatchEvent(new CustomEvent("slotchange"));o()}))},t.prototype.disconnectedCallback=function(){a.call(this)},t.prototype.attributeChangedCallback=function(e,t,n){this[y(e)]=n},n.addInitializer((function(){if(e.selector){if(window.customElements.get(e.selector))throw new Error(`@Component() ${n.name} duplicate selector '${e.selector}'`);window.customElements.define(e.selector,t)}}))}}Symbol("transmute");function w(e){return!!e&&e.constructor===Array}function $(e,t){e[d]&&e[b].map((n=>{n.render&&n.render.call(e,{[t]:!0})}))}function S(e){return null===e?"null":w(e)?"array":typeof e}function x(){return function(e,t){const n=t.name,r=n.replace(/^\$/,"");t.addInitializer((function(){let e=null;Reflect.defineProperty(this,n,{get(){return e??(e=this.shadowRoot?.querySelector(`[part~=${r}]`))}})}))}}Symbol("hasProxy");const E=Symbol("meta");function k(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function P(e){const t=e.toUpperCase();return 7===t.length?t:4===t.length?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:"#000000"}function R(e){var t=e.toString(16);return 1==t.length?"0"+t:t}function A(e,t,n){return"#"+R(e)+R(t)+R(n)}var C=n(457),O=function(e,t,n,r,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var b=(0,n[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(s=a(b.get))&&(p.get=s),(s=a(b.set))&&(p.set=s),(s=a(b.init))&&o.unshift(s)}else(s=a(b))&&("field"===l?o.unshift(s):p[c]=s)}u&&Object.defineProperty(u,r.name,p),h=!0},j=function(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0};(()=>{let e,t,n,r,o,c,u,h=[v({selector:"pg-input-hex-rgb",style:C.A,template:'<div> <input part="hex" type="text"/> <label part="labelRed">R</label> <input part="red" type="number" step="1" min="0" max="255"/> <label part="labelGreen">G</label> <input part="green" type="number" step="1" min="0" max="255"/> <label part="labelBlue">B</label> <input part="blue" type="number" step="1" min="0" max="255"/> </div>'})],d=[],f=HTMLElement,m=[],b=[],y=[],R=[],I=[],z=[],M=[],T=[],D=[],N=[];(class extends f{static{t=this}static{const v="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;var k;n=[function(e,t){const n=t.name,r=Symbol(n),o=Symbol(`${n}:type`),c=Symbol(`${n}:meta`);return t.addInitializer((function(){Reflect.defineProperty(this,n,{get:()=>"object"===this[o]||"array"===this[o]?this[r][s]?this[r]:p(this[r]):this[r],set:e=>{const t=S(k?k(e):e);if("index"!==n&&this[o]!==t&&"null"!==this[o]&&"null"!==t)throw new Error(`@Prop() ${n} with type '${this[o]}' cannot be set to ${t}.`);if("array"===this[o]){if(!w(e))throw new PropError(`Array "${n}" (Prop) initialized already. Reassignments must be array type.`,Object.getOwnPropertyDescriptor(this,n)?.set);if(this[r]===e)throw new Error("Setting an array to itself is not allowed.");const t=p(this[r]);if(t[i](this)){const n=e[s]?e[l]:e;t[a](this,n),this[r]=e}else this[r]=e}else this[r]=k?k(e):e,$(this,n)}})})),function(e){if(void 0===e&&"index"!==n)throw new Error(`@Prop() ${n} must have an initial value defined.`);if(void 0!==e&&"index"===n)throw new Error("@Prop() index must not have an initial value defined.");if(!0===e)throw new Error(`@Prop() ${n} boolean must initialize to false.`);if(!t.private){const{constructor:e}=this;e.observedAttributes??=[],e.symbols||(e.symbols={});const{symbols:t}=e,o=g(n);t[n]||(e.observedAttributes.push(o),t[n]=r)}return this[o]=S(e),"array"===this[o]?(this[r]=e,new Proxy(e,{get:(e,t)=>t===E?this[c]:(console.log("errr???"),Reflect.get(this[r],t)),set:(e,t,o)=>{if(t===E)return this[c]=o,!0;const i=Reflect.set(e,t,o);return"length"===t&&this[r].length===o||$(this,n),this[r]=o,i}})):(this[r]=k?k(this.getAttribute(n)??e):this.getAttribute(n)??e,this[r])}}],r=[x()],o=[x()],c=[x()],u=[x()],O(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:v},m,b),O(null,null,r,{kind:"field",name:"$hex",static:!1,private:!1,access:{has:e=>"$hex"in e,get:e=>e.$hex,set:(e,t)=>{e.$hex=t}},metadata:v},y,R),O(null,null,o,{kind:"field",name:"$red",static:!1,private:!1,access:{has:e=>"$red"in e,get:e=>e.$red,set:(e,t)=>{e.$red=t}},metadata:v},I,z),O(null,null,c,{kind:"field",name:"$green",static:!1,private:!1,access:{has:e=>"$green"in e,get:e=>e.$green,set:(e,t)=>{e.$green=t}},metadata:v},M,T),O(null,null,u,{kind:"field",name:"$blue",static:!1,private:!1,access:{has:e=>"$blue"in e,get:e=>e.$blue,set:(e,t)=>{e.$blue=t}},metadata:v},D,N),O(null,e={value:t},h,{kind:"class",name:t.name,metadata:v},null,d),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v}),j(t,d)}value=j(this,m,"#000000");$hex=(j(this,b),j(this,y,void 0));$red=(j(this,R),j(this,I,void 0));$green=(j(this,z),j(this,M,void 0));$blue=(j(this,T),j(this,D,void 0));connectedCallback(){this.$hex.value=this.value,this.updateRgb(),this.$hex.addEventListener("input",this.updateRgbDispatch.bind(this)),this.$red.addEventListener("input",this.updateHexDispatch.bind(this)),this.$green.addEventListener("input",this.updateHexDispatch.bind(this)),this.$blue.addEventListener("input",this.updateHexDispatch.bind(this))}updateRgb(){const e=k(P(this.$hex.value));null!==e&&(this.$red.value=e.r.toString(),this.$green.value=e.g.toString(),this.$blue.value=e.b.toString())}updateRgbDispatch(){this.updateRgb(),this.dispatchSelect()}updateHexDispatch(){this.$hex.value=A(parseInt(this.$red.value||"0",10),parseInt(this.$green.value||"0",10),parseInt(this.$blue.value||"0",10)),this.dispatchSelect()}dispatchSelect(){const e=P(this.$hex.value),t=A(parseInt(this.$red.value||"0",10),parseInt(this.$green.value||"0"),parseInt(this.$blue.value||"0"));this.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{hex:e,rgb:t}}))}render(){const e=P(this.value),t=k(e);this.$hex.value=e,this.$red.value=`${t?t.r:0}`,this.$green.value=`${t?t.g:0}`,this.$blue.value=`${t?t.b:0}`}constructor(){super(...arguments),j(this,N)}})})()})();
|