@angular-wave/angular.ts 0.0.46 → 0.0.48
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-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +1 -2
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-queue.js +3 -4
- package/src/animations/animation.js +1 -1
- package/src/animations/raf-scheduler.js +0 -1
- package/src/animations/shared.js +1 -1
- package/src/core/animate/animate.js +0 -1
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/filter/filter.js +2 -2
- package/src/core/location/location.js +1 -1
- package/src/core/location/location.spec.js +1 -1
- package/src/core/parser/ast-type.js +22 -0
- package/src/core/parser/ast.js +422 -0
- package/src/core/parser/compiler.js +561 -0
- package/src/core/parser/interpreter.js +422 -0
- package/src/core/parser/lexer.js +257 -0
- package/src/core/parser/parse.js +9 -1930
- package/src/core/parser/parse.spec.js +2 -2
- package/src/core/parser/parser.js +39 -0
- package/src/core/parser/shared.js +228 -0
- package/src/core/q/q.spec.js +0 -1
- package/src/core/sce/sce.js +3 -6
- package/src/core/scope/scope.js +19 -11
- package/src/core/task-tracker-factory.js +0 -1
- package/src/directive/attrs/attrs.js +4 -185
- package/src/directive/attrs/attrs.md +224 -0
- package/src/directive/class/class.js +0 -2
- package/src/directive/form/form.js +0 -3
- package/src/directive/include/include.js +1 -1
- package/src/directive/include/include.spec.js +0 -1
- package/src/directive/input/input.js +1 -2
- package/src/directive/model/model.js +1 -3
- package/src/directive/model/model.spec.js +0 -1
- package/src/directive/repeat/repeat.spec.js +0 -2
- package/src/exts/aria/aria.js +0 -1
- package/src/filters/filter.spec.js +0 -1
- package/src/injector.js +1 -1
- package/src/injector.spec.js +0 -5
- package/src/loader.js +0 -5
- package/src/services/cookie-reader.js +0 -1
- package/src/services/http/http.spec.js +0 -2
- package/src/shared/jqlite/jqlite.js +219 -140
- package/src/shared/utils.js +18 -7
- package/src/types.js +10 -0
- package/types/core/parser/ast-type.d.ts +20 -0
- package/types/core/parser/ast.d.ts +78 -0
- package/types/core/parser/compiler.d.ts +49 -0
- package/types/core/parser/interpreter.d.ts +57 -0
- package/types/core/parser/parse.d.ts +79 -0
- package/types/core/parser/parser.d.ts +22 -0
- package/types/core/parser/shared.d.ts +29 -0
- package/types/core/scope/scope.d.ts +9 -2
- package/types/directive/attrs/attrs.d.ts +0 -174
- package/types/shared/jqlite/jqlite.d.ts +33 -4
- package/types/shared/utils.d.ts +18 -5
- package/types/types.d.ts +1 -0
- package/types-back/index.d.ts +0 -12
|
@@ -55,7 +55,6 @@ import { CACHE, EXPANDO } from "../../core/cache/cache";
|
|
|
55
55
|
* - [`removeData()`](http://api.jquery.com/removeData/)
|
|
56
56
|
* - [`replaceWith()`](http://api.jquery.com/replaceWith/)
|
|
57
57
|
* - [`text()`](http://api.jquery.com/text/)
|
|
58
|
-
* - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers
|
|
59
58
|
* - [`val()`](http://api.jquery.com/val/)
|
|
60
59
|
*
|
|
61
60
|
* ## jQuery/jqLite Extras
|
|
@@ -136,7 +135,7 @@ const BOOLEAN_ELEMENTS = {};
|
|
|
136
135
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
137
136
|
* and execution of chain functions.
|
|
138
137
|
*
|
|
139
|
-
* @param {string|Element|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
138
|
+
* @param {string|Element|Comment|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
140
139
|
* @returns {JQLite}
|
|
141
140
|
*/
|
|
142
141
|
export function JQLite(element) {
|
|
@@ -538,162 +537,242 @@ JQLite.prototype.data = function (key, value) {
|
|
|
538
537
|
return this;
|
|
539
538
|
};
|
|
540
539
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
nodeType !== Node.ELEMENT_NODE &&
|
|
570
|
-
nodeType !== Node.DOCUMENT_FRAGMENT_NODE
|
|
571
|
-
)
|
|
572
|
-
return;
|
|
540
|
+
JQLite.prototype.replaceWith = function (arg1) {
|
|
541
|
+
let value;
|
|
542
|
+
let fn = function (element, replaceNode) {
|
|
543
|
+
let index;
|
|
544
|
+
const parent = element.parentNode;
|
|
545
|
+
dealoc(element);
|
|
546
|
+
forEach(new JQLite(replaceNode), (node) => {
|
|
547
|
+
if (index) {
|
|
548
|
+
parent.insertBefore(node, index.nextSibling);
|
|
549
|
+
} else {
|
|
550
|
+
parent.replaceChild(node, element);
|
|
551
|
+
}
|
|
552
|
+
index = node;
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
for (let i = 0; i < this.length; i++) {
|
|
556
|
+
if (isUndefined(value)) {
|
|
557
|
+
value = fn(this[i], arg1);
|
|
558
|
+
if (isDefined(value)) {
|
|
559
|
+
// any function which returns a value needs to be wrapped
|
|
560
|
+
value = JQLite(value);
|
|
561
|
+
}
|
|
562
|
+
} else {
|
|
563
|
+
addNodes(value, fn(this[i], arg1));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return isDefined(value) ? value : this;
|
|
567
|
+
};
|
|
573
568
|
|
|
574
|
-
|
|
569
|
+
JQLite.prototype.children = function () {
|
|
570
|
+
let value;
|
|
571
|
+
let fn = (element) =>
|
|
572
|
+
Array.from(element.childNodes).filter(
|
|
573
|
+
(child) => child.nodeType === Node.ELEMENT_NODE,
|
|
574
|
+
);
|
|
575
|
+
for (let i = 0; i < this.length; i++) {
|
|
576
|
+
value = JQLite(fn(this[i]));
|
|
577
|
+
}
|
|
578
|
+
return isDefined(value) ? value : this;
|
|
579
|
+
};
|
|
575
580
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
+
/**
|
|
582
|
+
* @param {string} node
|
|
583
|
+
* @returns {JQLite}
|
|
584
|
+
*/
|
|
585
|
+
JQLite.prototype.append = function (node) {
|
|
586
|
+
for (let i = 0; i < this.length; i++) {
|
|
587
|
+
const element = this[i];
|
|
588
|
+
const { nodeType } = element;
|
|
589
|
+
if (
|
|
590
|
+
nodeType !== Node.ELEMENT_NODE &&
|
|
591
|
+
nodeType !== Node.DOCUMENT_FRAGMENT_NODE
|
|
592
|
+
)
|
|
593
|
+
return this;
|
|
581
594
|
|
|
582
|
-
|
|
583
|
-
if (element.nodeType === Node.ELEMENT_NODE) {
|
|
584
|
-
const index = element.firstChild;
|
|
585
|
-
forEach(new JQLite(node), (child) => {
|
|
586
|
-
element.insertBefore(child, index);
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
},
|
|
595
|
+
let newNode = new JQLite(node);
|
|
590
596
|
|
|
591
|
-
|
|
597
|
+
for (let i = 0; i < newNode.length; i++) {
|
|
598
|
+
const child = newNode[i];
|
|
599
|
+
element.appendChild(child);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return this;
|
|
603
|
+
};
|
|
592
604
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
605
|
+
/**
|
|
606
|
+
* @param {string} node
|
|
607
|
+
* @returns {JQLite}
|
|
608
|
+
*/
|
|
609
|
+
JQLite.prototype.prepend = function (node) {
|
|
610
|
+
for (let i = 0; i < this.length; i++) {
|
|
611
|
+
const element = this[i];
|
|
612
|
+
if (element.nodeType === Node.ELEMENT_NODE) {
|
|
613
|
+
const index = element.firstChild;
|
|
614
|
+
forEach(new JQLite(node), (child) => {
|
|
615
|
+
element.insertBefore(child, index);
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return this;
|
|
620
|
+
};
|
|
596
621
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
622
|
+
/**
|
|
623
|
+
* @param {string} newElement
|
|
624
|
+
* @returns {JQLite}
|
|
625
|
+
*/
|
|
626
|
+
JQLite.prototype.after = function (newElement) {
|
|
627
|
+
for (let i = 0; i < this.length; i++) {
|
|
628
|
+
const element = this[i];
|
|
629
|
+
let index = element;
|
|
630
|
+
const parent = element.parentNode;
|
|
600
631
|
|
|
601
|
-
|
|
602
|
-
|
|
632
|
+
if (parent) {
|
|
633
|
+
let el = new JQLite(newElement);
|
|
603
634
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
635
|
+
for (let i = 0, ii = el.length; i < ii; i++) {
|
|
636
|
+
const node = el[i];
|
|
637
|
+
parent.insertBefore(node, index.nextSibling);
|
|
638
|
+
index = node;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return this;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* @param {boolean} [keepData]
|
|
647
|
+
* @returns
|
|
648
|
+
*/
|
|
649
|
+
JQLite.prototype.remove = function (keepData = false) {
|
|
650
|
+
for (let i = 0; i < this.length; i++) {
|
|
651
|
+
const element = this[i];
|
|
652
|
+
removeElement(element, keepData);
|
|
653
|
+
}
|
|
654
|
+
return this;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
JQLite.prototype.detach = function () {
|
|
658
|
+
for (let i = 0; i < this.length; i++) {
|
|
659
|
+
const element = this[i];
|
|
660
|
+
removeElement(element, true);
|
|
661
|
+
}
|
|
662
|
+
return this;
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
JQLite.prototype.parent = function () {
|
|
666
|
+
let value;
|
|
667
|
+
let fn = (element) => {
|
|
668
|
+
const parent = element.parentNode;
|
|
669
|
+
return parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE
|
|
670
|
+
? parent
|
|
671
|
+
: null;
|
|
672
|
+
};
|
|
673
|
+
for (let i = 0, ii = this.length; i < ii; i++) {
|
|
674
|
+
if (isUndefined(value)) {
|
|
675
|
+
value = fn(this[i]);
|
|
676
|
+
if (isDefined(value)) {
|
|
677
|
+
value = JQLite(value);
|
|
609
678
|
}
|
|
610
|
-
}
|
|
679
|
+
} else {
|
|
680
|
+
addNodes(value, fn(this[i]));
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return isDefined(value) ? value : this;
|
|
684
|
+
};
|
|
611
685
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
: null;
|
|
617
|
-
},
|
|
686
|
+
JQLite.prototype.find = function (selector) {
|
|
687
|
+
let value;
|
|
688
|
+
for (let i = 0, ii = this.length; i < ii; i++) {
|
|
689
|
+
const element = this[i];
|
|
618
690
|
|
|
619
|
-
|
|
620
|
-
find(element, selector) {
|
|
691
|
+
if (isUndefined(value)) {
|
|
621
692
|
if (element.getElementsByTagName) {
|
|
622
|
-
|
|
693
|
+
value = element.getElementsByTagName(selector);
|
|
694
|
+
} else {
|
|
695
|
+
value = [];
|
|
623
696
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
if (eventFns) {
|
|
637
|
-
// Create a dummy event to pass to the handlers
|
|
638
|
-
dummyEvent = {
|
|
639
|
-
preventDefault() {
|
|
640
|
-
this.defaultPrevented = true;
|
|
641
|
-
},
|
|
642
|
-
isDefaultPrevented() {
|
|
643
|
-
return this.defaultPrevented === true;
|
|
644
|
-
},
|
|
645
|
-
stopImmediatePropagation() {
|
|
646
|
-
this.immediatePropagationStopped = true;
|
|
647
|
-
},
|
|
648
|
-
isImmediatePropagationStopped() {
|
|
649
|
-
return this.immediatePropagationStopped === true;
|
|
650
|
-
},
|
|
651
|
-
stopPropagation: () => {},
|
|
652
|
-
type: eventName,
|
|
653
|
-
target: element,
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
// If a custom event was provided then extend our dummy event with it
|
|
657
|
-
if (event.type) {
|
|
658
|
-
dummyEvent = extend(dummyEvent, event);
|
|
659
|
-
}
|
|
697
|
+
if (isDefined(value)) {
|
|
698
|
+
// any function which returns a value needs to be wrapped
|
|
699
|
+
value = JQLite(value);
|
|
700
|
+
}
|
|
701
|
+
} else {
|
|
702
|
+
if (element.getElementsByTagName) {
|
|
703
|
+
addNodes(value, element.getElementsByTagName(selector));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return isDefined(value) ? value : this;
|
|
708
|
+
};
|
|
660
709
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
710
|
+
/**
|
|
711
|
+
* TODO: REMOVE! This function being used ONLY in tests!
|
|
712
|
+
*/
|
|
713
|
+
JQLite.prototype.triggerHandler = function (event, extraParameters) {
|
|
714
|
+
let value;
|
|
715
|
+
let fn = function (element, event, extraParameters) {
|
|
716
|
+
let dummyEvent;
|
|
717
|
+
let eventFnsCopy;
|
|
718
|
+
let handlerArgs;
|
|
719
|
+
const eventName = event.type || event;
|
|
720
|
+
const expandoStore = getExpando(element);
|
|
721
|
+
const events = expandoStore && expandoStore.events;
|
|
722
|
+
const eventFns = events && events[eventName];
|
|
723
|
+
|
|
724
|
+
if (eventFns) {
|
|
725
|
+
// Create a dummy event to pass to the handlers
|
|
726
|
+
dummyEvent = {
|
|
727
|
+
preventDefault() {
|
|
728
|
+
this.defaultPrevented = true;
|
|
729
|
+
},
|
|
730
|
+
isDefaultPrevented() {
|
|
731
|
+
return this.defaultPrevented === true;
|
|
732
|
+
},
|
|
733
|
+
stopImmediatePropagation() {
|
|
734
|
+
this.immediatePropagationStopped = true;
|
|
735
|
+
},
|
|
736
|
+
isImmediatePropagationStopped() {
|
|
737
|
+
return this.immediatePropagationStopped === true;
|
|
738
|
+
},
|
|
739
|
+
stopPropagation: () => {},
|
|
740
|
+
type: eventName,
|
|
741
|
+
target: element,
|
|
742
|
+
};
|
|
666
743
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
});
|
|
744
|
+
// If a custom event was provided then extend our dummy event with it
|
|
745
|
+
if (event.type) {
|
|
746
|
+
dummyEvent = extend(dummyEvent, event);
|
|
672
747
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
if (isUndefined(value)) {
|
|
684
|
-
value = fn(this[i], arg1, arg2, arg3);
|
|
685
|
-
if (isDefined(value)) {
|
|
686
|
-
// any function which returns a value needs to be wrapped
|
|
687
|
-
value = JQLite(value);
|
|
688
|
-
}
|
|
689
|
-
} else {
|
|
690
|
-
addNodes(value, fn(this[i], arg1, arg2, arg3));
|
|
748
|
+
|
|
749
|
+
// Copy event handlers in case event handlers array is modified during execution.
|
|
750
|
+
eventFnsCopy = shallowCopy(eventFns);
|
|
751
|
+
handlerArgs = extraParameters
|
|
752
|
+
? [dummyEvent].concat(extraParameters)
|
|
753
|
+
: [dummyEvent];
|
|
754
|
+
|
|
755
|
+
forEach(eventFnsCopy, (fn) => {
|
|
756
|
+
if (!dummyEvent.isImmediatePropagationStopped()) {
|
|
757
|
+
fn.apply(element, handlerArgs);
|
|
691
758
|
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
for (let i = 0, ii = this.length; i < ii; i++) {
|
|
763
|
+
if (isUndefined(value)) {
|
|
764
|
+
value = fn(this[i], event, extraParameters);
|
|
765
|
+
if (isDefined(value)) {
|
|
766
|
+
// @ts-ignore
|
|
767
|
+
value = JQLite(value);
|
|
692
768
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
769
|
+
} else {
|
|
770
|
+
// @ts-ignore
|
|
771
|
+
addNodes(value, fn(this[i], event, extraParameters));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return isDefined(value) ? value : this;
|
|
775
|
+
};
|
|
697
776
|
|
|
698
777
|
///////////////////////////////////////////////////////////////////
|
|
699
778
|
//////////// HELPER FUNCTIONS /////////////////////////
|
package/src/shared/utils.js
CHANGED
|
@@ -309,7 +309,6 @@ export function trim(value) {
|
|
|
309
309
|
return isString(value) ? value.trim() : value;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// eslint-disable-next-line camelcase
|
|
313
312
|
export function snakeCase(name, separator) {
|
|
314
313
|
const modseparator = separator || "_";
|
|
315
314
|
return name.replace(
|
|
@@ -399,7 +398,7 @@ export function forEachSorted(obj, iterator, context) {
|
|
|
399
398
|
|
|
400
399
|
/**
|
|
401
400
|
* when using forEach the params are value, key, but it is often useful to have key, value.
|
|
402
|
-
* @param {function(string, *)} iteratorFn
|
|
401
|
+
* @param {function(string, *):any} iteratorFn
|
|
403
402
|
* @returns {function(*, string)}
|
|
404
403
|
*/
|
|
405
404
|
export function reverseParams(iteratorFn) {
|
|
@@ -473,8 +472,8 @@ export function baseExtend(dst, objs, deep) {
|
|
|
473
472
|
* @param {...Object} src Source object(s).
|
|
474
473
|
* @returns {Object} Reference to `dst`.
|
|
475
474
|
*/
|
|
476
|
-
export function extend(dst) {
|
|
477
|
-
return baseExtend(dst,
|
|
475
|
+
export function extend(dst, ...src) {
|
|
476
|
+
return baseExtend(dst, src, false);
|
|
478
477
|
}
|
|
479
478
|
|
|
480
479
|
/**
|
|
@@ -515,15 +514,27 @@ export function merge(dst, ...src) {
|
|
|
515
514
|
return baseExtend(dst, src, true);
|
|
516
515
|
}
|
|
517
516
|
|
|
517
|
+
/**
|
|
518
|
+
* @param {string} str
|
|
519
|
+
* @returns {number}
|
|
520
|
+
*/
|
|
518
521
|
export function toInt(str) {
|
|
519
522
|
return parseInt(str, 10);
|
|
520
523
|
}
|
|
521
524
|
|
|
525
|
+
/**
|
|
526
|
+
* @param {any} num
|
|
527
|
+
* @returns {boolean}
|
|
528
|
+
*/
|
|
522
529
|
export function isNumberNaN(num) {
|
|
523
|
-
// eslint-disable-next-line no-self-compare
|
|
524
530
|
return Number.isNaN(num);
|
|
525
531
|
}
|
|
526
532
|
|
|
533
|
+
/**
|
|
534
|
+
* @param {Object} parent
|
|
535
|
+
* @param {Object} extra
|
|
536
|
+
* @returns {Object}
|
|
537
|
+
*/
|
|
527
538
|
export function inherit(parent, extra) {
|
|
528
539
|
return extend(Object.create(parent), extra);
|
|
529
540
|
}
|
|
@@ -599,7 +610,7 @@ export function isElement(node) {
|
|
|
599
610
|
*
|
|
600
611
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
601
612
|
*
|
|
602
|
-
* @param {JQLite|Element} element
|
|
613
|
+
* @param {import('../shared/jqlite/jqlite').JQLite|Element} element
|
|
603
614
|
* @returns
|
|
604
615
|
*/
|
|
605
616
|
export function getNodeName(element) {
|
|
@@ -699,7 +710,7 @@ export function simpleCompare(a, b) {
|
|
|
699
710
|
export function equals(o1, o2) {
|
|
700
711
|
if (o1 === o2) return true;
|
|
701
712
|
if (o1 === null || o2 === null) return false;
|
|
702
|
-
|
|
713
|
+
|
|
703
714
|
if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
|
|
704
715
|
const t1 = typeof o1;
|
|
705
716
|
const t2 = typeof o2;
|
package/src/types.js
CHANGED
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
* @template T
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {function(any, any=): any} CompiledExpression
|
|
16
|
+
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
17
|
+
* @property {boolean} constant - Indicates if the expression is constant.
|
|
18
|
+
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
19
|
+
* undefined is gonna be used since the implementation
|
|
20
|
+
* does not check the parameter. Let's force a value for consistency. If consumer
|
|
21
|
+
* wants to undefine it, pass the undefined value explicitly.
|
|
22
|
+
*/
|
|
23
|
+
|
|
14
24
|
/**
|
|
15
25
|
* @typedef {Object} ComponentOptions
|
|
16
26
|
* @description Component definition object (a simplified directive definition object)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ASTType = ("Program" | "ExpressionStatement" | "AssignmentExpression" | "ConditionalExpression" | "LogicalExpression" | "BinaryExpression" | "UnaryExpression" | "CallExpression" | "MemberExpression" | "Identifier" | "Literal" | "ArrayExpression" | "Property" | "ObjectExpression" | "ThisExpression" | "LocalsExpression" | "NGValueParameter");
|
|
2
|
+
export namespace ASTType {
|
|
3
|
+
let Program: string;
|
|
4
|
+
let ExpressionStatement: string;
|
|
5
|
+
let AssignmentExpression: string;
|
|
6
|
+
let ConditionalExpression: string;
|
|
7
|
+
let LogicalExpression: string;
|
|
8
|
+
let BinaryExpression: string;
|
|
9
|
+
let UnaryExpression: string;
|
|
10
|
+
let CallExpression: string;
|
|
11
|
+
let MemberExpression: string;
|
|
12
|
+
let Identifier: string;
|
|
13
|
+
let Literal: string;
|
|
14
|
+
let ArrayExpression: string;
|
|
15
|
+
let Property: string;
|
|
16
|
+
let ObjectExpression: string;
|
|
17
|
+
let ThisExpression: string;
|
|
18
|
+
let LocalsExpression: string;
|
|
19
|
+
let NGValueParameter: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export function AST(lexer: any, options: any): void;
|
|
2
|
+
export class AST {
|
|
3
|
+
constructor(lexer: any, options: any);
|
|
4
|
+
lexer: any;
|
|
5
|
+
options: any;
|
|
6
|
+
ast(text: any): {
|
|
7
|
+
type: string;
|
|
8
|
+
body: {
|
|
9
|
+
type: string;
|
|
10
|
+
expression: any;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
text: any;
|
|
14
|
+
tokens: any;
|
|
15
|
+
program(): {
|
|
16
|
+
type: string;
|
|
17
|
+
body: {
|
|
18
|
+
type: string;
|
|
19
|
+
expression: any;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
expressionStatement(): {
|
|
23
|
+
type: string;
|
|
24
|
+
expression: any;
|
|
25
|
+
};
|
|
26
|
+
filterChain(): any;
|
|
27
|
+
expression(): any;
|
|
28
|
+
assignment(): any;
|
|
29
|
+
ternary(): any;
|
|
30
|
+
logicalOR(): any;
|
|
31
|
+
logicalAND(): any;
|
|
32
|
+
equality(): any;
|
|
33
|
+
relational(): any;
|
|
34
|
+
additive(): any;
|
|
35
|
+
multiplicative(): any;
|
|
36
|
+
unary(): any;
|
|
37
|
+
primary(): any;
|
|
38
|
+
filter(baseExpression: any): {
|
|
39
|
+
type: string;
|
|
40
|
+
callee: {
|
|
41
|
+
type: string;
|
|
42
|
+
name: any;
|
|
43
|
+
};
|
|
44
|
+
arguments: any[];
|
|
45
|
+
filter: boolean;
|
|
46
|
+
};
|
|
47
|
+
parseArguments(): any;
|
|
48
|
+
identifier(): {
|
|
49
|
+
type: string;
|
|
50
|
+
name: any;
|
|
51
|
+
};
|
|
52
|
+
constant(): {
|
|
53
|
+
type: string;
|
|
54
|
+
value: any;
|
|
55
|
+
};
|
|
56
|
+
arrayDeclaration(): any;
|
|
57
|
+
object(): {
|
|
58
|
+
type: string;
|
|
59
|
+
properties: {
|
|
60
|
+
type: string;
|
|
61
|
+
kind: string;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
throwError(msg: any, token: any): never;
|
|
65
|
+
consume(e1: any): any;
|
|
66
|
+
peekToken(): any;
|
|
67
|
+
peek(e1: any, e2: any, e3: any, e4: any): any;
|
|
68
|
+
peekAhead(i: any, e1: any, e2: any, e3: any, e4: any): any;
|
|
69
|
+
expect(e1: any, e2: any, e3: any, e4: any): any;
|
|
70
|
+
selfReferential: {
|
|
71
|
+
this: {
|
|
72
|
+
type: string;
|
|
73
|
+
};
|
|
74
|
+
$locals: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function ASTCompiler($filter: any): void;
|
|
2
|
+
export class ASTCompiler {
|
|
3
|
+
constructor($filter: any);
|
|
4
|
+
$filter: any;
|
|
5
|
+
compile(ast: any): any;
|
|
6
|
+
state: {
|
|
7
|
+
nextId: number;
|
|
8
|
+
filters: {};
|
|
9
|
+
fn: {
|
|
10
|
+
vars: any[];
|
|
11
|
+
body: any[];
|
|
12
|
+
own: {};
|
|
13
|
+
};
|
|
14
|
+
assign: {
|
|
15
|
+
vars: any[];
|
|
16
|
+
body: any[];
|
|
17
|
+
own: {};
|
|
18
|
+
};
|
|
19
|
+
inputs: any[];
|
|
20
|
+
};
|
|
21
|
+
stage: string;
|
|
22
|
+
watchFns(): string;
|
|
23
|
+
generateFunction(name: any, params: any): string;
|
|
24
|
+
filterPrefix(): string;
|
|
25
|
+
varsPrefix(section: any): string;
|
|
26
|
+
body(section: any): any;
|
|
27
|
+
recurse(ast: any, intoId: any, nameId: any, recursionFn: any, create: any, skipWatchIdCheck: any): void;
|
|
28
|
+
getHasOwnProperty(element: any, property: any): any;
|
|
29
|
+
assign(id: any, value: any): any;
|
|
30
|
+
filter(filterName: any): any;
|
|
31
|
+
ifDefined(id: any, defaultValue: any): string;
|
|
32
|
+
plus(left: any, right: any): string;
|
|
33
|
+
return_(id: any): void;
|
|
34
|
+
if_(test: any, alternate: any, consequent: any): void;
|
|
35
|
+
not(expression: any): string;
|
|
36
|
+
isNull(expression: any): string;
|
|
37
|
+
notNull(expression: any): string;
|
|
38
|
+
nonComputedMember(left: any, right: any): string;
|
|
39
|
+
computedMember(left: any, right: any): string;
|
|
40
|
+
member(left: any, right: any, computed: any): string;
|
|
41
|
+
getStringValue(item: any): void;
|
|
42
|
+
lazyRecurse(ast: any, intoId: any, nameId: any, recursionFn: any, create: any, skipWatchIdCheck: any): () => void;
|
|
43
|
+
lazyAssign(id: any, value: any): () => void;
|
|
44
|
+
stringEscapeRegex: RegExp;
|
|
45
|
+
stringEscapeFn(c: any): string;
|
|
46
|
+
escape(value: any): any;
|
|
47
|
+
nextId(skip: any, init: any): string;
|
|
48
|
+
current(): any;
|
|
49
|
+
}
|