@redot-src/glare 1.2.1 → 1.3.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.
package/dist/icons.d.ts CHANGED
@@ -5,7 +5,6 @@ export declare const icons: {
5
5
  readonly zoomIn: string;
6
6
  readonly zoomOut: string;
7
7
  readonly download: string;
8
- readonly share: string;
9
8
  readonly thumbs: string;
10
9
  readonly play: string;
11
10
  readonly pause: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Glare } from './core/glare';
2
- export type { AjaxOptions, AnimationEffect, BoundGroup, ClickAction, ClickActionName, ContentType, EventHandler, EventName, FullscreenOptions, GlareInstance, GlareOptions, GlareRefs, I18nDict, IframeOptions, ImageOptions, LifecycleEvent, LifecycleHandler, MediaProvider, ResolvedOptions, ShareOptions, SlideEvent, SlideItem, SlideSource, SlideshowOptions, ThumbsOptions, ToolbarButton, TouchOptions, TransitionEffect, VideoOptions, } from './types';
2
+ export type { AjaxOptions, Anchor, AnchorPosition, AnimationEffect, BoundGroup, ClickAction, ClickActionName, ContentType, CustomButton, EventHandler, EventName, FullscreenOptions, GlareInstance, GlareOptions, GlareRefs, I18nDict, IframeOptions, ImageOptions, LifecycleEvent, LifecycleHandler, MediaProvider, ResolvedOptions, SlideEvent, SlideItem, SlideSource, SlideshowOptions, ThumbsFit, ThumbsOptions, ToolbarButton, TouchOptions, TransitionEffect, VideoOptions, } from './types';
3
3
  export type { Point, Zoom, ZoomState } from './core/zoom';
4
4
  export { Glare };
5
5
  export declare const autoBind: typeof Glare.autoBind;
@@ -4,4 +4,3 @@ export declare const spinnerTemplate = "<div class=\"glare-spinner\" role=\"stat
4
4
  export declare const errorTemplate = "<div class=\"glare-error\"><p>{{ERROR}}</p></div>";
5
5
  export declare const videoTemplate: string;
6
6
  export declare const iframeTemplate = "<iframe class=\"glare-iframe\"></iframe>";
7
- export declare const shareTemplate: string;
package/dist/types.d.ts CHANGED
@@ -1,16 +1,29 @@
1
1
  import type { Point, Zoom } from './core/zoom';
2
2
  import type { Fullscreen } from './modules/fullscreen';
3
- import type { Share } from './modules/share';
4
3
  import type { Slideshow } from './modules/slideshow';
5
4
  import type { Thumbs } from './modules/thumbs';
6
5
  export type ContentType = 'image' | 'video' | 'embed' | 'iframe' | 'inline' | 'ajax' | 'html';
7
- /** Effect played when the lightbox opens. */
8
- export type AnimationEffect = false | 'fade' | 'zoom';
9
- /** Effect played when moving between slides. */
10
- export type TransitionEffect = false | 'fade' | 'slide' | 'circular' | 'tube' | 'zoom-in-out' | 'rotate';
6
+ /** Effect played when the lightbox opens and closes. Any other name is a custom effect, written in CSS. */
7
+ export type AnimationEffect = false | 'fade' | 'zoom' | (string & {});
8
+ /** A spot in the lightbox the opening image can grow from, as `<vertical>-<horizontal>`. */
9
+ export type AnchorPosition = `${'top' | 'center' | 'bottom'}-${'left' | 'center' | 'right'}`;
10
+ /** Where the `'zoom'` effect starts: the slide's trigger, a position, an element, or a selector. */
11
+ export type Anchor = 'trigger' | AnchorPosition | HTMLElement | (string & {});
12
+ /** Effect played when moving between slides. Any other name is a custom effect, written in CSS. */
13
+ export type TransitionEffect = false | 'fade' | 'slide' | 'circular' | 'tube' | 'zoom-in-out' | 'rotate' | (string & {});
11
14
  export type ClickActionName = 'close' | 'next' | 'nextOrClose' | 'toggleControls' | 'zoom';
12
15
  export type ClickAction = false | ClickActionName | ((current: SlideItem, event: Event) => ClickActionName | false | void);
