@justeattakeaway/pie-webc-core 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,5 +3,5 @@ transforming...
3
3
  ✓ 11 modules transformed.
4
4
  rendering chunks...
5
5
  computing gzip size...
6
- dist/index.js 2.23 kB │ gzip: 1.02 kB
7
- ✓ built in 123ms
6
+ dist/index.js 2.40 kB │ gzip: 1.09 kB
7
+ ✓ built in 333ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [Added] - new wrapNativeEvent function to standardise how we structure custom versions of native browser events such as 'change' ([#1173](https://github.com/justeattakeaway/pie/pull/1173)) by [@jamieomaguire](https://github.com/jamieomaguire)
8
+
9
+ ## 0.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [Removed] - unused LitElementMixin type as we do not need it anywhere ([#1145](https://github.com/justeattakeaway/pie/pull/1145)) by [@jamieomaguire](https://github.com/jamieomaguire)
14
+
15
+ - [Changed] - Added `@justeattakeaway/pie-wrapper-react` as a devDependency as `build` now relies on the publish `add-react-wrapper` executable ([#1144](https://github.com/justeattakeaway/pie/pull/1144)) by [@siggerzz](https://github.com/siggerzz)
16
+
17
+ - [Changed] - Use proper interface keyword for RTLmixin interface. Was using a class before which is incorrect. ([#1145](https://github.com/justeattakeaway/pie/pull/1145)) by [@jamieomaguire](https://github.com/jamieomaguire)
18
+
3
19
  ## 0.15.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isServer as u } from "lit";
2
- const l = (e) => {
1
+ import { isServer as l } from "lit";
2
+ const a = (e) => {
3
3
  class t extends e {
4
4
  /**
5
5
  * A getter to determine whether the text direction is right-to-left (RTL).
@@ -11,11 +11,11 @@ const l = (e) => {
11
11
  * @returns {boolean} - Returns `true` if the text direction is RTL, otherwise `false`.
12
12
  */
13
13
  get isRTL() {
14
- return this.dir ? this.dir === "rtl" : !u && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1;
14
+ return this.dir ? this.dir === "rtl" : !l && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1;
15
15
  }
16
16
  }
17
17
  return t;
18
- }, a = (e) => {
18
+ }, d = (e) => {
19
19
  class t extends e {
20
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
21
  constructor(...i) {
@@ -53,13 +53,23 @@ const l = (e) => {
53
53
  configurable: !0
54
54
  });
55
55
  };
56
- function h(e, t) {
56
+ function b(e, t) {
57
57
  customElements.get(e) ? console.warn(`PIE Web Component: "${e}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(e, t);
58
58
  }
59
+ function p(e) {
60
+ return new CustomEvent(e.type, {
61
+ detail: {
62
+ sourceEvent: e
63
+ },
64
+ bubbles: e.bubbles,
65
+ cancelable: e.cancelable
66
+ });
67
+ }
59
68
  export {
60
- a as FormControlMixin,
61
- l as RtlMixin,
62
- h as defineCustomElement,
69
+ d as FormControlMixin,
70
+ a as RtlMixin,
71
+ b as defineCustomElement,
63
72
  m as requiredProperty,
64
- f as validPropertyValues
73
+ f as validPropertyValues,
74
+ p as wrapNativeEvent
65
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-webc-core",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "PIE design system base classes, mixins and utilities for web components",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "lit": "3.1.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@justeattakeaway/pie-components-config": "0.7.0"
23
+ "@justeattakeaway/pie-components-config": "0.9.0"
24
24
  },
25
25
  "volta": {
26
26
  "extends": "../../../package.json"
@@ -1 +1,2 @@
1
1
  export * from './defineCustomElement';
2
+ export * from './wrapNativeEvent';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Wraps the native event in a custom event. This is useful for native events that have `composed` set to `false`
3
+ * as these cannot propagate outside of the shadow DOM.
4
+ * @param event - The native event.
5
+ */
6
+ export function wrapNativeEvent (event: Event) {
7
+ return new CustomEvent(event.type, {
8
+ detail: {
9
+ sourceEvent: event,
10
+ },
11
+ bubbles: event.bubbles,
12
+ cancelable: event.cancelable,
13
+ });
14
+ }
@@ -36,7 +36,7 @@ export const FormControlMixin =
36
36
  /**
37
37
  * Class representing a LitElement that behaves like a native HTML form control element.
38
38
  * @extends {LitElement}
39
- * @implements {_FormControlInterface}
39
+ * @implements {FormControlInterface}
40
40
  */
41
41
  class FormControlElement extends superClass implements FormControlInterface {
42
42
  static formAssociated = true;
@@ -2,4 +2,3 @@ export * from './rtl/rtlMixin';
2
2
  export * from './formControl/formControlMixin';
3
3
 
4
4
  export * from './types/GenericConstructor';
5
- export * from './types/LitElementMixin';
@@ -6,7 +6,7 @@ import type { GenericConstructor } from '../types/GenericConstructor';
6
6
  * An interface representing the structure of RTL related class.
7
7
  * @interface
8
8
  */
9
- declare class _RTLInterface {
9
+ export interface RTLInterface {
10
10
  /** A boolean indicating whether the text direction is right-to-left. */
11
11
  isRTL: boolean;
12
12
  }
@@ -18,7 +18,7 @@ declare class _RTLInterface {
18
18
  *
19
19
  * @function
20
20
  * @param {GenericConstructor<LitElement>} superClass - The LitElement class to extend with RTL functionality.
21
- * @returns {GenericConstructor<_RTLInterface> & T} - A new class extending both LitElement and _RTLInterface.
21
+ * @returns {GenericConstructor<RTLInterface> & T} - A new class extending both LitElement and RTLInterface.
22
22
  *
23
23
  * @example
24
24
  * ```typescript
@@ -61,9 +61,9 @@ export const RtlMixin =
61
61
  /**
62
62
  * Class representing a LitElement with RTL handling.
63
63
  * @extends {LitElement}
64
- * @implements {_RTLInterface}
64
+ * @implements {RTLInterface}
65
65
  */
66
- class RTLElement extends superClass implements _RTLInterface {
66
+ class RTLElement extends superClass implements RTLInterface {
67
67
  /**
68
68
  * A getter to determine whether the text direction is right-to-left (RTL).
69
69
  * If the `dir` property is present on the component, it will be used to determine the text direction.
@@ -87,5 +87,5 @@ export const RtlMixin =
87
87
  }
88
88
  }
89
89
 
90
- return RTLElement as GenericConstructor<_RTLInterface> & T;
90
+ return RTLElement as GenericConstructor<RTLInterface> & T;
91
91
  };
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../configs/pie-components-config/tsconfig.json",
2
+ "extends": "@justeattakeaway/pie-components-config/tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "baseUrl": ".",
5
5
  "rootDir": ".",