@putout/bundle 4.6.8 → 4.6.10
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/bundle/putout.js +42 -9
- package/bundle/putout.min.js +1 -1
- package/package.json +1 -1
package/bundle/putout.js
CHANGED
|
@@ -62984,12 +62984,12 @@ var onceExports = once$9.exports;
|
|
|
62984
62984
|
|
|
62985
62985
|
const noop$3 = () => {};
|
|
62986
62986
|
|
|
62987
|
-
var
|
|
62987
|
+
var empty = /*#__PURE__*/Object.freeze({
|
|
62988
62988
|
__proto__: null,
|
|
62989
62989
|
default: noop$3
|
|
62990
62990
|
});
|
|
62991
62991
|
|
|
62992
|
-
var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(
|
|
62992
|
+
var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(empty);
|
|
62993
62993
|
|
|
62994
62994
|
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
62995
62995
|
|
|
@@ -69974,6 +69974,9 @@ jsx.getAttributeNode = getAttributeNode;
|
|
|
69974
69974
|
function getAttributeNode(path, name) {
|
|
69975
69975
|
let result = null;
|
|
69976
69976
|
|
|
69977
|
+
if (!path)
|
|
69978
|
+
return result;
|
|
69979
|
+
|
|
69977
69980
|
const node = path.node || path;
|
|
69978
69981
|
const {attributes} = node.openingElement;
|
|
69979
69982
|
|
|
@@ -69987,25 +69990,26 @@ function getAttributeNode(path, name) {
|
|
|
69987
69990
|
return result;
|
|
69988
69991
|
}
|
|
69989
69992
|
|
|
69990
|
-
jsx.getAttributeValue =
|
|
69993
|
+
jsx.getAttributeValue = getAttributeValue;
|
|
69994
|
+
function getAttributeValue(path, attributeName) {
|
|
69991
69995
|
const attribute = getAttributeNode(path, attributeName);
|
|
69992
69996
|
|
|
69993
69997
|
if (!attribute)
|
|
69994
69998
|
return '';
|
|
69995
69999
|
|
|
69996
70000
|
return attribute.value.value;
|
|
69997
|
-
}
|
|
69998
|
-
|
|
69999
|
-
|
|
70001
|
+
}
|
|
70002
|
+
jsx.addAttributeValue = addAttributeValue;
|
|
70003
|
+
function addAttributeValue(path, name, value) {
|
|
70000
70004
|
const attributeNode = getAttributeNode(path, name);
|
|
70001
70005
|
|
|
70002
70006
|
if (attributeNode.value.value.includes(value))
|
|
70003
70007
|
return;
|
|
70004
70008
|
|
|
70005
70009
|
setLiteralValue(attributeNode.value, `${attributeNode.value.value} ${value}`);
|
|
70006
|
-
}
|
|
70007
|
-
|
|
70008
|
-
|
|
70010
|
+
}
|
|
70011
|
+
jsx.removeAttributeValue = removeAttributeValue;
|
|
70012
|
+
function removeAttributeValue(path, name, attributeValue) {
|
|
70009
70013
|
if (!path)
|
|
70010
70014
|
return;
|
|
70011
70015
|
|
|
@@ -70016,6 +70020,35 @@ jsx.removeAttributeValue = (path, name, attributeValue) => {
|
|
|
70016
70020
|
|
|
70017
70021
|
if (value.includes(attributeValue))
|
|
70018
70022
|
setLiteralValue(classAttribute.value, value.replace(RegExp(`\\s?${attributeValue}`), ''));
|
|
70023
|
+
}
|
|
70024
|
+
jsx.setAttributeValue = (node, name, value) => {
|
|
70025
|
+
const attributeNode = getAttributeNode(node, name);
|
|
70026
|
+
|
|
70027
|
+
if (attributeNode)
|
|
70028
|
+
setLiteralValue(attributeNode.value, value);
|
|
70029
|
+
};
|
|
70030
|
+
|
|
70031
|
+
jsx.addClassName = (path, name) => {
|
|
70032
|
+
addAttributeValue(path, 'className', name);
|
|
70033
|
+
};
|
|
70034
|
+
|
|
70035
|
+
jsx.getClassName = getClassName;
|
|
70036
|
+
function getClassName(path) {
|
|
70037
|
+
return getAttributeValue(path, 'className');
|
|
70038
|
+
}
|
|
70039
|
+
|
|
70040
|
+
jsx.removeClassName = (path, name) => {
|
|
70041
|
+
removeAttributeValue(path, 'className', name);
|
|
70042
|
+
};
|
|
70043
|
+
|
|
70044
|
+
jsx.containsClassName = (path, className) => {
|
|
70045
|
+
const classNameValue = getClassName(path);
|
|
70046
|
+
return classNameValue.includes(className);
|
|
70047
|
+
};
|
|
70048
|
+
|
|
70049
|
+
jsx.hasDataName = (path, value = '') => {
|
|
70050
|
+
const attribute = getAttributeValue(path, 'data-name');
|
|
70051
|
+
return attribute === value;
|
|
70019
70052
|
};
|
|
70020
70053
|
|
|
70021
70054
|
/**
|