catchword 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +314 -2
- package/bin/catchword.js +8 -0
- package/bin/falcon.js +5 -0
- package/dist/cli/adb.d.ts +6 -0
- package/dist/cli/adb.js +52 -0
- package/dist/cli/audit.d.ts +4 -0
- package/dist/cli/audit.js +91 -0
- package/dist/cli/build.d.ts +13 -0
- package/dist/cli/build.js +139 -0
- package/dist/cli/clean.d.ts +1 -0
- package/dist/cli/clean.js +15 -0
- package/dist/cli/create.d.ts +4 -0
- package/dist/cli/create.js +60 -0
- package/dist/cli/dev.d.ts +10 -0
- package/dist/cli/dev.js +23 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +243 -0
- package/dist/cli/native.d.ts +18 -0
- package/dist/cli/native.js +232 -0
- package/dist/cli/simulator.d.ts +8 -0
- package/dist/cli/simulator.js +77 -0
- package/dist/cli/upload.d.ts +9 -0
- package/dist/cli/upload.js +135 -0
- package/dist/cli/util.d.ts +8 -0
- package/dist/cli/util.js +43 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +51 -0
- package/dist/native/api.d.ts +46 -0
- package/dist/native/api.js +185 -0
- package/dist/native/build.d.ts +47 -0
- package/dist/native/build.js +407 -0
- package/dist/native/elf.d.ts +15 -0
- package/dist/native/elf.js +200 -0
- package/dist/native/types.d.ts +9 -0
- package/dist/native/types.js +91 -0
- package/dist/native/wsl.d.ts +7 -0
- package/dist/native/wsl.js +29 -0
- package/dist/plugin/app-entry.d.ts +6 -0
- package/dist/plugin/app-entry.js +115 -0
- package/dist/plugin/assets.d.ts +4 -0
- package/dist/plugin/assets.js +84 -0
- package/dist/plugin/config.d.ts +14 -0
- package/dist/plugin/config.js +80 -0
- package/dist/plugin/context.d.ts +58 -0
- package/dist/plugin/context.js +255 -0
- package/dist/plugin/fallback.d.ts +4 -0
- package/dist/plugin/fallback.js +81 -0
- package/dist/plugin/image-service.d.ts +17 -0
- package/dist/plugin/image-service.js +138 -0
- package/dist/plugin/jsapi.d.ts +6 -0
- package/dist/plugin/jsapi.js +82 -0
- package/dist/plugin/output.d.ts +4 -0
- package/dist/plugin/output.js +75 -0
- package/dist/plugin/preview.d.ts +34 -0
- package/dist/plugin/preview.js +459 -0
- package/dist/plugin/sanitize.d.ts +5 -0
- package/dist/plugin/sanitize.js +48 -0
- package/dist/plugin/security.d.ts +4 -0
- package/dist/plugin/security.js +18 -0
- package/dist/plugin/sfc.d.ts +6 -0
- package/dist/plugin/sfc.js +181 -0
- package/dist/plugin/shim.d.ts +4 -0
- package/dist/plugin/shim.js +68 -0
- package/dist/plugin/state.d.ts +31 -0
- package/dist/plugin/state.js +61 -0
- package/dist/plugin/string-table.d.ts +7 -0
- package/dist/plugin/string-table.js +324 -0
- package/dist/plugin/style.d.ts +15 -0
- package/dist/plugin/style.js +114 -0
- package/dist/plugin/template.d.ts +7 -0
- package/dist/plugin/template.js +39 -0
- package/dist/steps/manifest.d.ts +9 -0
- package/dist/steps/manifest.js +60 -0
- package/dist/steps/pack.d.ts +3 -0
- package/dist/steps/pack.js +46 -0
- package/dist/steps/qjsc.d.ts +9 -0
- package/dist/steps/qjsc.js +186 -0
- package/dist/steps/report.d.ts +2 -0
- package/dist/steps/report.js +50 -0
- package/dist/steps/security.d.ts +17 -0
- package/dist/steps/security.js +310 -0
- package/dist/types.d.ts +158 -0
- package/dist/types.js +1 -0
- package/dist/util/class-tokenize.d.ts +2 -0
- package/dist/util/class-tokenize.js +56 -0
- package/dist/util/component-name.d.ts +6 -0
- package/dist/util/component-name.js +120 -0
- package/dist/util/fs.d.ts +14 -0
- package/dist/util/fs.js +70 -0
- package/dist/util/imports.d.ts +2 -0
- package/dist/util/imports.js +173 -0
- package/dist/util/log.d.ts +8 -0
- package/dist/util/log.js +24 -0
- package/package.json +61 -4
- package/template/README.md +38 -0
- package/template/catchword.config.ts +18 -0
- package/template/native/CMakeLists.txt +33 -0
- package/template/native/README.md +34 -0
- package/template/native/api.override.json +7 -0
- package/template/native/include/jsapi_demo.h +10 -0
- package/template/native/lib/README.md +10 -0
- package/template/native/sdk/README.md +6 -0
- package/template/native/src/bridge.cpp +9 -0
- package/template/native/src/jsapi_demo.cpp +11 -0
- package/template/package.json +38 -0
- package/template/src/app.js +45 -0
- package/template/src/app.json +11 -0
- package/template/src/base-page.js +150 -0
- package/template/src/components/HelloWorld.vue +20 -0
- package/template/src/mocks/$jsapi.test.js +5 -0
- package/template/src/mocks/test-module.js +5 -0
- package/template/src/pages/index/index.vue +41 -0
- package/template/src/pages/page/page.vue +63 -0
- package/template/src/shims.d.ts +21 -0
- package/template/src/styles/base.less +23 -0
- package/template/src/styles/mixin.less +32 -0
- package/template/src/styles/var.less +15 -0
- package/template/tsconfig.json +14 -0
- package/vendor/README.md +16 -0
- package/vendor/falcon-styler/.jscsrc +31 -0
- package/vendor/falcon-styler/LICENSE +21 -0
- package/vendor/falcon-styler/README.md +124 -0
- package/vendor/falcon-styler/index.js +273 -0
- package/vendor/falcon-styler/lib/shorthand-parser.js +78 -0
- package/vendor/falcon-styler/lib/util.js +30 -0
- package/vendor/falcon-styler/lib/validator.js +846 -0
- package/vendor/falcon-styler/package.json +32 -0
- package/vendor/licenses/falcon-styler.LICENSE +21 -0
- package/vendor/licenses/weex-template-compiler.README.md +3 -0
- package/vendor/package.json +5 -0
- package/vendor/qjsc/SHA256SUMS +11 -0
- package/vendor/qjsc/bin/darwin/arm64/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200412 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200906 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200412 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200906 +0 -0
- package/vendor/qjsc/bin/linux/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/win32/libgcc_s_dw2-1.dll +0 -0
- package/vendor/qjsc/bin/win32/pthreadGC-3.dll +0 -0
- package/vendor/qjsc/bin/win32/qjsc20200705.exe +0 -0
- package/vendor/web/falcon-js-web.js +863 -0
- package/vendor/web/falcon-jsapi-web.js +479 -0
- package/vendor/web/falcon-vue-render.js +11323 -0
- package/vendor/web/falcon-web-boot.js +4 -0
- package/vendor/web/falcon-web-hud.js +119 -0
- package/vendor/web/falcon-web-style.js +235 -0
- package/vendor/web/vue.runtime.common.dev.js +8467 -0
- package/vendor/web/vue.runtime.common.js +5 -0
- package/vendor/weex-template-compiler/README.md +3 -0
- package/vendor/weex-template-compiler/build.js +4824 -0
- package/vendor/weex-template-compiler/index.js +17 -0
- package/vendor/weex-template-compiler/package.json +25 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const DEBUG = false
|
|
2
|
+
function _collectFalconEventIds(name, callback) {
|
|
3
|
+
const evtList = $falcon.eventMap && $falcon.eventMap[name]
|
|
4
|
+
if (evtList) {
|
|
5
|
+
if (callback) {
|
|
6
|
+
const index = evtList.findIndex(
|
|
7
|
+
(item) => item.callback === callback || item.id === callback
|
|
8
|
+
)
|
|
9
|
+
if (index !== -1) {
|
|
10
|
+
return [evtList[index].id]
|
|
11
|
+
}
|
|
12
|
+
} else {
|
|
13
|
+
return evtList.map((item) => item.id)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return []
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class PageRes extends $falcon.Page {
|
|
20
|
+
constructor() {
|
|
21
|
+
super()
|
|
22
|
+
this.falconOnTokens = []
|
|
23
|
+
this.timeoutTokens = new Set()
|
|
24
|
+
this.intervalTokens = new Set()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
on(name, callback) {
|
|
28
|
+
const token = $falcon.on(name, callback)
|
|
29
|
+
this.falconOnTokens.push([token, name])
|
|
30
|
+
return token
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
off(name, callback) {
|
|
34
|
+
const falconOnTokens2 = []
|
|
35
|
+
let idsWillRemoved = _collectFalconEventIds(name, callback)
|
|
36
|
+
DEBUG && console.log(`idsWillRemoved ${JSON.stringify(idsWillRemoved)}`)
|
|
37
|
+
idsWillRemoved = new Set(idsWillRemoved)
|
|
38
|
+
for (let [token, name] of this.falconOnTokens) {
|
|
39
|
+
if (idsWillRemoved.has(token)) {
|
|
40
|
+
continue
|
|
41
|
+
}
|
|
42
|
+
falconOnTokens2.push([token, name])
|
|
43
|
+
}
|
|
44
|
+
this.falconOnTokens = falconOnTokens2
|
|
45
|
+
|
|
46
|
+
$falcon.off(name, callback)
|
|
47
|
+
}
|
|
48
|
+
trigger(name, options) {
|
|
49
|
+
$falcon.trigger(name, options)
|
|
50
|
+
}
|
|
51
|
+
setTimeout(func, ms) {
|
|
52
|
+
const token = setTimeout(() => {
|
|
53
|
+
this.timeoutTokens.delete(token)
|
|
54
|
+
func()
|
|
55
|
+
}, ms)
|
|
56
|
+
this.timeoutTokens.add(token)
|
|
57
|
+
return token
|
|
58
|
+
}
|
|
59
|
+
setInterval(func, ms) {
|
|
60
|
+
const token = setInterval(func, ms)
|
|
61
|
+
this.intervalTokens.add(token)
|
|
62
|
+
return token
|
|
63
|
+
}
|
|
64
|
+
clearTimeout(token) {
|
|
65
|
+
this.timeoutTokens.delete(token)
|
|
66
|
+
clearTimeout(token)
|
|
67
|
+
}
|
|
68
|
+
clearInterval(token) {
|
|
69
|
+
this.intervalTokens.delete(token)
|
|
70
|
+
clearInterval(token)
|
|
71
|
+
}
|
|
72
|
+
release() {
|
|
73
|
+
for (let [token, name] of this.falconOnTokens) {
|
|
74
|
+
DEBUG && console.log(`release $falcon.on token ${token}`)
|
|
75
|
+
$falcon.off(name, token)
|
|
76
|
+
}
|
|
77
|
+
this.falconOnTokens.length = 0
|
|
78
|
+
for (let token of this.timeoutTokens) {
|
|
79
|
+
DEBUG && console.log(`release setTimeout token ${token}`)
|
|
80
|
+
clearTimeout(token)
|
|
81
|
+
}
|
|
82
|
+
this.timeoutTokens.clear()
|
|
83
|
+
for (let token of this.intervalTokens) {
|
|
84
|
+
DEBUG && console.log(`release setInterval token ${token}`)
|
|
85
|
+
clearInterval(token)
|
|
86
|
+
}
|
|
87
|
+
this.intervalTokens.clear()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export class BasePage extends PageRes {
|
|
92
|
+
constructor() {
|
|
93
|
+
super()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async sleep(ms) {
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
this.setTimeout(() => {
|
|
99
|
+
resolve()
|
|
100
|
+
}, ms)
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
onLoad(options) {
|
|
105
|
+
super.onLoad(options)
|
|
106
|
+
this.options = options
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
onNewOptions(options) {
|
|
110
|
+
super.onNewOptions(options)
|
|
111
|
+
this.options = options
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onShow() {
|
|
115
|
+
super.onShow()
|
|
116
|
+
|
|
117
|
+
if (this.$root.onShow) {
|
|
118
|
+
this.$root.onShow()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onHide() {
|
|
123
|
+
super.onHide()
|
|
124
|
+
if (this.$root.onHide) {
|
|
125
|
+
this.$root.onHide()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
onUnload() {
|
|
130
|
+
try {
|
|
131
|
+
super.onUnload()
|
|
132
|
+
if (this.$root.onUnload) {
|
|
133
|
+
this.$root.onUnload()
|
|
134
|
+
}
|
|
135
|
+
} finally {
|
|
136
|
+
if (this.release) {
|
|
137
|
+
this.release()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
beforeVueInstantiate(Vue) {
|
|
143
|
+
try {
|
|
144
|
+
Vue.prototype.$workspace = globalThis.$workspace
|
|
145
|
+
Vue.prototype.$appid = globalThis.$appid
|
|
146
|
+
} catch (err) {
|
|
147
|
+
console.log(err)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<text class="text">Now, let's use Vue.js to build your iot app</text>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: "HelloComponent",
|
|
8
|
+
components: {},
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
msg:''
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style lang="less" scoped>@import "base.less";
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wrapper">
|
|
3
|
+
<text class="greeting">{{ message }}, falcon!</text>
|
|
4
|
+
<hello-world />
|
|
5
|
+
<text class="btn" @click="jump">click to the next page</text>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
|
11
|
+
export default {
|
|
12
|
+
name: 'index',
|
|
13
|
+
components: { HelloWorld },
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
message: '',
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
methods: {
|
|
20
|
+
onShow() {
|
|
21
|
+
this.message = 'Hello'
|
|
22
|
+
},
|
|
23
|
+
onHide() {
|
|
24
|
+
console.log(`onHide called`)
|
|
25
|
+
},
|
|
26
|
+
jump() {
|
|
27
|
+
$falcon.navTo('page', { from: 'index' })
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style lang="less" scoped>@import "base.less";
|
|
34
|
+
|
|
35
|
+
.greeting {
|
|
36
|
+
text-align: center;
|
|
37
|
+
margin: 20px 0px;
|
|
38
|
+
font-size: 50px;
|
|
39
|
+
color: #41b883;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wrapper">
|
|
3
|
+
<text class="greeting">Multi-page application</text>
|
|
4
|
+
<div style="row-gap: 10px;">
|
|
5
|
+
<text class="text">{{ dateStr }}</text>
|
|
6
|
+
<text class="text">options "from": {{ $page.options['from']}}</text>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div style="flex-direction: row; margin-top: 20px;">
|
|
10
|
+
<text class="btn" @click="jump">back</text>
|
|
11
|
+
<text class="btn" @click="finishPage">finish</text>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>function formatDateTimeStr(now)
|
|
17
|
+
{
|
|
18
|
+
const year = now.getFullYear();
|
|
19
|
+
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
20
|
+
const day = now.getDate().toString().padStart(2, '0');
|
|
21
|
+
const hour = now.getHours().toString().padStart(2, '0');
|
|
22
|
+
const minute = now.getMinutes().toString().padStart(2, '0');
|
|
23
|
+
const second = now.getSeconds().toString().padStart(2, '0');
|
|
24
|
+
|
|
25
|
+
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'page',
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
dateStr: formatDateTimeStr(new Date()),
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
mounted() {
|
|
36
|
+
this.$page.setInterval(() => this.dateStr = formatDateTimeStr(new Date()) , 1000)
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
onShow() {
|
|
40
|
+
console.log(`options ${JSON.stringify(this.$page.options)}`)
|
|
41
|
+
},
|
|
42
|
+
jump() {
|
|
43
|
+
$falcon.navTo('index', { from: 'page' })
|
|
44
|
+
},
|
|
45
|
+
finishApp() {
|
|
46
|
+
this.$app.finish()
|
|
47
|
+
},
|
|
48
|
+
finishPage() {
|
|
49
|
+
this.$page.finish()
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style lang="less" scoped>@import "base.less";
|
|
56
|
+
|
|
57
|
+
.greeting {
|
|
58
|
+
text-align: center;
|
|
59
|
+
margin: 20px 0px;
|
|
60
|
+
font-size: 34px;
|
|
61
|
+
color: #41b883;
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
const component: any
|
|
3
|
+
export default component
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module '*.png' {
|
|
7
|
+
const url: string
|
|
8
|
+
export default url
|
|
9
|
+
}
|
|
10
|
+
declare module '*.jpg' {
|
|
11
|
+
const url: string
|
|
12
|
+
export default url
|
|
13
|
+
}
|
|
14
|
+
declare module '*.svg' {
|
|
15
|
+
const url: string
|
|
16
|
+
export default url
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const $falcon: any
|
|
20
|
+
|
|
21
|
+
declare function defineComponent<T extends object>(options: T): T
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import './var.less';
|
|
2
|
+
@import './mixin.less';
|
|
3
|
+
|
|
4
|
+
.text {
|
|
5
|
+
#text();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wrapper {
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.btn {
|
|
14
|
+
margin: 10px;
|
|
15
|
+
padding: 0 20px;
|
|
16
|
+
font-size: 24px;
|
|
17
|
+
color: #727272;
|
|
18
|
+
border-radius: 6px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.btn:active {
|
|
22
|
+
#shadow();
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@import "./var.less";
|
|
2
|
+
#border(@width: @border-width-default, @style: @border-style-default, @color: @border-color-default, @radius: @border-radius-default) {
|
|
3
|
+
border-width: @width;
|
|
4
|
+
border-style: @style;
|
|
5
|
+
border-color: @color;
|
|
6
|
+
border-radius: @radius;
|
|
7
|
+
}
|
|
8
|
+
#border-top(@width: @border-width-default, @style: @border-style-default, @color: @border-color-default) {
|
|
9
|
+
border-top-width: @width;
|
|
10
|
+
border-top-style: @style;
|
|
11
|
+
border-top-color: @color;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#transition(@property: all, @duration:@transition-duration-default, @function:linear, @delay:0) {
|
|
15
|
+
transition-property: @property;
|
|
16
|
+
transition-duration: @duration;
|
|
17
|
+
transition-timing-function: @function;
|
|
18
|
+
transition-delay: @delay;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#bg-linear-gradient(@direction: @gradient-direction-default, @color-stops) {
|
|
22
|
+
background-image: linear-gradient(@direction, @color-stops);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#shadow(@h-shadow:@shadow-h-default, @v-shadow:@shadow-v-default, @radius:@shadow-radius-default, @color:@shadow-color-default) {
|
|
26
|
+
box-shadow: @h-shadow @v-shadow @radius @color;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#text() {
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
color: @text-color-default;
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@text-color-default: #34495e;
|
|
2
|
+
|
|
3
|
+
@border-color-default: #ebedf0;
|
|
4
|
+
@border-radius-default: 20px;
|
|
5
|
+
@border-width-default: 1px;
|
|
6
|
+
@border-style-default: solid;
|
|
7
|
+
|
|
8
|
+
@transition-duration-default: 300ms;
|
|
9
|
+
|
|
10
|
+
@gradient-direction-default: to right;
|
|
11
|
+
|
|
12
|
+
@shadow-h-default: 0px;
|
|
13
|
+
@shadow-v-default: 0px;
|
|
14
|
+
@shadow-radius-default: 5px;
|
|
15
|
+
@shadow-color-default: #646566;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"verbatimModuleSyntax": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"types": []
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "native/api.d.ts"]
|
|
14
|
+
}
|
package/vendor/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# vendor 说明
|
|
2
|
+
|
|
3
|
+
本目录中的代码全部来自第三方上游项目,`falcon-vite` 不通过 `require('aiot-vue-cli')`
|
|
4
|
+
引用任何原 CLI 的文件,改为在包内自带,便于独立发布与版本锁定。
|
|
5
|
+
|
|
6
|
+
| 目录 / 文件 | 来源 | 许可证 |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `falcon-styler/` | falcon-styler 0.3.9(weex-styler 的 Falcon 分支) | MIT,见 `licenses/falcon-styler.LICENSE` |
|
|
9
|
+
| `weex-template-compiler/` | Vue 2.6.12 的 weex-template-compiler,`weex-vue-framework` 分支 | MIT |
|
|
10
|
+
| `web/falcon-vue-render.js` | weex-vue-render 1.0.39(Falcon 分支),仅浏览器预览使用 | Apache-2.0(文件内保留 Apache 头) |
|
|
11
|
+
| `web/falcon-js-web.js` | Falcon JS Framework 的浏览器驱动,仅浏览器预览使用 | Apache-2.0(文件内保留 Apache 头) |
|
|
12
|
+
| `web/vue.runtime.common*.js` | Vue 2.6.14 | MIT |
|
|
13
|
+
| `qjsc/bin/**` | QuickJS 20200412 / 20200705 / 20200906 的 qjsc,用于生成 `.js.bin` | MIT (Fabrice Bellard) |
|
|
14
|
+
|
|
15
|
+
这些文件仅作为构建期依赖或浏览器预览运行时使用,不参与设备端应用包的内容
|
|
16
|
+
(设备端框架由固件提供)。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"preset": "node-style-guide",
|
|
3
|
+
|
|
4
|
+
"disallowKeywordsOnNewLine": [],
|
|
5
|
+
"disallowMultipleVarDecl": {"allExcept": ["undefined"]},
|
|
6
|
+
"disallowSemicolons": true,
|
|
7
|
+
"requireCapitalizedComments": null,
|
|
8
|
+
|
|
9
|
+
"requireCurlyBraces": [
|
|
10
|
+
"if",
|
|
11
|
+
"else",
|
|
12
|
+
"for",
|
|
13
|
+
"while",
|
|
14
|
+
"do",
|
|
15
|
+
"try",
|
|
16
|
+
"catch"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"disallowSpacesInFunction": null,
|
|
20
|
+
"disallowSpacesInNamedFunctionExpression": {
|
|
21
|
+
"beforeOpeningRoundBrace": true
|
|
22
|
+
},
|
|
23
|
+
"requireSpacesInAnonymousFunctionExpression": {
|
|
24
|
+
"beforeOpeningRoundBrace": true
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
"disallowSpaceBeforeComma": true,
|
|
28
|
+
"requireCommaBeforeLineBreak": true,
|
|
29
|
+
"disallowTrailingComma": true,
|
|
30
|
+
"requireTrailingComma": null
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present, songsiqi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Weex `<style>` Transformer
|
|
2
|
+
|
|
3
|
+
[![NPM version][npm-image]][npm-url]
|
|
4
|
+
[![Build status][circle-image]][circle-url]
|
|
5
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
6
|
+
|
|
7
|
+
[npm-image]: https://img.shields.io/npm/v/weex-styler.svg?style=flat-square
|
|
8
|
+
[npm-url]: https://npmjs.org/package/weex-styler
|
|
9
|
+
[circle-image]: https://circleci.com/gh/alibaba/weex_toolchain.svg?style=svg
|
|
10
|
+
[circle-url]: https://circleci.com/gh/alibaba/weex_toolchain/tree/master
|
|
11
|
+
[downloads-image]: https://img.shields.io/npm/dm/weex-styler.svg?style=flat-square
|
|
12
|
+
[downloads-url]: https://npmjs.org/package/weex-styler
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- convert a `<style>` element to JSON format
|
|
17
|
+
- autofix common mistakes
|
|
18
|
+
- friendly warnings
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
- `parse(code, done)`
|
|
23
|
+
- `validate(json, done)`
|
|
24
|
+
- `validateItem(name, value)`
|
|
25
|
+
|
|
26
|
+
### util api
|
|
27
|
+
|
|
28
|
+
- `util.hyphenedToCamelCase(value)`
|
|
29
|
+
- `util.camelCaseToHyphened(value)`
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
/**
|
|
33
|
+
* Parse `<style>` code to a JSON Object and log errors & warnings
|
|
34
|
+
*
|
|
35
|
+
* @param {string} code
|
|
36
|
+
* @param {function} done
|
|
37
|
+
*/
|
|
38
|
+
function parse(code, done) {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Validate a JSON Object and log errors & warnings
|
|
42
|
+
*
|
|
43
|
+
* @param {object} json
|
|
44
|
+
* @param {function} done
|
|
45
|
+
*/
|
|
46
|
+
function validate(json, done) {}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Result callback
|
|
50
|
+
*
|
|
51
|
+
* data
|
|
52
|
+
* - jsonStyle{}: `classname.propname.value`-like object
|
|
53
|
+
* - log[{line, column, reason}]
|
|
54
|
+
*
|
|
55
|
+
* @param {Error} err
|
|
56
|
+
* @param {object} data
|
|
57
|
+
*/
|
|
58
|
+
function done(err, data) {}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Validate a single name-value pair
|
|
62
|
+
*
|
|
63
|
+
* @param {string} name camel cased
|
|
64
|
+
* @param {string} value
|
|
65
|
+
* @return {object}
|
|
66
|
+
* - value
|
|
67
|
+
* - log{reason}
|
|
68
|
+
*/
|
|
69
|
+
function validateItem(name, value) {}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Validation
|
|
73
|
+
|
|
74
|
+
- rule check: only common rule type supported, othres will be ignored
|
|
75
|
+
- selector check: only single-classname selector is supported, others will be ignored
|
|
76
|
+
- prop name check: out-of-defined prop name will be warned but preserved
|
|
77
|
+
- prop value check: common prop value mistakes will be autofixed or ignored
|
|
78
|
+
+ color type: keywords, `#xxx` -> warning: `#xxxxxx`
|
|
79
|
+
+ color type: `transparent` -> error: not supported
|
|
80
|
+
+ length type: `100px` -> warning: `100`
|
|
81
|
+
|
|
82
|
+
## Demo
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
var styler = require('weex-styler')
|
|
86
|
+
|
|
87
|
+
var code = 'html {color: #000000;} .foo {color: red; -webkit-transform: rotate(90deg); width: 200px;}'
|
|
88
|
+
|
|
89
|
+
styler.parse(code, function (err, data) {
|
|
90
|
+
// syntax error
|
|
91
|
+
// format: {line, column, reason, ...}
|
|
92
|
+
err
|
|
93
|
+
// result
|
|
94
|
+
// {foo: {color: '#ff0000', webkitTransform: 'rotate(90deg)', width: 200}}
|
|
95
|
+
data.jsonStyle
|
|
96
|
+
// format: {line, column, reason}
|
|
97
|
+
// - Error: Selector `html` is not supported. Weex only support single-classname selector
|
|
98
|
+
// - Warning: prop value `red` is autofixed to `#ff0000`
|
|
99
|
+
// - Warning: prop name `-webkit-transform` is not supported
|
|
100
|
+
// - Warning: prop value `200px` is autofixed to `200`
|
|
101
|
+
data.log[]
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
var jsonStyle = {
|
|
105
|
+
foo: {
|
|
106
|
+
color: 'red',
|
|
107
|
+
webkitTransform: 'rotate(90deg)',
|
|
108
|
+
width: '200px'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
styler.validate(json, function (err, data) {
|
|
113
|
+
// syntax error
|
|
114
|
+
err
|
|
115
|
+
// result
|
|
116
|
+
// {foo: {color: '#ff0000', webkitTransform: 'rotate(90deg)', width: 200}}
|
|
117
|
+
data.jsonStyle
|
|
118
|
+
// format: {reason}
|
|
119
|
+
// - Warning: prop value `red` is autofixed to `#ff0000`
|
|
120
|
+
// - Warning: prop name `-webkit-transform` is not supported
|
|
121
|
+
// - Warning: prop value `200px` is autofixed to `200`
|
|
122
|
+
data.log[]
|
|
123
|
+
})
|
|
124
|
+
```
|