@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.js
CHANGED
|
@@ -2583,6 +2583,8 @@ function parseHintItem(item) {
|
|
|
2583
2583
|
const scope = obj.scope;
|
|
2584
2584
|
const platforms = parsePlatforms(obj.platforms);
|
|
2585
2585
|
if (platforms === null) return null;
|
|
2586
|
+
const element = parseElementRule(obj.element);
|
|
2587
|
+
if (element === MALFORMED_ELEMENT_RULE) return null;
|
|
2586
2588
|
return {
|
|
2587
2589
|
id,
|
|
2588
2590
|
label,
|
|
@@ -2590,7 +2592,7 @@ function parseHintItem(item) {
|
|
|
2590
2592
|
scope,
|
|
2591
2593
|
platforms,
|
|
2592
2594
|
paths: parsePaths(obj.paths),
|
|
2593
|
-
element
|
|
2595
|
+
element,
|
|
2594
2596
|
active: parseActive(obj.active)
|
|
2595
2597
|
};
|
|
2596
2598
|
}
|
|
@@ -2610,19 +2612,18 @@ function parsePaths(value) {
|
|
|
2610
2612
|
if (!Array.isArray(value)) return [];
|
|
2611
2613
|
return value.filter((p) => typeof p === "string");
|
|
2612
2614
|
}
|
|
2615
|
+
var MALFORMED_ELEMENT_RULE = /* @__PURE__ */ Symbol("malformed-element-rule");
|
|
2613
2616
|
function parseElementRule(value) {
|
|
2614
2617
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
2615
2618
|
const obj = value;
|
|
2616
2619
|
const rule = {};
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2620
|
+
const axes = ["tags", "roles", "classIncludes", "componentIncludes", "testIds"];
|
|
2621
|
+
for (const axis of axes) {
|
|
2622
|
+
if (!(axis in obj)) continue;
|
|
2623
|
+
const axisValue = obj[axis];
|
|
2624
|
+
if (!Array.isArray(axisValue)) return MALFORMED_ELEMENT_RULE;
|
|
2625
|
+
rule[axis] = axisValue.filter((v) => typeof v === "string");
|
|
2621
2626
|
}
|
|
2622
|
-
if (Array.isArray(obj.componentIncludes)) {
|
|
2623
|
-
rule.componentIncludes = obj.componentIncludes.filter((v) => typeof v === "string");
|
|
2624
|
-
}
|
|
2625
|
-
if (Array.isArray(obj.testIds)) rule.testIds = obj.testIds.filter((v) => typeof v === "string");
|
|
2626
2627
|
return rule;
|
|
2627
2628
|
}
|
|
2628
2629
|
function nonEmptyString(value) {
|