@rhtml/modifiers 0.0.112 → 0.0.115
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/dist/angular/if.js +2 -2
- package/dist/angular/if.js.map +1 -1
- package/dist/angular/index.d.ts +2 -1
- package/dist/angular/ng-for.js +6 -6
- package/dist/angular/ng-for.js.map +1 -1
- package/dist/angular/registry.js +2 -2
- package/dist/angular/registry.js.map +1 -1
- package/dist/animation/animation.js +3 -3
- package/dist/animation/animation.js.map +1 -1
- package/dist/animation/index.js +6 -2
- package/dist/animation/index.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/flex-align.d.ts +5 -4
- package/dist/layout/flex-align.js +2 -2
- package/dist/layout/flex-align.js.map +1 -1
- package/dist/layout/flex-fill.js +4 -4
- package/dist/layout/flex-fill.js.map +1 -1
- package/dist/layout/flex-offset.js +4 -4
- package/dist/layout/flex-offset.js.map +1 -1
- package/dist/layout/flex-order.js +4 -4
- package/dist/layout/flex-order.js.map +1 -1
- package/dist/layout/flex.d.ts +5 -4
- package/dist/layout/flex.js +4 -4
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/index.d.ts +9 -1
- package/dist/layout/index.js +7 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/layout-align.d.ts +5 -4
- package/dist/layout/layout-align.js +4 -4
- package/dist/layout/layout-align.js.map +1 -1
- package/dist/layout/layout-gap.d.ts +6 -5
- package/dist/layout/layout-gap.js +13 -14
- package/dist/layout/layout-gap.js.map +1 -1
- package/dist/layout/layout.d.ts +5 -4
- package/dist/layout/layout.js +5 -6
- package/dist/layout/layout.js.map +1 -1
- package/dist/layout/registry.js +2 -2
- package/dist/layout/registry.js.map +1 -1
- package/package.json +3 -12
- package/src/angular/if.ts +1 -1
- package/src/angular/ng-for.ts +3 -3
- package/src/angular/registry.ts +2 -2
- package/src/animation/animation.ts +2 -2
- package/src/layout/flex-align.ts +8 -6
- package/src/layout/flex-fill.ts +3 -3
- package/src/layout/flex-offset.ts +3 -3
- package/src/layout/flex-order.ts +3 -3
- package/src/layout/flex.ts +10 -8
- package/src/layout/index.ts +1 -1
- package/src/layout/layout-align.ts +10 -8
- package/src/layout/layout-gap.ts +19 -21
- package/src/layout/layout.ts +10 -10
- package/src/layout/registry.ts +2 -2
- package/.eslintrc.js +0 -26
- package/.prettierrc +0 -4
- package/jest.config.js +0 -16
package/dist/layout/layout.js
CHANGED
|
@@ -29,37 +29,36 @@ let Layout = class Layout extends custom_attributes_1.MediaQueryAttribute {
|
|
|
29
29
|
this.prevValue = this.value;
|
|
30
30
|
this.value = (_a = attribute.value) !== null && _a !== void 0 ? _a : this.value;
|
|
31
31
|
this.modify();
|
|
32
|
-
this.element.setAttribute('fxlayout', this.value);
|
|
33
32
|
}
|
|
34
33
|
OnExitMediaQuery() {
|
|
35
34
|
var _a;
|
|
36
35
|
this.value = (_a = this.prevValue) !== null && _a !== void 0 ? _a : this.value;
|
|
37
36
|
this.modify();
|
|
38
|
-
this.element.setAttribute('fxlayout', this.value);
|
|
39
37
|
}
|
|
40
38
|
clean() {
|
|
41
39
|
this.setStyles({
|
|
42
40
|
boxSizing: null,
|
|
43
41
|
flexFlow: null,
|
|
44
|
-
display: null
|
|
42
|
+
display: null,
|
|
45
43
|
})(this.element);
|
|
46
44
|
}
|
|
47
45
|
modify() {
|
|
48
46
|
if (!this.value) {
|
|
49
47
|
return;
|
|
50
48
|
}
|
|
49
|
+
this.element.setAttribute(this.selector, this.value);
|
|
51
50
|
const splitted = this.value.split(' ');
|
|
52
51
|
const [mainAxis, crossAxis] = splitted;
|
|
53
52
|
this.setStyles({
|
|
54
53
|
boxSizing: 'flex',
|
|
55
54
|
flexFlow: splitted.length > 1 ? `${mainAxis} ${crossAxis}` : mainAxis,
|
|
56
|
-
display: 'flex'
|
|
55
|
+
display: 'flex',
|
|
57
56
|
})(this.element);
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
59
|
Layout = __decorate([
|
|
61
|
-
custom_attributes_1.Modifier({
|
|
62
|
-
selector: 'fxLayout'
|
|
60
|
+
(0, custom_attributes_1.Modifier)({
|
|
61
|
+
selector: 'fxLayout',
|
|
63
62
|
})
|
|
64
63
|
], Layout);
|
|
65
64
|
exports.Layout = Layout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/layout/layout.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gEAIkC;AAWlC,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,uCAA2B;IAAvD;;QACE,UAAK,GAAG,KAAK,CAAC;IAiDhB,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/layout/layout.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gEAIkC;AAWlC,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,uCAA2B;IAAvD;;QACE,UAAK,GAAG,KAAK,CAAC;IAiDhB,CAAC;IA9CC,MAAM;QACJ,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,SAAS;QACP,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,KAAK,CAAC,SAAS,EAAE,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAkB;;QAC9C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,MAAA,SAAS,CAAC,KAAK,mCAAI,IAAI,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,gBAAgB;;QACd,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,KAAK,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEO,KAAK;QACX,IAAI,CAAC,SAAS,CAAC;YACb,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,OAAO;SACR;QACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC;QACvC,IAAI,CAAC,SAAS,CAAC;YACb,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,QAAQ;YACrE,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACF,CAAA;AAlDY,MAAM;IAHlB,IAAA,4BAAQ,EAAC;QACR,QAAQ,EAAE,UAAU;KACrB,CAAC;GACW,MAAM,CAkDlB;AAlDY,wBAAM"}
|
package/dist/layout/registry.js
CHANGED
|
@@ -11,11 +11,11 @@ const custom_attributes_1 = require("@rhtml/custom-attributes");
|
|
|
11
11
|
let Registry = class Registry extends custom_attributes_1.Attribute {
|
|
12
12
|
};
|
|
13
13
|
Registry = __decorate([
|
|
14
|
-
custom_attributes_1.Modifier({
|
|
14
|
+
(0, custom_attributes_1.Modifier)({
|
|
15
15
|
selector: 'flex-layout-registry',
|
|
16
16
|
registry() {
|
|
17
17
|
return new custom_attributes_1.CustomAttributeRegistry(this);
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
})
|
|
20
20
|
], Registry);
|
|
21
21
|
exports.Registry = Registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/layout/registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gEAIkC;AAQlC,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,6BAAS;CAAG,CAAA;AAA7B,QAAQ;IANpB,4BAAQ,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/layout/registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gEAIkC;AAQlC,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,6BAAS;CAAG,CAAA;AAA7B,QAAQ;IANpB,IAAA,4BAAQ,EAAC;QACR,QAAQ,EAAE,sBAAsB;QAChC,QAAQ;YACN,OAAO,IAAI,2CAAuB,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC;GACW,QAAQ,CAAqB;AAA7B,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhtml/modifiers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"description": "Reactive HyperText Markup Language",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "npx parcel ./examples/index.html --out-dir build/examples",
|
|
@@ -17,18 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@rxdi/lit-html": "^0.7.133",
|
|
20
|
-
"@rhtml/custom-attributes": "0.0.
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"eslint": "^6.7.2",
|
|
24
|
-
"eslint-config-prettier": "^6.7.0",
|
|
25
|
-
"eslint-plugin-prettier": "^3.1.1",
|
|
26
|
-
"eslint-plugin-simple-import-sort": "^5.0.0",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^2.10.0",
|
|
28
|
-
"@typescript-eslint/parser": "^2.10.0",
|
|
29
|
-
"prettier": "^1.19.1",
|
|
30
|
-
"ts-jest": "25.2.1"
|
|
20
|
+
"@rhtml/custom-attributes": "0.0.115"
|
|
31
21
|
},
|
|
22
|
+
"devDependencies": {},
|
|
32
23
|
"author": "Kristiyan Tachev",
|
|
33
24
|
"license": "MIT",
|
|
34
25
|
"browserslist": [
|
package/src/angular/if.ts
CHANGED
package/src/angular/ng-for.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Attribute, Input, Modifier } from '@rhtml/custom-attributes';
|
|
|
2
2
|
import { html, render, unsafeHTML } from '@rxdi/lit-html';
|
|
3
3
|
|
|
4
4
|
@Modifier({
|
|
5
|
-
selector: 'ngFor'
|
|
5
|
+
selector: 'ngFor',
|
|
6
6
|
})
|
|
7
7
|
export class NgFor extends Attribute {
|
|
8
8
|
@Input()
|
|
@@ -23,7 +23,7 @@ export class NgFor extends Attribute {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
private interpolate(object, string: string) {
|
|
26
|
-
return string.replace(this.regexes[2], match =>
|
|
26
|
+
return string.replace(this.regexes[2], (match) =>
|
|
27
27
|
match
|
|
28
28
|
.slice(2, -1)
|
|
29
29
|
.trim()
|
|
@@ -40,7 +40,7 @@ export class NgFor extends Attribute {
|
|
|
40
40
|
html`
|
|
41
41
|
<r-for .of=${this.parent[items]}>
|
|
42
42
|
<r-let
|
|
43
|
-
.item=${i => unsafeHTML(this.interpolate(i, template))}
|
|
43
|
+
.item=${(i) => unsafeHTML(this.interpolate(i, template))}
|
|
44
44
|
></r-let>
|
|
45
45
|
</r-for>
|
|
46
46
|
`,
|
package/src/angular/registry.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Attribute,
|
|
3
3
|
CustomAttributeRegistry,
|
|
4
|
-
Modifier
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
@Modifier({
|
|
8
8
|
selector: 'angular-layout-registry',
|
|
9
9
|
registry(this) {
|
|
10
10
|
return new CustomAttributeRegistry(this);
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
12
|
})
|
|
13
13
|
export class Registry extends Attribute {}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Attribute,
|
|
3
3
|
CustomAttributeRegistry,
|
|
4
4
|
Input,
|
|
5
|
-
Modifier
|
|
5
|
+
Modifier,
|
|
6
6
|
} from '@rhtml/custom-attributes';
|
|
7
7
|
|
|
8
8
|
import { Animations } from './animate.css';
|
|
@@ -16,7 +16,7 @@ interface Styles {
|
|
|
16
16
|
selector: 'animated',
|
|
17
17
|
registry(this: HTMLElement) {
|
|
18
18
|
return new CustomAttributeRegistry(this);
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
20
|
})
|
|
21
21
|
export class Animation extends Attribute<Styles> {
|
|
22
22
|
@Input({ observe: true })
|
package/src/layout/flex-align.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EnterMediaQueryAttributes,
|
|
3
2
|
MediaQueryAttribute,
|
|
4
|
-
|
|
3
|
+
MediaQueryEvent,
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
interface Styles {
|
|
@@ -9,9 +9,11 @@ interface Styles {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
@Modifier({
|
|
12
|
-
selector: 'fxFlexAlign'
|
|
12
|
+
selector: 'fxFlexAlign',
|
|
13
13
|
})
|
|
14
14
|
export class FlexAlign extends MediaQueryAttribute<Styles> {
|
|
15
|
+
private prevValue: string;
|
|
16
|
+
|
|
15
17
|
OnInit() {
|
|
16
18
|
this.modify();
|
|
17
19
|
super.OnInit();
|
|
@@ -26,7 +28,7 @@ export class FlexAlign extends MediaQueryAttribute<Styles> {
|
|
|
26
28
|
this.modify();
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
OnEnterMediaQuery([, attribute]:
|
|
31
|
+
OnEnterMediaQuery([, attribute]: MediaQueryEvent) {
|
|
30
32
|
this.prevValue = this.value;
|
|
31
33
|
this.value = attribute.value ?? this.value;
|
|
32
34
|
this.modify();
|
|
@@ -37,11 +39,11 @@ export class FlexAlign extends MediaQueryAttribute<Styles> {
|
|
|
37
39
|
this.modify();
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
clean() {
|
|
42
|
+
private clean() {
|
|
41
43
|
this.setStyles({ alignSelf: null })(this.element);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
modify() {
|
|
46
|
+
private modify() {
|
|
45
47
|
this.setStyles({ alignSelf: this.value || null })(this.element);
|
|
46
48
|
}
|
|
47
49
|
}
|
package/src/layout/flex-fill.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface Styles {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
@Modifier({
|
|
12
|
-
selector: 'fxFlexFill'
|
|
12
|
+
selector: 'fxFlexFill',
|
|
13
13
|
})
|
|
14
14
|
export class FlexFill extends Attribute<Styles> {
|
|
15
15
|
value = '100%';
|
|
@@ -32,7 +32,7 @@ export class FlexFill extends Attribute<Styles> {
|
|
|
32
32
|
margin: null,
|
|
33
33
|
minHeight: null,
|
|
34
34
|
minWidth: null,
|
|
35
|
-
width: null
|
|
35
|
+
width: null,
|
|
36
36
|
})(this.element);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ export class FlexFill extends Attribute<Styles> {
|
|
|
42
42
|
height: this.value,
|
|
43
43
|
minHeight: this.value,
|
|
44
44
|
minWidth: this.value,
|
|
45
|
-
width: this.value
|
|
45
|
+
width: this.value,
|
|
46
46
|
})(this.element);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -5,7 +5,7 @@ interface Styles {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@Modifier({
|
|
8
|
-
selector: 'fxFlexOffset'
|
|
8
|
+
selector: 'fxFlexOffset',
|
|
9
9
|
})
|
|
10
10
|
export class FlexOffset extends Attribute<Styles> {
|
|
11
11
|
OnInit() {
|
|
@@ -22,13 +22,13 @@ export class FlexOffset extends Attribute<Styles> {
|
|
|
22
22
|
|
|
23
23
|
private clean() {
|
|
24
24
|
this.setStyles({
|
|
25
|
-
marginLeft: null
|
|
25
|
+
marginLeft: null,
|
|
26
26
|
})(this.element);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
private modify() {
|
|
30
30
|
this.setStyles({
|
|
31
|
-
marginLeft: this.value || null
|
|
31
|
+
marginLeft: this.value || null,
|
|
32
32
|
})(this.element);
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/layout/flex-order.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface Styles {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@Modifier({
|
|
8
|
-
selector: 'fxFlexOrder'
|
|
8
|
+
selector: 'fxFlexOrder',
|
|
9
9
|
})
|
|
10
10
|
export class FlexOrder extends Attribute<Styles> {
|
|
11
11
|
OnInit() {
|
|
@@ -22,13 +22,13 @@ export class FlexOrder extends Attribute<Styles> {
|
|
|
22
22
|
|
|
23
23
|
private clean() {
|
|
24
24
|
this.setStyles({
|
|
25
|
-
order: null
|
|
25
|
+
order: null,
|
|
26
26
|
})(this.element);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
private modify() {
|
|
30
30
|
this.setStyles({
|
|
31
|
-
order: this.value || null
|
|
31
|
+
order: this.value || null,
|
|
32
32
|
})(this.element);
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/layout/flex.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EnterMediaQueryAttributes,
|
|
3
2
|
MediaQueryAttribute,
|
|
4
|
-
|
|
3
|
+
MediaQueryEvent,
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
interface Styles {
|
|
@@ -11,9 +11,11 @@ interface Styles {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@Modifier({
|
|
14
|
-
selector: 'fxFlex'
|
|
14
|
+
selector: 'fxFlex',
|
|
15
15
|
})
|
|
16
16
|
export class Flex extends MediaQueryAttribute<Styles> {
|
|
17
|
+
private prevValue: string;
|
|
18
|
+
|
|
17
19
|
OnInit() {
|
|
18
20
|
this.modify();
|
|
19
21
|
super.OnInit();
|
|
@@ -28,7 +30,7 @@ export class Flex extends MediaQueryAttribute<Styles> {
|
|
|
28
30
|
this.modify();
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
OnEnterMediaQuery([, attribute]:
|
|
33
|
+
OnEnterMediaQuery([, attribute]: MediaQueryEvent) {
|
|
32
34
|
this.prevValue = this.value;
|
|
33
35
|
this.value = attribute.value ?? this.value;
|
|
34
36
|
this.modify();
|
|
@@ -39,19 +41,19 @@ export class Flex extends MediaQueryAttribute<Styles> {
|
|
|
39
41
|
this.modify();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
clean() {
|
|
44
|
+
private clean() {
|
|
43
45
|
this.setStyles({
|
|
44
46
|
boxSizing: null,
|
|
45
47
|
maxWidth: null,
|
|
46
|
-
flex: null
|
|
48
|
+
flex: null,
|
|
47
49
|
})(this.element);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
modify() {
|
|
52
|
+
private modify() {
|
|
51
53
|
this.setStyles({
|
|
52
54
|
boxSizing: 'border-box',
|
|
53
55
|
maxWidth: this.value || null,
|
|
54
|
-
flex: '1 1 100%'
|
|
56
|
+
flex: '1 1 100%',
|
|
55
57
|
})(this.element);
|
|
56
58
|
}
|
|
57
59
|
}
|
package/src/layout/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EnterMediaQueryAttributes,
|
|
3
2
|
MediaQueryAttribute,
|
|
4
|
-
|
|
3
|
+
MediaQueryEvent,
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
interface Styles {
|
|
@@ -11,9 +11,11 @@ interface Styles {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@Modifier({
|
|
14
|
-
selector: 'fxLayoutAlign'
|
|
14
|
+
selector: 'fxLayoutAlign',
|
|
15
15
|
})
|
|
16
16
|
export class LayoutAlign extends MediaQueryAttribute<Styles> {
|
|
17
|
+
private prevValue: string;
|
|
18
|
+
|
|
17
19
|
OnInit() {
|
|
18
20
|
this.modify();
|
|
19
21
|
super.OnInit();
|
|
@@ -28,7 +30,7 @@ export class LayoutAlign extends MediaQueryAttribute<Styles> {
|
|
|
28
30
|
this.modify();
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
OnEnterMediaQuery([, attribute]:
|
|
33
|
+
OnEnterMediaQuery([, attribute]: MediaQueryEvent) {
|
|
32
34
|
this.prevValue = this.value;
|
|
33
35
|
this.value = attribute.value ?? this.value;
|
|
34
36
|
this.modify();
|
|
@@ -39,22 +41,22 @@ export class LayoutAlign extends MediaQueryAttribute<Styles> {
|
|
|
39
41
|
this.modify();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
clean() {
|
|
44
|
+
private clean() {
|
|
43
45
|
this.setStyles({
|
|
44
46
|
alignItems: null,
|
|
45
47
|
placeContent: null,
|
|
46
|
-
display: null
|
|
48
|
+
display: null,
|
|
47
49
|
})(this.element);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
modify() {
|
|
52
|
+
private modify() {
|
|
51
53
|
const [mainAxis, crossAxis] = this.value.split(' ');
|
|
52
54
|
this.setStyles({
|
|
53
55
|
alignItems: crossAxis ? crossAxis : mainAxis,
|
|
54
56
|
placeContent: crossAxis
|
|
55
57
|
? `${crossAxis} ${mainAxis}`
|
|
56
58
|
: `${mainAxis} ${mainAxis}`,
|
|
57
|
-
display: 'flex'
|
|
59
|
+
display: 'flex',
|
|
58
60
|
})(this.element);
|
|
59
61
|
}
|
|
60
62
|
}
|
package/src/layout/layout-gap.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createFiltersFromSelector,
|
|
3
|
-
EnterMediaQueryAttributes,
|
|
4
3
|
MediaQueryAttribute,
|
|
5
|
-
|
|
4
|
+
MediaQueryEvent,
|
|
5
|
+
Modifier,
|
|
6
6
|
} from '@rhtml/custom-attributes';
|
|
7
7
|
|
|
8
8
|
interface Styles {
|
|
@@ -11,26 +11,24 @@ interface Styles {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@Modifier({
|
|
14
|
-
selector: 'fxLayoutGap'
|
|
14
|
+
selector: 'fxLayoutGap',
|
|
15
|
+
observe: {
|
|
16
|
+
childList: true,
|
|
17
|
+
subtree: true,
|
|
18
|
+
attributes: true,
|
|
19
|
+
attributeFilter: createFiltersFromSelector('fxlayout'),
|
|
20
|
+
},
|
|
15
21
|
})
|
|
16
22
|
export class LayoutGap extends MediaQueryAttribute<Styles> {
|
|
17
|
-
private
|
|
23
|
+
private prevValue: string;
|
|
18
24
|
|
|
19
25
|
OnInit() {
|
|
20
26
|
this.modify();
|
|
21
|
-
this.observer = new MutationObserver(() => this.modify());
|
|
22
|
-
this.observer.observe(this.element, {
|
|
23
|
-
childList: true,
|
|
24
|
-
subtree: true,
|
|
25
|
-
attributes: true,
|
|
26
|
-
attributeFilter: createFiltersFromSelector('fxlayout')
|
|
27
|
-
});
|
|
28
27
|
super.OnInit();
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
OnDestroy() {
|
|
32
31
|
this.clean();
|
|
33
|
-
this.observer.disconnect();
|
|
34
32
|
super.OnDestroy();
|
|
35
33
|
}
|
|
36
34
|
|
|
@@ -38,7 +36,11 @@ export class LayoutGap extends MediaQueryAttribute<Styles> {
|
|
|
38
36
|
this.modify();
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
OnChange() {
|
|
40
|
+
this.modify();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
OnEnterMediaQuery([, attribute]: MediaQueryEvent) {
|
|
42
44
|
this.prevValue = this.value;
|
|
43
45
|
this.value = attribute.value ?? this.value;
|
|
44
46
|
this.modify();
|
|
@@ -49,21 +51,17 @@ export class LayoutGap extends MediaQueryAttribute<Styles> {
|
|
|
49
51
|
this.modify();
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// }
|
|
55
|
-
|
|
56
|
-
clean() {
|
|
54
|
+
private clean() {
|
|
57
55
|
const divs = [...this.element.children] as HTMLElement[];
|
|
58
56
|
for (const div of divs) {
|
|
59
57
|
this.setStyles({
|
|
60
58
|
flex: null,
|
|
61
|
-
margin: null
|
|
59
|
+
margin: null,
|
|
62
60
|
})(div);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
modify() {
|
|
64
|
+
private modify() {
|
|
67
65
|
const layout = this.element.getAttribute('fxlayout');
|
|
68
66
|
let margin = `0px ${this.value} ${this.value} 0px`;
|
|
69
67
|
if (layout === 'row') {
|
|
@@ -76,7 +74,7 @@ export class LayoutGap extends MediaQueryAttribute<Styles> {
|
|
|
76
74
|
for (const div of divs) {
|
|
77
75
|
this.setStyles({
|
|
78
76
|
flex: '1 1 25%',
|
|
79
|
-
margin
|
|
77
|
+
margin,
|
|
80
78
|
})(div);
|
|
81
79
|
}
|
|
82
80
|
}
|
package/src/layout/layout.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EnterMediaQueryAttributes,
|
|
3
2
|
MediaQueryAttribute,
|
|
4
|
-
|
|
3
|
+
MediaQueryEvent,
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
interface Styles {
|
|
@@ -11,10 +11,11 @@ interface Styles {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@Modifier({
|
|
14
|
-
selector: 'fxLayout'
|
|
14
|
+
selector: 'fxLayout',
|
|
15
15
|
})
|
|
16
16
|
export class Layout extends MediaQueryAttribute<Styles> {
|
|
17
17
|
value = 'row';
|
|
18
|
+
private prevValue: string;
|
|
18
19
|
|
|
19
20
|
OnInit() {
|
|
20
21
|
this.modify();
|
|
@@ -30,37 +31,36 @@ export class Layout extends MediaQueryAttribute<Styles> {
|
|
|
30
31
|
this.modify();
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
OnEnterMediaQuery([, attribute]:
|
|
34
|
+
OnEnterMediaQuery([, attribute]: MediaQueryEvent) {
|
|
34
35
|
this.prevValue = this.value;
|
|
35
36
|
this.value = attribute.value ?? this.value;
|
|
36
37
|
this.modify();
|
|
37
|
-
this.element.setAttribute('fxlayout', this.value);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
OnExitMediaQuery() {
|
|
41
41
|
this.value = this.prevValue ?? this.value;
|
|
42
42
|
this.modify();
|
|
43
|
-
this.element.setAttribute('fxlayout', this.value);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
clean() {
|
|
45
|
+
private clean() {
|
|
47
46
|
this.setStyles({
|
|
48
47
|
boxSizing: null,
|
|
49
48
|
flexFlow: null,
|
|
50
|
-
display: null
|
|
49
|
+
display: null,
|
|
51
50
|
})(this.element);
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
modify() {
|
|
53
|
+
private modify() {
|
|
55
54
|
if (!this.value) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
57
|
+
this.element.setAttribute(this.selector, this.value);
|
|
58
58
|
const splitted = this.value.split(' ');
|
|
59
59
|
const [mainAxis, crossAxis] = splitted;
|
|
60
60
|
this.setStyles({
|
|
61
61
|
boxSizing: 'flex',
|
|
62
62
|
flexFlow: splitted.length > 1 ? `${mainAxis} ${crossAxis}` : mainAxis,
|
|
63
|
-
display: 'flex'
|
|
63
|
+
display: 'flex',
|
|
64
64
|
})(this.element);
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/layout/registry.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Attribute,
|
|
3
3
|
CustomAttributeRegistry,
|
|
4
|
-
Modifier
|
|
4
|
+
Modifier,
|
|
5
5
|
} from '@rhtml/custom-attributes';
|
|
6
6
|
|
|
7
7
|
@Modifier({
|
|
8
8
|
selector: 'flex-layout-registry',
|
|
9
9
|
registry(this) {
|
|
10
10
|
return new CustomAttributeRegistry(this);
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
12
|
})
|
|
13
13
|
export class Registry extends Attribute {}
|
package/.eslintrc.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// Specifies the ESLint parser
|
|
3
|
-
parser: "@typescript-eslint/parser",
|
|
4
|
-
extends: [
|
|
5
|
-
// Uses the recommended rules from the @typescript-eslint/eslint-plugin
|
|
6
|
-
"plugin:@typescript-eslint/recommended",
|
|
7
|
-
// Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
|
|
8
|
-
"prettier/@typescript-eslint",
|
|
9
|
-
// Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
|
|
10
|
-
"plugin:prettier/recommended"
|
|
11
|
-
],
|
|
12
|
-
parserOptions: {
|
|
13
|
-
// Allows for the parsing of modern ECMAScript features
|
|
14
|
-
ecmaVersion: 2018,
|
|
15
|
-
// Allows for the use of imports
|
|
16
|
-
sourceType: "module"
|
|
17
|
-
},
|
|
18
|
-
rules: {
|
|
19
|
-
"@typescript-eslint/explicit-function-return-type": 0,
|
|
20
|
-
"simple-import-sort/sort": "error",
|
|
21
|
-
"sort-imports": "off",
|
|
22
|
-
"import/order": "off",
|
|
23
|
-
"@typescript-eslint/camelcase": 0
|
|
24
|
-
},
|
|
25
|
-
plugins: ["simple-import-sort"]
|
|
26
|
-
};
|
package/.prettierrc
DELETED
package/jest.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
testEnvironment: 'node',
|
|
3
|
-
testPathIgnorePatterns: ['/node_modules/'],
|
|
4
|
-
coverageReporters: ['lcov', 'html'],
|
|
5
|
-
rootDir: './',
|
|
6
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
|
|
7
|
-
globals: {
|
|
8
|
-
__DEV__: true
|
|
9
|
-
},
|
|
10
|
-
transform: {
|
|
11
|
-
'\\.(ts|tsx)$': 'ts-jest'
|
|
12
|
-
},
|
|
13
|
-
testRegex: '/src/.*\\.spec.(ts|tsx|js)$',
|
|
14
|
-
verbose: true,
|
|
15
|
-
collectCoverage: true
|
|
16
|
-
};
|