@purescraps/purehtml 0.6.0 → 0.7.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/examples/simple.js +21 -17
- package/dist/examples/simple.js.map +1 -1
- package/dist/src/index.js +18 -14
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -6
package/dist/src/index.js
CHANGED
|
@@ -6793,7 +6793,9 @@ var RemoveUrlQueryParam = class _RemoveUrlQueryParam extends Transformer {
|
|
|
6793
6793
|
}
|
|
6794
6794
|
if (args.length === 0) return val;
|
|
6795
6795
|
const url = new URL(val);
|
|
6796
|
-
|
|
6796
|
+
for (const paramName of args) {
|
|
6797
|
+
url.searchParams.delete(paramName);
|
|
6798
|
+
}
|
|
6797
6799
|
return url.toString();
|
|
6798
6800
|
}
|
|
6799
6801
|
};
|
|
@@ -6878,15 +6880,18 @@ var UrlQueryParamTransformer = class _UrlQueryParamTransformer extends Transform
|
|
|
6878
6880
|
if (args.length === 1) {
|
|
6879
6881
|
return url.searchParams.get(args[0]);
|
|
6880
6882
|
}
|
|
6881
|
-
return args.reduce(
|
|
6882
|
-
acc
|
|
6883
|
-
|
|
6884
|
-
|
|
6883
|
+
return args.reduce(
|
|
6884
|
+
(acc, arg) => {
|
|
6885
|
+
acc[arg] = url.searchParams.get(arg);
|
|
6886
|
+
return acc;
|
|
6887
|
+
},
|
|
6888
|
+
{}
|
|
6889
|
+
);
|
|
6885
6890
|
}
|
|
6886
6891
|
};
|
|
6887
6892
|
|
|
6888
6893
|
// src/transformers/transformers.ts
|
|
6889
|
-
var Transformers = class {
|
|
6894
|
+
var Transformers = class _Transformers {
|
|
6890
6895
|
static transformers = [
|
|
6891
6896
|
AttributeTransformer,
|
|
6892
6897
|
Exists,
|
|
@@ -6900,7 +6905,7 @@ var Transformers = class {
|
|
|
6900
6905
|
UrlQueryParamTransformer
|
|
6901
6906
|
];
|
|
6902
6907
|
static getByName(name) {
|
|
6903
|
-
return
|
|
6908
|
+
return _Transformers.transformers.find((tr) => tr.getName() === name);
|
|
6904
6909
|
}
|
|
6905
6910
|
};
|
|
6906
6911
|
|
|
@@ -7020,21 +7025,20 @@ var UnionConfig = class _UnionConfig extends Config {
|
|
|
7020
7025
|
const $parent = params.$el;
|
|
7021
7026
|
for (const config of this.configs) {
|
|
7022
7027
|
if (config instanceof ConfigWithSelector) {
|
|
7023
|
-
const $
|
|
7028
|
+
const $matches = config.getAllMatches($parent, {
|
|
7024
7029
|
alreadyMatched: false,
|
|
7025
7030
|
includeRoot: true
|
|
7026
7031
|
});
|
|
7027
|
-
if (!$
|
|
7032
|
+
if (!$matches || Array.isArray($matches) && $matches.length === 0)
|
|
7028
7033
|
continue;
|
|
7029
|
-
}
|
|
7030
7034
|
return config.extract({
|
|
7031
7035
|
...params,
|
|
7032
|
-
$el,
|
|
7033
|
-
|
|
7036
|
+
$el: Array.isArray($matches) ? $matches.length > 1 ? $parent : $matches[0] : $matches,
|
|
7037
|
+
// arrays must be matched again
|
|
7038
|
+
elementAlreadyMatched: !Array.isArray($matches) || $matches.length === 1
|
|
7034
7039
|
});
|
|
7035
|
-
} else {
|
|
7036
|
-
return config.extract({ ...params, $el: params.$el });
|
|
7037
7040
|
}
|
|
7041
|
+
return config.extract({ ...params, $el: params.$el });
|
|
7038
7042
|
}
|
|
7039
7043
|
return null;
|
|
7040
7044
|
}
|