onelaraveljs 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/README.md +87 -0
- package/docs/integration_analysis.md +116 -0
- package/docs/onejs_analysis.md +108 -0
- package/docs/optimization_implementation_group2.md +458 -0
- package/docs/optimization_plan.md +130 -0
- package/index.js +16 -0
- package/package.json +13 -0
- package/src/app.js +61 -0
- package/src/core/API.js +72 -0
- package/src/core/ChildrenRegistry.js +410 -0
- package/src/core/DOMBatcher.js +207 -0
- package/src/core/ErrorBoundary.js +226 -0
- package/src/core/EventDelegator.js +416 -0
- package/src/core/Helper.js +817 -0
- package/src/core/LoopContext.js +97 -0
- package/src/core/OneDOM.js +246 -0
- package/src/core/OneMarkup.js +444 -0
- package/src/core/Router.js +996 -0
- package/src/core/SEOConfig.js +321 -0
- package/src/core/SectionEngine.js +75 -0
- package/src/core/TemplateEngine.js +83 -0
- package/src/core/View.js +273 -0
- package/src/core/ViewConfig.js +229 -0
- package/src/core/ViewController.js +1410 -0
- package/src/core/ViewControllerOptimized.js +164 -0
- package/src/core/ViewIdentifier.js +361 -0
- package/src/core/ViewLoader.js +272 -0
- package/src/core/ViewManager.js +1962 -0
- package/src/core/ViewState.js +761 -0
- package/src/core/ViewSystem.js +301 -0
- package/src/core/ViewTemplate.js +4 -0
- package/src/core/helpers/BindingHelper.js +239 -0
- package/src/core/helpers/ConfigHelper.js +37 -0
- package/src/core/helpers/EventHelper.js +172 -0
- package/src/core/helpers/LifecycleHelper.js +17 -0
- package/src/core/helpers/ReactiveHelper.js +169 -0
- package/src/core/helpers/RenderHelper.js +15 -0
- package/src/core/helpers/ResourceHelper.js +89 -0
- package/src/core/helpers/TemplateHelper.js +11 -0
- package/src/core/managers/BindingManager.js +671 -0
- package/src/core/managers/ConfigurationManager.js +136 -0
- package/src/core/managers/EventManager.js +309 -0
- package/src/core/managers/LifecycleManager.js +356 -0
- package/src/core/managers/ReactiveManager.js +334 -0
- package/src/core/managers/RenderEngine.js +292 -0
- package/src/core/managers/ResourceManager.js +441 -0
- package/src/core/managers/ViewHierarchyManager.js +258 -0
- package/src/core/managers/ViewTemplateManager.js +127 -0
- package/src/core/reactive/ReactiveComponent.js +592 -0
- package/src/core/services/EventService.js +418 -0
- package/src/core/services/HttpService.js +106 -0
- package/src/core/services/LoggerService.js +57 -0
- package/src/core/services/StateService.js +512 -0
- package/src/core/services/StorageService.js +856 -0
- package/src/core/services/StoreService.js +258 -0
- package/src/core/services/TemplateDetectorService.js +361 -0
- package/src/core/services/Test.js +18 -0
- package/src/helpers/devWarnings.js +205 -0
- package/src/helpers/performance.js +226 -0
- package/src/helpers/utils.js +287 -0
- package/src/init.js +343 -0
- package/src/plugins/auto-plugin.js +34 -0
- package/src/services/Test.js +18 -0
- package/src/types/index.js +193 -0
- package/src/utils/date-helper.js +51 -0
- package/src/utils/helpers.js +39 -0
- package/src/utils/validation.js +32 -0
package/src/core/View.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View Engine class for managing view instances
|
|
3
|
+
* @param {Object} config - View configuration
|
|
4
|
+
*/
|
|
5
|
+
import { __defineGetters, __defineMethods, __defineProp, __defineProperties, __defineProps, deleteProp, hasData, uniqId } from '../helpers/utils.js';
|
|
6
|
+
import { ViewState } from './ViewState.js';
|
|
7
|
+
import logger from './services/LoggerService.js';
|
|
8
|
+
import { ViewController } from './ViewController.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @property {ViewController} __ - Internal view controller
|
|
12
|
+
*/
|
|
13
|
+
export class View {
|
|
14
|
+
/**
|
|
15
|
+
* Global resource registry
|
|
16
|
+
* Key: resourceKey (e.g., 'css:/css/chart.css' or 'js:/js/chart.js')
|
|
17
|
+
* Value: { element: HTMLElement, viewPaths: Set<string>, referenceCount: number, resourceType: string }
|
|
18
|
+
*/
|
|
19
|
+
static resourceRegistry = new Map();
|
|
20
|
+
static scripts = new Map();
|
|
21
|
+
|
|
22
|
+
static registerScript(name, key, callback) {
|
|
23
|
+
if (!name || !key || typeof callback !== 'function') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!this.scripts.has(name)) {
|
|
27
|
+
this.scripts.set(name, new Map());
|
|
28
|
+
}
|
|
29
|
+
if (this.scripts.get(name).has(key)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.scripts.get(name).set(key, callback);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getScript(name, key) {
|
|
36
|
+
if (!name || !key) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return this.scripts.get(name)?.get(key) || null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Generate resource key from resource data
|
|
44
|
+
* @param {Object} resource - Resource object
|
|
45
|
+
* @returns {string} Resource key
|
|
46
|
+
*/
|
|
47
|
+
static getResourceKey(resource) {
|
|
48
|
+
// For function wrapper scripts, use function name (ensures single execution)
|
|
49
|
+
if (resource.type === 'code' && resource.function) {
|
|
50
|
+
return `script:function:${resource.function}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// For external resources, use src/href
|
|
54
|
+
if (resource.type === 'src' && resource.src) {
|
|
55
|
+
return `script:${resource.src}`;
|
|
56
|
+
}
|
|
57
|
+
if (resource.type === 'href' && resource.href) {
|
|
58
|
+
return `style:${resource.href}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// For inline resources with id, use id
|
|
62
|
+
if (resource.id) {
|
|
63
|
+
const prefix = resource.type === 'code'
|
|
64
|
+
? (resource.resourceType === 'script' ? 'script:inline:' : 'style:inline:')
|
|
65
|
+
: '';
|
|
66
|
+
return `${prefix}${resource.id}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Fallback: use view path + content hash
|
|
70
|
+
const content = resource.content || resource.src || resource.href || '';
|
|
71
|
+
const hash = View._simpleHash(content);
|
|
72
|
+
return `${resource.type}:${resource.viewPath}:${hash}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Simple hash function for content
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
static _simpleHash(str) {
|
|
80
|
+
let hash = 0;
|
|
81
|
+
if (str.length === 0) return hash.toString();
|
|
82
|
+
for (let i = 0; i < str.length; i++) {
|
|
83
|
+
const char = str.charCodeAt(i);
|
|
84
|
+
hash = ((hash << 5) - hash) + char;
|
|
85
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
86
|
+
}
|
|
87
|
+
return Math.abs(hash).toString(36);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
constructor(path, config) {
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @type {ViewController}
|
|
95
|
+
*/
|
|
96
|
+
const controller = new ViewController(path, this, null);
|
|
97
|
+
Object.defineProperty(this, '__', {
|
|
98
|
+
value: controller,
|
|
99
|
+
writable: false,
|
|
100
|
+
configurable: false,
|
|
101
|
+
enumerable: false,
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
__defineProp(this, 'path', {
|
|
108
|
+
value: path,
|
|
109
|
+
writable: false,
|
|
110
|
+
configurable: false,
|
|
111
|
+
enumerable: false,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
__defineProp(this, 'viewType', {
|
|
115
|
+
value: 'view',
|
|
116
|
+
writable: true,
|
|
117
|
+
configurable: false,
|
|
118
|
+
enumerable: false,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Setup the view engine with configuration
|
|
126
|
+
* @param {string} path - View path
|
|
127
|
+
* @param {Object} config - View configuration
|
|
128
|
+
*/
|
|
129
|
+
setup(path, userDefined, config) {
|
|
130
|
+
if (this.isInitlized) {
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
this.__.setApp(this.App);
|
|
134
|
+
// Set config and path
|
|
135
|
+
|
|
136
|
+
// this.config = config || {};
|
|
137
|
+
this.__initialize__();
|
|
138
|
+
|
|
139
|
+
if (userDefined && typeof userDefined === 'object') {
|
|
140
|
+
Object.entries(userDefined).forEach(([key, value]) => {
|
|
141
|
+
this[key] = value;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
this.__.setup(path, config);
|
|
148
|
+
// Call _initialize to do the actual setup
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Initialize the view engine with configuration
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
__initialize__() {
|
|
158
|
+
if (this.isInitlized) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
__defineProp(this, 'isInitlized', {
|
|
163
|
+
value: true,
|
|
164
|
+
writable: false,
|
|
165
|
+
configurable: false,
|
|
166
|
+
enumerable: false,
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Set App instance
|
|
178
|
+
* @param {Object} app - App instance
|
|
179
|
+
* @returns {AppViewEngine} This instance for chaining
|
|
180
|
+
*/
|
|
181
|
+
setApp(app) {
|
|
182
|
+
this.__.setApp(app);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Reset view engine
|
|
189
|
+
*/
|
|
190
|
+
reset() {
|
|
191
|
+
// Implementation placeholder
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// accessors
|
|
195
|
+
|
|
196
|
+
get App() {
|
|
197
|
+
return this.__.App;
|
|
198
|
+
}
|
|
199
|
+
set App(value) {
|
|
200
|
+
// this.__.App = value;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get id() {
|
|
204
|
+
return this.__.id;
|
|
205
|
+
}
|
|
206
|
+
set id(value) {
|
|
207
|
+
// this.__.id = value;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
get type() {
|
|
211
|
+
return this.viewType;
|
|
212
|
+
}
|
|
213
|
+
set type(value) {
|
|
214
|
+
this.viewType = value;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
get parent() {
|
|
218
|
+
return this.__.parent?.view || null;
|
|
219
|
+
}
|
|
220
|
+
set parent(value) {
|
|
221
|
+
// this.__.parent = value;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get children() {
|
|
225
|
+
return this.__.children.map(ctrl => ctrl.view);
|
|
226
|
+
}
|
|
227
|
+
set children(value) {
|
|
228
|
+
// this.__.children = value;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
get superView() {
|
|
232
|
+
return this.__.superView?.view || null;
|
|
233
|
+
}
|
|
234
|
+
set superView(value) {
|
|
235
|
+
// this.__.superView = value;
|
|
236
|
+
}
|
|
237
|
+
get originalView() {
|
|
238
|
+
return this.__.originalView?.view || null;
|
|
239
|
+
}
|
|
240
|
+
set originalView(value) {
|
|
241
|
+
// this.__.originalView = value;
|
|
242
|
+
}
|
|
243
|
+
get isSuperView() {
|
|
244
|
+
return this.__.isSuperView;
|
|
245
|
+
}
|
|
246
|
+
set isSuperView(value) {
|
|
247
|
+
// this.__.isSuperView = value;
|
|
248
|
+
}
|
|
249
|
+
get isOriginalView() {
|
|
250
|
+
return this.__.isOriginalView;
|
|
251
|
+
}
|
|
252
|
+
set isOriginalView(value) {
|
|
253
|
+
// this.__.isOriginalView = value;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
get hasSuperView() {
|
|
257
|
+
return this.__.hasSuperView;
|
|
258
|
+
}
|
|
259
|
+
set hasSuperView(value) {
|
|
260
|
+
this.__.hasSuperView = value;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
get urlPath() {
|
|
264
|
+
return this.__.urlPath;
|
|
265
|
+
}
|
|
266
|
+
set urlPath(value) {
|
|
267
|
+
this.__.urlPath = value;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Export ViewEngine as alias for View (for backward compatibility)
|
|
273
|
+
export const ViewEngine = View;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
const basePrefix = 'data-';
|
|
2
|
+
const ATTR = {
|
|
3
|
+
PREFIX: {
|
|
4
|
+
BASE: basePrefix,
|
|
5
|
+
YIELD: `${basePrefix}yield-`,
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// DOM EVENTS - Mouse Events
|
|
9
|
+
CLICK: `${basePrefix}click-`,
|
|
10
|
+
DBLCLICK: `${basePrefix}dblclick-`,
|
|
11
|
+
MOUSEDOWN: `${basePrefix}mousedown-`,
|
|
12
|
+
MOUSEUP: `${basePrefix}mouseup-`,
|
|
13
|
+
MOUSEOVER: `${basePrefix}mouseover-`,
|
|
14
|
+
MOUSEOUT: `${basePrefix}mouseout-`,
|
|
15
|
+
MOUSEMOVE: `${basePrefix}mousemove-`,
|
|
16
|
+
MOUSEENTER: `${basePrefix}mouseenter-`,
|
|
17
|
+
MOUSELEAVE: `${basePrefix}mouseleave-`,
|
|
18
|
+
WHEEL: `${basePrefix}wheel-`,
|
|
19
|
+
AUXCLICK: `${basePrefix}auxclick-`,
|
|
20
|
+
|
|
21
|
+
// Keyboard Events
|
|
22
|
+
KEYDOWN: `${basePrefix}keydown-`,
|
|
23
|
+
KEYUP: `${basePrefix}keyup-`,
|
|
24
|
+
KEYPRESS: `${basePrefix}keypress-`,
|
|
25
|
+
|
|
26
|
+
// Form Events
|
|
27
|
+
INPUT: `${basePrefix}input-`,
|
|
28
|
+
CHANGE: `${basePrefix}change-`,
|
|
29
|
+
SUBMIT: `${basePrefix}submit-`,
|
|
30
|
+
RESET: `${basePrefix}reset-`,
|
|
31
|
+
INVALID: `${basePrefix}invalid-`,
|
|
32
|
+
SEARCH: `${basePrefix}search-`,
|
|
33
|
+
|
|
34
|
+
// Focus Events
|
|
35
|
+
FOCUS: `${basePrefix}focus-`,
|
|
36
|
+
BLUR: `${basePrefix}blur-`,
|
|
37
|
+
FOCUSIN: `${basePrefix}focusin-`,
|
|
38
|
+
FOCUSOUT: `${basePrefix}focusout-`,
|
|
39
|
+
|
|
40
|
+
// Selection Events
|
|
41
|
+
SELECT: `${basePrefix}select-`,
|
|
42
|
+
SELECTSTART: `${basePrefix}selectstart-`,
|
|
43
|
+
SELECTIONCHANGE: `${basePrefix}selectionchange-`,
|
|
44
|
+
|
|
45
|
+
// Touch Events
|
|
46
|
+
TOUCHSTART: `${basePrefix}touchstart-`,
|
|
47
|
+
TOUCHMOVE: `${basePrefix}touchmove-`,
|
|
48
|
+
TOUCHEND: `${basePrefix}touchend-`,
|
|
49
|
+
TOUCHCANCEL: `${basePrefix}touchcancel-`,
|
|
50
|
+
|
|
51
|
+
// Drag & Drop Events
|
|
52
|
+
DRAGSTART: `${basePrefix}dragstart-`,
|
|
53
|
+
DRAG: `${basePrefix}drag-`,
|
|
54
|
+
DRAGEND: `${basePrefix}dragend-`,
|
|
55
|
+
DRAGENTER: `${basePrefix}dragenter-`,
|
|
56
|
+
DRAGLEAVE: `${basePrefix}dragleave-`,
|
|
57
|
+
DRAGOVER: `${basePrefix}dragover-`,
|
|
58
|
+
DROP: `${basePrefix}drop-`,
|
|
59
|
+
|
|
60
|
+
// Media Events
|
|
61
|
+
PLAY: `${basePrefix}play-`,
|
|
62
|
+
PAUSE: `${basePrefix}pause-`,
|
|
63
|
+
ENDED: `${basePrefix}ended-`,
|
|
64
|
+
LOADSTART: `${basePrefix}loadstart-`,
|
|
65
|
+
LOADEDDATA: `${basePrefix}loadeddata-`,
|
|
66
|
+
LOADEDMETADATA: `${basePrefix}loadedmetadata-`,
|
|
67
|
+
CANPLAY: `${basePrefix}canplay-`,
|
|
68
|
+
CANPLAYTHROUGH: `${basePrefix}canplaythrough-`,
|
|
69
|
+
WAITING: `${basePrefix}waiting-`,
|
|
70
|
+
SEEKING: `${basePrefix}seeking-`,
|
|
71
|
+
SEEKED: `${basePrefix}seeked-`,
|
|
72
|
+
RATECHANGE: `${basePrefix}ratechange-`,
|
|
73
|
+
DURATIONCHANGE: `${basePrefix}durationchange-`,
|
|
74
|
+
VOLUMECHANGE: `${basePrefix}volumechange-`,
|
|
75
|
+
SUSPEND: `${basePrefix}suspend-`,
|
|
76
|
+
STALLED: `${basePrefix}stalled-`,
|
|
77
|
+
PROGRESS: `${basePrefix}progress-`,
|
|
78
|
+
EMPTIED: `${basePrefix}emptied-`,
|
|
79
|
+
ENCRYPTED: `${basePrefix}encrypted-`,
|
|
80
|
+
WAKEUP: `${basePrefix}wakeup-`,
|
|
81
|
+
|
|
82
|
+
// Window Events
|
|
83
|
+
LOAD: `${basePrefix}load-`,
|
|
84
|
+
UNLOAD: `${basePrefix}unload-`,
|
|
85
|
+
BEFOREUNLOAD: `${basePrefix}beforeunload-`,
|
|
86
|
+
RESIZE: `${basePrefix}resize-`,
|
|
87
|
+
SCROLL: `${basePrefix}scroll-`,
|
|
88
|
+
ORIENTATIONCHANGE: `${basePrefix}orientationchange-`,
|
|
89
|
+
VISIBILITYCHANGE: `${basePrefix}visibilitychange-`,
|
|
90
|
+
PAGEHIDE: `${basePrefix}pagehide-`,
|
|
91
|
+
PAGESHOW: `${basePrefix}pageshow-`,
|
|
92
|
+
POPSTATE: `${basePrefix}popstate-`,
|
|
93
|
+
HASHCHANGE: `${basePrefix}hashchange-`,
|
|
94
|
+
ONLINE: `${basePrefix}online-`,
|
|
95
|
+
OFFLINE: `${basePrefix}offline-`,
|
|
96
|
+
|
|
97
|
+
// Document Events
|
|
98
|
+
DOMCONTENTLOADED: `${basePrefix}DOMContentLoaded-`,
|
|
99
|
+
READYSTATECHANGE: `${basePrefix}readystatechange-`,
|
|
100
|
+
|
|
101
|
+
// Error Events
|
|
102
|
+
ERROR: `${basePrefix}error-`,
|
|
103
|
+
ABORT: `${basePrefix}abort-`,
|
|
104
|
+
|
|
105
|
+
// Context Menu
|
|
106
|
+
CONTEXTMENU: `${basePrefix}contextmenu-`,
|
|
107
|
+
|
|
108
|
+
// Animation Events
|
|
109
|
+
ANIMATIONSTART: `${basePrefix}animationstart-`,
|
|
110
|
+
ANIMATIONEND: `${basePrefix}animationend-`,
|
|
111
|
+
ANIMATIONITERATION: `${basePrefix}animationiteration-`,
|
|
112
|
+
|
|
113
|
+
// Transition Events
|
|
114
|
+
TRANSITIONSTART: `${basePrefix}transitionstart-`,
|
|
115
|
+
TRANSITIONEND: `${basePrefix}transitionend-`,
|
|
116
|
+
TRANSITIONRUN: `${basePrefix}transitionrun-`,
|
|
117
|
+
TRANSITIONCANCEL: `${basePrefix}transitioncancel-`,
|
|
118
|
+
|
|
119
|
+
// Pointer Events (Modern browsers)
|
|
120
|
+
POINTERDOWN: `${basePrefix}pointerdown-`,
|
|
121
|
+
POINTERUP: `${basePrefix}pointerup-`,
|
|
122
|
+
POINTERMOVE: `${basePrefix}pointermove-`,
|
|
123
|
+
POINTEROVER: `${basePrefix}pointerover-`,
|
|
124
|
+
POINTEROUT: `${basePrefix}pointerout-`,
|
|
125
|
+
POINTERENTER: `${basePrefix}pointerenter-`,
|
|
126
|
+
POINTERLEAVE: `${basePrefix}pointerleave-`,
|
|
127
|
+
POINTERCANCEL: `${basePrefix}pointercancel-`,
|
|
128
|
+
GOTPOINTERCAPTURE: `${basePrefix}gotpointercapture-`,
|
|
129
|
+
LOSTPOINTERCAPTURE: `${basePrefix}lostpointercapture-`,
|
|
130
|
+
|
|
131
|
+
// Fullscreen Events
|
|
132
|
+
FULLSCREENCHANGE: `${basePrefix}fullscreenchange-`,
|
|
133
|
+
FULLSCREENERROR: `${basePrefix}fullscreenerror-`,
|
|
134
|
+
|
|
135
|
+
// Clipboard Events
|
|
136
|
+
COPY: `${basePrefix}copy-`,
|
|
137
|
+
CUT: `${basePrefix}cut-`,
|
|
138
|
+
PASTE: `${basePrefix}paste-`,
|
|
139
|
+
|
|
140
|
+
// Gamepad Events
|
|
141
|
+
GAMEPADCONNECTED: `${basePrefix}gamepadconnected-`,
|
|
142
|
+
GAMEPADDISCONNECTED: `${basePrefix}gamepaddisconnected-`,
|
|
143
|
+
|
|
144
|
+
// Battery Events
|
|
145
|
+
BATTERYCHARGINGCHANGE: `${basePrefix}batterychargingchange-`,
|
|
146
|
+
BATTERYLEVELCHANGE: `${basePrefix}batterylevelchange-`,
|
|
147
|
+
|
|
148
|
+
// Device Orientation Events
|
|
149
|
+
DEVICEORIENTATION: `${basePrefix}deviceorientation-`,
|
|
150
|
+
DEVICEMOTION: `${basePrefix}devicemotion-`,
|
|
151
|
+
DEVICELIGHT: `${basePrefix}devicelight-`,
|
|
152
|
+
DEVICEPROXIMITY: `${basePrefix}deviceproximity-`,
|
|
153
|
+
|
|
154
|
+
// WebGL Events
|
|
155
|
+
WEBGLCONTEXTLOST: `${basePrefix}webglcontextlost-`,
|
|
156
|
+
WEBGLCONTEXTRESTORED: `${basePrefix}webglcontextrestored-`,
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
// view
|
|
160
|
+
VIEW: `${basePrefix}view-`,
|
|
161
|
+
},
|
|
162
|
+
KEYS: {
|
|
163
|
+
VIEW: `${basePrefix}view`,
|
|
164
|
+
VIEW_ID: `${basePrefix}view-id`,
|
|
165
|
+
VIEW_REF: `${basePrefix}view-ref`,
|
|
166
|
+
VIEW_SECTION_REF: `${basePrefix}view-section-ref`,
|
|
167
|
+
VIEW_RESOURCE: `${basePrefix}view-resource`,
|
|
168
|
+
VIEW_STYLE: `${basePrefix}view-style`,
|
|
169
|
+
VIEW_WRAPPER: `${basePrefix}view-wrapper`,
|
|
170
|
+
// yield
|
|
171
|
+
YIELD_ATTR: `${basePrefix}yield-attr`,
|
|
172
|
+
YIELD_CONTENT: `${basePrefix}yield-content`,
|
|
173
|
+
YIELD_CHILDREN: `${basePrefix}yield-children`,
|
|
174
|
+
YIELD_SUBSCRIBE: `${basePrefix}yield-subscribe`,
|
|
175
|
+
YIELD_SUBSCRIBE_ATTR: `${basePrefix}yield-subscribe-attr`,
|
|
176
|
+
YIELD_SUBSCRIBE_CONTENT: `${basePrefix}yield-subscribe-content`,
|
|
177
|
+
YIELD_SUBSCRIBE_CHILDREN: `${basePrefix}yield-subscribe-children`,
|
|
178
|
+
},
|
|
179
|
+
CLASSNAME: {
|
|
180
|
+
BASE: basePrefix,
|
|
181
|
+
VIEW_ERROR: `${basePrefix}view-error`,
|
|
182
|
+
VIRTUAL_CONTAINER: `${basePrefix}virtual-container`,
|
|
183
|
+
SECTION_ERROR: `${basePrefix}section-error`,
|
|
184
|
+
},
|
|
185
|
+
prefix: (key) => ATTR.PREFIX[key.toUpperCase()] || basePrefix + key,
|
|
186
|
+
key: (key) => ATTR.KEYS[key.toUpperCase()] || basePrefix + key,
|
|
187
|
+
className: (key) => ATTR.CLASSNAME[key.toUpperCase()] || basePrefix + key.toLowerCase().replace(/_/g, '-'),
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const FORBIDDEN_KEYS = [
|
|
192
|
+
'init',
|
|
193
|
+
'destroy',
|
|
194
|
+
'beforeInit',
|
|
195
|
+
'afterInit',
|
|
196
|
+
'beforeDestroy',
|
|
197
|
+
'destroyed',
|
|
198
|
+
'loadServerData',
|
|
199
|
+
'render',
|
|
200
|
+
'prerender',
|
|
201
|
+
'insertResources',
|
|
202
|
+
'removeResources',
|
|
203
|
+
'setMaster',
|
|
204
|
+
'setApp',
|
|
205
|
+
'addChild',
|
|
206
|
+
'removeChild',
|
|
207
|
+
'remove',
|
|
208
|
+
'setParent',
|
|
209
|
+
'parent',
|
|
210
|
+
'master',
|
|
211
|
+
'beforeCreate',
|
|
212
|
+
'created',
|
|
213
|
+
'beforeUpdate',
|
|
214
|
+
'updated',
|
|
215
|
+
'beforeMount',
|
|
216
|
+
'mounted',
|
|
217
|
+
'beforeUnmount',
|
|
218
|
+
'unmounted',
|
|
219
|
+
'renderLongSections',
|
|
220
|
+
'renderSections',
|
|
221
|
+
'prerenderSections',
|
|
222
|
+
'data',
|
|
223
|
+
'scope',
|
|
224
|
+
'subscribe',
|
|
225
|
+
'updateVariableItem',
|
|
226
|
+
'updateVariableData',
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
export { ATTR };
|