update build

This commit is contained in:
FloatingGhost 2023-01-02 15:10:29 +00:00
parent 4741a2f932
commit ca1bd40f33
10 changed files with 2051 additions and 6655 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,38 +1,6 @@
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var PointerTracker = _interopDefault(require('pointer-tracker'));
function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
if (!css || typeof document === 'undefined') { return; }
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var css = "pinch-zoom {\n display: block;\n overflow: hidden;\n touch-action: none;\n --scale: 1;\n --x: 0;\n --y: 0;\n}\n\npinch-zoom > * {\n transform: translate(var(--x), var(--y)) scale(var(--scale));\n transform-origin: 0 0;\n will-change: transform;\n}\n";
styleInject(css);
var PointerTracker = require('pointer-tracker');
const minScaleAttr = 'min-scale';
const allowPanMinScaleAttr = 'allow-pan-min-scale';
@ -81,6 +49,7 @@ const roundedCmp = (a, b) => {
return Math.round(a * 100) - Math.round(b * 100);
};
class PinchZoom extends HTMLElement {
static get observedAttributes() { return [minScaleAttr]; }
constructor() {
super();
// Current transform.
@ -117,7 +86,6 @@ class PinchZoom extends HTMLElement {
this.addEventListener('wheel', event => this._onWheel(event));
this.addEventListener('click', event => this._onClick(event, pointerTracker));
}
static get observedAttributes() { return [minScaleAttr]; }
attributeChangedCallback(name, oldValue, newValue) {
if (name === minScaleAttr) {
if (this.scale < this.minScale) {

27
dist/pinch-zoom.d.ts vendored
View file

@ -10,8 +10,8 @@ interface SetTransformOpts extends ChangeOptions {
x?: number;
y?: number;
}
declare type ScaleRelativeToValues = 'container' | 'content';
declare type ReachMinScaleStrategy = 'reset' | 'none';
type ScaleRelativeToValues = 'container' | 'content';
type ReachMinScaleStrategy = 'reset' | 'none';
export interface ScaleToOpts extends ChangeOptions {
/** Transform origin. Can be a number, or string percent, eg "50%" */
originX?: number | string;
@ -23,18 +23,23 @@ export interface ScaleToOpts extends ChangeOptions {
export default class PinchZoom extends HTMLElement {
private _positioningEl?;
private _transform;
static readonly observedAttributes: string[];
static get observedAttributes(): string[];
constructor();
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
minScale: number;
reachMinScaleStrategy: ReachMinScaleStrategy;
allowPanMinScale: number;
resetToMinScaleLimit: number;
stopPropagateHandled: boolean;
get minScale(): number;
set minScale(value: number);
get reachMinScaleStrategy(): ReachMinScaleStrategy;
set reachMinScaleStrategy(value: ReachMinScaleStrategy);
get allowPanMinScale(): number;
set allowPanMinScale(value: number);
get resetToMinScaleLimit(): number;
set resetToMinScaleLimit(value: number);
get stopPropagateHandled(): boolean;
set stopPropagateHandled(value: boolean);
connectedCallback(): void;
readonly x: number;
readonly y: number;
readonly scale: number;
get x(): number;
get y(): number;
get scale(): number;
/**
* Change the scale, adjusting x/y by a given transform origin.
*/

34
dist/pinch-zoom.es.js vendored
View file

@ -1,35 +1,5 @@
import PointerTracker from 'pointer-tracker';
function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
if (!css || typeof document === 'undefined') { return; }
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var css = "pinch-zoom {\n display: block;\n overflow: hidden;\n touch-action: none;\n --scale: 1;\n --x: 0;\n --y: 0;\n}\n\npinch-zoom > * {\n transform: translate(var(--x), var(--y)) scale(var(--scale));\n transform-origin: 0 0;\n will-change: transform;\n}\n";
styleInject(css);
const minScaleAttr = 'min-scale';
const allowPanMinScaleAttr = 'allow-pan-min-scale';
const resetToMinScaleLimitAttr = 'reset-to-min-scale-limit';
@ -77,6 +47,7 @@ const roundedCmp = (a, b) => {
return Math.round(a * 100) - Math.round(b * 100);
};
class PinchZoom extends HTMLElement {
static get observedAttributes() { return [minScaleAttr]; }
constructor() {
super();
// Current transform.
@ -113,7 +84,6 @@ class PinchZoom extends HTMLElement {
this.addEventListener('wheel', event => this._onWheel(event));
this.addEventListener('click', event => this._onClick(event, pointerTracker));
}
static get observedAttributes() { return [minScaleAttr]; }
attributeChangedCallback(name, oldValue, newValue) {
if (name === minScaleAttr) {
if (this.scale < this.minScale) {
@ -452,4 +422,4 @@ class PinchZoom extends HTMLElement {
customElements.define('pinch-zoom', PinchZoom);
export default PinchZoom;
export { PinchZoom as default };

4
dist/pinch-zoom.js vendored
View file

@ -232,6 +232,7 @@ var PinchZoom = (function () {
return Math.round(a * 100) - Math.round(b * 100);
};
class PinchZoom extends HTMLElement {
static get observedAttributes() { return [minScaleAttr]; }
constructor() {
super();
// Current transform.
@ -268,7 +269,6 @@ var PinchZoom = (function () {
this.addEventListener('wheel', event => this._onWheel(event));
this.addEventListener('click', event => this._onClick(event, pointerTracker));
}
static get observedAttributes() { return [minScaleAttr]; }
attributeChangedCallback(name, oldValue, newValue) {
if (name === minScaleAttr) {
if (this.scale < this.minScale) {
@ -609,4 +609,4 @@ var PinchZoom = (function () {
return PinchZoom;
}());
})();

4
dist/pinch-zoom.mjs vendored
View file

@ -47,6 +47,7 @@ const roundedCmp = (a, b) => {
return Math.round(a * 100) - Math.round(b * 100);
};
class PinchZoom extends HTMLElement {
static get observedAttributes() { return [minScaleAttr]; }
constructor() {
super();
// Current transform.
@ -83,7 +84,6 @@ class PinchZoom extends HTMLElement {
this.addEventListener('wheel', event => this._onWheel(event));
this.addEventListener('click', event => this._onClick(event, pointerTracker));
}
static get observedAttributes() { return [minScaleAttr]; }
attributeChangedCallback(name, oldValue, newValue) {
if (name === minScaleAttr) {
if (this.scale < this.minScale) {
@ -422,4 +422,4 @@ class PinchZoom extends HTMLElement {
customElements.define('pinch-zoom', PinchZoom);
export default PinchZoom;
export { PinchZoom as default };

8575
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,11 @@
{
"name": "pinch-zoom-element",
"version": "1.3.0",
"name": "@floatingghost/pinch-zoom-element",
"version": "1.3.1",
"description": "Put stuff in an element, now you can pinch-zoom it!",
"main": "dist/pinch-zoom.cjs.js",
"module": "dist/pinch-zoom.es.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"build": "rm -rf dist && rollup -c"
},
@ -29,14 +30,14 @@
"pointer-tracker": "^2.0.3"
},
"devDependencies": {
"rollup": "^0.66.6",
"rollup": "^3.9.1",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^3.0.0",
"rollup-plugin-typescript2": "^0.17.2",
"rollup-plugin-typescript2": "^0.34.1",
"tslint": "^5.11.0",
"tslint-config-airbnb": "^5.11.0",
"tslint-react": "^3.6.0",
"typescript": "^3.1.4"
"typescript": "^4.9.4"
}
}

View file

@ -2,12 +2,13 @@ import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import postcss from 'rollup-plugin-postcss';
import { terser } from "rollup-plugin-terser";
import { dependencies } from './package.json';
import pkg from './package.json' assert { type: "json" };
const { dependencies } = pkg;
const mjs = {
plugins: [
typescript({ useTsconfigDeclarationDir: false }),
postcss({ extract: 'dist/pinch-zoom.css' })
postcss({ extract: 'pinch-zoom.css', inject: false })
],
external: Object.keys(dependencies),
input: 'lib/index.ts',
@ -20,7 +21,7 @@ const mjs = {
const esm = {
plugins: [
typescript({ useTsconfigDeclarationDir: false }),
postcss()
postcss({ extract: 'pinch-zoom.css', inject: false })
],
external: Object.keys(dependencies),
input: 'lib/index.ts',
@ -33,7 +34,7 @@ const esm = {
const cjs = {
plugins: [
typescript({ useTsconfigDeclarationDir: false }),
postcss()
postcss({ extract: 'pinch-zoom.css', inject: false })
],
external: Object.keys(dependencies),
input: 'lib/index.ts',

View file

@ -2,7 +2,7 @@
"compileOnSave": false,
"compilerOptions": {
"strict": true,
"target": "es2017",
"target": "es2019",
"module": "esnext",
"moduleResolution": "node",
"noUnusedLocals": true,