accessify-widget 0.3.35 → 0.3.37

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.
@@ -1,4 +1,4 @@
1
- import { d, i } from "./index-f80f4-e4.js";
1
+ import { d, i } from "./index-jJHI2SMZ.js";
2
2
  export {
3
3
  d as destroy,
4
4
  i as init
@@ -76,10 +76,6 @@ const STALE_REACTION = new class StaleReactionError extends Error {
76
76
  __publicField(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
77
77
  }
78
78
  }();
79
- const IS_XHTML = (
80
- // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
81
- !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
82
- );
83
79
  function invariant_violation(message) {
84
80
  if (DEV) {
85
81
  const error = new Error(`invariant_violation
@@ -258,6 +254,8 @@ https://svelte.dev/e/svelte_boundary_reset_onerror`);
258
254
  }
259
255
  const EACH_ITEM_REACTIVE = 1;
260
256
  const EACH_INDEX_REACTIVE = 1 << 1;
257
+ const EACH_IS_CONTROLLED = 1 << 2;
258
+ const EACH_IS_ANIMATED = 1 << 3;
261
259
  const EACH_ITEM_IMMUTABLE = 1 << 4;
262
260
  const PROPS_IS_IMMUTABLE = 1;
263
261
  const PROPS_IS_UPDATED = 1 << 2;
@@ -3838,7 +3836,8 @@ var offscreen_anchor;
3838
3836
  function each(node, flags2, get_collection, get_key, render_fn2, fallback_fn = null) {
3839
3837
  var anchor = node;
3840
3838
  var items = /* @__PURE__ */ new Map();
3841
- {
3839
+ var is_controlled = (flags2 & EACH_IS_CONTROLLED) !== 0;
3840
+ if (is_controlled) {
3842
3841
  var parent_node = (
3843
3842
  /** @type {Element} */
3844
3843
  node
@@ -3963,17 +3962,31 @@ function skip_to_branch(effect2) {
3963
3962
  return effect2;
3964
3963
  }
3965
3964
  function reconcile(state2, array, anchor, flags2, get_key) {
3965
+ var is_animated = (flags2 & EACH_IS_ANIMATED) !== 0;
3966
3966
  var length = array.length;
3967
3967
  var items = state2.items;
3968
3968
  var current = skip_to_branch(state2.effect.first);
3969
3969
  var seen;
3970
3970
  var prev = null;
3971
+ var to_animate;
3971
3972
  var matched = [];
3972
3973
  var stashed = [];
3973
3974
  var value;
3974
3975
  var key;
3975
3976
  var effect2;
3976
3977
  var i;
3978
+ if (is_animated) {
3979
+ for (i = 0; i < length; i += 1) {
3980
+ value = array[i];
3981
+ key = get_key(value, i);
3982
+ effect2 = /** @type {EachItem} */
3983
+ items.get(key).e;
3984
+ if ((effect2.f & EFFECT_OFFSCREEN) === 0) {
3985
+ effect2.nodes?.a?.measure();
3986
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).add(effect2);
3987
+ }
3988
+ }
3989
+ }
3977
3990
  for (i = 0; i < length; i += 1) {
3978
3991
  value = array[i];
3979
3992
  key = get_key(value, i);
@@ -4008,6 +4021,10 @@ function reconcile(state2, array, anchor, flags2, get_key) {
4008
4021
  }
4009
4022
  if ((effect2.f & INERT) !== 0) {
4010
4023
  resume_effect(effect2);
4024
+ if (is_animated) {
4025
+ effect2.nodes?.a?.unfix();
4026
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).delete(effect2);
4027
+ }
4011
4028
  }
4012
4029
  if (effect2 !== current) {
4013
4030
  if (seen !== void 0 && seen.has(effect2)) {
@@ -4086,10 +4103,26 @@ function reconcile(state2, array, anchor, flags2, get_key) {
4086
4103
  }
4087
4104
  var destroy_length = to_destroy.length;
4088
4105
  if (destroy_length > 0) {
4089
- var controlled_anchor = length === 0 ? anchor : null;
4106
+ var controlled_anchor = (flags2 & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
4107
+ if (is_animated) {
4108
+ for (i = 0; i < destroy_length; i += 1) {
4109
+ to_destroy[i].nodes?.a?.measure();
4110
+ }
4111
+ for (i = 0; i < destroy_length; i += 1) {
4112
+ to_destroy[i].nodes?.a?.fix();
4113
+ }
4114
+ }
4090
4115
  pause_effects(state2, to_destroy, controlled_anchor);
4091
4116
  }
4092
4117
  }
4118
+ if (is_animated) {
4119
+ queue_micro_task(() => {
4120
+ if (to_animate === void 0) return;
4121
+ for (effect2 of to_animate) {
4122
+ effect2.nodes?.a?.apply();
4123
+ }
4124
+ });
4125
+ }
4093
4126
  }
4094
4127
  function create_item(items, anchor, value, key, index2, render_fn2, flags2, get_collection) {
4095
4128
  var v = (flags2 & EACH_ITEM_REACTIVE) !== 0 ? (flags2 & EACH_ITEM_IMMUTABLE) === 0 ? /* @__PURE__ */ mutable_source(value, false, false) : source(value) : null;
@@ -4293,17 +4326,6 @@ function set_style(dom, value, prev_styles, next_styles) {
4293
4326
  }
4294
4327
  const IS_CUSTOM_ELEMENT = Symbol("is custom element");
4295
4328
  const IS_HTML = Symbol("is html");
4296
- const PROGRESS_TAG = IS_XHTML ? "progress" : "PROGRESS";
4297
- function set_value(element, value) {
4298
- var attributes = get_attributes(element);
4299
- if (attributes.value === (attributes.value = // treat null and undefined the same for the initial value
4300
- value ?? void 0) || // @ts-expect-error
4301
- // `progress` elements always need their value set when it's `0`
4302
- element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG)) {
4303
- return;
4304
- }
4305
- element.value = value ?? "";
4306
- }
4307
4329
  function set_attribute(element, attribute, value, skip_warning) {
4308
4330
  var attributes = get_attributes(element);
4309
4331
  if (attributes[attribute] === (attributes[attribute] = value)) return;
@@ -6533,9 +6555,10 @@ Return ONLY the simplified text.`;
6533
6555
  }
6534
6556
  var root_2$1 = /* @__PURE__ */ from_html(`<button class="accessify-chip accessify-chip--icon"><span class="accessify-chip-icon" aria-hidden="true"></span> <span> </span></button>`);
6535
6557
  var root_1$2 = /* @__PURE__ */ from_html(`<div class="accessify-control-row" role="group"><div class="accessify-control-label"><span class="accessify-control-label-icon" aria-hidden="true"></span> <span class="accessify-control-label-text"> </span></div> <div class="accessify-chip-row"></div></div>`);
6536
- var root_3$1 = /* @__PURE__ */ from_html(`<div class="accessify-control-row" role="group"><div class="accessify-control-label"><span class="accessify-control-label-icon" aria-hidden="true"></span> <span class="accessify-control-label-text"> </span></div> <div class="accessify-slider-wrap"><button class="accessify-stepper-btn" aria-label="Decrease text size">−</button> <input type="range" class="accessify-slider"/> <button class="accessify-stepper-btn" aria-label="Increase text size">+</button> <span class="accessify-stepper-value" aria-live="polite"> </span></div></div>`);
6537
- var root_5 = /* @__PURE__ */ from_html(`<div class="accessify-card-wrap"><button class="accessify-card" role="switch"><span class="accessify-card-icon" aria-hidden="true"></span> <span class="accessify-card-label"> </span></button> <span class="accessify-card-info" role="note"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg></span></div>`);
6538
- var root_4 = /* @__PURE__ */ from_html(`<div class="accessify-features"></div>`);
6558
+ var root_4 = /* @__PURE__ */ from_html(`<button><span>A</span></button>`);
6559
+ var root_3$1 = /* @__PURE__ */ from_html(`<div class="accessify-control-row" role="group"><div class="accessify-control-label"><span class="accessify-control-label-icon" aria-hidden="true"></span> <span class="accessify-control-label-text"> </span></div> <div class="accessify-size-steps"></div></div>`);
6560
+ var root_6 = /* @__PURE__ */ from_html(`<div class="accessify-card-wrap"><button class="accessify-card" role="switch"><span class="accessify-card-icon" aria-hidden="true"></span> <span class="accessify-card-label"> </span></button> <span class="accessify-card-info" role="note"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg></span></div>`);
6561
+ var root_5 = /* @__PURE__ */ from_html(`<div class="accessify-features"></div>`);
6539
6562
  var root$2 = /* @__PURE__ */ from_html(`<!> <!> <div class="accessify-section-divider"></div> <!>`, 1);
6540
6563
  function FeatureGrid($$anchor, $$props) {
6541
6564
  push($$props, true);
@@ -6633,22 +6656,19 @@ function FeatureGrid($$anchor, $$props) {
6633
6656
  icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2v20"/><path d="M12 2a10 10 0 0 1 0 20" fill="currentColor"/></svg>'
6634
6657
  }
6635
6658
  ];
6636
- const TEXT_SIZE_MIN = 75;
6637
- const TEXT_SIZE_MAX = 200;
6638
- const TEXT_SIZE_STEP = 5;
6639
6659
  const AI_FEATURES = /* @__PURE__ */ new Set(["text-simplify", "alt-text"]);
6640
6660
  const loadedModules = /* @__PURE__ */ new Map();
6641
6661
  const FEATURE_LOADERS = {
6642
6662
  contrast: () => import("./contrast-CqsICAkU.js"),
6643
6663
  "text-size": () => import("./text-size-m_mHNPWo.js"),
6644
- "keyboard-nav": () => import("./keyboard-nav-CSajPv9n.js"),
6664
+ "keyboard-nav": () => import("./keyboard-nav-By_dGJQ-.js"),
6645
6665
  "link-highlight": () => import("./link-highlight-DBGm067Y.js"),
6646
6666
  "reading-guide": () => import("./reading-guide-VT8NciIL.js"),
6647
6667
  "reading-mask": () => import("./reading-mask-BABChuCz.js"),
6648
6668
  "animation-stop": () => import("./animation-stop-_chC8bg1.js"),
6649
6669
  "hide-images": () => import("./hide-images-B_LeCBcd.js"),
6650
6670
  "big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
6651
- "page-structure": () => import("./page-structure-BRj8VMOY.js"),
6671
+ "page-structure": () => import("./page-structure-DM8eu0-9.js"),
6652
6672
  tts: () => import("./tts-CjszLRnb.js"),
6653
6673
  "text-simplify": () => import("./text-simplify-CK2GFhq2.js"),
6654
6674
  "alt-text": () => Promise.resolve().then(() => altText)
@@ -6849,40 +6869,39 @@ function FeatureGrid($$anchor, $$props) {
6849
6869
  var span_5 = sibling(span_4, 2);
6850
6870
  var text_2 = child(span_5);
6851
6871
  var div_5 = sibling(div_4, 2);
6852
- var button_1 = child(div_5);
6853
- var input = sibling(button_1, 2);
6854
- set_attribute(input, "min", TEXT_SIZE_MIN);
6855
- set_attribute(input, "max", TEXT_SIZE_MAX);
6856
- set_attribute(input, "step", TEXT_SIZE_STEP);
6857
- set_attribute(input, "aria-valuemin", TEXT_SIZE_MIN);
6858
- set_attribute(input, "aria-valuemax", TEXT_SIZE_MAX);
6859
- var button_2 = sibling(input, 2);
6860
- var span_6 = sibling(button_2, 2);
6861
- var text_3 = child(span_6);
6872
+ each(
6873
+ div_5,
6874
+ 20,
6875
+ () => [
6876
+ { pct: 85, size: "11px" },
6877
+ { pct: 125, size: "16px" },
6878
+ { pct: 175, size: "21px" }
6879
+ ],
6880
+ index,
6881
+ ($$anchor3, step) => {
6882
+ var button_1 = root_4();
6883
+ let classes;
6884
+ var span_6 = child(button_1);
6885
+ template_effect(() => {
6886
+ classes = set_class(button_1, 1, "accessify-size-step-btn", null, classes, { active: get(textSize) === step.pct });
6887
+ set_attribute(button_1, "aria-label", `${step.pct ?? ""}%`);
6888
+ set_attribute(button_1, "aria-pressed", get(textSize) === step.pct);
6889
+ set_style(span_6, `font-size:${step.size ?? ""}`);
6890
+ });
6891
+ delegated("click", button_1, () => setTextSize(get(textSize) === step.pct ? 100 : step.pct));
6892
+ append($$anchor3, button_1);
6893
+ }
6894
+ );
6862
6895
  template_effect(
6863
- ($0, $1, $2) => {
6896
+ ($0, $1) => {
6864
6897
  set_attribute(div_3, "aria-label", $0);
6865
6898
  set_text(text_2, $1);
6866
- button_1.disabled = get(textSize) <= TEXT_SIZE_MIN;
6867
- set_value(input, get(textSize));
6868
- set_attribute(input, "aria-label", $2);
6869
- set_attribute(input, "aria-valuenow", get(textSize));
6870
- set_attribute(input, "aria-valuetext", `${get(textSize) ?? ""}%`);
6871
- button_2.disabled = get(textSize) >= TEXT_SIZE_MAX;
6872
- set_text(text_3, `${get(textSize) ?? ""}%`);
6873
6899
  },
6874
6900
  [
6875
- () => t("feature.textSize", $$props.config.lang),
6876
6901
  () => t("feature.textSize", $$props.config.lang),
6877
6902
  () => t("feature.textSize", $$props.config.lang)
6878
6903
  ]
6879
6904
  );
6880
- delegated("click", button_1, () => setTextSize(Math.max(TEXT_SIZE_MIN, get(textSize) - TEXT_SIZE_STEP)));
6881
- delegated("input", input, (e) => {
6882
- set(textSize, Number(e.target.value), true);
6883
- });
6884
- delegated("change", input, (e) => setTextSize(Number(e.target.value)));
6885
- delegated("click", button_2, () => setTextSize(Math.min(TEXT_SIZE_MAX, get(textSize) + TEXT_SIZE_STEP)));
6886
6905
  append($$anchor2, div_3);
6887
6906
  };
6888
6907
  var d_1 = /* @__PURE__ */ user_derived(() => get(visibleFeatureIds).has("text-size"));
@@ -6893,7 +6912,7 @@ function FeatureGrid($$anchor, $$props) {
6893
6912
  var node_2 = sibling(node_1, 4);
6894
6913
  {
6895
6914
  var consequent_2 = ($$anchor2) => {
6896
- var div_6 = root_4();
6915
+ var div_6 = root_5();
6897
6916
  each(
6898
6917
  div_6,
6899
6918
  21,
@@ -6905,19 +6924,19 @@ function FeatureGrid($$anchor, $$props) {
6905
6924
  (feature) => feature.id,
6906
6925
  ($$anchor3, feature) => {
6907
6926
  const isActive = /* @__PURE__ */ user_derived(() => $$props.activeFeatures.get(get(feature).id) ?? false);
6908
- var div_7 = root_5();
6909
- var button_3 = child(div_7);
6910
- var span_7 = child(button_3);
6927
+ var div_7 = root_6();
6928
+ var button_2 = child(div_7);
6929
+ var span_7 = child(button_2);
6911
6930
  html(span_7, () => getIcon(get(feature).iconId), true);
6912
6931
  var span_8 = sibling(span_7, 2);
6913
- var text_4 = child(span_8);
6914
- var span_9 = sibling(button_3, 2);
6932
+ var text_3 = child(span_8);
6933
+ var span_9 = sibling(button_2, 2);
6915
6934
  template_effect(
6916
6935
  ($0, $1, $2, $3) => {
6917
- set_attribute(button_3, "data-active", get(isActive));
6918
- set_attribute(button_3, "aria-checked", get(isActive));
6919
- set_attribute(button_3, "aria-label", $0);
6920
- set_text(text_4, $1);
6936
+ set_attribute(button_2, "data-active", get(isActive));
6937
+ set_attribute(button_2, "aria-checked", get(isActive));
6938
+ set_attribute(button_2, "aria-label", $0);
6939
+ set_text(text_3, $1);
6921
6940
  set_attribute(span_9, "aria-label", $2);
6922
6941
  set_attribute(span_9, "title", $3);
6923
6942
  },
@@ -6928,7 +6947,7 @@ function FeatureGrid($$anchor, $$props) {
6928
6947
  () => t(get(feature).descKey, $$props.config.lang)
6929
6948
  ]
6930
6949
  );
6931
- delegated("click", button_3, () => handleToggle(get(feature).id));
6950
+ delegated("click", button_2, () => handleToggle(get(feature).id));
6932
6951
  append($$anchor3, div_7);
6933
6952
  }
6934
6953
  );
@@ -6941,7 +6960,7 @@ function FeatureGrid($$anchor, $$props) {
6941
6960
  append($$anchor, fragment);
6942
6961
  pop();
6943
6962
  }
6944
- delegate(["click", "input", "change"]);
6963
+ delegate(["click"]);
6945
6964
  var root_1$1 = /* @__PURE__ */ from_html(`<span aria-hidden="true">&middot;</span> <a target="_blank" rel="noopener noreferrer"> </a>`, 1);
6946
6965
  var root$1 = /* @__PURE__ */ from_html(`<div class="accessify-footer"><div class="accessify-footer-links"><a target="_blank" rel="noopener noreferrer">Accessify Dashboard</a> <!></div> <button class="accessify-footer-close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg> <span> </span></button></div>`);
6947
6966
  function PanelFooter($$anchor, $$props) {
@@ -7994,27 +8013,21 @@ function createWidgetStyles(config2) {
7994
8013
  font-size: 13px; font-weight: 600; color: var(--text); user-select: none;
7995
8014
  }
7996
8015
 
7997
- /* Text Size slider */
7998
- .accessify-slider-wrap {
7999
- display: flex; align-items: center; gap: 8px;
8016
+ /* Text Size 3-step buttons */
8017
+ .accessify-size-steps {
8018
+ display: flex; align-items: flex-end; gap: 6px;
8000
8019
  }
8001
- .accessify-slider {
8002
- flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
8003
- background: var(--surface-dim); border-radius: 3px; outline: none;
8004
- cursor: pointer; border: none; margin: 0;
8005
- }
8006
- .accessify-slider::-webkit-slider-thumb {
8007
- -webkit-appearance: none; appearance: none;
8008
- width: 18px; height: 18px; border-radius: 50%;
8009
- background: var(--accent); cursor: pointer;
8010
- border: 2px solid var(--surface-card);
8011
- box-shadow: 0 1px 4px rgba(0,0,0,0.3);
8020
+ .accessify-size-step-btn {
8021
+ display: inline-flex; align-items: center; justify-content: center;
8022
+ width: 36px; height: 36px; border-radius: 8px;
8023
+ border: 1.5px solid var(--border); background: var(--surface-dim);
8024
+ color: var(--text); cursor: pointer; font-weight: 700;
8025
+ font-family: inherit; transition: all var(--fast);
8026
+ line-height: 1;
8012
8027
  }
8013
- .accessify-slider::-moz-range-thumb {
8014
- width: 18px; height: 18px; border-radius: 50%;
8015
- background: var(--accent); cursor: pointer;
8016
- border: 2px solid var(--surface-card);
8017
- box-shadow: 0 1px 4px rgba(0,0,0,0.3);
8028
+ .accessify-size-step-btn:hover { background: var(--surface-hover); }
8029
+ .accessify-size-step-btn.active {
8030
+ background: var(--accent); color: #fff; border-color: var(--accent);
8018
8031
  }
8019
8032
 
8020
8033
  /* ─── Feature Cards (2-column grid) ─── */
@@ -8971,4 +8984,4 @@ export {
8971
8984
  init as i,
8972
8985
  t
8973
8986
  };
8974
- //# sourceMappingURL=index-f80f4-e4.js.map
8987
+ //# sourceMappingURL=index-jJHI2SMZ.js.map