Skip to content
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

refactor(*): refactor imports, exports, and jsdocs #309

Merged
merged 1 commit into from
Aug 17, 2018
Merged

Conversation

CITguy
Copy link
Contributor

@CITguy CITguy commented Aug 11, 2018

JIRA: n/a (2018-08-10 free friday)

LGTM's

  • Dev LGTM
  • Zoom LGTM

Before

  • Requires importing helix-ui as a namespace to consume
  • HelixUI exports can be verbose to consume
  • elements namespace looks more like a property
import HelixUI from 'helix-ui';

const ICON_NAMES = Object.keys(HelixUI.ICONS);

class MyElement extends HelixUI.elements.HXElement { ... }

HelixUI.initialize();

After

  • Importing helix-ui as a namespace is optional. You could import individual items.
  • elements renamed to Elements to better communicate it as a namespace (breaking change)
  • New Utils namespace

Option 1: import module as namespace (retain status quo)

import * as HelixUI from 'helix-ui';

const ICON_NAMES = Object.keys(HelixUI.ICONS);
const KEY_MAP = Utils.KEYS;

class MyElement extends HelixUI.Elements.HXElement { ... }

HelixUI.initialize();

Option 2: import module items separately

import { initialize, ICONS, Elements, Utils } from 'helix-ui';

initialize();

const ICON_NAMES = Object.keys(ICONS);
const KEY_MAP = Utils.KEYS;

class MyElement extends Elements.HXElement { ... }

@HelixUI
Copy link
Contributor

HelixUI commented Aug 11, 2018

Deploy preview for helix-ui ready!

Built with commit cdcfb4e

https://deploy-preview-309--helix-ui.netlify.com

@CITguy CITguy force-pushed the ff-20180810 branch 3 times, most recently from 33b91e2 to 64f7ad1 Compare August 11, 2018 21:15
@@ -38,70 +38,45 @@ let eslintPlugin = eslint({
],
});

// Intro/Outro placed INSIDE the applied dependency function
let intro = `window.addEventListener('WebComponentsReady', function () {`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Redundant to HelixUI.initialize() logic.

{
input: 'src/node-entry.js',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After refactoring, node-entry.js was providing nothing of value.

@@ -1,158 +0,0 @@
# Compatibility Notes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is no longer needed. More concise documentation was added to Guides > Polyfills in the docs.

minor,
patch,
};
VERSION.toString = () => { return SEMVER }; // eslint-disable-line
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨BREAKING CHANGE 🚨

HelixUI.VERSION changed from the complex object (seen above) to a string literal (line 3 to the right).

VERSION.toString = () => { return SEMVER }; // eslint-disable-line

