@cloudbase/framework-plugin-low-code 0.6.32 → 0.6.35

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 (80) hide show
  1. package/lib/builder/config/index.js +2 -5
  2. package/lib/builder/core/copy.d.ts.map +1 -1
  3. package/lib/builder/mp/materials.d.ts.map +1 -1
  4. package/lib/builder/mp/materials.js +30 -5
  5. package/package.json +5 -3
  6. package/template/webpack/web.prod.js +1 -0
  7. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/cookie.js +0 -286
  8. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/history.js +0 -133
  9. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/local-storage.js +0 -103
  10. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/location.js +0 -588
  11. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/miniprogram.js +0 -101
  12. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/navigator.js +0 -80
  13. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/performance.js +0 -28
  14. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/screen.js +0 -31
  15. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/session-storage.js +0 -96
  16. package/template/dist/mp/miniprogram_npm/miniprogram-render/bom/xml-http-request.js +0 -290
  17. package/template/dist/mp/miniprogram_npm/miniprogram-render/document.js +0 -396
  18. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/custom-event.js +0 -12
  19. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event-target.js +0 -389
  20. package/template/dist/mp/miniprogram_npm/miniprogram-render/event/event.js +0 -186
  21. package/template/dist/mp/miniprogram_npm/miniprogram-render/index.js +0 -41
  22. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/attribute.js +0 -226
  23. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/class-list.js +0 -153
  24. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/comment.js +0 -80
  25. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/a.js +0 -165
  26. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/canvas.js +0 -138
  27. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/image.js +0 -177
  28. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/input.js +0 -181
  29. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/not-support.js +0 -60
  30. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/option.js +0 -126
  31. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/select.js +0 -155
  32. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/textarea.js +0 -178
  33. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/video.js +0 -165
  34. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-component.js +0 -84
  35. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element/wx-custom-component.js +0 -64
  36. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/element.js +0 -970
  37. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/node.js +0 -140
  38. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style-list.js +0 -28
  39. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/style.js +0 -158
  40. package/template/dist/mp/miniprogram_npm/miniprogram-render/node/text-node.js +0 -127
  41. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/parser.js +0 -269
  42. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/query-selector.js +0 -420
  43. package/template/dist/mp/miniprogram_npm/miniprogram-render/tree/tree.js +0 -130
  44. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/cache.js +0 -95
  45. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/pool.js +0 -24
  46. package/template/dist/mp/miniprogram_npm/miniprogram-render/util/tool.js +0 -131
  47. package/template/dist/mp/miniprogram_npm/miniprogram-render/window.js +0 -651
  48. package/template/generator/app/common.js +0 -17
  49. package/template/generator/app/global-api.js +0 -163
  50. package/template/generator/app/handlers.js +0 -13
  51. package/template/generator/datasources/config.js.tpl +0 -21
  52. package/template/generator/datasources/dataset-profiles.js.tpl +0 -5
  53. package/template/generator/datasources/datasource-profiles.js.tpl +0 -4
  54. package/template/generator/datasources/index.js.tpl +0 -14
  55. package/template/generator/handlers/NodeRenderer.jsx +0 -471
  56. package/template/generator/handlers/RenderWrapper.jsx +0 -145
  57. package/template/generator/index.jsx +0 -116
  58. package/template/generator/index.less +0 -120
  59. package/template/generator/pages/app.tpl +0 -181
  60. package/template/generator/pages/composite.tpl +0 -267
  61. package/template/generator/router/index.tpl +0 -49
  62. package/template/generator/store/computed.js +0 -11
  63. package/template/generator/store/index.js +0 -5
  64. package/template/generator/utils/ScanCodeComponent.js +0 -345
  65. package/template/generator/utils/actionHandler.js +0 -119
  66. package/template/generator/utils/common.js +0 -225
  67. package/template/generator/utils/computed.js +0 -9
  68. package/template/generator/utils/date.js +0 -324
  69. package/template/generator/utils/error.jsx +0 -14
  70. package/template/generator/utils/eventProxy.js +0 -64
  71. package/template/generator/utils/history.js +0 -35
  72. package/template/generator/utils/hooks.js +0 -10
  73. package/template/generator/utils/index.js +0 -41
  74. package/template/generator/utils/initGlobalVar.js +0 -14
  75. package/template/generator/utils/lifecycle.js +0 -158
  76. package/template/generator/utils/monitor-jssdk.min.js +0 -881
  77. package/template/generator/utils/page.js +0 -10
  78. package/template/generator/utils/scan-code-action.js +0 -27
  79. package/template/generator/utils/style.js +0 -81
  80. package/template/generator/utils/widgets.js +0 -343
