sanity-plugin-all-in-one-accessibility 1.1.3 → 1.1.4
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.js +11 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -343,7 +343,10 @@ function isValidIconSize(value) {
|
|
|
343
343
|
const size = wholeNumber(value, null);
|
|
344
344
|
return size !== null && size >= SIZE_MIN && size <= SIZE_MAX;
|
|
345
345
|
}
|
|
346
|
-
const POSITION_VALUES = AIOA_POSITIONS.flatMap((pos) => pos ? [pos[0]] : []), ICON_SIZE_VALUES = AIOA_ICON_SIZES.map((size) => size[0]), isSet = (value) => value != null && value !== "", isOn = (value) => Number(value) === 1, num$1 = (value) => wholeNumber(value, 0),
|
|
346
|
+
const POSITION_VALUES = AIOA_POSITIONS.flatMap((pos) => pos ? [pos[0]] : []), ICON_SIZE_VALUES = AIOA_ICON_SIZES.map((size) => size[0]), isSet = (value) => value != null && value !== "", isOn = (value) => Number(value) === 1, num$1 = (value) => wholeNumber(value, 0), clampOffset = (value) => String(Math.min(Math.max(num$1(value), 0), OFFSET_MAX));
|
|
347
|
+
function savedSide(first, second) {
|
|
348
|
+
return num$1(first) > 0 ? "first" : num$1(second) > 0 || isSet(second) && !isSet(first) ? "second" : "first";
|
|
349
|
+
}
|
|
347
350
|
function gridPosition(value) {
|
|
348
351
|
const position = positionValue(value);
|
|
349
352
|
return POSITION_VALUES.includes(position) ? position : "bottom_right";
|
|
@@ -352,7 +355,7 @@ function emptyAppearance() {
|
|
|
352
355
|
return appearanceFrom({});
|
|
353
356
|
}
|
|
354
357
|
function appearanceFrom(result) {
|
|
355
|
-
const hex = parseHex(result.widget_color_code || AIOA_DEFAULTS.widget_color_code) || AIOA_DEFAULT_COLOR, iconType = String(result.widget_icon_type || AIOA_DEFAULTS.widget_icon_type), iconSize = String(result.widget_icon_size || AIOA_DEFAULTS.widget_icon_size),
|
|
358
|
+
const hex = parseHex(result.widget_color_code || AIOA_DEFAULTS.widget_color_code) || AIOA_DEFAULT_COLOR, iconType = String(result.widget_icon_type || AIOA_DEFAULTS.widget_icon_type), iconSize = String(result.widget_icon_size || AIOA_DEFAULTS.widget_icon_size), useLeft = savedSide(result.widget_position_right, result.widget_position_left) === "second", useTop = savedSide(result.widget_position_bottom, result.widget_position_top) === "second";
|
|
356
359
|
return {
|
|
357
360
|
colorText: hex,
|
|
358
361
|
color: hex,
|
|
@@ -360,11 +363,10 @@ function appearanceFrom(result) {
|
|
|
360
363
|
widgetSize: String(result.widget_size) === "1" ? "1" : "0",
|
|
361
364
|
customPosition: Number(result.is_widget_custom_position) === 1,
|
|
362
365
|
position: gridPosition(result.widget_position || AIOA_DEFAULTS.widget_position),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
yDir: bottom > 0 || !(top > 0) ? "cust-pos-to-the-lower" : "cust-pos-to-the-upper",
|
|
366
|
+
x: clampOffset(useLeft ? result.widget_position_left : result.widget_position_right),
|
|
367
|
+
xDir: useLeft ? "cust-pos-to-the-left" : "cust-pos-to-the-right",
|
|
368
|
+
y: clampOffset(useTop ? result.widget_position_top : result.widget_position_bottom),
|
|
369
|
+
yDir: useTop ? "cust-pos-to-the-upper" : "cust-pos-to-the-lower",
|
|
368
370
|
positionCheck: !1,
|
|
369
371
|
iconType: /^aioa-icon-type-([1-9]|1\d|2\d)$/.test(iconType) ? iconType : "aioa-icon-type-1",
|
|
370
372
|
customSize: Number(result.is_widget_custom_size) === 1,
|
|
@@ -376,9 +378,9 @@ function appearanceFrom(result) {
|
|
|
376
378
|
function paidFrom(result) {
|
|
377
379
|
const r = result || {};
|
|
378
380
|
let mxDir = "right", mx = clampOffset(r.widget_position_right_mobile);
|
|
379
|
-
isSet(r.widget_position_horizontal_center_offset_mobile) ? (mxDir = "center", mx = clampOffset(r.widget_position_horizontal_center_offset_mobile)) :
|
|
381
|
+
isSet(r.widget_position_horizontal_center_offset_mobile) ? (mxDir = "center", mx = clampOffset(r.widget_position_horizontal_center_offset_mobile)) : savedSide(r.widget_position_right_mobile, r.widget_position_left_mobile) === "second" && (mxDir = "left", mx = clampOffset(r.widget_position_left_mobile));
|
|
380
382
|
let myDir = "bottom", my = clampOffset(r.widget_position_bottom_mobile);
|
|
381
|
-
return
|
|
383
|
+
return savedSide(r.widget_position_bottom_mobile, r.widget_position_top_mobile) === "second" && (myDir = "top", my = clampOffset(r.widget_position_top_mobile)), {
|
|
382
384
|
statement_link: typeof r.statement_link == "string" ? r.statement_link : "",
|
|
383
385
|
report_problem_link: typeof r.report_problem_link == "string" ? r.report_problem_link : "",
|
|
384
386
|
linkErrors: { statement_link: "", report_problem_link: "" },
|