@zohodesk/react-cli 0.0.1-beta.16 → 0.0.1-beta.160

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 (226) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +46 -3
  3. package/CHANGELOG.md +5 -0
  4. package/README.md +650 -0
  5. package/bin/cli.js +134 -27
  6. package/cert/cert.pem +37 -129
  7. package/cert/key.pem +27 -27
  8. package/cert/passphrase.pem +1 -0
  9. package/files/eslintrc.js +62 -0
  10. package/files/prettierrc.js +3 -0
  11. package/lib/babel/cmjs-plugins-presets.js +16 -9
  12. package/lib/babel/es-plugins-presets.js +26 -14
  13. package/lib/common/getEntries.js +33 -24
  14. package/lib/common/getPublicPathConfig.js +40 -0
  15. package/lib/common/index.js +27 -13
  16. package/lib/common/splitChunks.js +64 -26
  17. package/lib/common/sslcertUpdater.js +59 -0
  18. package/lib/common/templateParameters.js +25 -0
  19. package/lib/configs/jest.config.js +18 -28
  20. package/lib/configs/webpack.component.umd.config.js +31 -37
  21. package/lib/configs/webpack.css.umd.config.js +44 -44
  22. package/lib/configs/webpack.dev.config.js +113 -57
  23. package/lib/configs/webpack.docs.config.js +104 -98
  24. package/lib/configs/webpack.impact.config.js +116 -0
  25. package/lib/configs/webpack.prod.config.js +154 -86
  26. package/lib/hooks/docsProptypeHook.js +32 -38
  27. package/lib/jest/commitedFilesResult.js +144 -71
  28. package/lib/jest/coverageCollector.js +62 -29
  29. package/lib/jest/jsonMaker.js +54 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  31. package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  33. package/lib/jest/result.js +91 -41
  34. package/lib/jest/run.js +74 -27
  35. package/lib/jest/setup.js +103 -102
  36. package/lib/loaderUtils/getCSSLoaders.js +77 -0
  37. package/lib/loaderUtils/getDevJsLoaders.js +30 -23
  38. package/lib/loaderUtils/index.js +14 -7
  39. package/lib/loaders/docsLoader.js +15 -15
  40. package/lib/loaders/docsPropsLoader.js +14 -17
  41. package/lib/loaders/fileBountryLoader.js +17 -0
  42. package/lib/loaders/fileLoader.js +47 -38
  43. package/lib/loaders/scriptInstrumentLoader.js +21 -20
  44. package/lib/loaders/selectorMappingLoader.js +75 -0
  45. package/lib/loaders/workerLoader.js +136 -0
  46. package/lib/middlewares/HMRMiddleware.js +59 -41
  47. package/lib/middlewares/SSTMiddleware.js +21 -0
  48. package/lib/pluginUtils/getDevPlugins.js +173 -26
  49. package/lib/pluginUtils/getDocsPlugins.js +32 -17
  50. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  51. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  52. package/lib/pluginUtils/getProdPlugins.js +238 -37
  53. package/lib/pluginUtils/getServerPlugins.js +8 -11
  54. package/lib/pluginUtils/getUMDCSSPlugins.js +11 -15
  55. package/lib/pluginUtils/getUMDComponentPlugins.js +11 -15
  56. package/lib/pluginUtils/index.js +36 -43
  57. package/lib/plugins/CdnChangePlugin.js +77 -0
  58. package/lib/plugins/CleanupStatsPlugin.js +28 -0
  59. package/lib/plugins/EFCPlugin.js +211 -0
  60. package/lib/plugins/EFCPlugin.md +6 -0
  61. package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
  62. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  63. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  64. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  65. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  66. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  67. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +86 -0
  68. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  69. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  70. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  71. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  72. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  73. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  74. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  75. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  76. package/lib/plugins/ManifestPlugin.js +52 -63
  77. package/lib/plugins/ModuleStatsPlugin.js +98 -97
  78. package/lib/plugins/OptimizeJSPlugin.js +24 -41
  79. package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
  80. package/lib/plugins/PublicPathChangePlugin.js +187 -174
  81. package/lib/plugins/ReportGeneratePlugin.js +181 -0
  82. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  83. package/lib/plugins/ResourceHintsPlugin.js +53 -35
  84. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
  85. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
  86. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  87. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
  88. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  89. package/lib/plugins/ServiceWorkerPlugin.js +107 -0
  90. package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
  91. package/lib/plugins/SourceMapHookPlugin.js +25 -31
  92. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  93. package/lib/plugins/UglifyCSSPlugin.js +23 -30
  94. package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
  95. package/lib/plugins/index.js +118 -55
  96. package/lib/plugins/libraryImpactPlugin.js +190 -0
  97. package/lib/plugins/webpackwatchrunplugin.js +26 -0
  98. package/lib/postcss-plugins/ExcludeRTLPlugin.js +23 -0
  99. package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
  100. package/lib/schemas/index.js +463 -52
  101. package/lib/servers/clusterHubServer.js +22 -26
  102. package/lib/servers/docsServer.js +3 -5
  103. package/lib/servers/docsServerCore.js +93 -85
  104. package/lib/servers/helpServer.js +19 -21
  105. package/lib/servers/httpsOptions.js +19 -0
  106. package/lib/servers/impactServer.js +99 -92
  107. package/lib/servers/mockserver.js +44 -0
  108. package/lib/servers/nowatchserver.js +275 -0
  109. package/lib/servers/scrServer.js +147 -0
  110. package/lib/servers/server.js +118 -124
  111. package/lib/servers/ssServer.js +107 -65
  112. package/lib/sh/reportPublish.sh +16 -10
  113. package/lib/templates/CoverageScriptTemplate.js +45 -18
  114. package/lib/templates/WMSTemplate.js +17 -18
  115. package/lib/templates/linterConstant.js +10 -0
  116. package/lib/utils/babelPresets.js +12 -5
  117. package/lib/utils/buildstats.html +148 -0
  118. package/lib/utils/clean.js +12 -11
  119. package/lib/utils/copy.js +13 -127
  120. package/lib/utils/copyTimezones.js +21 -0
  121. package/lib/utils/createEventStream.js +24 -19
  122. package/lib/utils/cssClassNameGenerate.js +70 -0
  123. package/lib/utils/cssURLReplacer.js +67 -54
  124. package/lib/utils/dependencyPostPublish.js +42 -0
  125. package/lib/utils/fileUtils.js +125 -0
  126. package/lib/utils/folderIterator.js +47 -0
  127. package/lib/utils/getComponents.js +126 -0
  128. package/lib/utils/getCurrentBranch.js +11 -17
  129. package/lib/utils/getDependenciesImpactList.js +151 -0
  130. package/lib/utils/getHash.js +26 -0
  131. package/lib/utils/getIp.js +20 -0
  132. package/lib/utils/getOptions.js +55 -30
  133. package/lib/utils/getServerURL.js +25 -8
  134. package/lib/utils/index.js +259 -82
  135. package/lib/utils/init.js +2 -2
  136. package/lib/utils/initPreCommitHook.js +40 -31
  137. package/lib/utils/jsonHelper.js +97 -0
  138. package/lib/utils/libraryImpactConfig.js +63 -0
  139. package/lib/utils/lint/addScripts.js +27 -0
  140. package/lib/utils/lint/checkExistingConfig.js +67 -0
  141. package/lib/utils/lint/copyConfigs.js +24 -0
  142. package/lib/utils/lint/index.js +54 -0
  143. package/lib/utils/lint/lintScripts.js +11 -0
  144. package/lib/utils/lint/lintSetup.js +31 -0
  145. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  146. package/lib/utils/lint/question.js +30 -0
  147. package/lib/utils/lintReporter.js +142 -0
  148. package/lib/utils/mailSender.js +16 -25
  149. package/lib/utils/pullOrigin.js +28 -0
  150. package/lib/utils/reinstallDependencies.js +133 -0
  151. package/lib/utils/removeAttributes.js +25 -23
  152. package/lib/utils/repoClone.js +56 -63
  153. package/lib/utils/request.js +64 -77
  154. package/lib/utils/resultSchema.json +73 -0
  155. package/lib/utils/rtl.js +42 -0
  156. package/lib/utils/setEnvVariables.js +5 -6
  157. package/lib/utils/ssTestHack.js +48 -0
  158. package/lib/utils/switchBranch.js +28 -0
  159. package/lib/utils/urlConcat.js +22 -0
  160. package/package.json +92 -64
  161. package/templates/app/.eslintrc.js +140 -0
  162. package/templates/app/README.md +12 -12
  163. package/templates/app/app/index.html +24 -8
  164. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  165. package/templates/app/app/properties/i18nkeys.json +3 -3
  166. package/templates/app/docs/all.html +69 -69
  167. package/templates/app/mockapi/index.js +18 -13
  168. package/templates/app/package.json +37 -17
  169. package/templates/app/src/actions/SampleActions/index.js +37 -0
  170. package/templates/app/src/actions/index.js +65 -0
  171. package/templates/app/src/appUrls.js +19 -0
  172. package/templates/app/src/components/Alert/Alert.js +134 -0
  173. package/templates/app/src/components/Alert/Alert.module.css +79 -0
  174. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
  175. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
  176. package/templates/app/src/components/Sample/Sample.module.css +11 -0
  177. package/templates/app/src/components/Sample/SampleList.js +61 -0
  178. package/templates/app/src/components/Slider/Slider.css +41 -0
  179. package/templates/app/src/components/Slider/Slider.js +55 -0
  180. package/templates/app/src/containers/AlertContainer/index.js +15 -0
  181. package/templates/app/src/containers/AppContainer/index.js +96 -0
  182. package/templates/app/src/containers/AppContainer/index.module.css +27 -0
  183. package/templates/app/src/containers/CustomMatch/index.js +65 -0
  184. package/templates/app/src/containers/DevTools/index.js +10 -0
  185. package/templates/app/src/containers/Header/index.js +67 -0
  186. package/templates/app/src/containers/Header/index.module.css +43 -0
  187. package/templates/app/src/containers/Redirect/index.js +63 -0
  188. package/templates/app/src/containers/Redirector/index.js +47 -0
  189. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
  190. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
  191. package/templates/app/src/historyChange.js +5 -0
  192. package/templates/app/src/index.html +10 -0
  193. package/templates/app/src/index.js +24 -0
  194. package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
  195. package/templates/app/src/reducers/alertData.js +11 -0
  196. package/templates/app/src/reducers/index.js +6 -0
  197. package/templates/app/src/reducers/samples.js +19 -0
  198. package/templates/app/src/store/configureStore.dev.js +51 -0
  199. package/templates/app/src/store/configureStore.js +5 -0
  200. package/templates/app/src/store/configureStore.prod.js +26 -0
  201. package/templates/app/src/util/Common.js +5 -0
  202. package/templates/app/src/util/RequestAPI.js +132 -0
  203. package/templates/appold/README.md +12 -0
  204. package/templates/appold/app/index.html +8 -0
  205. package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
  206. package/templates/appold/app/properties/i18nkeys.json +3 -0
  207. package/templates/appold/docs/all.html +69 -0
  208. package/templates/appold/mockapi/index.js +13 -0
  209. package/templates/{app → appold}/mockapi/tickets.json +0 -0
  210. package/templates/appold/package.json +17 -0
  211. package/templates/appold/src/components/Text/Text.css +0 -0
  212. package/templates/appold/src/components/Text/Text.js +23 -0
  213. package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
  214. package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
  215. package/templates/appold/src/components/docs.js +1 -0
  216. package/templates/appold/src/components/index.js +5 -0
  217. package/templates/appold/src/index.js +13 -0
  218. package/templates/docs/all.html +1 -1
  219. package/templates/docs/component.html +110 -69
  220. package/templates/docs/components.html +221 -0
  221. package/templates/docs/css/component.css +12 -14
  222. package/templates/docs/css/componentTest.css +7 -0
  223. package/templates/docs/css/style.css +150 -206
  224. package/templates/docs/impactReportTemplate.html +154 -0
  225. package/templates/docs/index.html +1482 -1336
  226. package/templates/library/src/index.js +0 -0
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html class="isRem">
2
+ <html class="isRem" dir="ltr">
3
3
  <head>
