@cntrl-site/components 1.0.116 → 1.0.118-alpha.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/sources.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-D4_6w8f7.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-DkG1aICD.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
2
2
  import { CommonComponentProps } from '../props';
3
3
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
4
4
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -27,11 +27,12 @@ type BurgerShowInValue = string | Record<string, string>;
27
27
 
28
28
  type BurgerLink = {
29
29
  link?: {
30
- type?: 'url' | 'page' | 'anchor';
30
+ type?: 'url' | 'page' | 'anchor' | 'file';
31
31
  value?: string;
32
32
  target?: string;
33
33
  anchor?: string;
34
34
  url?: string;
35
+ download?: string;
35
36
  };
36
37
  mode?: 'page' | 'url';
37
38
  page?: string;
@@ -256,10 +257,11 @@ function isBlankTarget(target?: string): boolean {
256
257
  }
257
258
 
258
259
  function getBurgerDest(item: BurgerLink): {
259
- type: 'url' | 'page' | 'anchor';
260
+ type: 'url' | 'page' | 'anchor' | 'file';
260
261
  value: string;
261
262
  target?: '_blank';
262
263
  anchor?: string;
264
+ download?: string;
263
265
  } {
264
266
  const dest = item.link;
265
267
  if (dest && typeof dest === 'object') {
@@ -273,8 +275,12 @@ function getBurgerDest(item: BurgerLink): {
273
275
  if (dest.type === 'page') {
274
276
  return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
275
277
  }
278
+ if (dest.type === 'file') {
279
+ return { type: 'file', value: dest.value ?? '' };
280
+ }
281
+ // a published file link comes as its file's url, with the name to download it under
276
282
  if (typeof dest.url === 'string') {
277
- return { type: 'url', value: dest.url, target };
283
+ return { type: 'url', value: dest.url, target, download: typeof dest.download === 'string' ? dest.download : undefined };
278
284
  }
279
285
  }
280
286
  const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
@@ -295,12 +301,17 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
295
301
  label: string;
296
302
  href: string;
297
303
  target?: '_blank';
304
+ download?: string;
298
305
  } {
299
306
  const label = item.label || 'Link';
300
307
  const dest = getBurgerDest(item);
301
308
 
302
309
  if (dest.type === 'url') {
303
- return { label, href: dest.value, target: dest.target };
310
+ return { label, href: dest.value, target: dest.target, download: dest.download };
311
+ }
312
+ if (dest.type === 'file') {
313
+ // only the editor sees a file by its id, and downloads it through onLinkNavigate, right on the click
314
+ return { label, href: dest.value ? '#' : '', target: '_blank' };
304
315
  }
305
316
  if (dest.type === 'anchor') {
306
317
  const anchor = dest.value.replace(/^#/, '');
@@ -912,10 +923,11 @@ function renderTextPaddingControls(
912
923
  type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
913
924
 
914
925
  export type BurgerLinkNavigateEvent = {
915
- mode: 'page' | 'url';
926
+ mode: 'page' | 'url' | 'file';
916
927
  href: string;
917
928
  page?: string;
918
929
  url?: string;
930
+ file?: string;
919
931
  anchor?: string;
920
932
  target?: '_blank';
921
933
  };
@@ -1767,6 +1779,28 @@ function findAnchorTarget(hash: string): HTMLElement | null {
1767
1779
  return target instanceof HTMLElement ? target : null;
1768
1780
  }
1769
1781
 
1782
+ // the file is on the cdn, another origin, where the download attribute alone opens it instead
1783
+ function downloadFile(url: string, name: string) {
1784
+ fetch(url)
1785
+ .then((response) => {
1786
+ if (!response.ok) throw new Error(\`Could not download \${url}: \${response.status}\`);
1787
+ return response.blob();
1788
+ })
1789
+ .then((blob) => {
1790
+ const objectUrl = URL.createObjectURL(blob);
1791
+ const link = document.createElement('a');
1792
+ link.href = objectUrl;
1793
+ link.download = name || decodeURIComponent(url.split('?')[0].split('/').pop() ?? '');
1794
+ document.body.appendChild(link);
1795
+ link.click();
1796
+ link.remove();
1797
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
1798
+ })
1799
+ .catch(() => {
1800
+ window.location.assign(url);
1801
+ });
1802
+ }
1803
+
1770
1804
  function scrollToAnchor(hash: string): boolean {
1771
1805
  const target = findAnchorTarget(hash);
1772
1806
  if (!target) return false;
@@ -1800,10 +1834,11 @@ function handleLinkClick(
1800
1834
  const resolved = resolveBurgerLink(item, pages);
1801
1835
  const dest = getBurgerDest(item);
1802
1836
  const navigateEvent: BurgerLinkNavigateEvent = {
1803
- mode: dest.type === 'url' ? 'url' : 'page',
1837
+ mode: dest.type === 'url' || dest.type === 'file' ? dest.type : 'page',
1804
1838
  href: resolved.href || href,
1805
1839
  page: dest.type === 'page' ? dest.value : undefined,
1806
1840
  url: dest.type === 'url' ? dest.value : undefined,
1841
+ file: dest.type === 'file' ? dest.value : undefined,
1807
1842
  anchor: dest.type === 'anchor'
1808
1843
  ? dest.value.replace(/^#/, '')
1809
1844
  : (dest.anchor ?? '').replace(/^#/, ''),
@@ -1825,6 +1860,14 @@ function handleLinkClick(
1825
1860
  return;
1826
1861
  }
1827
1862
 
1863
+ const download = item ? getBurgerDest(item).download : undefined;
1864
+ if (download !== undefined && href && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
1865
+ event.preventDefault();
1866
+ downloadFile(href, download);
1867
+ onClose();
1868
+ return;
1869
+ }
1870
+
1828
1871
  if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
1829
1872
  event.preventDefault();
1830
1873
  runAfterClose(() => scrollToAnchor(hash));
@@ -2430,12 +2473,13 @@ export function Burger({
2430
2473
  const showOpenNavControls = showControls && isOpen;
2431
2474
 
2432
2475
  const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
2433
- const { label, href, target } = resolveBurgerLink(item, pages);
2476
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2434
2477
  const linkNode = href ? (
2435
2478
  <a
2436
2479
  href={href}
2437
2480
  target={target}
2438
2481
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2482
+ download={download}
2439
2483
  className={\`\${linkClassName} \${P}-has-href\`}
2440
2484
  onClick={(event) => onNavLinkClick(event, item)}
2441
2485
  >
@@ -2547,7 +2591,7 @@ export function Burger({
2547
2591
  };
2548
2592
 
2549
2593
  const renderNavLink = (item: BurgerLink, index: number) => {
2550
- const { label, href, target } = resolveBurgerLink(item, pages);
2594
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2551
2595
  const textContent = (
2552
2596
  <span className={navLinkTextClassName} style={navLinkTextStyle}>
2553
2597
  {renderMultilineText(label)}
@@ -2566,6 +2610,7 @@ export function Burger({
2566
2610
  href={href}
2567
2611
  target={target}
2568
2612
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2613
+ download={download}
2569
2614
  className={\`\${P}-nav-link \${P}-has-href\`}
2570
2615
  onClick={(event) => onNavLinkClick(event, item)}
2571
2616
  >
@@ -5701,7 +5746,6 @@ function getGridTextLeadingVars(
5701
5746
  const HOVER_ANIM_MS = 400;
5702
5747
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
5703
5748
  const HOVER_ZOOM = 1.1;
5704
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
5705
5749
  const MEDIA_RADIUS_VAR = '--grid-media-radius';
5706
5750
 
5707
5751
  function getCSS(P: string): string {
@@ -5847,10 +5891,16 @@ function getCSS(P: string): string {
5847
5891
  .\${P}-show-text-hover .\${P}-item-inner-hidden:hover .\${P}-item-subtitle {
5848
5892
  opacity: 1;
5849
5893
  }
5894
+ @property --\${P}-hover-zoom {
5895
+ syntax: '<number>';
5896
+ inherits: false;
5897
+ initial-value: 1;
5898
+ }
5850
5899
  .\${P}-hover-zoom-in .\${P}-item-image,
5851
5900
  .\${P}-hover-zoom-in .\${P}-item-video {
5852
- clip-path: inset(0 round var(\${MEDIA_RADIUS_VAR}, 0px));
5853
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
5901
+ transform: scale(var(--\${P}-hover-zoom));
5902
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)) round calc(var(\${MEDIA_RADIUS_VAR}, 0px) / var(--\${P}-hover-zoom)));
5903
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
5854
5904
  }
5855
5905
  .\${P}-hover-scale-down .\${P}-item-image,
5856
5906
  .\${P}-hover-scale-down .\${P}-item-video {
@@ -5861,8 +5911,7 @@ function getCSS(P: string): string {
5861
5911
  }
5862
5912
  @media (hover: hover) {
5863
5913
  .\${P}-hover-zoom-in .\${P}-item-image-wrapper:has(.\${P}-item-image:hover, .\${P}-item-video:hover) :is(.\${P}-item-image, .\${P}-item-video) {
5864
- transform: scale(\${HOVER_ZOOM});
5865
- clip-path: inset(\${HOVER_ZOOM_INSET} round calc(var(\${MEDIA_RADIUS_VAR}, 0px) / \${HOVER_ZOOM}));
5914
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
5866
5915
  }
5867
5916
  .\${P}-hover-scale-down .\${P}-item-image-wrapper:hover .\${P}-item-image,
5868
5917
  .\${P}-hover-scale-down .\${P}-item-image-wrapper:hover .\${P}-item-video {
@@ -11030,7 +11079,6 @@ import { buildJournalSlides, findJournalUrlSlideNumber, getEntryImages, hasJourn
11030
11079
  const HOVER_ANIM_MS = 400;
11031
11080
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
11032
11081
  const HOVER_ZOOM = 1.1;
11033
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
11034
11082
 
11035
11083
  function getCSS(P: string): string {
11036
11084
  return \`
@@ -11078,9 +11126,16 @@ function getCSS(P: string): string {
11078
11126
  max-width: 100%;
11079
11127
  }
11080
11128
 
11129
+ @property --\${P}-hover-zoom {
11130
+ syntax: '<number>';
11131
+ inherits: false;
11132
+ initial-value: 1;
11133
+ }
11134
+
11081
11135
  .\${P}-hover-zoom-in .\${P}-cover-image {
11082
- clip-path: inset(0);
11083
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11136
+ transform: scale(var(--\${P}-hover-zoom));
11137
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)));
11138
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11084
11139
  }
11085
11140
 
11086
11141
  .\${P}-hover-scale-down .\${P}-cover-image {
@@ -11093,8 +11148,7 @@ function getCSS(P: string): string {
11093
11148
 
11094
11149
  @media (hover: hover) {
11095
11150
  .\${P}-hover-zoom-in .\${P}-cover:hover .\${P}-cover-image {
11096
- transform: scale(\${HOVER_ZOOM});
11097
- clip-path: inset(\${HOVER_ZOOM_INSET});
11151
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
11098
11152
  }
11099
11153
  .\${P}-hover-scale-down .\${P}-cover:hover .\${P}-cover-image {
11100
11154
  transform: scale(0.9);
@@ -11844,7 +11898,6 @@ export type {
11844
11898
  const HOVER_ANIM_MS = 400;
11845
11899
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
11846
11900
  const HOVER_ZOOM = 1.1;
11847
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
11848
11901
 
11849
11902
  function getCSS(P: string): string {
11850
11903
  return \`
@@ -11892,9 +11945,16 @@ function getCSS(P: string): string {
11892
11945
  max-width: 100%;
11893
11946
  }
11894
11947
 
11948
+ @property --\${P}-hover-zoom {
11949
+ syntax: '<number>';
11950
+ inherits: false;
11951
+ initial-value: 1;
11952
+ }
11953
+
11895
11954
  .\${P}-hover-zoom-in .\${P}-cover-image {
11896
- clip-path: inset(0);
11897
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11955
+ transform: scale(var(--\${P}-hover-zoom));
11956
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)));
11957
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11898
11958
  }
11899
11959
 
11900
11960
  .\${P}-hover-scale-down .\${P}-cover-image {
@@ -11907,8 +11967,7 @@ function getCSS(P: string): string {
11907
11967
 
11908
11968
  @media (hover: hover) {
11909
11969
  .\${P}-hover-zoom-in .\${P}-cover:hover .\${P}-cover-image {
11910
- transform: scale(\${HOVER_ZOOM});
11911
- clip-path: inset(\${HOVER_ZOOM_INSET});
11970
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
11912
11971
  }
11913
11972
  .\${P}-hover-scale-down .\${P}-cover:hover .\${P}-cover-image {
11914
11973
  transform: scale(0.9);
@@ -25303,4 +25362,4 @@ export function Waterfall({
25303
25362
  </>
25304
25363
  );
25305
25364
  }
25306
- `,C={[n.BurgerComponent.id]:e,[n.ChroniclesComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;
25365
+ `,w={[n.BurgerComponent.id]:e,[n.ChroniclesComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=w;
package/dist/sources.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-0ZWBPdbh.mjs";
1
+ import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-kkKhL_qt.mjs";
2
2
  const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
3
  import { CommonComponentProps } from '../props';
4
4
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -28,11 +28,12 @@ type BurgerShowInValue = string | Record<string, string>;
28
28
 
29
29
  type BurgerLink = {
30
30
  link?: {
31
- type?: 'url' | 'page' | 'anchor';
31
+ type?: 'url' | 'page' | 'anchor' | 'file';
32
32
  value?: string;
33
33
  target?: string;
34
34
  anchor?: string;
35
35
  url?: string;
36
+ download?: string;
36
37
  };
37
38
  mode?: 'page' | 'url';
38
39
  page?: string;
@@ -257,10 +258,11 @@ function isBlankTarget(target?: string): boolean {
257
258
  }
258
259
 
259
260
  function getBurgerDest(item: BurgerLink): {
260
- type: 'url' | 'page' | 'anchor';
261
+ type: 'url' | 'page' | 'anchor' | 'file';
261
262
  value: string;
262
263
  target?: '_blank';
263
264
  anchor?: string;
265
+ download?: string;
264
266
  } {
265
267
  const dest = item.link;
266
268
  if (dest && typeof dest === 'object') {
@@ -274,8 +276,12 @@ function getBurgerDest(item: BurgerLink): {
274
276
  if (dest.type === 'page') {
275
277
  return { type: 'page', value: dest.value ?? '', target, anchor: dest.anchor };
276
278
  }
279
+ if (dest.type === 'file') {
280
+ return { type: 'file', value: dest.value ?? '' };
281
+ }
282
+ // a published file link comes as its file's url, with the name to download it under
277
283
  if (typeof dest.url === 'string') {
278
- return { type: 'url', value: dest.url, target };
284
+ return { type: 'url', value: dest.url, target, download: typeof dest.download === 'string' ? dest.download : undefined };
279
285
  }
280
286
  }
281
287
  const target = isBlankTarget(item.openIn) ? '_blank' : undefined;
@@ -296,12 +302,17 @@ function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
296
302
  label: string;
297
303
  href: string;
298
304
  target?: '_blank';
305
+ download?: string;
299
306
  } {
300
307
  const label = item.label || 'Link';
301
308
  const dest = getBurgerDest(item);
302
309
 
303
310
  if (dest.type === 'url') {
304
- return { label, href: dest.value, target: dest.target };
311
+ return { label, href: dest.value, target: dest.target, download: dest.download };
312
+ }
313
+ if (dest.type === 'file') {
314
+ // only the editor sees a file by its id, and downloads it through onLinkNavigate, right on the click
315
+ return { label, href: dest.value ? '#' : '', target: '_blank' };
305
316
  }
306
317
  if (dest.type === 'anchor') {
307
318
  const anchor = dest.value.replace(/^#/, '');
@@ -913,10 +924,11 @@ function renderTextPaddingControls(
913
924
  type ColorKeys = 'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor';
914
925
 
915
926
  export type BurgerLinkNavigateEvent = {
916
- mode: 'page' | 'url';
927
+ mode: 'page' | 'url' | 'file';
917
928
  href: string;
918
929
  page?: string;
919
930
  url?: string;
931
+ file?: string;
920
932
  anchor?: string;
921
933
  target?: '_blank';
922
934
  };
@@ -1768,6 +1780,28 @@ function findAnchorTarget(hash: string): HTMLElement | null {
1768
1780
  return target instanceof HTMLElement ? target : null;
1769
1781
  }
1770
1782
 
1783
+ // the file is on the cdn, another origin, where the download attribute alone opens it instead
1784
+ function downloadFile(url: string, name: string) {
1785
+ fetch(url)
1786
+ .then((response) => {
1787
+ if (!response.ok) throw new Error(\`Could not download \${url}: \${response.status}\`);
1788
+ return response.blob();
1789
+ })
1790
+ .then((blob) => {
1791
+ const objectUrl = URL.createObjectURL(blob);
1792
+ const link = document.createElement('a');
1793
+ link.href = objectUrl;
1794
+ link.download = name || decodeURIComponent(url.split('?')[0].split('/').pop() ?? '');
1795
+ document.body.appendChild(link);
1796
+ link.click();
1797
+ link.remove();
1798
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
1799
+ })
1800
+ .catch(() => {
1801
+ window.location.assign(url);
1802
+ });
1803
+ }
1804
+
1771
1805
  function scrollToAnchor(hash: string): boolean {
1772
1806
  const target = findAnchorTarget(hash);
1773
1807
  if (!target) return false;
@@ -1801,10 +1835,11 @@ function handleLinkClick(
1801
1835
  const resolved = resolveBurgerLink(item, pages);
1802
1836
  const dest = getBurgerDest(item);
1803
1837
  const navigateEvent: BurgerLinkNavigateEvent = {
1804
- mode: dest.type === 'url' ? 'url' : 'page',
1838
+ mode: dest.type === 'url' || dest.type === 'file' ? dest.type : 'page',
1805
1839
  href: resolved.href || href,
1806
1840
  page: dest.type === 'page' ? dest.value : undefined,
1807
1841
  url: dest.type === 'url' ? dest.value : undefined,
1842
+ file: dest.type === 'file' ? dest.value : undefined,
1808
1843
  anchor: dest.type === 'anchor'
1809
1844
  ? dest.value.replace(/^#/, '')
1810
1845
  : (dest.anchor ?? '').replace(/^#/, ''),
@@ -1826,6 +1861,14 @@ function handleLinkClick(
1826
1861
  return;
1827
1862
  }
1828
1863
 
1864
+ const download = item ? getBurgerDest(item).download : undefined;
1865
+ if (download !== undefined && href && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
1866
+ event.preventDefault();
1867
+ downloadFile(href, download);
1868
+ onClose();
1869
+ return;
1870
+ }
1871
+
1829
1872
  if (!opensInNewTab && hash && isSameDocumentHref(href) && findAnchorTarget(hash)) {
1830
1873
  event.preventDefault();
1831
1874
  runAfterClose(() => scrollToAnchor(hash));
@@ -2431,12 +2474,13 @@ export function Burger({
2431
2474
  const showOpenNavControls = showControls && isOpen;
2432
2475
 
2433
2476
  const renderOpenNavItems = (linkClassName: string) => items.filter((item) => isVisibleInOpenNav(item, layoutId)).map((item, index) => {
2434
- const { label, href, target } = resolveBurgerLink(item, pages);
2477
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2435
2478
  const linkNode = href ? (
2436
2479
  <a
2437
2480
  href={href}
2438
2481
  target={target}
2439
2482
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2483
+ download={download}
2440
2484
  className={\`\${linkClassName} \${P}-has-href\`}
2441
2485
  onClick={(event) => onNavLinkClick(event, item)}
2442
2486
  >
@@ -2548,7 +2592,7 @@ export function Burger({
2548
2592
  };
2549
2593
 
2550
2594
  const renderNavLink = (item: BurgerLink, index: number) => {
2551
- const { label, href, target } = resolveBurgerLink(item, pages);
2595
+ const { label, href, target, download } = resolveBurgerLink(item, pages);
2552
2596
  const textContent = (
2553
2597
  <span className={navLinkTextClassName} style={navLinkTextStyle}>
2554
2598
  {renderMultilineText(label)}
@@ -2567,6 +2611,7 @@ export function Burger({
2567
2611
  href={href}
2568
2612
  target={target}
2569
2613
  rel={target === '_blank' ? 'noopener noreferrer' : undefined}
2614
+ download={download}
2570
2615
  className={\`\${P}-nav-link \${P}-has-href\`}
2571
2616
  onClick={(event) => onNavLinkClick(event, item)}
2572
2617
  >
@@ -2684,7 +2729,7 @@ export function Burger({
2684
2729
  </div>
2685
2730
  );
2686
2731
  }
2687
- `, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2732
+ `, w = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2688
2733
  import { createPortal } from 'react-dom';
2689
2734
  import cn from 'classnames';
2690
2735
  import { CommonComponentProps } from '../props';
@@ -3731,7 +3776,7 @@ export function Chronicles({
3731
3776
  </>
3732
3777
  );
3733
3778
  }
3734
- `, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3779
+ `, C = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3735
3780
  import { CommonComponentProps } from '../props';
3736
3781
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3737
3782
 
@@ -5702,7 +5747,6 @@ function getGridTextLeadingVars(
5702
5747
  const HOVER_ANIM_MS = 400;
5703
5748
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
5704
5749
  const HOVER_ZOOM = 1.1;
5705
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
5706
5750
  const MEDIA_RADIUS_VAR = '--grid-media-radius';
5707
5751
 
5708
5752
  function getCSS(P: string): string {
@@ -5848,10 +5892,16 @@ function getCSS(P: string): string {
5848
5892
  .\${P}-show-text-hover .\${P}-item-inner-hidden:hover .\${P}-item-subtitle {
5849
5893
  opacity: 1;
5850
5894
  }
5895
+ @property --\${P}-hover-zoom {
5896
+ syntax: '<number>';
5897
+ inherits: false;
5898
+ initial-value: 1;
5899
+ }
5851
5900
  .\${P}-hover-zoom-in .\${P}-item-image,
5852
5901
  .\${P}-hover-zoom-in .\${P}-item-video {
5853
- clip-path: inset(0 round var(\${MEDIA_RADIUS_VAR}, 0px));
5854
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
5902
+ transform: scale(var(--\${P}-hover-zoom));
5903
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)) round calc(var(\${MEDIA_RADIUS_VAR}, 0px) / var(--\${P}-hover-zoom)));
5904
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
5855
5905
  }
5856
5906
  .\${P}-hover-scale-down .\${P}-item-image,
5857
5907
  .\${P}-hover-scale-down .\${P}-item-video {
@@ -5862,8 +5912,7 @@ function getCSS(P: string): string {
5862
5912
  }
5863
5913
  @media (hover: hover) {
5864
5914
  .\${P}-hover-zoom-in .\${P}-item-image-wrapper:has(.\${P}-item-image:hover, .\${P}-item-video:hover) :is(.\${P}-item-image, .\${P}-item-video) {
5865
- transform: scale(\${HOVER_ZOOM});
5866
- clip-path: inset(\${HOVER_ZOOM_INSET} round calc(var(\${MEDIA_RADIUS_VAR}, 0px) / \${HOVER_ZOOM}));
5915
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
5867
5916
  }
5868
5917
  .\${P}-hover-scale-down .\${P}-item-image-wrapper:hover .\${P}-item-image,
5869
5918
  .\${P}-hover-scale-down .\${P}-item-image-wrapper:hover .\${P}-item-video {
@@ -11031,7 +11080,6 @@ import { buildJournalSlides, findJournalUrlSlideNumber, getEntryImages, hasJourn
11031
11080
  const HOVER_ANIM_MS = 400;
11032
11081
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
11033
11082
  const HOVER_ZOOM = 1.1;
11034
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
11035
11083
 
11036
11084
  function getCSS(P: string): string {
11037
11085
  return \`
@@ -11079,9 +11127,16 @@ function getCSS(P: string): string {
11079
11127
  max-width: 100%;
11080
11128
  }
11081
11129
 
11130
+ @property --\${P}-hover-zoom {
11131
+ syntax: '<number>';
11132
+ inherits: false;
11133
+ initial-value: 1;
11134
+ }
11135
+
11082
11136
  .\${P}-hover-zoom-in .\${P}-cover-image {
11083
- clip-path: inset(0);
11084
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11137
+ transform: scale(var(--\${P}-hover-zoom));
11138
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)));
11139
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11085
11140
  }
11086
11141
 
11087
11142
  .\${P}-hover-scale-down .\${P}-cover-image {
@@ -11094,8 +11149,7 @@ function getCSS(P: string): string {
11094
11149
 
11095
11150
  @media (hover: hover) {
11096
11151
  .\${P}-hover-zoom-in .\${P}-cover:hover .\${P}-cover-image {
11097
- transform: scale(\${HOVER_ZOOM});
11098
- clip-path: inset(\${HOVER_ZOOM_INSET});
11152
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
11099
11153
  }
11100
11154
  .\${P}-hover-scale-down .\${P}-cover:hover .\${P}-cover-image {
11101
11155
  transform: scale(0.9);
@@ -11845,7 +11899,6 @@ export type {
11845
11899
  const HOVER_ANIM_MS = 400;
11846
11900
  const HOVER_EASING = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
11847
11901
  const HOVER_ZOOM = 1.1;
11848
- const HOVER_ZOOM_INSET = \`\${(((1 - 1 / HOVER_ZOOM) / 2) * 100).toFixed(4)}%\`;
11849
11902
 
11850
11903
  function getCSS(P: string): string {
11851
11904
  return \`
@@ -11893,9 +11946,16 @@ function getCSS(P: string): string {
11893
11946
  max-width: 100%;
11894
11947
  }
11895
11948
 
11949
+ @property --\${P}-hover-zoom {
11950
+ syntax: '<number>';
11951
+ inherits: false;
11952
+ initial-value: 1;
11953
+ }
11954
+
11896
11955
  .\${P}-hover-zoom-in .\${P}-cover-image {
11897
- clip-path: inset(0);
11898
- transition: transform \${HOVER_ANIM_MS}ms \${HOVER_EASING}, clip-path \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11956
+ transform: scale(var(--\${P}-hover-zoom));
11957
+ clip-path: inset(calc(50% - 50% / var(--\${P}-hover-zoom)));
11958
+ transition: --\${P}-hover-zoom \${HOVER_ANIM_MS}ms \${HOVER_EASING};
11899
11959
  }
11900
11960
 
11901
11961
  .\${P}-hover-scale-down .\${P}-cover-image {
@@ -11908,8 +11968,7 @@ function getCSS(P: string): string {
11908
11968
 
11909
11969
  @media (hover: hover) {
11910
11970
  .\${P}-hover-zoom-in .\${P}-cover:hover .\${P}-cover-image {
11911
- transform: scale(\${HOVER_ZOOM});
11912
- clip-path: inset(\${HOVER_ZOOM_INSET});
11971
+ --\${P}-hover-zoom: \${HOVER_ZOOM};
11913
11972
  }
11914
11973
  .\${P}-hover-scale-down .\${P}-cover:hover .\${P}-cover-image {
11915
11974
  transform: scale(0.9);
@@ -25306,8 +25365,8 @@ export function Waterfall({
25306
25365
  }
25307
25366
  `, U = {
25308
25367
  [y.id]: S,
25309
- [b.id]: C,
25310
- [x.id]: w,
25368
+ [b.id]: w,
25369
+ [x.id]: C,
25311
25370
  [P.id]: $,
25312
25371
  [v.id]: I,
25313
25372
  [f.id]: E,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.116",
3
+ "version": "1.0.118-alpha.1",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",