pixifact 0.1.3 → 0.1.4

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 (185) hide show
  1. package/README.md +3 -3
  2. package/dist/builtin-scenes/CenterContainer.d.ts +13 -0
  3. package/dist/builtin-scenes/CenterContainer.js +71 -0
  4. package/dist/builtin-scenes/CenterContainer.scene +3 -0
  5. package/dist/builtin-scenes/CenterContainer.ts +77 -0
  6. package/dist/builtin-scenes/Control.d.ts +44 -0
  7. package/dist/builtin-scenes/Control.js +206 -0
  8. package/dist/builtin-scenes/Control.scene +3 -0
  9. package/dist/builtin-scenes/Control.ts +233 -0
  10. package/dist/builtin-scenes/FlexItem.d.ts +45 -0
  11. package/dist/builtin-scenes/FlexItem.js +164 -0
  12. package/dist/builtin-scenes/FlexItem.scene +3 -0
  13. package/dist/builtin-scenes/FlexItem.ts +180 -0
  14. package/dist/builtin-scenes/FlexLayout.d.ts +29 -0
  15. package/dist/builtin-scenes/FlexLayout.js +358 -0
  16. package/dist/builtin-scenes/FlexLayout.scene +3 -0
  17. package/dist/builtin-scenes/FlexLayout.ts +409 -0
  18. package/dist/builtin-scenes/HBoxContainer.d.ts +15 -0
  19. package/dist/builtin-scenes/HBoxContainer.js +70 -0
  20. package/dist/builtin-scenes/HBoxContainer.scene +3 -0
  21. package/dist/builtin-scenes/HBoxContainer.ts +75 -0
  22. package/dist/builtin-scenes/MarginContainer.d.ts +23 -0
  23. package/dist/builtin-scenes/MarginContainer.js +131 -0
  24. package/dist/builtin-scenes/MarginContainer.scene +3 -0
  25. package/dist/builtin-scenes/MarginContainer.ts +139 -0
  26. package/dist/builtin-scenes/VBoxContainer.d.ts +15 -0
  27. package/dist/builtin-scenes/VBoxContainer.js +70 -0
  28. package/dist/builtin-scenes/VBoxContainer.scene +3 -0
  29. package/dist/builtin-scenes/VBoxContainer.ts +75 -0
  30. package/dist/builtin-scenes/controlLayout.d.ts +57 -0
  31. package/dist/builtin-scenes/controlLayout.js +202 -0
  32. package/dist/builtin-scenes/controlLayout.ts +270 -0
  33. package/dist/compiler/builtinScenes.d.ts +14 -0
  34. package/dist/compiler/builtinScenes.js +62 -0
  35. package/dist/compiler/compileScenes.js +126 -19
  36. package/dist/compiler/decorators.js +3 -0
  37. package/dist/compiler/index.d.ts +1 -0
  38. package/dist/compiler/index.js +1 -0
  39. package/dist/compiler/sceneAssetPair.js +19 -0
  40. package/dist/compiler/sceneRuntime.d.ts +5 -4
  41. package/dist/compiler/scriptInterfaceExtractor.d.ts +5 -0
  42. package/dist/compiler/scriptInterfaceExtractor.js +214 -8
  43. package/dist/compiler/spec.d.ts +2 -0
  44. package/dist/compiler/templateParser.js +4 -3
  45. package/dist/compiler/templateSerializer.js +2 -1
  46. package/dist/compiler/typescriptCompiler.js +87 -13
  47. package/dist/compiler-node/builtinSceneAssets.d.ts +8 -0
  48. package/dist/compiler-node/builtinSceneAssets.js +57 -0
  49. package/dist/compiler-node/index.d.ts +1 -0
  50. package/dist/compiler-node/index.js +1 -0
  51. package/dist/errors.d.ts +1 -0
  52. package/dist/errors.js +24 -0
  53. package/dist/index.d.ts +2 -5
  54. package/dist/index.js +2 -5
  55. package/dist/{authoring/ProjectConfig.d.ts → project/index.d.ts} +7 -0
  56. package/dist/{authoring/ProjectConfig.js → project/index.js} +22 -0
  57. package/dist/runtime/Group.d.ts +18 -0
  58. package/dist/runtime/Group.js +45 -0
  59. package/dist/runtime/index.d.ts +1 -9
  60. package/dist/runtime/index.js +1 -9
  61. package/package.json +4 -26
  62. package/dist/authoring/ActionRegistry.d.ts +0 -10
  63. package/dist/authoring/ActionRegistry.js +0 -26
  64. package/dist/authoring/ComponentPalette.d.ts +0 -16
  65. package/dist/authoring/ComponentPalette.js +0 -50
  66. package/dist/authoring/DesignToken.d.ts +0 -16
  67. package/dist/authoring/DesignToken.js +0 -33
  68. package/dist/authoring/DiffModel.d.ts +0 -10
  69. package/dist/authoring/DiffModel.js +0 -104
  70. package/dist/authoring/InspectorModel.d.ts +0 -27
  71. package/dist/authoring/InspectorModel.js +0 -139
  72. package/dist/authoring/LogicGraph.d.ts +0 -66
  73. package/dist/authoring/LogicGraph.js +0 -184
  74. package/dist/authoring/OverrideJournal.d.ts +0 -18
  75. package/dist/authoring/OverrideJournal.js +0 -23
  76. package/dist/authoring/PreferenceMemory.d.ts +0 -21
  77. package/dist/authoring/PreferenceMemory.js +0 -39
  78. package/dist/authoring/RuntimePreview.d.ts +0 -11
  79. package/dist/authoring/RuntimePreview.js +0 -25
  80. package/dist/authoring/SceneDocument.d.ts +0 -74
  81. package/dist/authoring/SceneDocument.js +0 -332
  82. package/dist/authoring/SceneProjectState.d.ts +0 -20
  83. package/dist/authoring/SceneProjectState.js +0 -8
  84. package/dist/authoring/SceneSelection.d.ts +0 -11
  85. package/dist/authoring/SceneSelection.js +0 -1
  86. package/dist/authoring/index.d.ts +0 -13
  87. package/dist/authoring/index.js +0 -13
  88. package/dist/commands/Command.d.ts +0 -63
  89. package/dist/commands/Command.js +0 -1
  90. package/dist/commands/CommandStack.d.ts +0 -14
  91. package/dist/commands/CommandStack.js +0 -45
  92. package/dist/commands/applyCommand.d.ts +0 -23
  93. package/dist/commands/applyCommand.js +0 -316
  94. package/dist/commands/index.d.ts +0 -4
  95. package/dist/commands/index.js +0 -4
  96. package/dist/commands/utils.d.ts +0 -17
  97. package/dist/commands/utils.js +0 -77
  98. package/dist/commands/validateCommand.d.ts +0 -12
  99. package/dist/commands/validateCommand.js +0 -285
  100. package/dist/nodes/Input.d.ts +0 -91
  101. package/dist/nodes/Input.js +0 -352
  102. package/dist/nodes/Textarea.d.ts +0 -10
  103. package/dist/nodes/Textarea.js +0 -38
  104. package/dist/nodes/components/Button.d.ts +0 -8
  105. package/dist/nodes/components/Button.js +0 -45
  106. package/dist/nodes/components/InputField.d.ts +0 -12
  107. package/dist/nodes/components/InputField.js +0 -53
  108. package/dist/nodes/components/ProgressBar.d.ts +0 -14
  109. package/dist/nodes/components/ProgressBar.js +0 -66
  110. package/dist/nodes/components/ScrollRect.d.ts +0 -23
  111. package/dist/nodes/components/ScrollRect.js +0 -108
  112. package/dist/nodes/components/Selectable.d.ts +0 -32
  113. package/dist/nodes/components/Selectable.js +0 -153
  114. package/dist/nodes/components/index.d.ts +0 -5
  115. package/dist/nodes/components/index.js +0 -5
  116. package/dist/nodes/graphics/Graphic.d.ts +0 -14
  117. package/dist/nodes/graphics/Graphic.js +0 -47
  118. package/dist/nodes/graphics/ImageGraphic.d.ts +0 -9
  119. package/dist/nodes/graphics/ImageGraphic.js +0 -42
  120. package/dist/nodes/graphics/RoundedRectGraphic.d.ts +0 -13
  121. package/dist/nodes/graphics/RoundedRectGraphic.js +0 -65
  122. package/dist/nodes/graphics/TextGraphic.d.ts +0 -13
  123. package/dist/nodes/graphics/TextGraphic.js +0 -70
  124. package/dist/nodes/graphics/index.d.ts +0 -4
  125. package/dist/nodes/graphics/index.js +0 -4
  126. package/dist/nodes/index.d.ts +0 -3
  127. package/dist/nodes/index.js +0 -3
  128. package/dist/runtime/Application.d.ts +0 -15
  129. package/dist/runtime/Application.js +0 -67
  130. package/dist/runtime/GameObject.d.ts +0 -100
  131. package/dist/runtime/GameObject.js +0 -297
  132. package/dist/runtime/GameObjectEvent.d.ts +0 -52
  133. package/dist/runtime/GameObjectEvent.js +0 -38
  134. package/dist/runtime/Transform.d.ts +0 -32
  135. package/dist/runtime/Transform.js +0 -157
  136. package/dist/runtime/component/Component.d.ts +0 -13
  137. package/dist/runtime/component/Component.js +0 -13
  138. package/dist/runtime/component/ComponentRegistry.d.ts +0 -49
  139. package/dist/runtime/component/ComponentRegistry.js +0 -25
  140. package/dist/runtime/component/Flex.d.ts +0 -6
  141. package/dist/runtime/component/Flex.js +0 -15
  142. package/dist/runtime/component/FlexGroup.d.ts +0 -26
  143. package/dist/runtime/component/FlexGroup.js +0 -136
  144. package/dist/runtime/component/GridLayout.d.ts +0 -47
  145. package/dist/runtime/component/GridLayout.js +0 -129
  146. package/dist/runtime/component/Layout.d.ts +0 -104
  147. package/dist/runtime/component/Layout.js +0 -248
  148. package/dist/runtime/component/decorators.d.ts +0 -4
  149. package/dist/runtime/component/decorators.js +0 -52
  150. package/dist/runtime/component/index.d.ts +0 -7
  151. package/dist/runtime/component/index.js +0 -7
  152. package/dist/runtime/graphics/index.d.ts +0 -11
  153. package/dist/runtime/graphics/index.js +0 -29
  154. package/dist/runtime/group/index.d.ts +0 -39
  155. package/dist/runtime/group/index.js +0 -102
  156. package/dist/runtime/image/Image.d.ts +0 -19
  157. package/dist/runtime/image/Image.js +0 -60
  158. package/dist/runtime/image/NineSliceImage.d.ts +0 -23
  159. package/dist/runtime/image/NineSliceImage.js +0 -64
  160. package/dist/runtime/image/index.d.ts +0 -2
  161. package/dist/runtime/image/index.js +0 -2
  162. package/dist/runtime/label/Label.d.ts +0 -11
  163. package/dist/runtime/label/Label.js +0 -26
  164. package/dist/runtime/label/LabelStyle.d.ts +0 -3
  165. package/dist/runtime/label/LabelStyle.js +0 -3
  166. package/dist/runtime/label/index.d.ts +0 -2
  167. package/dist/runtime/label/index.js +0 -2
  168. package/dist/runtime/utils/index.d.ts +0 -1
  169. package/dist/runtime/utils/index.js +0 -1
  170. package/dist/runtime/utils/onlyOnceQueueMicrotask.d.ts +0 -1
  171. package/dist/runtime/utils/onlyOnceQueueMicrotask.js +0 -12
  172. package/dist/runtime/utils/setProps.d.ts +0 -10
  173. package/dist/runtime/utils/setProps.js +0 -17
  174. package/dist/scene/dsl.d.ts +0 -25
  175. package/dist/scene/dsl.js +0 -112
  176. package/dist/scene/index.d.ts +0 -5
  177. package/dist/scene/index.js +0 -5
  178. package/dist/scene/instantiate.d.ts +0 -8
  179. package/dist/scene/instantiate.js +0 -208
  180. package/dist/scene/nodesDsl.d.ts +0 -42
  181. package/dist/scene/nodesDsl.js +0 -169
  182. package/dist/scene/spec.d.ts +0 -100
  183. package/dist/scene/spec.js +0 -1
  184. package/dist/scene/templates.d.ts +0 -21
  185. package/dist/scene/templates.js +0 -239