4
4
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -17,20 +17,29 @@
17
17
  var ReactDOM = Component.ReactDOM;
18
18
  var React = Component.React;
19
19
  var ReactDOMServer = Component.ReactDOMServer;
20
+
20
21
  class RenderComponent extends React.Component {
21
22
  constructor(props) {
22
23
  super(props);
23
24
  this.state = {
24
25
  Components: Component,
25
- selectedComponent:
26
- location.hash != '' ? location.hash.substring(1) : null
26
+ isError:false,
27
+ selectedComponent:location.hash != '' ? location.hash.substring(1) : null,
28
+ componentList:window.componentList?window.componentList:Component
27
29
  };
28
30
  this.hashChange = this.hashChange.bind(this);
29
31
  }
30
32
  hashChange() {
33
+ let parentFrameNode = parent.document.getElementById('loadingText');
31
34
  this.setState({
32
35
  selectedComponent:
33
36
  location.hash != '' ? location.hash.substring(1) : null
37
+ },()=>{
38
+ if(this.error) {
39
+ location.reload();
40
+ parentFrameNode? parentFrameNode.style.display = 'block':parentFrameNode.style.display='none';
41
+ this.error = false;
42
+ }
34
43
  });
35
44
  }
36
45
 
@@ -43,85 +52,117 @@
43
52
  componentWillUnmount() {
44
53
  window.removeEventListener('hashchange', this.hashChange);
45
54
  }
55
+
56
+ componentDidCatch(){
57
+ this.error = true;
58
+ this.setState({isError:this.error})
59
+ }
46
60
  render() {
47
- const { Components, selectedComponent } = this.state;
61
+ const { Components, selectedComponent,componentList} = this.state;
62
+ // var CLG=[]
63
+ // var complistGroup=Object.keys(componentList).map((item,i)=>{
64
+ // if(Array.isArray(componentList[item].docs.testProps)){
65
+ // CLG.push(item)
66
+ // }
67
+ // })
48
68
 
69
+ let msg=componentList[selectedComponent]?'Sorry! for the inconvenience.':'Sorry! Request URL not found.'
49
70
  var ComponentClass =
50
- selectedComponent && Components[selectedComponent];
71
+ selectedComponent && componentList[selectedComponent];
51
72
  var keysSingleAr =
52
73
  (ComponentClass &&
53
74
  ComponentClass.docs &&
54
75
  ComponentClass.docs.testProps &&
55
- Object.keys(ComponentClass.docs.testProps)) ||
56
- [];
57
- return (
58
- <div className="root" id="root">
59
- {Components[selectedComponent] ? (
60
- Array.isArray(ComponentClass.docs.testProps) ? (
61
- ComponentClass.docs.testProps.map((prop, i) => {
62
- return (
63
- <div className="comps">
64
- <ComponentClass {...prop} />
65
- </div>
66
- );
67
- })
68
- ) : (
69
- <ComponentClass {...ComponentClass.docs.testProps} />
70
- )
71
- ) : (
72
- <div className={'emptyState'}>
73
- <svg
74
- x="0px"
75
- y="0px"
76
- viewBox="0 0 512 512"
77
- style={{ enableBackground: 'new 0 0 512 512' }}
78
- xmlSpace="preserve"
79
- className={'smileIcon'}
80
- >
81
- <linearGradient
82
- id="SVGID_1_"
83
- gradientUnits="userSpaceOnUse"
84
- x1="256"
85
- y1="514"
86
- x2="256"
87
- y2="2"
88
- gradientTransform="matrix(1 0 0 -1 0 514)"
89
- >
90
- <stop offset="0" style={{ stopColor: '#2AF598' }} />
91
- <stop offset="1" style={{ stopColor: '#009EFD' }} />
92
- </linearGradient>
93
- <path
94
- style={{ fill: 'url(#SVGID_1_)' }}
95
- d="M344.354,381.58c-1.33-1.651-33.207-40.458-88.354-40.458
96
- c-55.832,0-87.972,39.974-88.29,40.378l-31.42-24.756c1.79-2.271,44.687-55.622,119.71-55.622s117.92,53.352,119.71,55.622
97
- L344.29,381.5L344.354,381.58z M437.02,437.02C485.371,388.668,512,324.38,512,256s-26.629-132.667-74.98-181.02
98
- C388.667,26.629,324.38,0,256,0S123.333,26.629,74.98,74.98C26.629,123.333,0,187.62,0,256s26.629,132.668,74.98,181.02
99
- C123.333,485.371,187.62,512,256,512S388.667,485.371,437.02,437.02z M472,256c0,119.103-96.897,216-216,216S40,375.103,40,256
100
- S136.897,40,256,40S472,136.897,472,256z M168,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
101
- S150.327,212.122,168,212.122z M344,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
102
- S326.327,212.122,344,212.122z"
103
- />
104
- </svg>
105
- <div>Please click the components on left side menu bar</div>
106
- </div>
107
- )}
76
+ Object.keys(ComponentClass.docs.testProps)) || [];
77
+ var ErrorMessage=(
78
+ <div className={'emptyState'}>
79
+ <svg
80
+ x='0px'
81
+ y='0px'
82
+ viewBox='0 0 512 512'
83
+ style={{ enableBackground: 'new 0 0 512 512' }}
84
+ xmlSpace='preserve'
85
+ className={'smileIcon'}
86
+ >
87
+ <path
88
+ style={{ fill: '#f00' }}
89
+ d='M344.354,381.58c-1.33-1.651-33.207-40.458-88.354-40.458
90
+ c-55.832,0-87.972,39.974-88.29,40.378l-31.42-24.756c1.79-2.271,44.687-55.622,119.71-55.622s117.92,53.352,119.71,55.622
91
+ L344.29,381.5L344.354,381.58z M437.02,437.02C485.371,388.668,512,324.38,512,256s-26.629-132.667-74.98-181.02
92
+ C388.667,26.629,324.38,0,256,0S123.333,26.629,74.98,74.98C26.629,123.333,0,187.62,0,256s26.629,132.668,74.98,181.02
93
+ C123.333,485.371,187.62,512,256,512S388.667,485.371,437.02,437.02z M472,256c0,119.103-96.897,216-216,216S40,375.103,40,256
94
+ S136.897,40,256,40S472,136.897,472,256z M168,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
95
+ S150.327,212.122,168,212.122z M344,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
96
+ S326.327,212.122,344,212.122z'
97
+ />
98
+ </svg>
99
+ <div>{msg}</div>
108
100
  </div>
101
+ )
102
+ let renderElement = (
103
+ <React.Fragment>
104
+ {
105
+ this.state.isError || componentList[selectedComponent] ? (
106
+ <ComponentClass {...ComponentClass.docs.testProps} />
107
+ ) : ( ErrorMessage )
108
+ }
109
+ </React.Fragment>
109
110
  );
111
+
112
+ return <div className='root'>{componentList._provider ? (
113
+ <componentList._provider>
114
+ {this.state.isError?ErrorMessage:renderElement}
115
+ </componentList._provider>
116
+ ) : (
117
+ this.state.isError?ErrorMessage:renderElement
118
+ )}</div>;
110
119
  }
111
120
  }
