diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..ea28aa6d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +* text=auto +.github/ export-ignore +.gitignore export-ignore +.gitattributes export-ignore + +.phpstorm.meta.php export-ignore + +tests/ export-ignore +phpunit.xml export-ignore + +composer.json export-ignore +composer.lock export-ignore + +mix-manifest.json export-ignore +package.json export-ignore +package-lock.json export-ignore +webpack.mix.js export-ignore +webpack.config.js export-ignore diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..121eea10 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,63 @@ +# @link https://leoloso.com/posts/github-action-to-release-wp-plugin/ +# Creates a zip file containing the installable plugin. +# Steps: +# - Checkout the source code. +# - Run "composer install" to download all dependencies. +# - Use `git archive` to create a zip file. +# - Manually add the `vendor/` directory to that zip file. (Little gross.) +# - Upload the .zip file as an artifact to the action. +# - Upload the .zip file to the release, for download. + +name: Generate Installable Plugin, and Upload as Release Asset + +# Controls wh en the workflow will run. +on: + # Triggers when a new release is published. + release: + types: [published] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel. +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job. + steps: + # Checks out the source code. + - name: Checkout code + uses: actions/checkout@v2 + + # Runs "composer install" and creates the build directory. + - name: Build project + run: | + composer install --no-dev --optimize-autoloader + mkdir build + mkdir ${{ github.event.repository.name }} + mv vendor/ ${{ github.event.repository.name }}/ + + # Create the zip file. Note that this won't include vendor/, we have to add that next. + - name: Create artifact + run: | + git archive --prefix ${{ github.event.repository.name }}/ -o build/${{ github.event.repository.name }}-${{ github.event.release.name }}.zip HEAD + + # Manually add the vendor/ directory into the zip file. + - name: Add vendor files + uses: montudor/action-zip@v0.1.0 + with: + args: zip -ur build/${{ github.event.repository.name }}-${{ github.event.release.name }}.zip ${{ github.event.repository.name }}/ + + # Uploads the zip file to the action. + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ github.event.repository.name }}-${{ github.event.release.name }} + path: build/${{ github.event.repository.name }}-${{ github.event.release.name }}.zip + + # Attaches the zip file to the release. + - name: Upload to release + uses: JasonEtco/upload-to-release@master + with: + args: build/${{ github.event.repository.name }}-${{ github.event.release.name }}.zip application/zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index a80335fa..c6284b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ npm-debug.log *.sass.map *.scss.map /node_modules/ +/vendor/ # amcharts spam assets/js/build/vendors~canvg.min.js diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php new file mode 100644 index 00000000..960c4604 --- /dev/null +++ b/.phpstorm.meta.php @@ -0,0 +1,11 @@ + '@', + '' => '@Class', + ] ) + ); +} diff --git a/assets/js/build/alpine.min.js b/assets/js/build/alpine.min.js new file mode 100644 index 00000000..69e438a6 --- /dev/null +++ b/assets/js/build/alpine.min.js @@ -0,0 +1,5 @@ +(()=>{var qe=!1,Ue=!1,F=[];function kt(e){tn(e)}function tn(e){F.includes(e)||F.push(e),rn()}function he(e){let t=F.indexOf(e);t!==-1&&F.splice(t,1)}function rn(){!Ue&&!qe&&(qe=!0,queueMicrotask(nn))}function nn(){qe=!1,Ue=!0;for(let e=0;ee.effect(t,{scheduler:r=>{Ge?kt(r):r()}}),We=e.raw}function Ye(e){K=e}function Dt(e){let t=()=>{};return[n=>{let i=K(n);e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),Y(i))}},()=>{t()}]}var $t=[],Lt=[],jt=[];function Ft(e){jt.push(e)}function _e(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Lt.push(t))}function Kt(e){$t.push(e)}function Bt(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Je(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}var Qe=new MutationObserver(Ze),Xe=!1;function et(){Qe.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Xe=!0}function sn(){on(),Qe.disconnect(),Xe=!1}var te=[],tt=!1;function on(){te=te.concat(Qe.takeRecords()),te.length&&!tt&&(tt=!0,queueMicrotask(()=>{an(),tt=!1}))}function an(){Ze(te),te.length=0}function m(e){if(!Xe)return e();sn();let t=e();return et(),t}var rt=!1,ge=[];function zt(){rt=!0}function Vt(){rt=!1,Ze(ge),ge=[]}function Ze(e){if(rt){ge=ge.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;os.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{Je(s,o)}),n.forEach((o,s)=>{$t.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Lt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||!o.isConnected||(delete o._x_ignoreSelf,delete o._x_ignore,jt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,n=null,i=null}function xe(e){return I(k(e))}function T(e,t,r){return e._x_dataStack=[t,...k(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function nt(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function k(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?k(e.host):e.parentNode?k(e.parentNode):[]}function I(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function ye(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,c,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(e)}function be(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>cn(n,i),s=>it(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function cn(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function it(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),it(e[t[0]],t.slice(1),r)}}var Ht={};function y(e,t){Ht[e]=t}function re(e,t){return Object.entries(Ht).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=ot(t);return i={interceptor:be,...i},_e(t,o),n(t,i)},enumerable:!1})}),e}function qt(e,t,r,...n){try{return r(...n)}catch(i){J(i,e,t)}}function J(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} + +${r?'Expression: "'+r+`" + +`:""}`,t),setTimeout(()=>{throw e},0)}function N(e,t,r={}){let n;return g(e,t)(i=>n=i,r),n}function g(...e){return Ut(...e)}var Ut=st;function Wt(e){Ut=e}function st(e,t){let r={};re(r,e);let n=[r,...k(e)];if(typeof t=="function")return ln(n,t);let i=un(n,t,e);return qt.bind(null,e,t,i)}function ln(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(I([n,...e]),i);ve(r,o)}}var at={};function fn(e,t){if(at[e])return at[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(() => { ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`)}catch(s){return J(s,t,e),Promise.resolve()}})();return at[e]=o,o}function un(e,t,r){let n=fn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=I([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>J(l,r,t));n.finished?(ve(i,n.result,a,s,r),n.result=void 0):c.then(l=>{ve(i,l,a,s,r)}).catch(l=>J(l,r,t)).finally(()=>n.result=void 0)}}}function ve(e,t,r,n,i){if(typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>ve(e,s,r,n)).catch(s=>J(s,i,t)):e(o)}else e(t)}var ct="x-";function w(e=""){return ct+e}function Gt(e){ct=e}var Yt={};function p(e,t){Yt[e]=t}function ne(e,t,r){let n={};return Array.from(t).map(Jt((o,s)=>n[o]=s)).filter(Zt).map(pn(n,r)).sort(mn).map(o=>dn(e,o))}function Qt(e){return Array.from(e).map(Jt()).filter(t=>!Zt(t))}var lt=!1,ie=new Map,Xt=Symbol();function er(e){lt=!0;let t=Symbol();Xt=t,ie.set(t,[]);let r=()=>{for(;ie.get(t).length;)ie.get(t).shift()();ie.delete(t)},n=()=>{lt=!1,r()};e(r),n()}function ot(e){let t=[],r=a=>t.push(a),[n,i]=Dt(e);return t.push(i),[{Alpine:P,effect:n,cleanup:r,evaluateLater:g.bind(g,e),evaluate:N.bind(N,e)},()=>t.forEach(a=>a())]}function dn(e,t){let r=()=>{},n=Yt[t.type]||r,[i,o]=ot(e);Bt(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),lt?ie.get(Xt).push(n):n())};return s.runCleanups=o,s}var we=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Ee=e=>e;function Jt(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=tr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var tr=[];function Z(e){tr.push(e)}function Zt({name:e}){return rr().test(e)}var rr=()=>new RegExp(`^${ct}([^:^.]+)\\b`);function pn(e,t){return({name:r,value:n})=>{let i=r.match(rr()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var ut="DEFAULT",Se=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",ut,"teleport","element"];function mn(e,t){let r=Se.indexOf(e.type)===-1?ut:e.type,n=Se.indexOf(t.type)===-1?ut:t.type;return Se.indexOf(r)-Se.indexOf(n)}function B(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var ft=[],dt=!1;function Oe(e){ft.push(e),queueMicrotask(()=>{dt||setTimeout(()=>{Ae()})})}function Ae(){for(dt=!1;ft.length;)ft.shift()()}function nr(){dt=!0}function C(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>C(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)C(n,t,!1),n=n.nextElementSibling}function z(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function or(){document.body||z("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `