UNPKG

@xailabs/altx

Version:

Flux flavor based on alt.js

1,206 lines (1,205 loc) 364 kB
{ "type": "File", "start": 0, "end": 2825, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 67, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2825, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 67, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 65, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 34 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 14, "end": 29, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 2, "column": 19 } }, "imported": { "type": "Identifier", "start": 14, "end": 18, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 2, "column": 8 }, "identifierName": "bind" }, "name": "bind" }, "local": { "type": "Identifier", "start": 22, "end": 29, "loc": { "start": { "line": 2, "column": 12 }, "end": { "line": 2, "column": 19 }, "identifierName": "bindAlt" }, "name": "bindAlt" } } ], "source": { "type": "StringLiteral", "start": 38, "end": 64, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 33 } }, "extra": { "rawValue": "alt-utils/lib/decorators", "raw": "'alt-utils/lib/decorators'" }, "value": "alt-utils/lib/decorators" }, "trailingComments": [ { "type": "CommentLine", "value": " DEPRECATED", "start": 71, "end": 84, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 13 } } }, { "type": "CommentLine", "value": " replace with \"calls and viewActions!\"", "start": 86, "end": 126, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 40 } } }, { "type": "CommentBlock", "value": "*\r\n * Creates a decorator for binding action handlers to a store.\r\n * A binding is created for each action that has a matching handler method mapping.\r\n *\r\n * The decorator takes any number of action handler definitions as arguments and applies their\r\n * bindings after concatinating them to a flat list, so you can pass either of these:\r\n * - an array of handler definitions\r\n * - any number of array of handler definitions\r\n * - any number of handlerdefinitions without arrays\r\n * - any mixed variation\r\n *\r\n * See manual/usage/action-handlers.md for more on this topic.\r\n ", "start": 132, "end": 711, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 22, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 713, "end": 2821, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 65, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", "start": 728, "end": 2821, "loc": { "start": { "line": 23, "column": 15 }, "end": { "line": 65, "column": 1 } }, "id": { "type": "Identifier", "start": 737, "end": 749, "loc": { "start": { "line": 23, "column": 24 }, "end": { "line": 23, "column": 36 }, "identifierName": "BindHandlers" }, "name": "BindHandlers", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 750, "end": 757, "loc": { "start": { "line": 23, "column": 37 }, "end": { "line": 23, "column": 44 } }, "argument": { "type": "Identifier", "start": 753, "end": 757, "loc": { "start": { "line": 23, "column": 40 }, "end": { "line": 23, "column": 44 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 759, "end": 2821, "loc": { "start": { "line": 23, "column": 46 }, "end": { "line": 65, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 766, "end": 1004, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 32, "column": 11 } }, "declarations": [ { "type": "VariableDeclarator", "start": 772, "end": 1003, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 32, "column": 10 } }, "id": { "type": "Identifier", "start": 772, "end": 783, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 21 }, "identifierName": "definitions" }, "name": "definitions" }, "init": { "type": "CallExpression", "start": 786, "end": 1003, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 32, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 786, "end": 797, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 35 } }, "object": { "type": "Identifier", "start": 786, "end": 790, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 28 }, "identifierName": "args" }, "name": "args" }, "property": { "type": "Identifier", "start": 791, "end": 797, "loc": { "start": { "line": 24, "column": 29 }, "end": { "line": 24, "column": 35 }, "identifierName": "reduce" }, "name": "reduce" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 798, "end": 998, "loc": { "start": { "line": 24, "column": 36 }, "end": { "line": 32, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 799, "end": 805, "loc": { "start": { "line": 24, "column": 37 }, "end": { "line": 24, "column": 43 }, "identifierName": "result" }, "name": "result" }, { "type": "Identifier", "start": 807, "end": 810, "loc": { "start": { "line": 24, "column": 45 }, "end": { "line": 24, "column": 48 }, "identifierName": "def" }, "name": "def" } ], "body": { "type": "BlockStatement", "start": 815, "end": 998, "loc": { "start": { "line": 24, "column": 53 }, "end": { "line": 32, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 826, "end": 967, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 30, "column": 9 } }, "test": { "type": "CallExpression", "start": 830, "end": 848, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 30 } }, "callee": { "type": "MemberExpression", "start": 830, "end": 843, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 25 } }, "object": { "type": "Identifier", "start": 830, "end": 835, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 17 }, "identifierName": "Array" }, "name": "Array" }, "property": { "type": "Identifier", "start": 836, "end": 843, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 25 }, "identifierName": "isArray" }, "name": "isArray" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 844, "end": 847, "loc": { "start": { "line": 25, "column": 26 }, "end": { "line": 25, "column": 29 }, "identifierName": "def" }, "name": "def" } ] }, "consequent": { "type": "BlockStatement", "start": 850, "end": 909, "loc": { "start": { "line": 25, "column": 32 }, "end": { "line": 27, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 865, "end": 898, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 45 } }, "expression": { "type": "CallExpression", "start": 865, "end": 897, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 865, "end": 876, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 23 } }, "object": { "type": "Identifier", "start": 865, "end": 868, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 15 }, "identifierName": "def" }, "name": "def" }, "property": { "type": "Identifier", "start": 869, "end": 876, "loc": { "start": { "line": 26, "column": 16 }, "end": { "line": 26, "column": 23 }, "identifierName": "forEach" }, "name": "forEach" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 877, "end": 896, "loc": { "start": { "line": 26, "column": 24 }, "end": { "line": 26, "column": 43 } }, "id": null, "generator": false, "expression": true, "async": false, "params": [ { "type": "Identifier", "start": 877, "end": 878, "loc": { "start": { "line": 26, "column": 24 }, "end": { "line": 26, "column": 25 }, "identifierName": "d" }, "name": "d" } ], "body": { "type": "CallExpression", "start": 882, "end": 896, "loc": { "start": { "line": 26, "column": 29 }, "end": { "line": 26, "column": 43 } }, "callee": { "type": "MemberExpression", "start": 882, "end": 893, "loc": { "start": { "line": 26, "column": 29 }, "end": { "line": 26, "column": 40 } }, "object": { "type": "Identifier", "start": 882, "end": 888, "loc": { "start": { "line": 26, "column": 29 }, "end": { "line": 26, "column": 35 }, "identifierName": "result" }, "name": "result" }, "property": { "type": "Identifier", "start": 889, "end": 893, "loc": { "start": { "line": 26, "column": 36 }, "end": { "line": 26, "column": 40 }, "identifierName": "push" }, "name": "push" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 894, "end": 895, "loc": { "start": { "line": 26, "column": 41 }, "end": { "line": 26, "column": 42 }, "identifierName": "d" }, "name": "d" } ] } } ] } } ], "directives": [] }, "alternate": { "type": "BlockStatement", "start": 924, "end": 967, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 30, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 939, "end": 956, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 29 } }, "expression": { "type": "CallExpression", "start": 939, "end": 955, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 939, "end": 950, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 23 } }, "object": { "type": "Identifier", "start": 939, "end": 945, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 18 }, "identifierName": "result" }, "name": "result" }, "property": { "type": "Identifier", "start": 946, "end": 950, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 23 }, "identifierName": "push" }, "name": "push" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 951, "end": 954, "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 29, "column": 27 }, "identifierName": "def" }, "name": "def" } ] } } ], "directives": [] } }, { "type": "ReturnStatement", "start": 977, "end": 991, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 31, "column": 22 } }, "argument": { "type": "Identifier", "start": 984, "end": 990, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 21 }, "identifierName": "result" }, "name": "result" } } ], "directives": [] } }, { "type": "ArrayExpression", "start": 1000, "end": 1002, "loc": { "start": { "line": 32, "column": 7 }, "end": { "line": 32, "column": 9 } }, "elements": [] } ] } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 1010, "end": 2818, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 64, "column": 6 } }, "argument": { "type": "FunctionExpression", "start": 1017, "end": 2817, "loc": { "start": { "line": 33, "column": 11 }, "end": { "line": 64, "column": 5 } }, "id": { "type": "Identifier", "start": 1026, "end": 1039, "loc": { "start": { "line": 33, "column": 20 }, "end": { "line": 33, "column": 33 }, "identifierName": "decorateStore" }, "name": "decorateStore" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1040, "end": 1050, "loc": { "start": { "line": 33, "column": 34 }, "end": { "line": 33, "column": 44 }, "identifierName": "StoreClass" }, "name": "StoreClass" } ], "body": { "type": "BlockStatement", "start": 1052, "end": 2817, "loc": { "start": { "line": 33, "column": 46 }, "end": { "line": 64, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1063, "end": 2782, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 62, "column": 11 } }, "expression": { "type": "CallExpression", "start": 1063, "end": 2781, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 62, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 1063, "end": 1082, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 27 } }, "object": { "type": "Identifier", "start": 1063, "end": 1074, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 19 }, "identifierName": "definitions" }, "name": "definitions" }, "property": { "type": "Identifier", "start": 1075, "end": 1082, "loc": { "start": { "line": 34, "column": 20 }, "end": { "line": 34, "column": 27 }, "identifierName": "forEach" }, "name": "forEach" }, "computed": false }, "arguments": [ { "type": "FunctionExpression", "start": 1083, "end": 2780, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 62, "column": 9 } }, "id": { "type": "Identifier", "start": 1092, "end": 1103, "loc": { "start": { "line": 34, "column": 37 }, "end": { "line": 34, "column": 48 }, "identifierName": "bindActions" }, "name": "bindActions" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "ObjectPattern", "start": 1104, "end": 1123, "loc": { "start": { "line": 34, "column": 49 }, "end": { "line": 34, "column": 68 } }, "properties": [ { "type": "ObjectProperty", "start": 1105, "end": 1112, "loc": { "start": { "line": 34, "column": 50 }, "end": { "line": 34, "column": 57 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1105, "end": 1112, "loc": { "start": { "line": 34, "column": 50 }, "end": { "line": 34, "column": 57 }, "identifierName": "handler" }, "name": "handler" }, "value": { "type": "Identifier", "start": 1105, "end": 1112, "loc": { "start": { "line": 34, "column": 50 }, "end": { "line": 34, "column": 57 }, "identifierName": "handler" }, "name": "handler" }, "extra": { "shorthand": true }