13
- export type ToolbarButton = 'zoom' | 'slideshow' | 'thumbs' | 'share' | 'download' | 'fullscreen' | 'more' | 'close' | (string & {});
16
+ /** A toolbar button defined inline: rendered like the built-in ones and wired to `click`. */
17
+ export interface CustomButton {
18
+ /** Identifies the button; also its `glare-button--{name}` class. */
19
+ name: string;
20
+ /** Tooltip and accessible name. */
21
+ label: string;
22
+ /** The button's content as HTML, usually an inline `<svg>`. */
23
+ icon: string;
24
+ click: (instance: GlareInstance, current: SlideItem, event: MouseEvent) => void;
25
+ }
26
+ export type ToolbarButton = 'zoom' | 'slideshow' | 'thumbs' | 'download' | 'fullscreen' | 'more' | 'close' | (string & {}) | CustomButton;
14
27
  export interface MediaProvider {
15
28
  matcher: RegExp;
16
29
  type?: ContentType;
@@ -77,10 +90,13 @@ export interface VideoOptions {
77
90
  format?: string;
78
91
  autoStart?: boolean;
79
92
  }
93
+ /** How a thumbnail image fills its square, as CSS `object-fit`. */
94
+ export type ThumbsFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
80
95
  export interface ThumbsOptions {
81
96
  autoStart?: boolean;
82
97
  parentEl?: string | HTMLElement;
83
98
  axis?: 'x' | 'y';
99
+ fit?: ThumbsFit;
84
100
  }
85
101
  export interface SlideshowOptions {
86
102
  autoStart?: boolean;
@@ -89,10 +105,6 @@ export interface SlideshowOptions {
89
105
  export interface FullscreenOptions {
90
106
  autoStart?: boolean;
91
107
  }
92
- export interface ShareOptions {
93
- url?: string | ((item: SlideItem) => string);
94
- tpl?: string;
95
- }
96
108
  export type I18nDict = {
97
109
  CLOSE: string;
98
110
  NEXT: string;
@@ -108,9 +120,7 @@ export type I18nDict = {
108
120
  FULL_SCREEN_EXIT: string;
109
121
  THUMBS: string;
110
122
  DOWNLOAD: string;
111
- SHARE: string;
112
123
  MORE: string;
113
- COPY: string;
114
124
  ZOOM: string;
115
125
  ZOOM_OUT: string;
116
126
  };
@@ -145,6 +155,7 @@ export interface GlareOptions extends EventHandlers {
145
155
  caption?: string | ((instance: GlareInstance, current: SlideItem) => string);
146
156
  animationEffect?: AnimationEffect;
147
157
  animationDuration?: number;
158
+ anchor?: Anchor;
148
159
  zoomOpacity?: boolean;
149
160
  transitionEffect?: TransitionEffect;
150
161
  transitionDuration?: number;
@@ -165,7 +176,6 @@ export interface GlareOptions extends EventHandlers {
165
176
  slideshow?: SlideshowOptions | boolean;
166
177
  thumbs?: ThumbsOptions | boolean;
167
178
  fullscreen?: FullscreenOptions | boolean;
168
- share?: ShareOptions | boolean;
169
179
  lang?: string;
170
180
  i18n?: Record<string, Partial<I18nDict>>;
171
181
  baseTpl?: string;
@@ -208,7 +218,6 @@ export interface GlareInstance {
208
218
  slideshow?: Slideshow;
209
219
  thumbs?: Thumbs;
210
220
  fullscreen?: Fullscreen;
211
- share?: Share;
212
221
  open(index?: number): void;
213
222
  close(): void;
214
223
  next(): void;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@redot-src/glare",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Modern, touch-enabled, fully customizable lightbox for the web — zero dependencies.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "author": "Glare Contributors",
8
- "homepage": "https://redot-src.github.io/glare/",
7
+ "author": {
8
+ "name": "Redot",
9
+ "url": "https://redot.dev"
10
+ },
11
+ "homepage": "https://glare.redot.dev/",
9
12
  "repository": {
10
13
  "type": "git",
11
14
  "url": "git+https://github.com/redot-src/glare.git"
@@ -50,14 +53,11 @@
50
53
  "./dist/*": "./dist/*"
51
54
  },
52
55
  "scripts": {
53
- "dev": "vite --mode demo",
56
+ "dev": "vitepress dev docs",
54
57
  "build": "npm run typecheck && vite build && vite build --mode umd && tsc -p tsconfig.build.json",
55
58
  "typecheck": "tsc --noEmit",
56
- "demo:build": "vite build --mode demo",
57
- "docs:dev": "vitepress dev docs",
58
59
  "docs:build": "vitepress build docs",
59
60
  "docs:preview": "vitepress preview docs",
60
- "pages:build": "npm run docs:build && npm run demo:build",
61
61
  "prepublishOnly": "npm run build"
62
62
  },
63
63
  "devDependencies": {
@@ -65,5 +65,9 @@
65
65
  "typescript": "^5.9.2",
66
66
  "vite": "^7.1.5",
67
67
  "vitepress": "^1.6.4"
68
+ },
69
+ "allowScripts": {
70
+ "esbuild@0.28.2": true,
71
+ "esbuild@0.21.5": true
68
72
  }
69
73
  }
@@ -1,17 +0,0 @@
1
- import type { ShareOptions } from '../types';
2
- import type { Glare } from '../core/glare';
3
- /** Overlay with social share links and a copyable URL. */
4
- export declare class Share {
5
- private readonly glare;
6
- private readonly container;
7
- private readonly opts;
8
- private overlay;
9
- private off;
10
- constructor(glare: Glare, container: HTMLElement, opts: ShareOptions);
11
- get isOpen(): boolean;
12
- open(): void;
13
- close(): void;
14
- destroy(): void;
15
- private copy;
16
- private resolveUrl;
17
- }