extract CSS to its own file
This commit is contained in:
parent
ff8e6f380e
commit
dc8dfa6a91
6 changed files with 17 additions and 62 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.css.d.ts
|
||||
.rpt2_cache
|
||||
node_modules
|
||||
|
|
2
dist/pinch-zoom-min.js
vendored
2
dist/pinch-zoom-min.js
vendored
File diff suppressed because one or more lines are too long
14
dist/pinch-zoom.css
vendored
Normal file
14
dist/pinch-zoom.css
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
pinch-zoom {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
touch-action: none;
|
||||
--scale: 1;
|
||||
--x: 0;
|
||||
--y: 0;
|
||||
}
|
||||
|
||||
pinch-zoom > * {
|
||||
transform: translate(var(--x), var(--y)) scale(var(--scale));
|
||||
transform-origin: 0 0;
|
||||
will-change: transform;
|
||||
}
|
30
dist/pinch-zoom.js
vendored
30
dist/pinch-zoom.js
vendored
|
@ -185,36 +185,6 @@ var PinchZoom = (function () {
|
|||
}
|
||||
}
|
||||
|
||||
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';
|
||||
|
|
30
dist/pinch-zoom.mjs
vendored
30
dist/pinch-zoom.mjs
vendored
|
@ -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';
|
||||
|
|
|
@ -7,7 +7,7 @@ import { dependencies } from './package.json';
|
|||
const mjs = {
|
||||
plugins: [
|
||||
typescript({ useTsconfigDeclarationDir: false }),
|
||||
postcss()
|
||||
postcss({ extract: 'dist/pinch-zoom.css' })
|
||||
],
|
||||
external: Object.keys(dependencies),
|
||||
input: 'lib/index.ts',
|
||||
|
|
Loading…
Reference in a new issue