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

feat(cxl-ui): migrate to lit #160

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"karma-webpack": "^4.0.0-rc.5",
"lerna": "^3.20.1",
"lint-staged": "^10.5.3",
"lit-html": "^2.0.0-rc.3",
"mocha": "^6.1.4",
"node-watch": "^0.7.1",
"npm-run-all": "^4.1.5",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"directory": "packages/core"
},
"dependencies": {
"lit-element": "^2.0.1",
"lit-html": "^2.0.0-rc.3"
"lit": "^2.0.0-rc.2"
},
"devDependencies": {
"@aybolit/test-helpers": "^0.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html } from 'lit-element';
import { LitElement, html } from 'lit';
import { DelegateFocusMixin } from '../mixins/delegate-focus-mixin.js';
import buttonBaseStyles from '../styles/button-base-css.js';

Expand All @@ -10,8 +10,8 @@ export class ButtonElement extends DelegateFocusMixin(LitElement) {
*/
link: {
type: String,
reflect: true
}
reflect: true,
},
};
}

Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/components/checkbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html } from 'lit-element';
import { LitElement, html } from 'lit';
import { DelegateFocusMixin } from '../mixins/delegate-focus-mixin.js';
import checkboxBaseStyles from '../styles/checkbox-base-css.js';

Expand All @@ -12,7 +12,7 @@ export class CheckboxElement extends DelegateFocusMixin(LitElement) {
*/
checked: {
type: Boolean,
reflect: true
reflect: true,
},

/**
Expand All @@ -21,16 +21,16 @@ export class CheckboxElement extends DelegateFocusMixin(LitElement) {
*/
indeterminate: {
type: Boolean,
reflect: true
reflect: true,
},

/**
* The value given to the data submitted with the name
* to the server when the checkbox is inside a form.
*/
value: {
reflect: true
}
reflect: true,
},
};
}

Expand Down Expand Up @@ -105,7 +105,7 @@ export class CheckboxElement extends DelegateFocusMixin(LitElement) {
}
this.dispatchEvent(
new CustomEvent('checked-changed', {
detail: { value: checked }
detail: { value: checked },
})
);
}
Expand All @@ -127,10 +127,10 @@ export class CheckboxElement extends DelegateFocusMixin(LitElement) {
// into the ancestor tree, so we must do this manually.
const changeEvent = new CustomEvent('change', {
detail: {
sourceEvent: e
sourceEvent: e,
},
bubbles: e.bubbles,
cancelable: e.cancelable
cancelable: e.cancelable,
});
this.dispatchEvent(changeEvent);
}
Expand Down
14 changes: 6 additions & 8 deletions packages/core/src/components/progress.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html } from 'lit-element';
import { ifDefined } from 'lit-html/directives/if-defined';
import { LitElement, html } from 'lit';
import { ifDefined } from 'lit/directives/if-defined';
import progressBaseStyles from '../styles/progress-base-css.js';

export class ProgressElement extends LitElement {
Expand All @@ -10,16 +10,16 @@ export class ProgressElement extends LitElement {
* or empty string to set indeterminate state.
*/
value: {
type: Number
type: Number,
},

/**
* Maximum bound to the native progress element.
* Note: the minimum value is always 0.
*/
max: {
type: Number
}
type: Number,
},
};
}

Expand All @@ -39,8 +39,6 @@ export class ProgressElement extends LitElement {
if (value === null || value === '') {
value = undefined;
}
return html`
<progress value="${ifDefined(value)}" max="${this.max}"></progress>
`;
return html` <progress value="${ifDefined(value)}" max="${this.max}"></progress> `;
}
}
24 changes: 12 additions & 12 deletions packages/core/src/components/range.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { LitElement, html } from 'lit-element';
import { ifDefined } from 'lit-html/directives/if-defined';
import { LitElement, html } from 'lit';
import { ifDefined } from 'lit/directives/if-defined';
import { DelegateFocusMixin } from '../mixins/delegate-focus-mixin.js';
import rangeBaseStyles from '../styles/range-base-css.js';

