@readium/navigator-html-injectables 2.3.0 → 2.3.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/navigator-html-injectables",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-alpha.1",
4
4
  "type": "module",
5
5
  "description": "An embeddable solution for connecting frames of HTML publications with a Readium Navigator",
6
6
  "author": "readium",
@@ -26,10 +26,6 @@
26
26
  "reader",
27
27
  "viewer"
28
28
  ],
29
- "scripts": {
30
- "clean": "rimraf types dist",
31
- "build": "pnpm clean && tsc && vite build"
32
- },
33
29
  "main": "./dist/index.umd.cjs",
34
30
  "module": "./dist/index.js",
35
31
  "types": "./types/src/index.d.ts",
@@ -49,11 +45,15 @@
49
45
  "node": ">=18"
50
46
  },
51
47
  "devDependencies": {
52
- "@readium/shared": "workspace:*",
53
48
  "css-selector-generator": "^3.8.0",
54
49
  "rimraf": "^6.1.2",
55
50
  "tslib": "^2.8.1",
56
51
  "typescript": "^5.9.3",
57
- "vite": "^7.3.1"
52
+ "vite": "^7.3.1",
53
+ "@readium/shared": "2.2.0-alpha.1"
54
+ },
55
+ "scripts": {
56
+ "clean": "rimraf types dist",
57
+ "build": "pnpm clean && tsc && vite build"
58
58
  }
59
- }
59
+ }
@@ -1,5 +1,7 @@
1
1
  import { ReadiumWindow } from "./dom";
2
2
 
3
+ export const isTypedOMSupported = typeof window.CSSTransformValue !== 'undefined';
4
+
3
5
  export function getProperties(wnd: ReadiumWindow) {
4
6
  const cssProperties: { [key: string]: string } = {};
5
7
 
@@ -8,6 +8,7 @@ import { rangeFromLocator } from "../../helpers/locator";
8
8
  import { ReadiumWindow, deselect, findFirstVisibleLocator } from "../../helpers/dom";
9
9
  import { PatternAnalyzer } from "../../protection/PatternAnalyzer";
10
10
  import { BaseSuspiciousActivityEvent } from "../Peripherals";
11
+ import { isTypedOMSupported } from "../../helpers/css";
11
12
 
12
13
  const COLUMN_SNAPPER_STYLE_ID = "readium-column-snapper-style";
13
14
 
@@ -133,7 +134,13 @@ export class ColumnSnapper extends Snapper {
133
134
  const spos = position(startX, so, elapsed, period);
134
135
  doc.scrollLeft = spos;
135
136
  if(this.overscroll !== 0)
136
- doc.style.transform = `translate3d(${-lpos}px, 0px, 0px)`;
137
+ if(isTypedOMSupported) {
138
+ doc.attributeStyleMap.set("transform", new CSSTransformValue([
139
+ new CSSTranslate(CSS.px(-lpos), CSS.px(0), CSS.px(0))
140
+ ]));
141
+ } else {
142
+ doc.style.transform = `translate3d(${-lpos}px, 0px, 0px)`;
143
+ }
137
144
 
138
145
  if (elapsed < period)
139
146
  this.wnd.requestAnimationFrame(step);
@@ -237,10 +244,22 @@ export class ColumnSnapper extends Snapper {
237
244
  const newpos = this.alreadyScrollLeft + dro;
238
245
  if(newpos < 0) {
239
246
  this.overscroll = newpos;
240
- this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`;
247
+ if(isTypedOMSupported) {
248
+ this.doc().attributeStyleMap.set("transform", new CSSTransformValue([
249
+ new CSSTranslate(CSS.px(-newpos), CSS.px(0), CSS.px(0))
250
+ ]));
251
+ } else {
252
+ this.doc().style.transform = `translate3d(${-newpos}px, 0px, 0px)`;
253
+ }
241
254
  } else if((newpos + this.wnd.innerWidth) > this.cachedScrollWidth) {
242
255
  this.overscroll = newpos;
243
- this.doc().style.transform = `translate3d(${-newpos}px, 0px, 0px)`;
256
+ if(isTypedOMSupported) {
257
+ this.doc().attributeStyleMap.set("transform", new CSSTransformValue([
258
+ new CSSTranslate(CSS.px(-newpos), CSS.px(0), CSS.px(0))
259
+ ]));
260
+ } else {
261
+ this.doc().style.transform = `translate3d(${-newpos}px, 0px, 0px)`;
262
+ }
244
263
  } else {
245
264
  this.overscroll = 0;
246
265
  this.doc().style.removeProperty("transform");
@@ -1,4 +1,5 @@
1
1
  import { ReadiumWindow } from "./dom";
2
+ export declare const isTypedOMSupported: boolean;
2
3
  export declare function getProperties(wnd: ReadiumWindow): {
3
4
  [key: string]: string;
4
5
  };