@@ -1,285 +0,0 @@
1
- import { ComponentRegistry } from "../runtime/index.js";
2
- import { findComponent, findNode, hasDuplicateComponentId, hasDuplicateNodeId, isDescendant } from "./utils.js";
3
- import { actionExists } from "../authoring/ActionRegistry.js";
4
- function ok() {
5
- return { ok: true };
6
- }
7
- function fail(error) {
8
- return { ok: false, error };
9
- }
10
- function canContainChildNode(node, root) {
11
- return node === root || node.kind === 'container';
12
- }
13
- function validateChildParent(parent, root) {
14
- return canContainChildNode(parent, root)
15
- ? ok()
16
- : fail('Only container nodes can contain child nodes.');
17
- }
18
- function validateNodeSpec(node) {
19
- if (!['container', 'image', 'text', 'input', 'shape'].includes(node.kind)) {
20
- return fail('Node kind must be one of: container, image, text, input, shape.');
21
- }
22
- if (node.kind !== 'container' && Array.isArray(node.children) && node.children.length > 0) {
23
- return fail('Only container nodes can declare children.');
24
- }
25
- if (node.kind === 'container') {
26
- for (const child of node.children ?? []) {
27
- const result = validateNodeSpec(child);
28
- if (!result.ok) {
29
- return result;
30
- }
31
- }
32
- }
33
- return ok();
34
- }
35
- function validateValue(prop, value, context = {}) {
36
- if (value === undefined) {
37
- return ok();
38
- }
39
- switch (prop.type) {
40
- case 'number':
41
- case 'color':
42
- return typeof value === 'number' ? ok() : fail(`Prop "${prop.key}" expects a number.`);
43
- case 'string':
44
- return typeof value === 'string' ? ok() : fail(`Prop "${prop.key}" expects a string.`);
45
- case 'event':
46
- if (typeof value !== 'string') {
47
- return fail(`Prop "${prop.key}" expects an action key string.`);
48
- }
49
- if (context.actions && !actionExists(context.actions, value)) {
50
- return fail(`Action "${value}" is not declared in the project action registry.`);
51
- }
52
- return ok();
53
- case 'assetRef':
54
- case 'nodeRef':
55
- case 'componentRef':
56
- return typeof value === 'string' || (typeof value === 'object' && value !== null)
57
- ? ok()
58
- : fail(`Prop "${prop.key}" expects a reference or string value.`);
59
- case 'boolean':
60
- return typeof value === 'boolean' ? ok() : fail(`Prop "${prop.key}" expects a boolean.`);
61
- case 'enum':
62
- return prop.options?.includes(value)
63
- ? ok()
64
- : fail(`Prop "${prop.key}" expects one of: ${(prop.options ?? []).join(', ')}.`);
65
- case 'vec2':
66
- case 'rect':
67
- return typeof value === 'object' && value !== null ? ok() : fail(`Prop "${prop.key}" expects an object.`);
68
- default:
69
- return ok();
70
- }
71
- }
72
- function displayProp(type, key, options) {
73
- return {
74
- key,
75
- type,
76
- options,
77
- };
78
- }
79
- const nodeDataProps = {
80
- image: [
81
- displayProp('enum', 'mode', ['sprite', 'nineSlice']),
82
- displayProp('assetRef', 'src'),
83
- displayProp('color', 'tint'),
84
- displayProp('number', 'leftWidth'),
85
- displayProp('number', 'rightWidth'),
86
- displayProp('number', 'topHeight'),
87
- displayProp('number', 'bottomHeight'),
88
- ],
89
- text: [
90
- displayProp('string', 'value'),
91
- displayProp('color', 'color'),
92
- displayProp('number', 'fontSize'),
93
- displayProp('string', 'fontFamily'),
94
- displayProp('enum', 'fontWeight', ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900']),
95
- displayProp('boolean', 'center'),
96
- ],
97
- input: [
98
- displayProp('string', 'value'),
99
- displayProp('color', 'backgroundColor'),
100
- displayProp('color', 'borderColor'),
101
- displayProp('number', 'borderSize'),
102
- displayProp('string', 'textColor'),
103
- displayProp('number', 'fontSize'),
104
- displayProp('string', 'fontFamily'),
105
- displayProp('number', 'paddingLeft'),
106
- displayProp('number', 'paddingRight'),
107
- displayProp('number', 'paddingTop'),
108
- displayProp('number', 'paddingBottom'),
109
- ],
110
- shape: [
111
- displayProp('enum', 'type', ['rect', 'roundedRect']),
112
- displayProp('color', 'color'),
113
- displayProp('number', 'fillAlpha'),
114
- displayProp('number', 'radius'),
115
- displayProp('color', 'strokeColor'),
116
- displayProp('number', 'strokeWidth'),
117
- displayProp('number', 'strokeAlpha'),
118
- ],
119
- };
120
- function validateSetNodeData(scene, command) {
121
- const locatedNode = findNode(scene, command.node);
122
- if (!locatedNode) {
123
- return fail(`Node "${command.node}" was not found.`);
124
- }
125
- if (locatedNode.node.kind !== command.field) {
126
- return fail(`Node "${command.node}" is ${locatedNode.node.kind}, not ${command.field}.`);
127
- }
128
- const prop = nodeDataProps[command.field].find((candidate) => candidate.key === command.prop);
129
- if (!prop) {
130
- return fail(`Node data prop "${command.prop}" does not exist on ${command.field}.`);
131
- }
132
- return validateValue(prop, command.value);
133
- }
134
- function validateComponentSpec(component, context = {}) {
135
- const schema = ComponentRegistry.get(component.type);
136
- if (!schema) {
137
- return fail(`Unknown component type "${component.type}".`);
138
- }
139
- for (const [key, value] of Object.entries(component.props ?? {})) {
140
- const prop = schema.props.find((candidate) => candidate.key === key);
141
- if (!prop) {
142
- return fail(`Prop "${key}" does not exist on ${component.type}.`);
143
- }
144
- const result = validateValue(prop, value, context);
145
- if (!result.ok) {
146
- return result;
147
- }
148
- }
149
- return ok();
150
- }
151
- function validateSetComponentProp(scene, command, context = {}) {
152
- const locatedNode = findNode(scene, command.node);
153
- if (!locatedNode) {
154
- return fail(`Node "${command.node}" was not found.`);
155
- }
156
- const locatedComponent = findComponent(locatedNode.node, command.component);
157
- if (!locatedComponent) {
158
- return fail(`Component "${command.component}" was not found on node "${command.node}".`);
159
- }
160
- const schema = ComponentRegistry.get(locatedComponent.component.type);
161
- if (!schema) {
162
- return fail(`Unknown component type "${locatedComponent.component.type}".`);
163
- }
164
- const prop = schema.props.find((candidate) => candidate.key === command.prop);
165
- if (!prop) {
166
- return fail(`Prop "${command.prop}" does not exist on ${schema.type}.`);
167
- }
168
- return validateValue(prop, command.value, context);
169
- }
170
- function validateAddComponent(scene, command, context = {}) {
171
- const locatedNode = findNode(scene, command.node);
172
- if (!locatedNode) {
173
- return fail(`Node "${command.node}" was not found.`);
174
- }
175
- const result = validateComponentSpec(command.component, context);
176
- if (!result.ok) {
177
- return result;
178
- }
179
- const schema = ComponentRegistry.get(command.component.type);
180
- if (schema?.disallowMultiple && (locatedNode.node.components ?? []).some((component) => component.type === command.component.type)) {
181
- return fail(`Component "${command.component.type}" cannot be added more than once.`);
182
- }
183
- if (command.component.id && hasDuplicateComponentId(locatedNode.node, command.component.id)) {
184
- return fail(`Component id "${command.component.id}" already exists on node "${command.node}".`);
185
- }
186
- return ok();
187
- }
188
- function validateSetNodeProp(scene, command) {
189
- const locatedNode = findNode(scene, command.node);
190
- if (!locatedNode) {
191
- return fail(`Node "${command.node}" was not found.`);
192
- }
193
- if (command.value !== undefined && typeof command.value !== 'string') {
194
- return fail(`Node prop "${command.prop}" expects a string.`);
195
- }
196
- if (command.prop === 'id' && command.value) {
197
- const duplicate = findNode(scene, command.value);
198
- if (duplicate && duplicate.node !== locatedNode.node) {
199
- return fail(`Node id "${command.value}" already exists.`);
200
- }
201
- }
202
- return ok();
203
- }
204
- function validateReparentNode(scene, command) {
205
- const locatedNode = findNode(scene, command.node);
206
- if (!locatedNode) {
207
- return fail(`Node "${command.node}" was not found.`);
208
- }
209
- if (locatedNode.node === scene.root) {
210
- return fail('Root node cannot be reparented.');
211
- }
212
- const parent = command.parent ? findNode(scene, command.parent) : undefined;
213
- if (command.parent && !parent) {
214
- return fail(`Parent node "${command.parent}" was not found.`);
215
- }
216
- if (parent && (parent.node === locatedNode.node || isDescendant(parent.node, locatedNode.node))) {
217
- return fail(`Node "${command.node}" cannot be reparented under itself or its descendant.`);
218
- }
219
- return validateChildParent(parent?.node ?? scene.root, scene.root);
220
- }
221
- function validateReorderNode(scene, command) {
222
- const locatedNode = findNode(scene, command.node);
223
- if (!locatedNode) {
224
- return fail(`Node "${command.node}" was not found.`);
225
- }
226
- if (!locatedNode.parent) {
227
- return fail('Root node cannot be reordered.');
228
- }
229
- if (!Number.isInteger(command.index) || command.index < 0) {
230
- return fail('Reorder index must be a non-negative integer.');
231
- }
232
- return ok();
233
- }
234
- export function validateCommand(scene, command, context = {}) {
235
- switch (command.op) {
236
- case 'setNodeProp':
237
- return validateSetNodeProp(scene, command);
238
- case 'setTransform':
239
- return findNode(scene, command.node) ? ok() : fail(`Node "${command.node}" was not found.`);
240
- case 'setNodeData':
241
- return validateSetNodeData(scene, command);
242
- case 'setComponentProp':
243
- return validateSetComponentProp(scene, command, context);
244
- case 'addComponent':
245
- return validateAddComponent(scene, command, context);
246
- case 'removeComponent': {
247
- const locatedNode = findNode(scene, command.node);
248
- if (!locatedNode) {
249
- return fail(`Node "${command.node}" was not found.`);
250
- }
251
- return findComponent(locatedNode.node, command.component)
252
- ? ok()
253
- : fail(`Component "${command.component}" was not found on node "${command.node}".`);
254
- }
255
- case 'createNode':
256
- const parent = command.parent ? findNode(scene, command.parent) : undefined;
257
- if (command.parent && !parent) {
258
- return fail(`Parent node "${command.parent}" was not found.`);
259
- }
260
- {
261
- const result = validateNodeSpec(command.node);
262
- if (!result.ok) {
263
- return result;
264
- }
265
- }
266
- if (command.node.id && hasDuplicateNodeId(scene, command.node.id)) {
267
- return fail(`Node id "${command.node.id}" already exists.`);
268
- }
269
- return validateChildParent(parent?.node ?? scene.root, scene.root);
270
- case 'deleteNode':
271
- if (scene.root.id === command.node || scene.root.key === command.node || scene.root.name === command.node) {
272
- return fail('Root node cannot be deleted.');
273
- }
274
- return findNode(scene, command.node) ? ok() : fail(`Node "${command.node}" was not found.`);
275
- case 'reparentNode':
276
- return validateReparentNode(scene, command);
277
- case 'reorderNode':
278
- return validateReorderNode(scene, command);
279
- case 'batch':
280
- return Array.isArray(command.commands) ? ok() : fail('Batch command expects a commands array.');
281
- default:
282
- return fail('Unknown command.');
283
- }
284
- }
285
- export const validateSceneCommand = validateCommand;
@@ -1,91 +0,0 @@
1
- import type { FederatedPointerEvent } from "pixi.js";
2
- import { Graphics, Group, Label, LabelStyle } from "../runtime/index.js";
3
- export declare class Input extends Group {
4
- /**
5
- * 背景样式
6
- */
7
- graphics: Graphics;
8
- /**
9
- * 使用html标签进行输入处理
10
- */
11
- element: HTMLTextAreaElement | HTMLInputElement;
12
- /**
13
- * 输入框失去焦点时显示的内容
14
- */
15
- valueLabel: Label;
16
- /**
17
- * HTML 输入元素对齐的 canvas。默认取文档中的第一个 canvas。
18
- */
19
- canvas?: Element;
20
- private _mask;
21
- private _value;
22
- private _destroyed;
23
- private _isFocused;
24
- private _textColor;
25
- private _focusedBorderColor;
26
- private _blurredBorderColor;
27
- private readonly _globalTransform;
28
- protected _isUpdateTransform: boolean;
29
- set width(val: number);
30
- get width(): number;
31
- set height(val: number);
32
- get height(): number;
33
- /**
34
- * 更新mask,条件:1、padding改变 2、宽高改变
35
- */
36
- protected updateMask(): void;
37
- protected _isUpdateElementSize: boolean;
38
- protected updateElementSize(): void;
39
- protected updateElementLineHeight(): void;
40
- protected updateHitArea(): void;
41
- /**
42
- * 更新2d变换,位置,缩放,斜切,旋转
43
- */
44
- updateTransform(): void;
45
- private getCanvasOffset;
46
- private getCanvasView;
47
- protected _isResize: boolean;
48
- /**
49
- * 更新大小
50
- */
51
- resize(): void;
52
- protected createElement(): void;
53
- render(): void;
54
- update(): void;
55
- private handleViewportChange;
56
- private handleTransformChange;
57
- private _stokeStyle;
58
- private _backgroundColor;
59
- set backgroundColor(val: number);
60
- set borderColor(val: number);
61
- set borderSize(val: number);
62
- protected _labelStyle: LabelStyle;
63
- set fontFamily(val: string | string[]);
64
- get fontFamily(): string | string[];
65
- set fontSize(val: number);
66
- get fontSize(): number;
67
- private _isDrawStyle;
68
- /**
69
- * 绘制背景样式
70
- */
71
- drawStyle(): void;
72
- protected _padding: number[];
73
- protected get contentWidth(): number;
74
- protected get contentHeight(): number;
75
- set paddingLeft(val: number);
76
- get paddingLeft(): number;
77
- set paddingRight(val: number);
78
- get paddingRight(): number;
79
- set paddingTop(val: number);
80
- get paddingTop(): number;
81
- set paddingBottom(val: number);
82
- get paddingBottom(): number;
83
- get value(): string;
84
- set value(val: string);
85
- private onFocus;
86
- focus(event?: FederatedPointerEvent): void;
87
- private onInput;
88
- private onBlur;
89
- blur(): void;
90
- onDestroy(): void;
91
- }