@rhtml/modifiers 0.0.117 → 0.0.119

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.
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AngularLayout = void 0;
4
4
  const if_1 = require("./if");
5
- const ng_for_1 = require("./ng-for");
6
5
  const registry_1 = require("./registry");
7
- exports.AngularLayout = [registry_1.Registry, if_1.IfOperator, ng_for_1.NgFor];
6
+ exports.AngularLayout = [registry_1.Registry, if_1.IfOperator];
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":";;;AAAA,6BAAkC;AAClC,qCAAiC;AACjC,yCAAsC;AAEzB,QAAA,aAAa,GAAG,CAAC,mBAAQ,EAAE,eAAU,EAAE,cAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":";;;AAAA,6BAAkC;AAClC,yCAAsC;AAEzB,QAAA,aAAa,GAAG,CAAC,mBAAQ,EAAE,eAAU,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhtml/modifiers",
3
- "version": "0.0.117",
3
+ "version": "0.0.119",
4
4
  "description": "Reactive HyperText Markup Language",
5
5
  "scripts": {
6
6
  "start": "npx parcel ./examples/index.html --out-dir build/examples",
@@ -16,8 +16,7 @@
16
16
  "url": "git@github.com:rhtml/rhtml.git"
17
17
  },
18
18
  "dependencies": {
19
- "@rxdi/lit-html": "^0.7.133",
20
- "@rhtml/custom-attributes": "0.0.117"
19
+ "@rhtml/custom-attributes": "0.0.119"
21
20
  },
22
21
  "devDependencies": {},
23
22
  "author": "Kristiyan Tachev",
@@ -1,5 +1,4 @@
1
1
  import { IfOperator } from './if';
2
- import { NgFor } from './ng-for';
3
2
  import { Registry } from './registry';
4
3
 
5
- export const AngularLayout = [Registry, IfOperator, NgFor];
4
+ export const AngularLayout = [Registry, IfOperator];
@@ -1,10 +0,0 @@
1
- import { Attribute } from '@rhtml/custom-attributes';
2
- export declare class NgFor extends Attribute {
3
- ngFor: string;
4
- regexes: RegExp[];
5
- OnInit(): void;
6
- OnDestroy(): void;
7
- OnUpdate(): void;
8
- private interpolate;
9
- private modify;
10
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.NgFor = void 0;
13
- const custom_attributes_1 = require("@rhtml/custom-attributes");
14
- const lit_html_1 = require("@rxdi/lit-html");
15
- let NgFor = class NgFor extends custom_attributes_1.Attribute {
16
- constructor() {
17
- super(...arguments);
18
- this.regexes = [/\${[^{]+}/g, /\@\{(.*?)(?!\@\{)\}/g, /{([^}]+)}/g];
19
- }
20
- OnInit() {
21
- this.modify();
22
- }
23
- OnDestroy() {
24
- //
25
- }
26
- OnUpdate() {
27
- this.modify();
28
- }
29
- interpolate(object, string) {
30
- return string.replace(this.regexes[2], (match) => match
31
- .slice(2, -1)
32
- .trim()
33
- .split('.')
34
- .reduce((el, k) => String(el[k]), object));
35
- }
36
- modify() {
37
- const [, , , items] = this.ngFor.split(' ');
38
- const template = this.element.innerHTML;
39
- this.element.innerHTML = '';
40
- (0, lit_html_1.render)((0, lit_html_1.html) `
41
- <r-for .of=${this.parent[items]}>
42
- <r-let
43
- .item=${(i) => (0, lit_html_1.unsafeHTML)(this.interpolate(i, template))}
44
- ></r-let>
45
- </r-for>
46
- `, this.element);
47
- }
48
- };
49
- __decorate([
50
- (0, custom_attributes_1.Input)(),
51
- __metadata("design:type", String)
52
- ], NgFor.prototype, "ngFor", void 0);
53
- NgFor = __decorate([
54
- (0, custom_attributes_1.Modifier)({
55
- selector: 'ngFor',
56
- })
57
- ], NgFor);
58
- exports.NgFor = NgFor;
59
- //# sourceMappingURL=ng-for.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ng-for.js","sourceRoot":"","sources":["../../src/angular/ng-for.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAsE;AACtE,6CAA0D;AAK1D,IAAa,KAAK,GAAlB,MAAa,KAAM,SAAQ,6BAAS;IAApC;;QAIE,YAAO,GAAG,CAAC,YAAY,EAAE,sBAAsB,EAAE,YAAY,CAAC,CAAC;IAuCjE,CAAC;IArCC,MAAM;QACJ,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,SAAS;QACP,EAAE;IACJ,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEO,WAAW,CAAC,MAAM,EAAE,MAAc;QACxC,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAC/C,KAAK;aACF,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACZ,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,CAAC,EAAE,EAAE,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CACpD,CAAC;IACJ,CAAC;IAEO,MAAM;QACZ,MAAM,CAAC,EAAE,AAAD,EAAG,AAAD,EAAG,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;QAC5B,IAAA,iBAAM,EACJ,IAAA,eAAI,EAAA;qBACW,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;;oBAEnB,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;;;OAG7D,EACD,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;CACF,CAAA;AAzCC;IADC,IAAA,yBAAK,GAAE;;oCACM;AAFH,KAAK;IAHjB,IAAA,4BAAQ,EAAC;QACR,QAAQ,EAAE,OAAO;KAClB,CAAC;GACW,KAAK,CA2CjB;AA3CY,sBAAK"}
@@ -1,50 +0,0 @@
1
- import { Attribute, Input, Modifier } from '@rhtml/custom-attributes';
2
- import { html, render, unsafeHTML } from '@rxdi/lit-html';
3
-
4
- @Modifier({
5
- selector: 'ngFor',
6
- })
7
- export class NgFor extends Attribute {
8
- @Input()
9
- ngFor: string;
10
-
11
- regexes = [/\${[^{]+}/g, /\@\{(.*?)(?!\@\{)\}/g, /{([^}]+)}/g];
12
-
13
- OnInit() {
14
- this.modify();
15
- }
16
-
17
- OnDestroy() {
18
- //
19
- }
20
-
21
- OnUpdate() {
22
- this.modify();
23
- }
24
-
25
- private interpolate(object, string: string) {
26
- return string.replace(this.regexes[2], (match) =>
27
- match
28
- .slice(2, -1)
29
- .trim()
30
- .split('.')
31
- .reduce((el, k: string) => String(el[k]), object)
32
- );
33
- }
34
-
35
- private modify() {
36
- const [, , , items] = this.ngFor.split(' ');
37
- const template = this.element.innerHTML;
38
- this.element.innerHTML = '';
39
- render(
40
- html`
41
- <r-for .of=${this.parent[items]}>
42
- <r-let
43
- .item=${(i) => unsafeHTML(this.interpolate(i, template))}
44
- ></r-let>
45
- </r-for>
46
- `,
47
- this.element
48
- );
49
- }
50
- }