@akylas/nativescript 9.1.4 → 9.1.5

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 (149) hide show
  1. package/application/application-common.d.ts +9 -3
  2. package/application/application-common.js +16 -3
  3. package/application/application-common.js.map +1 -1
  4. package/application/application.android.js +2 -6
  5. package/application/application.android.js.map +1 -1
  6. package/application/application.ios.js +8 -12
  7. package/application/application.ios.js.map +1 -1
  8. package/application/helpers-common.d.ts +2 -0
  9. package/application/helpers-common.js +23 -0
  10. package/application/helpers-common.js.map +1 -1
  11. package/config/config.interface.d.ts +1 -1
  12. package/config/config.interface.js.map +1 -1
  13. package/css-mediaquery/index.d.ts +6 -1
  14. package/css-mediaquery/index.js +31 -2
  15. package/css-mediaquery/index.js.map +1 -1
  16. package/debugger/webinspector-network.d.ts +29 -0
  17. package/fetch/index.d.ts +79 -0
  18. package/fetch/index.js +408 -0
  19. package/fetch/index.js.map +1 -0
  20. package/file-system/file-system-access.android.d.ts +1 -0
  21. package/file-system/file-system-access.android.js +18 -21
  22. package/file-system/file-system-access.android.js.map +1 -1
  23. package/global-types.d.ts +1 -1
  24. package/globals/index.js +4 -4
  25. package/globals/index.js.map +1 -1
  26. package/http/http-request/index.android.js +5 -1
  27. package/http/http-request/index.android.js.map +1 -1
  28. package/http/http-request-internal/http-request-internal-common.d.ts +1 -0
  29. package/http/http-request-internal/http-request-internal-common.js +9 -0
  30. package/http/http-request-internal/http-request-internal-common.js.map +1 -1
  31. package/http/http-request-internal/index.android.js +7 -5
  32. package/http/http-request-internal/index.android.js.map +1 -1
  33. package/http/http-request-internal/index.ios.js +33 -16
  34. package/http/http-request-internal/index.ios.js.map +1 -1
  35. package/image-source/index.ios.js +7 -6
  36. package/image-source/index.ios.js.map +1 -1
  37. package/index.d.ts +1 -1
  38. package/js-libs/easysax/easysax.d.ts +49 -7
  39. package/js-libs/easysax/easysax.js +631 -747
  40. package/js-libs/easysax/easysax.js.map +1 -0
  41. package/media-query-list/index.js +57 -15
  42. package/media-query-list/index.js.map +1 -1
  43. package/module-name-resolver/helpers.d.ts +1 -1
  44. package/module-name-resolver/helpers.js.map +1 -1
  45. package/module-name-resolver/index.d.ts +2 -2
  46. package/module-name-resolver/index.js.map +1 -1
  47. package/native-window/native-window.ios.js +3 -5
  48. package/native-window/native-window.ios.js.map +1 -1
  49. package/package.json +2 -3
  50. package/timer/index.android.js +2 -1
  51. package/timer/index.android.js.map +1 -1
  52. package/ui/action-bar/index.android.js +5 -4
  53. package/ui/action-bar/index.android.js.map +1 -1
  54. package/ui/animation/index.ios.js +6 -1
  55. package/ui/animation/index.ios.js.map +1 -1
  56. package/ui/builder/binding-builder.d.ts +8 -0
  57. package/ui/builder/binding-builder.js +12 -0
  58. package/ui/builder/binding-builder.js.map +1 -1
  59. package/ui/builder/component-builder/index.d.ts +7 -4
  60. package/ui/builder/component-builder/index.js +13 -7
  61. package/ui/builder/component-builder/index.js.map +1 -1
  62. package/ui/builder/index.d.ts +16 -2
  63. package/ui/builder/index.js +52 -12
  64. package/ui/builder/index.js.map +1 -1
  65. package/ui/button/index.android.js +4 -3
  66. package/ui/button/index.android.js.map +1 -1
  67. package/ui/content-view/index.js +2 -0
  68. package/ui/content-view/index.js.map +1 -1
  69. package/ui/core/bindable/bindable-types.d.ts +15 -0
  70. package/ui/core/bindable/bindable-types.js.map +1 -1
  71. package/ui/core/bindable/index.d.ts +1 -1
  72. package/ui/core/bindable/index.js +12 -7
  73. package/ui/core/bindable/index.js.map +1 -1
  74. package/ui/core/view/index.android.js +11 -9
  75. package/ui/core/view/index.android.js.map +1 -1
  76. package/ui/date-picker/index.android.js +1 -1
  77. package/ui/date-picker/index.android.js.map +1 -1
  78. package/ui/editable-text-base/index.android.d.ts +2 -0
  79. package/ui/editable-text-base/index.android.js +15 -6
  80. package/ui/editable-text-base/index.android.js.map +1 -1
  81. package/ui/editable-text-base/index.d.ts +8 -0
  82. package/ui/frame/fragment.transitions.android.d.ts +8 -5
  83. package/ui/frame/fragment.transitions.android.js +16 -18
  84. package/ui/frame/fragment.transitions.android.js.map +1 -1
  85. package/ui/frame/index.android.d.ts +1 -0
  86. package/ui/frame/index.android.js +10 -4
  87. package/ui/frame/index.android.js.map +1 -1
  88. package/ui/gestures/index.android.js +18 -9
  89. package/ui/gestures/index.android.js.map +1 -1
  90. package/ui/gestures/index.ios.js +6 -6
  91. package/ui/gestures/index.ios.js.map +1 -1
  92. package/ui/image/index.android.js +1 -1
  93. package/ui/image/index.android.js.map +1 -1
  94. package/ui/image-cache/index.android.js +1 -2
  95. package/ui/image-cache/index.android.js.map +1 -1
  96. package/ui/index.d.ts +1 -1
  97. package/ui/index.js.map +1 -1
  98. package/ui/list-picker/index.android.d.ts +1 -0
  99. package/ui/list-picker/index.android.js +6 -5
  100. package/ui/list-picker/index.android.js.map +1 -1
  101. package/ui/list-view/index.android.js +17 -9
  102. package/ui/list-view/index.android.js.map +1 -1
  103. package/ui/page/index.ios.js +7 -3
  104. package/ui/page/index.ios.js.map +1 -1
  105. package/ui/search-bar/index.android.js +2 -2
  106. package/ui/search-bar/index.android.js.map +1 -1
  107. package/ui/segmented-bar/index.android.js +8 -8
  108. package/ui/segmented-bar/index.android.js.map +1 -1
  109. package/ui/slider/index.android.js +1 -2
  110. package/ui/slider/index.android.js.map +1 -1
  111. package/ui/styling/background-common.js +2 -2
  112. package/ui/styling/background-common.js.map +1 -1
  113. package/ui/styling/background.d.ts +1 -1
  114. package/ui/styling/background.ios.d.ts +1 -1
  115. package/ui/styling/background.ios.js +1 -1
  116. package/ui/styling/background.ios.js.map +1 -1
  117. package/ui/styling/style/index.d.ts +13 -2
  118. package/ui/styling/style/index.js.map +1 -1
  119. package/ui/styling/style-scope.js +6 -0
  120. package/ui/styling/style-scope.js.map +1 -1
  121. package/ui/switch/index.android.js +1 -1
  122. package/ui/switch/index.android.js.map +1 -1
  123. package/ui/tab-view/index.android.js +9 -16
  124. package/ui/tab-view/index.android.js.map +1 -1
  125. package/ui/tab-view/index.ios.js +2 -2
  126. package/ui/tab-view/index.ios.js.map +1 -1
  127. package/ui/text-base/index.android.js +1 -1
  128. package/ui/text-base/index.android.js.map +1 -1
  129. package/ui/text-base/index.ios.js +1 -1
  130. package/ui/text-base/index.ios.js.map +1 -1
  131. package/ui/time-picker/index.android.js +1 -1
  132. package/ui/time-picker/index.android.js.map +1 -1
  133. package/ui/transition/page-transition.android.js +0 -44
  134. package/ui/transition/page-transition.android.js.map +1 -1
  135. package/ui/web-view/index.android.js +1 -1
  136. package/ui/web-view/index.android.js.map +1 -1
  137. package/utils/android-runtime-version.d.ts +12 -0
  138. package/utils/android-runtime-version.js +36 -0
  139. package/utils/android-runtime-version.js.map +1 -0
  140. package/utils/native-helper-for-android.js +3 -1
  141. package/utils/native-helper-for-android.js.map +1 -1
  142. package/xhr/index.d.ts +5 -4
  143. package/xhr/index.js +18 -18
  144. package/xhr/index.js.map +1 -1
  145. package/xml/index.d.ts +2 -2
  146. package/xml/index.js +1 -1
  147. package/xml/index.js.map +1 -1
  148. package/LICENSE +0 -19
  149. package/fetch/index.mjs +0 -535
