w-threejs-vue 1.0.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 (151) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +55 -0
  4. package/.jsdoc +25 -0
  5. package/LICENSE +21 -0
  6. package/README.md +39 -0
  7. package/SECURITY.md +5 -0
  8. package/babel.config.js +15 -0
  9. package/dist/w-threejs-vue.umd.js +26 -0
  10. package/dist/w-threejs-vue.umd.js.map +1 -0
  11. package/docs/examples/app.html +66 -0
  12. package/docs/examples/app.umd.js +31 -0
  13. package/docs/examples/app.umd.js.map +1 -0
  14. package/docs/examples/ex-AppBasicAutoRotateDeg.html +190 -0
  15. package/docs/examples/ex-AppBasicBackgroundColor.html +189 -0
  16. package/docs/examples/ex-AppBasicSize.html +170 -0
  17. package/docs/examples/ex-AppBasicUploadStl.html +237 -0
  18. package/docs/examples/ex-AppBasicUseAutoRotate.html +189 -0
  19. package/docs/examples/ex-AppCmCameraFar.html +191 -0
  20. package/docs/examples/ex-AppCmCameraFov.html +191 -0
  21. package/docs/examples/ex-AppCmCameraNear.html +191 -0
  22. package/docs/examples/ex-AppCmCameraOrthographicRatio.html +191 -0
  23. package/docs/examples/ex-AppCmCameraType.html +190 -0
  24. package/docs/examples/ex-AppCmGetCameraViewAngle.html +218 -0
  25. package/docs/examples/ex-AppCmSetCameraAzimuthAngle.html +190 -0
  26. package/docs/examples/ex-AppCmSetCameraPolarAngle.html +190 -0
  27. package/docs/examples/ex-AppCmSetCameraViewAngle.html +194 -0
  28. package/docs/examples/ex-AppHpHelperAxesLengthRatio.html +189 -0
  29. package/docs/examples/ex-AppHpHelperGridDensity.html +189 -0
  30. package/docs/examples/ex-AppHpHelperGridLengthRatio.html +189 -0
  31. package/docs/examples/ex-AppHpHelperGridPositionRatioZ.html +189 -0
  32. package/docs/examples/ex-AppHpUseHelperAxes.html +189 -0
  33. package/docs/examples/ex-AppHpUseHelperGrid.html +189 -0
  34. package/docs/examples/ex-AppLgLegnedBackgroundColor.html +189 -0
  35. package/docs/examples/ex-AppLgLegnedHeight.html +189 -0
  36. package/docs/examples/ex-AppLgLegnedHeightMax.html +189 -0
  37. package/docs/examples/ex-AppLtLightAmbientColor.html +189 -0
  38. package/docs/examples/ex-AppLtLightDirectionColor.html +191 -0
  39. package/docs/examples/ex-AppLtLightDirectionIntensity.html +191 -0
  40. package/docs/examples/ex-AppLtLightDirectionPos.html +191 -0
  41. package/docs/examples/ex-AppLtLightPointColor.html +192 -0
  42. package/docs/examples/ex-AppLtLightPointDecay.html +192 -0
  43. package/docs/examples/ex-AppLtLightPointDistance.html +192 -0
  44. package/docs/examples/ex-AppLtLightPointIntensity.html +192 -0
  45. package/docs/examples/ex-AppLtLightPointPoss.html +192 -0
  46. package/docs/examples/ex-AppLtUseLightAmbient.html +191 -0
  47. package/docs/examples/ex-AppLtUseLightDirection.html +191 -0
  48. package/docs/examples/ex-AppLtUseLightPoint.html +191 -0
  49. package/docs/examples/ex-AppMhGetMeshsInfor.html +198 -0
  50. package/docs/examples/ex-AppMhSetMeshColor.html +190 -0
  51. package/docs/examples/ex-AppMhSetMeshLabelText.html +190 -0
  52. package/docs/examples/ex-AppMhSetMeshLabelTextColor.html +190 -0
  53. package/docs/examples/ex-AppMhSetMeshLabelTextFontFamily.html +190 -0
  54. package/docs/examples/ex-AppMhSetMeshLabelTextFontSize.html +190 -0
  55. package/docs/examples/ex-AppMhSetMeshLabelVisible.html +198 -0
  56. package/docs/examples/ex-AppMhSetMeshVisible.html +198 -0
  57. package/docs/examples/ex-AppMuMenuIcons.html +217 -0
  58. package/docs/examples/ex-AppMuMenuTooltips.html +218 -0
  59. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  60. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  61. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  62. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  63. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  64. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  65. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  66. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  67. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  68. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  69. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  70. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  71. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  72. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  73. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  74. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  75. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  76. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  77. package/docs/index.html +84 -0
  78. package/docs/module-WThreejsVue.html +216 -0
  79. package/docs/scripts/collapse.js +39 -0
  80. package/docs/scripts/commonNav.js +28 -0
  81. package/docs/scripts/linenumber.js +25 -0
  82. package/docs/scripts/nav.js +12 -0
  83. package/docs/scripts/polyfill.js +4 -0
  84. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  85. package/docs/scripts/prettify/lang-css.js +2 -0
  86. package/docs/scripts/prettify/prettify.js +28 -0
  87. package/docs/scripts/search.js +99 -0
  88. package/docs/styles/jsdoc.css +776 -0
  89. package/docs/styles/prettify.css +80 -0
  90. package/package.json +74 -0
  91. package/public/index.html +42 -0
  92. package/src/App.vue +574 -0
  93. package/src/AppBasicAutoRotateDeg.vue +102 -0
  94. package/src/AppBasicBackgroundColor.vue +101 -0
  95. package/src/AppBasicSize.vue +90 -0
  96. package/src/AppBasicUploadStl.vue +159 -0
  97. package/src/AppBasicUseAutoRotate.vue +101 -0
  98. package/src/AppCmCameraFar.vue +103 -0
  99. package/src/AppCmCameraFov.vue +103 -0
  100. package/src/AppCmCameraNear.vue +103 -0
  101. package/src/AppCmCameraOrthographicRatio.vue +103 -0
  102. package/src/AppCmCameraType.vue +102 -0
  103. package/src/AppCmGetCameraViewAngle.vue +135 -0
  104. package/src/AppCmSetCameraAzimuthAngle.vue +104 -0
  105. package/src/AppCmSetCameraPolarAngle.vue +104 -0
  106. package/src/AppCmSetCameraViewAngle.vue +105 -0
  107. package/src/AppHpHelperAxesLengthRatio.vue +101 -0
  108. package/src/AppHpHelperGridDensity.vue +101 -0
  109. package/src/AppHpHelperGridLengthRatio.vue +101 -0
  110. package/src/AppHpHelperGridPositionRatioZ.vue +101 -0
  111. package/src/AppHpUseHelperAxes.vue +101 -0
  112. package/src/AppHpUseHelperGrid.vue +101 -0
  113. package/src/AppLgLegnedBackgroundColor.vue +101 -0
  114. package/src/AppLgLegnedHeight.vue +101 -0
  115. package/src/AppLgLegnedHeightMax.vue +101 -0
  116. package/src/AppLtLightAmbientColor.vue +101 -0
  117. package/src/AppLtLightDirectionColor.vue +103 -0
  118. package/src/AppLtLightDirectionIntensity.vue +103 -0
  119. package/src/AppLtLightDirectionPos.vue +103 -0
  120. package/src/AppLtLightPointColor.vue +104 -0
  121. package/src/AppLtLightPointDecay.vue +104 -0
  122. package/src/AppLtLightPointDistance.vue +104 -0
  123. package/src/AppLtLightPointIntensity.vue +104 -0
  124. package/src/AppLtLightPointPoss.vue +104 -0
  125. package/src/AppLtUseLightAmbient.vue +103 -0
  126. package/src/AppLtUseLightDirection.vue +103 -0
  127. package/src/AppLtUseLightPoint.vue +103 -0
  128. package/src/AppMhGetMeshsInfor.vue +112 -0
  129. package/src/AppMhSetMeshColor.vue +104 -0
  130. package/src/AppMhSetMeshLabelText.vue +104 -0
  131. package/src/AppMhSetMeshLabelTextColor.vue +104 -0
  132. package/src/AppMhSetMeshLabelTextFontFamily.vue +104 -0
  133. package/src/AppMhSetMeshLabelTextFontSize.vue +104 -0
  134. package/src/AppMhSetMeshLabelVisible.vue +106 -0
  135. package/src/AppMhSetMeshVisible.vue +106 -0
  136. package/src/AppMuMenuIcons.vue +130 -0
  137. package/src/AppMuMenuTooltips.vue +131 -0
  138. package/src/components/WThreejsVue.vue +955 -0
  139. package/src/js/addStl.mjs +83 -0
  140. package/src/js/getCsrdFromMeshs.mjs +85 -0
  141. package/src/js/plot3d.mjs +1407 -0
  142. package/src/main.js +8 -0
  143. package/test/all.test.mjs +10 -0
  144. package/toolg/addVersion.mjs +4 -0
  145. package/toolg/cleanFolder.mjs +4 -0
  146. package/toolg/gDistApp.mjs +38 -0
  147. package/toolg/gDistRollupComps.mjs +22 -0
  148. package/toolg/gDocExams.mjs +47 -0
  149. package/toolg/gExtractHtml.mjs +159 -0
  150. package/toolg/modifyReadme.mjs +4 -0
  151. package/vue.config.js +21 -0
