@solhun/feedback-kit-core 0.6.0 → 0.6.1
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/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2701,6 +2701,8 @@ function parseHintItem(item) {
|
|
|
2701
2701
|
const scope = obj.scope;
|
|
2702
2702
|
const platforms = parsePlatforms(obj.platforms);
|
|
2703
2703
|
if (platforms === null) return null;
|
|
2704
|
+
const element = parseElementRule(obj.element);
|
|
2705
|
+
if (element === MALFORMED_ELEMENT_RULE) return null;
|
|
2704
2706
|
return {
|
|
2705
2707
|
id,
|
|
2706
2708
|
label,
|
|
@@ -2708,7 +2710,7 @@ function parseHintItem(item) {
|
|
|
2708
2710
|
scope,
|
|
2709
2711
|
platforms,
|
|
2710
2712
|
paths: parsePaths(obj.paths),
|
|
2711
|
-
element
|
|
2713
|
+
element,
|
|
2712
2714
|
active: parseActive(obj.active)
|
|
2713
2715
|
};
|
|
2714
2716
|
}
|
|
@@ -2728,19 +2730,18 @@ function parsePaths(value) {
|
|
|
2728
2730
|
if (!Array.isArray(value)) return [];
|
|
2729
2731
|
return value.filter((p) => typeof p === "string");
|
|
2730
2732
|
}
|
|
2733
|
+
var MALFORMED_ELEMENT_RULE = /* @__PURE__ */ Symbol("malformed-element-rule");
|
|
2731
2734
|
function parseElementRule(value) {
|
|
2732
2735
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
2733
2736
|
const obj = value;
|
|
2734
2737
|
const rule = {};
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2738
|
+
const axes = ["tags", "roles", "classIncludes", "componentIncludes", "testIds"];
|
|
2739
|
+
for (const axis of axes) {
|
|
2740
|
+
if (!(axis in obj)) continue;
|
|
2741
|
+
const axisValue = obj[axis];
|
|
2742
|
+
if (!Array.isArray(axisValue)) return MALFORMED_ELEMENT_RULE;
|
|
2743
|
+
rule[axis] = axisValue.filter((v) => typeof v === "string");
|
|
2739
2744
|
}
|
|
2740
|
-
if (Array.isArray(obj.componentIncludes)) {
|
|
2741
|
-
rule.componentIncludes = obj.componentIncludes.filter((v) => typeof v === "string");
|
|
2742
|
-
}
|
|
2743
|
-
if (Array.isArray(obj.testIds)) rule.testIds = obj.testIds.filter((v) => typeof v === "string");
|
|
2744
2745
|
return rule;
|
|
2745
2746
|
}
|
|
2746
2747
|
function nonEmptyString(value) {
|