@@ -1 +1 @@
1
- {"version":3,"file":"binding-builder.js","sourceRoot":"","sources":["../../../../../packages/core/ui/builder/binding-builder.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,sBAAsB,GAAG,8CAA8C,CAAC;AAE9E,MAAM,KAAW,gBAAgB,CAUhC;AAVD,WAAiB,gBAAgB;IACnB,+BAAc,GAAG,gBAAgB,CAAC;IAClC,+BAAc,GAAG,gBAAgB,CAAC;IAClC,2BAAU,GAAG,YAAY,CAAC;IAC1B,uBAAM,GAAG,QAAQ,CAAC;IAClB,uBAAM,GAAG,QAAQ,CAAC;IAClB,gCAAe,GAAG,QAAQ,CAAC;IAC3B,+BAAc,GAAG,SAAS,CAAC;IAC3B,gCAAe,GAAG,UAAU,CAAC;IAC7B,oCAAmB,GAAG,mBAAmB,CAAC;AACxD,CAAC,EAVgB,gBAAgB,KAAhB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,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7C,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED,MAAM,oBAAoB,GAAG;IAC5B,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,gBAAgB,CAAC,cAAc;CAChD,CAAC","sourcesContent":["// regex that contains all symbols applicable for expression used to AI detect an expression.\nconst expressionSymbolsRegex = /[\\+\\-\\*\\/%\\?:<>=!\\|&\\(\\)^~]|^`.*\\$\\{.+\\}.*`$/;\n\nexport namespace bindingConstants {\n\texport const sourceProperty = 'sourceProperty';\n\texport const targetProperty = 'targetProperty';\n\texport const expression = 'expression';\n\texport const twoWay = 'twoWay';\n\texport const source = 'source';\n\texport const bindingValueKey = '$value';\n\texport const parentValueKey = '$parent';\n\texport const parentsValueKey = '$parents';\n\texport const newPropertyValueKey = '$newPropertyValue';\n}\n\nconst hasEqualSignRegex = /=+/;\nconst equalSignComparisionOperatorsRegex = /(==|===|>=|<=|!=|!==)/;\n\n// this regex is used to search for all instaces of '$parents[]' within an expression\nexport const parentsRegex = /\\$parents\\s*\\[\\s*(['\"]*)\\w*\\1\\s*\\]/g;\n\nfunction isNamedParam(value) {\n\tconst equalSignIndex = value.search(hasEqualSignRegex);\n\tif (equalSignIndex > -1) {\n\t\tconst equalSignSurround = value.substr(equalSignIndex > 0 ? equalSignIndex - 1 : 0, 3);\n\t\tif (equalSignSurround.search(equalSignComparisionOperatorsRegex) === -1) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction areNamedParams(params: Array<any>) {\n\tfor (let i = 0; i < params.length; i++) {\n\t\tif (isNamedParam(params[i])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nconst namedParamConstants = {\n\tpropName: 'propName',\n\tpropValue: 'propValue',\n};\n\nfunction getPropertyNameValuePair(param, knownOptions, callback) {\n\tlet nameValuePair = {};\n\tlet propertyName = param.substr(0, param.indexOf('=')).trim();\n\tconst propertyValue = param.substr(param.indexOf('=') + 1).trim();\n\tif (knownOptions) {\n\t\tif (!propertyName) {\n\t\t\tpropertyName = knownOptions.defaultProperty;\n\t\t} else {\n\t\t\tpropertyName = propertyName in knownOptions ? propertyName : null;\n\t\t}\n\t}\n\n\tif (propertyName) {\n\t\tif (callback) {\n\t\t\tnameValuePair = callback(propertyName, propertyValue);\n\t\t} else {\n\t\t\tnameValuePair[namedParamConstants.propName] = propertyName;\n\t\t\tnameValuePair[namedParamConstants.propValue] = propertyValue;\n\t\t}\n\n\t\treturn nameValuePair;\n\t}\n\n\treturn null;\n}\n\nfunction parseNamedProperties(parameterList, knownOptions, callback) {\n\tconst result = {};\n\tlet nameValuePair;\n\tfor (let i = 0; i < parameterList.length; i++) {\n\t\tnameValuePair = getPropertyNameValuePair(parameterList[i], knownOptions, callback);\n\t\tif (nameValuePair) {\n\t\t\tresult[nameValuePair[namedParamConstants.propName]] = nameValuePair[namedParamConstants.propValue];\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction getParamsArray(value: string) {\n\tconst result = [];\n\tlet skipComma = 0;\n\tlet indexReached = 0;\n\tlet singleQuoteBlock = false;\n\tlet doubleQuoteBlock = false;\n\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value[i] === '\"') {\n\t\t\tdoubleQuoteBlock = !doubleQuoteBlock;\n\t\t}\n\n\t\tif (value[i] === \"'\") {\n\t\t\tsingleQuoteBlock = !singleQuoteBlock;\n\t\t}\n\n\t\tif (value[i] === '(' || value[i] === '[') {\n\t\t\tskipComma++;\n\t\t}\n\n\t\tif (value[i] === ')' || value[i] === ']') {\n\t\t\tskipComma--;\n\t\t}\n\n\t\tif (value[i] === ',' && skipComma === 0 && !(singleQuoteBlock || doubleQuoteBlock)) {\n\t\t\tresult.push(value.substr(indexReached, i - indexReached));\n\t\t\tindexReached = i + 1;\n\t\t}\n\t}\n\n\tresult.push(value.substr(indexReached));\n\n\treturn result;\n}\n\nfunction isExpression(expression: string): boolean {\n\treturn expression.search(expressionSymbolsRegex) > -1;\n}\n\nexport function getBindingOptions(name: string, value: string): any {\n\tlet namedParams = [];\n\tconst params = getParamsArray(value);\n\tif (!areNamedParams(params)) {\n\t\tif (params.length === 1) {\n\t\t\tconst trimmedValue = params[0].trim();\n\t\t\tlet sourceProp;\n\t\t\tif (isExpression(trimmedValue)) {\n\t\t\t\tsourceProp = bindingConstants.bindingValueKey;\n\t\t\t\tnamedParams.push(bindingConstants.expression + ' = ' + trimmedValue);\n\t\t\t} else {\n\t\t\t\tsourceProp = trimmedValue;\n\t\t\t}\n\t\t\tnamedParams.push(bindingConstants.sourceProperty + ' = ' + sourceProp);\n\n\t\t\tnamedParams.push(bindingConstants.twoWay + ' = true');\n\t\t} else {\n\t\t\tnamedParams.push(bindingConstants.sourceProperty + ' = ' + params[0].trim());\n\t\t\tnamedParams.push(bindingConstants.expression + ' = ' + params[1].trim());\n\t\t\tconst twoWay = params[2] ? params[2].toLowerCase().trim() === 'true' : true;\n\t\t\tnamedParams.push(bindingConstants.twoWay + ' = ' + twoWay);\n\t\t}\n\t} else {\n\t\tnamedParams = params;\n\t}\n\n\tconst bindingPropertyHandler = function (prop, value) {\n\t\tconst result = {};\n\t\tresult[namedParamConstants.propName] = prop;\n\t\tif (prop === bindingConstants.twoWay) {\n\t\t\t// create a real boolean value\n\t\t\tif (value === 'true') {\n\t\t\t\tresult[namedParamConstants.propValue] = true;\n\t\t\t} else {\n\t\t\t\tresult[namedParamConstants.propValue] = false;\n\t\t\t}\n\t\t} else {\n\t\t\tresult[namedParamConstants.propValue] = value;\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tconst bindingOptionsParameters = parseNamedProperties(namedParams, xmlBindingProperties, bindingPropertyHandler);\n\tconst bindOptions = {\n\t\ttargetProperty: name,\n\t};\n\n\tfor (const prop in bindingOptionsParameters) {\n\t\tif (bindingOptionsParameters.hasOwnProperty(prop)) {\n\t\t\tbindOptions[prop] = bindingOptionsParameters[prop];\n\t\t}\n\t}\n\n\tif (bindOptions[bindingConstants.twoWay] === undefined) {\n\t\tbindOptions[bindingConstants.twoWay] = true;\n\t}\n\n\treturn bindOptions;\n}\n\nconst xmlBindingProperties = {\n\tsourceProperty: true,\n\texpression: true,\n\ttwoWay: true,\n\tsource: true,\n\tdefaultProperty: bindingConstants.sourceProperty,\n};\n"]}
1
+ {"version":3,"file":"binding-builder.js","sourceRoot":"","sources":["../../../../../packages/core/ui/builder/binding-builder.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,MAAM,sBAAsB,GAAG,8CAA8C,CAAC;AAE9E,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW,EAAE,OAAwB;IAC5E,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC7C,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,KAAW,gBAAgB,CAUhC;AAVD,WAAiB,gBAAgB;IACnB,+BAAc,GAAG,gBAAgB,CAAC;IAClC,+BAAc,GAAG,gBAAgB,CAAC;IAClC,2BAAU,GAAG,YAAY,CAAC;IAC1B,uBAAM,GAAG,QAAQ,CAAC;IAClB,uBAAM,GAAG,QAAQ,CAAC;IAClB,gCAAe,GAAG,QAAQ,CAAC;IAC3B,+BAAc,GAAG,SAAS,CAAC;IAC3B,gCAAe,GAAG,UAAU,CAAC;IAC7B,oCAAmB,GAAG,mBAAmB,CAAC;AACxD,CAAC,EAVgB,gBAAgB,KAAhB,gBAAgB,QAUhC;AAED,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,kCAAkC,GAAG,uBAAuB,CAAC;AAEnE,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C;AAED,MAAM,oBAAoB,GAAG;IAC5B,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,gBAAgB,CAAC,cAAc;CAChD,CAAC","sourcesContent":["import type { CompiledBinding } from '../core/bindable/bindable-types';\n\n// regex that contains all symbols applicable for expression used to AI detect an expression.\nconst expressionSymbolsRegex = /[\\+\\-\\*\\/%\\?:<>=!\\|&\\(\\)^~]|^`.*\\$\\{.+\\}.*`$/;\n\nconst compiledBindings = new Map<string, CompiledBinding>();\n\n/**\n * Registers a binding expression compiled ahead of time for the XML attribute at `key`: `file:line:column:attribute`,\n * the file as the module name resolver names it without a leading `./`, the element's start-tag position, and the\n * attribute name as written (`ios:text`).\n */\nexport function registerCompiledBinding(key: string, binding: CompiledBinding): void {\n\tcompiledBindings.set(key, binding);\n}\n\nexport function getCompiledBinding(key: string): CompiledBinding | undefined {\n\treturn compiledBindings.get(key);\n}\n\nexport namespace bindingConstants {\n\texport const sourceProperty = 'sourceProperty';\n\texport const targetProperty = 'targetProperty';\n\texport const expression = 'expression';\n\texport const twoWay = 'twoWay';\n\texport const source = 'source';\n\texport const bindingValueKey = '$value';\n\texport const parentValueKey = '$parent';\n\texport const parentsValueKey = '$parents';\n\texport const newPropertyValueKey = '$newPropertyValue';\n}\n\nconst hasEqualSignRegex = /=+/;\nconst equalSignComparisionOperatorsRegex = /(==|===|>=|<=|!=|!==)/;\n\n// this regex is used to search for all instaces of '$parents[]' within an expression\nexport const parentsRegex = /\\$parents\\s*\\[\\s*(['\"]*)\\w*\\1\\s*\\]/g;\n\nfunction isNamedParam(value) {\n\tconst equalSignIndex = value.search(hasEqualSignRegex);\n\tif (equalSignIndex > -1) {\n\t\tconst equalSignSurround = value.substr(equalSignIndex > 0 ? equalSignIndex - 1 : 0, 3);\n\t\tif (equalSignSurround.search(equalSignComparisionOperatorsRegex) === -1) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction areNamedParams(params: Array<any>) {\n\tfor (let i = 0; i < params.length; i++) {\n\t\tif (isNamedParam(params[i])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nconst namedParamConstants = {\n\tpropName: 'propName',\n\tpropValue: 'propValue',\n};\n\nfunction getPropertyNameValuePair(param, knownOptions, callback) {\n\tlet nameValuePair = {};\n\tlet propertyName = param.substr(0, param.indexOf('=')).trim();\n\tconst propertyValue = param.substr(param.indexOf('=') + 1).trim();\n\tif (knownOptions) {\n\t\tif (!propertyName) {\n\t\t\tpropertyName = knownOptions.defaultProperty;\n\t\t} else {\n\t\t\tpropertyName = propertyName in knownOptions ? propertyName : null;\n\t\t}\n\t}\n\n\tif (propertyName) {\n\t\tif (callback) {\n\t\t\tnameValuePair = callback(propertyName, propertyValue);\n\t\t} else {\n\t\t\tnameValuePair[namedParamConstants.propName] = propertyName;\n\t\t\tnameValuePair[namedParamConstants.propValue] = propertyValue;\n\t\t}\n\n\t\treturn nameValuePair;\n\t}\n\n\treturn null;\n}\n\nfunction parseNamedProperties(parameterList, knownOptions, callback) {\n\tconst result = {};\n\tlet nameValuePair;\n\tfor (let i = 0; i < parameterList.length; i++) {\n\t\tnameValuePair = getPropertyNameValuePair(parameterList[i], knownOptions, callback);\n\t\tif (nameValuePair) {\n\t\t\tresult[nameValuePair[namedParamConstants.propName]] = nameValuePair[namedParamConstants.propValue];\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction getParamsArray(value: string) {\n\tconst result = [];\n\tlet skipComma = 0;\n\tlet indexReached = 0;\n\tlet singleQuoteBlock = false;\n\tlet doubleQuoteBlock = false;\n\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value[i] === '\"') {\n\t\t\tdoubleQuoteBlock = !doubleQuoteBlock;\n\t\t}\n\n\t\tif (value[i] === \"'\") {\n\t\t\tsingleQuoteBlock = !singleQuoteBlock;\n\t\t}\n\n\t\tif (value[i] === '(' || value[i] === '[') {\n\t\t\tskipComma++;\n\t\t}\n\n\t\tif (value[i] === ')' || value[i] === ']') {\n\t\t\tskipComma--;\n\t\t}\n\n\t\tif (value[i] === ',' && skipComma === 0 && !(singleQuoteBlock || doubleQuoteBlock)) {\n\t\t\tresult.push(value.substr(indexReached, i - indexReached));\n\t\t\tindexReached = i + 1;\n\t\t}\n\t}\n\n\tresult.push(value.substr(indexReached));\n\n\treturn result;\n}\n\nfunction isExpression(expression: string): boolean {\n\treturn expression.search(expressionSymbolsRegex) > -1;\n}\n\nexport function getBindingOptions(name: string, value: string): any {\n\tlet namedParams = [];\n\tconst params = getParamsArray(value);\n\tif (!areNamedParams(params)) {\n\t\tif (params.length === 1) {\n\t\t\tconst trimmedValue = params[0].trim();\n\t\t\tlet sourceProp;\n\t\t\tif (isExpression(trimmedValue)) {\n\t\t\t\tsourceProp = bindingConstants.bindingValueKey;\n\t\t\t\tnamedParams.push(bindingConstants.expression + ' = ' + trimmedValue);\n\t\t\t} else {\n\t\t\t\tsourceProp = trimmedValue;\n\t\t\t}\n\t\t\tnamedParams.push(bindingConstants.sourceProperty + ' = ' + sourceProp);\n\n\t\t\tnamedParams.push(bindingConstants.twoWay + ' = true');\n\t\t} else {\n\t\t\tnamedParams.push(bindingConstants.sourceProperty + ' = ' + params[0].trim());\n\t\t\tnamedParams.push(bindingConstants.expression + ' = ' + params[1].trim());\n\t\t\tconst twoWay = params[2] ? params[2].toLowerCase().trim() === 'true' : true;\n\t\t\tnamedParams.push(bindingConstants.twoWay + ' = ' + twoWay);\n\t\t}\n\t} else {\n\t\tnamedParams = params;\n\t}\n\n\tconst bindingPropertyHandler = function (prop, value) {\n\t\tconst result = {};\n\t\tresult[namedParamConstants.propName] = prop;\n\t\tif (prop === bindingConstants.twoWay) {\n\t\t\t// create a real boolean value\n\t\t\tif (value === 'true') {\n\t\t\t\tresult[namedParamConstants.propValue] = true;\n\t\t\t} else {\n\t\t\t\tresult[namedParamConstants.propValue] = false;\n\t\t\t}\n\t\t} else {\n\t\t\tresult[namedParamConstants.propValue] = value;\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tconst bindingOptionsParameters = parseNamedProperties(namedParams, xmlBindingProperties, bindingPropertyHandler);\n\tconst bindOptions = {\n\t\ttargetProperty: name,\n\t};\n\n\tfor (const prop in bindingOptionsParameters) {\n\t\tif (bindingOptionsParameters.hasOwnProperty(prop)) {\n\t\t\tbindOptions[prop] = bindingOptionsParameters[prop];\n\t\t}\n\t}\n\n\tif (bindOptions[bindingConstants.twoWay] === undefined) {\n\t\tbindOptions[bindingConstants.twoWay] = true;\n\t}\n\n\treturn bindOptions;\n}\n\nconst xmlBindingProperties = {\n\tsourceProperty: true,\n\texpression: true,\n\ttwoWay: true,\n\tsource: true,\n\tdefaultProperty: bindingConstants.sourceProperty,\n};\n"]}
@@ -1,7 +1,10 @@
1
- import { View } from '../../core/view';
1
+ import type { ViewBase } from '../../core/view-base';
2
2
  export interface ComponentModule {
3
- component: View;
3
+ component: ViewBase;
4
4
  exports: any;
5
5
  }
6
- export declare function getComponentModule(elementName: string, namespace: string, attributes: Object, moduleExports: Object, moduleNamePath?: string, isRootComponent?: boolean): ComponentModule;
7
- export declare function setPropertyValue(instance: View, instanceModule: Object, exports: Object, propertyName: string, propertyValue: any): void;
6
+ export declare function getComponentModule(elementName: string, namespace: string | undefined, attributes: Object, moduleExports: Object, moduleNamePath?: string, isRootComponent?: boolean, bindingKey?: string): ComponentModule;
7
+ /**
8
+ * `bindingKey`: the attribute's key in the compiled binding table (`registerCompiledBinding`).
9
+ */
10
+ export declare function setPropertyValue(instance: any, instanceModule: Object, exports: Object, propertyName: string, propertyValue: any, bindingKey?: string): void;
@@ -1,6 +1,6 @@
1
1
  // Types.
2
2
  import { isEventOrGesture } from '../../core/bindable';
3
- import { getBindingOptions, bindingConstants } from '../binding-builder';
3
+ import { getBindingOptions, bindingConstants, getCompiledBinding } from '../binding-builder';
4
4
  import { profile } from '../../../profiling';
5
5
  import * as debugModule from '../../../utils/debug';
6
6
  import { Device } from '../../../platform';
@@ -126,10 +126,11 @@ const applyComponentCss = profile('applyComponentCss', (instance, moduleName, at
126
126
  }
127
127
  }
128
128
  });
129
- const applyComponentAttributes = profile('applyComponentAttributes', (instance, instanceModule, moduleExports, attributes) => {
129
+ const applyComponentAttributes = profile('applyComponentAttributes', (instance, instanceModule, moduleExports, attributes, bindingKey) => {
130
130
  if (instance && instanceModule) {
131
131
  for (let attr in attributes) {
132
132
  const attrValue = attributes[attr];
133
+ const attrKey = bindingKey && bindingKey + attr;
133
134
  if (attr.indexOf(':') !== -1) {
134
135
  const platformName = attr.split(':')[0].trim();
135
136
  if (platformName.toLowerCase() === Device.os.toLowerCase()) {
@@ -140,6 +141,7 @@ const applyComponentAttributes = profile('applyComponentAttributes', (instance,
140
141
  }
141
142
  }
142
143
  if (attr.indexOf('.') !== -1) {
144
+ // A dotted attribute (`ios.position`) sets a member of what the instance holds, any object.
143
145
  let subObj = instance;
144
146
  const properties = attr.split('.');
145
147
  const subPropName = properties[properties.length - 1];
@@ -149,16 +151,16 @@ const applyComponentAttributes = profile('applyComponentAttributes', (instance,
149
151
  }
150
152
  }
151
153
  if (subObj !== undefined && subObj !== null) {
152
- setPropertyValue(subObj, instanceModule, moduleExports, subPropName, attrValue);
154
+ setPropertyValue(subObj, instanceModule, moduleExports, subPropName, attrValue, attrKey);
153
155
  }
154
156
  }
155
157
  else {
156
- setPropertyValue(instance, instanceModule, moduleExports, attr, attrValue);
158
+ setPropertyValue(instance, instanceModule, moduleExports, attr, attrValue, attrKey);
157
159
  }
158
160
  }
159
161
  }
160
162
  });
161
- export function getComponentModule(elementName, namespace, attributes, moduleExports, moduleNamePath, isRootComponent) {
163
+ export function getComponentModule(elementName, namespace, attributes, moduleExports, moduleNamePath, isRootComponent, bindingKey) {
162
164
  // Support lower-case-dashed component declaration in the XML (https://github.com/NativeScript/NativeScript/issues/309).
163
165
  elementName = elementName
164
166
  .split('-')
@@ -169,14 +171,17 @@ export function getComponentModule(elementName, namespace, attributes, moduleExp
169
171
  if (isRootComponent) {
170
172
  applyComponentCss(instance, moduleNamePath, attributes);
171
173
  }
172
- applyComponentAttributes(instance, instanceModule, moduleExports, attributes);
174
+ applyComponentAttributes(instance, instanceModule, moduleExports, attributes, bindingKey);
173
175
  let componentModule;
174
176
  if (instance && instanceModule) {
175
177
  componentModule = { component: instance, exports: instanceModule };
176
178
  }
177
179
  return componentModule;
178
180
  }
179
- export function setPropertyValue(instance, instanceModule, exports, propertyName, propertyValue) {
181
+ /**
182
+ * `bindingKey`: the attribute's key in the compiled binding table (`registerCompiledBinding`).
183
+ */
184
+ export function setPropertyValue(instance, instanceModule, exports, propertyName, propertyValue, bindingKey) {
180
185
  // Note: instanceModule can be null if we are loading custom component with no code-behind.
181
186
  if (isBinding(propertyValue) && instance.bind) {
182
187
  const bindOptions = getBindingOptions(propertyName, getBindingExpressionFromAttribute(propertyValue));
@@ -185,6 +190,7 @@ export function setPropertyValue(instance, instanceModule, exports, propertyName
185
190
  targetProperty: bindOptions[bindingConstants.targetProperty],
186
191
  expression: bindOptions[bindingConstants.expression],
187
192
  twoWay: bindOptions[bindingConstants.twoWay],
193
+ compiled: bindingKey ? getCompiledBinding(bindingKey) : undefined,
188
194
  }, bindOptions[bindingConstants.source]);
189
195
  }
190
196
  else if (isEventOrGesture(propertyName, instance)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/ui/builder/component-builder/index.ts"],"names":[],"mappings":"AAGA,SAAS;AACT,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAA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,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,SAAS,CAAC,KAAU;IAC5B,IAAI,SAAS,CAAC;IACd,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QACzB,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,6CAA6C;AAC7C,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,SAAS,eAAe,CAAC,IAAY,EAAE,QAAc;IACpD,OAAO,QAAQ,CAAC,WAAW,IAAI,eAAe,IAAI,QAAQ,CAAC,WAAW,IAAK,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAClJ,CAAC","sourcesContent":["// Definitions.\nimport { View } from '../../core/view';\n\n// Types.\nimport { isEventOrGesture } from '../../core/bindable';\nimport { getBindingOptions, bindingConstants } from '../binding-builder';\nimport { profile } from '../../../profiling';\nimport * as debugModule from '../../../utils/debug';\nimport { Device } from '../../../platform';\nimport { sanitizeModuleName } from '../../../utils/common';\nimport { resolveModuleName } from '../../../module-name-resolver';\n\nexport interface ComponentModule {\n\tcomponent: View;\n\texports: any;\n}\n\nconst legacyShortBarrels = __UI_USE_EXTERNAL_RENDERER__\n\t? []\n\t: [\n\t\t\t'text/formatted-string',\n\t\t\t'text/span',\n\t\t\t'ui/text-base/formatted-string',\n\t\t\t'ui/text-base/span',\n\t\t\t'ui/action-bar',\n\t\t\t'ui/activity-indicator',\n\t\t\t'ui/button',\n\t\t\t'ui/content-view',\n\t\t\t'ui/date-picker',\n\t\t\t'ui/frame',\n\t\t\t'ui/html-view',\n\t\t\t'ui/image',\n\t\t\t'ui/label',\n\t\t\t'ui/layouts/absolute-layout',\n\t\t\t'ui/layouts/dock-layout',\n\t\t\t'ui/layouts/grid-layout',\n\t\t\t'ui/layouts/stack-layout',\n\t\t\t'ui/layouts/flexbox-layout',\n\t\t\t'ui/layouts/wrap-layout',\n\t\t\t'ui/list-picker',\n\t\t\t'ui/page',\n\t\t\t'ui/placeholder',\n\t\t\t'ui/progress',\n\t\t\t'ui/proxy-view-container',\n\t\t\t'ui/repeater',\n\t\t\t'ui/scroll-view',\n\t\t\t'ui/search-bar',\n\t\t\t'ui/segmented-bar',\n\t\t\t'ui/slider',\n\t\t\t'ui/switch',\n\t\t\t'ui/tab-view',\n\t\t\t'ui/web-view',\n\t\t\t'ui/text-field',\n\t\t\t'ui/text-view',\n\t\t\t'ui/time-picker',\n\t\t\t'ui/list-view',\n\t ];\nconst CORE_UI_BARREL = '@nativescript/core/ui';\nconst CODE_FILE = 'codeFile';\nconst CSS_FILE = 'cssFile';\nconst IMPORT = 'import';\n\nconst createComponentInstance = profile('createComponentInstance', (elementName: string, namespace: string): { instance: View; instanceModule: Object } => {\n\tlet instance: View;\n\tlet instanceModule: Object;\n\t// Get module id.\n\tlet resolvedModuleName;\n\ttry {\n\t\tif (typeof namespace === 'string') {\n\t\t\tif (legacyShortBarrels.includes(namespace)) {\n\t\t\t\t// console.log('CORE_UI_BARREL namespace:', namespace)\n\t\t\t\tresolvedModuleName = CORE_UI_BARREL;\n\t\t\t} else {\n\t\t\t\t// console.log('CUSTOM namespace:', namespace)\n\t\t\t\tresolvedModuleName = resolveModuleName(namespace, '');\n\t\t\t}\n\t\t\tinstanceModule = global.loadModule(resolvedModuleName);\n\t\t} else {\n\t\t\t// load module from @nativescript/core/ui or mapped paths\n\t\t\t// resolvedModuleName =\n\t\t\t// \tMODULES[elementName] ||\n\t\t\t// \tUI_PATH +\n\t\t\t// \t\t(elementName.toLowerCase().indexOf('layout') !== -1 ? 'layouts/' : '') +\n\t\t\t// \t\telementName\n\t\t\t// \t\t\t.split(/(?=[A-Z])/)\n\t\t\t// \t\t\t.join('-')\n\t\t\t// \t\t\t.toLowerCase();\n\n\t\t\tinstanceModule = global.loadModule(CORE_UI_BARREL);\n\t\t\t// don't register core modules for HMR self-accept\n\t\t\t// instanceModule = global.loadModule(resolvedModuleName, false);\n\t\t}\n\n\t\t// Get the component type from module.\n\t\tconst instanceType = instanceModule[elementName];\n\n\t\t// Create instance of the component.\n\t\tinstance = new instanceType();\n\t} catch (ex) {\n\t\tthrow new debugModule.ScopeError(ex, \"Module '\" + (resolvedModuleName || elementName) + \"' not found for element '\" + (namespace ? namespace + ':' : '') + elementName + \"'.\");\n\t}\n\n\treturn { instance, instanceModule };\n});\n\nconst getComponentModuleExports = profile('getComponentModuleExports', (instance: View, moduleExports: Object, attributes: Object): Object => {\n\tif (attributes) {\n\t\tconst codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];\n\t\tif (codeFileAttribute) {\n\t\t\tconst resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');\n\t\t\tif (resolvedCodeFileModule) {\n\t\t\t\tmoduleExports = global.loadModule(resolvedCodeFileModule);\n\t\t\t\t(<any>instance).exports = moduleExports;\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Code file with path \"${codeFileAttribute}\" cannot be found! Looking for webpack module with name \"${resolvedCodeFileModule}\"`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn moduleExports;\n});\n\nconst applyComponentCss = profile('applyComponentCss', (instance: View, moduleName: string, attributes: Object) => {\n\tlet cssApplied = false;\n\n\tif (attributes && attributes[CSS_FILE]) {\n\t\tconst resolvedCssModuleName = resolveModuleName(sanitizeModuleName(attributes[CSS_FILE]), 'css');\n\n\t\tif (resolvedCssModuleName) {\n\t\t\tinstance.addCssFile(resolvedCssModuleName);\n\t\t\tcssApplied = true;\n\t\t} else {\n\t\t\tthrow new Error(`Css file with path \"${attributes[CSS_FILE]}\" cannot be found! Looking for webpack module with name \"${resolvedCssModuleName}\"`);\n\t\t}\n\t}\n\n\tif (moduleName && !cssApplied) {\n\t\tconst resolvedCssModuleName = resolveModuleName(moduleName, 'css');\n\t\tif (resolvedCssModuleName) {\n\t\t\tinstance.addCssFile(resolvedCssModuleName);\n\t\t}\n\t}\n});\n\nconst applyComponentAttributes = profile('applyComponentAttributes', (instance: View, instanceModule: Object, moduleExports: Object, attributes: Object) => {\n\tif (instance && instanceModule) {\n\t\tfor (let attr in attributes) {\n\t\t\tconst attrValue = <string>attributes[attr];\n\n\t\t\tif (attr.indexOf(':') !== -1) {\n\t\t\t\tconst platformName = attr.split(':')[0].trim();\n\n\t\t\t\tif (platformName.toLowerCase() === Device.os.toLowerCase()) {\n\t\t\t\t\tattr = attr.split(':')[1].trim();\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (attr.indexOf('.') !== -1) {\n\t\t\t\tlet subObj = instance;\n\t\t\t\tconst properties = attr.split('.');\n\t\t\t\tconst subPropName = properties[properties.length - 1];\n\n\t\t\t\tfor (let i = 0; i < properties.length - 1; i++) {\n\t\t\t\t\tif (subObj !== undefined && subObj !== null) {\n\t\t\t\t\t\tsubObj = subObj[properties[i]];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (subObj !== undefined && subObj !== null) {\n\t\t\t\t\tsetPropertyValue(subObj, instanceModule, moduleExports, subPropName, attrValue);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsetPropertyValue(instance, instanceModule, moduleExports, attr, attrValue);\n\t\t\t}\n\t\t}\n\t}\n});\n\nexport function getComponentModule(elementName: string, namespace: string, attributes: Object, moduleExports: Object, moduleNamePath?: string, isRootComponent?: boolean): ComponentModule {\n\t// Support lower-case-dashed component declaration in the XML (https://github.com/NativeScript/NativeScript/issues/309).\n\telementName = elementName\n\t\t.split('-')\n\t\t.map((s) => s[0].toUpperCase() + s.substring(1))\n\t\t.join('');\n\n\tconst { instance, instanceModule } = createComponentInstance(elementName, namespace, null);\n\tmoduleExports = getComponentModuleExports(instance, <any>moduleExports, attributes);\n\tif (isRootComponent) {\n\t\tapplyComponentCss(instance, moduleNamePath, attributes);\n\t}\n\n\tapplyComponentAttributes(instance, instanceModule, moduleExports, attributes);\n\n\tlet componentModule;\n\tif (instance && instanceModule) {\n\t\tcomponentModule = { component: instance, exports: instanceModule };\n\t}\n\n\treturn componentModule;\n}\n\nexport function setPropertyValue(instance: View, instanceModule: Object, exports: Object, propertyName: string, propertyValue: any) {\n\t// Note: instanceModule can be null if we are loading custom component with no code-behind.\n\tif (isBinding(propertyValue) && instance.bind) {\n\t\tconst bindOptions = getBindingOptions(propertyName, getBindingExpressionFromAttribute(propertyValue));\n\t\tinstance.bind(\n\t\t\t{\n\t\t\t\tsourceProperty: bindOptions[bindingConstants.sourceProperty],\n\t\t\t\ttargetProperty: bindOptions[bindingConstants.targetProperty],\n\t\t\t\texpression: bindOptions[bindingConstants.expression],\n\t\t\t\ttwoWay: bindOptions[bindingConstants.twoWay],\n\t\t\t},\n\t\t\tbindOptions[bindingConstants.source],\n\t\t);\n\t} else if (isEventOrGesture(propertyName, instance)) {\n\t\t// Get the event handler from page module exports.\n\t\tconst handler = exports && exports[propertyValue];\n\n\t\t// Check if the handler is function and add it to the instance for specified event name.\n\t\tif (typeof handler === 'function') {\n\t\t\tinstance.on(propertyName, handler);\n\t\t}\n\t} else if (isKnownFunction(propertyName, instance) && exports && typeof exports[propertyValue] === 'function') {\n\t\tinstance[propertyName] = exports[propertyValue];\n\t} else {\n\t\tinstance[propertyName] = propertyValue;\n\t}\n}\n\nfunction getBindingExpressionFromAttribute(value: string): string {\n\treturn value.replace('{{', '').replace('}}', '').trim();\n}\n\nfunction isBinding(value: any): boolean {\n\tlet isBinding;\n\tif (typeof value === 'string') {\n\t\tconst str = value.trim();\n\t\tisBinding = str.indexOf('{{') === 0 && str.lastIndexOf('}}') === str.length - 2;\n\t}\n\n\treturn isBinding;\n}\n\n// For example, ListView.itemTemplateSelector\nconst KNOWN_FUNCTIONS = 'knownFunctions';\nfunction isKnownFunction(name: string, instance: View): boolean {\n\treturn instance.constructor && KNOWN_FUNCTIONS in instance.constructor && (instance.constructor[KNOWN_FUNCTIONS] as string).indexOf(name) !== -1;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/ui/builder/component-builder/index.ts"],"names":[],"mappings":"AAIA,SAAS;AACT,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQlE,MAAM,kBAAkB,GAAG,4BAA4B;IACtD,CAAC,CAAC,EAAE;IACJ,CAAC,CAAC;QACA,uBAAuB;QACvB,WAAW;QACX,+BAA+B;QAC/B,mBAAmB;QACnB,eAAe;QACf,uBAAuB;QACvB,WAAW;QACX,iBAAiB;QACjB,gBAAgB;QAChB,UAAU;QACV,cAAc;QACd,UAAU;QACV,UAAU;QACV,4BAA4B;QAC5B,wBAAwB;QACxB,wBAAwB;QACxB,yBAAyB;QACzB,2BAA2B;QAC3B,wBAAwB;QACxB,gBAAgB;QAChB,SAAS;QACT,gBAAgB;QAChB,aAAa;QACb,yBAAyB;QACzB,aAAa;QACb,gBAAgB;QAChB,eAAe;QACf,kBAAkB;QAClB,WAAW;QACX,WAAW;QACX,aAAa;QACb,aAAa;QACb,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,cAAc;KACb,CAAC;AACL,MAAM,cAAc,GAAG,uBA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,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,SAAS,eAAe,CAAC,IAAY,EAAE,QAA2B;IACjE,OAAO,QAAQ,CAAC,WAAW,IAAI,eAAe,IAAI,QAAQ,CAAC,WAAW,IAAK,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAc,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACpJ,CAAC","sourcesContent":["// Definitions.\nimport { View } from '../../core/view';\nimport type { ViewBase } from '../../core/view-base';\n\n// Types.\nimport { isEventOrGesture } from '../../core/bindable';\nimport { getBindingOptions, bindingConstants, getCompiledBinding } from '../binding-builder';\nimport { profile } from '../../../profiling';\nimport * as debugModule from '../../../utils/debug';\nimport { Device } from '../../../platform';\nimport { sanitizeModuleName } from '../../../utils/common';\nimport { resolveModuleName } from '../../../module-name-resolver';\n\nexport interface ComponentModule {\n\t// Any element: a view, or what a view holds (an ActionItem, a Span).\n\tcomponent: ViewBase;\n\texports: any;\n}\n\nconst legacyShortBarrels = __UI_USE_EXTERNAL_RENDERER__\n\t? []\n\t: [\n\t\t\t'text/formatted-string',\n\t\t\t'text/span',\n\t\t\t'ui/text-base/formatted-string',\n\t\t\t'ui/text-base/span',\n\t\t\t'ui/action-bar',\n\t\t\t'ui/activity-indicator',\n\t\t\t'ui/button',\n\t\t\t'ui/content-view',\n\t\t\t'ui/date-picker',\n\t\t\t'ui/frame',\n\t\t\t'ui/html-view',\n\t\t\t'ui/image',\n\t\t\t'ui/label',\n\t\t\t'ui/layouts/absolute-layout',\n\t\t\t'ui/layouts/dock-layout',\n\t\t\t'ui/layouts/grid-layout',\n\t\t\t'ui/layouts/stack-layout',\n\t\t\t'ui/layouts/flexbox-layout',\n\t\t\t'ui/layouts/wrap-layout',\n\t\t\t'ui/list-picker',\n\t\t\t'ui/page',\n\t\t\t'ui/placeholder',\n\t\t\t'ui/progress',\n\t\t\t'ui/proxy-view-container',\n\t\t\t'ui/repeater',\n\t\t\t'ui/scroll-view',\n\t\t\t'ui/search-bar',\n\t\t\t'ui/segmented-bar',\n\t\t\t'ui/slider',\n\t\t\t'ui/switch',\n\t\t\t'ui/tab-view',\n\t\t\t'ui/web-view',\n\t\t\t'ui/text-field',\n\t\t\t'ui/text-view',\n\t\t\t'ui/time-picker',\n\t\t\t'ui/list-view',\n\t ];\nconst CORE_UI_BARREL = '@nativescript/core/ui';\nconst CODE_FILE = 'codeFile';\nconst CSS_FILE = 'cssFile';\nconst IMPORT = 'import';\n\nconst createComponentInstance = profile('createComponentInstance', (elementName: string, namespace: string | undefined): { instance: ViewBase; instanceModule: Object } => {\n\tlet instance: ViewBase;\n\tlet instanceModule: Object;\n\t// Get module id.\n\tlet resolvedModuleName;\n\ttry {\n\t\tif (typeof namespace === 'string') {\n\t\t\tif (legacyShortBarrels.includes(namespace)) {\n\t\t\t\t// console.log('CORE_UI_BARREL namespace:', namespace)\n\t\t\t\tresolvedModuleName = CORE_UI_BARREL;\n\t\t\t} else {\n\t\t\t\t// console.log('CUSTOM namespace:', namespace)\n\t\t\t\tresolvedModuleName = resolveModuleName(namespace, '');\n\t\t\t}\n\t\t\tinstanceModule = global.loadModule(resolvedModuleName);\n\t\t} else {\n\t\t\t// load module from @nativescript/core/ui or mapped paths\n\t\t\t// resolvedModuleName =\n\t\t\t// \tMODULES[elementName] ||\n\t\t\t// \tUI_PATH +\n\t\t\t// \t\t(elementName.toLowerCase().indexOf('layout') !== -1 ? 'layouts/' : '') +\n\t\t\t// \t\telementName\n\t\t\t// \t\t\t.split(/(?=[A-Z])/)\n\t\t\t// \t\t\t.join('-')\n\t\t\t// \t\t\t.toLowerCase();\n\n\t\t\tinstanceModule = global.loadModule(CORE_UI_BARREL);\n\t\t\t// don't register core modules for HMR self-accept\n\t\t\t// instanceModule = global.loadModule(resolvedModuleName, false);\n\t\t}\n\n\t\t// Get the component type from module.\n\t\tconst instanceType = instanceModule[elementName];\n\n\t\t// Create instance of the component.\n\t\tinstance = new instanceType();\n\t} catch (ex) {\n\t\tthrow new debugModule.ScopeError(ex, \"Module '\" + (resolvedModuleName || elementName) + \"' not found for element '\" + (namespace ? namespace + ':' : '') + elementName + \"'.\");\n\t}\n\n\treturn { instance, instanceModule };\n});\n\nconst getComponentModuleExports = profile('getComponentModuleExports', (instance: ViewBase, moduleExports: Object, attributes: Object): Object => {\n\tif (attributes) {\n\t\tconst codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];\n\t\tif (codeFileAttribute) {\n\t\t\tconst resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');\n\t\t\tif (resolvedCodeFileModule) {\n\t\t\t\tmoduleExports = global.loadModule(resolvedCodeFileModule);\n\t\t\t\t(<any>instance).exports = moduleExports;\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Code file with path \"${codeFileAttribute}\" cannot be found! Looking for webpack module with name \"${resolvedCodeFileModule}\"`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn moduleExports;\n});\n\nconst applyComponentCss = profile('applyComponentCss', (instance: View, moduleName: string, attributes: Object) => {\n\tlet cssApplied = false;\n\n\tif (attributes && attributes[CSS_FILE]) {\n\t\tconst resolvedCssModuleName = resolveModuleName(sanitizeModuleName(attributes[CSS_FILE]), 'css');\n\n\t\tif (resolvedCssModuleName) {\n\t\t\tinstance.addCssFile(resolvedCssModuleName);\n\t\t\tcssApplied = true;\n\t\t} else {\n\t\t\tthrow new Error(`Css file with path \"${attributes[CSS_FILE]}\" cannot be found! Looking for webpack module with name \"${resolvedCssModuleName}\"`);\n\t\t}\n\t}\n\n\tif (moduleName && !cssApplied) {\n\t\tconst resolvedCssModuleName = resolveModuleName(moduleName, 'css');\n\t\tif (resolvedCssModuleName) {\n\t\t\tinstance.addCssFile(resolvedCssModuleName);\n\t\t}\n\t}\n});\n\nconst applyComponentAttributes = profile('applyComponentAttributes', (instance: ViewBase, instanceModule: Object, moduleExports: Object, attributes: Object, bindingKey?: string) => {\n\tif (instance && instanceModule) {\n\t\tfor (let attr in attributes) {\n\t\t\tconst attrValue = <string>attributes[attr];\n\t\t\tconst attrKey = bindingKey && bindingKey + attr;\n\n\t\t\tif (attr.indexOf(':') !== -1) {\n\t\t\t\tconst platformName = attr.split(':')[0].trim();\n\n\t\t\t\tif (platformName.toLowerCase() === Device.os.toLowerCase()) {\n\t\t\t\t\tattr = attr.split(':')[1].trim();\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (attr.indexOf('.') !== -1) {\n\t\t\t\t// A dotted attribute (`ios.position`) sets a member of what the instance holds, any object.\n\t\t\t\tlet subObj: any = instance;\n\t\t\t\tconst properties = attr.split('.');\n\t\t\t\tconst subPropName = properties[properties.length - 1];\n\n\t\t\t\tfor (let i = 0; i < properties.length - 1; i++) {\n\t\t\t\t\tif (subObj !== undefined && subObj !== null) {\n\t\t\t\t\t\tsubObj = subObj[properties[i]];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (subObj !== undefined && subObj !== null) {\n\t\t\t\t\tsetPropertyValue(subObj, instanceModule, moduleExports, subPropName, attrValue, attrKey);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsetPropertyValue(instance, instanceModule, moduleExports, attr, attrValue, attrKey);\n\t\t\t}\n\t\t}\n\t}\n});\n\nexport function getComponentModule(elementName: string, namespace: string | undefined, attributes: Object, moduleExports: Object, moduleNamePath?: string, isRootComponent?: boolean, bindingKey?: string): ComponentModule {\n\t// Support lower-case-dashed component declaration in the XML (https://github.com/NativeScript/NativeScript/issues/309).\n\telementName = elementName\n\t\t.split('-')\n\t\t.map((s) => s[0].toUpperCase() + s.substring(1))\n\t\t.join('');\n\n\tconst { instance, instanceModule } = createComponentInstance(elementName, namespace, null);\n\tmoduleExports = getComponentModuleExports(instance, <any>moduleExports, attributes);\n\tif (isRootComponent) {\n\t\tapplyComponentCss(<View>instance, moduleNamePath, attributes);\n\t}\n\n\tapplyComponentAttributes(instance, instanceModule, moduleExports, attributes, bindingKey);\n\n\tlet componentModule;\n\tif (instance && instanceModule) {\n\t\tcomponentModule = { component: instance, exports: instanceModule };\n\t}\n\n\treturn componentModule;\n}\n\n/**\n * `bindingKey`: the attribute's key in the compiled binding table (`registerCompiledBinding`).\n */\nexport function setPropertyValue(instance: any, instanceModule: Object, exports: Object, propertyName: string, propertyValue: any, bindingKey?: string) {\n\t// Note: instanceModule can be null if we are loading custom component with no code-behind.\n\tif (isBinding(propertyValue) && instance.bind) {\n\t\tconst bindOptions = getBindingOptions(propertyName, getBindingExpressionFromAttribute(propertyValue));\n\t\tinstance.bind(\n\t\t\t{\n\t\t\t\tsourceProperty: bindOptions[bindingConstants.sourceProperty],\n\t\t\t\ttargetProperty: bindOptions[bindingConstants.targetProperty],\n\t\t\t\texpression: bindOptions[bindingConstants.expression],\n\t\t\t\ttwoWay: bindOptions[bindingConstants.twoWay],\n\t\t\t\tcompiled: bindingKey ? getCompiledBinding(bindingKey) : undefined,\n\t\t\t},\n\t\t\tbindOptions[bindingConstants.source],\n\t\t);\n\t} else if (isEventOrGesture(propertyName, instance)) {\n\t\t// Get the event handler from page module exports.\n\t\tconst handler = exports && exports[propertyValue];\n\n\t\t// Check if the handler is function and add it to the instance for specified event name.\n\t\tif (typeof handler === 'function') {\n\t\t\tinstance.on(propertyName, handler);\n\t\t}\n\t} else if (isKnownFunction(propertyName, instance) && exports && typeof exports[propertyValue] === 'function') {\n\t\tinstance[propertyName] = exports[propertyValue];\n\t} else {\n\t\tinstance[propertyName] = propertyValue;\n\t}\n}\n\nfunction getBindingExpressionFromAttribute(value: string): string {\n\treturn value.replace('{{', '').replace('}}', '').trim();\n}\n\nfunction isBinding(value: any): boolean {\n\tlet isBinding;\n\tif (typeof value === 'string') {\n\t\tconst str = value.trim();\n\t\tisBinding = str.indexOf('{{') === 0 && str.lastIndexOf('}}') === str.length - 2;\n\t}\n\n\treturn isBinding;\n}\n\n// For example, ListView.itemTemplateSelector\nconst KNOWN_FUNCTIONS = 'knownFunctions';\nfunction isKnownFunction(name: string, instance: ViewBase | object): boolean {\n\treturn instance.constructor && KNOWN_FUNCTIONS in instance.constructor && (instance.constructor[KNOWN_FUNCTIONS] as string[]).indexOf(name) !== -1;\n}\n"]}
@@ -58,7 +58,19 @@ export declare function load(pathOrOptions: string | LoadOptions, context?: any)
58
58
  * @deprecated Use Builder.createViewFromEntry() instead.
59
59
  */
60
60
  export declare function createViewFromEntry(entry: ViewEntry): View;
61
- export declare function loadCustomComponent(componentNamespace: string, componentName?: string, attributes?: Object, context?: Object, parentPage?: View, isRootComponent?: boolean, moduleNamePath?: string): ComponentModule;
61
+ /**
62
+ * Builds an XML file's view tree without parsing it, as the Builder would from its text: `exports` is the context the
63
+ * Builder would parse it with, `moduleName` the module it loads it for, `xmlModule` the file as the resolver named it.
64
+ */
65
+ export type PageFactory = (exports: any, moduleName: string, xmlModule: string) => View;
66
+ /**
67
+ * Registers the factory of the XML file `xmlModule` (as the module name resolver names it, without a leading `./`);
68
+ * `undefined` removes it. The resolver still picks the file, so qualified variants keep their own factories.
69
+ * `codeModule`/`codeExports`: the file's code-behind as the resolver names it and the very object `global.loadModule`
70
+ * returns for it, which core then takes without loading the module.
71
+ */
72
+ export declare function registerPageFactory(xmlModule: string, factory?: PageFactory, codeModule?: string, codeExports?: any): void;
73
+ export declare function loadCustomComponent(componentNamespace: string, componentName?: string, attributes?: Object, context?: Object, parentPage?: View, isRootComponent?: boolean, moduleNamePath?: string, bindingKey?: string): ComponentModule;
62
74
  export declare function getExports(instance: ViewBase): any;
63
75
  export declare namespace xml2ui {
64
76
  /**
@@ -113,6 +125,7 @@ export declare namespace xml2ui {
113
125
  templateItems: Array<string>;
114
126
  errorFormat: ErrorFormatter;
115
127
  sourceTracker: SourceTracker;
128
+ xmlModule?: string;
116
129
  }
117
130
  /**
118
131
  * It is a state pattern
@@ -159,6 +172,7 @@ export declare namespace xml2ui {
159
172
  }
160
173
  export class ComponentParser implements XmlStateConsumer {
161
174
  private moduleName?;
175
+ private xmlModule?;
162
176
  private static KNOWNCOLLECTIONS;
163
177
  private static KNOWNTEMPLATES;
164
178
  private static KNOWNMULTITEMPLATES;
@@ -169,7 +183,7 @@ export declare namespace xml2ui {
169
183
  private complexProperties;
170
184
  private error;
171
185
  private sourceTracker;
172
- constructor(context: any, errorFormat: ErrorFormatter, sourceTracker: SourceTracker, moduleName?: string);
186
+ constructor(context: any, errorFormat: ErrorFormatter, sourceTracker: SourceTracker, moduleName?: string, xmlModule?: string);
173
187
  private buildComponent;
174
188
  parse(args: xml.ParserEvent): XmlStateConsumer;
175
189
  private static isComplexProperty;
@@ -49,7 +49,7 @@ export class Builder {
49
49
  else if (entry.moduleName) {
50
50
  const moduleName = sanitizeModuleName(entry.moduleName);
51
51
  const resolvedCodeModuleName = resolveModuleName(moduleName, ''); //`${moduleName}.xml`;
52
- const moduleExports = resolvedCodeModuleName ? global.loadModule(resolvedCodeModuleName) : null;
52
+ const moduleExports = resolvedCodeModuleName ? loadCodeModule(resolvedCodeModuleName) : null;
53
53
  if (moduleExports && moduleExports.createPage) {
54
54
  // Exports has a createPage() method
55
55
  const view = moduleExports.createPage();
@@ -150,12 +150,48 @@ export function createViewFromEntry(entry) {
150
150
  console.log('createViewFromEntry() is deprecated. Use Builder.createViewFromEntry() instead.');
151
151
  return Builder.createViewFromEntry(entry);
152
152
  }
153
+ const pageFactories = new Map();
154
+ const pageCodeModules = new Map();
155
+ const ownedCodeModules = new Map();
156
+ /**
157
+ * Registers the factory of the XML file `xmlModule` (as the module name resolver names it, without a leading `./`);
158
+ * `undefined` removes it. The resolver still picks the file, so qualified variants keep their own factories.
159
+ * `codeModule`/`codeExports`: the file's code-behind as the resolver names it and the very object `global.loadModule`
160
+ * returns for it, which core then takes without loading the module.
161
+ */
162
+ export function registerPageFactory(xmlModule, factory, codeModule, codeExports) {
163
+ const owned = pageCodeModules.get(xmlModule);
164
+ if (owned !== undefined) {
165
+ pageCodeModules.delete(xmlModule);
166
+ ownedCodeModules.delete(owned);
167
+ }
168
+ if (factory) {
169
+ pageFactories.set(xmlModule, factory);
170
+ if (codeModule) {
171
+ pageCodeModules.set(xmlModule, codeModule);
172
+ ownedCodeModules.set(codeModule, codeExports);
173
+ }
174
+ }
175
+ else {
176
+ pageFactories.delete(xmlModule);
177
+ }
178
+ }
179
+ function loadCodeModule(resolvedCodeModuleName) {
180
+ const name = resolvedCodeModuleName.startsWith('./') ? resolvedCodeModuleName.substring(2) : resolvedCodeModuleName;
181
+ return ownedCodeModules.has(name) ? ownedCodeModules.get(name) : global.loadModule(resolvedCodeModuleName);
182
+ }
153
183
  function loadInternal(moduleName, moduleExports) {
154
184
  let componentModule;
155
185
  const resolvedXmlModule = resolveModuleName(moduleName, 'xml');
156
186
  if (resolvedXmlModule) {
157
- const text = global.loadModule(resolvedXmlModule);
158
- componentModule = parseInternal(text, moduleExports, resolvedXmlModule, moduleName);
187
+ const factory = pageFactories.get(resolvedXmlModule.startsWith('./') ? resolvedXmlModule.substring(2) : resolvedXmlModule);
188
+ if (factory) {
189
+ componentModule = { component: factory(moduleExports, moduleName, resolvedXmlModule), exports: moduleExports };
190
+ }
191
+ else {
192
+ const text = global.loadModule(resolvedXmlModule);
193
+ componentModule = parseInternal(text, moduleExports, resolvedXmlModule, moduleName);
194
+ }
159
195
  }
160
196
  const componentView = componentModule && componentModule.component;
161
197
  if (componentView) {
@@ -169,7 +205,7 @@ function loadInternal(moduleName, moduleExports) {
169
205
  }
170
206
  return componentModule;
171
207
  }
172
- export function loadCustomComponent(componentNamespace, componentName, attributes, context, parentPage, isRootComponent = true, moduleNamePath) {
208
+ export function loadCustomComponent(componentNamespace, componentName, attributes, context, parentPage, isRootComponent = true, moduleNamePath, bindingKey) {
173
209
  if (!parentPage && context) {
174
210
  // Read the parent page that was passed down below
175
211
  // https://github.com/NativeScript/NativeScript/issues/1639
@@ -187,7 +223,7 @@ export function loadCustomComponent(componentNamespace, componentName, attribute
187
223
  let subExports = context;
188
224
  if (resolvedCodeModuleName) {
189
225
  // Component has registered code module.
190
- subExports = global.loadModule(resolvedCodeModuleName);
226
+ subExports = loadCodeModule(resolvedCodeModuleName);
191
227
  }
192
228
  // Pass the parent page down the chain in case of custom components nested on many levels. Use the context for piggybacking.
193
229
  // https://github.com/NativeScript/NativeScript/issues/1639
@@ -199,13 +235,13 @@ export function loadCustomComponent(componentNamespace, componentName, attribute
199
235
  // Attributes will be transferred to the custom component
200
236
  if (isDefined(result) && isDefined(result.component) && isDefined(attributes)) {
201
237
  for (const attr in attributes) {
202
- setPropertyValue(result.component, subExports, context, attr, attributes[attr]);
238
+ setPropertyValue(result.component, subExports, context, attr, attributes[attr], bindingKey && bindingKey + attr);
203
239
  }
204
240
  }
205
241
  }
206
242
  else {
207
243
  // Custom components without XML
208
- result = getComponentModule(componentName, componentNamespace, attributes, context, moduleNamePath, isRootComponent);
244
+ result = getComponentModule(componentName, componentNamespace, attributes, context, moduleNamePath, isRootComponent, bindingKey);
209
245
  // The namespace is the JS module and the (componentName is the name of the class in the module)
210
246
  // So if there is no componentNamespace/componentName.{qualifiers}.css we should also look for
211
247
  // componentNamespace.{qualifiers}.css
@@ -242,7 +278,7 @@ function parseInternal(value, context, xmlModule, moduleName) {
242
278
  : () => {
243
279
  // no-op
244
280
  };
245
- (start = new xml2ui.XmlStringParser(errorFormat)).pipe(new xml2ui.PlatformFilter()).pipe(new xml2ui.XmlStateParser((ui = new xml2ui.ComponentParser(context, errorFormat, componentSourceTracker, moduleName))));
281
+ (start = new xml2ui.XmlStringParser(errorFormat)).pipe(new xml2ui.PlatformFilter()).pipe(new xml2ui.XmlStateParser((ui = new xml2ui.ComponentParser(context, errorFormat, componentSourceTracker, moduleName, xmlModule))));
246
282
  start.parse(value);
247
283
  return ui.rootComponentModule;
248
284
  }
@@ -443,7 +479,7 @@ export var xml2ui;
443
479
  let ui;
444
480
  (start = new xml2ui.XmlArgsReplay(this._recordedXmlStream, errorFormat))
445
481
  // No platform filter, it has been filtered already
446
- .pipe(new XmlStateParser((ui = new ComponentParser(context, errorFormat, sourceTracker))));
482
+ .pipe(new XmlStateParser((ui = new ComponentParser(context, errorFormat, sourceTracker, undefined, this._templateProperty.xmlModule))));
447
483
  start.replay();
448
484
  return ui.rootComponentModule.component;
449
485
  });
@@ -490,8 +526,9 @@ export var xml2ui;
490
526
  }
491
527
  xml2ui.MultiTemplateParser = MultiTemplateParser;
492
528
  class ComponentParser {
493
- constructor(context, errorFormat, sourceTracker, moduleName) {
529
+ constructor(context, errorFormat, sourceTracker, moduleName, xmlModule) {
494
530
  this.moduleName = moduleName;
531
+ this.xmlModule = xmlModule;
495
532
  this.parents = new Array();
496
533
  this.complexProperties = new Array();
497
534
  this.context = context;
@@ -499,9 +536,10 @@ export var xml2ui;
499
536
  this.sourceTracker = sourceTracker;
500
537
  }
501
538
  buildComponent(args) {
539
+ const bindingKey = this.xmlModule && args.position ? `${this.xmlModule.startsWith('./') ? this.xmlModule.substring(2) : this.xmlModule}:${args.position.line}:${args.position.column}:` : undefined;
502
540
  if (args.prefix && args.namespace) {
503
541
  // Custom components
504
- return loadCustomComponent(args.namespace, args.elementName, args.attributes, this.context, this.currentRootView, !this.currentRootView, this.moduleName);
542
+ return loadCustomComponent(args.namespace, args.elementName, args.attributes, this.context, this.currentRootView, !this.currentRootView, this.moduleName, bindingKey);
505
543
  }
506
544
  else {
507
545
  // Default components
@@ -510,7 +548,7 @@ export var xml2ui;
510
548
  //Ignore the default ...tns.xsd namespace URL
511
549
  namespace = undefined;
512
550
  }
513
- return getComponentModule(args.elementName, namespace, args.attributes, this.context, this.moduleName, !this.currentRootView);
551
+ return getComponentModule(args.elementName, namespace, args.attributes, this.context, this.moduleName, !this.currentRootView, bindingKey);
514
552
  }
515
553
  }
516
554
  parse(args) {
@@ -536,6 +574,7 @@ export var xml2ui;
536
574
  templateItems: [],
537
575
  errorFormat: this.error,
538
576
  sourceTracker: this.sourceTracker,
577
+ xmlModule: this.xmlModule,
539
578
  });
540
579
  }
541
580
  if (ComponentParser.isKnownMultiTemplate(name, parent.exports)) {
@@ -547,6 +586,7 @@ export var xml2ui;
547
586
  templateItems: [],
548
587
  errorFormat: this.error,
549
588
  sourceTracker: this.sourceTracker,
589
+ xmlModule: this.xmlModule,
550
590
  });
551
591
  complexProperty.parser = parser;
552
592
  return parser;