smartphoto 2.1.3 → 2.1.6

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.
@@ -98,6 +98,7 @@ var defaults = {
98
98
  swipeTopToClose: false,
99
99
  swipeBottomToClose: true,
100
100
  swipeOffset: 100,
101
+ swipeVelocity: 0.5,
101
102
  headerHeight: 60,
102
103
  footerHeight: 60,
103
104
  forceInterval: 10,
@@ -105,7 +106,7 @@ var defaults = {
105
106
  loadOffset: 2,
106
107
  resizeStyle: "fit",
107
108
  lazyAttribute: "data-src",
108
- animationSpeed: 300
109
+ animationSpeed: 450
109
110
  };
110
111
  function deepFreeze(obj) {
111
112
  Object.keys(obj).forEach((key) => {
@@ -119,7 +120,11 @@ function deepFreeze(obj) {
119
120
  function createState(settings) {
120
121
  return {
121
122
  options: deepFreeze(
122
- extend({}, defaults, settings)
123
+ extend(
124
+ {},
125
+ defaults,
126
+ settings
127
+ )
123
128
  ),
124
129
  viewer: {
125
130
  isOpen: false,
@@ -355,6 +360,7 @@ function distance(p1, p2) {
355
360
  const y = p1.y - p2.y;
356
361
  return Math.sqrt(x * x + y * y);
357
362
  }
363
+ var MIN_FLICK_DISTANCE = 10;
358
364
  function getForceAndTheta(x, y) {
359
365
  return { force: Math.sqrt(x * x + y * y), theta: Math.atan2(y, x) };
360
366
  }
@@ -372,6 +378,7 @@ function createGestures({ state, callbacks }, { signal }) {
372
378
  let firstPos = null;
373
379
  let oldPos = null;
374
380
  let moveDir = null;
381
+ let swipeStartTime = 0;
375
382
  let photoSwipable = false;
376
383
  let firstPhotoPos = null;
377
384
  let oldPhotoPos = null;
@@ -379,6 +386,7 @@ function createGestures({ state, callbacks }, { signal }) {
379
386
  let photoVY = 0;
380
387
  let pinching = false;
381
388
  let oldDistance = 0;
389
+ let pinchMoveFrame = null;
382
390
  let vx = 0;
383
391
  let vy = 0;
384
392
  function isSmartPhone2() {
@@ -500,6 +508,7 @@ function createGestures({ state, callbacks }, { signal }) {
500
508
  dragStart = true;
501
509
  firstPos = pos;
502
510
  oldPos = pos;
511
+ swipeStartTime = Date.now();
503
512
  }
504
513
  function startPhotoDrag(e) {
505
514
  photoSwipable = true;
@@ -523,6 +532,23 @@ function createGestures({ state, callbacks }, { signal }) {
523
532
  }
524
533
  startSwipe(e);
525
534
  }
535
+ function scheduleGestureMove() {
536
+ if (pinchMoveFrame !== null) {
537
+ return;
538
+ }
539
+ pinchMoveFrame = requestAnimationFrame(() => {
540
+ pinchMoveFrame = null;
541
+ callbacks.onGestureMove();
542
+ });
543
+ }
544
+ function flushGestureMove() {
545
+ if (pinchMoveFrame === null) {
546
+ return;
547
+ }
548
+ cancelAnimationFrame(pinchMoveFrame);
549
+ pinchMoveFrame = null;
550
+ callbacks.onGestureMove();
551
+ }
526
552
  function movePinch() {
527
553
  const points = Array.from(activePointers.values());
528
554
  const dist = distance(
@@ -547,7 +573,7 @@ function createGestures({ state, callbacks }, { signal }) {
547
573
  state.viewer.hideUi = state.viewer.scaleSize < 1 || state.viewer.scaleSize > border;
548
574
  }
549
575
  oldDistance = dist;
550
- callbacks.onGestureMove();
576
+ scheduleGestureMove();
551
577
  }
552
578
  function moveSwipe(e) {
553
579
  const pos = getPos(e);
@@ -596,6 +622,7 @@ function createGestures({ state, callbacks }, { signal }) {
596
622
  }
597
623
  function endPinch() {
598
624
  pinching = false;
625
+ flushGestureMove();
599
626
  const item = currentItem(state);
600
627
  if (!item) {
601
628
  return;
@@ -632,9 +659,11 @@ function createGestures({ state, callbacks }, { signal }) {
632
659
  const items = currentItems(state) ?? [];
633
660
  if (moveDir === "horizontal") {
634
661
  let result = "stay";
635
- if (swipeWidth >= state.options.swipeOffset && state.viewer.currentIndex !== 0) {
662
+ const elapsedMs = Math.max(now - swipeStartTime, 1);
663
+ const isFlick = Math.abs(swipeWidth) >= MIN_FLICK_DISTANCE && Math.abs(swipeWidth) / elapsedMs >= state.options.swipeVelocity;
664
+ if ((swipeWidth >= state.options.swipeOffset || isFlick && swipeWidth > 0) && state.viewer.currentIndex !== 0) {
636
665
  result = "prev";
637
- } else if (swipeWidth <= -state.options.swipeOffset && state.viewer.currentIndex !== items.length - 1) {
666
+ } else if ((swipeWidth <= -state.options.swipeOffset || isFlick && swipeWidth < 0) && state.viewer.currentIndex !== items.length - 1) {
638
667
  result = "next";
639
668
  }
640
669
  callbacks.onSwipeEnd(result);
@@ -725,6 +754,10 @@ function createGestures({ state, callbacks }, { signal }) {
725
754
  }
726
755
  function detach() {
727
756
  clearInterval(interval);
757
+ if (pinchMoveFrame !== null) {
758
+ cancelAnimationFrame(pinchMoveFrame);
759
+ pinchMoveFrame = null;
760
+ }
728
761
  }
729
762
  return { attach, detach };
730
763
  }
@@ -1056,7 +1089,11 @@ function getWindowWidth() {
1056
1089
  return document.documentElement.clientWidth;
1057
1090
  }
1058
1091
  function getWindowHeight() {
1059
- return window.visualViewport?.height ?? document.documentElement.clientHeight;
1092
+ const visualViewport = window.visualViewport;
1093
+ if (visualViewport) {
1094
+ return visualViewport.height * visualViewport.scale;
1095
+ }
1096
+ return document.documentElement.clientHeight;
1060
1097
  }
1061
1098
  function isElementArray(source) {
1062
1099
  return source.length > 0 && source[0] instanceof Element;
@@ -1087,6 +1124,44 @@ var SmartPhoto = class {
1087
1124
  this.timeouts = [];
1088
1125
  this.loadAllFired = /* @__PURE__ */ new Set();
1089
1126
  this.syncedGroupId = null;
1127
+ // 文字列セレクタで構築された場合のみ設定される。Ajax等で後から追加された
1128
+ // 要素をクリック時に動的検出するための再スキャン起点(§discoverGroupElements)
1129
+ this.rootSelector = null;
1130
+ // クリックされた要素(またはその祖先)から登録済み Item を逆引きするための
1131
+ // キャッシュ。documentへのイベントデリゲーションで祖先チェーンを辿る際に使う
1132
+ this.itemsByElement = /* @__PURE__ */ new Map();
1133
+ // サムネイルクリックはこの1本の document デリゲーションリスナーだけで処理する
1134
+ // (個別バインドは廃止)。同じクリックイベントを複数の SmartPhoto インスタンスが
1135
+ // 二重処理しないよう、処理済みマーカーをイベント自体に立てて後続インスタンスに
1136
+ // 早期returnさせる(セレクタが重複するインスタンスが同時に存在するケース)
1137
+ this.handleDocumentClick = (e) => {
1138
+ if (!(e.target instanceof Element)) {
1139
+ return;
1140
+ }
1141
+ const marker = e;
1142
+ if (marker.__smartphotoClaimed) {
1143
+ return;
1144
+ }
1145
+ let matched = this.findRegisteredAncestor(e.target);
1146
+ if (!matched && this.rootSelector) {
1147
+ matched = e.target.closest(this.rootSelector);
1148
+ }
1149
+ if (!matched) {
1150
+ return;
1151
+ }
1152
+ e.preventDefault();
1153
+ marker.__smartphotoClaimed = true;
1154
+ if (!this.itemsByElement.has(matched) && this.rootSelector) {
1155
+ const groupId = groupIdFromElement(matched);
1156
+ if (this.resyncGroupFromDom(groupId)) {
1157
+ this.syncCurrentGroupView();
1158
+ }
1159
+ }
1160
+ const item = this.itemsByElement.get(matched);
1161
+ if (item) {
1162
+ this.openPhoto(item, matched);
1163
+ }
1164
+ };
1090
1165
  // ---- 内部: window イベント ----
1091
1166
  this.updateViewportHeight = () => {
1092
1167
  this.view.refs.dialog.style.setProperty(
@@ -1098,6 +1173,7 @@ var SmartPhoto = class {
1098
1173
  if (!currentItems(this.state)) {
1099
1174
  return;
1100
1175
  }
1176
+ this.updateViewportHeight();
1101
1177
  this.resetTranslateCurrent();
1102
1178
  this.setPosByCurrentIndex();
1103
1179
  this.setSizeByScreen();
@@ -1120,6 +1196,7 @@ var SmartPhoto = class {
1120
1196
  if (!currentItems(this.state)) {
1121
1197
  return;
1122
1198
  }
1199
+ this.updateViewportHeight();
1123
1200
  this.resetTranslateCurrent();
1124
1201
  this.setPosByCurrentIndex();
1125
1202
  this.setHashByCurrentIndex();
@@ -1130,6 +1207,7 @@ var SmartPhoto = class {
1130
1207
  const poll = (time) => {
1131
1208
  this.scheduleTimeout(() => {
1132
1209
  if (prevWidth !== getWindowWidth()) {
1210
+ this.updateViewportHeight();
1133
1211
  this.resetTranslateCurrent();
1134
1212
  this.setPosByCurrentIndex();
1135
1213
  this.setHashByCurrentIndex();
@@ -1142,6 +1220,7 @@ var SmartPhoto = class {
1142
1220
  };
1143
1221
  poll(0);
1144
1222
  };
1223
+ this.rootSelector = typeof source === "string" ? source : null;
1145
1224
  this.state = createState(settings ?? {});
1146
1225
  this.view = createView(
1147
1226
  { id: this.id, options: this.state.options },
@@ -1163,15 +1242,14 @@ var SmartPhoto = class {
1163
1242
  },
1164
1243
  { signal: this.abortController.signal }
1165
1244
  );
1245
+ document.addEventListener("click", this.handleDocumentClick, {
1246
+ signal: this.abortController.signal
1247
+ });
1166
1248
  this.ingestSource(source);
1167
1249
  this.syncCurrentGroupView();
1168
1250
  const restored = this.restoreFromHash();
1169
1251
  if (restored) {
1170
- if (restored.element) {
1171
- triggerEvent(restored.element, "click");
1172
- } else {
1173
- this.openPhoto(restored, null);
1174
- }
1252
+ this.openPhoto(restored, restored.element);
1175
1253
  }
1176
1254
  this.updateViewportHeight();
1177
1255
  if (window.visualViewport) {
@@ -1216,6 +1294,7 @@ var SmartPhoto = class {
1216
1294
  clearTimeout(id);
1217
1295
  });
1218
1296
  this.timeouts = [];
1297
+ this.itemsByElement.clear();
1219
1298
  this.gestures.detach();
1220
1299
  this.view.destroy();
1221
1300
  }
@@ -1328,7 +1407,7 @@ var SmartPhoto = class {
1328
1407
  this.gotoSlide(this.state.viewer.prev);
1329
1408
  }
1330
1409
  addItem(slideOrElement) {
1331
- const item = slideOrElement instanceof Element ? this.addElementItem(slideOrElement) : this.addSlideItem(slideOrElement);
1410
+ const item = slideOrElement instanceof HTMLElement ? this.addElementItem(slideOrElement) : this.addSlideItem(slideOrElement);
1332
1411
  this.syncCurrentGroupView();
1333
1412
  return item;
1334
1413
  }
@@ -1359,7 +1438,7 @@ var SmartPhoto = class {
1359
1438
  );
1360
1439
  addItemToGroup(this.state, item);
1361
1440
  this.loadAllFired.delete(groupId);
1362
- this.bindThumbnailClick(element, item);
1441
+ this.itemsByElement.set(element, item);
1363
1442
  return item;
1364
1443
  }
1365
1444
  addSlideItem(slide) {
@@ -1370,15 +1449,72 @@ var SmartPhoto = class {
1370
1449
  this.loadAllFired.delete(groupId);
1371
1450
  return item;
1372
1451
  }
1373
- bindThumbnailClick(element, item) {
1374
- element.addEventListener(
1375
- "click",
1376
- (e) => {
1377
- e.preventDefault();
1378
- this.openPhoto(item, element);
1379
- },
1380
- { signal: this.abortController.signal }
1381
- );
1452
+ // クリックされた要素(またはその祖先。<a><img></a> の img がクリックされる
1453
+ // ケースを含む)から、登録済み Item を持つ要素まで祖先チェーンを遡って探す
1454
+ findRegisteredAncestor(target) {
1455
+ let node = target;
1456
+ while (node) {
1457
+ if (this.itemsByElement.has(node)) {
1458
+ return node;
1459
+ }
1460
+ node = node.parentElement;
1461
+ }
1462
+ return null;
1463
+ }
1464
+ // rootSelector(文字列セレクタで構築した場合のみ設定される)を再スキャンし、
1465
+ // 指定グループを現在のDOM状態に合わせて丸ごと再構築する(追加・削除・並び順の
1466
+ // 変化を一度に反映)。既知要素は既存の Item オブジェクトをそのまま再利用する
1467
+ // ため loaded/width/height は保持され、DOM から消えた要素だけ itemsByElement
1468
+ // からも除去する。index/translateX は resetTranslate() で再計算する。
1469
+ // 呼び出し元(openPhoto)がこの結果を使い、変化があった場合のみ view を
1470
+ // 再同期する(§ダイアログを開く瞬間に整合を取る。開いている間の next()/prev()
1471
+ // では呼ばれないため、この間の追加/削除は次に開き直すまで反映されない)
1472
+ resyncGroupFromDom(groupId) {
1473
+ if (!this.rootSelector) {
1474
+ return false;
1475
+ }
1476
+ const domElements = Array.from(
1477
+ document.querySelectorAll(this.rootSelector)
1478
+ ).filter((el) => groupIdFromElement(el) === groupId);
1479
+ const domElementSet = new Set(domElements);
1480
+ const previous = this.state.groups.get(groupId) ?? [];
1481
+ const previousByElement = /* @__PURE__ */ new Map();
1482
+ previous.forEach((it) => {
1483
+ if (it.element) {
1484
+ previousByElement.set(it.element, it);
1485
+ }
1486
+ });
1487
+ let changed = domElements.length !== previous.length;
1488
+ const rebuilt = domElements.map((el, index) => {
1489
+ const existing = previousByElement.get(el);
1490
+ if (existing) {
1491
+ if (existing.index !== index) {
1492
+ changed = true;
1493
+ existing.index = index;
1494
+ }
1495
+ return existing;
1496
+ }
1497
+ changed = true;
1498
+ const item = itemFromElement(
1499
+ el,
1500
+ this.state.options,
1501
+ index,
1502
+ getWindowWidth()
1503
+ );
1504
+ this.itemsByElement.set(el, item);
1505
+ return item;
1506
+ });
1507
+ previous.forEach((it) => {
1508
+ if (it.element && !domElementSet.has(it.element)) {
1509
+ this.itemsByElement.delete(it.element);
1510
+ }
1511
+ });
1512
+ resetTranslate(rebuilt, getWindowWidth());
1513
+ this.state.groups.set(groupId, rebuilt);
1514
+ if (changed) {
1515
+ this.loadAllFired.delete(groupId);
1516
+ }
1517
+ return changed;
1382
1518
  }
1383
1519
  syncCurrentGroupView() {
1384
1520
  const items = currentItems(this.state);
@@ -1632,10 +1768,11 @@ var SmartPhoto = class {
1632
1768
  });
1633
1769
  }
1634
1770
  openPhoto(item, trigger) {
1771
+ const groupChanged = this.rootSelector ? this.resyncGroupFromDom(item.groupId) : false;
1635
1772
  this.lastTriggerElement = trigger;
1636
1773
  this.state.viewer.currentGroup = item.groupId;
1637
1774
  this.state.viewer.currentIndex = item.index;
1638
- if (this.syncedGroupId !== item.groupId) {
1775
+ if (this.syncedGroupId !== item.groupId || groupChanged) {
1639
1776
  this.syncCurrentGroupView();
1640
1777
  }
1641
1778
  this.setHashByCurrentIndex();
@@ -1726,6 +1863,7 @@ var SmartPhoto = class {
1726
1863
  this.state.viewer.photoPosX = 0;
1727
1864
  this.state.viewer.photoPosY = 0;
1728
1865
  this.state.viewer.onMove = true;
1866
+ this.updateViewportHeight();
1729
1867
  this.setPosByCurrentIndex();
1730
1868
  this.setHashByCurrentIndex();
1731
1869
  this.setSizeByScreen();
@@ -1,4 +1,4 @@
1
- import type { Item, ItemId, Slide, SmartPhotoEvent, SmartPhotoSettings, SmartPhotoSource } from "./types";
1
+ import type { ItemId, SlideData, SmartPhotoEvent, SmartPhotoItem, SmartPhotoOptions, SmartPhotoSource } from "./types";
2
2
  interface ShowOptions {
3
3
  group?: string;
4
4
  trigger?: HTMLElement;
@@ -16,7 +16,9 @@ export default class SmartPhoto {
16
16
  private timeouts;
17
17
  private loadAllFired;
18
18
  private syncedGroupId;
19
- constructor(source: SmartPhotoSource, settings?: SmartPhotoSettings);
19
+ private rootSelector;
20
+ private readonly itemsByElement;
21
+ constructor(source: SmartPhotoSource, settings?: SmartPhotoOptions);
20
22
  on(event: SmartPhotoEvent, fn: (this: HTMLDialogElement, ev: Event) => void): void;
21
23
  destroy(): void;
22
24
  [Symbol.dispose](): void;
@@ -24,17 +26,19 @@ export default class SmartPhoto {
24
26
  hidePhoto(dir?: "top" | "bottom"): void;
25
27
  zoomPhoto(): void;
26
28
  zoomOutPhoto(): void;
27
- addNewItem(element: HTMLElement): Item;
29
+ addNewItem(element: HTMLElement): SmartPhotoItem;
28
30
  show(indexOrId?: ItemId, opts?: ShowOptions): void;
29
31
  hide(): void;
30
32
  next(): void;
31
33
  prev(): void;
32
- addItem(slideOrElement: Slide | HTMLElement): Item;
34
+ addItem(slideOrElement: SlideData | HTMLElement): SmartPhotoItem;
33
35
  get currentIndex(): number;
34
36
  private ingestSource;
35
37
  private addElementItem;
36
38
  private addSlideItem;
37
- private bindThumbnailClick;
39
+ private findRegisteredAncestor;
40
+ private resyncGroupFromDom;
41
+ private handleDocumentClick;
38
42
  private syncCurrentGroupView;
39
43
  private setHash;
40
44
  private setHashByCurrentIndex;
@@ -1,10 +1,10 @@
1
- import type { Bound, Item, Slide, SmartPhotoOptions, SmartPhotoSettings, State, ViewerState } from "./types";
2
- export declare const defaults: SmartPhotoOptions;
3
- export declare function createState(settings: SmartPhotoSettings): State;
1
+ import type { Bound, Item, ResolvedSmartPhotoOptions, SlideData, SmartPhotoOptions, State, ViewerState } from "./types";
2
+ export declare const defaults: ResolvedSmartPhotoOptions;
3
+ export declare function createState(settings: SmartPhotoOptions): State;
4
4
  export declare function groupIdFromElement(element: Element): string;
5
- export declare function groupIdFromSlide(slide: Slide): string;
6
- export declare function itemFromElement(element: Element, options: Pick<SmartPhotoOptions, "lazyAttribute">, index: number, winWidth: number): Item;
7
- export declare function itemFromSlide(slide: Slide, index: number, winWidth: number): Item;
5
+ export declare function groupIdFromSlide(slide: SlideData): string;
6
+ export declare function itemFromElement(element: Element, options: Pick<ResolvedSmartPhotoOptions, "lazyAttribute">, index: number, winWidth: number): Item;
7
+ export declare function itemFromSlide(slide: SlideData, index: number, winWidth: number): Item;
8
8
  export declare function addItemToGroup(state: State, item: Item): void;
9
9
  export declare function currentItems(state: State): Item[] | null;
10
10
  export declare function currentItem(state: State): Item | null;
@@ -31,7 +31,7 @@ export interface Messages {
31
31
  closeDialog: string;
32
32
  carouselLabel: string;
33
33
  }
34
- export interface SmartPhotoOptions {
34
+ export interface ResolvedSmartPhotoOptions {
35
35
  classNames: ClassNames;
36
36
  message: Messages;
37
37
  arrows: boolean;
@@ -43,6 +43,7 @@ export interface SmartPhotoOptions {
43
43
  swipeTopToClose: boolean;
44
44
  swipeBottomToClose: boolean;
45
45
  swipeOffset: number;
46
+ swipeVelocity: number;
46
47
  headerHeight: number;
47
48
  footerHeight: number;
48
49
  forceInterval: number;
@@ -52,29 +53,31 @@ export interface SmartPhotoOptions {
52
53
  lazyAttribute: string;
53
54
  animationSpeed: number;
54
55
  }
55
- export type SmartPhotoSettings = Partial<Omit<SmartPhotoOptions, "classNames" | "message">> & {
56
+ export type SmartPhotoOptions = Partial<Omit<ResolvedSmartPhotoOptions, "classNames" | "message">> & {
56
57
  classNames?: Partial<ClassNames>;
57
58
  message?: Partial<Messages>;
58
59
  };
59
60
  export type ItemId = string | number;
60
- export interface Item {
61
+ export interface SmartPhotoItem {
61
62
  src: string | null;
62
63
  thumb: string | null;
63
64
  caption: string | null;
64
65
  alt: string | null;
65
66
  groupId: string;
66
- translateX: number;
67
- translateY: number;
68
67
  index: number;
69
68
  width: number;
70
69
  height: number;
70
+ id: ItemId;
71
+ loaded: boolean;
72
+ element: HTMLElement | null;
73
+ }
74
+ export interface Item extends SmartPhotoItem {
75
+ translateX: number;
76
+ translateY: number;
71
77
  scale: number;
72
78
  x: number;
73
79
  y: number;
74
- id: ItemId;
75
- loaded: boolean;
76
80
  processed: boolean;
77
- element: HTMLElement | null;
78
81
  }
79
82
  export interface AppearEffect {
80
83
  width: number;
@@ -110,7 +113,7 @@ export interface ViewerState {
110
113
  showNextArrow: boolean;
111
114
  }
112
115
  export interface State {
113
- options: SmartPhotoOptions;
116
+ options: ResolvedSmartPhotoOptions;
114
117
  viewer: ViewerState;
115
118
  groups: Map<string, Item[]>;
116
119
  }
@@ -120,7 +123,7 @@ export interface Bound {
120
123
  maxX: number;
121
124
  maxY: number;
122
125
  }
123
- export interface Slide {
126
+ export interface SlideData {
124
127
  src: string;
125
128
  thumb?: string;
126
129
  caption?: string;
@@ -130,7 +133,7 @@ export interface Slide {
130
133
  width?: number;
131
134
  height?: number;
132
135
  }
133
- export type SmartPhotoSource = string | NodeListOf<Element> | Element[] | Slide[];
136
+ export type SmartPhotoSource = string | NodeListOf<Element> | Element[] | SlideData[];
134
137
  export type SmartPhotoEvent = "open" | "close" | "change" | "swipestart" | "swipeend" | "zoomin" | "zoomout" | "gesturestart" | "gestureend" | "loadall";
135
138
  export type SwipeEndResult = "prev" | "next" | "close-top" | "close-bottom" | "stay";
136
139
  export type PhotoDragEndResult = "prev" | "next" | "zoom-out" | null;
@@ -1,4 +1,4 @@
1
- import type { AppearEffect, Item, SmartPhotoOptions, State } from "./types";
1
+ import type { AppearEffect, Item, ResolvedSmartPhotoOptions, State } from "./types";
2
2
  interface SlideRefs {
3
3
  li: HTMLLIElement;
4
4
  loaderWrap: HTMLDivElement | null;
@@ -41,7 +41,7 @@ export interface View {
41
41
  }
42
42
  export declare function createView({ id, options }: {
43
43
  id: string;
44
- options: SmartPhotoOptions;
44
+ options: ResolvedSmartPhotoOptions;
45
45
  }, handlers: ViewHandlers, { signal }: {
46
46
  signal: AbortSignal;
47
47
  }): View;
@@ -1,2 +1,3 @@
1
1
  import SmartPhoto from "./core";
2
2
  export default SmartPhoto;
3
+ export type { ClassNames, ItemId, Messages, SlideData, SmartPhotoEvent, SmartPhotoItem, SmartPhotoOptions, SmartPhotoSource, } from "./core/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartphoto",
3
- "version": "2.1.3",
3
+ "version": "2.1.6",
4
4
  "description": "smartphoto",
5
5
  "homepage": "https://developer.a-blogcms.jp",
6
6
  "main": "./lib/smartphoto.js",
@@ -31,17 +31,17 @@
31
31
  "lint": "biome check --write ./src",
32
32
  "lint:ci": "biome ci ./src",
33
33
  "typecheck": "tsc --noEmit",
34
- "build": "npm run build:js && npm run build:types && npm run build:sass",
34
+ "build": "npm run build:js && npm run build:types && npm run build:css",
35
35
  "build:js": "tsup",
36
36
  "build:types": "tsc -p tsconfig.build.json",
37
- "build:sass": "npm run clean:css && npm run sass && npm run sass:min",
38
- "clean:css": "rm -rf ./css/*",
39
- "sass": "sass ./scss/smartphoto.scss ./css/smartphoto.css --style expanded",
40
- "sass:min": "sass ./scss/smartphoto.scss ./css/smartphoto.min.css --style compressed --no-source-map",
37
+ "build:css": "npm run clean:css && npm run css:copy && npm run css:min",
38
+ "clean:css": "rm -rf ./css && mkdir -p ./css",
39
+ "css:copy": "cp ./styles/smartphoto.css ./css/smartphoto.css",
40
+ "css:min": "postcss ./styles/smartphoto.css -o ./css/smartphoto.min.css",
41
41
  "dev": "vite",
42
42
  "preview": "vite preview",
43
43
  "prepare": "husky",
44
- "prepack": "npm run lint:ci && npm run typecheck && npm run test:coverage && npm run build",
44
+ "prepack": "npm run lint:ci && npm run typecheck && npm test && npm run build",
45
45
  "release:patch": "npm version patch && git push --follow-tags",
46
46
  "release:minor": "npm version minor && git push --follow-tags",
47
47
  "release:major": "npm version major && git push --follow-tags"
@@ -64,10 +64,12 @@
64
64
  "@testing-library/jest-dom": "^7.0.0",
65
65
  "@types/node": "^24.13.3",
66
66
  "@vitest/coverage-v8": "^4.1.10",
67
+ "cssnano": "^8.0.4",
67
68
  "husky": "^9.1.7",
68
69
  "jsdom": "^30.0.1",
69
70
  "lint-staged": "^17.3.0",
70
- "sass": "^1.102.0",
71
+ "postcss": "^8.5.26",
72
+ "postcss-cli": "^11.0.1",
71
73
  "tsup": "^8.5.1",
72
74
  "typescript": "^7.0.2",
73
75
  "vite": "^8.2.0",
@@ -1 +0,0 @@
1
- {"version":3,"sourceRoot":"","sources":["../scss/smartphoto.scss"],"names":[],"mappings":"AAKA;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;;AAUJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;;;AAIF;EAEE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAKA;EAQA;EACA;EACA;EACA;EACA;EACA;EAKA,YACE;;AAIF;EACE;;AAGF;EACE;;;AASJ;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"smartphoto.css"}