Page MenuHomePhabricator

D635.id2019.diff
No OneTemporary

D635.id2019.diff

diff --git a/dist/overlay.node.js b/dist/overlay.node.js
new file mode 100644
--- /dev/null
+++ b/dist/overlay.node.js
@@ -0,0 +1 @@
+var e={633:(e,n,t)=>{t.d(n,{Z:()=>r});var o=t(645),i=t.n(o)()((function(e){return e[1]}));i.push([e.id,".z1WpYRaXWvkkpnO8PU6JP{position:fixed;top:0;left:0;height:100%;width:100%}\n",""]),i.locals={overlay:"z1WpYRaXWvkkpnO8PU6JP"};const r=i},645:e=>{e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t=e(n);return n[2]?"@media ".concat(n[2]," {").concat(t,"}"):t})).join("")},n.i=function(e,t,o){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(i[a]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);o&&i[c[0]]||(t&&(c[2]?c[2]="".concat(t," and ").concat(c[2]):c[2]=t),n.push(c))}},n}},379:(e,n,t)=>{var o,i=function(){var e={};return function(n){if(void 0===e[n]){var t=document.querySelector(n);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}e[n]=t}return e[n]}}(),r=[];function a(e){for(var n=-1,t=0;t<r.length;t++)if(r[t].identifier===e){n=t;break}return n}function s(e,n){for(var t={},o=[],i=0;i<e.length;i++){var s=e[i],c=n.base?s[0]+n.base:s[0],l=t[c]||0,d="".concat(c," ").concat(l);t[c]=l+1;var u=a(d),f={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(r[u].references++,r[u].updater(f)):r.push({identifier:d,updater:p(f,n),references:1}),o.push(d)}return o}function c(e){var n=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var r=t.nc;r&&(o.nonce=r)}if(Object.keys(o).forEach((function(e){n.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(n);else{var a=i(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}return n}var l,d=(l=[],function(e,n){return l[e]=n,l.filter(Boolean).join("\n")});function u(e,n,t,o){var i=t?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=d(n,i);else{var r=document.createTextNode(i),a=e.childNodes;a[n]&&e.removeChild(a[n]),a.length?e.insertBefore(r,a[n]):e.appendChild(r)}}function f(e,n,t){var o=t.css,i=t.media,r=t.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var h=null,v=0;function p(e,n){var t,o,i;if(n.singleton){var r=v++;t=h||(h=c(n)),o=u.bind(null,t,r,!1),i=u.bind(null,t,r,!0)}else t=c(n),o=f.bind(null,t,n),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)};return o(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;o(e=n)}else i()}}e.exports=function(e,n){(n=n||{}).singleton||"boolean"==typeof n.singleton||(n.singleton=(void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o));var t=s(e=e||[],n);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<t.length;o++){var i=a(t[o]);r[i].references--}for(var c=s(e,n),l=0;l<t.length;l++){var d=a(t[l]);0===r[d].references&&(r[d].updater(),r.splice(d,1))}t=c}}}}},n={};function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={id:o,exports:{}};return e[o](r,r.exports,t),r.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var o={};(()=>{function e(e){return e[e.length-1]}t.d(o,{Z:()=>c});var n=t(379),i=t.n(n),r=t(633);i()(r.Z,{insert:"head",singleton:!1});const a=r.Z.locals||{};let s;if(window.m3w&&window.m3w.Overlay)s=window.m3w.Overlay,1!==s.version&&console.info("There are several different instances of overlay running. This may lead to versioning issues");else{let n=[],t=!1;const o=1e3;s=function(e){this.closed=!0,this._onclose=e,this.container=document.createElement("div"),this.container.classList.add(a.overlay)},s.prototype={isTop:function(){return e(n)===this},_notify:function(){this.closed||(this._onclose(this),this.close())},open:function(){if(this.closed)return this.closed=!1,n.push(this),document.body.appendChild(this.container),this.container.style.zIndex=this.zindex(),this},close:function(){this.closed||(this.closed=!0,n.splice(n.indexOf(this),1),document.body.removeChild(this.container))},html:function(){return this.container},zindex:function(){return o+n.indexOf(this)},block:function(){this.isTop()&&(t=!0)}},s.version=1,document.body.addEventListener("click",(function(){window.setTimeout((function(){window.setTimeout((function(){t=!1}),0),t||n[0]&&e(n)._notify()}),0)}))}window.m3w=window.m3w||{},window.m3w.Overlay=s;const c=s})();var i=o.Z;export{i as default};
\ No newline at end of file
diff --git a/src/overlay.js b/src/overlay.js
--- a/src/overlay.js
+++ b/src/overlay.js
@@ -87,6 +87,18 @@
block: function () {
if (!this.isTop()) { return; }
blocked = true;
+ },
+
+ /**
+ * This method allows your application to define the kind of overlay being used,
+ * fixed overlays are set to follow the viewport (if the user scrolls the overlay
+ * will follow) or not (in which case the overlay will be attached to the document)
+ *
+ * @param {bool} set
+ */
+ setFixed : function (set) {
+ if (set) { this.container.classList.add('fixed'); }
+ else { this.container.classList.remove('fixed'); }
}
};
diff --git a/src/styles/overlay.scss b/src/styles/overlay.scss
--- a/src/styles/overlay.scss
+++ b/src/styles/overlay.scss
@@ -1,8 +1,19 @@
.overlay {
- position: fixed;
+ /*
+ * Compared to a fixed position, an absolute position provides us with much increased
+ * flexibility when working with layers. This allows us to create layers that are
+ * inherently larger than the viewport (which is a valuable feature) and it allows to
+ * position overlays relative to the document instead of the viewport.
+ */
+ position: absolute;
top: 0;
left: 0;
+}
+
+.overlay.fixed
+{
+ position: fixed;
height: 100%;
width: 100%;
}
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Apr 11 2021, 11:46 AM (9 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7064
Default Alt Text
D635.id2019.diff (6 KB)

Event Timeline