112
- try {
113
- ReactDOM.render(<RenderComponent />, react, () => {
114
- let attr = document.createAttribute('id');
115
- attr.value = 'check';
116
- let node = document.createElement('DIV');
117
- node.setAttributeNode(attr);
118
- document.getElementById('root').appendChild(node);
119
- });
120
- } catch (e) {
121
- console.log(e);
121
+ var compList;
122
+ var componentList= {};
123
+ var compGroupObj=function(comp,key,compGroup){
124
+ if (comp == 'React' || comp == 'ReactDOM' || comp =='renderToStaticMarkup') {
125
+ return;
126
+ }
127
+ if(comp=='default'){
128
+ componentList[key]=compGroup[comp]
129
+ return componentList
130
+ }
131
+ else{
132
+ componentList[comp]=compGroup[comp]
133
+ return componentList
134
+ }
122
135
  }
123
- </script>
136
+ Promise.all(Object.keys(Component).map((key) => {
124
137
 
138
+ let componentKey=Component[key];
139
+ if (key == 'React' || key == 'ReactDOM' || key=='renderToStaticMarkup') {
140
+ return;
141
+ }
142
+ if(key == '_provider'){
143
+ return compGroupObj(key,null,Component)
144
+ }
145
+ try{
146
+ return(
147
+ componentKey && componentKey.then((res)=>{
148
+ Object.keys(res).forEach((comp)=>{
149
+ let compGroup=res[comp];
150
+ Object.keys(compGroup).forEach((comps)=>{
151
+ compList=compGroupObj(comps,key,compGroup)
152
+ return compList
153
+ })
154
+ })
155
+ })
156
+ )
157
+ }
158
+ catch(error){
159
+ return Component
160
+ }
161
+ })).then(()=>{
162
+ Object.keys(componentList).length>1?window.componentList=componentList:window.componentList=Component
163
+ ReactDOM.render(<RenderComponent />, react);
164
+ })
165
+ </script>
125
166
  <script type="text/javascript">
126
167
  var err = null;
127
168
  var comName = '';
@@ -0,0 +1,221 @@
1
+ <!DOCTYPE html>
2
+ <html class="isRem" dir="ltr">
3
+ <head>
4
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="stylesheet" href="./css/component.css" />
7
+ <link rel="stylesheet" href="./css/componentTest.css" />
8
+ <link rel="stylesheet" href="/docs/css/main.css" />
9
+ </head>
10
+ <body>
11
+ <div id="react" class="ssTest appContainer"></div>
12
+ <div id="reactUserEdit"></div>
13
+ <script src="/docs/js/vendor.js" defer="true"></script>
14
+ <script src="/docs/js/main.js" defer="true"></script>
15
+ <script src="/docs/js/babel.min.js"></script>
16
+ <script type="text/babel">
17
+ var test = 'test';
18
+ var ReactDOM = Component.ReactDOM;
19
+ var React = Component.React;
20
+ var ReactDOMServer = Component.ReactDOMServer;
21
+ class RenderComponent extends React.Component {
22
+ constructor(props) {
23
+ super(props);
24
+ this.state = {
25
+ Components: Component,
26
+ isError: false,
27
+ selectedComponent:
28
+ location.hash != '' ? location.hash.substring(1) : null,
29
+ componentList: window.componentList
30
+ ? window.componentList
31
+ : Component,
32
+ };
33
+ this.hashChange = this.hashChange.bind(this);
34
+ }
35
+ hashChange() {
36
+ let parentFrameNode = parent.document.getElementById('loadingText');
37
+ this.setState(
38
+ {
39
+ selectedComponent:
40
+ location.hash != '' ? location.hash.substring(1) : null,
41
+ },
42
+ () => {
43
+ if (this.error) {
44
+ location.reload();
45
+ parentFrameNode
46
+ ? (parentFrameNode.style.display = 'block')
47
+ : (parentFrameNode.style.display = 'none');
48
+ this.error = false;
49
+ }
50
+ }
51
+ );
52
+ }
53
+
54
+ componentDidMount() {
55
+ window.addEventListener('hashchange', this.hashChange);
56
+ let parentFrameNode = parent.document.getElementById('loadingText');
57
+ if (parentFrameNode) parentFrameNode.style.display = 'none';
58
+ }
59
+
60
+ componentWillUnmount() {
61
+ window.removeEventListener('hashchange', this.hashChange);
62
+ }
63
+
64
+ componentDidCatch() {
65
+ this.error = true;
66
+ this.setState({ isError: this.error });
67
+ }
68
+ render() {
69
+ const { Components, selectedComponent, componentList } = this.state;
70
+ // var CLG=[]
71
+ // var complistGroup=Object.keys(componentList).map((item,i)=>{
72
+ // if(Array.isArray(componentList[item].docs.testProps)){
73
+ // CLG.push(item)
74
+ // }
75
+ // })
76
+ let msg = componentList[selectedComponent]
77
+ ? 'Sorry! for the inconvenience.'
78
+ : 'Sorry! Request URL not found.';
79
+ var ComponentClass =
80
+ selectedComponent && componentList[selectedComponent];
81
+ var keysSingleAr =
82
+ (ComponentClass &&
83
+ ComponentClass.docs &&
84
+ ComponentClass.docs.testProps &&
85
+ Object.keys(ComponentClass.docs.testProps)) ||
86
+ [];
87
+ var ErrorMessage = (
88
+ <div className={'emptyState'}>
89
+ <svg
90
+ x='0px'
91
+ y='0px'
92
+ viewBox='0 0 512 512'
93
+ style={{ enableBackground: 'new 0 0 512 512' }}
94
+ xmlSpace='preserve'
95
+ className={'smileIcon'}
96
+ >
97
+ <path
98
+ style={{ fill: '#f00' }}
99
+ d='M344.354,381.58c-1.33-1.651-33.207-40.458-88.354-40.458
100
+ c-55.832,0-87.972,39.974-88.29,40.378l-31.42-24.756c1.79-2.271,44.687-55.622,119.71-55.622s117.92,53.352,119.71,55.622
101
+ L344.29,381.5L344.354,381.58z M437.02,437.02C485.371,388.668,512,324.38,512,256s-26.629-132.667-74.98-181.02
102
+ C388.667,26.629,324.38,0,256,0S123.333,26.629,74.98,74.98C26.629,123.333,0,187.62,0,256s26.629,132.668,74.98,181.02
103
+ C123.333,485.371,187.62,512,256,512S388.667,485.371,437.02,437.02z M472,256c0,119.103-96.897,216-216,216S40,375.103,40,256
104
+ S136.897,40,256,40S472,136.897,472,256z M168,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
105
+ S150.327,212.122,168,212.122z M344,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
106
+ S326.327,212.122,344,212.122z'
107
+ />
108
+ </svg>
109
+ <div>{msg}</div>
110
+ </div>
111
+ );
112
+ let renderElement = (
113
+ <div className='root' id='root'>
114
+ {this.state.isError || componentList[selectedComponent] ? (
115
+ <ComponentClass {...ComponentClass.docs.testProps} />
116
+ ) : (
117
+ ErrorMessage
118
+ )}
119
+ </div>
120
+ );
121
+
122
+ return componentList._provider ? (
123
+ <componentList._provider>
124
+ {this.state.isError ? ErrorMessage : renderElement}
125
+ </componentList._provider>
126
+ ) : this.state.isError ? (
127
+ ErrorMessage
128
+ ) : (
129
+ renderElement
130
+ );
131
+ }
132
+ }
133
+ var compList;
134
+ var componentList = {};
135
+ var compGroupObj = function (comp, key, compGroup) {
136
+ if (
137
+ comp == 'React' ||
138
+ comp == 'ReactDOM' ||
139
+ comp == 'renderToStaticMarkup'
140
+ ) {
141
+ return;
142
+ }
143
+ if (comp == 'default') {
144
+ componentList[key] = compGroup[comp];
145
+ return componentList;
146
+ } else {
147
+ componentList[comp] = compGroup[comp];
148
+ return componentList;
149
+ }
150
+ };
151
+ Promise.all(
152
+ Object.keys(Component).map((key) => {
153
+ let componentKey = Component[key];
154
+ if (
155
+ key == 'React' ||
156
+ key == 'ReactDOM' ||
157
+ key == 'renderToStaticMarkup'
158
+ ) {
159
+ return;
160
+ }
161
+ try {
162
+ return (
163
+ componentKey &&
164
+ componentKey.then((res) => {
165
+ Object.keys(res).forEach((comp) => {
166
+ let compGroup = res[comp];
167
+ Object.keys(compGroup).forEach((comps) => {
168
+ compList = compGroupObj(comps, key, compGroup);
169
+ return compList;
170
+ });
171
+ });
172
+ })
173
+ );
174
+ } catch (error) {
175
+ return Component;
176
+ }
177
+ })
178
+ ).then(() => {
179
+ Object.keys(componentList).length > 1
180
+ ? (window.componentList = componentList)
181
+ : (window.componentList = Component);
182
+ ReactDOM.render(<RenderComponent />, react, () => {
183
+ let attr = document.createAttribute('id');
184
+ attr.value = 'check';
185
+ let node = document.createElement('DIV');
186
+ node.setAttributeNode(attr);
187
+ document.getElementById('root').appendChild(node);
188
+ });
189
+ });
190
+ </script>
191
+
192
+ <script type="text/javascript">
193
+ var err = null;
194
+ var comName = '';
195
+ var findErr = (window.onerror = function (e, line) {
196
+ err = e;
197
+ comName = window.location.hash.substr(1);
198
+ });
199
+ var funct = function () {
200
+ return { error: err, name: comName };
201
+ };
202
+
203
+ let hideCursorBlink = function (documentElement) {
204
+ var style = documentElement.createElement('style');
205
+ style.innerText =
206
+ '[contenteditable], input,textarea {color: transparent ! important; text-shadow: 0 0 0 black ! important;}';
207
+ documentElement.head.append(style);
208
+ };
209
+
210
+ let hideAllCursorBlink = function (documentElement) {
211
+ hideCursorBlink(documentElement);
212
+ var frameElements = documentElement.getElementsByTagName('iframe');
213
+ for (i = 0; i < frameElements.length; i++) {
214
+ if (frameElements[i].contentDocument) {
215
+ hideAllCursorBlink(frameElements[i].contentDocument);
216
+ }
217
+ }
218
+ };
219
+ </script>
220
+ </body>
221
+ </html>
@@ -1,9 +1,3 @@
1
- .ssTest *, .ssTest *:before, .ssTest *:after {
2
- transition: all 0s !important;
3
- transition-delay: 0s !important;
4
- animation-delay: 0s !important;
5
- animation-duration: 0s !important;
6
- }
7
1
  .comps {
8
2
  padding: 10px;
9
3
  max-width: 100%;
@@ -14,19 +8,20 @@
14
8
  height: 100vh;
15
9
  width: 100vw;
16
10
  display: flex;
17
- flex-direction: row;
18
11
  }
19
12
  .root {
20
- flex-grow: 1;
21
- min-height: 0;
22
- min-width: 0;
13
+ flex-grow: 1;
14
+ min-height: 0;
15
+ min-width: 0;
23
16
  overflow-y: auto;
24
17
  }
25
18
  .emptyState{
26
19
  display: flex;
27
20
  flex-direction: column;
28
- align-items: center;justify-content: center;
21
+ align-items: center;
22
+ justify-content: center;
29
23
  height:100%;
24
+ width: 100%;
30
25
  }
31
26
  .smileIcon{
32
27
  width: 60px;
@@ -34,11 +29,14 @@
34
29
  }
35
30
  body {
36
31
  overflow: hidden;
32
+ margin: 0;
33
+ }
34
+ html.isRem{
35
+ font-size: 16px
37
36
  }
38
-
39
- html.isRem{font-size: 16px}
40
37
  @media only screen and (min-width: 100em) {
41
38
  html.isRem {
42
- font-size: calc(100vw / 110);
39
+ font-size: calc(0.875em + 0.25 * (100vw - 28.75em) / 91.25);
40
+ font-size: -webkit-calc(87.5% + 0.25 * (100vw - 28.75em) / 91.25);
43
41
  }
44
42
  }
@@ -0,0 +1,7 @@
1
+ *, *:before,*:after {
2
+ transition: all 0s !important;
3
+ transition-delay: 0s !important;
4
+ animation-delay: 0s !important;
5
+ animation-duration: 0s !important;
6
+ opacity: 1 !important;
7
+ }