@gallerist/renderer-dom 0.3.0 → 0.3.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 CHANGED
@@ -840,9 +840,9 @@ function mount(viewer, opts = {}) {
840
840
  const orientation = rail === "left" || rail === "right" ? "vertical" : "horizontal";
841
841
  const groupAxis = opts.groupAxis ?? preset?.groupAxis ?? orientation;
842
842
  const vertical = groupAxis === "vertical";
843
- const linear = opts.linear ?? false;
843
+ let linear = false;
844
844
  const arrowLabelsOpt = opts.arrowLabels ?? preset?.arrowLabels ?? false;
845
- const arrowLabel = !arrowLabelsOpt || !controls || vertical || linear || arrows !== "pill-right" ? null : arrowLabelsOpt === true ? (group) => str(group.caption) : arrowLabelsOpt;
845
+ const arrowLabel = !arrowLabelsOpt || !controls || vertical || arrows !== "pill-right" ? null : arrowLabelsOpt === true ? (group) => str(group.caption) : arrowLabelsOpt;
846
846
  const loop = opts.loop ?? viewer.loop;
847
847
  const ui = { ...DEFAULT_STRINGS, ...opts.strings };
848
848
  const itemIndicator = opts.itemIndicator ?? preset?.itemIndicator ?? "pills";
@@ -908,9 +908,7 @@ function mount(viewer, opts = {}) {
908
908
  root.setAttribute("data-gallerist-rail-pos", railPos);
909
909
  root.setAttribute("data-gallerist-orientation", orientation);
910
910
  root.setAttribute("data-gallerist-axis", groupAxis);
911
- if (arrowLabel) root.setAttribute("data-gallerist-arrow-labels", "");
912
911
  root.setAttribute("data-gallerist-rail", railHidden ? "collapsed" : "expanded");
913
- if (linear) root.setAttribute("data-gallerist-linear", "true");
914
912
  if (frame) root.setAttribute("data-gallerist-frame", "");
915
913
  if (placard) root.setAttribute("data-gallerist-indicator", "placard");
916
914
  applyAppearance(root, { skin: opts.skin, accent: opts.accent, scheme: opts.scheme });
@@ -1351,7 +1349,7 @@ function mount(viewer, opts = {}) {
1351
1349
  const nameAt = (step) => {
1352
1350
  const n = viewer.loop && G > 1 ? (cur.g + step + G) % G : cur.g + step;
1353
1351
  const target = col.groups[n];
1354
- return target ? arrowLabel(target, n) : void 0;
1352
+ return target && !linear ? arrowLabel(target, n) : void 0;
1355
1353
  };
1356
1354
  setArrowLabel(prevArrow, nameAt(-1), ui.previous, ui.previousTo);
1357
1355
  setArrowLabel(nextArrow, nameAt(1), ui.next, ui.nextTo);
@@ -1770,6 +1768,14 @@ function mount(viewer, opts = {}) {
1770
1768
  const mountRegions = () => {
1771
1769
  pluginKeymap = aggregateKeymap(internals.getPlugins());
1772
1770
  mountPluginRegions(internals.getPlugins());
1771
+ const on = opts.linear ?? !!regionHosts.thumbnails.querySelector("[data-gallerist-linear]");
1772
+ root.toggleAttribute("data-gallerist-arrow-labels", !!arrowLabel && !on);
1773
+ if (on !== linear) {
1774
+ linear = on;
1775
+ if (on) root.setAttribute("data-gallerist-linear", "true");
1776
+ else root.removeAttribute("data-gallerist-linear");
1777
+ chromeCol = null;
1778
+ }
1773
1779
  const thumbs = regionHosts.thumbnails;
1774
1780
  const hasRail = [...thumbs.childNodes].some((n) => n !== railHandle);
1775
1781
  if (!hasRail) railHandle.remove();
@@ -1778,7 +1784,10 @@ function mount(viewer, opts = {}) {
1778
1784
  syncCaption();
1779
1785
  const cur = currentRec();
1780
1786
  if (cur) cur.overlayItem = void 0;
1781
- if (attached) renderWindow();
1787
+ if (attached) {
1788
+ renderWindow();
1789
+ updateChrome();
1790
+ }
1782
1791
  };
1783
1792
  mountRegions();
1784
1793
  const offPlugins = internals.onPluginsChanged(mountRegions);
@@ -1934,7 +1943,7 @@ function bind(opts = {}) {
1934
1943
  }
1935
1944
 
1936
1945
  // src/index.ts
1937
- var VERSION = "0.3.0" ;
1946
+ var VERSION = "0.3.1" ;
1938
1947
 
1939
1948
  Object.defineProperty(exports, "reconcileKeys", {
1940
1949
  enumerable: true,