Skip to content

Commit 3d29f23

Browse files
committed
feat: rename default attr
1 parent e110024 commit 3d29f23

File tree

12 files changed

+22
-15
lines changed

12 files changed

+22
-15
lines changed

.changeset/hungry-olives-agree.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@marko/compiler": minor
3+
"@marko/translator-default": minor
4+
"marko": minor
5+
---
6+
7+
Changes the "default" attributes name to be "value". This is technically a breaking change, but it primarily only impacts the tags-api-preview which will also be getting a release to support this change.

packages/compiler/src/babel-plugin/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export function parseMarko(file) {
293293
endAttr();
294294
currentTag.node.attributes.push(
295295
(currentAttr = t.markoAttribute(
296-
name || "default",
296+
name || "value",
297297
t.booleanLiteral(true),
298298
modifier,
299299
undefined,

packages/translator-default/test/fixtures/attr-method-shorthand/snapshots/cjs-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _marko_template._ = (0, _renderer.default)(function (input, out, _componentDef,
2626
}
2727
}, out, _componentDef, "0");
2828
(0, _renderTag.default)(_customTag2.default, {
29-
"default": function () {
29+
"value": function () {
3030
console.log("again");
3131
}
3232
}, out, _componentDef, "1");

packages/translator-default/test/fixtures/attr-method-shorthand/snapshots/html-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
1616
}, out, _componentDef, "0");
1717

1818
_marko_tag(_customTag, {
19-
"default": function () {
19+
"value": function () {
2020
console.log("again");
2121
}
2222
}, out, _componentDef, "1");

packages/translator-default/test/fixtures/attr-method-shorthand/snapshots/htmlProduction-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
1616
}, out, _componentDef, "0");
1717

1818
_marko_tag(_customTag, {
19-
"default": function () {
19+
"value": function () {
2020
console.log("again");
2121
}
2222
}, out, _componentDef, "1");

packages/translator-default/test/fixtures/attr-method-shorthand/snapshots/vdom-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
2020
}, out, _componentDef, "0");
2121

2222
_marko_tag(_customTag, {
23-
"default": function () {
23+
"value": function () {
2424
console.log("again");
2525
}
2626
}, out, _componentDef, "1");

packages/translator-default/test/fixtures/attr-method-shorthand/snapshots/vdomProduction-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
2020
}, out, _componentDef, "0");
2121

2222
_marko_tag(_customTag, {
23-
"default": function () {
23+
"value": function () {
2424
console.log("again");
2525
}
2626
}, out, _componentDef, "1");

packages/translator-default/test/fixtures/tag-with-default-attr/snapshots/cjs-expected.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ var _default = _marko_template;
1818
exports.default = _default;
1919
const _marko_component = {};
2020
_marko_template._ = (0, _renderer.default)(function (input, out, _componentDef, _component, state) {
21-
out.w("<div default></div>");
21+
out.w("<div value></div>");
2222
out.w("<div></div>");
23-
out.w(`<div${(0, _attr.default)("default", abc)}></div>`);
23+
out.w(`<div${(0, _attr.default)("value", abc)}></div>`);
2424
}, {
2525
t: _marko_componentType,
2626
i: true,

packages/translator-default/test/fixtures/tag-with-default-attr/snapshots/html-expected.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import _marko_attr from "marko/src/runtime/html/helpers/attr.js";
88
import _marko_renderer from "marko/src/runtime/components/renderer.js";
99
const _marko_component = {};
1010
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state) {
11-
out.w("<div default></div>");
11+
out.w("<div value></div>");
1212
out.w("<div></div>");
13-
out.w(`<div${_marko_attr("default", abc)}></div>`);
13+
out.w(`<div${_marko_attr("value", abc)}></div>`);
1414
}, {
1515
t: _marko_componentType,
1616
i: true,

packages/translator-default/test/fixtures/tag-with-default-attr/snapshots/htmlProduction-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import _marko_attr from "marko/dist/runtime/html/helpers/attr.js";
88
import _marko_renderer from "marko/dist/runtime/components/renderer.js";
99
const _marko_component = {};
1010
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state) {
11-
out.w(`<div default></div><div></div><div${_marko_attr("default", abc)}></div>`);
11+
out.w(`<div value></div><div></div><div${_marko_attr("value", abc)}></div>`);
1212
}, {
1313
t: _marko_componentType,
1414
i: true

0 commit comments

Comments
 (0)