@r74tech/docusaurus-plugin-panzoom 2.2.0 → 2.4.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/.prettierrc +12 -0
- package/CHANGELOG.md +15 -0
- package/dist/PanZoom.d.ts +1 -0
- package/dist/PanZoom.js +113 -15
- package/dist/PanZoomPlugin.js +12 -6
- package/dist/PanzoomPluginOptions.d.ts +62 -0
- package/dist/PanzoomPluginOptions.js +8 -0
- package/dist/img/zoom-in.d.ts +2 -0
- package/dist/img/zoom-in.js +3 -0
- package/dist/img/zoom-out.d.ts +2 -0
- package/dist/img/zoom-out.js +3 -0
- package/dist/img/zoom-reset.d.ts +2 -0
- package/dist/img/zoom-reset.js +3 -0
- package/dist/styles/panzoom.css +48 -0
- package/eslint.config.mjs +32 -0
- package/package.json +25 -5
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [2.4.0](https://github.com/r74tech/docusaurus-plugin-panzoom/compare/v2.3.0...v2.4.0) (2025-07-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add options to better control the zoom ([#7](https://github.com/r74tech/docusaurus-plugin-panzoom/issues/7)) ([4dc537c](https://github.com/r74tech/docusaurus-plugin-panzoom/commit/4dc537c8e059908cc2cae407fc78ae93de34c6dd))
|
|
7
|
+
|
|
8
|
+
# [2.3.0](https://github.com/r74tech/docusaurus-plugin-panzoom/compare/v2.2.0...v2.3.0) (2025-07-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add toolbar to control zooming (zoom in, zoom out, reset) ([a170e52](https://github.com/r74tech/docusaurus-plugin-panzoom/commit/a170e5253e2bf5b1ddb12bf7b0e648722b053bcb))
|
|
14
|
+
* merge all toolbar props into a single object ([0c32e6c](https://github.com/r74tech/docusaurus-plugin-panzoom/commit/0c32e6c361563ad81517818c99693a9de717f33f))
|
|
15
|
+
|
|
1
16
|
# [2.2.0](https://github.com/r74tech/docusaurus-plugin-panzoom/compare/v2.1.0...v2.2.0) (2025-07-12)
|
|
2
17
|
|
|
3
18
|
|
package/dist/PanZoom.d.ts
CHANGED
package/dist/PanZoom.js
CHANGED
|
@@ -4,13 +4,113 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const panzoom_1 = __importDefault(require("@panzoom/panzoom"));
|
|
7
|
+
const PanzoomPluginOptions_1 = require("./PanzoomPluginOptions");
|
|
8
|
+
const zoom_in_1 = __importDefault(require("./img/zoom-in"));
|
|
9
|
+
const zoom_out_1 = __importDefault(require("./img/zoom-out"));
|
|
10
|
+
const zoom_reset_1 = __importDefault(require("./img/zoom-reset"));
|
|
11
|
+
require("./styles/panzoom.css");
|
|
7
12
|
const config = require('@generated/docusaurus.config').default;
|
|
8
13
|
const { themeConfig } = config;
|
|
9
14
|
const { zoom } = themeConfig;
|
|
10
|
-
const { selectors = ['div.mermaid[data-processed="true"]', 'div.docusaurus-mermaid-container', '.drawio'], wrap = true, timeout = 1000, excludeClass = 'panzoom-exclude', ...panZoomConfig } = zoom;
|
|
15
|
+
const { selectors = ['div.mermaid[data-processed="true"]', 'div.docusaurus-mermaid-container', '.drawio'], wrap = true, timeout = 1000, excludeClass = 'panzoom-exclude', toolbar: { enabled = false, position = PanzoomPluginOptions_1.PanZoomPluginToolbarPosition.TopRight, opacity = 0 } = {}, enableWheelZoom = true, enableWheelZoomWithShift = false, enableDoubleClickResetZoom = true, restrictZoomOutBeyondOrigin = false, ...panZoomConfig } = zoom;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a toolbar with zoom controls for a panzoom instance
|
|
18
|
+
*
|
|
19
|
+
* @param container The container element to append the toolbar to
|
|
20
|
+
* @param instance The panzoom instance to control
|
|
21
|
+
* @param position The position of the toolbar
|
|
22
|
+
*/
|
|
23
|
+
const createToolbar = (container, instance, position) => {
|
|
24
|
+
const toolbar = document.createElement('div');
|
|
25
|
+
toolbar.className = `panzoom-toolbar panzoom-toolbar-${position} ${excludeClass}`;
|
|
26
|
+
// Apply custom opacity from configuration
|
|
27
|
+
toolbar.style.opacity = opacity.toString();
|
|
28
|
+
// Prevent double-click events from bubbling up to the container
|
|
29
|
+
// By default the panzoom library will reset on double click
|
|
30
|
+
toolbar.addEventListener('dblclick', (e) => {
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
});
|
|
33
|
+
// Helper function to create toolbar buttons
|
|
34
|
+
const createButton = (svg, title, action) => {
|
|
35
|
+
const button = document.createElement('button');
|
|
36
|
+
button.innerHTML = svg;
|
|
37
|
+
button.title = title;
|
|
38
|
+
button.className = excludeClass;
|
|
39
|
+
button.addEventListener('click', (e) => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
action();
|
|
43
|
+
});
|
|
44
|
+
return button;
|
|
45
|
+
};
|
|
46
|
+
// Create and append all buttons
|
|
47
|
+
const buttons = [
|
|
48
|
+
// Zoom in
|
|
49
|
+
createButton(zoom_in_1.default, 'Zoom in', () => {
|
|
50
|
+
instance.zoomIn();
|
|
51
|
+
}),
|
|
52
|
+
// Zoom out
|
|
53
|
+
createButton(zoom_out_1.default, 'Zoom out', () => {
|
|
54
|
+
if (!restrictZoomOutBeyondOrigin) {
|
|
55
|
+
instance.zoomOut();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (instance.getScale() > 1) {
|
|
59
|
+
instance.zoomOut();
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
// Reset zoom
|
|
63
|
+
createButton(zoom_reset_1.default, 'Reset zoom', () => {
|
|
64
|
+
instance.reset();
|
|
65
|
+
}),
|
|
66
|
+
];
|
|
67
|
+
buttons.forEach((button) => toolbar.appendChild(button));
|
|
68
|
+
container.appendChild(toolbar);
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Attach event listeners to the element where panzoom is applied.
|
|
72
|
+
* The listeners to add are based on the configuration options provided.
|
|
73
|
+
*
|
|
74
|
+
* @param element The element to add event listeners to
|
|
75
|
+
* @param instance The panzoom instance to control
|
|
76
|
+
*/
|
|
77
|
+
const addEventListeners = (element, instance) => {
|
|
78
|
+
const handleZoomWithWheel = (event) => {
|
|
79
|
+
if (restrictZoomOutBeyondOrigin) {
|
|
80
|
+
// Allow zooming in or zooming out only to the original size
|
|
81
|
+
if (event.deltaY < 0 || (event.deltaY > 0 && instance.getScale() > 1)) {
|
|
82
|
+
instance.zoomWithWheel(event);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
instance.zoomWithWheel(event);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Handle the wheel zoom functionality if at least one of the options is enabled
|
|
90
|
+
if (enableWheelZoom || enableWheelZoomWithShift) {
|
|
91
|
+
element.addEventListener('wheel', (event) => {
|
|
92
|
+
// Handle zoom with shift key
|
|
93
|
+
if (enableWheelZoomWithShift && event.shiftKey) {
|
|
94
|
+
handleZoomWithWheel(event);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Handle regular zoom
|
|
98
|
+
if (enableWheelZoom && !event.shiftKey) {
|
|
99
|
+
handleZoomWithWheel(event);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Handle double-click reset zoom
|
|
104
|
+
if (enableDoubleClickResetZoom) {
|
|
105
|
+
element.addEventListener('dblclick', () => {
|
|
106
|
+
instance.reset();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
11
110
|
/**
|
|
12
111
|
* Main work method to zoom the set of elements. You can pass in global options to the pan zoom component
|
|
13
112
|
* as well as control whether the items will be wrapped.
|
|
113
|
+
*
|
|
14
114
|
* @param selectors
|
|
15
115
|
*/
|
|
16
116
|
const zoomElements = (selectors) => {
|
|
@@ -20,25 +120,23 @@ const zoomElements = (selectors) => {
|
|
|
20
120
|
});
|
|
21
121
|
foundElements.forEach((element) => {
|
|
22
122
|
const instance = (0, panzoom_1.default)(element, { excludeClass, ...panZoomConfig });
|
|
123
|
+
let container;
|
|
23
124
|
if (wrap) {
|
|
24
125
|
const wrapper = document.createElement('div');
|
|
25
|
-
wrapper.setAttribute('style',
|
|
126
|
+
wrapper.setAttribute('style', 'overflow: hidden; position: relative;');
|
|
26
127
|
element.parentElement?.insertBefore(wrapper, element);
|
|
27
128
|
wrapper.appendChild(element);
|
|
28
|
-
|
|
29
|
-
instance.zoomWithWheel(event);
|
|
30
|
-
});
|
|
31
|
-
wrapper.addEventListener('dblclick', (event) => {
|
|
32
|
-
instance.reset();
|
|
33
|
-
});
|
|
129
|
+
container = wrapper;
|
|
34
130
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
131
|
+
else {
|
|
132
|
+
const htmlElement = element;
|
|
133
|
+
htmlElement.style.position = 'relative';
|
|
134
|
+
container = htmlElement;
|
|
135
|
+
}
|
|
136
|
+
addEventListeners(container, instance);
|
|
137
|
+
// Add toolbar if enabled
|
|
138
|
+
if (enabled) {
|
|
139
|
+
createToolbar(container, instance, position);
|
|
42
140
|
}
|
|
43
141
|
});
|
|
44
142
|
};
|
package/dist/PanZoomPlugin.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validatedThemeConfig = exports.PanZoomPlugin = void 0;
|
|
4
4
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
5
|
+
const PanzoomPluginOptions_1 = require("./PanzoomPluginOptions");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
/**
|
|
7
8
|
* Main module for the PanZoom plugin
|
|
@@ -11,15 +12,15 @@ const path_1 = require("path");
|
|
|
11
12
|
*/
|
|
12
13
|
const PanZoomPlugin = (context, options) => {
|
|
13
14
|
return {
|
|
14
|
-
name:
|
|
15
|
+
name: 'docusaurus-plugin-panzoom',
|
|
15
16
|
getClientModules() {
|
|
16
|
-
return [
|
|
17
|
-
|
|
18
|
-
];
|
|
19
|
-
}
|
|
17
|
+
return [(0, path_1.resolve)(__dirname, './PanZoom'), (0, path_1.resolve)(__dirname, './styles/panzoom.css')];
|
|
18
|
+
},
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
exports.PanZoomPlugin = PanZoomPlugin;
|
|
22
|
+
// Extract the valid toolbar position values from the enum
|
|
23
|
+
const validToolbarPositions = Object.values(PanzoomPluginOptions_1.PanZoomPluginToolbarPosition);
|
|
23
24
|
/**
|
|
24
25
|
* Theme validation rules for this plugin
|
|
25
26
|
*/
|
|
@@ -29,7 +30,12 @@ const panZoomValidator = utils_validation_1.Joi.object({
|
|
|
29
30
|
wrap: utils_validation_1.Joi.boolean(),
|
|
30
31
|
timeout: utils_validation_1.Joi.number(),
|
|
31
32
|
excludeClass: utils_validation_1.Joi.string(),
|
|
32
|
-
|
|
33
|
+
toolbar: utils_validation_1.Joi.object({
|
|
34
|
+
enabled: utils_validation_1.Joi.boolean(),
|
|
35
|
+
position: utils_validation_1.Joi.string().valid(...validToolbarPositions),
|
|
36
|
+
opacity: utils_validation_1.Joi.number().min(0).max(1),
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
33
39
|
});
|
|
34
40
|
/**
|
|
35
41
|
* Add a validation for the theme configuration
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { PanzoomOptions } from '@panzoom/panzoom';
|
|
2
|
+
export declare enum PanZoomPluginToolbarPosition {
|
|
3
|
+
TopRight = "top-right",
|
|
4
|
+
TopLeft = "top-left",
|
|
5
|
+
BottomRight = "bottom-right",
|
|
6
|
+
BottomLeft = "bottom-left"
|
|
7
|
+
}
|
|
2
8
|
export type PanZoomPluginOptions = PanzoomOptions & {
|
|
3
9
|
/**
|
|
4
10
|
* A list of selectors to look for elements to enable pan and zoom
|
|
@@ -28,4 +34,60 @@ export type PanZoomPluginOptions = PanzoomOptions & {
|
|
|
28
34
|
* default: 'panzoom-exclude'
|
|
29
35
|
*/
|
|
30
36
|
excludeClass?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Toolbar options for the Panzoom plugin.
|
|
39
|
+
*/
|
|
40
|
+
toolbar?: {
|
|
41
|
+
/**
|
|
42
|
+
* Whether to enable and show a control toolbar with buttons for zoom in, zoom out, and reset.
|
|
43
|
+
*
|
|
44
|
+
* default: false
|
|
45
|
+
*/
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The toolbar position (top-right, top-left, bottom-right, bottom-left)
|
|
49
|
+
*
|
|
50
|
+
* default: 'top-right'
|
|
51
|
+
*/
|
|
52
|
+
position?: PanZoomPluginToolbarPosition;
|
|
53
|
+
/**
|
|
54
|
+
* The toolbar opacity when not hovered (value between 0 and 1)
|
|
55
|
+
* The toolbar will become fully opaque (opacity: 1) when hovered.
|
|
56
|
+
*
|
|
57
|
+
* example: 0.5
|
|
58
|
+
* default: 0
|
|
59
|
+
*/
|
|
60
|
+
opacity?: number;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Whether to enable zooming with the mouse wheel.
|
|
64
|
+
* If true, the user can zoom in and out using the mouse wheel.
|
|
65
|
+
*
|
|
66
|
+
* default: true
|
|
67
|
+
*/
|
|
68
|
+
enableWheelZoom?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to enable zooming with the mouse wheel while holding the shift key.
|
|
71
|
+
* If true, the user can zoom in and out using the mouse wheel while holding the shift key.
|
|
72
|
+
*
|
|
73
|
+
* This option is independent of `enableWheelZoom`. Meaning, even if `enableWheelZoom` is false,
|
|
74
|
+
* and `enableWheelZoomWithShift` is true, the user can still zoom using shift + mouse whee.
|
|
75
|
+
* Also, `enableWheelZoom` and `enableWheelZoomWithShift` can be used together.
|
|
76
|
+
*
|
|
77
|
+
* default: false
|
|
78
|
+
*/
|
|
79
|
+
enableWheelZoomWithShift?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether to enable double-click to reset zoom.
|
|
82
|
+
* If true, double-clicking on the panzoom element will reset the zoom level.
|
|
83
|
+
*
|
|
84
|
+
* default: true
|
|
85
|
+
*/
|
|
86
|
+
enableDoubleClickResetZoom?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether to restrict zooming out beyond the original size of the element.
|
|
89
|
+
*
|
|
90
|
+
* default: false
|
|
91
|
+
*/
|
|
92
|
+
restrictZoomOutBeyondOrigin?: boolean;
|
|
31
93
|
};
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PanZoomPluginToolbarPosition = void 0;
|
|
4
|
+
var PanZoomPluginToolbarPosition;
|
|
5
|
+
(function (PanZoomPluginToolbarPosition) {
|
|
6
|
+
PanZoomPluginToolbarPosition["TopRight"] = "top-right";
|
|
7
|
+
PanZoomPluginToolbarPosition["TopLeft"] = "top-left";
|
|
8
|
+
PanZoomPluginToolbarPosition["BottomRight"] = "bottom-right";
|
|
9
|
+
PanZoomPluginToolbarPosition["BottomLeft"] = "bottom-left";
|
|
10
|
+
})(PanZoomPluginToolbarPosition = exports.PanZoomPluginToolbarPosition || (exports.PanZoomPluginToolbarPosition = {}));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000"><path d="M450-450H220v-60h230v-230h60v230h230v60H510v230h-60v-230Z"/></svg>';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#000\"><path d=\"M480-333.85v-91.92q0-22.6 15.82-38.41Q511.63-480 534.23-480h91.92v47.69h-98.46v98.46H480ZM534.23-100q-22.6 0-38.41-15.82Q480-131.64 480-154.23v-91.92h47.69v98.46h98.46V-100h-91.92Zm278.08-233.85v-98.46h-98.46V-480h91.92q22.59 0 38.41 15.82Q860-448.37 860-425.77v91.92h-47.69ZM713.85-100v-47.69h98.46v-98.46H860v91.92q0 22.59-15.82 38.41Q828.36-100 805.77-100h-91.92Zm94.07-467.69h-62.23q-27.54-84.54-99.57-138.43Q574.08-760 480-760q-117 0-198.5 81.5T200-480q0 78.15 38.46 141.81 38.46 63.65 101.54 99.34V-360h60v220H180v-60h113.23q-69.3-45-111.27-118.27Q140-391.54 140-480q0-70.8 26.77-132.63t72.77-107.83q46-46 107.83-72.77Q409.2-820 480-820q118.61 0 208.81 71.42Q779-677.15 807.92-567.69Z\"/></svg>";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000"><path d="M480-333.85v-91.92q0-22.6 15.82-38.41Q511.63-480 534.23-480h91.92v47.69h-98.46v98.46H480ZM534.23-100q-22.6 0-38.41-15.82Q480-131.64 480-154.23v-91.92h47.69v98.46h98.46V-100h-91.92Zm278.08-233.85v-98.46h-98.46V-480h91.92q22.59 0 38.41 15.82Q860-448.37 860-425.77v91.92h-47.69ZM713.85-100v-47.69h98.46v-98.46H860v91.92q0 22.59-15.82 38.41Q828.36-100 805.77-100h-91.92Zm94.07-467.69h-62.23q-27.54-84.54-99.57-138.43Q574.08-760 480-760q-117 0-198.5 81.5T200-480q0 78.15 38.46 141.81 38.46 63.65 101.54 99.34V-360h60v220H180v-60h113.23q-69.3-45-111.27-118.27Q140-391.54 140-480q0-70.8 26.77-132.63t72.77-107.83q46-46 107.83-72.77Q409.2-820 480-820q118.61 0 208.81 71.42Q779-677.15 807.92-567.69Z"/></svg>';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.panzoom-toolbar {
|
|
2
|
+
position: absolute;
|
|
3
|
+
z-index: 10;
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 5px;
|
|
6
|
+
padding: 5px;
|
|
7
|
+
background: rgba(255, 255, 255, 0.5);
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
transition: opacity 0.2s ease-in-out;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
*:hover > .panzoom-toolbar {
|
|
13
|
+
opacity: 1 !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.panzoom-toolbar-top-right {
|
|
17
|
+
top: 10px;
|
|
18
|
+
right: 10px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.panzoom-toolbar-top-left {
|
|
22
|
+
top: 10px;
|
|
23
|
+
left: 10px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.panzoom-toolbar-bottom-right {
|
|
27
|
+
bottom: 10px;
|
|
28
|
+
right: 10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.panzoom-toolbar-bottom-left {
|
|
32
|
+
bottom: 10px;
|
|
33
|
+
left: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.panzoom-toolbar button {
|
|
37
|
+
width: 30px;
|
|
38
|
+
height: 30px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
border: 1px solid #ddd;
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
background-color: #fff;
|
|
43
|
+
padding: 0;
|
|
44
|
+
margin: 0;
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tsParser from '@typescript-eslint/parser';
|
|
3
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
files: ['src/**/*.{ts,css}'],
|
|
10
|
+
ignores: ['**/dist/**', '**/node_modules/**'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
globals: {
|
|
15
|
+
...globals.node,
|
|
16
|
+
...globals.browser,
|
|
17
|
+
},
|
|
18
|
+
parser: tsParser,
|
|
19
|
+
},
|
|
20
|
+
plugins: {
|
|
21
|
+
'@typescript-eslint': tseslint,
|
|
22
|
+
prettier: prettierPlugin,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
...js.configs.recommended.rules,
|
|
26
|
+
...tseslint.configs.recommended.rules,
|
|
27
|
+
'prettier/prettier': 'error',
|
|
28
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
29
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r74tech/docusaurus-plugin-panzoom",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A plugin to enable the panzoom component on SVG and other elements",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
"author": "r74tech",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsc",
|
|
19
|
-
"
|
|
18
|
+
"build": "tsc && npm run copy-assets",
|
|
19
|
+
"copy-assets": "mkdir -p dist/styles && cp -r src/styles/* dist/styles/",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"lint": "eslint 'src/**/*.{ts,css}' --report-unused-disable-directives --max-warnings 0",
|
|
22
|
+
"lint:fix": "eslint --fix 'src/**/*.{ts,css}'",
|
|
23
|
+
"format": "prettier --write --no-error-on-unmatched-pattern 'src/**/*.{ts,css}' --config ./.prettierrc"
|
|
20
24
|
},
|
|
21
25
|
"dependencies": {
|
|
22
26
|
"@docusaurus/utils-validation": "^3.7.0",
|
|
@@ -24,6 +28,8 @@
|
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
30
|
"@docusaurus/types": "^3.7.0",
|
|
31
|
+
"@eslint/compat": "^1.2.3",
|
|
32
|
+
"@eslint/js": "^9.14.0",
|
|
27
33
|
"@semantic-release/changelog": "^6.0.3",
|
|
28
34
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
29
35
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -32,10 +38,19 @@
|
|
|
32
38
|
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
33
39
|
"@tsconfig/docusaurus": "^1.0.7",
|
|
34
40
|
"@types/node": "^22.14.0",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
42
|
+
"@typescript-eslint/parser": "^8.13.0",
|
|
43
|
+
"eslint": "^9.14.0",
|
|
44
|
+
"eslint-config-prettier": "^9.1.0",
|
|
45
|
+
"eslint-plugin-prettier": "^5.5.1",
|
|
46
|
+
"globals": "^15.12.0",
|
|
47
|
+
"lint-staged": "^15.2.10",
|
|
48
|
+
"prettier": "^3.3.3",
|
|
35
49
|
"react": "^18.3.1",
|
|
36
50
|
"react-dom": "^18.3.1",
|
|
37
51
|
"semantic-release": "^24.2.3",
|
|
38
|
-
"typescript": "^4.9.5"
|
|
52
|
+
"typescript": "^4.9.5",
|
|
53
|
+
"typescript-eslint": "^8.13.0"
|
|
39
54
|
},
|
|
40
55
|
"release": {
|
|
41
56
|
"plugins": [
|
|
@@ -79,5 +94,10 @@
|
|
|
79
94
|
"type": "git",
|
|
80
95
|
"url": "git+https://github.com/r74tech/docusaurus-plugin-panzoom.git"
|
|
81
96
|
},
|
|
82
|
-
"sideEffects": false
|
|
97
|
+
"sideEffects": false,
|
|
98
|
+
"lint-staged": {
|
|
99
|
+
"src/**/*.{ts,css}": [
|
|
100
|
+
"prettier --write --no-error-on-unmatched-pattern --config ./.prettierrc"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
83
103
|
}
|