From 156e609a92e7f7e7ebd8f4f5cd77b5d695db8bad Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Wed, 31 Jul 2019 20:54:16 -0400 Subject: [PATCH 01/12] feat: add the ability to disable Pattern Lab viewall links in the navigation --- .../uikit-workshop/.patternlabrc.example.js | 1 + .../src/scripts/components/pl-nav/pl-nav.js | 24 +++++++++++++------ packages/uikit-workshop/webpack.config.js | 8 +++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/uikit-workshop/.patternlabrc.example.js b/packages/uikit-workshop/.patternlabrc.example.js index becef019c..a6451d6fe 100644 --- a/packages/uikit-workshop/.patternlabrc.example.js +++ b/packages/uikit-workshop/.patternlabrc.example.js @@ -2,4 +2,5 @@ module.exports = { // buildDir: __dirname + '/www/pattern-lab', + noViewAll: true, // uncomment to disable displaying viewAll links in Pattern Lab }; diff --git a/packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js b/packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js index eb22dc888..0b719f204 100755 --- a/packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js +++ b/packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js @@ -12,12 +12,15 @@ const SubSubList = props => { const { children, category, elem } = props; const reorderedChildren = []; - const nonViewAllItems = children.filter( - item => - item.patternName !== 'View All' && !item.patternName.includes(' Docs') - ); - // const nonViewAllItems = children.filter((item => (item.patternName !== 'View All'))); - const viewAllItems = children.filter(item => item.patternName === 'View All'); + const nonViewAllItems = elem.noViewAll + ? children.filter(item => item.patternName !== 'View All') + : children.filter( + item => + item.patternName !== 'View All' && !item.patternName.includes(' Docs') + ); + const viewAllItems = elem.noViewAll + ? [] + : children.filter(item => item.patternName === 'View All'); reorderedChildren.push(...viewAllItems, ...nonViewAllItems); @@ -419,6 +422,10 @@ class Nav extends BaseComponent { ...props.boolean, ...{ default: true }, }, + noViewAll: { + ...props.boolean, + ...{ default: patternLab.noViewAll || false }, + }, }; toggleSpecialNavPanel(e) { @@ -542,7 +549,10 @@ class Nav extends BaseComponent { {patternItems && patternItems.map((patternItem, i) => { - return ( + return this.noViewAll && + patternItem.patternPartial.includes('viewall') ? ( + '' + ) : (
  • Date: Wed, 31 Jul 2019 20:54:44 -0400 Subject: [PATCH 02/12] chore: fresh uikit build --- packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js | 2 +- ...3fcee97.js => pl-modal-viewer-chunk-d9b4cef748f2dbb1ce74.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/uikit-workshop/dist/styleguide/js/{pl-modal-viewer-chunk-54c2aa66ee7ea3fcee97.js => pl-modal-viewer-chunk-d9b4cef748f2dbb1ce74.js} (100%) diff --git a/packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js b/packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js index 8688af85c..3d0cc1c96 100644 --- a/packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js +++ b/packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js @@ -1 +1 @@ -!function(e){function n(n){for(var t,i,a=n[0],l=n[1],u=n[3]||[],p=0,d=[];p= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js?")},"./node_modules/@babel/runtime/regenerator/index.js":function(module,exports,__webpack_require__){eval('module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/regenerator/index.js?')},"./node_modules/@reach/visually-hidden/es/index.js":function(module,__webpack_exports__,__webpack_require__){"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./src/scripts/utils/preact-compat.js");\n\nvar style = {\n border: 0,\n clip: "rect(0 0 0 0)",\n height: "1px",\n width: "1px",\n margin: "-1px",\n padding: 0,\n overflow: "hidden",\n position: "absolute"\n};\n/* harmony default export */ __webpack_exports__["default"] = (function (_ref) {\n var children = _ref.children;\n return react__WEBPACK_IMPORTED_MODULE_0__["default"].createElement("span", {\n style: style,\n children: children\n });\n});\n\n//# sourceURL=webpack:///./node_modules/@reach/visually-hidden/es/index.js?')},"./node_modules/@webcomponents/template/template.js":function(module,exports){eval("/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n// minimal template polyfill\n(function () {\n 'use strict';\n\n var needsTemplate = typeof HTMLTemplateElement === 'undefined';\n var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);\n var needsDocFrag = false; // NOTE: Replace DocumentFragment to work around IE11 bug that\n // causes children of a document fragment modified while\n // there is a mutation observer to not have a parentNode, or\n // have a broken parentNode (!?!)\n\n if (/Trident/.test(navigator.userAgent)) {\n (function () {\n needsDocFrag = true;\n var origCloneNode = Node.prototype.cloneNode;\n\n Node.prototype.cloneNode = function cloneNode(deep) {\n var newDom = origCloneNode.call(this, deep);\n\n if (this instanceof DocumentFragment) {\n newDom.__proto__ = DocumentFragment.prototype;\n }\n\n return newDom;\n }; // IE's DocumentFragment querySelector code doesn't work when\n // called on an element instance\n\n\n DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;\n DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;\n Object.defineProperties(DocumentFragment.prototype, {\n 'nodeType': {\n get: function get() {\n return Node.DOCUMENT_FRAGMENT_NODE;\n },\n configurable: true\n },\n 'localName': {\n get: function get() {\n return undefined;\n },\n configurable: true\n },\n 'nodeName': {\n get: function get() {\n return '#document-fragment';\n },\n configurable: true\n }\n });\n var origInsertBefore = Node.prototype.insertBefore;\n\n function insertBefore(newNode, refNode) {\n if (newNode instanceof DocumentFragment) {\n var child;\n\n while (child = newNode.firstChild) {\n origInsertBefore.call(this, child, refNode);\n }\n } else {\n origInsertBefore.call(this, newNode, refNode);\n }\n\n return newNode;\n }\n\n Node.prototype.insertBefore = insertBefore;\n var origAppendChild = Node.prototype.appendChild;\n\n Node.prototype.appendChild = function appendChild(child) {\n if (child instanceof DocumentFragment) {\n insertBefore.call(this, child, null);\n } else {\n origAppendChild.call(this, child);\n }\n\n return child;\n };\n\n var origRemoveChild = Node.prototype.removeChild;\n var origReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {\n if (newChild instanceof DocumentFragment) {\n insertBefore.call(this, newChild, oldChild);\n origRemoveChild.call(this, oldChild);\n } else {\n origReplaceChild.call(this, newChild, oldChild);\n }\n\n return oldChild;\n };\n\n Document.prototype.createDocumentFragment = function createDocumentFragment() {\n var frag = this.createElement('df');\n frag.__proto__ = DocumentFragment.prototype;\n return frag;\n };\n\n var origImportNode = Document.prototype.importNode;\n\n Document.prototype.importNode = function importNode(impNode, deep) {\n deep = deep || false;\n var newNode = origImportNode.call(this, impNode, deep);\n\n if (impNode instanceof DocumentFragment) {\n newNode.__proto__ = DocumentFragment.prototype;\n }\n\n return newNode;\n };\n })();\n } // NOTE: we rely on this cloneNode not causing element upgrade.\n // This means this polyfill must load before the CE polyfill and\n // this would need to be re-worked if a browser supports native CE\n // but not