marko 5.36.4 → 5.37.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/dist/compiler/index.js +11 -11
- package/dist/core-tags/components/init-components-tag.js +4 -4
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/core/__flush_here_and_after__.js +1 -1
- package/dist/core-tags/core/await/AsyncValue.js +21 -21
- package/dist/core-tags/core/await/renderer.js +24 -24
- package/dist/core-tags/core/await/reorderer-renderer.js +6 -6
- package/dist/node-require/browser-refresh.js +18 -1
- package/dist/node-require/index.js +7 -7
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +5 -5
- package/dist/node_modules/@internal/components-beginComponent/index.js +12 -12
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +99 -99
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +3 -3
- package/dist/node_modules/@internal/components-endComponent/index.js +3 -3
- package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
- package/dist/node_modules/@internal/components-entry/index.js +29 -29
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +13 -13
- package/dist/node_modules/@internal/components-entry-legacy/index.js +1 -1
- package/dist/node_modules/@internal/components-registry/index-browser.js +102 -102
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +20 -20
- package/dist/node_modules/@internal/components-util/index.js +24 -20
- 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/preserve-tag/index-browser.js +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +6 -6
- package/dist/node_modules/@internal/set-immediate/index-browser.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index-worker.js +3 -3
- package/dist/node_modules/@internal/set-immediate/index.js +3 -3
- package/dist/runtime/RenderResult.js +24 -24
- package/dist/runtime/components/Component.js +163 -163
- package/dist/runtime/components/ComponentDef.js +34 -34
- package/dist/runtime/components/ComponentsContext.js +20 -20
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +17 -17
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +8 -8
- 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/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +25 -25
- package/dist/runtime/components/legacy/dependencies/index.js +10 -10
- package/dist/runtime/components/legacy/renderer-legacy.js +56 -56
- package/dist/runtime/components/renderer.js +45 -45
- package/dist/runtime/components/update-manager.js +4 -4
- 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 +33 -33
- package/dist/runtime/helpers/render-tag.js +1 -1
- package/dist/runtime/helpers/serialize-noop.js +2 -2
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +35 -35
- package/dist/runtime/helpers/tags-compat/runtime-html.js +16 -16
- package/dist/runtime/html/AsyncStream.js +28 -28
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/StringWriter.js +2 -2
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +11 -11
- package/dist/runtime/html/helpers/attrs.js +6 -6
- package/dist/runtime/html/helpers/data-marko.js +6 -6
- package/dist/runtime/html/helpers/escape-quotes.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/merge-attrs.js +11 -11
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +100 -100
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +5 -5
- package/dist/runtime/vdom/VDocumentFragment.js +8 -8
- package/dist/runtime/vdom/VElement.js +52 -52
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +34 -34
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +6 -6
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +20 -20
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +10 -10
- package/dist/runtime/vdom/morphdom/helpers.js +5 -5
- package/dist/runtime/vdom/morphdom/index.js +81 -81
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/taglib/index.js +7 -7
- package/dist/translator/cdata/index.js +15 -0
- package/dist/translator/cdata/index[html].js +15 -0
- package/dist/translator/cdata/index[vdom].js +12 -0
- package/dist/translator/class.js +65 -0
- package/dist/translator/comment/index.js +15 -0
- package/dist/translator/comment/index[html].js +17 -0
- package/dist/translator/comment/index[vdom].js +3 -0
- package/dist/translator/declaration/index.js +15 -0
- package/dist/translator/declaration/index[html].js +12 -0
- package/dist/translator/declaration/index[vdom].js +3 -0
- package/dist/translator/document-type/index.js +15 -0
- package/dist/translator/document-type/index[html].js +12 -0
- package/dist/translator/document-type/index[vdom].js +3 -0
- package/dist/translator/index.js +551 -0
- package/dist/translator/placeholder/index.js +15 -0
- package/dist/translator/placeholder/index[html].js +93 -0
- package/dist/translator/placeholder/index[vdom].js +22 -0
- package/dist/translator/scriptlet.js +4 -0
- package/dist/translator/tag/attribute/directives/class.js +42 -0
- package/dist/translator/tag/attribute/directives/index.js +15 -0
- package/dist/translator/tag/attribute/directives/no-update-body-if.js +15 -0
- package/dist/translator/tag/attribute/directives/no-update-body.js +10 -0
- package/dist/translator/tag/attribute/directives/no-update-if.js +12 -0
- package/dist/translator/tag/attribute/directives/no-update.js +48 -0
- package/dist/translator/tag/attribute/directives/style.js +42 -0
- package/dist/translator/tag/attribute/index.js +150 -0
- package/dist/translator/tag/attribute/modifiers/index.js +7 -0
- package/dist/translator/tag/attribute/modifiers/no-update.js +14 -0
- package/dist/translator/tag/attribute/modifiers/scoped.js +23 -0
- package/dist/translator/tag/attribute-tag.js +149 -0
- package/dist/translator/tag/custom-tag.js +146 -0
- package/dist/translator/tag/dynamic-tag.js +74 -0
- package/dist/translator/tag/index.js +287 -0
- package/dist/translator/tag/macro-tag.js +7 -0
- package/dist/translator/tag/native-tag.js +27 -0
- package/dist/translator/tag/native-tag[html]/attributes.js +151 -0
- package/dist/translator/tag/native-tag[html]/index.js +221 -0
- package/dist/translator/tag/native-tag[vdom]/attributes.js +105 -0
- package/dist/translator/tag/native-tag[vdom]/index.js +189 -0
- package/dist/translator/tag/util.js +246 -0
- package/dist/translator/taglib/core/conditional/translate-else-if.js +20 -0
- package/dist/translator/taglib/core/conditional/translate-else.js +20 -0
- package/dist/translator/taglib/core/conditional/translate-if.js +8 -0
- package/dist/translator/taglib/core/conditional/util.js +41 -0
- package/dist/translator/taglib/core/index.js +474 -0
- package/dist/translator/taglib/core/macro/parse.js +17 -0
- package/dist/translator/taglib/core/macro/translate.js +48 -0
- package/dist/translator/taglib/core/parse-class.js +79 -0
- package/dist/translator/taglib/core/parse-export.js +14 -0
- package/dist/translator/taglib/core/parse-import.js +14 -0
- package/dist/translator/taglib/core/parse-module-code.js +18 -0
- package/dist/translator/taglib/core/parse-static.js +18 -0
- package/dist/translator/taglib/core/transform-style.js +66 -0
- package/dist/translator/taglib/core/translate-await.js +41 -0
- package/dist/translator/taglib/core/translate-body.js +17 -0
- package/dist/translator/taglib/core/translate-for.js +156 -0
- package/dist/translator/taglib/core/translate-html-comment.js +52 -0
- package/dist/translator/taglib/core/translate-include-content.js +53 -0
- package/dist/translator/taglib/core/translate-server-only.js +5 -0
- package/dist/translator/taglib/core/translate-while.js +32 -0
- package/dist/translator/taglib/index.js +6 -0
- package/dist/translator/taglib/migrate/all-templates.js +46 -0
- package/dist/translator/taglib/migrate/index.js +5 -0
- package/dist/translator/text/index.js +10 -0
- package/dist/translator/text/index[html].js +12 -0
- package/dist/translator/text/index[vdom].js +20 -0
- package/dist/translator/util/add-dependencies.js +329 -0
- package/dist/translator/util/escape-regexp.js +4 -0
- package/dist/translator/util/get-component-files.js +86 -0
- package/dist/translator/util/html-out-write.js +15 -0
- package/dist/translator/util/key-manager.js +176 -0
- package/dist/translator/util/optimize-html-writes.js +52 -0
- package/dist/translator/util/optimize-vdom-create.js +164 -0
- package/dist/translator/util/plugin-hooks.js +22 -0
- package/dist/translator/util/runtime-flags.js +3 -0
- package/dist/translator/util/vdom-out-write.js +10 -0
- package/dist/translator/util/with-previous-location.js +6 -0
- package/package.json +7 -4
- package/src/taglib/index.js +2 -2
- package/src/translator/cdata/index.js +15 -0
- package/src/translator/cdata/index[html].js +15 -0
- package/src/translator/cdata/index[vdom].js +12 -0
- package/src/translator/class.js +65 -0
- package/src/translator/comment/index.js +15 -0
- package/src/translator/comment/index[html].js +17 -0
- package/src/translator/comment/index[vdom].js +3 -0
- package/src/translator/declaration/index.js +15 -0
- package/src/translator/declaration/index[html].js +12 -0
- package/src/translator/declaration/index[vdom].js +3 -0
- package/src/translator/document-type/index.js +15 -0
- package/src/translator/document-type/index[html].js +12 -0
- package/src/translator/document-type/index[vdom].js +3 -0
- package/src/translator/index.js +551 -0
- package/src/translator/placeholder/index.js +15 -0
- package/src/translator/placeholder/index[html].js +93 -0
- package/src/translator/placeholder/index[vdom].js +22 -0
- package/src/translator/scriptlet.js +4 -0
- package/src/translator/tag/attribute/directives/class.js +42 -0
- package/src/translator/tag/attribute/directives/index.js +15 -0
- package/src/translator/tag/attribute/directives/no-update-body-if.js +15 -0
- package/src/translator/tag/attribute/directives/no-update-body.js +10 -0
- package/src/translator/tag/attribute/directives/no-update-if.js +12 -0
- package/src/translator/tag/attribute/directives/no-update.js +48 -0
- package/src/translator/tag/attribute/directives/style.js +42 -0
- package/src/translator/tag/attribute/index.js +150 -0
- package/src/translator/tag/attribute/modifiers/index.js +7 -0
- package/src/translator/tag/attribute/modifiers/no-update.js +14 -0
- package/src/translator/tag/attribute/modifiers/scoped.js +23 -0
- package/src/translator/tag/attribute-tag.js +149 -0
- package/src/translator/tag/custom-tag.js +146 -0
- package/src/translator/tag/dynamic-tag.js +74 -0
- package/src/translator/tag/index.js +287 -0
- package/src/translator/tag/macro-tag.js +7 -0
- package/src/translator/tag/native-tag.js +27 -0
- package/src/translator/tag/native-tag[html]/attributes.js +151 -0
- package/src/translator/tag/native-tag[html]/index.js +221 -0
- package/src/translator/tag/native-tag[vdom]/attributes.js +105 -0
- package/src/translator/tag/native-tag[vdom]/index.js +189 -0
- package/src/translator/tag/util.js +246 -0
- package/src/translator/taglib/core/conditional/translate-else-if.js +20 -0
- package/src/translator/taglib/core/conditional/translate-else.js +20 -0
- package/src/translator/taglib/core/conditional/translate-if.js +8 -0
- package/src/translator/taglib/core/conditional/util.js +41 -0
- package/src/translator/taglib/core/index.js +474 -0
- package/src/translator/taglib/core/macro/parse.js +17 -0
- package/src/translator/taglib/core/macro/translate.js +48 -0
- package/src/translator/taglib/core/parse-class.js +79 -0
- package/src/translator/taglib/core/parse-export.js +14 -0
- package/src/translator/taglib/core/parse-import.js +14 -0
- package/src/translator/taglib/core/parse-module-code.js +18 -0
- package/src/translator/taglib/core/parse-static.js +18 -0
- package/src/translator/taglib/core/transform-style.js +66 -0
- package/src/translator/taglib/core/translate-await.js +41 -0
- package/src/translator/taglib/core/translate-body.js +17 -0
- package/src/translator/taglib/core/translate-for.js +156 -0
- package/src/translator/taglib/core/translate-html-comment.js +52 -0
- package/src/translator/taglib/core/translate-include-content.js +53 -0
- package/src/translator/taglib/core/translate-server-only.js +5 -0
- package/src/translator/taglib/core/translate-while.js +32 -0
- package/src/translator/taglib/index.js +7 -0
- package/src/translator/taglib/migrate/all-templates.js +46 -0
- package/src/translator/taglib/migrate/index.js +5 -0
- package/src/translator/text/index.js +10 -0
- package/src/translator/text/index[html].js +12 -0
- package/src/translator/text/index[vdom].js +20 -0
- package/src/translator/util/add-dependencies.js +329 -0
- package/src/translator/util/escape-regexp.js +4 -0
- package/src/translator/util/get-component-files.js +86 -0
- package/src/translator/util/html-out-write.js +15 -0
- package/src/translator/util/key-manager.js +176 -0
- package/src/translator/util/optimize-html-writes.js +52 -0
- package/src/translator/util/optimize-vdom-create.js +164 -0
- package/src/translator/util/plugin-hooks.js +22 -0
- package/src/translator/util/runtime-flags.js +3 -0
- package/src/translator/util/vdom-out-write.js +10 -0
- package/src/translator/util/with-previous-location.js +6 -0
- package/translator/index.d.ts +7 -0
- package/translator/package.json +5 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler");
|
|
2
|
+
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _toString = _interopRequireDefault(require("marko/src/runtime/helpers/to-string"));
|
|
9
|
+
var _escapeScriptPlaceholder = _interopRequireDefault(require("marko/src/runtime/html/helpers/escape-script-placeholder"));
|
|
10
|
+
var _escapeStylePlaceholder = _interopRequireDefault(require("marko/src/runtime/html/helpers/escape-style-placeholder"));
|
|
11
|
+
var _escapeXml = require("marko/src/runtime/html/helpers/escape-xml");
|
|
12
|
+
|
|
13
|
+
var _htmlOutWrite = _interopRequireDefault(require("../util/html-out-write"));
|
|
14
|
+
var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location"));
|
|
15
|
+
|
|
16
|
+
const ESCAPE_TYPES = {
|
|
17
|
+
html: {
|
|
18
|
+
name: "x",
|
|
19
|
+
module: "marko/src/runtime/html/helpers/escape-xml.js",
|
|
20
|
+
alias: "marko_escapeXml",
|
|
21
|
+
fn: _escapeXml.x
|
|
22
|
+
},
|
|
23
|
+
script: {
|
|
24
|
+
module: "marko/src/runtime/html/helpers/escape-script-placeholder.js",
|
|
25
|
+
alias: "marko_escapeScript",
|
|
26
|
+
fn: _escapeScriptPlaceholder.default
|
|
27
|
+
},
|
|
28
|
+
style: {
|
|
29
|
+
module: "marko/src/runtime/html/helpers/escape-style-placeholder.js",
|
|
30
|
+
alias: "marko_escapeStyle",
|
|
31
|
+
fn: _escapeStylePlaceholder.default
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function _default(path) {
|
|
36
|
+
const {
|
|
37
|
+
node,
|
|
38
|
+
hub: { file }
|
|
39
|
+
} = path;
|
|
40
|
+
const computed = (0, _babelUtils.computeNode)(node.value);
|
|
41
|
+
let { escape, value } = node;
|
|
42
|
+
|
|
43
|
+
if (escape) {
|
|
44
|
+
const tagName = findParentTagName(path);
|
|
45
|
+
const escapeType = ESCAPE_TYPES[tagName] || ESCAPE_TYPES.html;
|
|
46
|
+
|
|
47
|
+
value = computed ?
|
|
48
|
+
_compiler.types.stringLiteral(escapeType.fn(computed.value)) :
|
|
49
|
+
_compiler.types.callExpression(
|
|
50
|
+
escapeType.name ?
|
|
51
|
+
(0, _babelUtils.importNamed)(
|
|
52
|
+
file,
|
|
53
|
+
escapeType.module,
|
|
54
|
+
escapeType.name,
|
|
55
|
+
escapeType.alias
|
|
56
|
+
) :
|
|
57
|
+
(0, _babelUtils.importDefault)(file, escapeType.module, escapeType.alias),
|
|
58
|
+
[value]
|
|
59
|
+
);
|
|
60
|
+
} else {
|
|
61
|
+
value = computed ?
|
|
62
|
+
_compiler.types.stringLiteral((0, _toString.default)(computed.value)) :
|
|
63
|
+
_compiler.types.callExpression(
|
|
64
|
+
(0, _babelUtils.importDefault)(
|
|
65
|
+
file,
|
|
66
|
+
"marko/src/runtime/helpers/to-string.js",
|
|
67
|
+
"marko_to_string"
|
|
68
|
+
),
|
|
69
|
+
[value]
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const replacement = (0, _htmlOutWrite.default)`${value}`;
|
|
74
|
+
|
|
75
|
+
if (replacement) {
|
|
76
|
+
path.replaceWith((0, _withPreviousLocation.default)(replacement, node));
|
|
77
|
+
} else {
|
|
78
|
+
path.remove();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function findParentTagName(path) {
|
|
83
|
+
while (path = path.parentPath) {
|
|
84
|
+
if (path.isProgram()) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (path.isMarkoTag()) {
|
|
89
|
+
const tagDef = (0, _babelUtils.getTagDef)(path);
|
|
90
|
+
return tagDef && tagDef.html && path.get("name.value").node;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/compiler/babel-utils");
|
|
2
|
+
|
|
3
|
+
var _vdomOutWrite = _interopRequireDefault(require("../util/vdom-out-write"));
|
|
4
|
+
var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location"));
|
|
5
|
+
|
|
6
|
+
function _default(path) {
|
|
7
|
+
const { node } = path;
|
|
8
|
+
const { escape, value } = node;
|
|
9
|
+
const method = escape ? "t" : "h";
|
|
10
|
+
const computed = (0, _babelUtils.computeNode)(value);
|
|
11
|
+
|
|
12
|
+
if (computed && computed.value == null) {
|
|
13
|
+
path.remove();
|
|
14
|
+
} else {
|
|
15
|
+
path.replaceWith(
|
|
16
|
+
(0, _withPreviousLocation.default)(
|
|
17
|
+
(0, _vdomOutWrite.default)(method, value, path.hub.file._componentInstanceIdentifier),
|
|
18
|
+
node
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
|
|
2
|
+
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _classValue = _interopRequireDefault(require("marko/src/runtime/helpers/class-value"));
|
|
8
|
+
|
|
9
|
+
var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-previous-location"));var _default = exports.default =
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
exit(tag, _, value) {
|
|
13
|
+
const {
|
|
14
|
+
hub: { file }
|
|
15
|
+
} = tag;
|
|
16
|
+
if (!(0, _babelUtils.isNativeTag)(tag)) return;
|
|
17
|
+
|
|
18
|
+
const computed = (0, _babelUtils.computeNode)(value.node);
|
|
19
|
+
if (computed) {
|
|
20
|
+
const str = (0, _classValue.default)(computed.value);
|
|
21
|
+
if (str) {
|
|
22
|
+
value.replaceWith(_compiler.types.stringLiteral(str));
|
|
23
|
+
} else {
|
|
24
|
+
value.parentPath.remove();
|
|
25
|
+
}
|
|
26
|
+
} else if (!value.isTemplateLiteral()) {
|
|
27
|
+
value.replaceWith(
|
|
28
|
+
(0, _withPreviousLocation.default)(
|
|
29
|
+
_compiler.types.callExpression(
|
|
30
|
+
(0, _babelUtils.importDefault)(
|
|
31
|
+
file,
|
|
32
|
+
"marko/src/runtime/helpers/class-value.js",
|
|
33
|
+
"marko_class_merge"
|
|
34
|
+
),
|
|
35
|
+
[value.node]
|
|
36
|
+
),
|
|
37
|
+
value.node
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _class = _interopRequireDefault(require("./class"));
|
|
2
|
+
var _noUpdate = _interopRequireDefault(require("./no-update"));
|
|
3
|
+
var _noUpdateBody = _interopRequireDefault(require("./no-update-body"));
|
|
4
|
+
var _noUpdateBodyIf = _interopRequireDefault(require("./no-update-body-if"));
|
|
5
|
+
var _noUpdateIf = _interopRequireDefault(require("./no-update-if"));
|
|
6
|
+
var _style = _interopRequireDefault(require("./style"));var _default = exports.default =
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
class: _class.default,
|
|
10
|
+
style: _style.default,
|
|
11
|
+
"no-update": _noUpdate.default,
|
|
12
|
+
"no-update-if": _noUpdateIf.default,
|
|
13
|
+
"no-update-body": _noUpdateBody.default,
|
|
14
|
+
"no-update-body-if": _noUpdateBodyIf.default
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _babelUtils = require("@marko/compiler/babel-utils");
|
|
2
|
+
|
|
3
|
+
var _noUpdate = _interopRequireDefault(require("./no-update"));var _default = exports.default =
|
|
4
|
+
|
|
5
|
+
{
|
|
6
|
+
enter(tag) {
|
|
7
|
+
tag.node.isPreserved = true;
|
|
8
|
+
},
|
|
9
|
+
exit(tag, attr, value) {
|
|
10
|
+
_noUpdate.default.exit(tag, attr, value, {
|
|
11
|
+
if: (0, _babelUtils.getArgOrSequence)(attr),
|
|
12
|
+
bodyOnly: true
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _noUpdate = _interopRequireDefault(require("./no-update"));var _default = exports.default =
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
enter(tag) {
|
|
5
|
+
tag.node.isPreserved = true;
|
|
6
|
+
},
|
|
7
|
+
exit(tag, attr, value) {
|
|
8
|
+
_noUpdate.default.exit(tag, attr, value, { bodyOnly: true });
|
|
9
|
+
}
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _babelUtils = require("@marko/compiler/babel-utils");
|
|
2
|
+
|
|
3
|
+
var _noUpdate = _interopRequireDefault(require("./no-update"));var _default = exports.default =
|
|
4
|
+
|
|
5
|
+
{
|
|
6
|
+
enter(tag) {
|
|
7
|
+
tag.node.isPreserved = true;
|
|
8
|
+
},
|
|
9
|
+
exit(tag, attr, value) {
|
|
10
|
+
_noUpdate.default.exit(tag, attr, value, { if: (0, _babelUtils.getArgOrSequence)(attr) });
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
|
|
2
|
+
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const EMPTY_OBJECT = {};var _default = exports.default =
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
enter(tag) {
|
|
10
|
+
tag.node.isPreserved = true;
|
|
11
|
+
},
|
|
12
|
+
exit(tag, attr, _, opts = EMPTY_OBJECT) {
|
|
13
|
+
attr.remove();
|
|
14
|
+
const { node } = tag;
|
|
15
|
+
const replacement = _compiler.types.markoTag(
|
|
16
|
+
_compiler.types.stringLiteral("_preserve"),
|
|
17
|
+
[],
|
|
18
|
+
opts.bodyOnly ? node.body : _compiler.types.markoTagBody([node])
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if ((0, _babelUtils.isNativeTag)(tag)) {
|
|
22
|
+
replacement.key = node.key;
|
|
23
|
+
replacement.attributes.push(
|
|
24
|
+
_compiler.types.markoAttribute("n", _compiler.types.booleanLiteral(true))
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (opts.bodyOnly) {
|
|
28
|
+
replacement.attributes.push(
|
|
29
|
+
_compiler.types.markoAttribute("b", _compiler.types.booleanLiteral(true))
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
replacement.key = (0, _babelUtils.normalizeTemplateString)`p_${node.key}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
replacement.isPreserved = true;
|
|
37
|
+
|
|
38
|
+
if (opts.if) {
|
|
39
|
+
replacement.attributes.push(_compiler.types.markoAttribute("i", opts.if));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (opts.bodyOnly) {
|
|
43
|
+
tag.set("body", _compiler.types.markoTagBody([replacement]));
|
|
44
|
+
} else {
|
|
45
|
+
tag.replaceWith(replacement);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
|
|
2
|
+
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _styleValue = _interopRequireDefault(require("marko/src/runtime/helpers/style-value"));
|
|
8
|
+
|
|
9
|
+
var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-previous-location"));var _default = exports.default =
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
exit(tag, _, value) {
|
|
13
|
+
const {
|
|
14
|
+
hub: { file }
|
|
15
|
+
} = tag;
|
|
16
|
+
if (!(0, _babelUtils.isNativeTag)(tag)) return;
|
|
17
|
+
|
|
18
|
+
const computed = (0, _babelUtils.computeNode)(value.node);
|
|
19
|
+
if (computed) {
|
|
20
|
+
const str = (0, _styleValue.default)(computed.value);
|
|
21
|
+
if (str) {
|
|
22
|
+
value.replaceWith(_compiler.types.stringLiteral(str));
|
|
23
|
+
} else {
|
|
24
|
+
value.parentPath.remove();
|
|
25
|
+
}
|
|
26
|
+
} else if (!value.isTemplateLiteral()) {
|
|
27
|
+
value.replaceWith(
|
|
28
|
+
(0, _withPreviousLocation.default)(
|
|
29
|
+
_compiler.types.callExpression(
|
|
30
|
+
(0, _babelUtils.importDefault)(
|
|
31
|
+
file,
|
|
32
|
+
"marko/src/runtime/helpers/style-value.js",
|
|
33
|
+
"marko_style_merge"
|
|
34
|
+
),
|
|
35
|
+
[value.node]
|
|
36
|
+
),
|
|
37
|
+
value.node
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _babelUtils = require("@marko/compiler/babel-utils");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _directives = _interopRequireDefault(require("./directives"));
|
|
8
|
+
var _modifiers = _interopRequireDefault(require("./modifiers"));
|
|
9
|
+
|
|
10
|
+
const EMPTY_ARRAY = [];
|
|
11
|
+
const EVENT_REG = /^(on(?:ce)?)(-)?(.*)$/;
|
|
12
|
+
const attachedDetachedLoaded = new WeakSet();var _default = exports.default =
|
|
13
|
+
|
|
14
|
+
{
|
|
15
|
+
enter(attr) {
|
|
16
|
+
const {
|
|
17
|
+
hub: { file }
|
|
18
|
+
} = attr;
|
|
19
|
+
const tag = attr.parentPath;
|
|
20
|
+
const value = attr.get("value");
|
|
21
|
+
const { name, arguments: args } = attr.node;
|
|
22
|
+
const isVDOM = file.markoOpts.output !== "html";
|
|
23
|
+
|
|
24
|
+
if (execModifiersAndDirectives("enter", tag, attr, value)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Event handlers.
|
|
29
|
+
let [, eventType, isDash, eventName] = EVENT_REG.exec(name) || EMPTY_ARRAY;
|
|
30
|
+
|
|
31
|
+
if (eventType && args) {
|
|
32
|
+
if (!args.length) {
|
|
33
|
+
throw attr.buildCodeFrameError("Event handler is missing arguments.");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!value.isBooleanLiteral(true)) {
|
|
37
|
+
throw value.buildCodeFrameError(
|
|
38
|
+
`"${name}(handler, ...args)" does not accept a value.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!isDash) {
|
|
43
|
+
// When the event is not in dash case we normalized differently for html tags and custom tags.
|
|
44
|
+
|
|
45
|
+
if ((0, _babelUtils.isNativeTag)(tag)) {
|
|
46
|
+
// Lowercase the string
|
|
47
|
+
// Example: onMouseOver → mouseover
|
|
48
|
+
eventName = eventName.toLowerCase();
|
|
49
|
+
} else {
|
|
50
|
+
// Convert first character to lower case:
|
|
51
|
+
// Example: onBeforeShow → beforeShow
|
|
52
|
+
eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const handlers = tag.node.handlers = tag.node.handlers || {};
|
|
57
|
+
if (handlers[eventName]) {
|
|
58
|
+
throw attr.buildCodeFrameError(
|
|
59
|
+
"Duplicate event handlers are not supported."
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
handlers[eventName] = {
|
|
64
|
+
arguments: args,
|
|
65
|
+
once: eventType === "once"
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (isVDOM) {
|
|
69
|
+
if (eventName === "attach" || eventName === "detach") {
|
|
70
|
+
if (!attachedDetachedLoaded.has(file)) {
|
|
71
|
+
// Pull in helper for element attach/detach;
|
|
72
|
+
attachedDetachedLoaded.add(file);
|
|
73
|
+
(0, _babelUtils.importDefault)(
|
|
74
|
+
file,
|
|
75
|
+
"marko/src/runtime/components/attach-detach.js"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
attr.remove();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
exit(attr) {
|
|
86
|
+
const tag = attr.parentPath;
|
|
87
|
+
const { name, arguments: args } = attr.node;
|
|
88
|
+
const value = attr.get("value");
|
|
89
|
+
|
|
90
|
+
if (execModifiersAndDirectives("exit", tag, attr, value)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const tagDef = (0, _babelUtils.getTagDef)(tag);
|
|
95
|
+
|
|
96
|
+
if (tagDef) {
|
|
97
|
+
if (!tagDef.html && !tagDef.getAttribute(name)) {
|
|
98
|
+
throw attr.buildCodeFrameError(
|
|
99
|
+
`<${
|
|
100
|
+
tag.get("name.value").node}> does not support the "${
|
|
101
|
+
name}" attribute.`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (args && args.length) {
|
|
107
|
+
throw attr.buildCodeFrameError(
|
|
108
|
+
`Unsupported arguments on the "${name}" attribute.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (attr.node.bound) {
|
|
113
|
+
throw attr.buildCodeFrameError(
|
|
114
|
+
`The binding syntax (:=) is only supported when using the "Tags API".`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
function execModifiersAndDirectives(type, tag, attr, value) {
|
|
121
|
+
const { node } = attr;
|
|
122
|
+
const { name, modifier } = node;
|
|
123
|
+
|
|
124
|
+
if (modifier) {
|
|
125
|
+
const modifierTranslate = _modifiers.default[modifier];
|
|
126
|
+
if (modifierTranslate) {
|
|
127
|
+
if (modifierTranslate[type]) {
|
|
128
|
+
const tagNode = tag.node;
|
|
129
|
+
const attrNode = attr.node;
|
|
130
|
+
modifierTranslate[type](tag, attr, value);
|
|
131
|
+
if (tag.node !== tagNode || attr.node !== attrNode) return true;
|
|
132
|
+
}
|
|
133
|
+
} else if (name === "xlink" && modifier === "href" && (0, _babelUtils.isNativeTag)(tag)) {
|
|
134
|
+
node.name += `:${modifier}`;
|
|
135
|
+
node.modifier = undefined;
|
|
136
|
+
} else {
|
|
137
|
+
throw attr.buildCodeFrameError(`Unsupported modifier "${modifier}".`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const directiveTranslate = _directives.default[name];
|
|
142
|
+
if (directiveTranslate) {
|
|
143
|
+
if (directiveTranslate[type]) {
|
|
144
|
+
const tagNode = tag.node;
|
|
145
|
+
const attrNode = attr.node;
|
|
146
|
+
directiveTranslate[type](tag, attr, value);
|
|
147
|
+
if (tag.node !== tagNode || attr.node !== attrNode) return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _noUpdate = _interopRequireDefault(require("./no-update"));
|
|
2
|
+
var _scoped = _interopRequireDefault(require("./scoped"));var _default = exports.default =
|
|
3
|
+
|
|
4
|
+
{
|
|
5
|
+
scoped: _scoped.default,
|
|
6
|
+
"no-update": _noUpdate.default
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";exports.__esModule = true;exports.default = void 0; /**
|
|
2
|
+
* Does nothing in html mode.
|
|
3
|
+
*/var _default = exports.default =
|
|
4
|
+
{
|
|
5
|
+
exit(tag, attr) {
|
|
6
|
+
const { node } = tag;
|
|
7
|
+
|
|
8
|
+
if (!node.preserveAttrs) {
|
|
9
|
+
node.preserveAttrs = [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
node.preserveAttrs.push(attr.node.name);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
|
|
2
|
+
|
|
3
|
+
var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-previous-location"));var _default = exports.default =
|
|
4
|
+
|
|
5
|
+
{
|
|
6
|
+
exit(tag, _, value) {
|
|
7
|
+
const {
|
|
8
|
+
hub: { file }
|
|
9
|
+
} = tag;
|
|
10
|
+
value.replaceWith(
|
|
11
|
+
(0, _withPreviousLocation.default)(
|
|
12
|
+
_compiler.types.callExpression(
|
|
13
|
+
_compiler.types.memberExpression(
|
|
14
|
+
file._componentDefIdentifier,
|
|
15
|
+
_compiler.types.identifier("elId")
|
|
16
|
+
),
|
|
17
|
+
[value.node]
|
|
18
|
+
),
|
|
19
|
+
value.node
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";exports.__esModule = true;exports.analyzeAttributeTags = analyzeAttributeTags;exports.default = translateAttributeTag;var _compiler = require("@marko/compiler");
|
|
2
|
+
var _babelUtils = require("@marko/compiler/babel-utils");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _util = require("./util");
|
|
13
|
+
|
|
14
|
+
const attributeTagsForTag = new WeakMap();
|
|
15
|
+
const contentTypeCache = new WeakMap();
|
|
16
|
+
const ContentType = {
|
|
17
|
+
attribute: 0,
|
|
18
|
+
render: 1,
|
|
19
|
+
mixed: 2
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function analyzeAttributeTags(rootTag) {
|
|
23
|
+
const visit = [rootTag];
|
|
24
|
+
const parentTags = [rootTag];
|
|
25
|
+
let i = 0;
|
|
26
|
+
let attributeTags;
|
|
27
|
+
|
|
28
|
+
while (i < visit.length) {
|
|
29
|
+
const tag = visit[i++];
|
|
30
|
+
const attrTags = tag.node.body.attributeTags ?
|
|
31
|
+
tag.get("body").get("body") :
|
|
32
|
+
tag.get("attributeTags");
|
|
33
|
+
for (const child of attrTags) {
|
|
34
|
+
if ((0, _babelUtils.isAttributeTag)(child)) {
|
|
35
|
+
(0, _babelUtils.assertNoArgs)(child);
|
|
36
|
+
const tagDef = (0, _babelUtils.getTagDef)(child) || {};
|
|
37
|
+
const name = (0, _babelUtils.getFullyResolvedTagName)(child);
|
|
38
|
+
let {
|
|
39
|
+
targetProperty = child.node.name.value.slice(1),
|
|
40
|
+
isRepeated = false
|
|
41
|
+
} = tagDef;
|
|
42
|
+
|
|
43
|
+
const preserveName =
|
|
44
|
+
tagDef.preserveName === true || tagDef.removeDashes === false;
|
|
45
|
+
|
|
46
|
+
if (!preserveName) {
|
|
47
|
+
targetProperty = removeDashes(targetProperty);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const attrTagMeta = (attributeTags ||= {})[name] ||= {
|
|
51
|
+
targetProperty,
|
|
52
|
+
isRepeated
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
(child.node.extra ||= {}).attributeTag = attrTagMeta;
|
|
56
|
+
|
|
57
|
+
const parentTag = (0, _babelUtils.findParentTag)(child);
|
|
58
|
+
const parentTagExtra = parentTag.node.extra ||= {};
|
|
59
|
+
const parentSeenAttributeTagProperties =
|
|
60
|
+
attributeTagsForTag.get(parentTag);
|
|
61
|
+
let hasAttributeTags = false;
|
|
62
|
+
|
|
63
|
+
if (!parentSeenAttributeTagProperties) {
|
|
64
|
+
parentTagExtra.hasAttributeTags = true;
|
|
65
|
+
attributeTagsForTag.set(parentTag, new Set([targetProperty]));
|
|
66
|
+
} else if (parentSeenAttributeTagProperties.has(targetProperty)) {
|
|
67
|
+
hasAttributeTags = true;
|
|
68
|
+
} else {
|
|
69
|
+
parentSeenAttributeTagProperties.add(targetProperty);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!hasAttributeTags) {
|
|
73
|
+
if (
|
|
74
|
+
parentTag.
|
|
75
|
+
get("attributes").
|
|
76
|
+
some(
|
|
77
|
+
(attr) =>
|
|
78
|
+
attr.isMarkoSpreadAttribute() ||
|
|
79
|
+
attr.node.name === targetProperty
|
|
80
|
+
))
|
|
81
|
+
{
|
|
82
|
+
parentTag.pushContainer(
|
|
83
|
+
"attributes",
|
|
84
|
+
_compiler.types.markoAttribute(
|
|
85
|
+
targetProperty,
|
|
86
|
+
_compiler.types.unaryExpression("void", _compiler.types.numericLiteral(0))
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
parentTags.push(child);
|
|
93
|
+
visit.push(child);
|
|
94
|
+
} else if ((0, _babelUtils.isTransparentTag)(child)) {
|
|
95
|
+
visit.push(child);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (attributeTags) {
|
|
101
|
+
(rootTag.node.extra ??= {}).attributeTags = attributeTags;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function translateAttributeTag(tag) {
|
|
106
|
+
const { node } = tag;
|
|
107
|
+
const meta = node.extra?.attributeTag;
|
|
108
|
+
if (!meta) {
|
|
109
|
+
throw tag.
|
|
110
|
+
get("name").
|
|
111
|
+
buildCodeFrameError("@tags must be nested within another element.");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
(0, _babelUtils.assertNoArgs)(tag);
|
|
115
|
+
|
|
116
|
+
tag.replaceWith(
|
|
117
|
+
_compiler.types.expressionStatement(
|
|
118
|
+
_compiler.types.callExpression(
|
|
119
|
+
(0, _babelUtils.importNamed)(
|
|
120
|
+
tag.hub.file,
|
|
121
|
+
"marko/src/runtime/helpers/attr-tag.js",
|
|
122
|
+
meta.isRepeated ? "r" : "a",
|
|
123
|
+
meta.isRepeated ?
|
|
124
|
+
"marko_repeated_attr_tag" :
|
|
125
|
+
"marko_repeatable_attr_tag"
|
|
126
|
+
),
|
|
127
|
+
[_compiler.types.stringLiteral(meta.targetProperty), getAttrTagObject(tag)]
|
|
128
|
+
)
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function getAttrTagObject(tag) {
|
|
134
|
+
const attrs = (0, _util.getAttrs)(tag, false, true);
|
|
135
|
+
|
|
136
|
+
if (_compiler.types.isNullLiteral(attrs)) {
|
|
137
|
+
return _compiler.types.objectExpression([]);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return attrs;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function removeDashes(str) {
|
|
144
|
+
return str.replace(/-([a-z])/g, matchToUpperCase);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function matchToUpperCase(_match, lower) {
|
|
148
|
+
return lower.toUpperCase();
|
|
149
|
+
}
|