const isNumeric = n => !isNaN(parseFloat(n)) && isFinite(n);
const isNumeric = (n) => !isNaN(parseFloat(n)) && isFinite(n);

export class RangeElement extends DelegateFocusMixin(LitElement) {
static get properties() {
return {
value: {
type: Number
type: Number,
},

min: {
type: Number
type: Number,
},

max: {
type: Number
type: Number,
},

step: {
type: Number
}
type: Number,
},
};
}

Expand Down Expand Up @@ -98,8 +98,8 @@ export class RangeElement extends DelegateFocusMixin(LitElement) {
this.dispatchEvent(
new CustomEvent('value-changed', {
detail: {
value: this.value
}
value: this.value,
},
})
);
}
Expand All @@ -114,10 +114,10 @@ export class RangeElement extends DelegateFocusMixin(LitElement) {
// into the ancestor tree, so we must do this manually.
const changeEvent = new CustomEvent('change', {
detail: {
sourceEvent: e
sourceEvent: e,
},
bubbles: e.bubbles,
cancelable: e.cancelable
cancelable: e.cancelable,
});
this.dispatchEvent(changeEvent);
}
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/components/switch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html } from 'lit-element';
import { LitElement, html } from 'lit';
import { DelegateFocusMixin } from '../mixins/delegate-focus-mixin.js';
import switchBaseStyles from '../styles/switch-base-css.js';

Expand All @@ -10,8 +10,8 @@ export class SwitchElement extends DelegateFocusMixin(LitElement) {
*/
checked: {
type: Boolean,
reflect: true
}
reflect: true,
},
};
}

