Skip to content

Major UIKit Rendering Performance Improvements, Logo Customization, & LitElement Migration #1078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
344dd8e
chore: add currentColor to SVG icons before getting processed by Webpack
sghoweri Oct 19, 2019
c8886b6
feat: add support for optional chaining syntax via Babel plugin
sghoweri Oct 19, 2019
611f705
feat: add lit-element, basic Typescript support to Webpack
sghoweri Oct 19, 2019
94b9d20
refactor: update Search to reduce it's size when the Header runs out …
sghoweri Oct 20, 2019
0eda431
feat: update the Nav design to not bold the active item in order to n…
sghoweri Oct 20, 2019
ea95de9
refactor: allow the Nav to shrink in size if the available space is c…
sghoweri Oct 20, 2019
e8ce2a9
feat: add new <pl-icon> component
sghoweri Oct 20, 2019
5e7b014
feat: add new <pl-button> component to make Button-like styles more r…
sghoweri Oct 20, 2019
28d47eb
feat: refactor Drawer to render via lit-element + massively improve r…
sghoweri Oct 20, 2019
2ed70e7
feat: update Webpack config to use the latest Style Loader + new SVG …
sghoweri Oct 20, 2019
aff1777
refactor: update Logo component to allow deeper customizations + swit…
sghoweri Oct 20, 2019
46009d9
feat: refactor + convert pl-toggle-layout to lit-element
sghoweri Oct 20, 2019
95a3b21
feat: refactor + convert pl-toggle-theme to lit-element
sghoweri Oct 20, 2019
85cd9c5
feat: refactor + convert pl-toggle-info to lit-element
sghoweri Oct 20, 2019
3c5a9a7
chore: remove old versions of refactored / converted components
sghoweri Oct 20, 2019
9e1c3e7
refactor: convert Header to render via lit-html
sghoweri Oct 20, 2019
447f054
refactor: clean up Nav styles + use new <pl-icon> component; keep usi…
sghoweri Oct 20, 2019
9d602fe
feat: add support for auto-closing Nav when clicking inside of the re…
sghoweri Oct 20, 2019
80d1fe8
refactor: update Tools Menu to use new <pl-button> and <pl-icon> comp…
sghoweri Oct 20, 2019
395dd2c
refactor: update Webpack config to not calculate Critical CSS while d…
sghoweri Oct 20, 2019
9ed1c39
refactor: update Viewport to render using lit-html
sghoweri Oct 20, 2019
4f9b281
refactor: switch over to using new <pl-icon> component
sghoweri Oct 20, 2019
622ed76
feat: remove mixin that was causing outlines to be removed from defau…
sghoweri Oct 20, 2019
c0a902b
chore: style cleanup
sghoweri Oct 20, 2019
c16e963
refactor: update entrypoint to now import all components that are lis…
sghoweri Oct 20, 2019
1e9f173
refactor: add new SVG icons that are no longer getting hard-coded ins…
sghoweri Oct 20, 2019
63b9d83
feat: add local copy of new Slotify library till published to NPM
sghoweri Oct 20, 2019
34de61c
feat: temp add unsafe-svg directive till upstream PR merged
sghoweri Oct 20, 2019
69a11a8
refactor: temporarily disable loading up Shadow DOM polyfills since n…
sghoweri Oct 20, 2019
bd1c32c
chore: fresh uikit build
sghoweri Oct 20, 2019
72613c5
refactor: clean up console logs + add ability to close context menu v…
sghoweri Oct 20, 2019
f7fabb3
chore: fresh uikit build
sghoweri Oct 20, 2019
593bf3d
Merge branch 'dev' into feature/uikit-refactor-and-enhancements
sghoweri Oct 20, 2019
7c1d8d1
fix(deploy): add setup command
bmuenzenmeyer Oct 21, 2019
c95a06e
fix: add missing $
sghoweri Oct 21, 2019
54cf64a
chore: fresh uikit build
sghoweri Oct 21, 2019
fbf9c48
Merge commit '3f89dda1685874e251f9777f969c0943e0080881'
bolt-bot Oct 22, 2019
e9536cd
Merge branch 'dev' into feature/uikit-refactor-and-enhancements
sghoweri Nov 2, 2019
2ff8e1c
feat: major refactoring + UI updates to address cross browser support…
sghoweri Nov 3, 2019
7147085
fix: update drawer UI to not collapse content on smaller screen sizes
sghoweri Nov 4, 2019
435243c
fix: temp workaround to fix content exceeding the height of drawer co…
sghoweri Nov 4, 2019
da3c5f1
fix: fix classname typo
sghoweri Nov 4, 2019
41b11af
fix: address bug causing viewport width to progressively decrease in …
sghoweri Nov 4, 2019
a7dc8cb
chore: increase viewport resize transition speed + remove 3D transfor…
sghoweri Nov 4, 2019
dab9b8c
chore: add missing @pattern-lab/uikit-polyfills dependency to the mai…
sghoweri Nov 4, 2019
ade34a2
fix: configure the Logo's `altText` config option when used as an HTM…
sghoweri Nov 5, 2019
22fc44a
fix: update package.json description in `@pattern-lab/uikit-polyfills`
sghoweri Nov 5, 2019
e285e78
Merge branch 'dev' into feature/uikit-refactor-and-enhancements
bmuenzenmeyer Nov 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions packages/uikit-polyfills/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

/*
* Polyfills loaded: HTML Imports, Custom Elements, platform polyfills, template
* Used in: IE 11
*/

import 'regenerator-runtime/runtime';
import '@webcomponents/template/template.js';
import 'core-js/modules/es.array.find';

import 'element-closest';
import 'core-js/modules/es.string.includes';
import 'core-js/modules/es.array.includes';
// import 'core-js/modules/es.array.from';
// import 'core-js/modules/es.object.assign';

import './platform/remove-polyfill.js';
import './platform/es6-misc';
import './platform/custom-event';
import './platform/promise';
import './platform/symbol';
import './platform/flag-parser';
// import '@webcomponents/custom-elements/src/custom-elements.js';

import '@webcomponents/custom-elements/src/custom-elements.js';

// import 'document-register-element';
// by default, the second argument is 'auto'
// but it could be also 'force'
// which ignores feature detection and force
// the polyfill version of CustomElements
// installCE(global, 'auto');

import '@webcomponents/url/url.js';
import './platform/baseuri';
import './platform/unresolved';

import 'core-js/modules/es.array.for-each';

if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}

// import 'core-js/modules/es.string.trim-end';
// import 'core-js/modules/es.string.trim-start';
// import 'core-js/modules/es.string.code-point-at';
// import 'core-js/modules/es.number.is-nan';
26 changes: 26 additions & 0 deletions packages/uikit-polyfills/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@pattern-lab/uikit-polyfills",
"version": "0.0.0",
"description": "Web Component Polyfills used in Pattern Lab's UIKit",
"main": "index.js",
"author": "Salem Ghoweri <me@salemghoweri.com>",
"license": "MIT",
"dependencies": {
"@ungap/weakset": "^0.1.5",
"@webcomponents/custom-elements": "^1.3.0",
"@webcomponents/shadycss": "^1.9.2",
"@webcomponents/shadydom": "^1.6.1",
"@webcomponents/template": "^1.4.1",
"@webcomponents/url": "^0.7.4",
"@webcomponents/webcomponentsjs": "^2.3.0",
"core-js": "^3.3.6",
"custom-event-polyfill": "^1.0.7",
"document-register-element": "^1.14.3",
"es6-promise": "^4.2.8",
"get-own-property-symbols": "^0.9.3",
"promise-polyfill": "^8.0.0"
},
"publishConfig": {
"access": "public"
}
}
39 changes: 39 additions & 0 deletions packages/uikit-polyfills/platform/baseuri.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
@license
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

export {};

// Implement Node.baseURI for IE 11
// adapted from
// https://github.com/webcomponents/html-imports/blob/v1.2.0/src/html-imports.js

/** @type {Object|undefined} */
const nativeBaseURI = Object.getOwnPropertyDescriptor(
Node.prototype,
'baseURI'
);
if (!nativeBaseURI) {
Object.defineProperty(Node.prototype, 'baseURI', {
/**
* @this {Node}
* @return {string}
*/
get() {
// this.ownerDocument is `null` for documents
const doc = this.ownerDocument || this;
const base = /** @type {HTMLBaseElement} */ (doc.querySelector(
'base[href]'
));
return (base && base.href) || window.location.href;
},
configurable: true,
enumerable: true,
});
}
122 changes: 122 additions & 0 deletions packages/uikit-polyfills/platform/custom-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

(function() {
// defaultPrevented is broken in IE.
// https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called
const workingDefaultPrevented = (function() {
const e = document.createEvent('Event');
e.initEvent('foo', true, true);
e.preventDefault();
return e.defaultPrevented;
})();

if (!workingDefaultPrevented) {
const origPreventDefault = Event.prototype.preventDefault;
Event.prototype.preventDefault = function() {
if (!this.cancelable) {
return;
}

origPreventDefault.call(this);

Object.defineProperty(this, 'defaultPrevented', {
get() {
return true;
},
configurable: true,
});
};
}

const isIE = /Trident/.test(navigator.userAgent);

// Event constructor shim
if (!window.Event || (isIE && typeof window.Event !== 'function')) {
const origEvent = window.Event;
/**
* @param {!string} inType
* @param {?(EventInit)=} params
*/
window.Event = function(inType, params) {
params = params || {};
const e = document.createEvent('Event');
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
return e;
};
if (origEvent) {
for (const i in origEvent) {
window.Event[i] = origEvent[i];
}
window.Event.prototype = origEvent.prototype;
}
}

// CustomEvent constructor shim
if (
!window.CustomEvent ||
(isIE && typeof window.CustomEvent !== 'function')
) {
/**
* @template T
* @param {!string} inType
* @param {?(CustomEventInit<T>)=} params
*/
window.CustomEvent = function(inType, params) {
params = params || {};
const e = document.createEvent('CustomEvent');
e.initCustomEvent(
inType,
Boolean(params.bubbles),
Boolean(params.cancelable),
params.detail
);
return e;
};
window.CustomEvent.prototype = window.Event.prototype;
}

if (!window.MouseEvent || (isIE && typeof window.MouseEvent !== 'function')) {
const origMouseEvent = window.MouseEvent;
/**
*
* @param {!string} inType
* @param {?(MouseEventInit)=} params
*/
window.MouseEvent = function(inType, params) {
params = params || {};
const e = document.createEvent('MouseEvent');
e.initMouseEvent(
inType,
Boolean(params.bubbles),
Boolean(params.cancelable),
params.view || window,
params.detail,
params.screenX,
params.screenY,
params.clientX,
params.clientY,
params.ctrlKey,
params.altKey,
params.shiftKey,
params.metaKey,
params.button,
params.relatedTarget
);
return e;
};
if (origMouseEvent) {
for (const j in origMouseEvent) {
window.MouseEvent[j] = origMouseEvent[j];
}
}
window.MouseEvent.prototype = origMouseEvent.prototype;
}
})();
38 changes: 38 additions & 0 deletions packages/uikit-polyfills/platform/es6-misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

(function() {
if (!Array.from) {
Array.from = function(object) {
return [].slice.call(/** @type {IArrayLike} */ (object));
};
}

if (!Object.assign) {
const assign = function(target, source) {
const n$ = Object.getOwnPropertyNames(source);
for (var i = 0, p; i < n$.length; i++) {
p = n$[i];
target[p] = source[p];
}
};

Object.assign = function(target) {
const args = [].slice.call(arguments, 1);
for (var i = 0, s; i < args.length; i++) {
s = args[i];
if (s) {
assign(target, s);
}
}
return target;
};
}
})();
69 changes: 69 additions & 0 deletions packages/uikit-polyfills/platform/flag-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* eslint-disable no-restricted-globals */
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

export {};

// Establish scope.
window.WebComponents = window.WebComponents || { flags: {} };

// loading script
const file = 'webcomponents-bundle';
const script = document.querySelector(`script[src*="${file}"]`);
const flagMatcher = /wc-(.+)/;

// Flags. Convert url arguments to flags
const flags = {};
if (!flags.noOpts) {
// from url
location.search
.slice(1)
.split('&')
.forEach(option => {
const parts = option.split('=');
let match;
if (parts[0] && (match = parts[0].match(flagMatcher))) {
flags[match[1]] = parts[1] || true;
}
});
// from script
if (script) {
for (let i = 0, a; (a = script.attributes[i]); i++) {
if (a.name !== 'src') {
flags[a.name] = a.value || true;
}
}
}
// log flags
if (flags.log && flags.log.split) {
const parts = flags.log.split(',');
flags.log = {};
parts.forEach(f => {
flags.log[f] = true;
});
} else {
flags.log = {};
}
}

// exports
window.WebComponents.flags = flags;
const forceShady = flags.shadydom;
if (forceShady) {
window.ShadyDOM = window.ShadyDOM || {};
window.ShadyDOM.force = forceShady;
const { noPatch } = flags;
window.ShadyDOM.noPatch = noPatch === 'true' ? true : noPatch;
}

const forceCE = flags.register || flags.ce;
if (forceCE && window.customElements) {
window.customElements.forcePolyfill = forceCE;
}
Loading