diff --git a/core/pfe-core/controllers/test/combobox-controller.spec.ts b/core/pfe-core/controllers/test/combobox-controller.spec.ts index 6bf92712db..1ab72c28a6 100644 --- a/core/pfe-core/controllers/test/combobox-controller.spec.ts +++ b/core/pfe-core/controllers/test/combobox-controller.spec.ts @@ -2,7 +2,7 @@ import { expect, fixture, nextFrame } from '@open-wc/testing'; import { sendKeys } from '@web/test-runner-commands'; import { a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { query } from 'lit/decorators/query.js'; import { ReactiveElement, html, render, type PropertyValues, type TemplateResult } from 'lit'; diff --git a/core/pfe-core/decorators/custom-element.ts b/core/pfe-core/decorators/custom-element.ts new file mode 100644 index 0000000000..286ded22c3 --- /dev/null +++ b/core/pfe-core/decorators/custom-element.ts @@ -0,0 +1,61 @@ +import type { Constructor } from '@lit/reactive-element/decorators/base.js'; +import type { CustomElementDecorator } from '@lit/reactive-element/decorators/custom-element.js'; + +/** + * Allow for custom element classes with private constructors + */ +type CustomElementClass = Omit; + +/** + * Helper to define a custom element with gracefull error + * handling for duplicate definition. + */ +function defineElement(tagName: string, classOrTarget: CustomElementConstructor) { + try { + customElements.define( + tagName, + classOrTarget + ); + } catch (e) { + if (e instanceof Error) { + if (e.message.includes('has already been used with this registry')) { + console.warn(`Duplicate definition for [${tagName}].`, e); + return; + } + } + throw e; + } +} + +/** + * Class decorator factory that defines the decorated class as a custom element. + * Allows duplicate custom element definitions to fail gracefully with a console + * warn rather than an unhandled error for duplicate definitions. + * + * + * ```js + * @customElement('my-element') + * class MyElement extends LitElement { + * render() { + * return html``; + * } + * } + * ``` + * @category Decorator + * @param tagName The tag name of the custom element to define. + */ +export const customElement = + (tagName: string): CustomElementDecorator => + ( + classOrTarget: CustomElementClass | Constructor, + context?: ClassDecoratorContext> + ) => { + if (context !== undefined) { + context.addInitializer(() => { + defineElement(tagName, classOrTarget as CustomElementConstructor); + }); + } else { + defineElement(tagName, classOrTarget as CustomElementConstructor); + } + }; + diff --git a/core/pfe-core/package.json b/core/pfe-core/package.json index af2e498e33..9bf6dec8ac 100644 --- a/core/pfe-core/package.json +++ b/core/pfe-core/package.json @@ -42,6 +42,7 @@ "./decorators/initializer.js": "./decorators/initializer.js", "./decorators/observed.js": "./decorators/observed.js", "./decorators/observes.js": "./decorators/observes.js", + "./decorators/custom-element.js": "./decorators/custom-element.js", "./decorators/time.js": "./decorators/time.js", "./decorators/trace.js": "./decorators/trace.js", "./functions/arraysAreEquivalent.js": "./functions/arraysAreEquivalent.js", diff --git a/docs/docs/develop/javascript.md b/docs/docs/develop/javascript.md index 5744bfc3a3..169c6de7a3 100644 --- a/docs/docs/develop/javascript.md +++ b/docs/docs/develop/javascript.md @@ -64,7 +64,7 @@ In TypeScript, lit observed properties are defined using either the `@property() or the `@state()` decorator (for private or internal properties). Add the property import statement. ```ts -import { customElement } from 'lit/decorators/custom-element.js' +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js' import { property } from 'lit/decorators/property.js' ``` @@ -190,7 +190,7 @@ For your reference, here's the final Javascript code for `pf-cool-element`: ```ts import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/docs/docs/develop/structure.md b/docs/docs/develop/structure.md index 51d3190a26..b95b13b479 100644 --- a/docs/docs/develop/structure.md +++ b/docs/docs/develop/structure.md @@ -48,7 +48,7 @@ Let's take a look at the `pf-cool-element.ts` file to see what we have. ```ts import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import styles from './pf-cool-element.css'; diff --git a/elements/pf-accordion/pf-accordion-header.ts b/elements/pf-accordion/pf-accordion-header.ts index d4acc6ad62..44acfb48a3 100644 --- a/elements/pf-accordion/pf-accordion-header.ts +++ b/elements/pf-accordion/pf-accordion-header.ts @@ -1,7 +1,7 @@ import type { PfAccordion } from './pf-accordion.js'; import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js'; diff --git a/elements/pf-accordion/pf-accordion-panel.ts b/elements/pf-accordion/pf-accordion-panel.ts index 056e207f2a..8824cfa5d7 100644 --- a/elements/pf-accordion/pf-accordion-panel.ts +++ b/elements/pf-accordion/pf-accordion-panel.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { getRandomId } from '@patternfly/pfe-core/functions/random.js'; diff --git a/elements/pf-accordion/pf-accordion.ts b/elements/pf-accordion/pf-accordion.ts index 4daaefed8c..f2d01f7401 100644 --- a/elements/pf-accordion/pf-accordion.ts +++ b/elements/pf-accordion/pf-accordion.ts @@ -2,7 +2,7 @@ import { LitElement, html, type TemplateResult } from 'lit'; import { observes } from '@patternfly/pfe-core/decorators/observes.js'; import { listen } from '@patternfly/pfe-core/decorators/listen.js'; import { property } from 'lit/decorators/property.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { RovingTabindexController } from '@patternfly/pfe-core/controllers/roving-tabindex-controller.js'; import { NumberListConverter } from '@patternfly/pfe-core'; diff --git a/elements/pf-avatar/pf-avatar.ts b/elements/pf-avatar/pf-avatar.ts index d4aa243830..556d380e81 100644 --- a/elements/pf-avatar/pf-avatar.ts +++ b/elements/pf-avatar/pf-avatar.ts @@ -1,6 +1,6 @@ import { LitElement, html, type TemplateResult } from 'lit'; import { property } from 'lit/decorators/property.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import style from './pf-avatar.css'; diff --git a/elements/pf-back-to-top/pf-back-to-top.ts b/elements/pf-back-to-top/pf-back-to-top.ts index 7912dcd2eb..59dc7d8728 100644 --- a/elements/pf-back-to-top/pf-back-to-top.ts +++ b/elements/pf-back-to-top/pf-back-to-top.ts @@ -1,5 +1,5 @@ import { LitElement, html, isServer, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; diff --git a/elements/pf-background-image/pf-background-image.ts b/elements/pf-background-image/pf-background-image.ts index 86ba30b9f9..291574dcab 100644 --- a/elements/pf-background-image/pf-background-image.ts +++ b/elements/pf-background-image/pf-background-image.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js'; import { property } from 'lit/decorators/property.js'; diff --git a/elements/pf-badge/pf-badge.ts b/elements/pf-badge/pf-badge.ts index 48ca61df7a..56879f91db 100644 --- a/elements/pf-badge/pf-badge.ts +++ b/elements/pf-badge/pf-badge.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import styles from './pf-badge.css'; diff --git a/elements/pf-banner/pf-banner.ts b/elements/pf-banner/pf-banner.ts index b6dd731dcf..d8b84e5714 100644 --- a/elements/pf-banner/pf-banner.ts +++ b/elements/pf-banner/pf-banner.ts @@ -1,6 +1,6 @@ import { LitElement, html, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-button/pf-button.ts b/elements/pf-button/pf-button.ts index 067de822c7..9fb74da79c 100644 --- a/elements/pf-button/pf-button.ts +++ b/elements/pf-button/pf-button.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-card/pf-card.ts b/elements/pf-card/pf-card.ts index 72a29419a6..a8842d1865 100644 --- a/elements/pf-card/pf-card.ts +++ b/elements/pf-card/pf-card.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-chip/pf-chip-group.ts b/elements/pf-chip/pf-chip-group.ts index a57f79f560..3ec23f9599 100644 --- a/elements/pf-chip/pf-chip-group.ts +++ b/elements/pf-chip/pf-chip-group.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { query } from 'lit/decorators/query.js'; import { queryAssignedNodes } from 'lit/decorators/query-assigned-nodes.js'; diff --git a/elements/pf-chip/pf-chip.ts b/elements/pf-chip/pf-chip.ts index 393ce0f0c9..be22b77809 100644 --- a/elements/pf-chip/pf-chip.ts +++ b/elements/pf-chip/pf-chip.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import '@patternfly/elements/pf-button/pf-button.js'; diff --git a/elements/pf-clipboard-copy/pf-clipboard-copy.ts b/elements/pf-clipboard-copy/pf-clipboard-copy.ts index 6b69717f93..0c05cc3c54 100644 --- a/elements/pf-clipboard-copy/pf-clipboard-copy.ts +++ b/elements/pf-clipboard-copy/pf-clipboard-copy.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; import { ifDefined } from 'lit/directives/if-defined.js'; diff --git a/elements/pf-code-block/pf-code-block.ts b/elements/pf-code-block/pf-code-block.ts index 398328b576..f691edd46b 100644 --- a/elements/pf-code-block/pf-code-block.ts +++ b/elements/pf-code-block/pf-code-block.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; import styles from './pf-code-block.css'; diff --git a/elements/pf-dropdown/pf-dropdown-group.ts b/elements/pf-dropdown/pf-dropdown-group.ts index cabe98d10a..71400fa4ce 100644 --- a/elements/pf-dropdown/pf-dropdown-group.ts +++ b/elements/pf-dropdown/pf-dropdown-group.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import styles from './pf-dropdown-group.css'; diff --git a/elements/pf-dropdown/pf-dropdown-item.ts b/elements/pf-dropdown/pf-dropdown-item.ts index c1aaf98ddb..f714c317d6 100644 --- a/elements/pf-dropdown/pf-dropdown-item.ts +++ b/elements/pf-dropdown/pf-dropdown-item.ts @@ -1,5 +1,5 @@ import { LitElement, html, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; import { query } from 'lit/decorators/query.js'; diff --git a/elements/pf-dropdown/pf-dropdown-menu.ts b/elements/pf-dropdown/pf-dropdown-menu.ts index 36a3390040..73374d7bf8 100644 --- a/elements/pf-dropdown/pf-dropdown-menu.ts +++ b/elements/pf-dropdown/pf-dropdown-menu.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { consume } from '@lit/context'; import { state } from 'lit/decorators/state.js'; import { context, type PfDropdownContext } from './context.js'; diff --git a/elements/pf-dropdown/pf-dropdown.ts b/elements/pf-dropdown/pf-dropdown.ts index debd667963..c8bda18236 100644 --- a/elements/pf-dropdown/pf-dropdown.ts +++ b/elements/pf-dropdown/pf-dropdown.ts @@ -1,7 +1,7 @@ import { LitElement, html, type PropertyValues, type TemplateResult } from 'lit'; import { styleMap } from 'lit/directives/style-map.js'; import { classMap } from 'lit/directives/class-map.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js'; import { provide } from '@lit/context'; diff --git a/elements/pf-icon/pf-icon.ts b/elements/pf-icon/pf-icon.ts index 5e59651acc..fe77b4a56f 100644 --- a/elements/pf-icon/pf-icon.ts +++ b/elements/pf-icon/pf-icon.ts @@ -1,5 +1,5 @@ import { LitElement, html, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { state } from 'lit/decorators/state.js'; diff --git a/elements/pf-jump-links/pf-jump-links-item.ts b/elements/pf-jump-links/pf-jump-links-item.ts index 404c5644ce..df26523ebc 100644 --- a/elements/pf-jump-links/pf-jump-links-item.ts +++ b/elements/pf-jump-links/pf-jump-links-item.ts @@ -1,5 +1,5 @@ import { html, LitElement, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; diff --git a/elements/pf-jump-links/pf-jump-links-list.ts b/elements/pf-jump-links/pf-jump-links-list.ts index 001219bb71..7eb0235883 100644 --- a/elements/pf-jump-links/pf-jump-links-list.ts +++ b/elements/pf-jump-links/pf-jump-links-list.ts @@ -1,5 +1,5 @@ import { html, LitElement, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import style from './pf-jump-links-list.css'; diff --git a/elements/pf-jump-links/pf-jump-links.ts b/elements/pf-jump-links/pf-jump-links.ts index 9f9ba022a7..7365810d32 100644 --- a/elements/pf-jump-links/pf-jump-links.ts +++ b/elements/pf-jump-links/pf-jump-links.ts @@ -1,5 +1,5 @@ import { html, LitElement, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ScrollSpyController } from '@patternfly/pfe-core/controllers/scroll-spy-controller.js'; diff --git a/elements/pf-label/pf-label.ts b/elements/pf-label/pf-label.ts index 244bb4b4fc..768f02bea7 100644 --- a/elements/pf-label/pf-label.ts +++ b/elements/pf-label/pf-label.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-modal/pf-modal.ts b/elements/pf-modal/pf-modal.ts index 74f2156422..b823c94a54 100644 --- a/elements/pf-modal/pf-modal.ts +++ b/elements/pf-modal/pf-modal.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { query } from 'lit/decorators/query.js'; import { ifDefined } from 'lit/directives/if-defined.js'; diff --git a/elements/pf-panel/pf-panel.ts b/elements/pf-panel/pf-panel.ts index 4d5024c0f2..690d688de0 100644 --- a/elements/pf-panel/pf-panel.ts +++ b/elements/pf-panel/pf-panel.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js'; diff --git a/elements/pf-popover/pf-popover.ts b/elements/pf-popover/pf-popover.ts index d2c7fbf05e..d14a6a81c0 100644 --- a/elements/pf-popover/pf-popover.ts +++ b/elements/pf-popover/pf-popover.ts @@ -1,7 +1,7 @@ import type { Placement } from '@patternfly/pfe-core/controllers/floating-dom-controller.js'; import { LitElement, nothing, html, type PropertyValues, isServer, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { query } from 'lit/decorators/query.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/elements/pf-progress-stepper/pf-progress-step.ts b/elements/pf-progress-stepper/pf-progress-step.ts index 6ebe9e2a1f..511bf70d6d 100644 --- a/elements/pf-progress-stepper/pf-progress-step.ts +++ b/elements/pf-progress-stepper/pf-progress-step.ts @@ -2,7 +2,7 @@ import type { PropertyValues, TemplateResult } from 'lit'; import type { PfProgressStepper } from './pf-progress-stepper.js'; import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-progress-stepper/pf-progress-stepper.ts b/elements/pf-progress-stepper/pf-progress-stepper.ts index e02c55b3bb..d1aa87d5a5 100644 --- a/elements/pf-progress-stepper/pf-progress-stepper.ts +++ b/elements/pf-progress-stepper/pf-progress-stepper.ts @@ -1,5 +1,5 @@ import { LitElement, html, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import style from './pf-progress-stepper.css'; diff --git a/elements/pf-progress/pf-progress.ts b/elements/pf-progress/pf-progress.ts index 9746bb0dd1..85420e1919 100644 --- a/elements/pf-progress/pf-progress.ts +++ b/elements/pf-progress/pf-progress.ts @@ -1,7 +1,7 @@ import type { PropertyValues, TemplateResult } from 'lit'; import { LitElement, html } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/elements/pf-select/pf-option-group.ts b/elements/pf-select/pf-option-group.ts index 8c6be3cc22..287c31e714 100644 --- a/elements/pf-select/pf-option-group.ts +++ b/elements/pf-select/pf-option-group.ts @@ -1,6 +1,6 @@ import { LitElement, html, type TemplateResult } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js'; diff --git a/elements/pf-select/pf-option.ts b/elements/pf-select/pf-option.ts index e36bd2aca0..d52c090056 100644 --- a/elements/pf-select/pf-option.ts +++ b/elements/pf-select/pf-option.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { queryAssignedNodes } from 'lit/decorators/query-assigned-nodes.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-select/pf-select.ts b/elements/pf-select/pf-select.ts index f3721a3f22..8432c08c0b 100644 --- a/elements/pf-select/pf-select.ts +++ b/elements/pf-select/pf-select.ts @@ -3,7 +3,7 @@ import type { Placement } from '@patternfly/pfe-core/controllers/floating-dom-co import type { TemplateResult } from 'lit'; import { LitElement, html, isServer } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { query } from 'lit/decorators/query.js'; import { repeat } from 'lit/directives/repeat.js'; diff --git a/elements/pf-spinner/pf-spinner.ts b/elements/pf-spinner/pf-spinner.ts index 146e5629bd..08bc96ba49 100644 --- a/elements/pf-spinner/pf-spinner.ts +++ b/elements/pf-spinner/pf-spinner.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { styleMap } from 'lit/directives/style-map.js'; import { property } from 'lit/decorators/property.js'; diff --git a/elements/pf-switch/pf-switch.ts b/elements/pf-switch/pf-switch.ts index 1717408d7e..a33548290b 100644 --- a/elements/pf-switch/pf-switch.ts +++ b/elements/pf-switch/pf-switch.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js'; diff --git a/elements/pf-table/pf-caption.ts b/elements/pf-table/pf-caption.ts index 8dffe07f3c..353d716b35 100644 --- a/elements/pf-table/pf-caption.ts +++ b/elements/pf-table/pf-caption.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import styles from './pf-caption.css'; diff --git a/elements/pf-table/pf-table.ts b/elements/pf-table/pf-table.ts index 4611daf11c..57a4ff54aa 100644 --- a/elements/pf-table/pf-table.ts +++ b/elements/pf-table/pf-table.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { styleMap } from 'lit/directives/style-map.js'; import { state } from 'lit/decorators/state.js'; diff --git a/elements/pf-table/pf-tbody.ts b/elements/pf-table/pf-tbody.ts index d58f980578..f88cdd95e2 100644 --- a/elements/pf-table/pf-tbody.ts +++ b/elements/pf-table/pf-tbody.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import styles from './pf-tbody.css'; diff --git a/elements/pf-table/pf-td.ts b/elements/pf-table/pf-td.ts index a700fad07c..fa10d4f890 100644 --- a/elements/pf-table/pf-td.ts +++ b/elements/pf-table/pf-td.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import styles from './pf-td.css'; diff --git a/elements/pf-table/pf-th.ts b/elements/pf-table/pf-th.ts index ed95cee6ed..9a3b76f9d6 100644 --- a/elements/pf-table/pf-th.ts +++ b/elements/pf-table/pf-th.ts @@ -1,5 +1,5 @@ import { LitElement, html, svg, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-table/pf-thead.ts b/elements/pf-table/pf-thead.ts index 35bc35c897..45252c47fb 100644 --- a/elements/pf-table/pf-thead.ts +++ b/elements/pf-table/pf-thead.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import styles from './pf-thead.css'; diff --git a/elements/pf-table/pf-tr.ts b/elements/pf-table/pf-tr.ts index 9193dba0ae..c27b766def 100644 --- a/elements/pf-table/pf-tr.ts +++ b/elements/pf-table/pf-tr.ts @@ -1,5 +1,5 @@ import { LitElement, html, type ComplexAttributeConverter, type PropertyValues } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import styles from './pf-tr.css'; diff --git a/elements/pf-tabs/pf-tab-panel.ts b/elements/pf-tabs/pf-tab-panel.ts index a5cf07f175..30b8d56bc6 100644 --- a/elements/pf-tabs/pf-tab-panel.ts +++ b/elements/pf-tabs/pf-tab-panel.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { state } from 'lit/decorators/state.js'; import { consume } from '@lit/context'; diff --git a/elements/pf-tabs/pf-tab.ts b/elements/pf-tabs/pf-tab.ts index 69c9b1ca71..c6e9a74ce7 100644 --- a/elements/pf-tabs/pf-tab.ts +++ b/elements/pf-tabs/pf-tab.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-tabs/pf-tabs.ts b/elements/pf-tabs/pf-tabs.ts index 366ac6f40b..7fed552f80 100644 --- a/elements/pf-tabs/pf-tabs.ts +++ b/elements/pf-tabs/pf-tabs.ts @@ -1,5 +1,5 @@ import { html, LitElement, type PropertyValues, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { query } from 'lit/decorators/query.js'; import { provide } from '@lit/context'; diff --git a/elements/pf-text-area/pf-text-area.ts b/elements/pf-text-area/pf-text-area.ts index 54d058f496..dd53773b11 100644 --- a/elements/pf-text-area/pf-text-area.ts +++ b/elements/pf-text-area/pf-text-area.ts @@ -1,5 +1,5 @@ import { LitElement, html, isServer, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/elements/pf-text-input/pf-text-input.ts b/elements/pf-text-input/pf-text-input.ts index 9f2867fb36..19245c34f2 100644 --- a/elements/pf-text-input/pf-text-input.ts +++ b/elements/pf-text-input/pf-text-input.ts @@ -1,5 +1,5 @@ import { LitElement, html, isServer, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/elements/pf-tile/pf-tile.ts b/elements/pf-tile/pf-tile.ts index e5313357f0..72d561222d 100644 --- a/elements/pf-tile/pf-tile.ts +++ b/elements/pf-tile/pf-tile.ts @@ -1,5 +1,5 @@ import { LitElement, html, type TemplateResult } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import styles from './pf-tile.css'; diff --git a/elements/pf-timestamp/pf-timestamp.ts b/elements/pf-timestamp/pf-timestamp.ts index 2229106228..5c6a4c92f8 100644 --- a/elements/pf-timestamp/pf-timestamp.ts +++ b/elements/pf-timestamp/pf-timestamp.ts @@ -1,7 +1,7 @@ import type { ComplexAttributeConverter, PropertyValues, TemplateResult } from 'lit'; import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { diff --git a/elements/pf-tooltip/pf-tooltip.ts b/elements/pf-tooltip/pf-tooltip.ts index e97344d9a1..7fa3da1c76 100644 --- a/elements/pf-tooltip/pf-tooltip.ts +++ b/elements/pf-tooltip/pf-tooltip.ts @@ -1,6 +1,6 @@ import type { PropertyValues, TemplateResult } from 'lit'; import { LitElement, html, isServer } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import { property } from 'lit/decorators/property.js'; import { styleMap } from 'lit/directives/style-map.js'; import { classMap } from 'lit/directives/class-map.js'; diff --git a/tools/create-element/templates/element/element.ts b/tools/create-element/templates/element/element.ts index 8f35f9fcab..1ce3f2f0f8 100644 --- a/tools/create-element/templates/element/element.ts +++ b/tools/create-element/templates/element/element.ts @@ -1,5 +1,5 @@ import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators/custom-element.js'; +import { customElement } from '@patternfly/pfe-core/decorators/custom-element.js'; import styles from '<%= cssRelativePath %>';