babel-plugin-wallace 0.0.6 → 0.0.8
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/ast-helpers.d.ts +1 -1
- package/dist/ast-helpers.js +2 -10
- package/dist/ast-helpers.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +9 -9
- package/dist/consolidation/ComponentDefinitionData.d.ts +7 -7
- package/dist/consolidation/ComponentDefinitionData.js +19 -24
- package/dist/consolidation/ComponentDefinitionData.js.map +1 -1
- package/dist/consolidation/consolidateComponent.d.ts +1 -1
- package/dist/consolidation/consolidateComponent.js +2 -2
- package/dist/consolidation/consolidateComponent.js.map +1 -1
- package/dist/consolidation/processNodes.js +62 -36
- package/dist/consolidation/processNodes.js.map +1 -1
- package/dist/consolidation/types.d.ts +10 -4
- package/dist/consolidation/utils.js +0 -1
- package/dist/consolidation/utils.js.map +1 -1
- package/dist/consolidation/visibility.d.ts +1 -4
- package/dist/consolidation/visibility.js +10 -31
- package/dist/consolidation/visibility.js.map +1 -1
- package/dist/constants.d.ts +7 -5
- package/dist/constants.js +12 -10
- package/dist/constants.js.map +1 -1
- package/dist/contexts/parameters.js +7 -6
- package/dist/contexts/parameters.js.map +1 -1
- package/dist/directives.js +22 -5
- package/dist/directives.js.map +1 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +3 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/models/component.js +4 -2
- package/dist/models/component.js.map +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/node.d.ts +7 -3
- package/dist/models/node.js +16 -101
- package/dist/models/node.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/visitors/attribute.js +8 -3
- package/dist/visitors/attribute.js.map +1 -1
- package/dist/writers/define-component.js +45 -33
- package/dist/writers/define-component.js.map +1 -1
- package/package.json +2 -2
package/dist/ast-helpers.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare function getJSXElementName(path: NodePath<JSXElement>): string |
|
|
|
7
7
|
/**
|
|
8
8
|
* An Expression can be one of dozens of types, most of which are not usable.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getPlaceholderExpression(path: NodePath, expression: Expression | JSXEmptyExpression): Expression;
|
|
10
|
+
export declare function getPlaceholderExpression(path: NodePath, expression: Expression | JSXEmptyExpression): Expression | undefined;
|
package/dist/ast-helpers.js
CHANGED
|
@@ -31,22 +31,14 @@ function getJSXElementName(path) {
|
|
|
31
31
|
* An Expression can be one of dozens of types, most of which are not usable.
|
|
32
32
|
*/
|
|
33
33
|
function getPlaceholderExpression(path, expression) {
|
|
34
|
-
// if (
|
|
35
|
-
// // TODO: I probably need to expand this...
|
|
36
|
-
// t.isIdentifier(expression) ||
|
|
37
|
-
// t.isMemberExpression(expression) ||
|
|
38
|
-
// t.isCallExpression(expression)
|
|
39
|
-
// ) {
|
|
40
|
-
// return expression;
|
|
41
|
-
// } else
|
|
42
34
|
if (t.isJSXEmptyExpression(expression)) {
|
|
43
|
-
|
|
35
|
+
// This is really to handle comments
|
|
36
|
+
return undefined;
|
|
44
37
|
}
|
|
45
38
|
else if (t.isObjectExpression(expression)) {
|
|
46
39
|
// The code is copied, so the object would be created afresh each time.
|
|
47
40
|
(0, errors_1.error)(path, errors_1.ERROR_MESSAGES.PLACEHOLDER_MAY_NOT_BE_LITERAL_OBJECT);
|
|
48
41
|
}
|
|
49
|
-
//error(path, ERROR_MESSAGES.INVALID_PLACEHOLDER_EXPRESSION);
|
|
50
42
|
return expression;
|
|
51
43
|
}
|
|
52
44
|
//# sourceMappingURL=ast-helpers.js.map
|
package/dist/ast-helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-helpers.js","sourceRoot":"","sources":["../src/ast-helpers.ts"],"names":[],"mappings":";;AAKA,8CAoBC;AAKD,
|
|
1
|
+
{"version":3,"file":"ast-hel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AAU,CAAC,EAAE,CAAC;QACvC,oCAAoC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,uEAAuE;QACvE,IAAA,cAAK,EAAC,IAAI,EAAE,uBAAc,CAAC,qCAAqC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,UAAwB,CAAC;AAClC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Directive } from "./models";
|
|
|
2
2
|
interface GleekitOptions {
|
|
3
3
|
directives?: Array<typeof Directive>;
|
|
4
4
|
}
|
|
5
|
-
declare class
|
|
5
|
+
declare class WallaceConfig {
|
|
6
6
|
#private;
|
|
7
7
|
directives: {
|
|
8
8
|
[key: string]: typeof Directive;
|
|
@@ -10,5 +10,5 @@ declare class GleekitConfig {
|
|
|
10
10
|
applyOptions(options: GleekitOptions): void;
|
|
11
11
|
addDirectives(directives: Array<typeof Directive>): void;
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const wallaceConfig: WallaceConfig;
|
|
14
14
|
export {};
|
package/dist/config.js
CHANGED
|
@@ -10,23 +10,23 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var _WallaceConfig_loaded;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.wallaceConfig = void 0;
|
|
16
16
|
const directives_1 = require("./directives");
|
|
17
|
-
class
|
|
17
|
+
class WallaceConfig {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.directives = {};
|
|
20
|
-
|
|
20
|
+
_WallaceConfig_loaded.set(this, false);
|
|
21
21
|
}
|
|
22
22
|
applyOptions(options) {
|
|
23
|
-
if (__classPrivateFieldGet(this,
|
|
23
|
+
if (__classPrivateFieldGet(this, _WallaceConfig_loaded, "f")) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (options.directives) {
|
|
27
27
|
this.addDirectives(options.directives);
|
|
28
28
|
}
|
|
29
|
-
__classPrivateFieldSet(this,
|
|
29
|
+
__classPrivateFieldSet(this, _WallaceConfig_loaded, true, "f");
|
|
30
30
|
}
|
|
31
31
|
addDirectives(directives) {
|
|
32
32
|
for (const directiveClass of directives) {
|
|
@@ -41,7 +41,7 @@ class GleekitConfig {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
44
|
+
_WallaceConfig_loaded = new WeakMap();
|
|
45
|
+
exports.wallaceConfig = new WallaceConfig();
|
|
46
|
+
exports.wallaceConfig.addDirectives(directives_1.builtinDirectives);
|
|
47
47
|
//# sourceMappingURL=config.js.map
|
|
@@ -10,8 +10,8 @@ export declare class ComponentDefinitionData {
|
|
|
10
10
|
component: Component;
|
|
11
11
|
html: string;
|
|
12
12
|
watches: Array<ComponentWatch>;
|
|
13
|
-
|
|
14
|
-
[key:
|
|
13
|
+
dynamicElements: {
|
|
14
|
+
[key: number]: CallExpression;
|
|
15
15
|
};
|
|
16
16
|
baseComponent: Expression | undefined;
|
|
17
17
|
lookups: {
|
|
@@ -19,11 +19,11 @@ export declare class ComponentDefinitionData {
|
|
|
19
19
|
};
|
|
20
20
|
collectedRefs: Array<string>;
|
|
21
21
|
constructor(component: Component);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
addLookup(expression: Expression):
|
|
22
|
+
saveDynamicElement(address: NodeAddress): number;
|
|
23
|
+
saveNestedAsDynamicElement(address: NodeAddress, componentCls: Expression): number;
|
|
24
|
+
addLookup(expression: Expression): number;
|
|
25
25
|
getFunctionIdentifier(name: IMPORTABLES): Identifier;
|
|
26
26
|
getLookupCallBackParams(): Array<Identifier>;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
wrapDynamicElementCall(key: number, functionName: IMPORTABLES, remainingArgs: Expression[]): void;
|
|
28
|
+
getNextmiscStashKey(): number;
|
|
29
29
|
}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var _ComponentDefinitionData_dynamicElementKey, _ComponentDefinitionData_miscStashKey, _ComponentDefinitionData_lookupKeys;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ComponentDefinitionData = void 0;
|
|
16
16
|
const types_1 = require("@babel/types");
|
|
@@ -21,28 +21,26 @@ const utils_1 = require("./utils");
|
|
|
21
21
|
class ComponentDefinitionData {
|
|
22
22
|
constructor(component) {
|
|
23
23
|
this.watches = [];
|
|
24
|
-
this.
|
|
24
|
+
this.dynamicElements = {};
|
|
25
25
|
this.lookups = {};
|
|
26
26
|
this.collectedRefs = [];
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
_ComponentDefinitionData_dynamicElementKey.set(this, -1);
|
|
28
|
+
_ComponentDefinitionData_miscStashKey.set(this, 0);
|
|
29
29
|
_ComponentDefinitionData_lookupKeys.set(this, []);
|
|
30
30
|
this.component = component;
|
|
31
31
|
this.baseComponent = component.baseComponent;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
saveDynamicElement(address) {
|
|
34
34
|
var _a;
|
|
35
|
-
__classPrivateFieldSet(this,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return key;
|
|
35
|
+
__classPrivateFieldSet(this, _ComponentDefinitionData_dynamicElementKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"), _a++, _a), "f");
|
|
36
|
+
this.dynamicElements[__classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f")] = (0, utils_1.buildFindElementCall)(this.component.module, address);
|
|
37
|
+
return __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f");
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
saveNestedAsDynamicElement(address, componentCls) {
|
|
41
40
|
var _a;
|
|
42
|
-
__classPrivateFieldSet(this,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return key;
|
|
41
|
+
__classPrivateFieldSet(this, _ComponentDefinitionData_dynamicElementKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"), _a++, _a), "f");
|
|
42
|
+
this.dynamicElements[__classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f")] = (0, utils_1.buildNestedClassCall)(this.component.module, address, componentCls);
|
|
43
|
+
return __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f");
|
|
46
44
|
}
|
|
47
45
|
addLookup(expression) {
|
|
48
46
|
const hashExpression = (expr) => {
|
|
@@ -54,7 +52,7 @@ class ComponentDefinitionData {
|
|
|
54
52
|
if (__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash) === -1) {
|
|
55
53
|
__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").push(hash);
|
|
56
54
|
}
|
|
57
|
-
const key =
|
|
55
|
+
const key = __classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash);
|
|
58
56
|
this.lookups[key] = (0, types_1.functionExpression)(null, this.getLookupCallBackParams(), (0, types_1.blockStatement)([(0, types_1.returnStatement)(expression)]));
|
|
59
57
|
return key;
|
|
60
58
|
}
|
|
@@ -65,18 +63,15 @@ class ComponentDefinitionData {
|
|
|
65
63
|
getLookupCallBackParams() {
|
|
66
64
|
return [this.component.propsIdentifier, this.component.componentIdentifier];
|
|
67
65
|
}
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
this.stash[key],
|
|
71
|
-
...remainingArgs,
|
|
72
|
-
]);
|
|
66
|
+
wrapDynamicElementCall(key, functionName, remainingArgs) {
|
|
67
|
+
this.dynamicElements[key] = (0, types_1.callExpression)(this.getFunctionIdentifier(functionName), [this.dynamicElements[key], ...remainingArgs]);
|
|
73
68
|
}
|
|
74
|
-
|
|
69
|
+
getNextmiscStashKey() {
|
|
75
70
|
var _a;
|
|
76
|
-
__classPrivateFieldSet(this,
|
|
77
|
-
return __classPrivateFieldGet(this,
|
|
71
|
+
__classPrivateFieldSet(this, _ComponentDefinitionData_miscStashKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_miscStashKey, "f"), _a++, _a), "f");
|
|
72
|
+
return __classPrivateFieldGet(this, _ComponentDefinitionData_miscStashKey, "f") - 1;
|
|
78
73
|
}
|
|
79
74
|
}
|
|
80
75
|
exports.ComponentDefinitionData = ComponentDefinitionData;
|
|
81
|
-
|
|
76
|
+
_ComponentDefinitionData_dynamicElementKey = new WeakMap(), _ComponentDefinitionData_miscStashKey = new WeakMap(), _ComponentDefinitionData_lookupKeys = new WeakMap();
|
|
82
77
|
//# sourceMappingURL=ComponentDefinitionData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentDefinitionData.js","sourceRoot":"","sources":["../../src/consolidation/ComponentDefinitionData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,wCAMsB;AAItB,mCAIiB;AAEjB;;GAEG;AACH,MAAa,uBAAuB;IAWlC,YAAY,SAAoB;QARhC,YAAO,GAA0B,EAAE,CAAC;QACpC,
|
|
1
|
+
{"version":3,"file":"ComponentDefinitionData.js","sourceRoot":"","sources":["../../src/consolidation/ComponentDefinitionData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,wCAM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CAAA,MAAA,CAAC;QACrB,OAAO,uBAAA,IAAI,6CAAc,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AAvED,0DAuEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from "../models";
|
|
2
2
|
import { ComponentDefinitionData } from "./ComponentDefinitionData";
|
|
3
3
|
/**
|
|
4
|
-
* Deals with
|
|
4
|
+
* Deals with visibility toggles, setting ref keys and such.
|
|
5
5
|
*/
|
|
6
6
|
export declare function consolidateComponent(component: Component): ComponentDefinitionData;
|
|
@@ -27,13 +27,13 @@ function hoistTextNodes(component) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Deals with
|
|
30
|
+
* Deals with visibility toggles, setting ref keys and such.
|
|
31
31
|
*/
|
|
32
32
|
function consolidateComponent(component) {
|
|
33
33
|
const componentDefinition = new ComponentDefinitionData_1.ComponentDefinitionData(component);
|
|
34
34
|
hoistTextNodes(component);
|
|
35
35
|
(0, processNodes_1.processNodes)(component, componentDefinition);
|
|
36
|
-
(0, visibility_1.
|
|
36
|
+
(0, visibility_1.processeVisibilityToggles)(componentDefinition.watches);
|
|
37
37
|
// This must be done after all the processing, as DOM may have changed.
|
|
38
38
|
componentDefinition.html = component.rootElement.outerHTML;
|
|
39
39
|
return componentDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consolidateComponent.js","sourceRoot":"","sources":["../../src/consolidation/consolidateComponent.ts"],"names":[],"mappings":";;AA8BA,oDAUC;AAxCD,sCAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"consolidateComponent.js","sourceRoot":"","sources":["../../src/consolidation/consolidateComponent.ts"],"names":[],"mappings":";;AA8BA,oDAUC;AAxCD,sCAAuD;AACvD,6CAAyD;AACzD,uEAAoE;AACpE,iDAA8C;AAC9C,mCAAsC;AAEtC;;;GAGG;AACH,SAAS,cAAc,CAAC,SAAoB;IAC1C,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,IAAI,YAAY,wBAAe,EAAE,CAAC;YACpC,IAAI,IAAA,mBAAW,EAAC,IAAI,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC3B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;gBACrC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,SAAoB;IAEpB,MAAM,mBAAmB,GAAG,IAAI,iDAAuB,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,SAAS,CAAC,CAAC;IAC1B,IAAA,2BAAY,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAC7C,IAAA,sCAAyB,EAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACvD,uEAAuE;IACvE,mBAAmB,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC;IAC3D,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -14,7 +14,7 @@ function addBindInstruction(node) {
|
|
|
14
14
|
const attribute = inputType === "checkbox" ? "checked" : "value";
|
|
15
15
|
node.bindInstructions.forEach(({ eventName, expression }) => {
|
|
16
16
|
node.watchAttribute(attribute, expression);
|
|
17
|
-
const callback = t.assignmentExpression("=", expression, t.memberExpression(t.identifier(constants_1.
|
|
17
|
+
const callback = t.assignmentExpression("=", expression, t.memberExpression(t.identifier(constants_1.EXTRA_PARAMETERS.element), t.identifier(attribute)));
|
|
18
18
|
node.addEventListener(eventName, callback);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -22,14 +22,6 @@ function addBindInstruction(node) {
|
|
|
22
22
|
(0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.BIND_ONLY_ALLOWED_ON_INPUT);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function addShieldInfo(componentDefinition, componentWatch, shieldInfo) {
|
|
26
|
-
const shieldLookupKey = componentDefinition.addLookup(shieldInfo.expression);
|
|
27
|
-
componentWatch.shieldInfo = {
|
|
28
|
-
count: 0,
|
|
29
|
-
key: shieldLookupKey,
|
|
30
|
-
reverse: shieldInfo.reverse,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
25
|
function ensureToggleTargetsHaveTriggers(node) {
|
|
34
26
|
node.toggleTargets.forEach((target) => {
|
|
35
27
|
const match = node.toggleTriggers.find((trigger) => trigger.name == target.name);
|
|
@@ -86,28 +78,39 @@ function processNodes(component, componentDefinition) {
|
|
|
86
78
|
const stubComponentName = stubName
|
|
87
79
|
? t.memberExpression(t.identifier(constants_1.COMPONENT_BUILD_PARAMS.component), t.identifier(stubName))
|
|
88
80
|
: undefined;
|
|
89
|
-
const
|
|
81
|
+
const visibilityToggle = node.getVisibilityToggle();
|
|
90
82
|
const ref = node.getRef();
|
|
91
83
|
const repeatInstruction = node.getRepeatInstruction();
|
|
92
84
|
const createWatch = node.watches.length > 0 ||
|
|
93
85
|
node.bindInstructions.length > 0 ||
|
|
94
86
|
node.toggleTriggers.length > 0 ||
|
|
95
|
-
|
|
87
|
+
visibilityToggle ||
|
|
96
88
|
node.isNestedClass ||
|
|
97
89
|
stubName ||
|
|
98
90
|
repeatInstruction;
|
|
99
|
-
|
|
91
|
+
// TODO: should ref really save the element?
|
|
92
|
+
const shouldSaveElement = createWatch ||
|
|
93
|
+
ref ||
|
|
94
|
+
node.eventListeners.length > 0 ||
|
|
95
|
+
node.hasConditionalChildren;
|
|
100
96
|
ensureToggleTargetsHaveTriggers(node);
|
|
101
|
-
if (
|
|
97
|
+
if (shouldSaveElement) {
|
|
102
98
|
const nestedComponentCls = node.isNestedClass
|
|
103
99
|
? t.identifier(node.tagName)
|
|
104
100
|
: stubComponentName;
|
|
105
|
-
|
|
106
|
-
? componentDefinition.
|
|
107
|
-
: componentDefinition.
|
|
101
|
+
node.elementKey = nestedComponentCls
|
|
102
|
+
? componentDefinition.saveNestedAsDynamicElement(node.address, nestedComponentCls)
|
|
103
|
+
: componentDefinition.saveDynamicElement(node.address);
|
|
108
104
|
if (node.bindInstructions.length) {
|
|
109
105
|
addBindInstruction(node);
|
|
110
106
|
}
|
|
107
|
+
if (node.hasConditionalChildren) {
|
|
108
|
+
node.detacherStashKey = componentDefinition.getNextmiscStashKey();
|
|
109
|
+
componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.stashMisc, [
|
|
110
|
+
(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
|
|
111
|
+
t.objectExpression([]),
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
111
114
|
if (createWatch) {
|
|
112
115
|
const _callbacks = {};
|
|
113
116
|
const addCallbackStatement = (key, statements) => {
|
|
@@ -117,7 +120,7 @@ function processNodes(component, componentDefinition) {
|
|
|
117
120
|
_callbacks[key].push(...statements);
|
|
118
121
|
};
|
|
119
122
|
const componentWatch = {
|
|
120
|
-
|
|
123
|
+
elementKey: node.elementKey,
|
|
121
124
|
callbacks: {},
|
|
122
125
|
address: node.address,
|
|
123
126
|
};
|
|
@@ -128,7 +131,10 @@ function processNodes(component, componentDefinition) {
|
|
|
128
131
|
});
|
|
129
132
|
if (node.isNestedClass) {
|
|
130
133
|
const props = node.getProps();
|
|
131
|
-
const
|
|
134
|
+
const ctrlArg = (0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.ctrl));
|
|
135
|
+
const args = props
|
|
136
|
+
? [props, ctrlArg]
|
|
137
|
+
: [(0, types_1.identifier)("undefined"), ctrlArg];
|
|
132
138
|
addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
|
|
133
139
|
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)("render")), args)),
|
|
134
140
|
]);
|
|
@@ -139,25 +145,45 @@ function processNodes(component, componentDefinition) {
|
|
|
139
145
|
// Need to be careful with WATCH_CALLBACK_PARAMS
|
|
140
146
|
if (stubName) {
|
|
141
147
|
addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
|
|
142
|
-
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)("render")), [
|
|
148
|
+
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)("render")), [
|
|
149
|
+
component.propsIdentifier,
|
|
150
|
+
(0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.ctrl)),
|
|
151
|
+
])),
|
|
143
152
|
]);
|
|
144
153
|
}
|
|
145
|
-
if (
|
|
146
|
-
|
|
154
|
+
if (visibilityToggle) {
|
|
155
|
+
const shieldLookupKey = componentDefinition.addLookup(visibilityToggle.expression);
|
|
156
|
+
componentWatch.shieldInfo = {
|
|
157
|
+
skipCount: 0, // gets set later once we've processed all the nodes.
|
|
158
|
+
key: shieldLookupKey,
|
|
159
|
+
reverse: visibilityToggle.reverse,
|
|
160
|
+
};
|
|
161
|
+
if (visibilityToggle.detach) {
|
|
162
|
+
if (node.parent.detacherStashKey === undefined) {
|
|
163
|
+
throw new Error("Parent node was not given a stash key");
|
|
164
|
+
}
|
|
165
|
+
componentWatch.shieldInfo.detacher = {
|
|
166
|
+
index: node.address[node.address.length - 1],
|
|
167
|
+
stashKey: node.parent.detacherStashKey,
|
|
168
|
+
parentKey: node.parent.elementKey,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
147
171
|
}
|
|
148
172
|
if (repeatInstruction) {
|
|
149
|
-
|
|
150
|
-
componentDefinition.component.module.requireImport(constants_1.IMPORTABLES.getSequentialPool);
|
|
173
|
+
componentDefinition.component.module.requireImport(constants_1.IMPORTABLES.getSequentialRepeater);
|
|
151
174
|
const poolInstance = repeatInstruction.poolExpression ||
|
|
152
|
-
(0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.
|
|
175
|
+
(0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.getSequentialRepeater), [
|
|
153
176
|
(0, types_1.identifier)(repeatInstruction.componentCls),
|
|
154
177
|
]);
|
|
155
|
-
|
|
178
|
+
// TODO: couple the stash index with the call to save - if possible?
|
|
179
|
+
// Or make it an object and pass the key when saving.
|
|
180
|
+
const miscStashKey = componentDefinition.getNextmiscStashKey();
|
|
181
|
+
componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.stashMisc, [(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component), poolInstance]);
|
|
156
182
|
addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
|
|
157
|
-
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.objectStash)), (0, types_1.numericLiteral)(
|
|
183
|
+
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.objectStash)), (0, types_1.numericLiteral)(miscStashKey), true), (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.patch)), [
|
|
158
184
|
(0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element),
|
|
159
185
|
repeatInstruction.expression,
|
|
160
|
-
component.componentIdentifier,
|
|
186
|
+
(0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.ctrl)),
|
|
161
187
|
])),
|
|
162
188
|
]);
|
|
163
189
|
}
|
|
@@ -177,23 +203,23 @@ function processNodes(component, componentDefinition) {
|
|
|
177
203
|
(0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REFS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT);
|
|
178
204
|
}
|
|
179
205
|
componentDefinition.collectedRefs.push(ref);
|
|
180
|
-
componentDefinition.
|
|
181
|
-
(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
|
|
182
|
-
(0, types_1.stringLiteral)(ref),
|
|
183
|
-
]);
|
|
206
|
+
componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.saveRef, [(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component), (0, types_1.stringLiteral)(ref)]);
|
|
184
207
|
}
|
|
185
|
-
//
|
|
186
|
-
//
|
|
208
|
+
// TODO: improve this, as we are basically renaming things specifically for the
|
|
209
|
+
// build function that have already been renamed, which can get confusing.
|
|
210
|
+
// It also needs to rename ctrl and props explicitly as it doesn't seem to
|
|
211
|
+
// rename component when it's a member expression.
|
|
187
212
|
const eventVariableMapping = {
|
|
188
213
|
[component.componentIdentifier.name]: constants_1.COMPONENT_BUILD_PARAMS.component,
|
|
214
|
+
[component.componentIdentifier.name + "." + constants_1.SPECIAL_SYMBOLS.ctrl]: `${constants_1.COMPONENT_BUILD_PARAMS.component}.${constants_1.SPECIAL_SYMBOLS.ctrl}`,
|
|
189
215
|
[component.propsIdentifier.name]: `${constants_1.COMPONENT_BUILD_PARAMS.component}.props`,
|
|
190
|
-
[constants_1.
|
|
216
|
+
[constants_1.EXTRA_PARAMETERS.element]: `${constants_1.EXTRA_PARAMETERS.event}.target`,
|
|
191
217
|
};
|
|
192
218
|
node.eventListeners.forEach((listener) => {
|
|
193
219
|
const updatedExpression = (0, utils_2.renameVariablesInExpression)(listener.callback, eventVariableMapping);
|
|
194
|
-
componentDefinition.
|
|
220
|
+
componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.onEvent, [
|
|
195
221
|
(0, types_1.stringLiteral)(listener.eventName),
|
|
196
|
-
(0, types_1.functionExpression)(null, [(0, types_1.identifier)(constants_1.
|
|
222
|
+
(0, types_1.functionExpression)(null, [(0, types_1.identifier)(constants_1.EXTRA_PARAMETERS.event)], (0, types_1.blockStatement)([(0, types_1.expressionStatement)(updatedExpression)])),
|
|
197
223
|
]);
|
|
198
224
|
});
|
|
199
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processNodes.js","sourceRoot":"","sources":["../../src/consolidation/processNodes.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"processNodes.js","sourceRoot":"","sources":["../../src/consolidation/processNodes.ts"],"names":[],"mappings":";;AAuHA,oCAwRC;AA9YD,wCASsB;AACtB,kCAAkC;AAClC,oCAAsC;AAEtC,sCAAkD;AAClD,4CAMsB;AAGtB,mCAKiB;AAEjB,SAAS,kBAAkB,CAAC,IAAmB;IAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,OAAO,EAAE,CAAC;QAC1C,aAAa;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAClD,MAAM,SAAS,GAAG,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,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0E;YAC1E,kDAAkD;YAClD,MAAM,oBAAoB,GAA8B;gBACtD,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,kCAAsB,CAAC,SAAS;gBACtE,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,GAAG,GAAG,GAAG,2BAAe,CAAC,IAAI,CAAC,EAC/D,GAAG,kCAAsB,CAAC,SAAS,IAAI,2BAAe,CAAC,IAAI,EAAE;gBAC/D,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,EAC9B,GAAG,kCAAsB,CAAC,SAAS,QAAQ;gBAC7C,CAAC,4BAAgB,CAAC,OAAO,CAAC,EAAE,GAAG,4BAAgB,CAAC,KAAK,SAAS;aAC/D,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACvC,MAAM,iBAAiB,GAAG,IAAA,mCAA2B,EACnD,QAAQ,CAAC,QAAQ,EACjB,oBAAoB,CACrB,CAAC;gBAEF,mBAAmB,CAAC,sBAAsB,CACxC,IAAI,CAAC,UAAU,EACf,uBAAW,CAAC,OAAO,EACnB;oBACE,IAAA,qBAAa,EAAC,QAAQ,CAAC,SAAS,CAAC;oBACjC,IAAA,0BAAkB,EAChB,IAAI,EACJ,CAAC,IAAA,kBAAU,EAAC,4BAAgB,CAAC,KAAK,CAAC,CAAC,EACpC,IAAA,sBAAc,EAAC,CAAC,IAAA,2BAAmB,EAAC,iBAAiB,CAAC,CAAC,CAAC,CACzD;iBACF,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import type { FunctionExpression } from "@babel/types";
|
|
2
2
|
export type NodeAddress = Array<number>;
|
|
3
|
+
export interface Detacher {
|
|
4
|
+
index: number;
|
|
5
|
+
stashKey: number;
|
|
6
|
+
parentKey: number;
|
|
7
|
+
}
|
|
3
8
|
export interface ShieldInfo {
|
|
4
|
-
key:
|
|
9
|
+
key: number;
|
|
5
10
|
reverse: boolean;
|
|
6
|
-
|
|
11
|
+
skipCount: number;
|
|
12
|
+
detacher?: Detacher;
|
|
7
13
|
}
|
|
8
14
|
export interface ComponentWatch {
|
|
9
|
-
|
|
15
|
+
elementKey: number;
|
|
10
16
|
shieldInfo?: ShieldInfo | undefined;
|
|
11
17
|
callbacks: {
|
|
12
|
-
[key: string]: FunctionExpression;
|
|
18
|
+
[key: string | number]: FunctionExpression;
|
|
13
19
|
};
|
|
14
20
|
address: NodeAddress;
|
|
15
21
|
}
|
|
@@ -32,7 +32,6 @@ function buildNestedClassCall(module, address, componentCls) {
|
|
|
32
32
|
(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
|
|
33
33
|
buildAddressArray(address),
|
|
34
34
|
componentCls,
|
|
35
|
-
(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
|
|
36
35
|
]);
|
|
37
36
|
}
|
|
38
37
|
function removeKeys(obj, keys) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/consolidation/utils.ts"],"names":[],"mappings":";;AAiBA,kCAKC;AAED,kCAKC;AAED,8CAEC;AAED,oDASC;AAED,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/consolidation/utils.ts"],"names":[],"mappings":";;AAiBA,kCAKC;AAED,kCAKC;AAED,8CAEC;AAED,oDASC;AAED,oDAWC;AAED,gCAKC;AAMD,kEAmCC;AAMD,4DAQC;AAtHD,wCAOsB;AAEtB,4CAIsB;AAGtB,SAAgB,WAAW,CACzB,IAAmB,EACnB,QAA8B;IAE9B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;AACxE,CAAC;AA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B,CAAC,QAAQ;QAC9B,iCAAqB,CAAC,OAAO;QAC7B,iCAAqB,CAAC,KAAK;QAC3B,iCAAqB,CAAC,SAAS;KAChC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import { ComponentWatch } from "./types";
|
|
2
|
-
|
|
3
|
-
* Must be done after processing watches as we need to know how many watches to skip.
|
|
4
|
-
*/
|
|
5
|
-
export declare function processShields(watches: Array<ComponentWatch>): void;
|
|
2
|
+
export declare function processeVisibilityToggles(watches: Array<ComponentWatch>): void;
|
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.processeVisibilityToggles = processeVisibilityToggles;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
/*
|
|
6
|
-
* Given an array of addresses such as:
|
|
7
|
-
*
|
|
8
|
-
* [
|
|
9
|
-
* [0],
|
|
10
|
-
* [0, 1],
|
|
11
|
-
* [0, 2],
|
|
12
|
-
* [1],
|
|
13
|
-
* ]
|
|
14
|
-
*
|
|
15
|
-
* It returns an array with the count of nested items, like so:
|
|
16
|
-
*
|
|
17
|
-
* [2, 0, 0, 0]
|
|
18
|
-
*/
|
|
19
|
-
function calculateShieldCounts(addresses) {
|
|
20
|
-
const processedAddresses = [];
|
|
21
|
-
addresses.forEach((path) => {
|
|
22
|
-
processedAddresses.forEach((processed) => {
|
|
23
|
-
if ((0, utils_1.arrayStartsWith)(processed.path, path)) {
|
|
24
|
-
processed.count++;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
processedAddresses.push({ path: path, count: 0 });
|
|
28
|
-
});
|
|
29
|
-
return processedAddresses.map((i) => i.count);
|
|
30
|
-
}
|
|
31
5
|
/**
|
|
6
|
+
* Sets the skipCount of each watch's shieldInfo.
|
|
7
|
+
* This indicates how many watches to skip if that element is hidden.
|
|
32
8
|
* Must be done after processing watches as we need to know how many watches to skip.
|
|
33
9
|
*/
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
10
|
+
function setSkipCounts(watch, index, watches) {
|
|
11
|
+
watch.shieldInfo.skipCount = watches
|
|
12
|
+
.slice(index)
|
|
13
|
+
.filter((w) => (0, utils_1.arrayStartsWith)(watch.address, w.address)).length;
|
|
14
|
+
}
|
|
15
|
+
function processeVisibilityToggles(watches) {
|
|
37
16
|
watches.forEach((watch, index) => {
|
|
38
17
|
if (watch.shieldInfo) {
|
|
39
|
-
watch
|
|
18
|
+
setSkipCounts(watch, index, watches);
|
|
40
19
|
}
|
|
41
20
|
});
|
|
42
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../src/consolidation/visibility.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../src/consolidation/visibility.ts"],"names":[],"mappings":";;AAkBA,8DAMC;AAxBD,oCAA2C;AAG3C;;;;GAIG;AACH,SAAS,aAAa,CACpB,KAAqB,EACrB,KAAa,EACb,OAA8B;IAE9B,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO;SACjC,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AACrE,CAAC;AAED,SAAgB,yBAAyB,CAAC,OAA8B;IACtE,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC/B,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|