@fusion.dev/helix 0.99.0 → 0.101.0

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.
@@ -12,7 +12,7 @@ import type { CSSResultGroup } from 'lit';
12
12
  * @since 0.1.0
13
13
  * @status stable
14
14
  * @category overlays
15
- * @aliases Modal, Lightbox, Sheet
15
+ * @aliases Modal, Sheet
16
16
  * @documentation https://fusion.dev/helix/components/dialog
17
17
  *
18
18
  * @cssproperty --dialog-border-color - Color of the panel's edge.
@@ -76,6 +76,14 @@ registerElementEvents({
76
76
  'helix-image': ['error', 'load'],
77
77
  'helix-input': ['change', 'helix-before-change', 'input'],
78
78
  'helix-kbd': ['helix-shortcut'],
79
+ 'helix-lightbox': [
80
+ 'close',
81
+ 'helix-activate',
82
+ 'helix-before-activate',
83
+ 'helix-before-close',
84
+ 'helix-before-open',
85
+ 'toggle',
86
+ ],
79
87
  'helix-listbox': ['change', 'helix-before-change', 'helix-filter', 'input'],
80
88
  'helix-megamenu': ['helix-before-close', 'helix-before-open', 'toggle'],
81
89
  'helix-menu': ['helix-before-close', 'helix-before-open', 'helix-select', 'toggle'],
package/dist/index.d.ts CHANGED
@@ -52,6 +52,7 @@ export * from './image/index.js';
52
52
  export * from './input/index.js';
53
53
  export * from './kbd/index.js';
54
54
  export * from './legend/index.js';
55
+ export * from './lightbox/index.js';
55
56
  export * from './line-chart/index.js';
56
57
  export * from './list/index.js';
57
58
  export * from './listbox/index.js';
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ export * from './image/index.js';
47
47
  export * from './input/index.js';
48
48
  export * from './kbd/index.js';
49
49
  export * from './legend/index.js';
50
+ export * from './lightbox/index.js';
50
51
  export * from './line-chart/index.js';
51
52
  export * from './list/index.js';
52
53
  export * from './listbox/index.js';
@@ -0,0 +1,2 @@
1
+ export { HelixLightboxItem } from './item/lightbox-item.js';
2
+ export { HelixLightbox } from './root/lightbox-root.js';
@@ -0,0 +1,2 @@
1
+ export { HelixLightboxItem } from './item/lightbox-item.js';
2
+ export { HelixLightbox } from './root/lightbox-root.js';
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,34 @@
1
+ import { createSheet } from '@fusion.dev/helix-core';
2
+ export const styles = createSheet(`:host {
3
+ display: contents;
4
+ }
5
+
6
+ [part="item"] {
7
+ align-items: center;
8
+ block-size: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--lightbox-item-gap, var(--helix-space-sm));
12
+ inline-size: 100%;
13
+ justify-content: center;
14
+
15
+ min-block-size: 0;
16
+ min-inline-size: 0;
17
+ }
18
+
19
+ [part="item"][hidden] {
20
+ display: none;
21
+ }
22
+
23
+ [part="item"] ::slotted(*) {
24
+ max-block-size: 100%;
25
+ max-inline-size: 100%;
26
+ object-fit: contain;
27
+ }
28
+
29
+ [part="item"] ::slotted([slot="description"]) {
30
+ color: var(--lightbox-item-description-color, var(--helix-color-foreground-subtle));
31
+ font-size: var(--helix-text-sm);
32
+ line-height: calc(var(--helix-text-sm) * var(--helix-leading-normal));
33
+ text-align: center;
34
+ }`);
@@ -0,0 +1,28 @@
1
+ import { HelixHeadlessLightboxItem } from '@fusion.dev/helix-headless/lightbox';
2
+ import type { CSSResultGroup } from 'lit';
3
+ /**
4
+ * @summary One thing a lightbox can show.
5
+ *
6
+ * @description
7
+ * Presentation only: the box centers what it was given and holds it inside the
8
+ * viewport rather than sizing it, because what is in here is the consumer's and
9
+ * may be a picture, a frame of video or a chart. Which item is shown, and the
10
+ * arithmetic that decides, is the base class.
11
+ *
12
+ * @since 0.100.0
13
+ * @status stable
14
+ * @category media
15
+ * @aliases LightboxSlide, GalleryItem
16
+ * @documentation https://fusion.dev/helix/components/lightbox
17
+ *
18
+ * @cssproperty --lightbox-item-description-color - Color of the line under the content.
19
+ * @cssproperty --lightbox-item-gap - Space between the content and the line under it.
20
+ */
21
+ export declare class HelixLightboxItem extends HelixHeadlessLightboxItem {
22
+ static styles: CSSResultGroup;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'helix-lightbox-item': HelixLightboxItem;
27
+ }
28
+ }
@@ -0,0 +1,16 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { customElement } from '@fusion.dev/helix-core';
8
+ import { HelixHeadlessLightboxItem } from '@fusion.dev/helix-headless/lightbox';
9
+ import { styles } from './lightbox-item.css.js';
10
+ let HelixLightboxItem = class HelixLightboxItem extends HelixHeadlessLightboxItem {
11
+ static { this.styles = styles; }
12
+ };
13
+ HelixLightboxItem = __decorate([
14
+ customElement('helix-lightbox-item')
15
+ ], HelixLightboxItem);
16
+ export { HelixLightboxItem };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,76 @@
1
+ import { createSheet } from '@fusion.dev/helix-core';
2
+ export const styles = createSheet(`:host {
3
+ color-scheme: dark;
4
+ display: contents;
5
+ }
6
+
7
+ [part="dialog"] {
8
+ background-color: transparent;
9
+ block-size: 100dvh;
10
+ border: none;
11
+ box-sizing: border-box;
12
+ color: var(--lightbox-foreground, var(--helix-color-foreground));
13
+ display: grid;
14
+ gap: var(--lightbox-gap, var(--helix-space-sm));
15
+ grid-template-rows: auto 1fr auto;
16
+ inline-size: 100vw;
17
+ max-block-size: 100dvh;
18
+ max-inline-size: 100vw;
19
+ padding: var(--lightbox-padding, var(--helix-space-md));
20
+ }
21
+
22
+ [part="dialog"]:not([open]) {
23
+ display: none;
24
+ }
25
+
26
+ :host {
27
+ --_lightbox-scrim: var(--helix-color-background);
28
+ }
29
+
30
+ [part="dialog"]::backdrop {
31
+ background-color: var(--lightbox-scrim, var(--_lightbox-scrim));
32
+ }
33
+
34
+ [part="viewport"] {
35
+ align-items: center;
36
+ display: flex;
37
+ justify-content: center;
38
+
39
+ min-block-size: 0;
40
+ overflow: hidden;
41
+ }
42
+
43
+ ::slotted([slot="header"]),
44
+ ::slotted([slot="footer"]) {
45
+ transition:
46
+ opacity var(--helix-duration-fast) var(--helix-easing-standard),
47
+ visibility var(--helix-duration-fast) var(--helix-easing-standard);
48
+ }
49
+
50
+ :host(:state(idle)) ::slotted([slot="header"]),
51
+ :host(:state(idle)) ::slotted([slot="footer"]) {
52
+ opacity: 0;
53
+ visibility: hidden;
54
+ }
55
+
56
+ [part="live"] {
57
+ block-size: 1px;
58
+ clip-path: inset(50%);
59
+ inline-size: 1px;
60
+ overflow: hidden;
61
+ position: absolute;
62
+ white-space: nowrap;
63
+ }
64
+
65
+ @media (prefers-reduced-motion: reduce) {
66
+ ::slotted([slot="header"]),
67
+ ::slotted([slot="footer"]) {
68
+ transition: none;
69
+ }
70
+ }
71
+
72
+ @media print {
73
+ :host {
74
+ display: none;
75
+ }
76
+ }`);
@@ -0,0 +1,41 @@
1
+ import { HelixHeadlessLightbox } from '@fusion.dev/helix-headless/lightbox';
2
+ import type { CSSResultGroup } from 'lit';
3
+ /**
4
+ * @summary A viewer that opens one thing over the page.
5
+ *
6
+ * @description
7
+ * **A takeover rather than a panel, which is the whole difference from
8
+ * `Dialog`.** A dialog is a thing over the page and stops short of the edges to
9
+ * say so; a lightbox is the page for as long as it is open. The scrim is heavier
10
+ * for the same reason: what is behind it is not meant to be read.
11
+ *
12
+ * **A dark region that says so once**, with `color-scheme: dark` on the host,
13
+ * which is `Video`'s answer to the same problem: the chrome is the consumer's
14
+ * own components and they resolve their own tokens, so without a scheme on the
15
+ * region they draw page-colored ink on a black room and disappear into it.
16
+ *
17
+ * The chrome fades rather than leaves while the reader is still, because a bar
18
+ * that is removed from the layout takes the picture's size with it and the
19
+ * reader watches it jump every time they stop moving.
20
+ *
21
+ * @since 0.100.0
22
+ * @status stable
23
+ * @category media
24
+ * @aliases Photo viewer, Image viewer, Gallery overlay
25
+ * @documentation https://fusion.dev/helix/components/lightbox
26
+ *
27
+ * @event {HelixActivateEvent} helix-activate - Fired once the shown item has moved, so the element already holds it.
28
+ *
29
+ * @cssproperty --lightbox-foreground - Color of the chrome drawn over the content.
30
+ * @cssproperty --lightbox-gap - Space between the chrome and the content.
31
+ * @cssproperty --lightbox-padding - Inset from the edges of the screen.
32
+ * @cssproperty --lightbox-scrim - The wash over the page behind the viewer. Set on the host, where a token still resolves: a `var()` written inside `::backdrop` cannot see one.
33
+ */
34
+ export declare class HelixLightbox extends HelixHeadlessLightbox {
35
+ static styles: CSSResultGroup;
36
+ }
37
+ declare global {
38
+ interface HTMLElementTagNameMap {
39
+ 'helix-lightbox': HelixLightbox;
40
+ }
41
+ }
@@ -0,0 +1,16 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { customElement } from '@fusion.dev/helix-core';
8
+ import { HelixHeadlessLightbox } from '@fusion.dev/helix-headless/lightbox';
9
+ import { styles } from './lightbox-root.css.js';
10
+ let HelixLightbox = class HelixLightbox extends HelixHeadlessLightbox {
11
+ static { this.styles = styles; }
12
+ };
13
+ HelixLightbox = __decorate([
14
+ customElement('helix-lightbox')
15
+ ], HelixLightbox);
16
+ export { HelixLightbox };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix",
3
3
  "description": "Styled component tier. Extends the headless tier with token-driven presentation.",
4
- "version": "0.99.0",
4
+ "version": "0.101.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -47,13 +47,13 @@
47
47
  },
48
48
  "bugs": "https://github.com/project-fusion/fusion/issues",
49
49
  "dependencies": {
50
- "@fusion.dev/helix-core": "0.99.0",
51
- "@fusion.dev/helix-headless": "0.99.0",
52
- "@fusion.dev/helix-styles": "0.99.0"
50
+ "@fusion.dev/helix-core": "0.101.0",
51
+ "@fusion.dev/helix-headless": "0.101.0",
52
+ "@fusion.dev/helix-styles": "0.101.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@fusion.dev/helix-cem": "0.99.0",
56
- "@fusion.dev/helix-testing": "0.99.0",
55
+ "@fusion.dev/helix-cem": "0.101.0",
56
+ "@fusion.dev/helix-testing": "0.101.0",
57
57
  "@fusion.dev/scripts": "0.0.0-dev",
58
58
  "@happy-dom/global-registrator": "^20.0.0",
59
59
  "@lit-labs/ssr": "^4.1.0",