diff --git a/.distignore b/.distignore new file mode 100644 index 00000000..9a357a08 --- /dev/null +++ b/.distignore @@ -0,0 +1,2 @@ +node_modules +.github \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b29c953d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - '*.*.*' + +env: + PLUGIN_SLUG: wp-feature-notifications + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: ./.github/actions/node + + - name: Build package + shell: bash + run: npm run build --if-present + + - name: Create artifacts + shell: bash + run: rsync -rc --exclude-from="${GITHUB_WORKSPACE}/.distignore" "${GITHUB_WORKSPACE}/" "${PLUGIN_SLUG}/" --delete --delete-excluded && zip -r "${GITHUB_WORKSPACE}/${PLUGIN_SLUG}.zip" "${PLUGIN_SLUG}" + + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: github.ref + files: ${{ PLUGIN_SLUG }}.zip + fail_on_unmatched_files: true + target_commitish: trunk + generate_release_notes: true + draft: true diff --git a/.gitignore b/.gitignore index 626acaf6..135f8327 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,12 @@ # OS fixes .DS_Store +# IDE-specific +.phpunit.result.cachecghooks.lock + +# Vendor code /node_modules/ /vendor/ -.phpunit.result.cachecghooks.lock +# Build Files +/build/ diff --git a/build/wp-notify.asset.php b/build/wp-notify.asset.php deleted file mode 100644 index 4eeb9211..00000000 --- a/build/wp-notify.asset.php +++ /dev/null @@ -1 +0,0 @@ - array('moment', 'react', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '652333172ae36e46a9cf'); diff --git a/build/wp-notify.css b/build/wp-notify.css deleted file mode 100644 index 14482de9..00000000 --- a/build/wp-notify.css +++ /dev/null @@ -1,2 +0,0 @@ -:root{--wp-notify_color-default:#404040;--wp-notify_color-white:#fff;--wp-notify_color-light-gray-500:#e2e4e7;--wp-notify_color-light-gray-400:#e8eaeb;--wp-notify_color-light-gray:#c3c4c7;--wp-notify_color-secondary:#6c7781;--wp-notify_color-light-gray-800:#23282d;--wp-notify_color-red:#d94f4f;--wp-notify_color-blue:#0071a1;--wp-notify_color-blue-light:#72aee6;--wp-notify_color-link:var(--wp-notify_color-blue);--wp-notify_color-link-active:var(--wp-notify_color-blue-light);--wp-notify_color-scrollbar:var(--wp-notify_color-light-gray-400);--wp-notify_color-error:var(--wp-notify_color-red);--wp-notify_color-info:var(--wp-notify_color-blue);--wp-notify_color-warning:#ffb900;--wp-notify_color-success:#46b450;--wp-notify_hub-width:320px;--wp-notify_hub-image-size:32px;--wp-notify_hub-spacing-top:15px;--wp-notify_hub-spacing-bottom:17px;--wp-notify_hub-spacing-horizontal:16px;--wp-notify_hub-spacing-gap:8px}.wp-notification{background:var(--wp-notify_color-white);color:var(--wp-notify_color-default);max-height:600px;overflow:hidden}.wp-notification-action{color:var(--wp-notify_color-link);text-decoration-line:underline}.wp-notification-source{color:var(--wp-notify_color-secondary)}.wp-notification.dismissing{max-height:0;opacity:0;padding-bottom:0!important;padding-top:0!important;transition:opacity .1s,padding .1s,max-height .1s}#wpadminbar .wp-notification.unread>:first-child,#wpbody .wp-notification-wrap>:first-child{position:relative}#wpadminbar .wp-notification.unread>:first-child:before,#wpbody .wp-notification-wrap>:first-child:before{background:var(--wp-notify_color-error);border-radius:50%;content:"";display:block;height:6px;position:absolute;top:calc(50% - 3px);width:6px}#wpadminbar .wp-notification.unread>:first-child:before{left:calc(var(--wp-notify_hub-image-size)*-1.6 - 3px);top:calc(var(--wp-notify_hub-image-size)/2)}#wpbody .wp-notification-wrap>:first-child:before{left:-21px;top:7px}#wpbody #wp-notify-dashboard-notices,#wpbody #wp-notify-notice-demo{clear:both}#wpbody .wp-notification{--wp-notify_hub-spacing-top:clamp(2em,3vh,3em);--wp-notify_hub-element-bottom:clamp(1.5em,3vh,3em);--wp-notify_hub-spacing-gap:clamp(2.5em,3vh,4em);border-color:var(--wp-notify_color-light-gray);border-left-style:solid;border-left-width:4px;box-shadow:0 1px 1px #0000000a;box-sizing:border-box;display:grid;gap:50px;grid-auto-flow:row;grid-template-columns:auto 200px;grid-template-rows:auto;justify-content:space-between;margin:10px 0 var(--wp-notify_hub-element-bottom);padding:var(--wp-notify_hub-spacing-top) 20px var(--wp-notify_hub-spacing-gap) 36px;width:100%}#wpbody .wp-notification+.wp-notification{border-top:none;margin-top:calc(var(--wp-notify_hub-element-bottom)*-1)}#wpbody .wp-notification .wp-notification-wrap>:first-child{margin-top:0}#wpbody .wp-notification .wp-notification-wrap>:last-child{margin-bottom:0}#wpbody .wp-notification .wp-notification-actions{margin-top:1em}#wpbody .wp-notification .wp-notification-actions .button{border:1px solid #0000;border-radius:3px;line-height:20px;padding:8px;text-decoration:none}#wpbody .wp-notification .wp-notification-actions .button-primary{padding:8px 32px}#wpbody .wp-notification .wp-notification-image figure{margin:0;max-height:200px;max-width:200px}#wpbody .wp-notification .wp-notification-image figure img{object-fit:contain;object-position:center;width:100%}@media screen and (max-width:782px){#wpbody .wp-notification{grid-template-columns:auto}#wpbody .wp-notification .wp-notification-wrap{order:2}}#wpadminbar #wp-admin-bar-wp-notify{padding-right:8px;position:relative;z-index:100002}#wpadminbar #wp-admin-bar-wp-notify>.ab-item .ab-icon:before{content:"";top:3px}#wpadminbar #wp-admin-bar-wp-notify .ab-label{background:var(--wp-notify_color-red);border:1px solid var(--wp-notify_color-light-gray-800);border-radius:50%;font-size:0;height:6px;left:20px;position:absolute;top:12px;width:6px}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-wp-notify{display:block}#wpadminbar #wp-admin-bar-wp-notify .ab-label{clip:unset;-webkit-clip-path:unset;clip-path:unset;height:11px;left:28px;top:16px;width:11px}}#wp-notification-hub{background:var(--wp-notify_color-white);box-shadow:0 0 24px -16px var(--wp-notify_color-default);box-sizing:border-box;display:flex;flex-direction:column;height:100%;max-width:var(--wp-notify_hub-width);opacity:0;padding:30px 0 50px;position:fixed;right:calc(0px - var(--wp-notify_hub-width));top:0;transform:translateX(0);transition:transform .35s,opacity .25s;width:100%;z-index:100001}#wp-admin-bar-wp-notify.active #wp-notification-hub{opacity:1;transform:translateX(-100%)}#wpadminbar #wp-notification-hub:active .wp-notification-image .ab-icon:before,#wpadminbar #wp-notification-hub:hover .wp-notification-image .ab-icon:before{color:var(--wp-notify_color-white)}#wp-notification-hub .wp-notification-hub-wrapper{height:inherit;overflow:auto;position:relative}#wp-notification-hub .wp-notification-hub-wrapper div#wp-notify-adminbar{min-height:100%;padding-bottom:48px}#wp-notification-hub .wp-notification-hub-wrapper:after{box-shadow:0 10px 24px 2px var(--wp-notify_color-default);content:"";display:block;margin:auto;width:80%}#wp-notification-hub .wp-notification-hub-wrapper::-webkit-scrollbar{height:48px;width:18px}#wp-notification-hub .wp-notification-hub-wrapper::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:var(--wp-notify_color-scrollbar);border:6px solid #0000;-webkit-border-radius:18px;height:6px}#wp-notification-hub *{box-sizing:border-box;line-height:1.5;margin:0;padding:0}#wp-notification-hub h2{font-size:1.2rem;font-weight:700;margin:0}#wp-notification-hub header{background:var(--wp-notify_color-white);box-shadow:0 0 0 1px var(--wp-notify_color-white);min-height:50px;padding:0 var(--wp-notify_hub-spacing-horizontal) 10px;position:sticky;top:0;z-index:2}#wp-notification-hub header #clear-all-wp-notify-adminbar svg{vertical-align:middle}#wpadminbar #wp-notification-hub:hover footer,#wpadminbar #wp-notification-hub:hover footer a .ab-icon:before{color:var(--wp-notify_color-link)}#wpadminbar #wp-notification-hub:hover footer:hover,#wpadminbar #wp-notification-hub:hover footer:hover a .ab-icon:before{color:var(--wp-notify_color-link-active)}#wp-notification-hub footer{background:var(--wp-notify_color-white);border-top:1px solid var(--wp-notify_color-light-gray);bottom:0;left:0;padding:15px var(--wp-notify_hub-spacing-horizontal);position:fixed;right:0;text-align:center}#wp-notification-hub footer .ab-icon{position:inherit}#wp-notification-hub footer .ab-icon:before,#wp-notification-hub footer a{color:var(--wp-notify_color-link);line-height:20px}#wp-notification-hub footer .ab-icon:before:hover,#wp-notification-hub footer a:hover{color:var(--wp-notify_color-link-active)}#wp-notification-hub footer a:focus-visible{border-radius:2px;outline:2px solid #000}#wpadminbar .quicklinks #wp-notification-hub a{height:inherit}#wp-notification-hub li:active .ab-icon:before{color:var(--wp-notify_color-link)}#wp-notification-hub li:hover .ab-icon:before{color:inherit}#wp-notification-hub .wp-notification{-webkit-user-drag:none;display:grid;gap:12px;grid-auto-flow:row;grid-template-columns:var(--wp-notify_hub-image-size) auto;grid-template-rows:auto;margin-left:var(--wp-notify_hub-spacing-gap);margin-right:var(--wp-notify_hub-spacing-gap);max-width:calc(var(--wp-notify_hub-width) - var(--wp-notify_hub-spacing-gap)*2);padding:var(--wp-notify_hub-spacing-top) var(--wp-notify_hub-spacing-horizontal) var(--wp-notify_hub-spacing-gap);-webkit-user-select:none;user-select:none}#wp-notification-hub .wp-notification:focus-visible{border-radius:2px;outline:2px solid #000}#wp-notification-hub .wp-notification-wrap{margin-top:-4px}#wp-notification-hub .wp-notification-wrap>*{margin:0 0 4px}#wp-notification-hub .wp-notification-title{font-weight:600;line-height:1.5}#wp-notification-hub .wp-notification-action{background:#0000;border:0;display:block}#wp-notification-hub .wp-notification-image{grid-row:1;height:var(--wp-notify_hub-image-size);min-width:var(--wp-notify_hub-image-size);position:relative;width:var(--wp-notify_hub-image-size)}#wp-notification-hub .wp-notification-image *{height:100%;object-fit:cover;width:100%}#wp-notification-hub .wp-notification-icon{background:var(--wp-notify_color-light-gray-500);border-radius:8px}#wp-notification-hub .wp-notification-icon .ab-icon{font-size:24px;line-height:1;padding:4px}#wp-notification-hub .wp-notification-icon .ab-icon:before{color:var(--wp-notify_color-white);opacity:.9}#wp-notification-hub .wp-notification.user .wp-notification-image img{border-radius:8px}#wp-notification-hub .wp-notification .severity-alert{background-color:var(--wp-notify_color-error)}#wp-notification-hub .wp-notification .severity-warning{background-color:var(--wp-notify_color-warning)}#wp-notification-hub .wp-notification .severity-success{background-color:var(--wp-notify_color-success)}#wp-notification-hub .wp-notification .severity-info{background-color:var(--wp-notify_color-blue)} - diff --git a/build/wp-notify.js b/build/wp-notify.js deleted file mode 100644 index fc5c0df0..00000000 --- a/build/wp-notify.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var e={154:e=>{function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),o=1;o/gm),W=d(/^data-[\-\w.\u00B7-\uFFFF]/),Q=d(/^aria-[\-\w]+$/),Z=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=d(/^(?:\w+script|data):/i),J=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=d(/^html$/i),X=function(){return"undefined"==typeof window?null:window},$=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(r=n.currentScript.getAttribute(o));var i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X(),r=function(e){return t(e)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var i=n.document,a=n.document,c=n.DocumentFragment,l=n.HTMLTemplateElement,s=n.Node,u=n.Element,d=n.NodeFilter,p=n.NamedNodeMap,f=void 0===p?n.NamedNodeMap||n.MozNamedAttrMap:p,g=n.HTMLFormElement,y=n.DOMParser,h=n.trustedTypes,D=u.prototype,K=S(D,"cloneNode"),ee=S(D,"nextSibling"),te=S(D,"childNodes"),ne=S(D,"parentNode");if("function"==typeof l){var re=a.createElement("template");re.content&&re.content.ownerDocument&&(a=re.content.ownerDocument)}var oe=$(h,i),ie=oe?oe.createHTML(""):"",ae=a,ce=ae.implementation,le=ae.createNodeIterator,se=ae.createDocumentFragment,ue=ae.getElementsByTagName,me=i.importNode,de={};try{de=C(a).documentMode?a.documentMode:{}}catch(e){}var pe={};r.isSupported="function"==typeof ne&&ce&&void 0!==ce.createHTMLDocument&&9!==de;var fe,ge,ye=Y,he=G,Me=W,Ne=Q,ve=V,we=J,Ee=Z,be=null,Ae=I({},[].concat(o(j),o(O),o(k),o(_),o(U))),Te=null,Le=I({},[].concat(o(H),o(B),o(F),o(P))),xe=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),De=null,Ie=null,Ce=!0,Se=!0,je=!1,Oe=!1,ke=!1,ze=!1,_e=!1,Re=!1,Ue=!1,He=!1,Be=!0,Fe=!1,Pe="user-content-",Ye=!0,Ge=!1,We={},Qe=null,Ze=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ve=null,Je=I({},["audio","video","img","source","image","track"]),qe=null,Xe=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$e="http://www.w3.org/1998/Math/MathML",Ke="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",tt=et,nt=!1,rt=["application/xhtml+xml","text/html"],ot="text/html",it=null,at=a.createElement("form"),ct=function(e){return e instanceof RegExp||e instanceof Function},lt=function(t){it&&it===t||(t&&"object"===e(t)||(t={}),t=C(t),fe=fe=-1===rt.indexOf(t.PARSER_MEDIA_TYPE)?ot:t.PARSER_MEDIA_TYPE,ge="application/xhtml+xml"===fe?function(e){return e}:w,be="ALLOWED_TAGS"in t?I({},t.ALLOWED_TAGS,ge):Ae,Te="ALLOWED_ATTR"in t?I({},t.ALLOWED_ATTR,ge):Le,qe="ADD_URI_SAFE_ATTR"in t?I(C(Xe),t.ADD_URI_SAFE_ATTR,ge):Xe,Ve="ADD_DATA_URI_TAGS"in t?I(C(Je),t.ADD_DATA_URI_TAGS,ge):Je,Qe="FORBID_CONTENTS"in t?I({},t.FORBID_CONTENTS,ge):Ze,De="FORBID_TAGS"in t?I({},t.FORBID_TAGS,ge):{},Ie="FORBID_ATTR"in t?I({},t.FORBID_ATTR,ge):{},We="USE_PROFILES"in t&&t.USE_PROFILES,Ce=!1!==t.ALLOW_ARIA_ATTR,Se=!1!==t.ALLOW_DATA_ATTR,je=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=t.SAFE_FOR_TEMPLATES||!1,ke=t.WHOLE_DOCUMENT||!1,Re=t.RETURN_DOM||!1,Ue=t.RETURN_DOM_FRAGMENT||!1,He=t.RETURN_TRUSTED_TYPE||!1,_e=t.FORCE_BODY||!1,Be=!1!==t.SANITIZE_DOM,Fe=t.SANITIZE_NAMED_PROPS||!1,Ye=!1!==t.KEEP_CONTENT,Ge=t.IN_PLACE||!1,Ee=t.ALLOWED_URI_REGEXP||Ee,tt=t.NAMESPACE||et,t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(xe.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&(Se=!1),Ue&&(Re=!0),We&&(be=I({},o(U)),Te=[],!0===We.html&&(I(be,j),I(Te,H)),!0===We.svg&&(I(be,O),I(Te,B),I(Te,P)),!0===We.svgFilters&&(I(be,k),I(Te,B),I(Te,P)),!0===We.mathMl&&(I(be,_),I(Te,F),I(Te,P))),t.ADD_TAGS&&(be===Ae&&(be=C(be)),I(be,t.ADD_TAGS,ge)),t.ADD_ATTR&&(Te===Le&&(Te=C(Te)),I(Te,t.ADD_ATTR,ge)),t.ADD_URI_SAFE_ATTR&&I(qe,t.ADD_URI_SAFE_ATTR,ge),t.FORBID_CONTENTS&&(Qe===Ze&&(Qe=C(Qe)),I(Qe,t.FORBID_CONTENTS,ge)),Ye&&(be["#text"]=!0),ke&&I(be,["html","head","body"]),be.table&&(I(be,["tbody"]),delete De.tbody),m&&m(t),it=t)},st=I({},["mi","mo","mn","ms","mtext"]),ut=I({},["foreignobject","desc","title","annotation-xml"]),mt=I({},["title","style","font","a","script"]),dt=I({},O);I(dt,k),I(dt,z);var pt=I({},_);I(pt,R);var ft=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:et,tagName:"template"});var n=w(e.tagName),r=w(t.tagName);return e.namespaceURI===Ke?t.namespaceURI===et?"svg"===n:t.namespaceURI===$e?"svg"===n&&("annotation-xml"===r||st[r]):Boolean(dt[n]):e.namespaceURI===$e?t.namespaceURI===et?"math"===n:t.namespaceURI===Ke?"math"===n&&ut[r]:Boolean(pt[n]):e.namespaceURI===et&&!(t.namespaceURI===Ke&&!ut[r])&&!(t.namespaceURI===$e&&!st[r])&&!pt[n]&&(mt[n]||!dt[n])},gt=function(e){v(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ie}catch(t){e.remove()}}},yt=function(e,t){try{v(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){v(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Te[e])if(Re||Ue)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ht=function(e){var t,n;if(_e)e=""+e;else{var r=E(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===fe&&(e=''+e+"");var o=oe?oe.createHTML(e):e;if(tt===et)try{t=(new y).parseFromString(o,fe)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?"":o}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),tt===et?ue.call(t,ke?"html":"body")[0]:ke?t.documentElement:i},Mt=function(e){return le.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Nt=function(e){return e instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},vt=function(t){return"object"===e(s)?t instanceof s:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},wt=function(e,t,n){pe[e]&&M(pe[e],(function(e){e.call(r,t,n,it)}))},Et=function(e){var t;if(wt("beforeSanitizeElements",e,null),Nt(e))return gt(e),!0;if(L(/[\u0080-\uFFFF]/,e.nodeName))return gt(e),!0;var n=ge(e.nodeName);if(wt("uponSanitizeElement",e,{tagName:n,allowedTags:be}),e.hasChildNodes()&&!vt(e.firstElementChild)&&(!vt(e.content)||!vt(e.content.firstElementChild))&&L(/<[/\w]/g,e.innerHTML)&&L(/<[/\w]/g,e.textContent))return gt(e),!0;if("select"===n&&L(/