@@ -1,226 +0,0 @@
1
- const Pool = require('../util/pool')
2
- const cache = require('../util/cache')
3
- const tool = require('../util/tool')
4
-
5
- const pool = new Pool()
6
-
7
- class Attribute {
8
- constructor(element, onUpdate) {
9
- this.$$init(element, onUpdate)
10
- }
11
-
12
- /**
13
- * 创建实例
14
- */
15
- static $$create(element, onUpdate) {
16
- const config = cache.getConfig()
17
-
18
- if (config.optimization.domExtendMultiplexing) {
19
- // 复用 dom 扩展对象
20
- const instance = pool.get()
21
-
22
- if (instance) {
23
- instance.$$init(element, onUpdate)
24
- return instance
25
- }
26
- }
27
-
28
- return new Attribute(element, onUpdate)
29
- }
30
-
31
- /**
32
- * 初始化实例
33
- */
34
- $$init(element, onUpdate) {
35
- this.$_element = element
36
- this.$_doUpdate = onUpdate
37
- this.$_map = {}
38
- this.$_list = []
39
-
40
- this.triggerUpdate()
41
- }
42
-
43
- /**
44
- * 销毁实例
45
- */
46
- $$destroy() {
47
- this.$_element = null
48
- this.$_doUpdate = null
49
- this.$_map = null
50
- this.$_list = null
51
- }
52
-
53
- /**
54
- * 回收实例
55
- */
56
- $$recycle() {
57
- this.$$destroy()
58
-
59
- const config = cache.getConfig()
60
-
61
- if (config.optimization.domExtendMultiplexing) {
62
- // 复用 dom 扩展对象
63
- pool.add(this)
64
- }
65
- }
66
-
67
- /**
68
- * 属性列表,需要动态更新
69
- */
70
- get list() {
71
- return this.$_list
72
- }
73
-
74
- /**
75
- * 设置属性
76
- */
77
- set(name, value) {
78
- const element = this.$_element
79
- const map = this.$_map
80
-
81
- if (name === 'id') {
82
- map.id = value
83
- } else if (name === 'class' || (element.tagName === 'WX-COMPONENT' && name === 'className')) {
84
- element.className = value
85
- } else if (name === 'style') {
86
- element.style.cssText = value
87
- } else if (name.indexOf('data-') === 0) {
88
- const datasetName = tool.toCamel(name.substr(5))
89
- element.dataset[datasetName] = value
90
- } else {
91
- const config = cache.getConfig()
92
-
93
- // 判断 value 是否需要删减
94
- if (typeof value === 'string' && config.optimization.attrValueReduce && value.length > config.optimization.attrValueReduce) {
95
- console.warn(`property "${name}" will be deleted, because it's greater than ${config.optimization.attrValueReduce}`)
96
- value = ''
97
- }
98
-
99
- map[name] = value
100
-
101
- // canvas 如果有 node 对象,需要将 width/height 设置进去
102
- if ((name === 'width' || name === 'height') && element.tagName === 'CANVAS' && element.$$node) {
103
- element.$$node[name] = value
104
- }
105
-
106
- // 其他字段的设置需要触发父组件更新
107
- this.$_doUpdate()
108
- }
109
-
110
- this.triggerUpdate()
111
- }
112
-
113
- /**
114
- * 取属性
115
- */
116
- get(name) {
117
- const element = this.$_element
118
- const map = this.$_map
119
-
120
- if (name === 'id') {
121
- return map.id || ''
122
- } if (name === 'class') {
123
- return element.className
124
- } else if (name === 'style') {
125
- return element.style.cssText
126
- } else if (name.indexOf('data-') === 0) {
127
- const datasetName = tool.toCamel(name.substr(5))
128
- if (!element.$__dataset) return undefined
129
- return element.dataset[datasetName]
130
- } else {
131
- return map[name]
132
- }
133
- }
134
-
135
- /**
136
- * 判断属性是否存在
137
- */
138
- has(name) {
139
- const element = this.$_element
140
- const map = this.$_map
141
-
142
- if (name === 'id') {
143
- return !!element.id
144
- } else if (name === 'class') {
145
- return !!element.className
146
- } else if (name === 'style') {
147
- return !!element.style.cssText
148
- } else if (name.indexOf('data-') === 0) {
149
- const datasetName = tool.toCamel(name.substr(5))
150
- if (!element.$__dataset) return false
151
- return Object.prototype.hasOwnProperty.call(element.dataset, datasetName)
152
- } else {
153
- return Object.prototype.hasOwnProperty.call(map, name)
154
- }
155
- }
156
-
157
- /**
158
- * 删除属性
159
- */
160
- remove(name) {
161
- const element = this.$_element
162
- const map = this.$_map
163
-
164
- if (name === 'id') {
165
- element.id = ''
166
- } else if (name === 'class' || name === 'style') {
167
- this.set(name, '')
168
- } else if (name.indexOf('data-') === 0) {
169
- const datasetName = tool.toCamel(name.substr(5))
170
- if (element.$__dataset) delete element.dataset[datasetName]
171
- } else {
172
- // 其他字段的设置需要触发父组件更新
173
- delete map[name]
174
- this.$_doUpdate()
175
- }
176
-
177
- this.triggerUpdate()
178
- }
179
-
180
- /**
181
- * 更新属性列表
182
- */
183
- triggerUpdate() {
184
- const map = this.$_map
185
- const list = this.$_list
186
-
187
- // 清空旧的列表
188
- list.forEach(item => {
189
- delete list[item.name]
190
- })
191
- delete list.class
192
- delete list.style
193
- list.length = 0
194
-
195
- // 添加新列表
196
- Object.keys(map).forEach(name => {
197
- if (name !== 'id') {
198
- const item = {name, value: map[name]}
199
-
200
- list.push(item)
201
- list[name] = item
202
- }
203
- })
204
-
205
- const idValue = this.get('id')
206
- const classValue = this.get('class')
207
- const styleValue = this.get('style')
208
- if (idValue) {
209
- const item = {name: 'id', value: idValue}
210
- list.push(item)
211
- list.id = item
212
- }
213
- if (classValue) {
214
- const item = {name: 'class', value: classValue}
215
- list.push(item)
216
- list.class = item
217
- }
218
- if (styleValue) {
219
- const item = {name: 'style', value: styleValue}
220
- list.push(item)
221
- list.style = item
222
- }
223
- }
224
- }
225
-
226
- module.exports = Attribute
@@ -1,153 +0,0 @@
1
- /**
2
- * babel extends 无法直接继承 Array,所以换种方法来继承:https://babeljs.io/docs/en/caveats/#classes
3
- */
4
- const Pool = require('../util/pool')
5
- const cache = require('../util/cache')
6
-
7
- const pool = new Pool()
8
-
9
- function ClassList(onUpdate) {
10
- this.$$init(onUpdate)
11
- }
12
-
13
- /**
14
- * 创建实例
15
- */
16
- ClassList.$$create = function(onUpdate) {
17
- const config = cache.getConfig()
18
-
19
- if (config.optimization.domExtendMultiplexing) {
20
- // 复用 dom 扩展对象
21
- const instance = pool.get()
22
-
23
- if (instance) {
24
- instance.$$init(onUpdate)
25
- return instance
26
- }
27
- }
28
-
29
- return new ClassList(onUpdate)
30
- }
31
-
32
- ClassList.prototype = Object.assign([], {
33
- /**
34
- * 初始化实例
35
- */
36
- $$init(onUpdate) {
37
- this.$_doUpdate = onUpdate
38
- },
39
-
40
- /**
41
- * 销毁实例
42
- */
43
- $$destroy() {
44
- this.$_doUpdate = null
45
- this.length = 0
46
- },
47
-
48
- /**
49
- * 回收实例
50
- */
51
- $$recycle() {
52
- this.$$destroy()
53
-
54
- const config = cache.getConfig()
55
-
56
- if (config.optimization.domExtendMultiplexing) {
57
- // 复用 dom 扩展对象
58
- pool.add(this)
59
- }
60
- },
61
-
62
- /**
63
- * 解析 className
64
- */
65
- $$parse(className = '') {
66
- this.length = 0 // 置空当前内容
67
-
68
- className = className.trim()
69
- className = className ? className.split(/\s+/) : []
70
-
71
- for (const item of className) {
72
- this.push(item)
73
- }
74
-
75
- this.$_doUpdate()
76
- },
77
-
78
- /**
79
- * 对外属性和方法
80
- */
81
- item(index) {
82
- return this[index]
83
- },
84
-
85
- contains(className) {
86
- if (typeof className !== 'string') return false
87
-
88
- return this.indexOf(className) !== -1
89
- },
90
-
91
- add(...args) {
92
- let isUpdate = false
93
-
94
- for (let className of args) {
95
- if (typeof className !== 'string') continue
96
-
97
- className = className.trim()
98
-
99
- if (className && this.indexOf(className) === -1) {
100
- this.push(className)
101
- isUpdate = true
102
- }
103
- }
104
-
105
- if (isUpdate) this.$_doUpdate()
106
- },
107
-
108
- remove(...args) {
109
- let isUpdate = false
110
-
111
- for (let className of args) {
112
- if (typeof className !== 'string') continue
113
-
114
- className = className.trim()
115
-
116
- if (!className) continue
117
-
118
- const index = this.indexOf(className)
119
- if (index >= 0) {
120
- this.splice(index, 1)
121
- isUpdate = true
122
- }
123
- }
124
-
125
- if (isUpdate) this.$_doUpdate()
126
- },
127
-
128
- toggle(className, force) {
129
- if (typeof className !== 'string') return false
130
-
131
- className = className.trim()
132
-
133
- if (!className) return false
134
-
135
- const isNotContain = this.indexOf(className) === -1
136
- let action = isNotContain ? 'add' : 'remove'
137
- action = force === true ? 'add' : force === false ? 'remove' : action
138
-
139
- if (action === 'add') {
140
- this.add(className)
141
- } else {
142
- this.remove(className)
143
- }
144
-
145
- return force === true || force === false ? force : isNotContain
146
- },
147
-
148
- toString() {
149
- return this.join(' ')
150
- },
151
- })
152
-
153
- module.exports = ClassList
@@ -1,80 +0,0 @@
1
- const Node = require('./node')
2
- const tool = require('../util/tool')
3
- const Pool = require('../util/pool')
4
- const cache = require('../util/cache')
5
-
6
- const pool = new Pool()
7
-
8
- class Comment extends Node {
9
- /**
10
- * 创建实例
11
- */
12
- static $$create(options, tree) {
13
- const config = cache.getConfig()
14
-
15
- if (config.optimization.commentMultiplexing) {
16
- // 复用 comment 节点
17
- const instance = pool.get()
18
-
19
- if (instance) {
20
- instance.$$init(options, tree)
21
- return instance
22
- }
23
- }
24
-
25
- return new Comment(options, tree)
26
- }
27
-
28
- /**
29
- * 覆写父类的 $$init 方法
30
- */
31
- $$init(options, tree) {
32
- options.type = 'comment'
33
-
34
- super.$$init(options, tree)
35
- }
36
-
37
- /**
38
- * 回收实例
39
- */
40
- $$recycle() {
41
- this.$$destroy()
42
-
43
- const config = cache.getConfig()
44
-
45
- if (config.optimization.commentMultiplexing) {
46
- // 复用 comment 节点
47
- pool.add(this)
48
- }
49
- }
50
-
51
- /**
52
- * 对应的 dom 信息
53
- */
54
- get $$domInfo() {
55
- return {
56
- nodeId: this.$_nodeId,
57
- pageId: this.$_pageId,
58
- type: this.$_type,
59
- }
60
- }
61
-
62
- /**
63
- * 对外属性和方法
64
- */
65
- get nodeName() {
66
- return '#comment'
67
- }
68
-
69
- get nodeType() {
70
- return Node.COMMENT_NODE
71
- }
72
-
73
- cloneNode() {
74
- return this.ownerDocument.$$createComment({
75
- nodeId: `b-${tool.getId()}`, // 运行时生成,使用 b- 前缀
76
- })
77
- }
78
- }
79
-
80
- module.exports = Comment
@@ -1,165 +0,0 @@
1
- const Element = require('../element')
2
- const Location = require('../../bom/location')
3
- const cache = require('../../util/cache')
4
- const Pool = require('../../util/pool')
5
- const tool = require('../../util/tool')
6
-
7
- const pool = new Pool()
8
-
9
- class HTMLAnchorElement extends Element {
10
- /**
11
- * 创建实例
12
- */
13
- static $$create(options, tree) {
14
- const config = cache.getConfig()
15
-
16
- if (config.optimization.elementMultiplexing) {
17
- // 复用 element 节点
18
- const instance = pool.get()
19
-
20
- if (instance) {
21
- instance.$$init(options, tree)
22
- return instance
23
- }
24
- }
25
-
26
- return new HTMLAnchorElement(options, tree)
27
- }
28
-
29
- /**
30
- * 覆写父类的 $$init 方法
31
- */
32
- $$init(options, tree) {
33
- super.$$init(options, tree)
34
-
35
- this.$_protocol = 'http:'
36
- this.$_hostname = ''
37
- this.$_port = ''
38
- this.$_pathname = '/'
39
- this.$_search = ''
40
- this.$_hash = ''
41
- }
42
-
43
- /**
44
- * 覆写父类的 $$destroy 方法
45
- */
46
- $$destroy() {
47
- super.$$destroy()
48
-
49
- this.$_protocol = null
50
- this.$_hostname = null
51
- this.$_port = null
52
- this.$_pathname = null
53
- this.$_search = null
54
- this.$_hash = null
55
- }
56
-
57
- /**
58
- * 覆写父类的回收实例方法
59
- */
60
- $$recycle() {
61
- this.$_children.forEach(child => child.$$recycle())
62
- this.$$destroy()
63
-
64
- const config = cache.getConfig()
65
-
66
- if (config.optimization.elementMultiplexing) {
67
- // 复用 element 节点
68
- pool.add(this)
69
- }
70
- }
71
-
72
- /**
73
- * 调用 $_generateHtml 接口时用于处理额外的属性,
74
- */
75
- $$dealWithAttrsForGenerateHtml(html, node) {
76
- const href = node.href
77
- if (href) html += ` href="${tool.escapeForHtmlGeneration(href)}"`
78
-
79
- const target = node.target
80
- if (target) html += ` target="${tool.escapeForHtmlGeneration(target)}"`
81
-
82
- return html
83
- }
84
-
85
- /**
86
- * 调用 outerHTML 的 setter 时用于处理额外的属性
87
- */
88
- $$dealWithAttrsForOuterHTML(node) {
89
- this.href = node.href || ''
90
- this.target = node.target || ''
91
- }
92
-
93
- /**
94
- * 调用 cloneNode 接口时用于处理额外的属性
95
- */
96
- $$dealWithAttrsForCloneNode() {
97
- return {
98
- href: this.href,
99
- target: this.target,
100
- }
101
- }
102
-
103
- /**
104
- * 对外属性和方法
105
- */
106
- get href() {
107
- return this.$_attrs.get('href')
108
- }
109
-
110
- set href(value) {
111
- value = '' + value
112
-
113
- if (value.indexOf('//') === -1) {
114
- const {origin} = cache.getConfig()
115
- value = origin + (value[0] === '/' ? value : `/${value}`)
116
- }
117
-
118
- this.$_attrs.set('href', value)
119
- const {
120
- protocol, hostname, port, pathname, search, hash
121
- } = Location.$$parse(value)
122
-
123
- this.$_protocol = protocol || this.$_protocol
124
- this.$_hostname = hostname || this.$_hostname
125
- this.$_port = port || ''
126
- this.$_pathname = pathname || '/'
127
- this.$_search = search || ''
128
- this.$_hash = hash || ''
129
- }
130
-
131
- get protocol() {
132
- return this.$_protocol
133
- }
134
-
135
- get hostname() {
136
- return this.$_hostname
137
- }
138
-
139
- get port() {
140
- return this.$_port
141
- }
142
-
143
- get pathname() {
144
- return this.$_pathname
145
- }
146
-
147
- get search() {
148
- return this.$_search
149
- }
150
-
151
- get hash() {
152
- return this.$_hash
153
- }
154
-
155
- get target() {
156
- return this.$_attrs.get('target')
157
- }
158
-
159
- set target(value) {
160
- value = '' + value
161
- this.$_attrs.set('target', value)
162
- }
163
- }
164
-
165
- module.exports = HTMLAnchorElement