mirror of
https://github.com/nostalgic-css/NES.css.git
synced 2025-08-31 17:51:46 +02:00
Merge branch 'develop' into develop
This commit is contained in:
@@ -9,7 +9,7 @@ import { withBackgrounds } from '@storybook/addon-backgrounds';
|
||||
import '../scss/nes.scss'; // eslint-disable-line import/no-unresolved
|
||||
|
||||
// automatically import all files ending in *.stories.js
|
||||
const req = require.context('../docs', true, /.stories.js$/);
|
||||
const req = require.context('../story', true, /.stories.js$/);
|
||||
function loadStories() {
|
||||
req.keys().forEach(filename => req(filename));
|
||||
}
|
||||
|
@@ -1,745 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
*/
|
||||
(function() {
|
||||
|
||||
// nb. This is for IE10 and lower _only_.
|
||||
var supportCustomEvent = window.CustomEvent;
|
||||
if (!supportCustomEvent || typeof supportCustomEvent === 'object') {
|
||||
supportCustomEvent = function CustomEvent(event, x) {
|
||||
x = x || {};
|
||||
var ev = document.createEvent('CustomEvent');
|
||||
ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null);
|
||||
return ev;
|
||||
};
|
||||
supportCustomEvent.prototype = window.Event.prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Element} el to check for stacking context
|
||||
* @return {boolean} whether this el or its parents creates a stacking context
|
||||
*/
|
||||
function createsStackingContext(el) {
|
||||
while (el && el !== document.body) {
|
||||
var s = window.getComputedStyle(el);
|
||||
var invalid = function(k, ok) {
|
||||
return !(s[k] === undefined || s[k] === ok);
|
||||
}
|
||||
if (s.opacity < 1 ||
|
||||
invalid('zIndex', 'auto') ||
|
||||
invalid('transform', 'none') ||
|
||||
invalid('mixBlendMode', 'normal') ||
|
||||
invalid('filter', 'none') ||
|
||||
invalid('perspective', 'none') ||
|
||||
s['isolation'] === 'isolate' ||
|
||||
s.position === 'fixed' ||
|
||||
s.webkitOverflowScrolling === 'touch') {
|
||||
return true;
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the nearest <dialog> from the passed element.
|
||||
*
|
||||
* @param {Element} el to search from
|
||||
* @return {HTMLDialogElement} dialog found
|
||||
*/
|
||||
function findNearestDialog(el) {
|
||||
while (el) {
|
||||
if (el.localName === 'dialog') {
|
||||
return /** @type {HTMLDialogElement} */ (el);
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blur the specified element, as long as it's not the HTML body element.
|
||||
* This works around an IE9/10 bug - blurring the body causes Windows to
|
||||
* blur the whole application.
|
||||
*
|
||||
* @param {Element} el to blur
|
||||
*/
|
||||
function safeBlur(el) {
|
||||
if (el && el.blur && el !== document.body) {
|
||||
el.blur();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!NodeList} nodeList to search
|
||||
* @param {Node} node to find
|
||||
* @return {boolean} whether node is inside nodeList
|
||||
*/
|
||||
function inNodeList(nodeList, node) {
|
||||
for (var i = 0; i < nodeList.length; ++i) {
|
||||
if (nodeList[i] === node) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLFormElement} el to check
|
||||
* @return {boolean} whether this form has method="dialog"
|
||||
*/
|
||||
function isFormMethodDialog(el) {
|
||||
if (!el || !el.hasAttribute('method')) {
|
||||
return false;
|
||||
}
|
||||
return el.getAttribute('method').toLowerCase() === 'dialog';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!HTMLDialogElement} dialog to upgrade
|
||||
* @constructor
|
||||
*/
|
||||
function dialogPolyfillInfo(dialog) {
|
||||
this.dialog_ = dialog;
|
||||
this.replacedStyleTop_ = false;
|
||||
this.openAsModal_ = false;
|
||||
|
||||
// Set a11y role. Browsers that support dialog implicitly know this already.
|
||||
if (!dialog.hasAttribute('role')) {
|
||||
dialog.setAttribute('role', 'dialog');
|
||||
}
|
||||
|
||||
dialog.show = this.show.bind(this);
|
||||
dialog.showModal = this.showModal.bind(this);
|
||||
dialog.close = this.close.bind(this);
|
||||
|
||||
if (!('returnValue' in dialog)) {
|
||||
dialog.returnValue = '';
|
||||
}
|
||||
|
||||
if ('MutationObserver' in window) {
|
||||
var mo = new MutationObserver(this.maybeHideModal.bind(this));
|
||||
mo.observe(dialog, {attributes: true, attributeFilter: ['open']});
|
||||
} else {
|
||||
// IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also
|
||||
// seem to fire even if the element was removed as part of a parent removal. Use the removed
|
||||
// events to force downgrade (useful if removed/immediately added).
|
||||
var removed = false;
|
||||
var cb = function() {
|
||||
removed ? this.downgradeModal() : this.maybeHideModal();
|
||||
removed = false;
|
||||
}.bind(this);
|
||||
var timeout;
|
||||
var delayModel = function(ev) {
|
||||
if (ev.target !== dialog) { return; } // not for a child element
|
||||
var cand = 'DOMNodeRemoved';
|
||||
removed |= (ev.type.substr(0, cand.length) === cand);
|
||||
window.clearTimeout(timeout);
|
||||
timeout = window.setTimeout(cb, 0);
|
||||
};
|
||||
['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) {
|
||||
dialog.addEventListener(name, delayModel);
|
||||
});
|
||||
}
|
||||
// Note that the DOM is observed inside DialogManager while any dialog
|
||||
// is being displayed as a modal, to catch modal removal from the DOM.
|
||||
|
||||
Object.defineProperty(dialog, 'open', {
|
||||
set: this.setOpen.bind(this),
|
||||
get: dialog.hasAttribute.bind(dialog, 'open')
|
||||
});
|
||||
|
||||
this.backdrop_ = document.createElement('div');
|
||||
this.backdrop_.className = 'backdrop';
|
||||
this.backdrop_.addEventListener('click', this.backdropClick_.bind(this));
|
||||
}
|
||||
|
||||
dialogPolyfillInfo.prototype = {
|
||||
|
||||
get dialog() {
|
||||
return this.dialog_;
|
||||
},
|
||||
|
||||
/**
|
||||
* Maybe remove this dialog from the modal top layer. This is called when
|
||||
* a modal dialog may no longer be tenable, e.g., when the dialog is no
|
||||
* longer open or is no longer part of the DOM.
|
||||
*/
|
||||
maybeHideModal: function() {
|
||||
if (this.dialog_.hasAttribute('open') && document.body.contains(this.dialog_)) { return; }
|
||||
this.downgradeModal();
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
||||
*/
|
||||
downgradeModal: function() {
|
||||
if (!this.openAsModal_) { return; }
|
||||
this.openAsModal_ = false;
|
||||
this.dialog_.style.zIndex = '';
|
||||
|
||||
// This won't match the native <dialog> exactly because if the user set top on a centered
|
||||
// polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
|
||||
// possible to polyfill this perfectly.
|
||||
if (this.replacedStyleTop_) {
|
||||
this.dialog_.style.top = '';
|
||||
this.replacedStyleTop_ = false;
|
||||
}
|
||||
|
||||
// Clear the backdrop and remove from the manager.
|
||||
this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_);
|
||||
dialogPolyfill.dm.removeDialog(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {boolean} value whether to open or close this dialog
|
||||
*/
|
||||
setOpen: function(value) {
|
||||
if (value) {
|
||||
this.dialog_.hasAttribute('open') || this.dialog_.setAttribute('open', '');
|
||||
} else {
|
||||
this.dialog_.removeAttribute('open');
|
||||
this.maybeHideModal(); // nb. redundant with MutationObserver
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles clicks on the fake .backdrop element, redirecting them as if
|
||||
* they were on the dialog itself.
|
||||
*
|
||||
* @param {!Event} e to redirect
|
||||
*/
|
||||
backdropClick_: function(e) {
|
||||
if (!this.dialog_.hasAttribute('tabindex')) {
|
||||
// Clicking on the backdrop should move the implicit cursor, even if dialog cannot be
|
||||
// focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this
|
||||
// would not be needed - clicks would move the implicit cursor there.
|
||||
var fake = document.createElement('div');
|
||||
this.dialog_.insertBefore(fake, this.dialog_.firstChild);
|
||||
fake.tabIndex = -1;
|
||||
fake.focus();
|
||||
this.dialog_.removeChild(fake);
|
||||
} else {
|
||||
this.dialog_.focus();
|
||||
}
|
||||
|
||||
var redirectedEvent = document.createEvent('MouseEvents');
|
||||
redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
|
||||
e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
|
||||
e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
|
||||
this.dialog_.dispatchEvent(redirectedEvent);
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Focuses on the first focusable element within the dialog. This will always blur the current
|
||||
* focus, even if nothing within the dialog is found.
|
||||
*/
|
||||
focus_: function() {
|
||||
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
|
||||
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
|
||||
if (!target && this.dialog_.tabIndex >= 0) {
|
||||
target = this.dialog_;
|
||||
}
|
||||
if (!target) {
|
||||
// Note that this is 'any focusable area'. This list is probably not exhaustive, but the
|
||||
// alternative involves stepping through and trying to focus everything.
|
||||
var opts = ['button', 'input', 'keygen', 'select', 'textarea'];
|
||||
var query = opts.map(function(el) {
|
||||
return el + ':not([disabled])';
|
||||
});
|
||||
// TODO(samthor): tabindex values that are not numeric are not focusable.
|
||||
query.push('[tabindex]:not([disabled]):not([tabindex=""])'); // tabindex != "", not disabled
|
||||
target = this.dialog_.querySelector(query.join(', '));
|
||||
}
|
||||
safeBlur(document.activeElement);
|
||||
target && target.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the zIndex for the backdrop and dialog.
|
||||
*
|
||||
* @param {number} dialogZ
|
||||
* @param {number} backdropZ
|
||||
*/
|
||||
updateZIndex: function(dialogZ, backdropZ) {
|
||||
if (dialogZ < backdropZ) {
|
||||
throw new Error('dialogZ should never be < backdropZ');
|
||||
}
|
||||
this.dialog_.style.zIndex = dialogZ;
|
||||
this.backdrop_.style.zIndex = backdropZ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows the dialog. If the dialog is already open, this does nothing.
|
||||
*/
|
||||
show: function() {
|
||||
if (!this.dialog_.open) {
|
||||
this.setOpen(true);
|
||||
this.focus_();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Show this dialog modally.
|
||||
*/
|
||||
showModal: function() {
|
||||
if (this.dialog_.hasAttribute('open')) {
|
||||
throw new Error('Failed to execute \'showModal\' on dialog: The element is already open, and therefore cannot be opened modally.');
|
||||
}
|
||||
if (!document.body.contains(this.dialog_)) {
|
||||
throw new Error('Failed to execute \'showModal\' on dialog: The element is not in a Document.');
|
||||
}
|
||||
if (!dialogPolyfill.dm.pushDialog(this)) {
|
||||
throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.');
|
||||
}
|
||||
|
||||
if (createsStackingContext(this.dialog_.parentElement)) {
|
||||
console.warn('A dialog is being shown inside a stacking context. ' +
|
||||
'This may cause it to be unusable. For more information, see this link: ' +
|
||||
'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context');
|
||||
}
|
||||
|
||||
this.setOpen(true);
|
||||
this.openAsModal_ = true;
|
||||
|
||||
// Optionally center vertically, relative to the current viewport.
|
||||
if (dialogPolyfill.needsCentering(this.dialog_)) {
|
||||
dialogPolyfill.reposition(this.dialog_);
|
||||
this.replacedStyleTop_ = true;
|
||||
} else {
|
||||
this.replacedStyleTop_ = false;
|
||||
}
|
||||
|
||||
// Insert backdrop.
|
||||
this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling);
|
||||
|
||||
// Focus on whatever inside the dialog.
|
||||
this.focus_();
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes this HTMLDialogElement. This is optional vs clearing the open
|
||||
* attribute, however this fires a 'close' event.
|
||||
*
|
||||
* @param {string=} opt_returnValue to use as the returnValue
|
||||
*/
|
||||
close: function(opt_returnValue) {
|
||||
if (!this.dialog_.hasAttribute('open')) {
|
||||
throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.');
|
||||
}
|
||||
this.setOpen(false);
|
||||
|
||||
// Leave returnValue untouched in case it was set directly on the element
|
||||
if (opt_returnValue !== undefined) {
|
||||
this.dialog_.returnValue = opt_returnValue;
|
||||
}
|
||||
|
||||
// Triggering "close" event for any attached listeners on the <dialog>.
|
||||
var closeEvent = new supportCustomEvent('close', {
|
||||
bubbles: false,
|
||||
cancelable: false
|
||||
});
|
||||
this.dialog_.dispatchEvent(closeEvent);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var dialogPolyfill = {};
|
||||
|
||||
dialogPolyfill.reposition = function(element) {
|
||||
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
||||
var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2;
|
||||
element.style.top = Math.max(scrollTop, topValue) + 'px';
|
||||
};
|
||||
|
||||
dialogPolyfill.isInlinePositionSetByStylesheet = function(element) {
|
||||
for (var i = 0; i < document.styleSheets.length; ++i) {
|
||||
var styleSheet = document.styleSheets[i];
|
||||
var cssRules = null;
|
||||
// Some browsers throw on cssRules.
|
||||
try {
|
||||
cssRules = styleSheet.cssRules;
|
||||
} catch (e) {}
|
||||
if (!cssRules) { continue; }
|
||||
for (var j = 0; j < cssRules.length; ++j) {
|
||||
var rule = cssRules[j];
|
||||
var selectedNodes = null;
|
||||
// Ignore errors on invalid selector texts.
|
||||
try {
|
||||
selectedNodes = document.querySelectorAll(rule.selectorText);
|
||||
} catch(e) {}
|
||||
if (!selectedNodes || !inNodeList(selectedNodes, element)) {
|
||||
continue;
|
||||
}
|
||||
var cssTop = rule.style.getPropertyValue('top');
|
||||
var cssBottom = rule.style.getPropertyValue('bottom');
|
||||
if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
dialogPolyfill.needsCentering = function(dialog) {
|
||||
var computedStyle = window.getComputedStyle(dialog);
|
||||
if (computedStyle.position !== 'absolute') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We must determine whether the top/bottom specified value is non-auto. In
|
||||
// WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but
|
||||
// Firefox returns the used value. So we do this crazy thing instead: check
|
||||
// the inline style and then go through CSS rules.
|
||||
if ((dialog.style.top !== 'auto' && dialog.style.top !== '') ||
|
||||
(dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) {
|
||||
return false;
|
||||
}
|
||||
return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!Element} element to force upgrade
|
||||
*/
|
||||
dialogPolyfill.forceRegisterDialog = function(element) {
|
||||
if (window.HTMLDialogElement || element.showModal) {
|
||||
console.warn('This browser already supports <dialog>, the polyfill ' +
|
||||
'may not work correctly', element);
|
||||
}
|
||||
if (element.localName !== 'dialog') {
|
||||
throw new Error('Failed to register dialog: The element is not a dialog.');
|
||||
}
|
||||
new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!Element} element to upgrade, if necessary
|
||||
*/
|
||||
dialogPolyfill.registerDialog = function(element) {
|
||||
if (!element.showModal) {
|
||||
dialogPolyfill.forceRegisterDialog(element);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
dialogPolyfill.DialogManager = function() {
|
||||
/** @type {!Array<!dialogPolyfillInfo>} */
|
||||
this.pendingDialogStack = [];
|
||||
|
||||
var checkDOM = this.checkDOM_.bind(this);
|
||||
|
||||
// The overlay is used to simulate how a modal dialog blocks the document.
|
||||
// The blocking dialog is positioned on top of the overlay, and the rest of
|
||||
// the dialogs on the pending dialog stack are positioned below it. In the
|
||||
// actual implementation, the modal dialog stacking is controlled by the
|
||||
// top layer, where z-index has no effect.
|
||||
this.overlay = document.createElement('div');
|
||||
this.overlay.className = '_dialog_overlay';
|
||||
this.overlay.addEventListener('click', function(e) {
|
||||
this.forwardTab_ = undefined;
|
||||
e.stopPropagation();
|
||||
checkDOM([]); // sanity-check DOM
|
||||
}.bind(this));
|
||||
|
||||
this.handleKey_ = this.handleKey_.bind(this);
|
||||
this.handleFocus_ = this.handleFocus_.bind(this);
|
||||
|
||||
this.zIndexLow_ = 100000;
|
||||
this.zIndexHigh_ = 100000 + 150;
|
||||
|
||||
this.forwardTab_ = undefined;
|
||||
|
||||
if ('MutationObserver' in window) {
|
||||
this.mo_ = new MutationObserver(function(records) {
|
||||
var removed = [];
|
||||
records.forEach(function(rec) {
|
||||
for (var i = 0, c; c = rec.removedNodes[i]; ++i) {
|
||||
if (!(c instanceof Element)) {
|
||||
continue;
|
||||
} else if (c.localName === 'dialog') {
|
||||
removed.push(c);
|
||||
}
|
||||
removed = removed.concat(c.querySelectorAll('dialog'));
|
||||
}
|
||||
});
|
||||
removed.length && checkDOM(removed);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called on the first modal dialog being shown. Adds the overlay and related
|
||||
* handlers.
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.blockDocument = function() {
|
||||
document.documentElement.addEventListener('focus', this.handleFocus_, true);
|
||||
document.addEventListener('keydown', this.handleKey_);
|
||||
this.mo_ && this.mo_.observe(document, {childList: true, subtree: true});
|
||||
};
|
||||
|
||||
/**
|
||||
* Called on the first modal dialog being removed, i.e., when no more modal
|
||||
* dialogs are visible.
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.unblockDocument = function() {
|
||||
document.documentElement.removeEventListener('focus', this.handleFocus_, true);
|
||||
document.removeEventListener('keydown', this.handleKey_);
|
||||
this.mo_ && this.mo_.disconnect();
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the stacking of all known dialogs.
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.updateStacking = function() {
|
||||
var zIndex = this.zIndexHigh_;
|
||||
|
||||
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
||||
dpi.updateZIndex(--zIndex, --zIndex);
|
||||
if (i === 0) {
|
||||
this.overlay.style.zIndex = --zIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Make the overlay a sibling of the dialog itself.
|
||||
var last = this.pendingDialogStack[0];
|
||||
if (last) {
|
||||
var p = last.dialog.parentNode || document.body;
|
||||
p.appendChild(this.overlay);
|
||||
} else if (this.overlay.parentNode) {
|
||||
this.overlay.parentNode.removeChild(this.overlay);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Element} candidate to check if contained or is the top-most modal dialog
|
||||
* @return {boolean} whether candidate is contained in top dialog
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) {
|
||||
while (candidate = findNearestDialog(candidate)) {
|
||||
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
||||
if (dpi.dialog === candidate) {
|
||||
return i === 0; // only valid if top-most
|
||||
}
|
||||
}
|
||||
candidate = candidate.parentElement;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {
|
||||
if (this.containedByTopDialog_(event.target)) { return; }
|
||||
|
||||
if (document.activeElement === document.documentElement) { return; }
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
safeBlur(/** @type {Element} */ (event.target));
|
||||
|
||||
if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key
|
||||
|
||||
var dpi = this.pendingDialogStack[0];
|
||||
var dialog = dpi.dialog;
|
||||
var position = dialog.compareDocumentPosition(event.target);
|
||||
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
||||
if (this.forwardTab_) {
|
||||
// forward
|
||||
dpi.focus_();
|
||||
} else if (event.target !== document.documentElement) {
|
||||
// backwards if we're not already focused on <html>
|
||||
document.documentElement.focus();
|
||||
}
|
||||
} else {
|
||||
// TODO: Focus after the dialog, is ignored.
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {
|
||||
this.forwardTab_ = undefined;
|
||||
if (event.keyCode === 27) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var cancelEvent = new supportCustomEvent('cancel', {
|
||||
bubbles: false,
|
||||
cancelable: true
|
||||
});
|
||||
var dpi = this.pendingDialogStack[0];
|
||||
if (dpi && dpi.dialog.dispatchEvent(cancelEvent)) {
|
||||
dpi.dialog.close();
|
||||
}
|
||||
} else if (event.keyCode === 9) {
|
||||
this.forwardTab_ = !event.shiftKey;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are
|
||||
* removed and immediately readded don't stay modal, they become normal.
|
||||
*
|
||||
* @param {!Array<!HTMLDialogElement>} removed that have definitely been removed
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) {
|
||||
// This operates on a clone because it may cause it to change. Each change also calls
|
||||
// updateStacking, which only actually needs to happen once. But who removes many modal dialogs
|
||||
// at a time?!
|
||||
var clone = this.pendingDialogStack.slice();
|
||||
clone.forEach(function(dpi) {
|
||||
if (removed.indexOf(dpi.dialog) !== -1) {
|
||||
dpi.downgradeModal();
|
||||
} else {
|
||||
dpi.maybeHideModal();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!dialogPolyfillInfo} dpi
|
||||
* @return {boolean} whether the dialog was allowed
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.pushDialog = function(dpi) {
|
||||
var allowed = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
|
||||
if (this.pendingDialogStack.length >= allowed) {
|
||||
return false;
|
||||
}
|
||||
if (this.pendingDialogStack.unshift(dpi) === 1) {
|
||||
this.blockDocument();
|
||||
}
|
||||
this.updateStacking();
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!dialogPolyfillInfo} dpi
|
||||
*/
|
||||
dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {
|
||||
var index = this.pendingDialogStack.indexOf(dpi);
|
||||
if (index === -1) { return; }
|
||||
|
||||
this.pendingDialogStack.splice(index, 1);
|
||||
if (this.pendingDialogStack.length === 0) {
|
||||
this.unblockDocument();
|
||||
}
|
||||
this.updateStacking();
|
||||
};
|
||||
|
||||
dialogPolyfill.dm = new dialogPolyfill.DialogManager();
|
||||
dialogPolyfill.formSubmitter = null;
|
||||
dialogPolyfill.useValue = null;
|
||||
|
||||
/**
|
||||
* Installs global handlers, such as click listers and native method overrides. These are needed
|
||||
* even if a no dialog is registered, as they deal with <form method="dialog">.
|
||||
*/
|
||||
if (window.HTMLDialogElement === undefined) {
|
||||
|
||||
/**
|
||||
* If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with
|
||||
* one that returns the correct value.
|
||||
*/
|
||||
var testForm = document.createElement('form');
|
||||
testForm.setAttribute('method', 'dialog');
|
||||
if (testForm.method !== 'dialog') {
|
||||
var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method');
|
||||
if (methodDescriptor) {
|
||||
// nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything
|
||||
// and don't bother to update the element.
|
||||
var realGet = methodDescriptor.get;
|
||||
methodDescriptor.get = function() {
|
||||
if (isFormMethodDialog(this)) {
|
||||
return 'dialog';
|
||||
}
|
||||
return realGet.call(this);
|
||||
};
|
||||
var realSet = methodDescriptor.set;
|
||||
methodDescriptor.set = function(v) {
|
||||
if (typeof v === 'string' && v.toLowerCase() === 'dialog') {
|
||||
return this.setAttribute('method', v);
|
||||
}
|
||||
return realSet.call(this, v);
|
||||
};
|
||||
Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Global 'click' handler, to capture the <input type="submit"> or <button> element which has
|
||||
* submitted a <form method="dialog">. Needed as Safari and others don't report this inside
|
||||
* document.activeElement.
|
||||
*/
|
||||
document.addEventListener('click', function(ev) {
|
||||
dialogPolyfill.formSubmitter = null;
|
||||
dialogPolyfill.useValue = null;
|
||||
if (ev.defaultPrevented) { return; } // e.g. a submit which prevents default submission
|
||||
|
||||
var target = /** @type {Element} */ (ev.target);
|
||||
if (!target || !isFormMethodDialog(target.form)) { return; }
|
||||
|
||||
var valid = (target.type === 'submit' && ['button', 'input'].indexOf(target.localName) > -1);
|
||||
if (!valid) {
|
||||
if (!(target.localName === 'input' && target.type === 'image')) { return; }
|
||||
// this is a <input type="image">, which can submit forms
|
||||
dialogPolyfill.useValue = ev.offsetX + ',' + ev.offsetY;
|
||||
}
|
||||
|
||||
var dialog = findNearestDialog(target);
|
||||
if (!dialog) { return; }
|
||||
|
||||
dialogPolyfill.formSubmitter = target;
|
||||
}, false);
|
||||
|
||||
/**
|
||||
* Replace the native HTMLFormElement.submit() method, as it won't fire the
|
||||
* submit event and give us a chance to respond.
|
||||
*/
|
||||
var nativeFormSubmit = HTMLFormElement.prototype.submit;
|
||||
var replacementFormSubmit = function () {
|
||||
if (!isFormMethodDialog(this)) {
|
||||
return nativeFormSubmit.call(this);
|
||||
}
|
||||
var dialog = findNearestDialog(this);
|
||||
dialog && dialog.close();
|
||||
};
|
||||
HTMLFormElement.prototype.submit = replacementFormSubmit;
|
||||
|
||||
/**
|
||||
* Global form 'dialog' method handler. Closes a dialog correctly on submit
|
||||
* and possibly sets its return value.
|
||||
*/
|
||||
document.addEventListener('submit', function(ev) {
|
||||
var form = /** @type {HTMLFormElement} */ (ev.target);
|
||||
if (!isFormMethodDialog(form)) { return; }
|
||||
ev.preventDefault();
|
||||
|
||||
var dialog = findNearestDialog(form);
|
||||
if (!dialog) { return; }
|
||||
|
||||
// Forms can only be submitted via .submit() or a click (?), but anyway: sanity-check that
|
||||
// the submitter is correct before using its value as .returnValue.
|
||||
var s = dialogPolyfill.formSubmitter;
|
||||
if (s && s.form === form) {
|
||||
dialog.close(dialogPolyfill.useValue || s.value);
|
||||
} else {
|
||||
dialog.close();
|
||||
}
|
||||
dialogPolyfill.formSubmitter = null;
|
||||
}, true);
|
||||
}
|
||||
|
||||
dialogPolyfill['forceRegisterDialog'] = dialogPolyfill.forceRegisterDialog;
|
||||
dialogPolyfill['registerDialog'] = dialogPolyfill.registerDialog;
|
||||
|
||||
if (typeof define === 'function' && 'amd' in define) {
|
||||
// AMD support
|
||||
define(function() { return dialogPolyfill; });
|
||||
} else if (typeof module === 'object' && typeof module['exports'] === 'object') {
|
||||
// CommonJS support
|
||||
module['exports'] = dialogPolyfill;
|
||||
} else {
|
||||
// all others
|
||||
window['dialogPolyfill'] = dialogPolyfill;
|
||||
}
|
||||
})();
|
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Visual Studio 2015 dark style
|
||||
* Author: Nicolas LLOBERA <nllobera@gmail.com>
|
||||
*/
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #1E1E1E;
|
||||
color: #DCDCDC;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-literal,
|
||||
.hljs-symbol,
|
||||
.hljs-name {
|
||||
color: #569CD6;
|
||||
}
|
||||
.hljs-link {
|
||||
color: #569CD6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-type {
|
||||
color: #4EC9B0;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-class {
|
||||
color: #B8D7A3;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-meta-string {
|
||||
color: #D69D85;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-template-tag {
|
||||
color: #9A5334;
|
||||
}
|
||||
|
||||
.hljs-subst,
|
||||
.hljs-function,
|
||||
.hljs-title,
|
||||
.hljs-params,
|
||||
.hljs-formula {
|
||||
color: #DCDCDC;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #57A64A;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-doctag {
|
||||
color: #608B4E;
|
||||
}
|
||||
|
||||
.hljs-meta,
|
||||
.hljs-meta-keyword,
|
||||
.hljs-tag {
|
||||
color: #9B9B9B;
|
||||
}
|
||||
|
||||
.hljs-variable,
|
||||
.hljs-template-variable {
|
||||
color: #BD63C5;
|
||||
}
|
||||
|
||||
.hljs-attr,
|
||||
.hljs-attribute,
|
||||
.hljs-builtin-name {
|
||||
color: #9CDCFE;
|
||||
}
|
||||
|
||||
.hljs-section {
|
||||
color: gold;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*.hljs-code {
|
||||
font-family:'Monospace';
|
||||
}*/
|
||||
|
||||
.hljs-bullet,
|
||||
.hljs-selector-tag,
|
||||
.hljs-selector-id,
|
||||
.hljs-selector-class,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color: #D7BA7D;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
background-color: #144212;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
background-color: #600;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
File diff suppressed because one or more lines are too long
196
demo/style.css
196
demo/style.css
@@ -1,196 +0,0 @@
|
||||
body {
|
||||
padding: 0 2rem;
|
||||
margin: 2rem;
|
||||
}
|
||||
|
||||
.nes-container:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
i.brand {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
div.containers > .nes-container {
|
||||
display: inline-block;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.selects {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.selects .nes-select {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.nes-select + .nes-select {
|
||||
margin-left: 24px;
|
||||
}
|
||||
|
||||
.balloon.nes-container .nes-balloon {
|
||||
max-width: 600px;
|
||||
margin: 2rem 2rem;
|
||||
}
|
||||
|
||||
.balloon.nes-container .messages {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.balloon.nes-container .message {
|
||||
display: flex;
|
||||
}
|
||||
.balloon.nes-container .message i {
|
||||
align-self: flex-end;
|
||||
}
|
||||
.balloon.nes-container .message.-left {
|
||||
align-self: flex-start;
|
||||
}
|
||||
.balloon.nes-container .message.-right {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.form.nes-container > .nes-field:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
#tables {
|
||||
margin: 35px auto;
|
||||
}
|
||||
|
||||
#progress {
|
||||
margin-top: 35px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
}
|
||||
.footer a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.github-link {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
height: 100px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
.github-link:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.github-link > p.nes-balloon {
|
||||
align-self: flex-start;
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
color: #333;
|
||||
}
|
||||
.github-link > i.nes-octocat {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.show-code {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -4px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 34px;
|
||||
font-size: 0.7em;
|
||||
}
|
||||
|
||||
.sample-code {
|
||||
margin: 0;
|
||||
}
|
||||
.sample-code > code {
|
||||
padding: 1em 2em;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
.code {
|
||||
display: none;
|
||||
padding: 0;
|
||||
margin-top: -20px;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.copy {
|
||||
width: 58px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
#form .nes-field,
|
||||
#form .field {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.copied {
|
||||
position: absolute;
|
||||
right: 35px;
|
||||
bottom: 25px;
|
||||
z-index: 2;
|
||||
display: none;
|
||||
padding: 10px;
|
||||
font-size: 0.7em;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.balloon .copied {
|
||||
right: 10px;
|
||||
bottom: -4px;
|
||||
}
|
||||
|
||||
#dialogs > section {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#dialogs .dialog-menu {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#texts {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.nes-text {
|
||||
margin-right: 2em;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1280px) {
|
||||
.code p:first-child {
|
||||
width: 99%;
|
||||
padding-top: 2.7em;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 2rem 0.2rem;
|
||||
}
|
||||
.balloon.nes-container .nes-balloon {
|
||||
max-width: 70%;
|
||||
}
|
||||
|
||||
.github-link {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.code p {
|
||||
width: 100%;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
#code-avatars p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/* Copyright (c) 2013 The Chromium Authors. All rights reserved. */
|
||||
dialog {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: -moz-fit-content;
|
||||
width: -webkit-fit-content;
|
||||
width: fit-content;
|
||||
height: -moz-fit-content;
|
||||
height: -webkit-fit-content;
|
||||
height: fit-content;
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
color: black;
|
||||
background: white;
|
||||
border: solid;
|
||||
}
|
||||
|
||||
dialog:not([open]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
dialog + .backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
._dialog_overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
dialog.fixed {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
216
docs/index.html
Normal file
216
docs/index.html
Normal file
@@ -0,0 +1,216 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<meta name="description" content="NES.css is a NES-style CSS Framework." />
|
||||
<meta name="keywords" content="html5,css,framework,sass,NES,8bit" />
|
||||
<meta name="author" content="© 2018 B.C.Rikko" />
|
||||
<meta name="theme-color" content="#212529"/>
|
||||
<link rel="shortcut icon" type="image/png" href="favicon.png">
|
||||
<link rel="shortcut icon" sizes="196x196" href="favicon.png">
|
||||
<link rel="apple-touch-icon" href="favicon.png">
|
||||
|
||||
<title>NES.css - NES-style CSS Framework</title>
|
||||
|
||||
<link href="https://unpkg.com/nes.css@latest/css/nes.min.css" rel="stylesheet" />
|
||||
<link href="./style.css" rel="stylesheet" />
|
||||
<script src="./lib/vue.min.js"></script>
|
||||
|
||||
<script src="./lib/dialog-polyfill.js"></script>
|
||||
<script src="./lib/highlight.js"></script>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="NES.css" />
|
||||
<meta property="og:url" content="https://nostalgic-css.github.io/NES.css/" />
|
||||
<meta property="og:description" content="NES-style CSS Framework | ファミコン風CSSフレームワーク" />
|
||||
<meta property="og:image" content="https://user-images.githubusercontent.com/5305599/49061716-da649680-f254-11e8-9a89-d95a7407ec6a.png" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:site" content="@bc_rikko" />
|
||||
<meta name="twitter:creator" content="@bc_rikko" />
|
||||
<meta name="twitter:image" content="https://user-images.githubusercontent.com/5305599/49061716-da649680-f254-11e8-9a89-d95a7407ec6a.png" />
|
||||
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41640153-4"></script>
|
||||
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag("js", new Date());gtag("config", "UA-41640153-4");</script>
|
||||
<script>
|
||||
if (window.navigator.userAgent.toLocaleLowerCase().indexOf('trident') !== -1) {
|
||||
window.alert('IE is not supported on this page.')
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="nescss">
|
||||
<header :class="{ sticky: scrollPos > 50 }">
|
||||
<div class="container">
|
||||
<div class="nav-brand">
|
||||
<a href="https://nostalgic-css.github.io/NES.css/">
|
||||
<h1><i class="snes-jp-logo brand-logo"></i>NES.css</h1>
|
||||
</a>
|
||||
<p>NES-style CSS Framework.</p>
|
||||
</div>
|
||||
|
||||
<div class="social-buttons">
|
||||
<p>Share on SNS</p>
|
||||
<div class="share">
|
||||
<a @click="share('twitter')"><i class="nes-icon twitter"></i></a>
|
||||
<a @click="share('facebook')"><i class="nes-icon facebook"></i></a>
|
||||
<a @click="share('linkedin')"><i class="nes-icon linkedin"></i></a>
|
||||
<a @click="share('github')"><i class="nes-icon github"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<main class="main-content">
|
||||
<a class="github-link" :class="{ active: scrollPos < 200 }" href="https://github.com/nostalgic-css/NES.css" target="_blank" rel="noopener" @mouseover="startAnimate" @mouseout="stopAnimate">
|
||||
<p class="nes-balloon from-right">Fork me<br />on GitHub</p>
|
||||
<i class="nes-octocat" :class="animateOctocat ? 'animate' : ''"></i>
|
||||
</a>
|
||||
|
||||
<!-- About -->
|
||||
<section class="topic">
|
||||
<h2 id="about"><a href="#about">#</a>About</h2>
|
||||
<p>NES.css is NES-style (8bit-like) CSS Framework.</p>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Installation -->
|
||||
<section class="topic">
|
||||
<h2 id="installation"><a href="#installation">#</a>Installation</h2>
|
||||
<p>NES.css is available via either npm or Yarn, or a CDN.</p>
|
||||
<p>Please read <a href="https://github.com/nostalgic-css/NES.css" target="_blank" rel="noopener">README.md</a>.</p>
|
||||
</section>
|
||||
|
||||
<!-- Usage -->
|
||||
<section class="topic">
|
||||
<h2 id="usage"><a href="#usage">#</a>Usage</h2>
|
||||
<p>NES.css only provides components. You will need to define your own layout.</p>
|
||||
|
||||
<section class="showcase" v-for="sample in collection" :key="sample">
|
||||
<section class="nes-container with-title">
|
||||
<h3 class="title">{{ sample.title | capitalize }}</h3>
|
||||
<div
|
||||
:id="sample.title"
|
||||
class="item"
|
||||
v-html="sample.code">
|
||||
</div>
|
||||
<p v-if="sample.description" class="description nes-text">{{ sample.description }}</p>
|
||||
<p v-if="sample.note" class="note nes-text is-error">{{ sample.note }}</p>
|
||||
<button type="button" class="nes-btn is-primary showcode" @click="sample.showCode = !sample.showCode"><></button>
|
||||
</section>
|
||||
<section class="samplecode" v-show="sample.showCode">
|
||||
<button type="button" class="nes-btn copycode" @click="copy($event, sample.title)">copy</button>
|
||||
<pre><code class="html">{{ sample.code }}</code></pre>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<!-- Members -->
|
||||
<section class="topic">
|
||||
<h2 id="members"><a href="#members">#</a>Members</h2>
|
||||
<section class="coreteam">
|
||||
<h3 class="topic-title"><i class="nes-icon star"></i>Core Team Members</h3>
|
||||
<p>Here is core team members developing NES.css.</p>
|
||||
|
||||
<div class="coreteam-members">
|
||||
<template v-for="member in coreteam">
|
||||
<section class="nes-container is-dark member-card">
|
||||
<div class="avatar">
|
||||
<img class="lazy" :data-src="'https://github.com/' + member.github + '.png?size=80'" :alt="'Core Member ' + member.name">
|
||||
</div>
|
||||
<div class="profile">
|
||||
<h4 class="name">{{ member.name }}</h4>
|
||||
<p>{{ member.feat }}</p>
|
||||
<div>
|
||||
<a :href="'https://github.com/' + member.github" target="_blank" rel="noopener" aria-label="github"><i class="nes-icon github"></i></a>
|
||||
<a :href="'https://twitter.com/' + member.twitter" target="_blank" rel="noopener" aria-label="twitter"><i class="nes-icon twitter"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<section class="coreteam-emeriti" v-if="emeriti.length > 0">
|
||||
<h3 class="topic-title"><i class="nes-icon trophy"></i>Core Team Emeriti</h3>
|
||||
<p>Here we honor some no-longer-active core team members.</p>
|
||||
|
||||
<div class="coreteam-members">
|
||||
<template v-for="member in emeriti">
|
||||
<section class="nes-container is-dark member-card">
|
||||
<div class="avatar">
|
||||
<img class="lazy" :data-src="'https://github.com/' + member.github + '.png?size=80'" :alt="'Emeriti ' + member.name">
|
||||
</div>
|
||||
<div class="profile">
|
||||
<h4 class="name">{{ member.name }}</h4>
|
||||
<p>{{ member.feat }}</p>
|
||||
<div>
|
||||
<a :href="'https://github.com/' + member.github" target="_blank" rel="noopener" aria-label="github"><i class="nes-icon github"></i></a>
|
||||
<a :href="'https://twitter.com/' + member.twitter" target="_blank" rel="noopener" aria-label="twitter"><i class="nes-icon twitter"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<section class="contributors">
|
||||
<h3 class="topic-title"><i class="nes-icon heart"></i>Contributors</h3>
|
||||
<template v-for="user in contributors">
|
||||
<a class="contributor" :href="'https://github.com/' + user" target="_black">
|
||||
<img class="nes-avatar is-large is-rounded lazy" :data-src="'https://github.com/' + user + '.png?size=64'" :alt="'Contributor ' + user">
|
||||
<p>{{ user }}</p>
|
||||
</a>
|
||||
</template>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<!-- Articles -->
|
||||
<section class="topic">
|
||||
<h2 id="articles"><a href="#articles">#</a>Articles</h2>
|
||||
<article class="article-link">
|
||||
<h3 class="title">
|
||||
<a href="https://medium.com/@bc_rikko/why-i-created-and-released-nes-css-ee8966bacd09" target="_blank" rel="noopener"><i class="nes-icon medium"></i><span>Why I created and released NES.css</span></a>
|
||||
</h3>
|
||||
</article>
|
||||
<article class="article-link">
|
||||
<h3 class="title">
|
||||
<a href="https://github.blog/2019-01-20-release-radar-december-2018/#nes-css-1-0" target="_blank" rel="noopener"><i class="nes-icon github"></i><span>Release Radar·December 2018|The GitHub Blog</span></a>
|
||||
</h3>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>
|
||||
<span>©2018</span>
|
||||
<a href="https://kuroeveryday.blogspot.com/" target="_blank" rel="noopener">Black Everyday Company</a>
|
||||
<span>-</span>
|
||||
<a href="https://twitter.com/bc_rikko" target="_blank" rel="noopener">@bc_rikko</a>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<!-- Copied balloon -->
|
||||
<div class="nes-balloon from-right copied-balloon" :style="copiedBalloon">
|
||||
<p>copied!!</p>
|
||||
</div>
|
||||
|
||||
<!-- FAB Button -->
|
||||
<button type="button" class="nes-btn is-error scroll-btn" :class="{ active: scrollPos > 500 }" @click="window.scrollTo({ top:0, behavior: 'smooth' })"><span><</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="./script.js"></script>
|
||||
<script>
|
||||
const h = document.querySelector('head');
|
||||
['./lib/dialog-polyfill.css', './lib/highlight-theme.css'].forEach(a => {
|
||||
const l = document.createElement('link');
|
||||
l.href = a;
|
||||
l.rel = 'stylesheet';
|
||||
h.appendChild(l);
|
||||
})
|
||||
</script>
|
||||
</html>
|
2
docs/lib/dialog-polyfill.css
Normal file
2
docs/lib/dialog-polyfill.css
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Copyright (c) 2013 The Chromium Authors. All rights reserved. */
|
||||
._dialog_overlay,dialog+.backdrop{right:0;bottom:0;left:0;position:fixed}dialog{position:absolute;right:0;left:0;display:block;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;padding:1em;margin:auto;color:#000;background:#fff;border:solid}dialog:not([open]){display:none}dialog+.backdrop{top:0;background:rgba(0,0,0,.1)}._dialog_overlay{top:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}
|
4
docs/lib/dialog-polyfill.js
Normal file
4
docs/lib/dialog-polyfill.js
Normal file
File diff suppressed because one or more lines are too long
5
docs/lib/highlight-theme.css
Normal file
5
docs/lib/highlight-theme.css
Normal file
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Visual Studio 2015 dark style
|
||||
* Author: Nicolas LLOBERA <nllobera@gmail.com>
|
||||
*/
|
||||
.hljs{display:block;overflow-x:auto;padding:.5em;background:#1E1E1E;color:#DCDCDC}.hljs-addition,.hljs-deletion{display:inline-block;width:100%}.hljs-keyword,.hljs-link,.hljs-literal,.hljs-name,.hljs-symbol{color:#569CD6}.hljs-link{text-decoration:underline}.hljs-built_in,.hljs-type{color:#4EC9B0}.hljs-class,.hljs-number{color:#B8D7A3}.hljs-meta-string,.hljs-string{color:#D69D85}.hljs-regexp,.hljs-template-tag{color:#9A5334}.hljs-formula,.hljs-function,.hljs-params,.hljs-subst,.hljs-title{color:#DCDCDC}.hljs-comment,.hljs-quote{color:#57A64A;font-style:italic}.hljs-doctag{color:#608B4E}.hljs-meta,.hljs-meta-keyword,.hljs-tag{color:#9B9B9B}.hljs-template-variable,.hljs-variable{color:#BD63C5}.hljs-attr,.hljs-attribute,.hljs-builtin-name{color:#9CDCFE}.hljs-section{color:gold}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-bullet,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-selector-tag{color:#D7BA7D}.hljs-addition{background-color:#144212}.hljs-deletion{background-color:#600}
|
2
docs/lib/highlight.js
Normal file
2
docs/lib/highlight.js
Normal file
File diff suppressed because one or more lines are too long
6
docs/lib/vue.min.js
vendored
Normal file
6
docs/lib/vue.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
640
docs/script.js
Normal file
640
docs/script.js
Normal file
@@ -0,0 +1,640 @@
|
||||
const sampleCollection = [
|
||||
{
|
||||
title: 'texts',
|
||||
showCode: false,
|
||||
code: `<span class="nes-text is-primary">Primary</span>
|
||||
<span class="nes-text is-success">Success</span>
|
||||
<span class="nes-text is-warning">Warning</span>
|
||||
<span class="nes-text is-error">Error</span>
|
||||
<span class="nes-text is-disabled">Disabled</span>`,
|
||||
},
|
||||
{
|
||||
title: 'buttons',
|
||||
showCode: false,
|
||||
code: `<a class="nes-btn">Normal</a>
|
||||
|
||||
<button type="button" class="nes-btn is-primary">Primary</button>
|
||||
<button type="button" class="nes-btn is-success">Success</button>
|
||||
<button type="button" class="nes-btn is-warning">Warning</button>
|
||||
<button type="button" class="nes-btn is-error">Error</button>
|
||||
<button type="button" class="nes-btn is-disabled">Disabled</button>`,
|
||||
},
|
||||
{
|
||||
title: 'radios',
|
||||
showCode: false,
|
||||
code: `<label>
|
||||
<input type="radio" class="nes-radio" name="answer" checked />
|
||||
<span>Yes</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" class="nes-radio" name="answer" />
|
||||
<span>No</span>
|
||||
</label>`,
|
||||
},
|
||||
{
|
||||
title: 'checkboxes',
|
||||
showCode: false,
|
||||
code: `<label>
|
||||
<input type="checkbox" class="nes-checkbox" checked />
|
||||
<span>Enable</span>
|
||||
</label>
|
||||
|
||||
<div style="background-color:#212529; padding: 1rem;">
|
||||
<label>
|
||||
<input type="checkbox" class="nes-checkbox is-dark" checked />
|
||||
<span>Dark</span>
|
||||
</label>
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'inputs',
|
||||
showCode: false,
|
||||
code: `<div class="nes-field">
|
||||
<label for="name_field">Your name</label>
|
||||
<input type="text" id="name_field" class="nes-input">
|
||||
</div>
|
||||
|
||||
<div class="nes-field is-inline">
|
||||
<label for="inline_field">.input.is-success</label>
|
||||
<input type="text" id="inline_field" class="nes-input is-success" placeholder="NES.css">
|
||||
</div>
|
||||
|
||||
<div class="nes-field is-inline">
|
||||
<label for="warning_field">.input.is-warning</label>
|
||||
<input type="text" id="warning_field" class="nes-input is-warning" placeholder="8bit.css">
|
||||
</div>
|
||||
|
||||
<div class="nes-field is-inline">
|
||||
<label for="error_field">.input.is-error</label>
|
||||
<input type="text" id="error_field" class="nes-input is-error" placeholder="awesome.css">
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'textarea',
|
||||
showCode: false,
|
||||
code: `<label for="textarea_field">Textarea</label>
|
||||
<textarea id="textarea_field" class="nes-textarea"></textarea>`,
|
||||
},
|
||||
{
|
||||
title: 'selects',
|
||||
showCode: false,
|
||||
code: `<label for="default_select">Default select</label>
|
||||
<div class="nes-select">
|
||||
<select required id="default_select">
|
||||
<option value="" disabled selected hidden>Select...</option>
|
||||
<option value="0">To be</option>
|
||||
<option value="1">Not to be</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="success_select">nes-select.is-success</label>
|
||||
<div class="nes-select is-success">
|
||||
<select required id="success_select">
|
||||
<option value="" disabled selected hidden>Select...</option>
|
||||
<option value="0">To be</option>
|
||||
<option value="1">Not to be</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="warning_select">nes-select.is-warning</label>
|
||||
<div class="nes-select is-warning">
|
||||
<select required id="warning_select">
|
||||
<option value="" disabled selected hidden>Select...</option>
|
||||
<option value="0">To be</option>
|
||||
<option value="1">Not to be</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="error_select">nes-select.is-error</label>
|
||||
<div class="nes-select is-error">
|
||||
<select required id="error_select">
|
||||
<option value="" disabled selected hidden>Select...</option>
|
||||
<option value="0">To be</option>
|
||||
<option value="1">Not to be</option>
|
||||
</select>
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'containers',
|
||||
showCode: false,
|
||||
code: `<div class="nes-container with-title is-centered">
|
||||
<p class="title">Container.is-centered</p>
|
||||
<p>Good morning. Thou hast had a good night's sleep, I hope.</p>
|
||||
</div>
|
||||
|
||||
<div class="nes-container is-dark with-title">
|
||||
<p class="title">Container.is-dark</p>
|
||||
<p>Good morning. Thou hast had a good night's sleep, I hope.</p>
|
||||
</div>
|
||||
|
||||
<div class="nes-container is-rounded">
|
||||
<p>Good morning. Thou hast had a good night's sleep, I hope.</p>
|
||||
</div>
|
||||
|
||||
<div class="nes-container is-rounded is-dark">
|
||||
<p>Good morning. Thou hast had a good night's sleep, I hope.</p>
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'dialogs',
|
||||
note:
|
||||
'NES.css does not include any JavaScript. If you want to use dialog element other than Chrome, you need polyfill.',
|
||||
showCode: false,
|
||||
code: `<!-- Dialog -->
|
||||
<section>
|
||||
<button type="button" class="nes-btn is-primary" onclick="document.getElementById('dialog-default').showModal();">
|
||||
Open dialog
|
||||
</button>
|
||||
<dialog class="nes-dialog" id="dialog-default">
|
||||
<form method="dialog">
|
||||
<p class="title">Dialog</p>
|
||||
<p>Alert: this is a dialog.</p>
|
||||
<menu class="dialog-menu">
|
||||
<button class="nes-btn">Cancel</button>
|
||||
<button class="nes-btn is-primary">Confirm</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
</section>
|
||||
|
||||
<!-- Dark dialog -->
|
||||
<section>
|
||||
<button type="button" class="nes-btn is-primary" onclick="document.getElementById('dialog-dark').showModal();">
|
||||
Open dark dialog
|
||||
</button>
|
||||
<dialog class="nes-dialog is-dark" id="dialog-dark">
|
||||
<form method="dialog">
|
||||
<p class="title">Dark dialog</p>
|
||||
<p>Alert: this is a dialog.</p>
|
||||
<menu class="dialog-menu">
|
||||
<button class="nes-btn">Cancel</button>
|
||||
<button class="nes-btn is-primary">Confirm</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
</section>
|
||||
|
||||
<!-- Rounded dialog -->
|
||||
<section>
|
||||
<button type="button" class="nes-btn is-primary" onclick="document.getElementById('dialog-rounded').showModal();">
|
||||
Open rounded dialog
|
||||
</button>
|
||||
<dialog class="nes-dialog is-rounded" id="dialog-rounded">
|
||||
<form method="dialog">
|
||||
<p class="title">Rounded dialog</p>
|
||||
<p>Alert: this is a dialog.</p>
|
||||
<menu class="dialog-menu">
|
||||
<button class="nes-btn">Cancel</button>
|
||||
<button class="nes-btn is-primary">Confirm</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
</section>
|
||||
|
||||
<!-- Dark and Rounded dialog -->
|
||||
<section>
|
||||
<button type="button" class="nes-btn is-primary" onclick="document.getElementById('dialog-dark-rounded').showModal();">
|
||||
Open dark and rounded dialog
|
||||
</button>
|
||||
<dialog class="nes-dialog is-dark is-rounded" id="dialog-dark-rounded">
|
||||
<form method="dialog">
|
||||
<p class="title">Dark and Rounded dialog</p>
|
||||
<p>Alert: this is a dialog.</p>
|
||||
<menu class="dialog-menu">
|
||||
<button class="nes-btn">Cancel</button>
|
||||
<button class="nes-btn is-primary">Confirm</button>
|
||||
</menu>
|
||||
</form>
|
||||
</dialog>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'lists',
|
||||
showCode: false,
|
||||
code: `<div class="lists">
|
||||
<ul class="nes-list is-disc">
|
||||
<li>Good morning.</li>
|
||||
<li>Thou hast had a good night's sleep, I hope.</li>
|
||||
<li>Thou hast had a good afternoon</li>
|
||||
<li>Good night.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="lists">
|
||||
<ul class="nes-list is-circle">
|
||||
<li>Good morning.</li>
|
||||
<li>Thou hast had a good night's sleep, I hope.</li>
|
||||
<li>Thou hast had a good afternoon</li>
|
||||
<li>Good night.</li>
|
||||
</ul>
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'tables',
|
||||
showCode: false,
|
||||
code: `<div class="nes-table-responsive">
|
||||
<table class="nes-table is-bordered is-centered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table.is-bordered</th>
|
||||
<th>Table.is-centered</th>
|
||||
<th>Table.is-centered</th>
|
||||
<th>Table.is-centered</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Thou hast had a good morning</td>
|
||||
<td>Thou hast had a good afternoon</td>
|
||||
<td>Thou hast had a good evening</td>
|
||||
<td>Thou hast had a good night</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Thou hast had a good morning</td>
|
||||
<td>Thou hast had a good afternoon</td>
|
||||
<td>Thou hast had a good evening</td>
|
||||
<td>Thou hast had a good night</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="nes-table-responsive">
|
||||
<table class="nes-table is-bordered is-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table.is-dark</th>
|
||||
<th>Table.is-bordered</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Thou hast had a good morning</td>
|
||||
<td>Thou hast had a good afternon</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Thou hast had a good morning</td>
|
||||
<td>Thou hast had a good afternoon</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>`,
|
||||
},
|
||||
{
|
||||
title: 'progress',
|
||||
showCode: false,
|
||||
code: `<progress class="nes-progress" value="90" max="100"></progress>
|
||||
<progress class="nes-progress is-primary" value="80" max="100"></progress>
|
||||
<progress class="nes-progress is-success" value="50" max="100"></progress>
|
||||
<progress class="nes-progress is-warning" value="30" max="100"></progress>
|
||||
<progress class="nes-progress is-error" value="10" max="100"></progress>
|
||||
<progress class="nes-progress is-pattern" value="50" max="100"></progress>`,
|
||||
},
|
||||
{
|
||||
title: 'avatars',
|
||||
description: 'It is recommended to "image-rendering: pixelated".',
|
||||
showCode: false,
|
||||
code: `<img class="nes-avatar" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
|
||||
<img class="nes-avatar is-small" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
<img class="nes-avatar is-medium" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
<img class="nes-avatar is-large" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
|
||||
|
||||
<img class="nes-avatar is-rounded" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
|
||||
<img class="nes-avatar is-rounded is-small" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
<img class="nes-avatar is-rounded is-medium" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">
|
||||
<img class="nes-avatar is-rounded is-large" alt="Gravatar image example" src="https://www.gravatar.com/avatar?s=15" style="image-rendering: pixelated;">`,
|
||||
},
|
||||
{
|
||||
title: 'balloons',
|
||||
showCode: false,
|
||||
code: `<section class="message-list">
|
||||
<section class="message -left">
|
||||
<i class="nes-bcrikko"></i>
|
||||
<!-- Balloon -->
|
||||
<div class="nes-balloon from-left">
|
||||
<p>Hello NES.css</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="message -right">
|
||||
<!-- Balloon -->
|
||||
<div class="nes-balloon from-right">
|
||||
<p>Good morning. Thou hast had a good night's sleep, I hope.</p>
|
||||
</div>
|
||||
<i class="nes-bcrikko"></i>
|
||||
</section>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'badges',
|
||||
showCode: false,
|
||||
code: `<a href="#" class="nes-badge">
|
||||
<span class="is-dark">NES.css</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge">
|
||||
<span class="is-primary">is</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge">
|
||||
<span class="is-success">a</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge">
|
||||
<span class="is-warning">great</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge">
|
||||
<span class="is-error">framework!</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge is-splited">
|
||||
<span class="is-dark">npm</span>
|
||||
<span class="is-primary">1.1.0</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge is-splited">
|
||||
<span class="is-dark">test</span>
|
||||
<span class="is-success">100%</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge is-icon">
|
||||
<span class="is-warning"><i class="nes-icon star is-small"></i></span>
|
||||
<span class="is-primary">Icons</span>
|
||||
</a>
|
||||
|
||||
<a href="#" class="nes-badge is-icon">
|
||||
<span class="is-dark">hi</span>
|
||||
<span class="is-warning">Text</span>
|
||||
</a>`,
|
||||
},
|
||||
{
|
||||
title: 'reaction-icons',
|
||||
showCode: false,
|
||||
description:
|
||||
'If you wanto to change icon size, please use "is-small", "is-medium" and "is-large".',
|
||||
code: `<section class="icon-list">
|
||||
<!-- heart -->
|
||||
<i class="nes-icon is-large heart"></i>
|
||||
<i class="nes-icon is-large heart is-empty"></i>
|
||||
|
||||
<!-- star -->
|
||||
<i class="nes-icon is-large star"></i>
|
||||
<i class="nes-icon is-large star is-half"></i>
|
||||
<i class="nes-icon is-large star is-transparent"></i>
|
||||
<i class="nes-icon is-large star is-empty"></i>
|
||||
|
||||
<!-- like -->
|
||||
<i class="nes-icon is-large like"></i>
|
||||
<i class="nes-icon is-large like is-empty"></i>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'sns-icons',
|
||||
showCode: false,
|
||||
description:
|
||||
'If you wanto to change icon size, please use "is-small", "is-medium" and "is-large".',
|
||||
code: `<section class="icon-list">
|
||||
<!-- twitter -->
|
||||
<i class="nes-icon twitter is-large"></i>
|
||||
|
||||
<!-- facebook -->
|
||||
<i class="nes-icon facebook is-large"></i>
|
||||
|
||||
<!-- instagram -->
|
||||
<i class="nes-icon instagram is-large"></i>
|
||||
|
||||
<!-- github -->
|
||||
<i class="nes-icon github is-large"></i>
|
||||
|
||||
<!-- google -->
|
||||
<i class="nes-icon google is-large"></i>
|
||||
|
||||
<!-- gmail -->
|
||||
<i class="nes-icon gmail is-large"></i>
|
||||
|
||||
<!-- medium -->
|
||||
<i class="nes-icon medium is-large"></i>
|
||||
|
||||
<!-- linkedin -->
|
||||
<i class="nes-icon linkedin is-large"></i>
|
||||
|
||||
<!-- twitch -->
|
||||
<i class="nes-icon twitch is-large"></i>
|
||||
|
||||
<!-- youtube -->
|
||||
<i class="nes-icon youtube is-large"></i>
|
||||
|
||||
<!-- reddit -->
|
||||
<i class="nes-icon reddit is-large"></i>
|
||||
|
||||
<!-- whatsapp -->
|
||||
<i class="nes-icon whatsapp is-large"></i>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'other-icons',
|
||||
showCode: false,
|
||||
description:
|
||||
'If you wanto to change icon size, please use "is-small", "is-medium" and "is-large".',
|
||||
code: `<section class="icon-list">
|
||||
<!-- close -->
|
||||
<i class="nes-icon close is-large"></i>
|
||||
|
||||
<!-- trophy -->
|
||||
<i class="nes-icon trophy is-large"></i>
|
||||
|
||||
<!-- coin -->
|
||||
<i class="nes-icon coin is-large"></i>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'pixel-arts',
|
||||
showCode: false,
|
||||
code: `<section class="icon-list">
|
||||
<!-- controllers -->
|
||||
<i class="nes-logo"></i>
|
||||
<i class="nes-jp-logo"></i>
|
||||
<i class="snes-logo"></i>
|
||||
<i class="snes-jp-logo"></i>
|
||||
|
||||
<!-- octocat -->
|
||||
<i class="nes-octocat animate"></i>
|
||||
|
||||
<!-- phone -->
|
||||
<i class="nes-smartphone"></i>
|
||||
<i class="nes-phone"></i>
|
||||
</section>`,
|
||||
},
|
||||
{
|
||||
title: 'Nintendo-characters',
|
||||
showCode: false,
|
||||
note:
|
||||
'Nintendo owns the copyright of these characters. Please comply with the Nintendo guidelines and laws of the applicable jurisdiction.',
|
||||
code: `<section class="icon-list">
|
||||
<!-- Copyright Nintendo -->
|
||||
<i class="nes-mario"></i>
|
||||
<i class="nes-ash"></i>
|
||||
<i class="nes-pokeball"></i>
|
||||
<i class="nes-bulbasaur"></i>
|
||||
<i class="nes-charmander"></i>
|
||||
<i class="nes-squirtle"></i>
|
||||
<i class="nes-kirby"></i>
|
||||
</section>`,
|
||||
},
|
||||
];
|
||||
|
||||
const coreteam = [
|
||||
{
|
||||
name: 'B.C.Rikko',
|
||||
feat: 'Creator of NES.css',
|
||||
github: 'BcRikko',
|
||||
twitter: 'bc_rikko',
|
||||
},
|
||||
{
|
||||
name: 'Igor Guastalla',
|
||||
feat: 'Development support',
|
||||
github: 'guastallaigor',
|
||||
twitter: 'guastallaigor',
|
||||
},
|
||||
];
|
||||
|
||||
const emeriti = [
|
||||
{
|
||||
name: 'Trezy',
|
||||
feat: 'Setup DevOps',
|
||||
github: 'trezy',
|
||||
twitter: 'TrezyCodes',
|
||||
},
|
||||
{
|
||||
name: 'Abdullah Samman',
|
||||
feat: 'Setup test suite',
|
||||
github: 'evexoio',
|
||||
twitter: 'evexoio',
|
||||
},
|
||||
];
|
||||
|
||||
// curl https://api.github.com/repos/nostalgic-css/NES.css/contributors | jq '.[].login'
|
||||
const contributors = [
|
||||
'4k1k0',
|
||||
'sombreroEnPuntas',
|
||||
'Divoolej',
|
||||
'soph-iest',
|
||||
'montezume',
|
||||
'sazzadsazib',
|
||||
'KeevanDance',
|
||||
'jdvivar',
|
||||
'IngwiePhoenix',
|
||||
'jjspace',
|
||||
'Baldomo',
|
||||
'DanSnow',
|
||||
'ernestomancebo',
|
||||
'Ilyeo',
|
||||
'Kartones',
|
||||
'rrj-dev',
|
||||
'vicainelli',
|
||||
'stewartrule',
|
||||
'kenshinji',
|
||||
'youngkaneda',
|
||||
'Takumi0901',
|
||||
'loo41',
|
||||
'alexgleason',
|
||||
'agarzola',
|
||||
'fleeting',
|
||||
'JamesIves',
|
||||
];
|
||||
|
||||
new Vue({
|
||||
el: '#nescss',
|
||||
data() {
|
||||
return {
|
||||
collection: sampleCollection,
|
||||
coreteam,
|
||||
emeriti,
|
||||
contributors,
|
||||
animateOctocat: false,
|
||||
copiedBalloon: {
|
||||
display: 'none',
|
||||
top: 0,
|
||||
left: 0,
|
||||
},
|
||||
scrollPos: 0,
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
capitalize(val) {
|
||||
if (!val) return '';
|
||||
val = val.toString();
|
||||
return val.charAt(0).toUpperCase() + val.slice(1);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
document.addEventListener('scroll', () => {
|
||||
this.scrollPos = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
});
|
||||
hljs.initHighlightingOnLoad();
|
||||
[].forEach.call(document.querySelectorAll('dialog'), (a) => {
|
||||
dialogPolyfill.registerDialog(a);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
Array.from(document.querySelectorAll('img.lazy')).forEach((img) => {
|
||||
img.src = img.dataset.src;
|
||||
img.classList.remove('lazy');
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
share(media) {
|
||||
const url = (() => {
|
||||
switch (media) {
|
||||
case 'twitter':
|
||||
return 'https://twitter.com/share?text=NES.css%EF%BD%9CNES-style%20CSS%20Framework%20%40bc_rikko&url=https://nostalgic-css.github.io/NES.css/';
|
||||
case 'facebook':
|
||||
return 'https://www.facebook.com/sharer.php?u=https://nostalgic-css.github.io/NES.css/&t=NES.css%EF%BD%9CNES-style%20CSS%20Framework';
|
||||
case 'linkedin':
|
||||
return 'https://www.linkedin.com/shareArticle?url=https%3A//nostalgic-css.github.io/NES.css/&title=NES.css%EF%BD%9CNES-style%20CSS%20Framework';
|
||||
case 'github':
|
||||
return 'https://github.com/nostalgic-css/NES.css';
|
||||
}
|
||||
})();
|
||||
|
||||
window.open(url, '');
|
||||
},
|
||||
copy(event, id) {
|
||||
this.showCopiedBalloon(event.pageY, event.pageX);
|
||||
|
||||
const fake = document.createElement('textarea');
|
||||
fake.value = this.collection.find(a => a.title === id).code;
|
||||
fake.setAttribute('readonly', '');
|
||||
Object.assign(fake.style, {
|
||||
position: 'absolute',
|
||||
left: '-9999px',
|
||||
});
|
||||
this.$el.appendChild(fake);
|
||||
fake.select();
|
||||
document.execCommand('copy');
|
||||
this.$el.removeChild(fake);
|
||||
},
|
||||
startAnimate() {
|
||||
this.animateOctocat = true;
|
||||
},
|
||||
stopAnimate() {
|
||||
this.animateOctocat = false;
|
||||
},
|
||||
showCopiedBalloon(top, left) {
|
||||
this.copiedBalloon = {
|
||||
display: 'block',
|
||||
top: `${top - 100}px`,
|
||||
left: `${left - 180}px`,
|
||||
};
|
||||
setTimeout(() => {
|
||||
this.copiedBalloon.display = 'none';
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
});
|
318
docs/style.css
Normal file
318
docs/style.css
Normal file
@@ -0,0 +1,318 @@
|
||||
@charset "utf-8";
|
||||
@import url(https://fonts.googleapis.com/css?family=Press+Start+2P);
|
||||
|
||||
body {
|
||||
padding: 0 2rem;
|
||||
margin: 0 2rem;
|
||||
}
|
||||
|
||||
#nescss > .container {
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
margin-top: 150px;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 9;
|
||||
border-bottom: 4px solid #D3D3D3;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
header > .container {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding-top: 1rem;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
header > .container > .nav-brand {
|
||||
margin-right: auto;
|
||||
}
|
||||
header > .container > .social-button {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.nav-brand .brand-logo {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
.nav-brand > a {
|
||||
color: #212529;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.social-buttons p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* Header-sticky */
|
||||
header.sticky > .container {
|
||||
font-size: 0.8rem;
|
||||
padding: 0;
|
||||
align-items: center;
|
||||
}
|
||||
header.sticky .nav-brand h1 {
|
||||
margin: 0;
|
||||
}
|
||||
header.sticky .nav-brand p {
|
||||
display: none;
|
||||
margin-bottom: 0;
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
|
||||
/* Main */
|
||||
.main-content {
|
||||
margin-bottom: 4rem;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
footer {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
footer a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h2 > a {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.topic {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
/* github link */
|
||||
.github-link {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
right: -240px;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
height: 100px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.github-link.active {
|
||||
right: 10px;
|
||||
}
|
||||
.github-link:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.github-link > p.nes-balloon {
|
||||
align-self: flex-start;
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
color: #333;
|
||||
}
|
||||
.github-link > i.nes-octocat {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
/* Showcase */
|
||||
section.showcase {
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
section.showcase > section.nes-container {
|
||||
padding-bottom: 2.5rem;
|
||||
}
|
||||
section.showcase > section.nes-container,
|
||||
section.showcase > section.samplecode {
|
||||
position: relative;
|
||||
}
|
||||
.nes-btn.showcode {
|
||||
position: absolute;
|
||||
font-size: 12px;
|
||||
bottom: 0px;
|
||||
right: -4px;
|
||||
}
|
||||
.nes-btn.copycode {
|
||||
position: absolute;
|
||||
font-size: 12px;
|
||||
top: 0;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
section.showcase > section.samplecode > pre code {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: -1rem;
|
||||
}
|
||||
.item > * {
|
||||
margin-bottom: 1.5rem !important;
|
||||
}
|
||||
|
||||
/* Containers */
|
||||
.item.containers > .nes-container {
|
||||
display: inline-block;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
/* Balloons sample */
|
||||
section.message-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.message-list > .message {
|
||||
display: flex;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
.message-list > .message > .nes-balloon {
|
||||
max-width: 550px;
|
||||
}
|
||||
.message-list > .message i {
|
||||
align-self: flex-end;
|
||||
}
|
||||
.message-list > .message.-left {
|
||||
align-self: flex-start;
|
||||
}
|
||||
.message-list > .message.-right {
|
||||
align-self: flex-end;
|
||||
}
|
||||
.message-list > .message.-left i {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
.message-list > .message.-right i {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
.icon-list > .blur-filter {
|
||||
filter: blur(10px);
|
||||
}
|
||||
|
||||
/* Copied balloon */
|
||||
.nes-balloon.copied-balloon {
|
||||
position: absolute;
|
||||
display: none;
|
||||
padding: 1rem;
|
||||
box-shadow: 0 5px 20px 5px rgba(0,0,0,.6);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Topic */
|
||||
h3.topic-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
h3.topic-title > i {
|
||||
margin-right: 1.5rem;
|
||||
}
|
||||
|
||||
/* coreteam */
|
||||
.coreteam-members {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.nes-container.member-card {
|
||||
display: flex;
|
||||
padding: 1rem 1.5rem;
|
||||
width: 470px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.member-card .avatar > img {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.member-card > .profile {
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
.member-card > .profile > .name {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* Contributors */
|
||||
.contributor {
|
||||
display: inline-block;
|
||||
margin: 1rem;
|
||||
text-align: center;
|
||||
width: 160px;
|
||||
}
|
||||
.contributor > p {
|
||||
margin: .5rem;
|
||||
font-size: 12px;
|
||||
}
|
||||
.contributor img.nes-avatar {
|
||||
transition: all .4s;
|
||||
display: inline-block;
|
||||
}
|
||||
.contributor:hover {
|
||||
text-decoration: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Articles */
|
||||
.article-link > .title a {
|
||||
color: #333;
|
||||
}
|
||||
.article-link > .title span {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
/* Scroll back to top */
|
||||
.scroll-btn {
|
||||
position: fixed;
|
||||
bottom: -60px;
|
||||
right: 2rem;
|
||||
box-shadow: 0 5px 20px rgba(0,0,0,.6);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.scroll-btn.active {
|
||||
bottom: 25px;
|
||||
}
|
||||
.scroll-btn > span {
|
||||
display: block;
|
||||
transform: rotateZ(90deg);
|
||||
}
|
||||
|
||||
.lazy {
|
||||
background-color: #006bb3;
|
||||
}
|
||||
|
||||
@media screen and (max-width: calc(980px - 4rem)) {
|
||||
header > .container {
|
||||
margin: 0 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
body {
|
||||
margin: 2rem 0.5rem;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
header > .container {
|
||||
margin: 0 0.5rem;
|
||||
}
|
||||
|
||||
.github-link {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.message-list > .message > .nes-balloon {
|
||||
max-width: 60%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 580px) {
|
||||
#nescss > .container {
|
||||
margin-top: 190px;
|
||||
}
|
||||
}
|
1085
index.html
1085
index.html
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -3,7 +3,7 @@
|
||||
"description": "NES.css is NES-style CSS Framework.",
|
||||
"scripts": {
|
||||
"watch": "npm run build:sass -- --watch",
|
||||
"//": "Build task",
|
||||
"// Build task": "",
|
||||
"build": "run-p build:core build:main",
|
||||
"build:core": "npm run build:sass-core && npm run build:autoprefix-core && npm run build:cleancss-core",
|
||||
"build:main": "npm run build:sass && npm run build:autoprefix && npm run build:cleancss",
|
||||
@@ -11,15 +11,15 @@
|
||||
"prebuild:stylelint": "npm run stylelint -- --fix",
|
||||
"prebuild:clean": "rimraf css",
|
||||
"postbuild": "npm run build:storybook",
|
||||
"//": "For nes.css",
|
||||
"// For nes.css": "",
|
||||
"build:sass": "node-sass --output-style expanded --source-map true --functions scripts/scssFunctions.js scss/nes.scss css/nes.css",
|
||||
"build:autoprefix": "postcss --use autoprefixer --map false --output css/nes.css css/nes.css",
|
||||
"build:cleancss": "cleancss -o css/nes.min.css css/nes.css",
|
||||
"//": "For nes-core.css",
|
||||
"// For nes-core.css": "",
|
||||
"build:sass-core": "node-sass --output-style expanded --source-map true --functions scripts/scssFunctions.js scss/nes-core.scss css/nes-core.css",
|
||||
"build:autoprefix-core": "postcss --use autoprefixer --map false --output css/nes-core.css css/nes-core.css",
|
||||
"build:cleancss-core": "cleancss -o css/nes-core.min.css css/nes-core.css",
|
||||
"//": "Misc",
|
||||
"// Misc": "",
|
||||
"stylelint": "stylelint scss/**/*.scss",
|
||||
"storybook": "start-storybook -p 6006",
|
||||
"build:storybook": "build-storybook",
|
||||
@@ -111,7 +111,7 @@
|
||||
"npm run postbuild"
|
||||
],
|
||||
"*.js": [
|
||||
"eslint '.storybook/**/*.js' 'docs/**/*.js'"
|
||||
"eslint '.storybook/**/*.js' 'story/**/*.js'"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
@@ -148,14 +148,14 @@
|
||||
"scss/at-rule-no-unknown": true
|
||||
},
|
||||
"ignoreFiles": [
|
||||
"demo/lib/*"
|
||||
"docs/*"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "airbnb-base"
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"demo/lib/*"
|
||||
"docs/*"
|
||||
],
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
Reference in New Issue
Block a user