@ibyar/expressions 0.8.2-dev.20221008 → 0.8.4

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.
Files changed (172) hide show
  1. package/README.md +0 -3
  2. package/api/abstract.d.ts +6 -5
  3. package/api/abstract.js +15 -12
  4. package/api/abstract.js.map +1 -1
  5. package/api/class/class.d.ts +99 -60
  6. package/api/class/class.js +285 -233
  7. package/api/class/class.js.map +1 -1
  8. package/api/class/decorator.d.ts +2 -4
  9. package/api/class/decorator.js +6 -9
  10. package/api/class/decorator.js.map +1 -1
  11. package/api/computing/call.d.ts +2 -4
  12. package/api/computing/call.js +8 -11
  13. package/api/computing/call.js.map +1 -1
  14. package/api/computing/debugger.d.ts +1 -4
  15. package/api/computing/debugger.js +2 -5
  16. package/api/computing/debugger.js.map +1 -1
  17. package/api/computing/new.d.ts +2 -4
  18. package/api/computing/new.js +7 -10
  19. package/api/computing/new.js.map +1 -1
  20. package/api/computing/rest.d.ts +2 -4
  21. package/api/computing/rest.js +6 -9
  22. package/api/computing/rest.js.map +1 -1
  23. package/api/computing/return.d.ts +2 -4
  24. package/api/computing/return.js +6 -9
  25. package/api/computing/return.js.map +1 -1
  26. package/api/computing/spread.d.ts +2 -4
  27. package/api/computing/spread.js +6 -9
  28. package/api/computing/spread.js.map +1 -1
  29. package/api/computing/throw.d.ts +4 -8
  30. package/api/computing/throw.js +18 -23
  31. package/api/computing/throw.js.map +1 -1
  32. package/api/computing/yield.d.ts +2 -4
  33. package/api/computing/yield.js +7 -10
  34. package/api/computing/yield.js.map +1 -1
  35. package/api/definition/array.d.ts +3 -6
  36. package/api/definition/array.js +14 -18
  37. package/api/definition/array.js.map +1 -1
  38. package/api/definition/bind.d.ts +2 -3
  39. package/api/definition/bind.js +9 -10
  40. package/api/definition/bind.js.map +1 -1
  41. package/api/definition/comment.d.ts +3 -5
  42. package/api/definition/comment.js +6 -7
  43. package/api/definition/comment.js.map +1 -1
  44. package/api/definition/function.d.ts +20 -27
  45. package/api/definition/function.js +92 -110
  46. package/api/definition/function.js.map +1 -1
  47. package/api/definition/member.d.ts +2 -3
  48. package/api/definition/member.js +14 -11
  49. package/api/definition/member.js.map +1 -1
  50. package/api/definition/object.d.ts +5 -9
  51. package/api/definition/object.js +24 -30
  52. package/api/definition/object.js.map +1 -1
  53. package/api/definition/statement.d.ts +2 -4
  54. package/api/definition/statement.js +6 -9
  55. package/api/definition/statement.js.map +1 -1
  56. package/api/definition/values.d.ts +15 -40
  57. package/api/definition/values.js +49 -79
  58. package/api/definition/values.js.map +1 -1
  59. package/api/expression.d.ts +40 -26
  60. package/api/expression.js.map +1 -1
  61. package/api/index.d.ts +1 -0
  62. package/api/index.js +1 -0
  63. package/api/index.js.map +1 -1
  64. package/api/module/common.d.ts +4 -5
  65. package/api/module/common.js +12 -12
  66. package/api/module/common.js.map +1 -1
  67. package/api/module/export.d.ts +5 -10
  68. package/api/module/export.js +35 -38
  69. package/api/module/export.js.map +1 -1
  70. package/api/module/import.d.ts +6 -10
  71. package/api/module/import.js +28 -32
  72. package/api/module/import.js.map +1 -1
  73. package/api/operators/assignment.d.ts +3 -3
  74. package/api/operators/assignment.js +5 -5
  75. package/api/operators/assignment.js.map +1 -1
  76. package/api/operators/await.d.ts +3 -5
  77. package/api/operators/await.js +7 -10
  78. package/api/operators/await.js.map +1 -1
  79. package/api/operators/binary.d.ts +1 -1
  80. package/api/operators/binary.js +1 -1
  81. package/api/operators/binary.js.map +1 -1
  82. package/api/operators/chaining.d.ts +2 -3
  83. package/api/operators/chaining.js +6 -7
  84. package/api/operators/chaining.js.map +1 -1
  85. package/api/operators/comma.d.ts +2 -4
  86. package/api/operators/comma.js +6 -9
  87. package/api/operators/comma.js.map +1 -1
  88. package/api/operators/grouping.d.ts +2 -4
  89. package/api/operators/grouping.js +6 -9
  90. package/api/operators/grouping.js.map +1 -1
  91. package/api/operators/logical.d.ts +1 -1
  92. package/api/operators/logical.js +1 -1
  93. package/api/operators/logical.js.map +1 -1
  94. package/api/operators/pipeline.d.ts +2 -4
  95. package/api/operators/pipeline.js +8 -15
  96. package/api/operators/pipeline.js.map +1 -1
  97. package/api/operators/ternary.d.ts +2 -4
  98. package/api/operators/ternary.js +8 -13
  99. package/api/operators/ternary.js.map +1 -1
  100. package/api/operators/types.d.ts +1 -1
  101. package/api/operators/unary.d.ts +3 -5
  102. package/api/operators/unary.js +7 -10
  103. package/api/operators/unary.js.map +1 -1
  104. package/api/operators/update.d.ts +3 -5
  105. package/api/operators/update.js +8 -11
  106. package/api/operators/update.js.map +1 -1
  107. package/api/program.d.ts +3 -5
  108. package/api/program.js +7 -8
  109. package/api/program.js.map +1 -1
  110. package/api/statement/control/block.d.ts +2 -4
  111. package/api/statement/control/block.js +9 -14
  112. package/api/statement/control/block.js.map +1 -1
  113. package/api/statement/control/empty.d.ts +2 -5
  114. package/api/statement/control/empty.js +6 -8
  115. package/api/statement/control/empty.js.map +1 -1
  116. package/api/statement/control/if.d.ts +2 -4
  117. package/api/statement/control/if.js +8 -13
  118. package/api/statement/control/if.js.map +1 -1
  119. package/api/statement/control/switch.d.ts +4 -9
  120. package/api/statement/control/switch.js +19 -28
  121. package/api/statement/control/switch.js.map +1 -1
  122. package/api/statement/control/terminate.d.ts +4 -7
  123. package/api/statement/control/terminate.js +11 -19
  124. package/api/statement/control/terminate.js.map +1 -1
  125. package/api/statement/control/with.d.ts +21 -0
  126. package/api/statement/control/with.js +67 -0
  127. package/api/statement/control/with.js.map +1 -0
  128. package/api/statement/declarations/declares.d.ts +4 -7
  129. package/api/statement/declarations/declares.js +14 -20
  130. package/api/statement/declarations/declares.js.map +1 -1
  131. package/api/statement/iterations/for.d.ts +6 -11
  132. package/api/statement/iterations/for.js +35 -53
  133. package/api/statement/iterations/for.js.map +1 -1
  134. package/api/statement/iterations/while.d.ts +3 -6
  135. package/api/statement/iterations/while.js +14 -22
  136. package/api/statement/iterations/while.js.map +1 -1
  137. package/package.json +14 -4
  138. package/scope/finalizer.d.ts +1 -1
  139. package/scope/pool.d.ts +1 -1
  140. package/scope/proxy.d.ts +1 -1
  141. package/scope/proxy.js +1 -0
  142. package/scope/proxy.js.map +1 -1
  143. package/scope/scope.d.ts +8 -24
  144. package/scope/scope.js +25 -75
  145. package/scope/scope.js.map +1 -1
  146. package/scope/stack.d.ts +15 -3
  147. package/scope/stack.js +49 -32
  148. package/scope/stack.js.map +1 -1
  149. package/v8/enums.d.ts +4 -2
  150. package/v8/enums.js.map +1 -1
  151. package/v8/factory.d.ts +148 -0
  152. package/v8/factory.js +499 -0
  153. package/v8/factory.js.map +1 -0
  154. package/v8/inline.d.ts +50 -48
  155. package/v8/inline.js +322 -300
  156. package/v8/inline.js.map +1 -1
  157. package/v8/node.d.ts +141 -0
  158. package/v8/node.js +2 -0
  159. package/v8/node.js.map +1 -0
  160. package/v8/nodes.d.ts +0 -14
  161. package/v8/nodes.js +1 -152
  162. package/v8/nodes.js.map +1 -1
  163. package/v8/parser.d.ts +21 -18
  164. package/v8/parser.js +97 -84
  165. package/v8/parser.js.map +1 -1
  166. package/v8/stream.d.ts +2 -1
  167. package/v8/stream.js +221 -311
  168. package/v8/stream.js.map +1 -1
  169. package/v8/token.d.ts +3 -1
  170. package/v8/token.js +7 -5
  171. package/v8/token.js.map +1 -1
  172. package/visit/visitor.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"while.js","sourceRoot":"","sources":["../../../../../src/expressions/api/statement/iterations/while.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;GAKG;AAEI,IAAM,SAAS,iBAAf,MAAM,SAAU,SAAQ,sBAAsB;IAWpD,YAAoB,IAAoB,EAAU,IAAoB;QACrE,KAAK,EAAE,CAAC;QADW,SAAI,GAAJ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AI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtF,CAAC;IACD,QAAQ;QACP,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;IACvE,CAAC;IACD,MAAM;QACL,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;SACxB,CAAC;IACH,CAAC;CACD,CAAA;AA/DY,WAAW;IADvB,YAAY,CAAC,kBAAkB,CAAC;;GACpB,WAAW,CA+DvB;SA/DY,WAAW","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType\n} from '../../expression.js';\nimport type { Scope } from '../../../scope/scope.js';\nimport type { Stack } from '../../../scope/stack.js';\nimport { AbstractExpressionNode, ReturnValue } from '../../abstract.js';\nimport { Deserializer } from '../../deserialize/deserialize.js';\nimport { TerminateReturnType } from '../control/terminate.js';\n\n/**\n * The while statement creates a loop that executes a specified\n * statement as long as the test condition evaluates to true.\n * The condition is evaluated before executing the statement.\n * \n */\n@Deserializer('WhileStatement')\nexport class WhileNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: WhileNode, deserializer: NodeDeserializer): WhileNode {\n\t\treturn new WhileNode(\n\t\t\tdeserializer(node.test),\n\t\t\tdeserializer(node.body)\n\t\t);\n\t}\n\tstatic visit(node: WhileNode, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.body);\n\t\tvisitNode(node.test);\n\t}\n\tconstructor(private test: ExpressionNode, private body: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetTest() {\n\t\treturn this.test;\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.test.shareVariables(scopeList);\n\t\tthis.body.shareVariables(scopeList);\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`WhileNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst condition = this.test.get(stack);\n\t\tconst whileBlock = stack.pushBlockScope();\n\t\twhile (condition) {\n\t\t\tconst result = this.body.get(stack);\n\t\t\t// useless case, as it at the end of for statement\n\t\t\t// an array/block statement, should return last signal\n\t\t\tif (result instanceof TerminateReturnType) {\n\t\t\t\tif (result.type === 'continue') {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result instanceof ReturnValue) {\n\t\t\t\tstack.clearTo(whileBlock);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tstack.clearTo(whileBlock);\n\t\treturn void 0;\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.test.dependency(computed).concat(this.body.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.test.dependencyPath(computed).concat(this.body.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\treturn `while (${this.test.toString()}) ${this.body.toString()}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\ttest: this.test.toJSON(),\n\t\t\tbody: this.body.toJSON()\n\t\t};\n\t}\n}\n\n@Deserializer('DoWhileStatement')\nexport class DoWhileNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: DoWhileNode, deserializer: NodeDeserializer): DoWhileNode {\n\t\treturn new DoWhileNode(\n\t\t\tdeserializer(node.test),\n\t\t\tdeserializer(node.body)\n\t\t);\n\t}\n\tstatic visit(node: DoWhileNode, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.test);\n\t\tvisitNode(node.body);\n\t}\n\tconstructor(private test: ExpressionNode, private body: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetTest() {\n\t\treturn this.test;\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.test.shareVariables(scopeList);\n\t\tthis.body.shareVariables(scopeList);\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`WhileNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst whileBlock = stack.pushBlockScope();\n\t\tdo {\n\t\t\tconst result = this.body.get(stack);\n\t\t\t// useless case, as it at the end of for statement\n\t\t\t// an array/block statement, should return last signal\n\t\t\tif (result instanceof TerminateReturnType) {\n\t\t\t\tif (result.type === 'continue') {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result instanceof ReturnValue) {\n\t\t\t\tstack.clearTo(whileBlock);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t} while (this.test.get(stack));\n\t\tstack.clearTo(whileBlock);\n\t\treturn void 0;\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.body.dependency(computed).concat(this.test.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.body.dependencyPath(computed).concat(this.test.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\treturn `do {${this.body.toString()}} while (${this.test.toString()})`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\ttest: this.test.toJSON(),\n\t\t\tbody: this.body.toJSON()\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"while.js","sourceRoot":"","sources":["../../../../../src/expressions/api/statement/iterations/while.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAA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,EAAE;QAC/B,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,CAAC;IACf,CAAC;IACD,UAAU,CAAC,QAAe;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtF,CAAC;IACD,QAAQ;QACP,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;IACvE,CAAC;IACD,MAAM;QACL,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;SACxB,CAAC;IACH,CAAC;CACD,CAAA;AAjEY,WAAW;IADvB,YAAY,CAAC,kBAAkB,CAAC;;GACpB,WAAW,CAiEvB;SAjEY,WAAW","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode, ExpressionEventPath,\n\tVisitNodeType, SourceLocation\n} from '../../expression.js';\nimport type { Stack } from '../../../scope/stack.js';\nimport { AbstractExpressionNode, ReturnValue } from '../../abstract.js';\nimport { Deserializer } from '../../deserialize/deserialize.js';\nimport { TerminateReturnType } from '../control/terminate.js';\n\n/**\n * The while statement creates a loop that executes a specified\n * statement as long as the test condition evaluates to true.\n * The condition is evaluated before executing the statement.\n * \n */\n@Deserializer('WhileStatement')\nexport class WhileNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: WhileNode, deserializer: NodeDeserializer): WhileNode {\n\t\treturn new WhileNode(\n\t\t\tdeserializer(node.test),\n\t\t\tdeserializer(node.body),\n\t\t\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: WhileNode, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.body);\n\t\tvisitNode(node.test);\n\t}\n\tconstructor(\n\t\tprivate test: ExpressionNode,\n\t\tprivate body: ExpressionNode,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetTest() {\n\t\treturn this.test;\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`WhileNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst condition = this.test.get(stack);\n\t\tconst whileBlock = stack.pushBlockScope();\n\t\twhile (condition) {\n\t\t\tconst result = this.body.get(stack);\n\t\t\t// useless case, as it at the end of for statement\n\t\t\t// an array/block statement, should return last signal\n\t\t\tif (result instanceof TerminateReturnType) {\n\t\t\t\tif (result.type === 'continue') {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result instanceof ReturnValue) {\n\t\t\t\tstack.clearTo(whileBlock);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tstack.clearTo(whileBlock);\n\t\treturn void 0;\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.test.dependency(computed).concat(this.body.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.test.dependencyPath(computed).concat(this.body.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\treturn `while (${this.test.toString()}) ${this.body.toString()}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\ttest: this.test.toJSON(),\n\t\t\tbody: this.body.toJSON()\n\t\t};\n\t}\n}\n\n@Deserializer('DoWhileStatement')\nexport class DoWhileNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: DoWhileNode, deserializer: NodeDeserializer): DoWhileNode {\n\t\treturn new DoWhileNode(\n\t\t\tdeserializer(node.test),\n\t\t\tdeserializer(node.body),\n\t\t\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: DoWhileNode, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.test);\n\t\tvisitNode(node.body);\n\t}\n\tconstructor(\n\t\tprivate test: ExpressionNode,\n\t\tprivate body: ExpressionNode,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetTest() {\n\t\treturn this.test;\n\t}\n\tgetBody() {\n\t\treturn this.body;\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`WhileNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst whileBlock = stack.pushBlockScope();\n\t\tdo {\n\t\t\tconst result = this.body.get(stack);\n\t\t\t// useless case, as it at the end of for statement\n\t\t\t// an array/block statement, should return last signal\n\t\t\tif (result instanceof TerminateReturnType) {\n\t\t\t\tif (result.type === 'continue') {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result instanceof ReturnValue) {\n\t\t\t\tstack.clearTo(whileBlock);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t} while (this.test.get(stack));\n\t\tstack.clearTo(whileBlock);\n\t\treturn void 0;\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.body.dependency(computed).concat(this.test.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.body.dependencyPath(computed).concat(this.test.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\treturn `do {${this.body.toString()}} while (${this.test.toString()})`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\ttest: this.test.toJSON(),\n\t\t\tbody: this.body.toJSON()\n\t\t};\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibyar/expressions",
3
- "version": "0.8.2-dev.20221008",
3
+ "version": "0.8.4",
4
4
  "description": "Aurora expression, an template expression and evaluation, An 100% spec compliant ES2022 JavaScript toolchain,",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ibyar/aurora/tree/dev/packages/expressions",
@@ -9,6 +9,16 @@
9
9
  "url": "https://github.com/ibyar/aurora.git",
10
10
  "directory": "packages/expressions"
11
11
  },
12
+ "bugs": {
13
+ "url": "https://github.com/ibyar/aurora/issues"
14
+ },
15
+ "author": "The Ibyar Authors (https://github.com/ibyar/aurora/graphs/contributors)",
16
+ "contributors": [
17
+ {
18
+ "name": "Muhammad Salem",
19
+ "email": "salem.ebo@gmail.com"
20
+ }
21
+ ],
12
22
  "main": "./index.js",
13
23
  "module": "./index.js",
14
24
  "types": "./index.d.ts",
@@ -24,10 +34,10 @@
24
34
  },
25
35
  "dependencies": {
26
36
  "reflect-metadata": "^0.1.13",
27
- "tslib": "^2.4.0"
37
+ "tslib": "^2.4.1"
28
38
  },
29
39
  "devDependencies": {
30
- "typescript": "^4.8.4"
40
+ "typescript": "^4.9.4"
31
41
  },
32
42
  "scripts": {
33
43
  "build": "tsc --build --verbose"
@@ -51,5 +61,5 @@
51
61
  "backend",
52
62
  "front-end"
53
63
  ],
54
- "gitHead": "abe877ef8e4d4914a0b9bc12dc88154ba9f0b2b9"
64
+ "gitHead": "bb412fef645853fc2af3d86e14b633813a988a2b"
55
65
  }
@@ -1,4 +1,4 @@
1
- declare type Actions = (() => void)[];
1
+ type Actions = (() => void)[];
2
2
  export declare function finalizerRegister(target: object, actions: Actions, unregisterToken?: object): void;
3
3
  export declare function finalizerUnregister(unregisterToken: object): void;
4
4
  export {};
package/scope/pool.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactiveScope, ReactiveScopeControl, ReadOnlyScope, Scope } from './scope.js';
2
- export declare type ScopeType = 'scope' | 'read-only' | 'reactive' | 'reactive-control';
2
+ export type ScopeType = 'scope' | 'read-only' | 'reactive' | 'reactive-control';
3
3
  export declare function getScopeFor<S extends Scope<T>, T extends object>(ctx: T): S | undefined;
4
4
  export declare function getScopeFor<T extends object>(ctx: T, type: 'scope', propertyKeys?: (keyof T)[]): Scope<T>;
5
5
  export declare function getScopeFor<T extends object>(ctx: T, type: 'read-only', propertyKeys?: (keyof T)[]): ReadOnlyScope<T>;
package/scope/proxy.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare class ScopeProxyHandler<T extends Context> implements ProxyHandle
11
11
  set(model: T, propertyKey: PropertyKey, value: any, receiver: any): boolean;
12
12
  deleteProperty(model: T, propertyKey: string | symbol): boolean;
13
13
  }
14
- export declare type RevocableProxy<T> = {
14
+ export type RevocableProxy<T> = {
15
15
  proxy: T;
16
16
  revoke: () => void;
17
17
  };
package/scope/proxy.js CHANGED
@@ -7,6 +7,7 @@ export function hasBindingHook(ctx) {
7
7
  case ctx instanceof WeakMap:
8
8
  case ctx instanceof WeakSet:
9
9
  case ctx instanceof Promise:
10
+ // check first if running in browser
10
11
  case HTMLElement && ctx instanceof HTMLElement:
11
12
  return true;
12
13
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/expressions/scope/proxy.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAI,GAAM;IACvC,QAAQ,IAAI,EAAE;QACb,yCAAyC;QACzC,KAAK,GAAG,YAAY,GAAG,CAAC;QACxB,KAAK,GAAG,YAAY,GAAG,CAAC;QACxB,KAAK,GAAG,YAAY,IAAI,CAAC;QACzB,KAAK,GAAG,YAAY,OAAO,CAAC;QAC5B,KAAK,GAAG,YAAY,OAAO,CAAC;QAC5B,KAAK,GAAG,YAAY,OAAO,CAAC;QAC5B,KAAK,WAAW,IAAI,GAAG,YAAY,WAAW;YAC7C,OAAO,IAAI,CAAC;QACb;YACC,OAAO,KAAK,CAAC;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CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Scope, Context } from './scope.js';\n\nexport function hasBindingHook<T>(ctx: T) {\n\tswitch (true) {\n\t\t// exclude classes that have binding hook\n\t\tcase ctx instanceof Map:\n\t\tcase ctx instanceof Set:\n\t\tcase ctx instanceof Date:\n\t\tcase ctx instanceof WeakMap:\n\t\tcase ctx instanceof WeakSet:\n\t\tcase ctx instanceof Promise:\n\t\tcase HTMLElement && ctx instanceof HTMLElement:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * crete new proxy handler object as scoped context\n */\nexport class ScopeProxyHandler<T extends Context> implements ProxyHandler<Context> {\n\t// private functionHandler: FunctionProxyHandler<Function>;\n\tconstructor(private scope: Scope<T>) { }\n\thas(model: T, propertyKey: PropertyKey): boolean {\n\t\treturn this.scope.has(propertyKey);\n\t}\n\tget(model: T, propertyKey: PropertyKey, receiver: any): any {\n\t\tconst value = this.scope.get(propertyKey);\n\t\tif (!(value && typeof value === 'object')) {\n\t\t\treturn value;\n\t\t}\n\t\tconst scope = this.scope.getInnerScope(propertyKey);\n\t\tif (!scope) {\n\t\t\treturn value;\n\t\t}\n\t\treturn createProxyForContext(scope);\n\t}\n\tset(model: T, propertyKey: PropertyKey, value: any, receiver: any): boolean {\n\t\treturn this.scope.set(propertyKey, value);\n\t}\n\tdeleteProperty(model: T, propertyKey: string | symbol): boolean {\n\t\treturn this.scope.delete(propertyKey);\n\t}\n}\n\nexport type RevocableProxy<T> = {\n\tproxy: T;\n\trevoke: () => void;\n};\n\nexport function createRevocableProxyForContext<T extends object>(context: T, scope: Scope<T>): RevocableProxy<T> {\n\treturn Proxy.revocable<T>(context, new ScopeProxyHandler(scope));\n}\n\nexport function createProxyForContext<T extends object>(scope: Scope<T>): T {\n\treturn new Proxy<T>(scope.getContext(), new ScopeProxyHandler(scope));\n}\n"]}
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/expressions/scope/proxy.ts"],"names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CAAC;IACD,cAAc,CAAC,KAAQ,EAAE,WAA4B;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;CACD;AAOD,MAAM,UAAU,8BAA8B,CAAmB,OAAU,EAAE,KAAe;IAC3F,OAAO,KAAK,CAAC,SAAS,CAAI,OAAO,EAAE,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,KAAe;IACtE,OAAO,IAAI,KAAK,CAAI,KAAK,CAAC,UAAU,EAAE,EAAE,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Scope, Context } from './scope.js';\n\nexport function hasBindingHook<T>(ctx: T) {\n\tswitch (true) {\n\t\t// exclude classes that have binding hook\n\t\tcase ctx instanceof Map:\n\t\tcase ctx instanceof Set:\n\t\tcase ctx instanceof Date:\n\t\tcase ctx instanceof WeakMap:\n\t\tcase ctx instanceof WeakSet:\n\t\tcase ctx instanceof Promise:\n\t\t// check first if running in browser\n\t\tcase HTMLElement && ctx instanceof HTMLElement:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * crete new proxy handler object as scoped context\n */\nexport class ScopeProxyHandler<T extends Context> implements ProxyHandler<Context> {\n\t// private functionHandler: FunctionProxyHandler<Function>;\n\tconstructor(private scope: Scope<T>) { }\n\thas(model: T, propertyKey: PropertyKey): boolean {\n\t\treturn this.scope.has(propertyKey);\n\t}\n\tget(model: T, propertyKey: PropertyKey, receiver: any): any {\n\t\tconst value = this.scope.get(propertyKey);\n\t\tif (!(value && typeof value === 'object')) {\n\t\t\treturn value;\n\t\t}\n\t\tconst scope = this.scope.getInnerScope(propertyKey);\n\t\tif (!scope) {\n\t\t\treturn value;\n\t\t}\n\t\treturn createProxyForContext(scope);\n\t}\n\tset(model: T, propertyKey: PropertyKey, value: any, receiver: any): boolean {\n\t\treturn this.scope.set(propertyKey, value);\n\t}\n\tdeleteProperty(model: T, propertyKey: string | symbol): boolean {\n\t\treturn this.scope.delete(propertyKey);\n\t}\n}\n\nexport type RevocableProxy<T> = {\n\tproxy: T;\n\trevoke: () => void;\n};\n\nexport function createRevocableProxyForContext<T extends object>(context: T, scope: Scope<T>): RevocableProxy<T> {\n\treturn Proxy.revocable<T>(context, new ScopeProxyHandler(scope));\n}\n\nexport function createProxyForContext<T extends object>(scope: Scope<T>): T {\n\treturn new Proxy<T>(scope.getContext(), new ScopeProxyHandler(scope));\n}\n"]}
package/scope/scope.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TypeOf } from '../api/utils.js';
2
- export declare type Context = Record<PropertyKey, any>;
2
+ export type Context = Record<PropertyKey, any>;
3
3
  export interface Scope<T = Context> {
4
4
  /**
5
5
  * get value of `propertyKey` in current context
@@ -58,26 +58,6 @@ export declare class Scope<T extends Context> implements Scope<T> {
58
58
  protected _inners: Map<keyof T, Scope<any>>;
59
59
  constructor(context: T, propertyKeys?: (keyof T)[]);
60
60
  }
61
- /**
62
- * a class scope used for class instance and private static properties
63
- */
64
- export declare class ClassScope<T extends Context> extends Scope<T> {
65
- private _pKeys?;
66
- static for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]): ClassScope<T>;
67
- static blockScope<T extends Context>(propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]): ClassScope<T>;
68
- static readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]): ReadOnlyScope<{
69
- this: T;
70
- }>;
71
- protected _private: Context;
72
- constructor(context: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]);
73
- getPrivateContext(): T;
74
- get(key: keyof T): any;
75
- set(key: keyof T, value: any, receiver?: any): boolean;
76
- has(key: keyof T): boolean;
77
- delete(key: keyof T): boolean;
78
- protected isPrivateKey(key: keyof T): boolean;
79
- getClass(): TypeOf<ReadOnlyScope<Context>>;
80
- }
81
61
  export declare class ReadOnlyScope<T extends Context> extends Scope<T> {
82
62
  static for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]): ReadOnlyScope<T>;
83
63
  static blockScope<T extends Context>(propertyKeys?: (keyof T)[]): ReadOnlyScope<T>;
@@ -93,7 +73,7 @@ export declare class ScopeSubscription<T> {
93
73
  resume(): void;
94
74
  unsubscribe(): void;
95
75
  }
96
- export declare type ValueChangedCallback = (newValue: any, oldValue?: any) => void;
76
+ export type ValueChangedCallback = (newValue: any, oldValue?: any) => void;
97
77
  export declare class ValueChangeObserver<T> {
98
78
  private _subscribers;
99
79
  private _lock;
@@ -220,7 +200,11 @@ export declare class ModuleScope extends ReactiveScope<ModuleContext> {
220
200
  importModule(propertyKey: keyof ModuleContext, scope: ModuleScope): void;
221
201
  }
222
202
  export declare class WebModuleScope extends ModuleScope {
223
- constructor();
224
- updateContext(context: any): void;
203
+ private source;
204
+ private importCallOptions?;
205
+ private import;
206
+ constructor(source: string, importCallOptions?: ImportCallOptions | undefined);
207
+ private updateContext;
208
+ resolveImport(): Promise<any>;
225
209
  }
226
210
  export {};
package/scope/scope.js CHANGED
@@ -1,15 +1,15 @@
1
1
  export class Scope {
2
- constructor(_ctx, _keys) {
3
- this._ctx = _ctx;
4
- this._keys = _keys;
5
- this._inners = new Map();
6
- }
7
2
  static for(ctx, propertyKeys) {
8
3
  return new Scope(ctx, propertyKeys);
9
4
  }
10
5
  static blockScope(propertyKeys) {
11
6
  return new Scope({}, propertyKeys);
12
7
  }
8
+ constructor(_ctx, _keys) {
9
+ this._ctx = _ctx;
10
+ this._keys = _keys;
11
+ this._inners = new Map();
12
+ }
13
13
  get(key) {
14
14
  return Reflect.get(this._ctx, key);
15
15
  }
@@ -53,64 +53,6 @@ export class Scope {
53
53
  return Scope;
54
54
  }
55
55
  }
56
- /**
57
- * a class scope used for class instance and private static properties
58
- */
59
- export class ClassScope extends Scope {
60
- constructor(context, propertyKeys, _pKeys) {
61
- super(context, propertyKeys);
62
- this._pKeys = _pKeys;
63
- this._private = {};
64
- }
65
- static for(ctx, propertyKeys, privateKeys) {
66
- return new ClassScope(ctx, propertyKeys, privateKeys);
67
- }
68
- static blockScope(propertyKeys, privateKeys) {
69
- return new ClassScope({}, propertyKeys, privateKeys);
70
- }
71
- static readOnlyScopeForThis(ctx, propertyKeys, privateKeys) {
72
- const thisScope = ClassScope.for(ctx, propertyKeys, privateKeys);
73
- const thisCtx = {
74
- 'this': ctx,
75
- };
76
- const rootScope = ReadOnlyScope.for(thisCtx, ['this']);
77
- rootScope.setInnerScope('this', thisScope);
78
- return rootScope;
79
- }
80
- getPrivateContext() {
81
- return this._private;
82
- }
83
- get(key) {
84
- if (this.isPrivateKey(key)) {
85
- return Reflect.get(this._private, key);
86
- }
87
- return super.get(key);
88
- }
89
- set(key, value, receiver) {
90
- if (this.isPrivateKey(key)) {
91
- return Reflect.set(this._private, key, value);
92
- }
93
- return super.set(key, value, receiver);
94
- }
95
- has(key) {
96
- if (this.isPrivateKey(key)) {
97
- return this._pKeys?.includes(key) ?? key in this._private;
98
- }
99
- return super.has(key);
100
- }
101
- delete(key) {
102
- if (this.isPrivateKey(key)) {
103
- return Reflect.deleteProperty(this._private, key);
104
- }
105
- return super.delete(key);
106
- }
107
- isPrivateKey(key) {
108
- return typeof key === 'string' && key.startsWith('#');
109
- }
110
- getClass() {
111
- return Scope;
112
- }
113
- }
114
56
  export class ReadOnlyScope extends Scope {
115
57
  static for(ctx, propertyKeys) {
116
58
  return new ReadOnlyScope(ctx, propertyKeys);
@@ -215,16 +157,6 @@ export class ValueChangeObserver {
215
157
  }
216
158
  }
217
159
  export class ReactiveScope extends Scope {
218
- constructor(context, propertyKeys, _name, _parent) {
219
- super(context, propertyKeys);
220
- this._name = _name;
221
- this._parent = _parent;
222
- this._observer = new ValueChangeObserver();
223
- this._clone = Object.assign({}, context);
224
- if (HTMLElement && context instanceof HTMLElement) {
225
- this._keys = [];
226
- }
227
- }
228
160
  static for(context, propertyKeys) {
229
161
  return new ReactiveScope(context, propertyKeys);
230
162
  }
@@ -249,6 +181,13 @@ export class ReactiveScope extends Scope {
249
181
  rootScope.setInnerScope('this', thisScope);
250
182
  return rootScope;
251
183
  }
184
+ constructor(context, propertyKeys, _name, _parent) {
185
+ super(context, propertyKeys);
186
+ this._name = _name;
187
+ this._parent = _parent;
188
+ this._observer = new ValueChangeObserver();
189
+ this._clone = Object.assign({}, context);
190
+ }
252
191
  set(propertyKey, newValue, receiver) {
253
192
  const oldValue = Reflect.get(this._ctx, propertyKey);
254
193
  const result = Reflect.set(this._ctx, propertyKey, newValue);
@@ -297,7 +236,7 @@ export class ReactiveScope extends Scope {
297
236
  const pt = typeof pv;
298
237
  const ct = typeof cv;
299
238
  if (pt === 'object') {
300
- if (ct === 'object') {
239
+ if (ct === 'object' && pv == cv) {
301
240
  this.getInnerScope(key)?.detectChanges();
302
241
  }
303
242
  else if (cv != pv) {
@@ -437,15 +376,26 @@ export class ModuleScope extends ReactiveScope {
437
376
  super(context, propertyKeys);
438
377
  }
439
378
  importModule(propertyKey, scope) {
379
+ this._ctx[propertyKey] = scope._ctx;
440
380
  this._inners.set(propertyKey, scope);
381
+ this.detectChanges();
441
382
  }
442
383
  }
443
384
  export class WebModuleScope extends ModuleScope {
444
- constructor() {
385
+ constructor(source, importCallOptions) {
445
386
  super({});
387
+ this.source = source;
388
+ this.importCallOptions = importCallOptions;
389
+ this.import = import(source
390
+ /*, { assert: importCallOptions?.assert } */ // TODO: update in future, node16, ESNEXT,ES2022, ES2023, ES2024
391
+ ).then(module => (this.updateContext(module))).then(() => this._ctx, () => this._ctx);
446
392
  }
447
393
  updateContext(context) {
448
394
  this._ctx = context;
395
+ this.detectChanges();
396
+ }
397
+ resolveImport() {
398
+ return this.import;
449
399
  }
450
400
  }
451
401
  //# sourceMappingURL=scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/expressions/scope/scope.ts"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C,OAAO,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SAClD;IACF,CAAC;IACD,QAAQ;QACP,OAAO,oBAAoB,CAAC;IAC7B,CAAC;CACD;AAyBD,MAAM,OAAO,WAAY,SAAQ,aAA4B;IAC5D,YAAY,OAAsB,EAAE,YAAsC;QACzE,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9B,CAAC;IACD,YAAY,CAAC,WAAgC,EAAE,KAAkB;QAChE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;CACD;AACD,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC9C;QACC,KAAK,CAAC,EAAmB,CAAC,CAAC;IAC5B,CAAC;IACD,aAAa,CAAC,OAAY;QACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,CAAC;CACD","sourcesContent":["import { TypeOf } from '../api/utils.js';\n\nexport type Context = Record<PropertyKey, any>;\nexport interface Scope<T = Context> {\n\n\t/**\n\t * get value of `propertyKey` in current context\n\t * @param propertyKey \n\t */\n\tget(propertyKey: keyof T): any;\n\n\t/**\n\t * set the value of `propertyKey` in current context, could be instilled with `value`.\n\t * @param propertyKey \n\t * @param value \n\t * @param receiver \n\t */\n\tset(propertyKey: keyof T, value?: any, receiver?: any): boolean;\n\n\t/**\n\t * is current context has `propertyKey` in hash map keys\n\t * @param propertyKey \n\t */\n\thas(propertyKey: keyof T): boolean;\n\n\t/**\n\t * delete property from context\n\t * @param propertyKey \n\t */\n\tdelete(propertyKey: keyof T): boolean;\n\n\t/**\n\t * get current context object of this scope\n\t */\n\tgetContext(): T;\n\n\t/**\n\t * get a proxy of the current context object if exists. \n\t */\n\tgetContextProxy?(): T;\n\n\t/**\n\t * get a scope for an object named as `propertyKey` from cache map,\n\t * \n\t * if the current value is not type od `object`, will return `undefined`.\n\t * @param propertyKey the name of the property\n\t */\n\tgetInnerScope<S extends Scope<Context>>(propertyKey: keyof T): S | undefined;\n\n\t/**\n\t * create a scope with the same type of this scope\n\t */\n\tsetInnerScope<S extends Scope<Context>>(propertyKey: keyof T): S;\n\n\t/**\n\t * sc\n\t * @param propertyKey \n\t * @param scope \n\t */\n\tsetInnerScope<S extends Scope<Context>>(propertyKey: keyof T, scope?: S): S;\n\n\tgetClass(): TypeOf<Scope<Context>>;\n}\n\nexport class Scope<T extends Context> implements Scope<T> {\n\tstatic for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new Scope(ctx, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new Scope({} as T, propertyKeys);\n\t}\n\n\tprotected _inners = new Map<keyof T, Scope<any>>();\n\n\tconstructor(context: T, propertyKeys?: (keyof T)[]);\n\tconstructor(protected _ctx: T, protected _keys?: (keyof T)[]) { }\n\tget(key: keyof T): any {\n\t\treturn Reflect.get(this._ctx, key);\n\t}\n\tset(key: keyof T, value: any, receiver?: any): boolean {\n\t\treturn Reflect.set(this._ctx, key, value);\n\t}\n\thas(key: keyof T): boolean {\n\t\treturn this._keys?.includes(key) ?? key in this._ctx;\n\t}\n\tdelete(key: keyof T): boolean {\n\t\treturn Reflect.deleteProperty(this._ctx, key);\n\t}\n\tgetContext(): T {\n\t\treturn this._ctx;\n\t}\n\tgetInnerScope<S extends Scope<Context>>(key: keyof T): S | undefined {\n\t\tconst ctx = this.get(key);\n\t\tlet scope = this._inners.get(key);\n\t\tif (scope) {\n\t\t\tscope._ctx = ctx;\n\t\t\treturn scope as S;\n\t\t}\n\t\tif (!(ctx && typeof ctx === 'object')) {\n\t\t\treturn;\n\t\t}\n\t\tscope = new (this.getClass())(ctx, undefined, key, this);\n\t\tthis._inners.set(key, scope);\n\t\treturn scope as S;\n\t}\n\tsetInnerScope<S extends Scope<Context>>(key: keyof T, scope?: S): S {\n\t\tif (scope) {\n\t\t\tthis._inners.set(key, scope);\n\t\t\treturn scope;\n\t\t}\n\t\tconst ctx = this.get(key);\n\t\tscope = new (this.getClass())(ctx, undefined, key, this) as S;\n\t\tthis._inners.set(key, scope);\n\t\treturn scope;\n\t}\n\tgetClass(): TypeOf<Scope<Context>> {\n\t\treturn Scope;\n\t}\n}\n\n/**\n * a class scope used for class instance and private static properties \n */\n\nexport class ClassScope<T extends Context> extends Scope<T> {\n\tstatic for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]) {\n\t\treturn new ClassScope(ctx, propertyKeys, privateKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]) {\n\t\treturn new ClassScope({} as T, propertyKeys, privateKeys);\n\t}\n\tstatic readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]) {\n\t\tconst thisScope = ClassScope.for(ctx, propertyKeys, privateKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tprotected _private: Context = {};\n\tconstructor(context: T, propertyKeys?: (keyof T)[], privateKeys?: (keyof T)[]);\n\tconstructor(context: T, propertyKeys?: (keyof T)[], private _pKeys?: (keyof T)[]) {\n\t\tsuper(context, propertyKeys);\n\t}\n\tgetPrivateContext(): T {\n\t\treturn this._private;\n\t}\n\tget(key: keyof T): any {\n\t\tif (this.isPrivateKey(key)) {\n\t\t\treturn Reflect.get(this._private, key);\n\t\t}\n\t\treturn super.get(key);\n\t}\n\tset(key: keyof T, value: any, receiver?: any): boolean {\n\t\tif (this.isPrivateKey(key)) {\n\t\t\treturn Reflect.set(this._private, key, value);\n\t\t}\n\t\treturn super.set(key, value, receiver);\n\t}\n\thas(key: keyof T): boolean {\n\t\tif (this.isPrivateKey(key)) {\n\t\t\treturn this._pKeys?.includes(key) ?? key in this._private;\n\t\t}\n\t\treturn super.has(key);\n\t}\n\tdelete(key: keyof T): boolean {\n\t\tif (this.isPrivateKey(key)) {\n\t\t\treturn Reflect.deleteProperty(this._private, key);\n\t\t}\n\t\treturn super.delete(key);\n\t}\n\tprotected isPrivateKey(key: keyof T) {\n\t\treturn typeof key === 'string' && key.startsWith('#');\n\t}\n\tgetClass(): TypeOf<ReadOnlyScope<Context>> {\n\t\treturn Scope;\n\t}\n}\n\nexport class ReadOnlyScope<T extends Context> extends Scope<T> {\n\tstatic for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReadOnlyScope(ctx, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReadOnlyScope({} as T, propertyKeys);\n\t}\n\tset(propertyKey: keyof T, value: any, receiver?: any): boolean {\n\t\t// do nothing\n\t\treturn false;\n\t}\n\tdelete(propertyKey: keyof T): boolean {\n\t\t// do nothing\n\t\treturn false;\n\t}\n\tgetClass(): TypeOf<ReadOnlyScope<Context>> {\n\t\treturn ReadOnlyScope;\n\t}\n}\n\nexport class ScopeSubscription<T> {\n\tconstructor(private propertyKey: keyof T, private observer: ValueChangeObserver<T>) { }\n\tpause() {\n\t\tthis.observer.pause(this.propertyKey, this);\n\t}\n\tresume() {\n\t\tthis.observer.resume(this.propertyKey, this);\n\t}\n\tunsubscribe(): void {\n\t\tthis.observer.unsubscribe(this.propertyKey, this);\n\t}\n}\n\nexport type ValueChangedCallback = (newValue: any, oldValue?: any) => void;\n\ntype SubscriptionInfo = { callback: ValueChangedCallback, enable: boolean };\n\nexport class ValueChangeObserver<T> {\n\tprivate _subscribers: Map<keyof T, Map<ScopeSubscription<T>, SubscriptionInfo>> = new Map();\n\tprivate _lock: (keyof T)[] = [];\n\temit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tif (this._lock.includes(propertyKey)) {\n\t\t\treturn;\n\t\t}\n\t\tconst subscribers = this._subscribers.get(propertyKey);\n\t\tif (!subscribers || subscribers.size == 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis._lock.push(propertyKey);\n\t\tsubscribers?.forEach(subscriptionInfo => {\n\t\t\tif (!subscriptionInfo.enable) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tsubscriptionInfo.callback(newValue, oldValue);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\t\t});\n\t\tif (this._lock.pop() !== propertyKey) {\n\t\t\tconsole.error('lock error');\n\t\t};\n\t}\n\tsubscribe(propertyKey: keyof T, callback: ValueChangedCallback): ScopeSubscription<T> {\n\t\tconst subscription: ScopeSubscription<T> = new ScopeSubscription(propertyKey, this);\n\t\tlet propertySubscribers = this._subscribers.get(propertyKey);\n\t\tif (!propertySubscribers) {\n\t\t\tpropertySubscribers = new Map();\n\t\t\tthis._subscribers.set(propertyKey, propertySubscribers);\n\t\t}\n\t\tpropertySubscribers.set(subscription, { callback, enable: true });\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(propertyKey: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tif (subscription) {\n\t\t\tthis._subscribers.get(propertyKey)?.delete(subscription);\n\t\t} else {\n\t\t\tthis._subscribers.delete(propertyKey);\n\t\t}\n\t}\n\n\tpause(propertyKey: keyof T, subscription: ScopeSubscription<T>) {\n\t\tconst subscriptionInfo = this._subscribers.get(propertyKey)?.get(subscription);\n\t\tsubscriptionInfo && (subscriptionInfo.enable = false);\n\t}\n\n\tresume(propertyKey: keyof T, subscription: ScopeSubscription<T>) {\n\t\tconst subscriptionInfo = this._subscribers.get(propertyKey)?.get(subscription);\n\t\tsubscriptionInfo && (subscriptionInfo.enable = true);\n\t}\n\n\t/**\n\t * check if this Observer has any subscribers\n\t */\n\thasSubscribers(): boolean;\n\n\t/**\n\t * check if there is any subscribers registered by the propertyKey.\n\t * \n\t * @param propertyKey\n\t */\n\thasSubscribers(propertyKey: keyof T): boolean;\n\thasSubscribers(propertyKey?: keyof T): boolean {\n\t\tif (propertyKey) {\n\t\t\treturn (this._subscribers.get(propertyKey)?.size ?? 0) > 0;\n\t\t}\n\t\treturn this._subscribers.size > 0;\n\t}\n\n\t/**\n\t * clear subscription maps\n\t */\n\tdestroy() {\n\t\tthis._subscribers.clear();\n\t}\n}\n\nexport class ReactiveScope<T extends Context> extends Scope<T> {\n\tstatic for<T extends Context>(context: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScope(context, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScope({} as T, propertyKeys);\n\t}\n\tstatic scopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tprotected _clone: T;\n\tdeclare protected _inners: Map<keyof T, ReactiveScope<any>>;\n\tprotected _observer: ValueChangeObserver<T> = new ValueChangeObserver<T>();\n\n\n\tconstructor(context: T, propertyKeys?: (keyof T)[], protected _name?: keyof T, protected _parent?: ReactiveScope<any>) {\n\t\tsuper(context, propertyKeys);\n\t\tthis._clone = Object.assign({}, context);\n\t\tif (HTMLElement && context instanceof HTMLElement) {\n\t\t\tthis._keys = [];\n\t\t}\n\t}\n\n\tset(propertyKey: keyof T, newValue: any, receiver?: any): boolean {\n\t\tconst oldValue = Reflect.get(this._ctx, propertyKey);\n\t\tconst result = Reflect.set(this._ctx, propertyKey, newValue);\n\t\tif (result) {\n\t\t\tthis.emit(propertyKey, newValue, oldValue);\n\t\t}\n\t\treturn result;\n\t}\n\tdelete(propertyKey: keyof T): boolean {\n\t\tconst oldValue = Reflect.get(this._ctx, propertyKey);\n\t\tconst isDelete = Reflect.deleteProperty(this._ctx, propertyKey);\n\t\tif (isDelete && oldValue !== undefined) {\n\t\t\tthis.emit(propertyKey, undefined, oldValue);\n\t\t}\n\t\treturn isDelete;\n\t}\n\temit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tthis._observer.emit(propertyKey, newValue, oldValue);\n\t\tthis._parent?.emit(this._name!, this._ctx);\n\t}\n\tsubscribe(propertyKey: keyof T, callback: ValueChangedCallback): ScopeSubscription<T> {\n\t\treturn this._observer.subscribe(propertyKey, callback);\n\t}\n\tunsubscribe(propertyKey?: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tif (propertyKey && subscription) {\n\t\t\tthis._observer.unsubscribe(propertyKey, subscription);\n\t\t} else if (propertyKey) {\n\t\t\tthis._observer.unsubscribe(propertyKey);\n\t\t} else {\n\t\t\tthis._observer.destroy();\n\t\t}\n\t}\n\tdetectChanges() {\n\t\tconst previous = this._clone;\n\t\tconst current = this._ctx;\n\t\tif ((!!!previous && !!current) || (!!previous && !!!current)) {\n\t\t\tthis._parent?.emit(this._name!, current);\n\t\t\treturn;\n\t\t}\n\t\tconst keys = this._keys ?? this.getPropertyKeys(previous, current);\n\t\tkeys.forEach(key => {\n\t\t\tconst pv = previous[key];\n\t\t\tconst cv = current[key];\n\t\t\tconst pt = typeof pv;\n\t\t\tconst ct = typeof cv;\n\t\t\tif (pt === 'object') {\n\t\t\t\tif (ct === 'object') {\n\t\t\t\t\tthis.getInnerScope<ReactiveScope<Context>>(key)?.detectChanges();\n\t\t\t\t} else if (cv != pv) {\n\t\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t\t}\n\t\t\t} else if (ct === 'object') {\n\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t} else if (pv != cv) {\n\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t}\n\t\t});\n\t\tthis._clone = Object.assign({}, this._ctx);\n\t}\n\tprotected getPropertyKeys<V extends Record<PropertyKey, any>>(...objs: V[]) {\n\t\tlet keys: (keyof V)[] = [];\n\t\tobjs.forEach(obj => {\n\t\t\tkeys.push(...Object.keys(obj));\n\t\t\tkeys.push(...Object.getOwnPropertySymbols(obj));\n\t\t});\n\t\tkeys = Array.from(new Set(keys));\n\t\tkeys = keys.filter(key => {\n\t\t\tswitch (typeof key) {\n\t\t\t\tcase 'string':\n\t\t\t\t\treturn !key.startsWith('_');\n\t\t\t\tcase 'symbol':\n\t\t\t\t\treturn !key.toString().startsWith('Symbol(_');\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\treturn keys;\n\t}\n\tgetClass(): TypeOf<ReactiveScope<Context>> {\n\t\treturn ReactiveScope;\n\t}\n}\n\n/**\n * used control/notify/pause scope about changes in current context\n */\nexport interface ScopeControl<T extends Context> {\n\n\t/**\n\t * get current stacte of applying change detection.\n\t */\n\tisAttached(): boolean;\n\n\t/**\n\t * used when want to update ui-view like, you want to replace an array with another \n\t * without reflect changes on view until reattached again.\n\t */\n\tdetach(): void;\n\n\t/**\n\t * apply all the not emitted changes, and continue emit in time.\n\t */\n\treattach(): void;\n\n\t/**\n\t * apply changes now,\n\t * will not effect the state of the detector wither if attached ot not.\n\t * \n\t * if a propertyKey is provided, will emit this property only \n\t * @param propertyKey \n\t */\n\temitChanges(propertyKey?: keyof T, propertyValue?: any): void;\n\n\t/**\n\t * throw error if any changes has been made\n\t */\n\tcheckNoChanges(): void;\n}\n\nexport class ReactiveScopeControl<T extends Context> extends ReactiveScope<T> implements ScopeControl<T> {\n\tstatic for<T extends Context>(context: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScopeControl(context, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScopeControl({} as T, propertyKeys);\n\t}\n\tstatic scopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScopeControl.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScopeControl.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic reactiveScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\n\tprotected _attached: boolean = true;\n\tprotected _marked: { [key: keyof Context]: [any, any] } = {};\n\n\toverride emit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tif (this._attached) {\n\t\t\tsuper.emit(propertyKey, newValue, oldValue);\n\t\t} else if (this._marked[propertyKey as string]) {\n\t\t\tif (newValue == this._marked[propertyKey as string][1]) {\n\t\t\t\tdelete this._marked[propertyKey as string];\n\t\t\t} else {\n\t\t\t\tthis._marked[propertyKey as string][0] = newValue;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._marked[propertyKey as string] = [newValue, oldValue];\n\t\t}\n\t}\n\tisAttached(): boolean {\n\t\treturn this._attached;\n\t}\n\tdetach(): void {\n\t\tthis._attached = false;\n\t}\n\treattach(): void {\n\t\tthis._attached = true;\n\t\tthis.emitChanges();\n\t}\n\temitChanges(propertyKey?: keyof T, propertyValue?: any): void {\n\t\tif (propertyKey) {\n\t\t\tsuper.emit(propertyKey, propertyValue);\n\t\t\tReflect.deleteProperty(this._marked, propertyKey);\n\t\t\treturn;\n\t\t}\n\t\tconst latestChanges = this._marked;\n\t\tthis._marked = {};\n\t\tconst keys = this._keys ?? this.getPropertyKeys(latestChanges);\n\t\tkeys.forEach(propertyKey => {\n\t\t\tthis._observer.emit(propertyKey, latestChanges[propertyKey][0], latestChanges[propertyKey][1]);\n\t\t});\n\t\tkeys.length && this._parent?.emit(this._name!, this._ctx);\n\t}\n\tdetectChanges() {\n\t\tthis.detach();\n\t\tsuper.detectChanges();\n\t\tthis.reattach();\n\t}\n\tcheckNoChanges() {\n\t\tthis.detach();\n\t\tsuper.detectChanges();\n\t\tconst keys = Object.keys(this._marked);\n\t\tif (keys.length > 0) {\n\t\t\tthrow new Error(`Some Changes had been detected`);\n\t\t}\n\t}\n\tgetClass(): TypeOf<ReactiveScopeControl<Context>> {\n\t\treturn ReactiveScopeControl;\n\t}\n}\n\n\ninterface ImportMeta {\n\turl: URL;\n\t/**\n\t *\n\t * Provides a module-relative resolution function scoped to each module, returning\n\t * the URL string.\n\t *\n\t * @param specified The module specifier to resolve relative to `parent`.\n\t * @param parent The absolute parent module URL to resolve from. If none\n\t * is specified, the value of `import.meta.url` is used as the default.\n\t */\n\tresolve?(specified: string, parent?: string | URL): Promise<string>;\n}\n\nexport interface ModuleImport {\n\tmeta: ImportMeta\n}\n\nexport interface ModuleContext extends Context {\n\timport: ModuleImport & ((path: string) => Promise<any>);\n}\n\nexport class ModuleScope extends ReactiveScope<ModuleContext> {\n\tconstructor(context: ModuleContext, propertyKeys?: (keyof ModuleContext)[]) {\n\t\tsuper(context, propertyKeys);\n\t}\n\timportModule(propertyKey: keyof ModuleContext, scope: ModuleScope): void {\n\t\tthis._inners.set(propertyKey, scope);\n\t}\n}\nexport class WebModuleScope extends ModuleScope {\n\tconstructor() {\n\t\tsuper({} as ModuleContext);\n\t}\n\tupdateContext(context: any) {\n\t\tthis._ctx = context;\n\t}\n}\n"]}
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/expressions/scope/scope.ts"],"names":[],"mappings":"AAgEA,MAAM,OAAO,KAAK;IACjB,MAAM,CAAC,GAAG,CAAoB,GAAM,EAAE,YAA0B;QAC/D,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IACD,MAAM,CAAC,UAAU,CAAoB,YAA0B;QAC9D,OAAO,IAAI,KAAK,CAAC,EAAO,EAAE,YAAY,CAAC,CAAC;IACzC,CAAC;IAKD,YAAsB,IAAO,EAAY,KAAmB;QAAtC,SAAI,GAAJ,IAAI,CAAG;QAAY,UAAK,GAAL,KAAK,CAAc;QAHlD,YAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAGa,CAAC;IACjE,GAAG,CAAC,GAAY;QACf,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,GAAG,CAAC,GAAY,EAAE,KAAU,EAAE,QAAc;QAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,GAAG,CAAC,GAAY;QACf,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IACtD,CAAC;IACD,MAAM,CAAC,GAAY;QAClB,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,UAAU;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IA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AC,MAAM,GAAG,MAAM,CACnB,MAAM;QACN,4CAA4C,CAAC,gEAAgE;SAC7G,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvF,CAAC;IACO,aAAa,CAAC,OAAY;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAED,aAAa;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACD","sourcesContent":["import { TypeOf } from '../api/utils.js';\n\nexport type Context = Record<PropertyKey, any>;\nexport interface Scope<T = Context> {\n\n\t/**\n\t * get value of `propertyKey` in current context\n\t * @param propertyKey \n\t */\n\tget(propertyKey: keyof T): any;\n\n\t/**\n\t * set the value of `propertyKey` in current context, could be instilled with `value`.\n\t * @param propertyKey \n\t * @param value \n\t * @param receiver \n\t */\n\tset(propertyKey: keyof T, value?: any, receiver?: any): boolean;\n\n\t/**\n\t * is current context has `propertyKey` in hash map keys\n\t * @param propertyKey \n\t */\n\thas(propertyKey: keyof T): boolean;\n\n\t/**\n\t * delete property from context\n\t * @param propertyKey \n\t */\n\tdelete(propertyKey: keyof T): boolean;\n\n\t/**\n\t * get current context object of this scope\n\t */\n\tgetContext(): T;\n\n\t/**\n\t * get a proxy of the current context object if exists. \n\t */\n\tgetContextProxy?(): T;\n\n\t/**\n\t * get a scope for an object named as `propertyKey` from cache map,\n\t * \n\t * if the current value is not type od `object`, will return `undefined`.\n\t * @param propertyKey the name of the property\n\t */\n\tgetInnerScope<S extends Scope<Context>>(propertyKey: keyof T): S | undefined;\n\n\t/**\n\t * create a scope with the same type of this scope\n\t */\n\tsetInnerScope<S extends Scope<Context>>(propertyKey: keyof T): S;\n\n\t/**\n\t * sc\n\t * @param propertyKey \n\t * @param scope \n\t */\n\tsetInnerScope<S extends Scope<Context>>(propertyKey: keyof T, scope?: S): S;\n\n\tgetClass(): TypeOf<Scope<Context>>;\n}\n\nexport class Scope<T extends Context> implements Scope<T> {\n\tstatic for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new Scope(ctx, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new Scope({} as T, propertyKeys);\n\t}\n\n\tprotected _inners = new Map<keyof T, Scope<any>>();\n\n\tconstructor(context: T, propertyKeys?: (keyof T)[]);\n\tconstructor(protected _ctx: T, protected _keys?: (keyof T)[]) { }\n\tget(key: keyof T): any {\n\t\treturn Reflect.get(this._ctx, key);\n\t}\n\tset(key: keyof T, value: any, receiver?: any): boolean {\n\t\treturn Reflect.set(this._ctx, key, value);\n\t}\n\thas(key: keyof T): boolean {\n\t\treturn this._keys?.includes(key) ?? key in this._ctx;\n\t}\n\tdelete(key: keyof T): boolean {\n\t\treturn Reflect.deleteProperty(this._ctx, key);\n\t}\n\tgetContext(): T {\n\t\treturn this._ctx;\n\t}\n\tgetInnerScope<S extends Scope<Context>>(key: keyof T): S | undefined {\n\t\tconst ctx = this.get(key);\n\t\tlet scope = this._inners.get(key);\n\t\tif (scope) {\n\t\t\tscope._ctx = ctx;\n\t\t\treturn scope as S;\n\t\t}\n\t\tif (!(ctx && typeof ctx === 'object')) {\n\t\t\treturn;\n\t\t}\n\t\tscope = new (this.getClass())(ctx, undefined, key, this);\n\t\tthis._inners.set(key, scope);\n\t\treturn scope as S;\n\t}\n\tsetInnerScope<S extends Scope<Context>>(key: keyof T, scope?: S): S {\n\t\tif (scope) {\n\t\t\tthis._inners.set(key, scope);\n\t\t\treturn scope;\n\t\t}\n\t\tconst ctx = this.get(key);\n\t\tscope = new (this.getClass())(ctx, undefined, key, this) as S;\n\t\tthis._inners.set(key, scope);\n\t\treturn scope;\n\t}\n\tgetClass(): TypeOf<Scope<Context>> {\n\t\treturn Scope;\n\t}\n}\n\nexport class ReadOnlyScope<T extends Context> extends Scope<T> {\n\tstatic for<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReadOnlyScope(ctx, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReadOnlyScope({} as T, propertyKeys);\n\t}\n\tset(propertyKey: keyof T, value: any, receiver?: any): boolean {\n\t\t// do nothing\n\t\treturn false;\n\t}\n\tdelete(propertyKey: keyof T): boolean {\n\t\t// do nothing\n\t\treturn false;\n\t}\n\tgetClass(): TypeOf<ReadOnlyScope<Context>> {\n\t\treturn ReadOnlyScope;\n\t}\n}\n\nexport class ScopeSubscription<T> {\n\tconstructor(private propertyKey: keyof T, private observer: ValueChangeObserver<T>) { }\n\tpause() {\n\t\tthis.observer.pause(this.propertyKey, this);\n\t}\n\tresume() {\n\t\tthis.observer.resume(this.propertyKey, this);\n\t}\n\tunsubscribe(): void {\n\t\tthis.observer.unsubscribe(this.propertyKey, this);\n\t}\n}\n\nexport type ValueChangedCallback = (newValue: any, oldValue?: any) => void;\n\ntype SubscriptionInfo = { callback: ValueChangedCallback, enable: boolean };\n\nexport class ValueChangeObserver<T> {\n\tprivate _subscribers: Map<keyof T, Map<ScopeSubscription<T>, SubscriptionInfo>> = new Map();\n\tprivate _lock: (keyof T)[] = [];\n\temit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tif (this._lock.includes(propertyKey)) {\n\t\t\treturn;\n\t\t}\n\t\tconst subscribers = this._subscribers.get(propertyKey);\n\t\tif (!subscribers || subscribers.size == 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis._lock.push(propertyKey);\n\t\tsubscribers?.forEach(subscriptionInfo => {\n\t\t\tif (!subscriptionInfo.enable) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tsubscriptionInfo.callback(newValue, oldValue);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\t\t});\n\t\tif (this._lock.pop() !== propertyKey) {\n\t\t\tconsole.error('lock error');\n\t\t};\n\t}\n\tsubscribe(propertyKey: keyof T, callback: ValueChangedCallback): ScopeSubscription<T> {\n\t\tconst subscription: ScopeSubscription<T> = new ScopeSubscription(propertyKey, this);\n\t\tlet propertySubscribers = this._subscribers.get(propertyKey);\n\t\tif (!propertySubscribers) {\n\t\t\tpropertySubscribers = new Map();\n\t\t\tthis._subscribers.set(propertyKey, propertySubscribers);\n\t\t}\n\t\tpropertySubscribers.set(subscription, { callback, enable: true });\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(propertyKey: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tif (subscription) {\n\t\t\tthis._subscribers.get(propertyKey)?.delete(subscription);\n\t\t} else {\n\t\t\tthis._subscribers.delete(propertyKey);\n\t\t}\n\t}\n\n\tpause(propertyKey: keyof T, subscription: ScopeSubscription<T>) {\n\t\tconst subscriptionInfo = this._subscribers.get(propertyKey)?.get(subscription);\n\t\tsubscriptionInfo && (subscriptionInfo.enable = false);\n\t}\n\n\tresume(propertyKey: keyof T, subscription: ScopeSubscription<T>) {\n\t\tconst subscriptionInfo = this._subscribers.get(propertyKey)?.get(subscription);\n\t\tsubscriptionInfo && (subscriptionInfo.enable = true);\n\t}\n\n\t/**\n\t * check if this Observer has any subscribers\n\t */\n\thasSubscribers(): boolean;\n\n\t/**\n\t * check if there is any subscribers registered by the propertyKey.\n\t * \n\t * @param propertyKey\n\t */\n\thasSubscribers(propertyKey: keyof T): boolean;\n\thasSubscribers(propertyKey?: keyof T): boolean {\n\t\tif (propertyKey) {\n\t\t\treturn (this._subscribers.get(propertyKey)?.size ?? 0) > 0;\n\t\t}\n\t\treturn this._subscribers.size > 0;\n\t}\n\n\t/**\n\t * clear subscription maps\n\t */\n\tdestroy() {\n\t\tthis._subscribers.clear();\n\t}\n}\n\nexport class ReactiveScope<T extends Context> extends Scope<T> {\n\tstatic for<T extends Context>(context: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScope(context, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScope({} as T, propertyKeys);\n\t}\n\tstatic scopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tprotected _clone: T;\n\tdeclare protected _inners: Map<keyof T, ReactiveScope<any>>;\n\tprotected _observer: ValueChangeObserver<T> = new ValueChangeObserver<T>();\n\n\n\tconstructor(context: T, propertyKeys?: (keyof T)[], protected _name?: keyof T, protected _parent?: ReactiveScope<any>) {\n\t\tsuper(context, propertyKeys);\n\t\tthis._clone = Object.assign({}, context);\n\t}\n\n\tset(propertyKey: keyof T, newValue: any, receiver?: any): boolean {\n\t\tconst oldValue = Reflect.get(this._ctx, propertyKey);\n\t\tconst result = Reflect.set(this._ctx, propertyKey, newValue);\n\t\tif (result) {\n\t\t\tthis.emit(propertyKey, newValue, oldValue);\n\t\t}\n\t\treturn result;\n\t}\n\tdelete(propertyKey: keyof T): boolean {\n\t\tconst oldValue = Reflect.get(this._ctx, propertyKey);\n\t\tconst isDelete = Reflect.deleteProperty(this._ctx, propertyKey);\n\t\tif (isDelete && oldValue !== undefined) {\n\t\t\tthis.emit(propertyKey, undefined, oldValue);\n\t\t}\n\t\treturn isDelete;\n\t}\n\temit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tthis._observer.emit(propertyKey, newValue, oldValue);\n\t\tthis._parent?.emit(this._name!, this._ctx);\n\t}\n\tsubscribe(propertyKey: keyof T, callback: ValueChangedCallback): ScopeSubscription<T> {\n\t\treturn this._observer.subscribe(propertyKey, callback);\n\t}\n\tunsubscribe(propertyKey?: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tif (propertyKey && subscription) {\n\t\t\tthis._observer.unsubscribe(propertyKey, subscription);\n\t\t} else if (propertyKey) {\n\t\t\tthis._observer.unsubscribe(propertyKey);\n\t\t} else {\n\t\t\tthis._observer.destroy();\n\t\t}\n\t}\n\tdetectChanges() {\n\t\tconst previous = this._clone;\n\t\tconst current = this._ctx;\n\t\tif ((!!!previous && !!current) || (!!previous && !!!current)) {\n\t\t\tthis._parent?.emit(this._name!, current);\n\t\t\treturn;\n\t\t}\n\t\tconst keys = this._keys ?? this.getPropertyKeys(previous, current);\n\t\tkeys.forEach(key => {\n\t\t\tconst pv = previous[key];\n\t\t\tconst cv = current[key];\n\t\t\tconst pt = typeof pv;\n\t\t\tconst ct = typeof cv;\n\t\t\tif (pt === 'object') {\n\t\t\t\tif (ct === 'object' && pv == cv) {\n\t\t\t\t\tthis.getInnerScope<ReactiveScope<Context>>(key)?.detectChanges();\n\t\t\t\t} else if (cv != pv) {\n\t\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t\t}\n\t\t\t} else if (ct === 'object') {\n\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t} else if (pv != cv) {\n\t\t\t\tthis.emit(key, cv, pv);\n\t\t\t}\n\t\t});\n\t\tthis._clone = Object.assign({}, this._ctx);\n\t}\n\tprotected getPropertyKeys<V extends Record<PropertyKey, any>>(...objs: V[]) {\n\t\tlet keys: (keyof V)[] = [];\n\t\tobjs.forEach(obj => {\n\t\t\tkeys.push(...Object.keys(obj));\n\t\t\tkeys.push(...Object.getOwnPropertySymbols(obj));\n\t\t});\n\t\tkeys = Array.from(new Set(keys));\n\t\tkeys = keys.filter(key => {\n\t\t\tswitch (typeof key) {\n\t\t\t\tcase 'string':\n\t\t\t\t\treturn !key.startsWith('_');\n\t\t\t\tcase 'symbol':\n\t\t\t\t\treturn !key.toString().startsWith('Symbol(_');\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\treturn keys;\n\t}\n\tgetClass(): TypeOf<ReactiveScope<Context>> {\n\t\treturn ReactiveScope;\n\t}\n}\n\n/**\n * used control/notify/pause scope about changes in current context\n */\nexport interface ScopeControl<T extends Context> {\n\n\t/**\n\t * get current stacte of applying change detection.\n\t */\n\tisAttached(): boolean;\n\n\t/**\n\t * used when want to update ui-view like, you want to replace an array with another \n\t * without reflect changes on view until reattached again.\n\t */\n\tdetach(): void;\n\n\t/**\n\t * apply all the not emitted changes, and continue emit in time.\n\t */\n\treattach(): void;\n\n\t/**\n\t * apply changes now,\n\t * will not effect the state of the detector wither if attached ot not.\n\t * \n\t * if a propertyKey is provided, will emit this property only \n\t * @param propertyKey \n\t */\n\temitChanges(propertyKey?: keyof T, propertyValue?: any): void;\n\n\t/**\n\t * throw error if any changes has been made\n\t */\n\tcheckNoChanges(): void;\n}\n\nexport class ReactiveScopeControl<T extends Context> extends ReactiveScope<T> implements ScopeControl<T> {\n\tstatic for<T extends Context>(context: T, propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScopeControl(context, propertyKeys);\n\t}\n\tstatic blockScope<T extends Context>(propertyKeys?: (keyof T)[]) {\n\t\treturn new ReactiveScopeControl({} as T, propertyKeys);\n\t}\n\tstatic scopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScopeControl.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScopeControl.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\tstatic reactiveScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]) {\n\t\tconst thisScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst thisCtx = {\n\t\t\t'this': ctx,\n\t\t};\n\t\tconst rootScope = Scope.for(thisCtx, ['this']);\n\t\trootScope.setInnerScope('this', thisScope);\n\t\treturn rootScope;\n\t}\n\n\tprotected _attached: boolean = true;\n\tprotected _marked: { [key: keyof Context]: [any, any] } = {};\n\n\toverride emit(propertyKey: keyof T, newValue: any, oldValue?: any): void {\n\t\tif (this._attached) {\n\t\t\tsuper.emit(propertyKey, newValue, oldValue);\n\t\t} else if (this._marked[propertyKey as string]) {\n\t\t\tif (newValue == this._marked[propertyKey as string][1]) {\n\t\t\t\tdelete this._marked[propertyKey as string];\n\t\t\t} else {\n\t\t\t\tthis._marked[propertyKey as string][0] = newValue;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._marked[propertyKey as string] = [newValue, oldValue];\n\t\t}\n\t}\n\tisAttached(): boolean {\n\t\treturn this._attached;\n\t}\n\tdetach(): void {\n\t\tthis._attached = false;\n\t}\n\treattach(): void {\n\t\tthis._attached = true;\n\t\tthis.emitChanges();\n\t}\n\temitChanges(propertyKey?: keyof T, propertyValue?: any): void {\n\t\tif (propertyKey) {\n\t\t\tsuper.emit(propertyKey, propertyValue);\n\t\t\tReflect.deleteProperty(this._marked, propertyKey);\n\t\t\treturn;\n\t\t}\n\t\tconst latestChanges = this._marked;\n\t\tthis._marked = {};\n\t\tconst keys = this._keys ?? this.getPropertyKeys(latestChanges);\n\t\tkeys.forEach(propertyKey => {\n\t\t\tthis._observer.emit(propertyKey, latestChanges[propertyKey][0], latestChanges[propertyKey][1]);\n\t\t});\n\t\tkeys.length && this._parent?.emit(this._name!, this._ctx);\n\t}\n\tdetectChanges() {\n\t\tthis.detach();\n\t\tsuper.detectChanges();\n\t\tthis.reattach();\n\t}\n\tcheckNoChanges() {\n\t\tthis.detach();\n\t\tsuper.detectChanges();\n\t\tconst keys = Object.keys(this._marked);\n\t\tif (keys.length > 0) {\n\t\t\tthrow new Error(`Some Changes had been detected`);\n\t\t}\n\t}\n\tgetClass(): TypeOf<ReactiveScopeControl<Context>> {\n\t\treturn ReactiveScopeControl;\n\t}\n}\n\n\ninterface ImportMeta {\n\turl: URL;\n\t/**\n\t *\n\t * Provides a module-relative resolution function scoped to each module, returning\n\t * the URL string.\n\t *\n\t * @param specified The module specifier to resolve relative to `parent`.\n\t * @param parent The absolute parent module URL to resolve from. If none\n\t * is specified, the value of `import.meta.url` is used as the default.\n\t */\n\tresolve?(specified: string, parent?: string | URL): Promise<string>;\n}\n\nexport interface ModuleImport {\n\tmeta: ImportMeta\n}\n\nexport interface ModuleContext extends Context {\n\timport: ModuleImport & ((path: string) => Promise<any>);\n}\n\nexport class ModuleScope extends ReactiveScope<ModuleContext> {\n\tconstructor(context: ModuleContext, propertyKeys?: (keyof ModuleContext)[]) {\n\t\tsuper(context, propertyKeys);\n\t}\n\timportModule(propertyKey: keyof ModuleContext, scope: ModuleScope): void {\n\t\tthis._ctx[propertyKey] = scope._ctx;\n\t\tthis._inners.set(propertyKey, scope);\n\t\tthis.detectChanges();\n\t}\n}\nexport class WebModuleScope extends ModuleScope {\n\n\t// private loaded = false;\n\tprivate import: Promise<any>;\n\tconstructor(private source: string, private importCallOptions?: ImportCallOptions) {\n\t\tsuper({} as ModuleContext);\n\t\tthis.import = import(\n\t\t\tsource\n\t\t\t/*, { assert: importCallOptions?.assert } */ // TODO: update in future, node16, ESNEXT,ES2022, ES2023, ES2024\n\t\t).then(module => (this.updateContext(module))).then(() => this._ctx, () => this._ctx);\n\t}\n\tprivate updateContext(context: any) {\n\t\tthis._ctx = context;\n\t\tthis.detectChanges();\n\t}\n\n\tresolveImport() {\n\t\treturn this.import;\n\t}\n}\n"]}
package/scope/stack.d.ts CHANGED
@@ -122,6 +122,8 @@ export declare class Stack implements Stack {
122
122
  constructor(globalScope: Scope<Context>, resolver: ModuleScopeResolver, moduleSource: string);
123
123
  constructor(stack: Array<Scope<Context>>);
124
124
  constructor(stack: Array<Scope<Context>>, resolver: ModuleScopeResolver, moduleSource: string);
125
+ constructor(stack: Stack);
126
+ constructor(stack: Stack, resolver: ModuleScopeResolver, moduleSource: string);
125
127
  private initModuleContext;
126
128
  detectChanges(): void;
127
129
  private getReactiveScopeControls;
@@ -134,15 +136,25 @@ export interface ModuleScopeResolver {
134
136
  export declare function createRootURL(source: string): URL;
135
137
  export interface ResolverConfig {
136
138
  /**
137
- *
139
+ * allow import modules from external http(s) module
138
140
  */
139
141
  allowImportExternal?: boolean;
140
142
  }
143
+ /**
144
+ * file system provider
145
+ */
146
+ export interface ModuleSourceProvider {
147
+ [url: string]: string;
148
+ }
141
149
  export declare class ModuleScopeResolver implements ModuleScopeResolver {
150
+ protected globalStack: Stack;
151
+ protected provider: ModuleSourceProvider;
142
152
  protected config?: ResolverConfig | undefined;
143
153
  protected modules: [string, ModuleScope][];
144
- constructor(config?: ResolverConfig | undefined);
145
- register(source: string, moduleScope: ModuleScope): void;
154
+ constructor(globalStack: Stack, provider: ModuleSourceProvider, config?: ResolverConfig | undefined);
155
+ private register;
156
+ resolve(source: keyof ModuleSourceProvider): ModuleScope;
157
+ resolve(source: keyof ModuleSourceProvider, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope;
146
158
  protected findScopeBySource(source: string, importCallOptions?: ImportCallOptions): ModuleScope;
147
159
  protected findSourceByScope(moduleScope: ModuleScope): string;
148
160
  protected resolveExternalModule(source: string, importCallOptions?: ImportCallOptions): WebModuleScope;