@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,140 +0,0 @@
1
- const EventTarget = require('../event/event-target')
2
- const cache = require('../util/cache')
3
-
4
- class Node extends EventTarget {
5
- /**
6
- * 覆写父类的 $$init 方法
7
- */
8
- $$init(options, tree) {
9
- super.$$init()
10
-
11
- this.$_nodeId = options.nodeId // 唯一标识
12
- this.$_type = options.type
13
- this.$_parentNode = null
14
- this.$_tree = tree
15
- this.$_pageId = tree.pageId
16
- }
17
-
18
- /**
19
- * 覆写父类的 $$destroy 方法
20
- */
21
- $$destroy() {
22
- super.$$destroy()
23
-
24
- this.$_nodeId = null
25
- this.$_type = null
26
- this.$_parentNode = null
27
- this.$_tree = null
28
- this.$_pageId = null
29
- }
30
-
31
- /**
32
- * 内部 nodeId
33
- */
34
- get $$nodeId() {
35
- return this.$_nodeId
36
- }
37
-
38
- /**
39
- * 内部 pageId
40
- */
41
- get $$pageId() {
42
- return this.$_pageId
43
- }
44
-
45
- /**
46
- * 更新 parentNode
47
- */
48
- $$updateParent(parentNode = null) {
49
- this.$_parentNode = parentNode
50
- }
51
-
52
- /**
53
- * 对外属性和方法
54
- */
55
- get parentNode() {
56
- return this.$_parentNode
57
- }
58
-
59
- get nodeValue() {
60
- return null
61
- }
62
-
63
- get previousSibling() {
64
- const childNodes = this.parentNode && this.parentNode.childNodes || []
65
- const index = childNodes.indexOf(this)
66
-
67
- if (index > 0) {
68
- return childNodes[index - 1]
69
- }
70
-
71
- return null
72
- }
73
-
74
- get previousElementSibling() {
75
- const childNodes = this.parentNode && this.parentNode.childNodes || []
76
- const index = childNodes.indexOf(this)
77
-
78
- if (index > 0) {
79
- for (let i = index - 1; i >= 0; i--) {
80
- if (childNodes[i].nodeType === Node.ELEMENT_NODE) {
81
- return childNodes[i]
82
- }
83
- }
84
- }
85
-
86
- return null
87
- }
88
-
89
- get nextSibling() {
90
- const childNodes = this.parentNode && this.parentNode.childNodes || []
91
- const index = childNodes.indexOf(this)
92
-
93
- return childNodes[index + 1] || null
94
- }
95
-
96
- get nextElementSibling() {
97
- const childNodes = this.parentNode && this.parentNode.childNodes || []
98
- const index = childNodes.indexOf(this)
99
-
100
- if (index < childNodes.length - 1) {
101
- for (let i = index + 1, len = childNodes.length; i < len; i++) {
102
- if (childNodes[i].nodeType === Node.ELEMENT_NODE) {
103
- return childNodes[i]
104
- }
105
- }
106
- }
107
-
108
- return null
109
- }
110
-
111
- get ownerDocument() {
112
- return cache.getDocument(this.$_pageId) || null
113
- }
114
-
115
- get childNodes() {
116
- return []
117
- }
118
-
119
- hasChildNodes() {
120
- return false
121
- }
122
-
123
- remove() {
124
- if (!this.parentNode || !this.parentNode.removeChild) return this
125
-
126
- return this.parentNode.removeChild(this)
127
- }
128
- }
129
-
130
- // 静态属性
131
- Node.ELEMENT_NODE = 1
132
- Node.TEXT_NODE = 3
133
- Node.CDATA_SECTION_NODE = 4
134
- Node.PROCESSING_INSTRUCTION_NODE = 7
135
- Node.COMMENT_NODE = 8
136
- Node.DOCUMENT_NODE = 9
137
- Node.DOCUMENT_TYPE_NODE = 10
138
- Node.DOCUMENT_FRAGMENT_NODE = 11
139
-
140
- module.exports = Node
@@ -1,28 +0,0 @@
1
- /**
2
- * 支持的样式属性列表,默认只包含常用的样式属性
3
- */
4
-
5
- module.exports = [
6
- 'position', 'top', 'bottom', 'right', 'left', 'float', 'clear',
7
- 'display', 'width', 'height', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'flex', 'flexBasis', 'flexGrow', 'flexShrink', 'flexDirection', 'flexWrap', 'justifyContent', 'alignItems', 'order',
8
- 'padding', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop',
9
- 'margin', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop',
10
-
11
- 'background', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPosition', 'backgroundRepeat', 'backgroundSize',
12
- 'border', 'borderRadius', 'borderBottomColor', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStyle', 'borderBottomWidth', 'borderCollapse', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStyle', 'borderTopWidth',
13
- 'borderTop', 'borderBottom', 'borderRight', 'borderLeft',
14
- 'outline', 'borderWidth', 'borderStyle', 'borderColor',
15
-
16
- 'animation', 'animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction',
17
- 'transition', 'transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction',
18
- 'transform', 'transformOrigin', 'perspective', 'perspectiveOrigin', 'backfaceVisibility',
19
-
20
- 'font', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight',
21
- 'color', 'textAlign', 'textDecoration', 'textIndent', 'textRendering', 'textShadow', 'textOverflow', 'textTransform',
22
- 'wordBreak', 'wordSpacing', 'wordWrap', 'lineHeight', 'letterSpacing', 'whiteSpace', 'userSelect',
23
-
24
- 'visibility', 'opacity', 'zIndex', 'zoom', 'overflow', 'overflowX', 'overflowY',
25
- 'boxShadow', 'boxSizing', 'content', 'cursor', 'direction', 'listStyle', 'objectFit', 'pointerEvents', 'resize', 'verticalAlign', 'willChange', 'clip', 'clipPath', 'fill',
26
-
27
- 'touchAction', 'WebkitAppearance'
28
- ]
@@ -1,158 +0,0 @@
1
- const styleList = require('./style-list')
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
- /**
9
- * 解析样式串
10
- */
11
- function parse(styleText) {
12
- const rules = {}
13
-
14
- if (styleText) {
15
- styleText = tool.decodeContent(styleText)
16
- styleText = styleText.replace(/url\([^)]+\)/ig, all => all.replace(/;/ig, ':#||#:')) // 先处理值里面的分号
17
- styleText.split(';').forEach(rule => {
18
- rule = rule.trim()
19
- if (!rule) return
20
-
21
- const split = rule.indexOf(':')
22
- if (split === -1) return
23
-
24
- const name = tool.toCamel(rule.substr(0, split).trim())
25
- rules[name] = rule.substr(split + 1).replace(/:#\|\|#:/ig, ';').trim()
26
- })
27
- }
28
-
29
- return rules
30
- }
31
-
32
- class Style {
33
- constructor(onUpdate) {
34
- this.$$init(onUpdate)
35
- }
36
-
37
- /**
38
- * 创建实例
39
- */
40
- static $$create(onUpdate) {
41
- const config = cache.getConfig()
42
-
43
- if (config.optimization.domExtendMultiplexing) {
44
- // 复用 dom 扩展对象
45
- const instance = pool.get()
46
-
47
- if (instance) {
48
- instance.$$init(onUpdate)
49
- return instance
50
- }
51
- }
52
-
53
- return new Style(onUpdate)
54
- }
55
-
56
- /**
57
- * 初始化实例
58
- */
59
- $$init(onUpdate) {
60
- this.$_doUpdate = onUpdate || (() => {})
61
- this.$_disableCheckUpdate = false // 是否禁止检查更新
62
- }
63
-
64
- /**
65
- * 销毁实例
66
- */
67
- $$destroy() {
68
- this.$_doUpdate = null
69
- this.$_disableCheckUpdate = false
70
-
71
- styleList.forEach(name => {
72
- this[`$_${name}`] = undefined
73
- })
74
- }
75
-
76
- /**
77
- * 回收实例
78
- */
79
- $$recycle() {
80
- this.$$destroy()
81
-
82
- const config = cache.getConfig()
83
-
84
- if (config.optimization.domExtendMultiplexing) {
85
- // 复用 dom 扩展对象
86
- pool.add(this)
87
- }
88
- }
89
-
90
- /**
91
- * 检查更新
92
- */
93
- $_checkUpdate() {
94
- if (!this.$_disableCheckUpdate) {
95
- this.$_doUpdate()
96
- }
97
- }
98
-
99
- /**
100
- * 对外属性和方法
101
- */
102
- get cssText() {
103
- const joinText = styleList.filter(name => this[`$_${name}`]).map(name => `${tool.toDash(name)}:${this['$_' + name]}`).join(';').trim()
104
- return joinText ? `${joinText};` : ''
105
- }
106
-
107
- set cssText(styleText) {
108
- if (typeof styleText !== 'string') return
109
-
110
- styleText = styleText.replace(/"/g, '\'')
111
-
112
- // 解析样式
113
- const rules = parse(styleText)
114
-
115
- this.$_disableCheckUpdate = true // 将每条规则的设置合并为一次更新
116
- for (const name of styleList) {
117
- this[name] = rules[name]
118
- }
119
- this.$_disableCheckUpdate = false
120
- this.$_checkUpdate()
121
- }
122
-
123
- getPropertyValue(name) {
124
- if (typeof name !== 'string') return ''
125
-
126
- name = tool.toCamel(name)
127
- return this[name] || ''
128
- }
129
- }
130
-
131
- /**
132
- * 设置各个属性的 getter、setter
133
- */
134
- const properties = {}
135
- styleList.forEach(name => {
136
- properties[name] = {
137
- get() {
138
- return this[`$_${name}`] || ''
139
- },
140
- set(value) {
141
- const config = cache.getConfig()
142
- const oldValue = this[`$_${name}`]
143
- value = value !== undefined ? '' + value : undefined
144
-
145
- // 判断 value 是否需要删减
146
- if (value && config.optimization.styleValueReduce && value.length > config.optimization.styleValueReduce) {
147
- console.warn(`property "${name}" will be deleted, because it's greater than ${config.optimization.styleValueReduce}`)
148
- value = undefined
149
- }
150
-
151
- this[`$_${name}`] = value
152
- if (oldValue !== value) this.$_checkUpdate()
153
- },
154
- }
155
- })
156
- Object.defineProperties(Style.prototype, properties)
157
-
158
- module.exports = Style
@@ -1,127 +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 TextNode extends Node {
9
- /**
10
- * 创建实例
11
- */
12
- static $$create(options, tree) {
13
- const config = cache.getConfig()
14
-
15
- if (config.optimization.textMultiplexing) {
16
- // 复用 text 节点
17
- const instance = pool.get()
18
-
19
- if (instance) {
20
- instance.$$init(options, tree)
21
- return instance
22
- }
23
- }
24
-
25
- return new TextNode(options, tree)
26
- }
27
-
28
- /**
29
- * 覆写父类的 $$init 方法
30
- */
31
- $$init(options, tree) {
32
- options.type = 'text'
33
-
34
- super.$$init(options, tree)
35
-
36
- this.$_content = options.content || ''
37
- }
38
-
39
- /**
40
- * 覆写父类的 $$destroy 方法
41
- */
42
- $$destroy() {
43
- super.$$destroy()
44
-
45
- this.$_content = ''
46
- }
47
-
48
- /**
49
- * 回收实例
50
- */
51
- $$recycle() {
52
- this.$$destroy()
53
-
54
- const config = cache.getConfig()
55
-
56
- if (config.optimization.textMultiplexing) {
57
- // 复用 text 节点
58
- pool.add(this)
59
- }
60
- }
61
-
62
- /**
63
- * 更新父组件树
64
- */
65
- $_triggerParentUpdate() {
66
- if (this.parentNode) this.parentNode.$$trigger('$$childNodesUpdate')
67
- }
68
-
69
- /**
70
- * 对应的 dom 信息
71
- */
72
- get $$domInfo() {
73
- return {
74
- nodeId: this.$_nodeId,
75
- pageId: this.$_pageId,
76
- type: this.$_type,
77
- content: this.$_content,
78
- }
79
- }
80
-
81
- /**
82
- * 对外属性和方法
83
- */
84
- get nodeName() {
85
- return '#text'
86
- }
87
-
88
- get nodeType() {
89
- return Node.TEXT_NODE
90
- }
91
-
92
- get nodeValue() {
93
- return this.textContent
94
- }
95
-
96
- set nodeValue(value) {
97
- this.textContent = value
98
- }
99
-
100
- get textContent() {
101
- return this.$_content
102
- }
103
-
104
- set textContent(value) {
105
- value += ''
106
-
107
- this.$_content = value
108
- this.$_triggerParentUpdate()
109
- }
110
-
111
- get data() {
112
- return this.textContent
113
- }
114
-
115
- set data(value) {
116
- this.textContent = value
117
- }
118
-
119
- cloneNode() {
120
- return this.ownerDocument.$$createTextNode({
121
- content: this.$_content,
122
- nodeId: `b-${tool.getId()}`, // 运行时生成,使用 b- 前缀
123
- })
124
- }
125
- }
126
-
127
- module.exports = TextNode