marko 5.29.1 → 5.30.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/bin/markoc.js +18 -18
- package/dist/core-tags/core/await/index.d.marko +10 -0
- package/dist/core-tags/core/await/renderer.js +5 -1
- package/dist/node_modules/@internal/components-beginComponent/index.js +13 -3
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
- package/dist/node_modules/@internal/components-entry/index.js +73 -45
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/dist/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-registry/index-browser.js +70 -43
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +17 -17
- package/dist/node_modules/@internal/components-util/index.js +18 -8
- package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/dist/node_modules/@internal/create-readable/index.js +9 -9
- package/dist/node_modules/@internal/set-immediate/index-browser.js +1 -1
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index.js +2 -2
- package/dist/runtime/RenderResult.js +3 -3
- package/dist/runtime/components/Component.js +146 -148
- package/dist/runtime/components/ComponentDef.js +41 -27
- package/dist/runtime/components/ComponentsContext.js +6 -6
- package/dist/runtime/components/GlobalComponentsContext.js +3 -3
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +27 -27
- package/dist/runtime/components/attach-detach.js +7 -7
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/legacy/browser.json +9 -0
- package/dist/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/dist/runtime/components/legacy/dependencies/html.js +3 -0
- package/dist/runtime/components/legacy/dependencies/index.js +178 -0
- package/dist/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/dist/runtime/components/legacy/index.js +1 -0
- package/dist/runtime/components/legacy/jquery.js +51 -0
- package/dist/runtime/components/legacy/ready.js +152 -0
- package/dist/runtime/components/legacy/renderer-legacy.js +230 -0
- package/dist/runtime/components/renderer.js +30 -26
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +5 -5
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +7 -9
- package/dist/runtime/helpers/style-value.js +7 -2
- package/dist/runtime/html/AsyncStream.js +20 -20
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +19 -6
- package/dist/runtime/html/helpers/attrs.js +7 -0
- package/dist/runtime/html/helpers/data-marko.js +2 -2
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/merge-attrs.js +38 -7
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +9 -6
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +86 -86
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VElement.js +61 -50
- package/dist/runtime/vdom/VFragment.js +8 -8
- package/dist/runtime/vdom/VNode.js +36 -36
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +24 -4
- package/dist/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/hot-reload.js +19 -19
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +5 -5
- package/dist/runtime/vdom/morphdom/index.js +56 -56
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +7 -7
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +14 -14
- package/docs/10-awesome-marko-features.md +1 -1
- package/docs/body-content.md +3 -3
- package/docs/class-components.md +6 -6
- package/docs/cloudflare-workers.md +3 -3
- package/docs/compiler.md +5 -5
- package/docs/express.md +2 -2
- package/docs/http.md +1 -1
- package/docs/koa.md +1 -1
- package/docs/lasso.md +1 -1
- package/docs/marko-vs-react.md +2 -2
- package/docs/rendering.md +6 -6
- package/docs/rollup.md +30 -30
- package/docs/troubleshooting-streaming.md +1 -1
- package/docs/typescript.md +1 -1
- package/docs/vite.md +3 -3
- package/docs/webpack.md +25 -25
- package/docs/why-is-marko-fast.md +2 -2
- package/index.d.ts +1 -0
- package/legacy-components-browser.marko +15 -0
- package/legacy-components.js +7 -0
- package/package.json +51 -45
- package/src/compiler/config.js +1 -1
- package/src/compiler/index.js +5 -5
- package/src/core-tags/core/__flush_here_and_after__.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +1 -1
- package/src/core-tags/core/await/index.d.marko +10 -0
- package/src/core-tags/core/await/renderer.js +8 -4
- package/src/core-tags/core/await/reorderer-renderer.js +1 -1
- package/src/node-require/browser-refresh.js +2 -2
- package/src/node-require/index.js +2 -2
- package/src/node_modules/@internal/components-beginComponent/index.js +16 -6
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index.js +65 -37
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-registry/index-browser.js +33 -6
- package/src/node_modules/@internal/components-util/index.js +10 -0
- package/src/runtime/RenderResult.js +3 -3
- package/src/runtime/components/Component.js +16 -18
- package/src/runtime/components/ComponentDef.js +22 -8
- package/src/runtime/components/ComponentsContext.js +1 -1
- package/src/runtime/components/State.js +2 -2
- package/src/runtime/components/attach-detach.js +1 -1
- package/src/runtime/components/dom-data.js +1 -1
- package/src/runtime/components/legacy/browser.json +9 -0
- package/src/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/src/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/src/runtime/components/legacy/dependencies/html.js +3 -0
- package/src/runtime/components/legacy/dependencies/index.js +178 -0
- package/src/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/src/runtime/components/legacy/index.js +1 -0
- package/src/runtime/components/legacy/jquery.js +51 -0
- package/src/runtime/components/legacy/ready.js +152 -0
- package/src/runtime/components/legacy/renderer-legacy.js +230 -0
- package/src/runtime/components/renderer.js +4 -0
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +1 -1
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/style-value.js +7 -2
- package/src/runtime/html/AsyncStream.js +5 -5
- package/src/runtime/html/BufferedWriter.js +1 -1
- package/src/runtime/html/StringWriter.js +1 -1
- package/src/runtime/html/helpers/attr.js +15 -2
- package/src/runtime/html/helpers/attrs.js +7 -0
- package/src/runtime/html/helpers/merge-attrs.js +38 -7
- package/src/runtime/html/hot-reload.js +1 -1
- package/src/runtime/html/index.js +2 -2
- package/src/runtime/renderable.js +5 -2
- package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
- package/src/runtime/vdom/VComponent.js +1 -1
- package/src/runtime/vdom/VDocumentFragment.js +1 -1
- package/src/runtime/vdom/VElement.js +17 -6
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +1 -1
- package/src/runtime/vdom/VText.js +1 -1
- package/src/runtime/vdom/helpers/attrs.js +26 -6
- package/src/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/src/runtime/vdom/hot-reload.js +1 -1
- package/src/runtime/vdom/index.js +2 -2
- package/src/runtime/vdom/morphdom/fragment.js +1 -1
- package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/src/taglib/index.js +1 -1
- package/tags-html.d.ts +9 -0
- package/dist/core-tags/core/await/index.marko +0 -13
- package/src/core-tags/core/await/index.marko +0 -13
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
var w10Noop = require("warp10/constants").NOOP;
|
4
4
|
var componentUtil = require("@internal/components-util");
|
5
|
-
var attachBubblingEvent = componentUtil.
|
5
|
+
var attachBubblingEvent = componentUtil._W_;
|
6
6
|
var addDelegatedEventHandler =
|
7
|
-
require("./event-delegation").
|
7
|
+
require("./event-delegation")._u_;
|
8
8
|
var extend = require("raptor-util/extend");
|
9
9
|
var KeySequence = require("./KeySequence");
|
10
10
|
var EMPTY_OBJECT = {};
|
11
11
|
|
12
12
|
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
13
13
|
var FLAG_HAS_RENDER_BODY = 2;
|
14
|
+
var FLAG_IS_LEGACY = 4;
|
15
|
+
var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
14
16
|
|
15
17
|
/**
|
16
18
|
* A ComponentDef is used to hold the metadata collected at runtime for
|
@@ -18,25 +20,25 @@ var FLAG_HAS_RENDER_BODY = 2;
|
|
18
20
|
* later (after the rendered HTML has been added to the DOM)
|
19
21
|
*/
|
20
22
|
function ComponentDef(component, componentId, componentsContext) {
|
21
|
-
this.
|
23
|
+
this.aH_ = componentsContext; // The AsyncWriter that this component is associated with
|
22
24
|
this.i_ = component;
|
23
25
|
this.id = componentId;
|
24
26
|
|
25
|
-
this.
|
27
|
+
this._g_ = undefined; // An array of DOM events that need to be added (in sets of three)
|
26
28
|
|
27
|
-
this.
|
29
|
+
this._w_ = false;
|
28
30
|
|
29
31
|
this.B_ = false;
|
30
32
|
this.C_ = 0;
|
31
33
|
|
32
|
-
this.
|
33
|
-
this.
|
34
|
+
this.aI_ = 0; // The unique integer to use for the next scoped ID
|
35
|
+
this.aJ_ = null;
|
34
36
|
}
|
35
37
|
|
36
38
|
ComponentDef.prototype = {
|
37
|
-
|
39
|
+
aK_: function (key) {
|
38
40
|
return (
|
39
|
-
this.
|
41
|
+
this.aJ_ || (this.aJ_ = new KeySequence())).aK_(
|
40
42
|
key);
|
41
43
|
},
|
42
44
|
|
@@ -70,8 +72,8 @@ ComponentDef.prototype = {
|
|
70
72
|
/**
|
71
73
|
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
|
72
74
|
*/
|
73
|
-
|
74
|
-
return this.id + "-c" + this.
|
75
|
+
aL_: function () {
|
76
|
+
return this.id + "-c" + this.aI_++;
|
75
77
|
},
|
76
78
|
|
77
79
|
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
|
@@ -79,33 +81,45 @@ ComponentDef.prototype = {
|
|
79
81
|
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
|
80
82
|
},
|
81
83
|
|
82
|
-
get
|
83
|
-
return this.i_.
|
84
|
+
get _s_() {
|
85
|
+
return this.i_._s_;
|
84
86
|
}
|
85
87
|
};
|
86
88
|
|
87
|
-
ComponentDef.prototype.nk = ComponentDef.prototype.
|
89
|
+
ComponentDef.prototype.nk = ComponentDef.prototype.aK_;
|
88
90
|
|
89
|
-
ComponentDef.
|
91
|
+
ComponentDef._F_ = function (o, types, global, registry) {
|
90
92
|
var id = o[0];
|
91
93
|
var typeName = types[o[1]];
|
92
94
|
var input = o[2] || null;
|
93
95
|
var extra = o[3] || EMPTY_OBJECT;
|
94
96
|
|
95
97
|
var state = extra.s;
|
96
|
-
var componentProps = extra.w;
|
98
|
+
var componentProps = extra.w || EMPTY_OBJECT;
|
97
99
|
var flags = extra.f;
|
98
|
-
var
|
100
|
+
var isLegacy = flags & FLAG_IS_LEGACY;
|
101
|
+
var renderBody = flags & FLAG_HAS_RENDER_BODY ? w10Noop : extra.r;
|
102
|
+
|
103
|
+
var component =
|
104
|
+
typeName /* legacy */ &&
|
105
|
+
registry._I_(typeName, id, isLegacy);
|
99
106
|
|
100
107
|
// Prevent newly created component from being queued for update since we area
|
101
108
|
// just building it from the server info
|
102
|
-
component.
|
109
|
+
component._f_ = true;
|
103
110
|
|
104
|
-
if (
|
105
|
-
|
111
|
+
if (isLegacy) {
|
112
|
+
component.widgetConfig = componentProps;
|
113
|
+
component._c_ = renderBody;
|
114
|
+
} else if (renderBody) {
|
115
|
+
(input || (input = {})).renderBody = renderBody;
|
106
116
|
}
|
107
117
|
|
108
|
-
if (
|
118
|
+
if (
|
119
|
+
!isLegacy &&
|
120
|
+
flags & FLAG_WILL_RERENDER_IN_BROWSER &&
|
121
|
+
!(flags & FLAG_OLD_HYDRATE_NO_CREATE))
|
122
|
+
{
|
109
123
|
if (component.onCreate) {
|
110
124
|
component.onCreate(input, { global: global });
|
111
125
|
}
|
@@ -125,29 +139,29 @@ ComponentDef._l_ = function (o, types, global, registry) {
|
|
125
139
|
component.state = state;
|
126
140
|
}
|
127
141
|
|
128
|
-
if (componentProps) {
|
142
|
+
if (!isLegacy && componentProps) {
|
129
143
|
extend(component, componentProps);
|
130
144
|
}
|
131
145
|
}
|
132
146
|
|
133
|
-
component.
|
147
|
+
component.U_ = input;
|
134
148
|
|
135
149
|
if (extra.b) {
|
136
|
-
component.
|
150
|
+
component._b_ = extra.b;
|
137
151
|
}
|
138
152
|
|
139
153
|
var scope = extra.p;
|
140
154
|
var customEvents = extra.e;
|
141
155
|
if (customEvents) {
|
142
|
-
component.
|
156
|
+
component.aB_(customEvents, scope);
|
143
157
|
}
|
144
158
|
|
145
|
-
component.
|
159
|
+
component.ai_ = global;
|
146
160
|
|
147
161
|
return {
|
148
162
|
id: id,
|
149
163
|
i_: component,
|
150
|
-
|
164
|
+
_g_: extra.d,
|
151
165
|
C_: extra.f || 0
|
152
166
|
};
|
153
167
|
};
|
@@ -11,9 +11,9 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
11
11
|
|
12
12
|
var nestedContextsForParent;
|
13
13
|
if (
|
14
|
-
!(nestedContextsForParent = parentComponentsContext.
|
14
|
+
!(nestedContextsForParent = parentComponentsContext._h_))
|
15
15
|
{
|
16
|
-
nestedContextsForParent = parentComponentsContext.
|
16
|
+
nestedContextsForParent = parentComponentsContext._h_ = [];
|
17
17
|
}
|
18
18
|
|
19
19
|
nestedContextsForParent.push(this);
|
@@ -29,18 +29,18 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
29
29
|
this.b_ = [];
|
30
30
|
this.A_ = out;
|
31
31
|
this.k_ = componentDef;
|
32
|
-
this.
|
32
|
+
this._h_ = undefined;
|
33
33
|
this.p_ =
|
34
34
|
parentComponentsContext && parentComponentsContext.p_;
|
35
35
|
}
|
36
36
|
|
37
37
|
ComponentsContext.prototype = {
|
38
|
-
|
38
|
+
ad_: function (host) {
|
39
39
|
var componentDefs = this.b_;
|
40
40
|
|
41
|
-
ComponentsContext.
|
41
|
+
ComponentsContext._K_(componentDefs, host);
|
42
42
|
|
43
|
-
this.A_.emit("
|
43
|
+
this.A_.emit("aM_");
|
44
44
|
|
45
45
|
// Reset things stored in global since global is retained for
|
46
46
|
// future renders
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";var nextComponentIdProvider =
|
2
|
-
require("@internal/components-util").
|
2
|
+
require("@internal/components-util")._V_;
|
3
3
|
|
4
4
|
function GlobalComponentsContext(out) {
|
5
5
|
this.z_ = {};
|
6
|
-
this.
|
7
|
-
this.
|
6
|
+
this.ax_ = undefined;
|
7
|
+
this.aL_ = nextComponentIdProvider(out);
|
8
8
|
}
|
9
9
|
|
10
10
|
module.exports = GlobalComponentsContext;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";function KeySequence() {
|
2
|
-
this.
|
2
|
+
this.aN_ = Object.create(null);
|
3
3
|
}
|
4
4
|
|
5
|
-
KeySequence.prototype.
|
6
|
-
var lookup = this.
|
5
|
+
KeySequence.prototype.aK_ = function (key) {
|
6
|
+
var lookup = this.aN_;
|
7
7
|
|
8
8
|
if (lookup[key]) {
|
9
9
|
return key + "_" + lookup[key]++;
|
@@ -4,38 +4,38 @@
|
|
4
4
|
class ServerComponent {
|
5
5
|
constructor(id, input, out, typeName, customEvents, scope) {
|
6
6
|
this.id = id;
|
7
|
-
this.
|
8
|
-
this.
|
7
|
+
this.___ = customEvents;
|
8
|
+
this._a_ = scope;
|
9
9
|
this.typeName = typeName;
|
10
|
-
this.
|
11
|
-
this.
|
10
|
+
this._b_ = undefined; // Used to keep track of bubbling DOM events for components rendered on the server
|
11
|
+
this._d_ = 0;
|
12
12
|
|
13
13
|
this.onCreate(input, out);
|
14
|
-
this.
|
15
|
-
if (this.
|
16
|
-
this.
|
14
|
+
this._e_ = this.onInput(input, out) || input;
|
15
|
+
if (this.U_ === undefined) {
|
16
|
+
this.U_ = this._e_;
|
17
17
|
}
|
18
18
|
this.onRender(out);
|
19
19
|
}
|
20
20
|
|
21
21
|
set input(newInput) {
|
22
|
-
this.
|
22
|
+
this.U_ = newInput;
|
23
23
|
}
|
24
24
|
|
25
25
|
get input() {
|
26
|
-
return this.
|
26
|
+
return this.U_;
|
27
27
|
}
|
28
28
|
|
29
29
|
set state(newState) {
|
30
|
-
this.
|
30
|
+
this.G_ = newState;
|
31
31
|
}
|
32
32
|
|
33
33
|
get state() {
|
34
|
-
return this.
|
34
|
+
return this.G_;
|
35
35
|
}
|
36
36
|
|
37
|
-
get
|
38
|
-
return this.
|
37
|
+
get aA_() {
|
38
|
+
return this.G_;
|
39
39
|
}
|
40
40
|
|
41
41
|
elId(nestedId) {
|
@@ -5,10 +5,10 @@ function ensure(state, propertyName) {
|
|
5
5
|
if (!(propertyName in proto)) {
|
6
6
|
Object.defineProperty(proto, propertyName, {
|
7
7
|
get: function () {
|
8
|
-
return this.
|
8
|
+
return this.H_[propertyName];
|
9
9
|
},
|
10
10
|
set: function (value) {
|
11
|
-
this.
|
11
|
+
this.ap_(propertyName, value, false /* ensure:false */);
|
12
12
|
}
|
13
13
|
});
|
14
14
|
}
|
@@ -16,35 +16,35 @@ function ensure(state, propertyName) {
|
|
16
16
|
|
17
17
|
function State(component) {
|
18
18
|
this.i_ = component;
|
19
|
-
this.
|
19
|
+
this.H_ = {};
|
20
20
|
|
21
|
-
this.
|
22
|
-
this.
|
23
|
-
this.
|
24
|
-
this.
|
21
|
+
this.aj_ = false;
|
22
|
+
this.au_ = null;
|
23
|
+
this.at_ = null;
|
24
|
+
this.aO_ = null; // An object that we use to keep tracking of state properties that were forced to be dirty
|
25
25
|
|
26
26
|
Object.seal(this);
|
27
27
|
}
|
28
28
|
|
29
29
|
State.prototype = {
|
30
|
-
|
30
|
+
_v_: function () {
|
31
31
|
var self = this;
|
32
32
|
|
33
|
-
self.
|
34
|
-
self.
|
35
|
-
self.
|
36
|
-
self.
|
33
|
+
self.aj_ = false;
|
34
|
+
self.au_ = null;
|
35
|
+
self.at_ = null;
|
36
|
+
self.aO_ = null;
|
37
37
|
},
|
38
38
|
|
39
|
-
|
39
|
+
an_: function (newState) {
|
40
40
|
var state = this;
|
41
41
|
var key;
|
42
42
|
|
43
|
-
var rawState = this.
|
43
|
+
var rawState = this.H_;
|
44
44
|
|
45
45
|
for (key in rawState) {
|
46
46
|
if (!(key in newState)) {
|
47
|
-
state.
|
47
|
+
state.ap_(
|
48
48
|
key,
|
49
49
|
undefined,
|
50
50
|
false /* ensure:false */,
|
@@ -54,7 +54,7 @@ State.prototype = {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
for (key in newState) {
|
57
|
-
state.
|
57
|
+
state.ap_(
|
58
58
|
key,
|
59
59
|
newState[key],
|
60
60
|
true /* ensure:true */,
|
@@ -62,32 +62,32 @@ State.prototype = {
|
|
62
62
|
|
63
63
|
}
|
64
64
|
},
|
65
|
-
|
66
|
-
var rawState = this.
|
65
|
+
ap_: function (name, value, shouldEnsure, forceDirty) {
|
66
|
+
var rawState = this.H_;
|
67
67
|
|
68
68
|
if (shouldEnsure) {
|
69
69
|
ensure(this, name);
|
70
70
|
}
|
71
71
|
|
72
72
|
if (forceDirty) {
|
73
|
-
var forcedDirtyState = this.
|
73
|
+
var forcedDirtyState = this.aO_ || (this.aO_ = {});
|
74
74
|
forcedDirtyState[name] = true;
|
75
75
|
} else if (rawState[name] === value) {
|
76
76
|
return;
|
77
77
|
}
|
78
78
|
|
79
|
-
if (!this.
|
79
|
+
if (!this.aj_) {
|
80
80
|
// This is the first time we are modifying the component state
|
81
81
|
// so introduce some properties to do some tracking of
|
82
82
|
// changes to the state
|
83
|
-
this.
|
84
|
-
this.
|
85
|
-
this.
|
86
|
-
this.
|
87
|
-
this.i_.
|
83
|
+
this.aj_ = true; // Mark the component state as dirty (i.e. modified)
|
84
|
+
this.au_ = rawState;
|
85
|
+
this.H_ = rawState = extend({}, rawState);
|
86
|
+
this.at_ = {};
|
87
|
+
this.i_.ao_();
|
88
88
|
}
|
89
89
|
|
90
|
-
this.
|
90
|
+
this.at_[name] = value;
|
91
91
|
|
92
92
|
if (value === undefined) {
|
93
93
|
// Don't store state properties with an undefined or null value
|
@@ -98,7 +98,7 @@ State.prototype = {
|
|
98
98
|
}
|
99
99
|
},
|
100
100
|
toJSON: function () {
|
101
|
-
return this.
|
101
|
+
return this.H_;
|
102
102
|
}
|
103
103
|
};
|
104
104
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";var eventDelegation = require("./event-delegation");
|
2
|
-
var delegateEvent = eventDelegation.
|
3
|
-
var getEventFromEl = eventDelegation.
|
2
|
+
var delegateEvent = eventDelegation.aP_;
|
3
|
+
var getEventFromEl = eventDelegation.aQ_;
|
4
4
|
|
5
5
|
// var componentsUtil = require('@internal/components-util');
|
6
6
|
// var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
@@ -14,10 +14,10 @@ function handleNodeAttach(node, componentsContext) {
|
|
14
14
|
var out = componentsContext.A_;
|
15
15
|
var data = out.data;
|
16
16
|
|
17
|
-
var attachTargets = data.
|
17
|
+
var attachTargets = data.aR_;
|
18
18
|
if (!attachTargets) {
|
19
|
-
attachTargets = data.
|
20
|
-
out.on("
|
19
|
+
attachTargets = data.aR_ = [];
|
20
|
+
out.on("aM_", function () {
|
21
21
|
for (var i = 0; i < attachTargets.length; i += 2) {
|
22
22
|
var node = attachTargets[i];
|
23
23
|
var target = attachTargets[i + 1];
|
@@ -56,5 +56,5 @@ function handleNodeDetach(node) {
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
-
eventDelegation.
|
60
|
-
eventDelegation.
|
59
|
+
eventDelegation.aS_ = handleNodeAttach;
|
60
|
+
eventDelegation.al_ = handleNodeDetach;
|
@@ -6,7 +6,7 @@ var BaseComponent = require("./Component");
|
|
6
6
|
var inherit = require("raptor-util/inherit");
|
7
7
|
|
8
8
|
module.exports = function defineComponent(def, renderer) {
|
9
|
-
if (def.
|
9
|
+
if (def.E_) {
|
10
10
|
return def;
|
11
11
|
}
|
12
12
|
|
@@ -35,7 +35,7 @@ module.exports = function defineComponent(def, renderer) {
|
|
35
35
|
BaseComponent.call(this, id);
|
36
36
|
}
|
37
37
|
|
38
|
-
if (!proto.
|
38
|
+
if (!proto.E_) {
|
39
39
|
// Inherit from Component if they didn't already
|
40
40
|
inherit(ComponentClass, BaseComponent);
|
41
41
|
}
|
@@ -48,14 +48,14 @@ module.exports = function defineComponent(def, renderer) {
|
|
48
48
|
|
49
49
|
// Set a flag on the constructor function to make it clear this is
|
50
50
|
// a component so that we can short-circuit this work later
|
51
|
-
Component.
|
51
|
+
Component.E_ = true;
|
52
52
|
|
53
53
|
function State(component) {
|
54
54
|
BaseState.call(this, component);
|
55
55
|
}
|
56
56
|
inherit(State, BaseState);
|
57
|
-
proto.
|
58
|
-
proto.
|
57
|
+
proto.V_ = State;
|
58
|
+
proto.W_ = renderer;
|
59
59
|
|
60
60
|
return Component;
|
61
61
|
};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";module.exports = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
_O_: new WeakMap(),
|
3
|
+
_N_: new WeakMap(),
|
4
|
+
_r_: new WeakMap(),
|
5
|
+
aT_: new WeakMap(),
|
6
|
+
_M_: new WeakMap(),
|
7
|
+
_q_: {}
|
8
8
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";var componentsUtil = require("@internal/components-util");
|
2
|
-
var runtimeId = componentsUtil.
|
3
|
-
var componentLookup = componentsUtil.
|
4
|
-
var getMarkoPropsFromEl = componentsUtil.
|
2
|
+
var runtimeId = componentsUtil._S_;
|
3
|
+
var componentLookup = componentsUtil._o_;
|
4
|
+
var getMarkoPropsFromEl = componentsUtil._t_;
|
5
5
|
|
6
6
|
var TEXT_NODE = 3;
|
7
7
|
|
@@ -54,7 +54,7 @@ function delegateEvent(node, eventName, target, event) {
|
|
54
54
|
|
55
55
|
if (extraArgs != null) {
|
56
56
|
if (typeof extraArgs === "number") {
|
57
|
-
extraArgs = targetComponent.
|
57
|
+
extraArgs = targetComponent._b_[extraArgs];
|
58
58
|
}
|
59
59
|
}
|
60
60
|
|
@@ -132,12 +132,12 @@ function addDelegatedEventHandlerToHost(eventType, host) {
|
|
132
132
|
|
133
133
|
function noop() {}
|
134
134
|
|
135
|
-
exports.
|
136
|
-
exports.
|
137
|
-
exports.
|
138
|
-
exports.
|
139
|
-
exports.
|
140
|
-
exports.
|
135
|
+
exports.aS_ = noop;
|
136
|
+
exports.al_ = noop;
|
137
|
+
exports.aP_ = delegateEvent;
|
138
|
+
exports.aQ_ = getEventFromEl;
|
139
|
+
exports._u_ = addDelegatedEventHandler;
|
140
|
+
exports._C_ = function (host) {
|
141
141
|
Object.keys(delegatedEvents).forEach(function (eventType) {
|
142
142
|
addDelegatedEventHandlerToHost(eventType, host);
|
143
143
|
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict"; /**
|
2
|
+
* Define a new UI component that includes component and renderer.
|
3
|
+
*
|
4
|
+
* @param {Object} def The definition of the UI component (component methods, component constructor, rendering methods, etc.)
|
5
|
+
* @return {Component} The resulting Component with renderer
|
6
|
+
*/
|
7
|
+
var defineRenderer;
|
8
|
+
var defineWidget;
|
9
|
+
|
10
|
+
module.exports = function defineComponent(def) {
|
11
|
+
// eslint-disable-next-line no-constant-condition
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
if (def.E_) {
|
17
|
+
return def;
|
18
|
+
}
|
19
|
+
|
20
|
+
var renderer;
|
21
|
+
|
22
|
+
if (def.template || def.renderer) {
|
23
|
+
renderer = defineRenderer(def);
|
24
|
+
} else {
|
25
|
+
throw new Error('Expected "template" or "renderer"');
|
26
|
+
}
|
27
|
+
|
28
|
+
return defineWidget(def, renderer);
|
29
|
+
};
|
30
|
+
|
31
|
+
defineRenderer = require("./defineRenderer-legacy");
|
32
|
+
defineWidget = require("./defineWidget-legacy");
|