Expand Down Expand Up @@ -64,7 +64,7 @@ export class SwitchElement extends DelegateFocusMixin(LitElement) {
this.setAttribute('aria-checked', checked);
this.dispatchEvent(
new CustomEvent('checked-changed', {
detail: { value: checked }
detail: { value: checked },
})
);
}
Expand All @@ -77,10 +77,10 @@ export class SwitchElement extends DelegateFocusMixin(LitElement) {
// into the ancestor tree, so we must do this manually.
const changeEvent = new CustomEvent('change', {
detail: {
sourceEvent: e
sourceEvent: e,
},
bubbles: e.bubbles,
cancelable: e.cancelable
cancelable: e.cancelable,
});
this.dispatchEvent(changeEvent);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cxl-lumo-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@polymer/iron-iconset-svg": "^3.0.1",
"@vaadin/vaadin-lumo-styles": "^1.5.0",
"@vaadin/vaadin-themable-mixin": "^1.5.2",
"lit-element": "^2.2.1",
"lit-html": "^2.0.0-rc.3"
"lit": "^2.0.0-rc.2",
"lit-element": "^2.2.1"
}
}
3 changes: 1 addition & 2 deletions packages/cxl-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"@vaadin/vaadin-tabs": "^4.0.0-alpha4",
"@vaadin/vaadin-themable-mixin": "^1.6.2",
"headroom.js": "^0.12.0",
"lit-element": "^2.2.1",
"lit-html": "^2.0.0-rc.3"
"lit": "^2.0.0-rc.2"
},
"@pika/pack": {
"pipeline": [
Expand Down
2 changes: 1 addition & 1 deletion packages/cxl-ui/src/components/cxl-accordion-card.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { customElement } from 'lit-element';
import { customElement } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import { AccordionPanelElement } from '@vaadin/vaadin-accordion/src/vaadin-accordion-panel';

Expand Down
3 changes: 2 additions & 1 deletion packages/cxl-ui/src/components/cxl-app-layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @todo implement primary action button.
*/
import { LitElement, html, customElement, property, query } from 'lit-element';
import { LitElement, html } from 'lit';
import { customElement, property, query } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import cxlAppLayoutStyles from '../styles/cxl-app-layout-css.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/cxl-ui/src/components/cxl-card.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { customElement, LitElement, html } from 'lit-element';
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import cxlCardGlobalStyles from '../styles/global/cxl-card-css.js';
Expand Down
8 changes: 4 additions & 4 deletions packages/cxl-ui/src/components/cxl-marketing-nav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LitElement, html, customElement, property, query } from 'lit-element';
import { LitElement, html } from 'lit';
import { customElement, property, query } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import cxlMarketingNavStyles from '../styles/cxl-marketing-nav-css.js';
Expand Down Expand Up @@ -132,9 +133,8 @@ export class CXLMarketingNavElement extends LitElement {
/**
* Configure `.menu-item-search`.
*/
const menuItemSearchContextMenu = this.menuItemSearchElement.querySelector(
'vaadin-context-menu'
);
const menuItemSearchContextMenu =
this.menuItemSearchElement.querySelector('vaadin-context-menu');

/**
* `<vaadin-context-menu-item>` interferes with form input.
Expand Down
3 changes: 2 additions & 1 deletion packages/cxl-ui/src/components/cxl-section.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LitElement, customElement, html, svg } from 'lit-element';
import { LitElement, html, svg } from 'lit';
import { customElement } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import cxlSectionStyles from '../styles/cxl-section-css';

Expand Down
2 changes: 1 addition & 1 deletion packages/cxl-ui/src/components/cxl-tabs-slider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@conversionxl/cxl-lumo-styles';
import { TabsElement } from '@vaadin/vaadin-tabs';
import { customElement } from 'lit-element';
import { customElement } from 'lit/decorators';

@customElement('cxl-tabs-slider')
export class CXLTabsSliderElement extends TabsElement {
Expand Down
2 changes: 1 addition & 1 deletion packages/cxl-ui/src/components/cxl-vaadin-accordion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { customElement } from 'lit-element';
import { customElement } from 'lit/decorators';
import '@conversionxl/cxl-lumo-styles';
import '@vaadin/vaadin-accordion';
import { AccordionElement } from '@vaadin/vaadin-accordion/src/vaadin-accordion';
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/cxl-lumo-styles/elements.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@conversionxl/cxl-lumo-styles';
import '@vaadin/vaadin-button';
import '@vaadin/vaadin-notification';
import { html } from 'lit-html';
import { html } from 'lit';
import cxlLoadingStyles from '@conversionxl/cxl-lumo-styles/src/styles/loading-css.js';
import { CXLAppLayout } from '../cxl-ui/cxl-app-layout/layout=1c.stories';

Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/cxl-lumo-styles/typography.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@conversionxl/cxl-lumo-styles';
import '@vaadin/vaadin-button';
import { withKnobs } from '@storybook/addon-knobs';
import { html } from 'lit-html';
import { html } from 'lit';

export default {
decorators: [withKnobs],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import { withKnobs, boolean } from '@storybook/addon-knobs';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import { withKnobs, boolean } from '@storybook/addon-knobs';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-card.js';
import '@conversionxl/cxl-lumo-styles';

Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/cxl-ui/cxl-marketing-nav.stories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from 'lit-html';
import { html } from 'lit';
import { useEffect } from '@storybook/client-api';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import { Headroom } from '@conversionxl/cxl-ui';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@conversionxl/cxl-ui/src/components/cxl-card';
import '@conversionxl/cxl-ui/src/components/cxl-tabs-slider';
import { html } from 'lit-html';
import { html } from 'lit';
import { CXLTestimonial } from '../cxl-card/[theme=cxl-testimonial].stories';
import archiveData from '../cxl-vaadin-accordion/theme=cxl-archive.data.json';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html } from 'lit-html';
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
import { html } from 'lit';
import { unsafeHTML } from 'lit/directives/unsafe-html';
import '@conversionxl/cxl-ui/src/components/cxl-vaadin-accordion.js';
import '@conversionxl/cxl-ui/src/components/cxl-accordion-card.js';
import archiveData from './theme=cxl-archive.data.json';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html } from 'lit-html';
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
import { html } from 'lit';
import { unsafeHTML } from 'lit/directives/unsafe-html';
import '@conversionxl/cxl-ui/src/components/cxl-vaadin-accordion.js';
import faqData from './theme=cxl-faq.data.json';

Expand Down
Loading