export default {
elements,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨BREAKING CHANGE 🚨

Rename HelixUI.elements namespace to HelixUI.Elements. I doubt that anybody is using this API, but we'll be sure to announce the breaking change.

@@ -0,0 +1,28 @@
export { HXAccordionElement } from './HXAccordionElement';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • file moved from src/helix-ui/elements.js
  • simplified import paths from ./elements/<HXFileName>.js to ./<HXFileName>

@@ -1,169 +0,0 @@
import _account from './icons/account.svg';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File moved to src/helix-ui/icons/index.js with modified contents.

@@ -0,0 +1,169 @@
import _account from './account.svg';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified import paths from ./icons/<icon>.svg to ./<icon>.svg

import * as Elements from './elements';
export { version as VERSION } from '../../package.json';
export { default as ICONS } from './icons';
export { default as Utils } from './utils';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds HelixUI.Utils.* to generated JavaScript.

@@ -1,3 +0,0 @@
/** @module */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to src/helix-ui/util/index.js

@CITguy CITguy force-pushed the ff-20180810 branch 2 times, most recently from 4fd106b to 5f8e2f9 Compare August 12, 2018 19:11
CITguy pushed a commit that referenced this pull request Aug 14, 2018
* add documentation around `<hx-icon>` being an inline element
* add Shadow Markup for HXIconElement
* add Shadow Styles for HXIconElement
* remove unnecessary @imports for hx-icon styles
* remove unnecessary `fill-rule` attributes from SVG files
* remove HXIconElement.icons property (see #309)

Closes:
* SURF-1244 (inconsistent button heights w/ icons)
* SURF-1260 (multiple rendering of hx-icon)
* SURF-1293 (JSX: `<hx-error>`)
* SURF-1272 (JSX: Icons)
CITguy pushed a commit that referenced this pull request Aug 14, 2018
* add documentation around `<hx-icon>` being an inline element
* add Shadow Markup for HXIconElement
* add Shadow Styles for HXIconElement
* remove unnecessary @imports for hx-icon styles
* remove unnecessary `fill-rule` attributes from SVG files
* remove HXIconElement.icons property (see #309)
* update regression snapshots

Closes:
* SURF-1244 (inconsistent button heights w/ icons)
* SURF-1260 (multiple rendering of hx-icon)
* SURF-1293 (JSX: `<hx-error>`)
* SURF-1272 (JSX: Icons)
CITguy pushed a commit that referenced this pull request Aug 15, 2018
* add documentation around `<hx-icon>` being an inline element
* add Shadow Markup for HXIconElement
* add Shadow Styles for HXIconElement
* remove unnecessary @imports for hx-icon styles
* remove unnecessary `fill-rule` attributes from SVG files
* remove HXIconElement.icons property (see #309)
* update regression snapshots

Closes:
* SURF-1244 (inconsistent button heights w/ icons)
* SURF-1260 (multiple rendering of hx-icon)
* SURF-1293 (JSX: `<hx-error>`)
* SURF-1272 (JSX: Icons)
* SURF-1114 (focus style of "X" in `<hx-search>`)
CITguy pushed a commit that referenced this pull request Aug 15, 2018
* add documentation around `<hx-icon>` being an inline element
* add Shadow Markup for HXIconElement
* add Shadow Styles for HXIconElement
* remove unnecessary @imports for hx-icon styles
* remove unnecessary `fill-rule` attributes from SVG files
* remove HXIconElement.icons property (see #309)
* update regression snapshots

Closes:
* SURF-1224 (inconsistent button heights w/ icons)
* SURF-1260 (multiple rendering of hx-icon)
* SURF-1293 (JSX: `<hx-error>`)
* SURF-1272 (JSX: Icons)
* SURF-1114 (focus style of "X" in `<hx-search>`)
@CITguy

This comment has been minimized.

CITguy pushed a commit that referenced this pull request Aug 17, 2018
* add documentation around `<hx-icon>` being an inline element
* add Shadow Markup for HXIconElement
* add Shadow Styles for HXIconElement
* remove unnecessary @imports for hx-icon styles
* remove unnecessary `fill-rule` attributes from SVG files
* remove HXIconElement.icons property (see #309)
* update regression snapshots

Closes:
* SURF-1224 (inconsistent button heights w/ icons)
* SURF-1260 (multiple rendering of hx-icon)
* SURF-1293 (JSX: `<hx-error>`)
* SURF-1272 (JSX: Icons)
* SURF-1114 (focus style of "X" in `<hx-search>`)
@CITguy CITguy force-pushed the ff-20180810 branch 2 times, most recently from ad2558a to 90fa31d Compare August 17, 2018 15:36
export default {
KEYS,
Position,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the onScroll as well

* (because 'scroll' events do not bubble).
*
* The event is dispatched from the `document` object, instead of bubbling from
* the oritinal element, to avoid interfering with 'scroll' event listeners
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original element

* add `HelixUI.Utils` namespace
* refactor utils to better adhere to ES6 module format
* remove redundant `src/COMPATIBILITY.md` documentation
* remove redundant initialization logic from `helix-ui.browser[.min].js`
* remove unnecessary `node-entry.js`
* normalize all import paths to use the Node ES6 format (no `.js` extensions)

BREAKING:
* rename `HelixUI.elements` namespace to `HelixUI.Elements`
* convert `HelixUI.VERSION` from an object to a string literal
Copy link
Contributor

@cathysiller cathysiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zoom lgtm

@100stacks
Copy link
Member

Dev LGTM

@CITguy CITguy merged commit ce1cef9 into master Aug 17, 2018
@CITguy CITguy deleted the ff-20180810 branch August 17, 2018 17:50
@CITguy CITguy mentioned this pull request Aug 21, 2018
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants