@hadss/hmrouter-plugin 1.1.0-beta.0 → 1.1.1-alpha.0

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 (120) hide show
  1. package/README.md +246 -67
  2. package/dist/HMRouterPluginManager.d.ts +9 -0
  3. package/dist/HMRouterPluginManager.js +55 -0
  4. package/dist/Index.d.ts +9 -3
  5. package/dist/Index.js +29 -109
  6. package/dist/framework/constants/TaskConstants.d.ts +8 -0
  7. package/dist/framework/constants/TaskConstants.js +12 -0
  8. package/dist/framework/constants/index.d.ts +1 -0
  9. package/dist/framework/constants/index.js +17 -0
  10. package/dist/framework/core/PluginExecutionController.d.ts +15 -0
  11. package/dist/framework/core/PluginExecutionController.js +62 -0
  12. package/dist/framework/core/TaskManager.d.ts +12 -0
  13. package/dist/framework/core/TaskManager.js +67 -0
  14. package/dist/framework/core/TaskStage.d.ts +10 -0
  15. package/dist/framework/core/TaskStage.js +14 -0
  16. package/dist/framework/core/index.d.ts +3 -0
  17. package/dist/framework/core/index.js +19 -0
  18. package/dist/framework/extension/ExtensionManager.d.ts +11 -0
  19. package/dist/framework/extension/ExtensionManager.js +33 -0
  20. package/dist/framework/extension/PluginExtension.d.ts +13 -0
  21. package/dist/framework/extension/PluginExtension.js +6 -0
  22. package/dist/framework/extension/context/ExtensionContextImpl.d.ts +23 -0
  23. package/dist/framework/extension/context/ExtensionContextImpl.js +64 -0
  24. package/dist/framework/extension/context/Interface.d.ts +21 -0
  25. package/dist/framework/extension/context/Interface.js +2 -0
  26. package/dist/framework/extension/context/TemplateMetadataImpl.d.ts +12 -0
  27. package/dist/framework/extension/context/TemplateMetadataImpl.js +22 -0
  28. package/dist/framework/extension/index.d.ts +4 -0
  29. package/dist/framework/extension/index.js +20 -0
  30. package/dist/framework/index.d.ts +4 -0
  31. package/dist/framework/index.js +20 -0
  32. package/dist/framework/utils/FileUtil.d.ts +13 -0
  33. package/dist/framework/utils/FileUtil.js +20 -0
  34. package/dist/framework/utils/Logger.d.ts +12 -0
  35. package/dist/framework/utils/Logger.js +31 -0
  36. package/dist/framework/utils/ModuleTypeUtil.d.ts +4 -0
  37. package/dist/framework/utils/ModuleTypeUtil.js +16 -0
  38. package/dist/framework/utils/ObjectUtils.d.ts +3 -0
  39. package/dist/framework/utils/ObjectUtils.js +14 -0
  40. package/dist/framework/utils/PluginStore.d.ts +10 -0
  41. package/dist/framework/utils/PluginStore.js +29 -0
  42. package/dist/framework/utils/StringUtil.d.ts +3 -0
  43. package/dist/framework/utils/StringUtil.js +18 -0
  44. package/dist/framework/utils/TsAstUtil.d.ts +6 -0
  45. package/dist/framework/utils/TsAstUtil.js +19 -0
  46. package/dist/framework/utils/index.d.ts +7 -0
  47. package/dist/framework/utils/index.js +23 -0
  48. package/dist/hmrouter_extension/HMRouterExtension.d.ts +14 -0
  49. package/dist/hmrouter_extension/HMRouterExtension.js +47 -0
  50. package/dist/hmrouter_extension/HMRouterExtensionContext.d.ts +8 -0
  51. package/dist/hmrouter_extension/HMRouterExtensionContext.js +2 -0
  52. package/dist/hmrouter_extension/analyzer/AnnotationAnalyzerRegistry.d.ts +14 -0
  53. package/dist/hmrouter_extension/analyzer/AnnotationAnalyzerRegistry.js +45 -0
  54. package/dist/hmrouter_extension/analyzer/ComponentAnalyzer.d.ts +12 -0
  55. package/dist/hmrouter_extension/analyzer/ComponentAnalyzer.js +52 -0
  56. package/dist/hmrouter_extension/analyzer/RouterAnalyzer.d.ts +11 -0
  57. package/dist/hmrouter_extension/analyzer/RouterAnalyzer.js +79 -0
  58. package/dist/hmrouter_extension/analyzer/interface/AbstractAnnotationAnalyzer.d.ts +9 -0
  59. package/dist/hmrouter_extension/analyzer/interface/AbstractAnnotationAnalyzer.js +9 -0
  60. package/dist/hmrouter_extension/analyzer/interface/IConstantResolver.d.ts +7 -0
  61. package/dist/hmrouter_extension/analyzer/interface/IConstantResolver.js +2 -0
  62. package/dist/hmrouter_extension/analyzer/utils/ConstantAnalyzer.d.ts +9 -0
  63. package/dist/hmrouter_extension/analyzer/utils/ConstantAnalyzer.js +32 -0
  64. package/dist/hmrouter_extension/analyzer/utils/ConstantResolver.d.ts +15 -0
  65. package/dist/hmrouter_extension/analyzer/utils/ConstantResolver.js +217 -0
  66. package/dist/hmrouter_extension/analyzer/utils/DecoratorParser.d.ts +7 -0
  67. package/dist/hmrouter_extension/analyzer/utils/DecoratorParser.js +41 -0
  68. package/dist/hmrouter_extension/analyzer/utils/ImportAnalyzer.d.ts +4 -0
  69. package/dist/hmrouter_extension/analyzer/utils/ImportAnalyzer.js +35 -0
  70. package/dist/hmrouter_extension/config/HMRouterPluginConfig.d.ts +38 -0
  71. package/dist/hmrouter_extension/config/HMRouterPluginConfig.js +64 -0
  72. package/dist/hmrouter_extension/constants/AnnotationConstants.d.ts +8 -0
  73. package/dist/hmrouter_extension/constants/AnnotationConstants.js +11 -0
  74. package/dist/hmrouter_extension/constants/FilePathConstants.d.ts +19 -0
  75. package/dist/hmrouter_extension/constants/FilePathConstants.js +26 -0
  76. package/dist/hmrouter_extension/constants/ObfuscationConstants.d.ts +5 -0
  77. package/dist/hmrouter_extension/constants/ObfuscationConstants.js +8 -0
  78. package/dist/hmrouter_extension/constants/PluginConstants.d.ts +6 -0
  79. package/dist/hmrouter_extension/constants/PluginConstants.js +9 -0
  80. package/dist/hmrouter_extension/constants/PrefixConstants.d.ts +8 -0
  81. package/dist/hmrouter_extension/constants/PrefixConstants.js +11 -0
  82. package/dist/hmrouter_extension/constants/RouterMapConstants.d.ts +5 -0
  83. package/dist/hmrouter_extension/constants/RouterMapConstants.js +8 -0
  84. package/dist/hmrouter_extension/constants/TemplateConstants.d.ts +6 -0
  85. package/dist/hmrouter_extension/constants/TemplateConstants.js +9 -0
  86. package/dist/hmrouter_extension/constants/VersionConstants.d.ts +6 -0
  87. package/dist/hmrouter_extension/constants/VersionConstants.js +9 -0
  88. package/dist/hmrouter_extension/constants/index.d.ts +8 -0
  89. package/dist/hmrouter_extension/constants/index.js +22 -0
  90. package/dist/hmrouter_extension/error/PluginError.d.ts +29 -0
  91. package/dist/hmrouter_extension/error/PluginError.js +75 -0
  92. package/dist/hmrouter_extension/model/HMAnnotationModel.d.ts +28 -0
  93. package/dist/hmrouter_extension/model/HMAnnotationModel.js +2 -0
  94. package/dist/hmrouter_extension/model/RouterInfo.d.ts +6 -0
  95. package/dist/hmrouter_extension/model/RouterInfo.js +2 -0
  96. package/dist/hmrouter_extension/model/TemplateModel.d.ts +8 -0
  97. package/dist/hmrouter_extension/model/TemplateModel.js +2 -0
  98. package/dist/hmrouter_extension/model/index.d.ts +3 -0
  99. package/dist/hmrouter_extension/model/index.js +19 -0
  100. package/dist/hmrouter_extension/processor/CodeGenerationProcessor.d.ts +13 -0
  101. package/dist/hmrouter_extension/processor/CodeGenerationProcessor.js +117 -0
  102. package/dist/hmrouter_extension/processor/CompletionProcessor.d.ts +11 -0
  103. package/dist/hmrouter_extension/processor/CompletionProcessor.js +59 -0
  104. package/dist/hmrouter_extension/processor/ConfigUpdateProcessor.d.ts +11 -0
  105. package/dist/hmrouter_extension/processor/ConfigUpdateProcessor.js +53 -0
  106. package/dist/hmrouter_extension/processor/InitializerProcessor.d.ts +15 -0
  107. package/dist/hmrouter_extension/processor/InitializerProcessor.js +95 -0
  108. package/dist/hmrouter_extension/processor/ObfuscationProcessor.d.ts +13 -0
  109. package/dist/hmrouter_extension/processor/ObfuscationProcessor.js +121 -0
  110. package/dist/hmrouter_extension/processor/ResourceProcessor.d.ts +9 -0
  111. package/dist/hmrouter_extension/processor/ResourceProcessor.js +53 -0
  112. package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.d.ts +9 -0
  113. package/dist/hmrouter_extension/processor/RouterMapBuildingProcessor.js +122 -0
  114. package/dist/hmrouter_extension/processor/index.d.ts +7 -0
  115. package/dist/hmrouter_extension/processor/index.js +23 -0
  116. package/examples/CustomExtension.ts +256 -0
  117. package/package.json +2 -2
  118. package/template/customBuilder.ejs +1 -0
  119. package/template/viewBuilder.ejs +1 -0
  120. package/template/viewBuilder_v1.ejs +104 -0
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ // instrument ignore file
17
+ // auto-generated <%= componentName %>Builder.ets by HMRouter
18
+ import <%if(isDefaultExport) {%> <%= componentName %> <% } else {%> { <%= componentName %> } <% } %> from '<%= importPath %>'
19
+ import { TemplateService, TranslateOption, ScaleOption, OpacityOption, HMRouterMgr } from '@hadss/hmrouter'
20
+
21
+ @Builder
22
+ export function <%= componentName %>Builder(name: string, param: Object) {
23
+ <%= componentName %>Generated()
24
+ }
25
+
26
+ export const <%= componentName %>BuilderWrapBuilder = wrapBuilder(<%= componentName %>Builder)
27
+
28
+ @Component
29
+ export struct <%= componentName %>Generated {
30
+ @State translateOption: TranslateOption = new TranslateOption()
31
+ @State scaleOption: ScaleOption = new ScaleOption()
32
+ @State opacityOption: OpacityOption = new OpacityOption()
33
+ private pageUrl: string = ''
34
+ private ndId: string = ''
35
+ private navigationId: string = ''
36
+
37
+ aboutToAppear(): void {
38
+ this.navigationId = this.queryNavigationInfo()!.navigationId;
39
+ const allPathName = HMRouterMgr.getPathStack(this.navigationId)?.getAllPathName();
40
+ this.pageUrl = allPathName ? allPathName[allPathName.length - 1] : '';
41
+ TemplateService.aboutToAppear(this.navigationId, this.pageUrl, <%= dialog %>,
42
+ this.translateOption, this.scaleOption, this.opacityOption)
43
+ }
44
+
45
+ aboutToDisappear(): void {
46
+ TemplateService.aboutToDisappear(this.navigationId, this.pageUrl, this.ndId)
47
+ }
48
+
49
+ build() {
50
+ NavDestination() {
51
+ <%= componentName %>()
52
+ }
53
+ <% if(dialog){ %>.mode(NavDestinationMode.DIALOG)<% } %>
54
+ .hideTitleBar(true)
55
+ .gesture(PanGesture()
56
+ .onActionStart((event: GestureEvent) => {
57
+ TemplateService.interactiveStart(this.navigationId, this.ndId, event)
58
+ })
59
+ .onActionUpdate((event: GestureEvent) =>{
60
+ TemplateService.interactiveProgress(this.navigationId, this.ndId, event)
61
+ })
62
+ .onActionEnd((event: GestureEvent) =>{
63
+ TemplateService.interactiveFinish(this.navigationId, this.ndId, event)
64
+ })
65
+ .onActionCancel(() =>{
66
+ TemplateService.interactiveCancel(this.navigationId, this.ndId)
67
+ })
68
+ )
69
+ .translate(this.translateOption)
70
+ .scale(this.scaleOption)
71
+ .opacity(this.opacityOption.opacity)
72
+ .onAppear(() => {
73
+ TemplateService.onAppear(this.navigationId, this.pageUrl, this.ndId)
74
+ })
75
+ .onDisAppear(() => {
76
+ TemplateService.onDisAppear(this.navigationId, this.pageUrl, this.ndId)
77
+ })
78
+ .onShown(() => {
79
+ TemplateService.onShown(this.navigationId, this.pageUrl, this.ndId)
80
+ })
81
+ .onHidden(() => {
82
+ TemplateService.onHidden(this.navigationId, this.pageUrl, this.ndId)
83
+ })
84
+ .onWillAppear(() => {
85
+ TemplateService.onWillAppear(this.navigationId, this.pageUrl)
86
+ })
87
+ .onWillDisappear(() => {
88
+ TemplateService.onWillDisappear(this.navigationId, this.pageUrl, this.ndId)
89
+ })
90
+ .onWillShow(() => {
91
+ TemplateService.onWillShow(this.navigationId, this.pageUrl, this.ndId)
92
+ })
93
+ .onWillHide(() => {
94
+ TemplateService.onWillHide(this.navigationId, this.pageUrl, this.ndId)
95
+ })
96
+ .onReady((navContext: NavDestinationContext) => {
97
+ this.ndId = navContext.navDestinationId!
98
+ TemplateService.onReady(this.navigationId, this.pageUrl, navContext)
99
+ })
100
+ .onBackPressed(() => {
101
+ return TemplateService.onBackPressed(this.navigationId, this.pageUrl, this.ndId)
102
+ })
103
+ }
104
+ }