@justeattakeaway/pie-webc-core 0.23.0 → 0.24.1
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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +15 -0
- package/dist/index.js +32 -30
- package/package.json +3 -3
- package/src/mixins/rtl/rtlMixin.ts +3 -3
- package/src/types/component-default-props-generic.ts +31 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
[36mvite
|
|
1
|
+
[36mvite v5.3.6 [32mbuilding for production...[36m[39m
|
|
2
2
|
transforming...
|
|
3
3
|
[32m✓[39m 16 modules transformed.
|
|
4
4
|
rendering chunks...
|
|
5
5
|
computing gzip size...
|
|
6
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m2.
|
|
7
|
-
[32m✓ built in
|
|
6
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m2.69 kB[22m[1m[22m[2m │ gzip: 1.23 kB[22m
|
|
7
|
+
[32m✓ built in 108ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Changed] - Suggested package updates for security ([#1953](https://github.com/justeattakeaway/pie/pull/1953)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
8
|
+
|
|
9
|
+
## 0.24.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [Changed] - Update default props generic helper type to include all props by default ([#1582](https://github.com/justeattakeaway/pie/pull/1582)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
14
|
+
|
|
15
|
+
[Changed] - Naming of generic type
|
|
16
|
+
[Added] - JSDoc comment
|
|
17
|
+
|
|
3
18
|
## 0.23.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { isServer as
|
|
2
|
-
const
|
|
3
|
-
const o = `#${
|
|
4
|
-
Object.defineProperty(s,
|
|
1
|
+
import { isServer as u } from "lit";
|
|
2
|
+
const d = (t, e, n) => function(s, r) {
|
|
3
|
+
const o = `#${r}`;
|
|
4
|
+
Object.defineProperty(s, r, {
|
|
5
5
|
get() {
|
|
6
6
|
return this[o];
|
|
7
7
|
},
|
|
8
|
-
set(
|
|
9
|
-
e.includes(
|
|
10
|
-
`<${t}> Invalid value "${
|
|
8
|
+
set(c) {
|
|
9
|
+
e.includes(c) ? this[o] = c : (console.error(
|
|
10
|
+
`<${t}> Invalid value "${c}" provided for property "${r}".`,
|
|
11
11
|
`Must be one of: ${e.join(" | ")}.`,
|
|
12
|
-
`Falling back to default value: "${
|
|
13
|
-
), this[o] =
|
|
12
|
+
`Falling back to default value: "${n}"`
|
|
13
|
+
), this[o] = n);
|
|
14
14
|
},
|
|
15
15
|
configurable: !0
|
|
16
16
|
});
|
|
17
|
-
},
|
|
17
|
+
}, l = (t) => function(n, i) {
|
|
18
18
|
const s = `#${i}`;
|
|
19
|
-
Object.defineProperty(
|
|
19
|
+
Object.defineProperty(n, i, {
|
|
20
20
|
get() {
|
|
21
21
|
return this[s];
|
|
22
22
|
},
|
|
23
|
-
set(
|
|
24
|
-
(
|
|
23
|
+
set(r) {
|
|
24
|
+
(r == null || typeof r == "string" && r.trim() === "") && console.error(`<${t}> Missing required attribute "${i}"`), this[s] = r;
|
|
25
25
|
},
|
|
26
26
|
configurable: !0
|
|
27
27
|
});
|
|
@@ -29,7 +29,7 @@ const a = (t, e, r) => function(s, n) {
|
|
|
29
29
|
function f(t, e) {
|
|
30
30
|
customElements.get(t) ? console.warn(`PIE Web Component: "${t}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(t, e);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function b(t) {
|
|
33
33
|
return new CustomEvent(t.type, {
|
|
34
34
|
detail: {
|
|
35
35
|
sourceEvent: t
|
|
@@ -38,16 +38,16 @@ function m(t) {
|
|
|
38
38
|
cancelable: t.cancelable
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function h(t, e, n) {
|
|
42
42
|
e.startsWith("pie-") || console.warn("A custom event name should start with `pie-`");
|
|
43
43
|
const i = new CustomEvent(e, {
|
|
44
44
|
bubbles: !0,
|
|
45
45
|
composed: !0,
|
|
46
|
-
detail:
|
|
46
|
+
detail: n
|
|
47
47
|
});
|
|
48
48
|
t.dispatchEvent(i);
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const m = (t) => {
|
|
51
51
|
class e extends t {
|
|
52
52
|
/**
|
|
53
53
|
* A getter to determine whether the text direction is right-to-left (RTL).
|
|
@@ -59,28 +59,30 @@ const h = (t) => {
|
|
|
59
59
|
* @returns {boolean} - Returns `true` if the text direction is RTL, otherwise `false`.
|
|
60
60
|
*/
|
|
61
61
|
get isRTL() {
|
|
62
|
-
return this.dir ? this.dir === "rtl" : !
|
|
62
|
+
return this.dir ? this.dir === "rtl" : !u && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
return e;
|
|
66
66
|
}, p = (t) => {
|
|
67
|
-
class
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
constructor(...i) {
|
|
70
|
-
super(...i), this._internals = this.attachInternals();
|
|
71
|
-
}
|
|
67
|
+
const n = class n extends t {
|
|
72
68
|
get form() {
|
|
73
69
|
return this._internals.form;
|
|
74
70
|
}
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
+
constructor(...s) {
|
|
73
|
+
super(...s), this._internals = this.attachInternals();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
n.formAssociated = !0;
|
|
77
|
+
let e = n;
|
|
78
|
+
return e;
|
|
77
79
|
};
|
|
78
80
|
export {
|
|
79
81
|
p as FormControlMixin,
|
|
80
|
-
|
|
82
|
+
m as RtlMixin,
|
|
81
83
|
f as defineCustomElement,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
h as dispatchCustomEvent,
|
|
85
|
+
l as requiredProperty,
|
|
86
|
+
d as validPropertyValues,
|
|
87
|
+
b as wrapNativeEvent
|
|
86
88
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-webc-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "PIE design system base classes, mixins and utilities for web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"test:watch": "run -T vitest"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"lit": "3.
|
|
21
|
+
"lit": "3.2.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
24
|
+
"@justeattakeaway/pie-components-config": "0.18.0"
|
|
25
25
|
},
|
|
26
26
|
"volta": {
|
|
27
27
|
"extends": "../../../package.json"
|
|
@@ -41,16 +41,16 @@ export interface RTLInterface {
|
|
|
41
41
|
*
|
|
42
42
|
* class MyStyledElement extends RtlMixin(LitElement) {
|
|
43
43
|
* render() {
|
|
44
|
-
* return html`<div class="foo" ?
|
|
44
|
+
* return html`<div class="foo" ?data-is-rtl=${this.isRTL}>Content</div>`;
|
|
45
45
|
* }
|
|
46
46
|
* }
|
|
47
47
|
*
|
|
48
48
|
* customElements.define('my-styled-element', MyStyledElement);
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
|
-
* The corresponding SCSS to leverage the `
|
|
51
|
+
* The corresponding SCSS to leverage the `data-is-rtl` attribute:
|
|
52
52
|
* ```scss
|
|
53
|
-
* .foo[
|
|
53
|
+
* .foo[data-is-rtl] {
|
|
54
54
|
* background-color: red;
|
|
55
55
|
* text-align: right;
|
|
56
56
|
* }
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This type should be used when defining the default props for a component.
|
|
3
|
+
* It is a generic type that takes two type parameters:
|
|
4
|
+
* - `T` is the type of the props object that the default props are being defined for.
|
|
5
|
+
* - `K` is the type of the keys in `T` that should be required in the default props.
|
|
6
|
+
* By default, `K` is set to be all the keys in `T`. This means that all the keys in `T` will be required in the default props.
|
|
7
|
+
* You can override this by specifying a subset of the keys in `T` that should be required in the default props.
|
|
8
|
+
*
|
|
9
|
+
* @example ```tsx
|
|
10
|
+
* interface MyComponentProps {
|
|
11
|
+
* a: string;
|
|
12
|
+
* b?: number;
|
|
13
|
+
* c: boolean;
|
|
14
|
+
* }
|
|
15
|
+
* const allProps: ComponentDefaultProps<MyComponentProps> = {
|
|
16
|
+
* a: 'default value',
|
|
17
|
+
* b: 42,
|
|
18
|
+
* c: true,
|
|
19
|
+
* };
|
|
20
|
+
*
|
|
21
|
+
* const pickProps: ComponentDefaultProps<MyComponentProps, 'a'> = {
|
|
22
|
+
* a: 'default value',
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* const omitProps: ComponentDefaultProps<MyComponentProps, keyof Omit<MyComponentProps, 'a'>> = {
|
|
26
|
+
* b: 42,
|
|
27
|
+
* c: true,
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type ComponentDefaultProps<T, K extends keyof T = keyof T> = Readonly<Required<Pick<T, K>>>;
|