@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.d.cts CHANGED
@@ -125,9 +125,12 @@ interface MountOptions {
125
125
  */
126
126
  rail?: RailPlacement;
127
127
  /**
128
- * Linear traversal (pairs with `thumbnails({ groupDisplay: 'flat' })`). When true, ←/→ walks the
129
- * flattened item sequence across groups (1a, 1b, 2a, 2b, 2c, 3a…), ↑/↓ retire, the counter shows
130
- * `item N / total`, and the within-group pills hide — surfaced as `data-gallerist-linear`.
128
+ * Linear traversal: ←/→ walk the flattened item sequence across groups (1a, 1b, 2a, 2b, 2c, 3a…),
129
+ * ↑/↓ retire, the counter shows `item N / total`, and the within-group pills hide — surfaced as
130
+ * `data-gallerist-linear`. Unset, it follows the rail: on while the `thumbnails` region holds an
131
+ * element marked `data-gallerist-linear` (a flat rail, `thumbnails({ groupDisplay: 'flat' })`,
132
+ * marks its region so), off otherwise, and it changes when the plugins do. `true` or `false`
133
+ * fixes it.
131
134
  */
132
135
  linear?: boolean;
133
136
  /**
package/dist/index.d.ts CHANGED
@@ -125,9 +125,12 @@ interface MountOptions {
125
125
  */
126
126
  rail?: RailPlacement;
127
127
  /**
128
- * Linear traversal (pairs with `thumbnails({ groupDisplay: 'flat' })`). When true, ←/→ walks the
129
- * flattened item sequence across groups (1a, 1b, 2a, 2b, 2c, 3a…), ↑/↓ retire, the counter shows
130
- * `item N / total`, and the within-group pills hide — surfaced as `data-gallerist-linear`.
128
+ * Linear traversal: ←/→ walk the flattened item sequence across groups (1a, 1b, 2a, 2b, 2c, 3a…),
129
+ * ↑/↓ retire, the counter shows `item N / total`, and the within-group pills hide — surfaced as
130
+ * `data-gallerist-linear`. Unset, it follows the rail: on while the `thumbnails` region holds an
131
+ * element marked `data-gallerist-linear` (a flat rail, `thumbnails({ groupDisplay: 'flat' })`,
132
+ * marks its region so), off otherwise, and it changes when the plugins do. `true` or `false`
133
+ * fixes it.
131
134
  */
132
135
  linear?: boolean;
133
136
  /**
package/dist/index.js CHANGED
@@ -839,9 +839,9 @@ function mount(viewer, opts = {}) {
839
839
  const orientation = rail === "left" || rail === "right" ? "vertical" : "horizontal";
840
840
  const groupAxis = opts.groupAxis ?? preset?.groupAxis ?? orientation;
841
841
  const vertical = groupAxis === "vertical";
842
- const linear = opts.linear ?? false;
842
+ let linear = false;
843
843
  const arrowLabelsOpt = opts.arrowLabels ?? preset?.arrowLabels ?? false;
844
- const arrowLabel = !arrowLabelsOpt || !controls || vertical || linear || arrows !== "pill-right" ? null : arrowLabelsOpt === true ? (group) => str(group.caption) : arrowLabelsOpt;
844
+ const arrowLabel = !arrowLabelsOpt || !controls || vertical || arrows !== "pill-right" ? null : arrowLabelsOpt === true ? (group) => str(group.caption) : arrowLabelsOpt;
845
845
  const loop = opts.loop ?? viewer.loop;
846
846
  const ui = { ...DEFAULT_STRINGS, ...opts.strings };
847
847
  const itemIndicator = opts.itemIndicator ?? preset?.itemIndicator ?? "pills";
@@ -907,9 +907,7 @@ function mount(viewer, opts = {}) {
907
907
  root.setAttribute("data-gallerist-rail-pos", railPos);
908
908
  root.setAttribute("data-gallerist-orientation", orientation);
909
909
  root.setAttribute("data-gallerist-axis", groupAxis);
910
- if (arrowLabel) root.setAttribute("data-gallerist-arrow-labels", "");
911
910
  root.setAttribute("data-gallerist-rail", railHidden ? "collapsed" : "expanded");
912
- if (linear) root.setAttribute("data-gallerist-linear", "true");
913
911
  if (frame) root.setAttribute("data-gallerist-frame", "");
914
912
  if (placard) root.setAttribute("data-gallerist-indicator", "placard");
915
913
  applyAppearance(root, { skin: opts.skin, accent: opts.accent, scheme: opts.scheme });
@@ -1350,7 +1348,7 @@ function mount(viewer, opts = {}) {
1350
1348
  const nameAt = (step) => {
1351
1349
  const n = viewer.loop && G > 1 ? (cur.g + step + G) % G : cur.g + step;
1352
1350
  const target = col.groups[n];
1353
- return target ? arrowLabel(target, n) : void 0;
1351
+ return target && !linear ? arrowLabel(target, n) : void 0;
1354
1352
  };
1355
1353
  setArrowLabel(prevArrow, nameAt(-1), ui.previous, ui.previousTo);
1356
1354
  setArrowLabel(nextArrow, nameAt(1), ui.next, ui.nextTo);
@@ -1769,6 +1767,14 @@ function mount(viewer, opts = {}) {
1769
1767
  const mountRegions = () => {
1770
1768
  pluginKeymap = aggregateKeymap(internals.getPlugins());
1771
1769
  mountPluginRegions(internals.getPlugins());
1770
+ const on = opts.linear ?? !!regionHosts.thumbnails.querySelector("[data-gallerist-linear]");
1771
+ root.toggleAttribute("data-gallerist-arrow-labels", !!arrowLabel && !on);
1772
+ if (on !== linear) {
1773
+ linear = on;
1774
+ if (on) root.setAttribute("data-gallerist-linear", "true");
1775
+ else root.removeAttribute("data-gallerist-linear");
1776
+ chromeCol = null;
1777
+ }
1772
1778
  const thumbs = regionHosts.thumbnails;
1773
1779
  const hasRail = [...thumbs.childNodes].some((n) => n !== railHandle);
1774
1780
  if (!hasRail) railHandle.remove();
@@ -1777,7 +1783,10 @@ function mount(viewer, opts = {}) {
1777
1783
  syncCaption();
1778
1784
  const cur = currentRec();
1779
1785
  if (cur) cur.overlayItem = void 0;
1780
- if (attached) renderWindow();
1786
+ if (attached) {
1787
+ renderWindow();
1788
+ updateChrome();
1789
+ }
1781
1790
  };
1782
1791
  mountRegions();
1783
1792
  const offPlugins = internals.onPluginsChanged(mountRegions);
@@ -1933,7 +1942,7 @@ function bind(opts = {}) {
1933
1942
  }
1934
1943
 
1935
1944
  // src/index.ts
1936
- var VERSION = "0.3.0" ;
1945
+ var VERSION = "0.3.1" ;
1937
1946
 
1938
1947
  export { DEFAULT_STRINGS, VERSION, applyAppearance, bind, collectionFromLinks, imageAdapter, mount, resolvePreset };
1939
1948
  //# sourceMappingURL=index.js.map