marko 5.29.2 → 5.30.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 +1 -1
- package/bin/markoc.js +18 -18
- 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/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
|
@@ -23,7 +23,7 @@ var voidWriter = {
|
|
|
23
23
|
},
|
|
24
24
|
toString: function () {
|
|
25
25
|
return "";
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
function State(root, stream, writer, events) {
|
|
@@ -235,7 +235,7 @@ var proto = (AsyncStream.prototype = {
|
|
|
235
235
|
|
|
236
236
|
state.events.emit("beginAsync", {
|
|
237
237
|
out: newStream,
|
|
238
|
-
parentOut: this
|
|
238
|
+
parentOut: this,
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
return newStream;
|
|
@@ -498,7 +498,7 @@ var proto = (AsyncStream.prototype = {
|
|
|
498
498
|
newOut.on("error", this.emit.bind(this, "error"));
|
|
499
499
|
this._state.events.emit("beginDetachedAsync", {
|
|
500
500
|
out: newOut,
|
|
501
|
-
parentOut: this
|
|
501
|
+
parentOut: this,
|
|
502
502
|
});
|
|
503
503
|
return newOut;
|
|
504
504
|
},
|
|
@@ -655,7 +655,7 @@ var proto = (AsyncStream.prototype = {
|
|
|
655
655
|
this.___assignedComponentDef = componentDef;
|
|
656
656
|
this.___assignedKey = key;
|
|
657
657
|
this.___assignedCustomEvents = customEvents;
|
|
658
|
-
}
|
|
658
|
+
},
|
|
659
659
|
});
|
|
660
660
|
|
|
661
661
|
// alias:
|
|
@@ -669,6 +669,6 @@ function getNonMarkoStack(error) {
|
|
|
669
669
|
.toString()
|
|
670
670
|
.split("\n")
|
|
671
671
|
.slice(1)
|
|
672
|
-
.filter(line => !/\/node_modules\/marko\//.test(line))
|
|
672
|
+
.filter((line) => !/\/node_modules\/marko\//.test(line))
|
|
673
673
|
.join("\n");
|
|
674
674
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var escapeQuoteHelpers = require("./escape-quotes");
|
|
4
4
|
var escapeDoubleQuotes = escapeQuoteHelpers.___escapeDoubleQuotes;
|
|
5
5
|
var escapeSingleQuotes = escapeQuoteHelpers.___escapeSingleQuotes;
|
|
6
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
6
7
|
|
|
7
8
|
module.exports = maybeEmptyAttr;
|
|
8
9
|
|
|
@@ -26,8 +27,20 @@ function notEmptyAttr(name, value) {
|
|
|
26
27
|
case "number":
|
|
27
28
|
return " " + name + "=" + value;
|
|
28
29
|
case "object":
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
switch (value.toString) {
|
|
31
|
+
case Object.prototype.toString:
|
|
32
|
+
case Array.prototype.toString:
|
|
33
|
+
// eslint-disable-next-line no-constant-condition
|
|
34
|
+
if ("MARKO_DEBUG") {
|
|
35
|
+
complain(
|
|
36
|
+
"Relying on JSON.stringify for attribute values is deprecated, in future versions of Marko these will be cast to strings instead.",
|
|
37
|
+
{ locationIndex: 2 }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return " " + name + singleQuote(JSON.stringify(value), 2);
|
|
42
|
+
case RegExp.prototype.toString:
|
|
43
|
+
return " " + name + guessQuotes(value.source);
|
|
31
44
|
}
|
|
32
45
|
}
|
|
33
46
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
4
|
var dynamicAttrHelper = require("./_dynamic-attr");
|
|
4
5
|
|
|
5
6
|
module.exports = function attrs(arg) {
|
|
@@ -11,6 +12,12 @@ module.exports = function attrs(arg) {
|
|
|
11
12
|
}
|
|
12
13
|
return result;
|
|
13
14
|
case "string":
|
|
15
|
+
// eslint-disable-next-line no-constant-condition
|
|
16
|
+
if ("MARKO_DEBUG") {
|
|
17
|
+
complain(
|
|
18
|
+
"Passing a string as a dynamic attribute value is deprecated - More details: https://github.com/marko-js/marko/wiki/Deprecation:-String-as-dynamic-attribute-value"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
14
21
|
return arg;
|
|
15
22
|
default:
|
|
16
23
|
return "";
|
|
@@ -1,20 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
4
|
var dynamicAttrHelper = require("./_dynamic-attr");
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Merges attribute objects into a string.
|
|
7
8
|
*/
|
|
8
9
|
module.exports = function mergeAttrs() {
|
|
9
|
-
var
|
|
10
|
+
var i = arguments.length;
|
|
11
|
+
var last = arguments[--i];
|
|
10
12
|
var seen = new Set();
|
|
13
|
+
var result = "";
|
|
14
|
+
var attrName;
|
|
15
|
+
|
|
16
|
+
if (typeof last === "string") {
|
|
17
|
+
// eslint-disable-next-line no-constant-condition
|
|
18
|
+
if ("MARKO_DEBUG") {
|
|
19
|
+
complain(
|
|
20
|
+
"Passing a string as dynamic attributes ('<div ${string}>' or '<div ...string>') is deprecated, use an object instead."
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
result += last[0] === " " ? last : " " + last;
|
|
25
|
+
} else {
|
|
26
|
+
for (attrName in last) {
|
|
27
|
+
result += dynamicAttrHelper(attrName, last[attrName]);
|
|
28
|
+
seen.add(attrName);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
while (i) {
|
|
33
|
+
var arg = arguments[--i];
|
|
34
|
+
if (typeof arg === "string") {
|
|
35
|
+
// eslint-disable-next-line no-constant-condition
|
|
36
|
+
if ("MARKO_DEBUG") {
|
|
37
|
+
complain(
|
|
38
|
+
"Passing a string as dynamic attributes ('<div ${string}>' or '<div ...string>') is deprecated, use an object instead."
|
|
39
|
+
);
|
|
40
|
+
}
|
|
11
41
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
42
|
+
result += arg[0] === " " ? arg : " " + arg;
|
|
43
|
+
} else {
|
|
44
|
+
for (attrName in arg) {
|
|
45
|
+
if (!seen.has(attrName)) {
|
|
46
|
+
result += dynamicAttrHelper(attrName, arg[attrName]);
|
|
47
|
+
seen.add(attrName);
|
|
48
|
+
}
|
|
18
49
|
}
|
|
19
50
|
}
|
|
20
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
globalThis.Marko = {
|
|
4
|
-
Component: function () {}
|
|
4
|
+
Component: function () {},
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ exports.t = function createTemplate(typeName) {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
function Template(typeName) {
|
|
18
|
-
this.___typeName = typeName;
|
|
18
|
+
this.path = this.___typeName = typeName;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
Template.prototype.stream = require("@internal/create-readable");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
var defaultCreateOut = require("./createOut");
|
|
2
4
|
var setImmediate = require("@internal/set-immediate").___setImmediate;
|
|
3
5
|
var extend = require("raptor-util/extend");
|
|
@@ -27,6 +29,7 @@ module.exports = function (target, renderer) {
|
|
|
27
29
|
var createOut = target.createOut || renderer.createOut || defaultCreateOut;
|
|
28
30
|
|
|
29
31
|
return extend(target, {
|
|
32
|
+
_: renderFunc,
|
|
30
33
|
createOut: createOut,
|
|
31
34
|
|
|
32
35
|
renderToString: function (data, callback) {
|
|
@@ -127,7 +130,7 @@ module.exports = function (target, renderer) {
|
|
|
127
130
|
if (callback) {
|
|
128
131
|
finalOut
|
|
129
132
|
.on("finish", function () {
|
|
130
|
-
callback(null, finalOut.___getResult());
|
|
133
|
+
callback(null, finalOut.___getResult(), finalOut);
|
|
131
134
|
})
|
|
132
135
|
.once("error", callback);
|
|
133
136
|
}
|
|
@@ -137,6 +140,6 @@ module.exports = function (target, renderer) {
|
|
|
137
140
|
globalData.template = globalData.template || this;
|
|
138
141
|
|
|
139
142
|
return safeRender(render, finalData, finalOut, shouldEnd);
|
|
140
|
-
}
|
|
143
|
+
},
|
|
141
144
|
});
|
|
142
145
|
};
|
|
@@ -288,7 +288,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
|
288
288
|
|
|
289
289
|
state.___events.emit("beginAsync", {
|
|
290
290
|
out: asyncOut,
|
|
291
|
-
parentOut: this
|
|
291
|
+
parentOut: this,
|
|
292
292
|
});
|
|
293
293
|
|
|
294
294
|
return asyncOut;
|
|
@@ -438,7 +438,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
|
438
438
|
this.___assignedComponentDef = componentDef;
|
|
439
439
|
this.___assignedKey = key;
|
|
440
440
|
this.___assignedCustomEvents = customEvents;
|
|
441
|
-
}
|
|
441
|
+
},
|
|
442
442
|
});
|
|
443
443
|
|
|
444
444
|
proto.e = proto.element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* jshint newcap:false */
|
|
2
2
|
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
4
|
var domData = require("../components/dom-data");
|
|
4
5
|
var componentsUtil = require("@internal/components-util");
|
|
5
6
|
var vElementByDOMNode = domData.___vElementByDOMNode;
|
|
@@ -14,7 +15,7 @@ var NS_MATH = "http://www.w3.org/1998/Math/MathML";
|
|
|
14
15
|
var NS_SVG = "http://www.w3.org/2000/svg";
|
|
15
16
|
var DEFAULT_NS = {
|
|
16
17
|
svg: NS_SVG,
|
|
17
|
-
math: NS_MATH
|
|
18
|
+
math: NS_MATH,
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
var FLAG_SIMPLE_ATTRS = 1;
|
|
@@ -30,8 +31,18 @@ function convertAttrValue(type, value) {
|
|
|
30
31
|
if (value === true) {
|
|
31
32
|
return "";
|
|
32
33
|
} else if (type == "object") {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
switch (value.toString) {
|
|
35
|
+
case Object.prototype.toString:
|
|
36
|
+
case Array.prototype.toString:
|
|
37
|
+
// eslint-disable-next-line no-constant-condition
|
|
38
|
+
if ("MARKO_DEBUG") {
|
|
39
|
+
complain(
|
|
40
|
+
"Relying on JSON.stringify for attribute values is deprecated, in future versions of Marko these will be cast to strings instead."
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return JSON.stringify(value);
|
|
44
|
+
case RegExp.prototype.toString:
|
|
45
|
+
return value.source;
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
|
|
@@ -201,7 +212,7 @@ VElement.prototype = {
|
|
|
201
212
|
// different namespaces
|
|
202
213
|
var value = this.___attributes[name];
|
|
203
214
|
return value != null && value !== false;
|
|
204
|
-
}
|
|
215
|
+
},
|
|
205
216
|
};
|
|
206
217
|
|
|
207
218
|
inherit(VElement, VNode);
|
|
@@ -213,7 +224,7 @@ var proto = (VElementClone.prototype = VElement.prototype);
|
|
|
213
224
|
get: function () {
|
|
214
225
|
var value = this.___attributes[name];
|
|
215
226
|
return value !== false && value != null;
|
|
216
|
-
}
|
|
227
|
+
},
|
|
217
228
|
});
|
|
218
229
|
});
|
|
219
230
|
|
|
@@ -229,7 +240,7 @@ defineProperty(proto, "___value", {
|
|
|
229
240
|
this.___attributes.type === "radio"
|
|
230
241
|
? "on"
|
|
231
242
|
: "";
|
|
232
|
-
}
|
|
243
|
+
},
|
|
233
244
|
});
|
|
234
245
|
|
|
235
246
|
VElement.___removePreservedAttributes = function (attrs) {
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
4
|
var classHelper = require("../../helpers/class-value");
|
|
4
5
|
var styleHelper = require("../../helpers/style-value");
|
|
6
|
+
var parseHTML = require("../parse-html");
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Helper for processing dynamic attributes
|
|
8
10
|
*/
|
|
9
11
|
module.exports = function (attributes) {
|
|
10
|
-
if (attributes
|
|
12
|
+
if (typeof attributes === "string") {
|
|
11
13
|
// eslint-disable-next-line no-constant-condition
|
|
12
14
|
if ("MARKO_DEBUG") {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
17
|
-
}
|
|
15
|
+
complain(
|
|
16
|
+
"Passing a string as a dynamic attribute value is deprecated - More details: https://github.com/marko-js/marko/wiki/Deprecation:-String-as-dynamic-attribute-value"
|
|
17
|
+
);
|
|
18
18
|
}
|
|
19
|
+
return parseAttrs(attributes);
|
|
20
|
+
}
|
|
19
21
|
|
|
22
|
+
if (attributes) {
|
|
20
23
|
var newAttributes = {};
|
|
21
24
|
|
|
22
25
|
for (var attrName in attributes) {
|
|
@@ -39,3 +42,20 @@ module.exports = function (attributes) {
|
|
|
39
42
|
|
|
40
43
|
return attributes;
|
|
41
44
|
};
|
|
45
|
+
|
|
46
|
+
function parseAttrs(str) {
|
|
47
|
+
if (str === "") {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var attrs = parseHTML("<a " + str + ">").attributes;
|
|
52
|
+
var result = {};
|
|
53
|
+
var attr;
|
|
54
|
+
|
|
55
|
+
for (var len = attrs.length, i = 0; i < len; i++) {
|
|
56
|
+
attr = attrs[i];
|
|
57
|
+
result[attr.name] = attr.value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var attrs = require("./attrs");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Merges attribute objects into a object.
|
|
7
|
+
*/
|
|
8
|
+
module.exports = function mergeAttrs() {
|
|
9
|
+
var len = arguments.length;
|
|
10
|
+
var result = {};
|
|
11
|
+
for (var i = 0; i < len; i++) {
|
|
12
|
+
Object.assign(result, attrs(arguments[i]));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
window.Marko = {
|
|
4
|
-
Component: function () {}
|
|
4
|
+
Component: function () {},
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ exports.t = function createTemplate(typeName) {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
function Template(typeName) {
|
|
18
|
-
this.___typeName = typeName;
|
|
18
|
+
this.path = this.___typeName = typeName;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
var AsyncVDOMBuilder = require("./AsyncVDOMBuilder");
|
package/src/taglib/index.js
CHANGED
package/tags-html.d.ts
CHANGED
|
@@ -186,6 +186,7 @@ declare global {
|
|
|
186
186
|
| "prev"
|
|
187
187
|
| "search"
|
|
188
188
|
| "tag"
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
189
190
|
| (string & {});
|
|
190
191
|
|
|
191
192
|
/**
|
|
@@ -313,6 +314,7 @@ declare global {
|
|
|
313
314
|
| "nofullscreen"
|
|
314
315
|
| "noplaybackrate"
|
|
315
316
|
| "noremoteplayback"
|
|
317
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
316
318
|
| (string & {});
|
|
317
319
|
|
|
318
320
|
/**
|
|
@@ -816,6 +818,7 @@ declare global {
|
|
|
816
818
|
| "opener"
|
|
817
819
|
| "prev"
|
|
818
820
|
| "search"
|
|
821
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
819
822
|
| (string & {});
|
|
820
823
|
/**
|
|
821
824
|
* Specifies the browsing context in which the linked resource will be opened.
|
|
@@ -925,6 +928,7 @@ declare global {
|
|
|
925
928
|
| "allow-top-navigation-by-user-activation"
|
|
926
929
|
| "allow-top-navigation-to-custom-protocols"
|
|
927
930
|
| "allow-top-navigation"
|
|
931
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
928
932
|
| (string & {});
|
|
929
933
|
/**
|
|
930
934
|
* The URL of the page to embed in the iframe.
|
|
@@ -1429,6 +1433,7 @@ declare global {
|
|
|
1429
1433
|
| "prev"
|
|
1430
1434
|
| "search"
|
|
1431
1435
|
| "stylesheet"
|
|
1436
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1432
1437
|
| (string & {});
|
|
1433
1438
|
|
|
1434
1439
|
/**
|
|
@@ -1779,6 +1784,7 @@ declare global {
|
|
|
1779
1784
|
| "application/javascript"
|
|
1780
1785
|
| "module"
|
|
1781
1786
|
| "import-map"
|
|
1787
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1782
1788
|
| (string & {});
|
|
1783
1789
|
|
|
1784
1790
|
/** @deprecated */
|
|
@@ -2236,6 +2242,7 @@ declare global {
|
|
|
2236
2242
|
| "nofullscreen"
|
|
2237
2243
|
| "noplaybackrate"
|
|
2238
2244
|
| "noremoteplayback"
|
|
2245
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2239
2246
|
| (string & {});
|
|
2240
2247
|
|
|
2241
2248
|
/**
|
|
@@ -3913,6 +3920,7 @@ type AttrTarget =
|
|
|
3913
3920
|
| "_parent"
|
|
3914
3921
|
| "_self"
|
|
3915
3922
|
| "_top"
|
|
3923
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3916
3924
|
| (string & {});
|
|
3917
3925
|
type AttrReferrerPolicy =
|
|
3918
3926
|
| AttrMissing
|
|
@@ -3985,6 +3993,7 @@ type AttrAutoComplete =
|
|
|
3985
3993
|
| "mobile"
|
|
3986
3994
|
| "fax"
|
|
3987
3995
|
| "pager"
|
|
3996
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3988
3997
|
| (string & {});
|
|
3989
3998
|
type Tag<Input> = Input extends Marko.HTMLAttributes<infer Element>
|
|
3990
3999
|
? Marko.NativeTag<Input, Element>
|