package/src/main.js ADDED
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue'
2
+ import App from './App.vue'
3
+
4
+ Vue.config.productionTip = false
5
+
6
+ new Vue({
7
+ render: h => h(App),
8
+ }).$mount('#app')
@@ -0,0 +1,10 @@
1
+ import assert from 'assert'
2
+
3
+
4
+ describe('all', function() {
5
+
6
+ it('test in localhost', function() {
7
+ assert.strict.deepEqual(1, 1)
8
+ })
9
+
10
+ })
@@ -0,0 +1,4 @@
1
+ import addVersion from 'w-package-tools/src/addVersion.mjs'
2
+
3
+
4
+ addVersion()
@@ -0,0 +1,4 @@
1
+ import cleanFolder from 'w-package-tools/src/cleanFolder.mjs'
2
+
3
+
4
+ cleanFolder('docs')
@@ -0,0 +1,38 @@
1
+ import rollupVueToHtml from 'w-package-tools/src/rollupVueToHtml.mjs'
2
+
3
+
4
+ let opt = {
5
+ title: `w-threejs-vue`,
6
+ head: `
7
+
8
+ <!-- rollupVueToHtml已自動添加@babel/polyfill與vue -->
9
+
10
+ <!-- fontawesome -->
11
+ <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css" rel="stylesheet">
12
+
13
+ <!-- mdi, 各組件使用mdi/js故不需引用 -->
14
+ <link _href="https://cdn.jsdelivr.net/npm/@mdi/font@7.2.96/css/materialdesignicons.min.css" rel="stylesheet">
15
+
16
+ <!-- google, 各組件使用mdi/js故不需引用 -->
17
+ <link _href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
18
+ <link _href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
19
+
20
+ <!-- lodash -->
21
+ <script src="https://cdn.jsdelivr.net/npm/lodash@latest/lodash.min.js"></script>
22
+
23
+ <!-- wsemi -->
24
+ <script src="https://cdn.jsdelivr.net/npm/wsemi@latest/dist/wsemi.umd.min.js"></script>
25
+
26
+ <!-- data -->
27
+ <script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRain.js"></script>
28
+ <script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRainClip.js"></script>
29
+
30
+ `,
31
+ newVue: ``,
32
+ globals: {
33
+ },
34
+ external: [
35
+ ],
36
+ }
37
+ rollupVueToHtml('./src/App.vue', './docs/examples/app.html', opt)
38
+
@@ -0,0 +1,22 @@
1
+ import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
2
+
3
+
4
+ let fdSrc = './src/components/'
5
+ let fdTar = './dist'
6
+
7
+
8
+ rollupFiles({
9
+ fns: 'WThreejsVue.vue',
10
+ fdSrc,
11
+ fdTar,
12
+ format: 'umd',
13
+ //nameDistType: 'kebabCase',
14
+ hookNameDist: () => {
15
+ return 'w-threejs-vue'
16
+ },
17
+ globals: {
18
+ },
19
+ external: [
20
+ ],
21
+ })
22
+
@@ -0,0 +1,47 @@
1
+ import _ from 'lodash-es'
2
+ import fs from 'fs'
3
+ import getFiles from 'w-package-tools/src/getFiles.mjs'
4
+ import getPks from 'w-package-tools/src/getPks.mjs'
5
+
6
+
7
+ let fdSrc = './test-html/'
8
+ let fdTar = './docs/examples/'
9
+
10
+
11
+ async function main() {
12
+ //把example裡面cdn更換, 再複製到docs的example內, 作為日後發佈為靜態網站
13
+
14
+ //pks
15
+ let pks = getPks()
16
+
17
+ //cdn
18
+ let cdn = `<script src="https://cdn.jsdelivr.net/npm/w-threejs-vue@${pks.version}/dist/w-threejs-vue.umd.js"></script>`
19
+
20
+ //mkdirSync
21
+ if (!fs.existsSync(fdTar)) {
22
+ fs.mkdirSync(fdTar)
23
+ }
24
+
25
+ //getFiles
26
+ let ltfs = getFiles(fdSrc)
27
+
28
+ _.each(ltfs, function(v) {
29
+
30
+ //fn
31
+ let fn = fdSrc + v
32
+
33
+ //c
34
+ let c = fs.readFileSync(fn, 'utf8')
35
+
36
+ //replace
37
+ let r = `<script src="../dist/w-threejs-vue.umd.js"></script>`
38
+ c = c.replace(r, cdn)
39
+
40
+ //write
41
+ //console.log(c)
42
+ fs.writeFileSync(fdTar + v, c, 'utf8')
43
+
44
+ })
45
+
46
+ }
47
+ main()
@@ -0,0 +1,159 @@
1
+ import fs from 'fs'
2
+ import _ from 'lodash-es'
3
+ import w from 'wsemi'
4
+ import getFiles from 'w-package-tools/src/getFiles.mjs'
5
+ import cleanFolder from 'w-package-tools/src/cleanFolder.mjs'
6
+ import parseVueCode from 'w-package-tools/src/parseVueCode.mjs'
7
+ import extractHtml from 'w-package-tools/src/extractHtml.mjs'
8
+
9
+
10
+ let fdSrc = './src/'
11
+ let fdTestHtml = './test-html/'
12
+ let fdTestSrc = './test-action/'
13
+
14
+
15
+ function writeHtml(v) {
16
+
17
+ function getAppTmp() {
18
+ return v.tmp
19
+ }
20
+
21
+ function procHtml(h) {
22
+
23
+ //change cmp name
24
+ h = w.replace(h, 'WThreejsVue', 'w-threejs-vue')
25
+
26
+ return h
27
+ }
28
+
29
+ //opt
30
+ let opt = {
31
+ title: `example for ${v.casename}`,
32
+ head: `
33
+
34
+ <!-- extractHtml已自動添加@babel/polyfill與vue -->
35
+
36
+ <!-- fontawesome -->
37
+ <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css" rel="stylesheet">
38
+
39
+ <!-- mdi, 各組件使用mdi/js會於轉單頁時改為mdi icon, 故需引用mdi/css -->
40
+ <link href="https://cdn.jsdelivr.net/npm/@mdi/font@7.2.96/css/materialdesignicons.min.css" rel="stylesheet">
41
+
42
+ <!-- google, 各組件使用mdi/js故不需引用 -->
43
+ <link _href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
44
+ <link _href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
45
+
46
+ <!-- w-threejs-vue -->
47
+ <script src="../dist/w-threejs-vue.umd.js"></script>
48
+
49
+ <!-- lodash -->
50
+ <script src="https://cdn.jsdelivr.net/npm/lodash@latest/lodash.min.js"></script>
51
+
52
+ <!-- wsemi -->
53
+ <script src="https://cdn.jsdelivr.net/npm/wsemi@latest/dist/wsemi.umd.min.js"></script>
54
+
55
+ <!-- data -->
56
+ <script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRain.js"></script>
57
+ <script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRainClip.js"></script>
58
+
59
+ <!-- w-jsonview-tree -->
60
+ <script src="https://cdn.jsdelivr.net/npm/w-jsonview-tree@latest/dist/w-jsonview-tree.umd.js"></script>
61
+ <script>
62
+ let jv=window['w-jsonview-tree']
63
+ </script>
64
+
65
+ <style>
66
+ .option-label {
67
+ position:absolute;
68
+ left:10px;
69
+ top:-33px;
70
+ padding:4px 20px 7px 20px;
71
+ border-left:1px solid #ddd;
72
+ border-top:1px solid #ddd;
73
+ border-right:1px solid #ddd;
74
+ border-bottom:1px solid #f6f6f6;
75
+ border-top-left-radius:15px;
76
+ border-top-right-radius:15px;
77
+ background:#f6f6f6;
78
+ }
79
+ </style>
80
+
81
+ `,
82
+ appTag: `div`,
83
+ appStyle: `padding:0px 30px;`,
84
+ appTmp: getAppTmp(),
85
+ installVue: `Vue.component('w-threejs-vue', window['w-threejs-vue'])`,
86
+ newVue: ``,
87
+ data: v.data,
88
+ mounted: v.mounted,
89
+ computed: v.computed,
90
+ methods: v.methods,
91
+ action: v.action,
92
+ procHtml,
93
+ fpHtml: `${fdTestHtml}${v.fn}.html`,
94
+ fpAction: `${fdTestSrc}${v.fn}.action.json`,
95
+ }
96
+
97
+ //extractHtml
98
+ extractHtml(opt)
99
+
100
+ }
101
+
102
+
103
+ function extractApp(fn) {
104
+
105
+ //casename
106
+ let casename = fn.replace('.vue', '')
107
+
108
+ //read
109
+ let hh = fs.readFileSync(fdSrc + fn, 'utf8')
110
+
111
+ // //取代example與code
112
+ // hh = w.replace(hh, '{filename}', casename)
113
+
114
+ // //複寫回去, 因開發階段懶得手動改全部, 故得用程式改
115
+ // fs.writeFileSync(fdSrc + fn, hh, 'utf8')
116
+
117
+ //parseVueCode
118
+ let { tmp, mounted, data, computed, methods, action } = parseVueCode(hh)
119
+
120
+ //writeHtml
121
+ writeHtml({
122
+ fn: `ex-${casename}`,
123
+ casename,
124
+ tmp,
125
+ mounted,
126
+ data,
127
+ computed,
128
+ methods,
129
+ action,
130
+ })
131
+
132
+ }
133
+
134
+
135
+ function main() {
136
+ //由jsdoc產製之wsemi.html, 自動添加將example轉換成codepen線上編輯功能
137
+
138
+ //cleanFolder
139
+ cleanFolder(fdTestHtml)
140
+ //cleanFolder(fdTestSrc)
141
+
142
+ //getFiles
143
+ let ltfs = getFiles(fdSrc)
144
+
145
+ //filter
146
+ ltfs = _.filter(ltfs, function(v) {
147
+ return v.indexOf('App') >= 0
148
+ })
149
+ _.pull(ltfs, 'App.vue')
150
+ //console.log(ltfs)
151
+
152
+ //extractApp
153
+ _.each(ltfs, function(v) {
154
+ console.log('extracting: ' + fdSrc + v)
155
+ extractApp(v)
156
+ })
157
+
158
+ }
159
+ main()
@@ -0,0 +1,4 @@
1
+ import modifyReadme from 'w-package-tools/src/modifyReadme.mjs'
2
+
3
+
4
+ modifyReadme()
package/vue.config.js ADDED
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ lintOnSave: false, //禁止eslint-loader於編譯時檢查語法
3
+ devServer: {
4
+ proxy: {
5
+ '/api': {
6
+ target: 'http://localhost:9000',
7
+ pathRewrite: {
8
+ '^/api': '/api'
9
+ },
10
+ },
11
+ '/swdoc': {
12
+ target: 'http://localhost:9000',
13
+ pathRewrite: {
14
+ '^/swdoc': '/swdoc'
15
+ },
16
+ },
17
+ }
18
+ },
19
+ //transpileDependencies: ['abc'],
20
+ //publicPath: process.env.NODE_ENV === 'production' ? '/abc/' : '/',
21
+ }